简体   繁体   English

Lucee 5.3.8 CFChart URL 禁用

[英]Lucee 5.3.8 CFChart URL Disable

Lucee CFChart type pie from query markup:来自查询标记的 Lucee CFChart 类型饼图:

<cfchart chartheight="600" chartwidth="800" showborder="true" title="Levels">
<cfchartseries query="#layout.querymap[layout.QueryName]#" type="pie" itemcolumn="Title" valuecolumn="Amount" />
</cfchart>

creates this HTML:创建此 HTML:

<map id="chart_8" name="chart_8">
<area shape="poly" coords="211,170,225,147,242,126,262,108,284,93,307,80,333,71,359,66,386,64,386,263,386,263" title="84000" alt="" href="#?series=0&category=xxxx&value=84000.0"/>
<area shape="poly" coords="176,278,178,254,182,230,189,208,199,186,374,278,374,278" title="37500" alt="" href="#?series=0&category=xxxx&value=37500.0"/>
<area shape="poly" coords="275,468,254,453,235,436,218,416,204,395,193,372,185,348,180,323,179,297,377,297,377,297" title="80000" alt="" href="#?series=0&category=xxxx&value=80000.0"/>
<area shape="poly" coords="516,471,491,487,465,498,437,505,409,509,380,508,352,503,325,494,299,481,401,310,401,310" title="90000" alt="" href="#?series=0&category=xxxx&value=90000.0"/>
<area shape="poly" coords="610,359,598,388,581,416,561,440,536,461,420,300,420,300" title="50000" alt="" href="#?series=0&category=xxxx&value=50000.0"/>
<area shape="poly" coords="588,168,600,188,610,208,617,229,621,251,623,273,623,296,620,318,614,340,425,281,425,281" title="70000" alt="" href="#?series=0&category=xxxx&value=70000.0"/>
<area shape="poly" coords="412,63,436,65,459,69,482,76,504,86,524,99,543,113,560,130,575,149,412,262,412,262" title="75000" alt="" href="#?series=0&category=xxxx&value=75000.0"/>
</map><img border="0" usemap="#chart_8" src="/lucee/graph.cfm?img=f09a50705458509f66c5f37628f0bdea&type=png">

I want the static image alone;我只想要 static 图像; no href links, no area tags, no map tags.没有href链接,没有区域标签,没有map标签。

An empty url attribute doesn't work;空的 url 属性不起作用; a documentation search was futile.文件搜索是徒劳的。

Use the source attribute of cfchart .使用cfchartsource属性。 It will store the src attribute of the generated image in the specified variable.它将生成图像的src属性存储在指定的变量中。

<cfchart source="myChartImage" ...>
  <cfchartseries ...>
</cfchart>

<cfdump var="#myChartImage#">

Using your example, myChartImage would be a string with a value of /lucee/graph.cfm?img=f09a50705458509f66c5f37628f0bdea&type=png .使用您的示例, myChartImage将是一个值为/lucee/graph.cfm?img=f09a50705458509f66c5f37628f0bdea&type=png的字符串。

If you want to store the generated chart image as an actual file without calling /lucee/graph.cfm , you need to request the URI via cfhttp using the getAsBinary attribute and retrieve the data as byte array.如果您想在不调用/lucee/graph.cfm的情况下将生成的图表图像存储为实际文件,则需要使用getAsBinary属性通过cfhttp请求 URI,并将数据检索为字节数组。 You can then write it to disk or encode it as base64 or hex etc.然后,您可以将其写入磁盘或将其编码为 base64 或十六进制等。

@Alex - thank you: This produces bare img tag I want: @Alex - 谢谢:这会产生我想要的裸 img 标签:

<cfchart chartheight="600" chartwidth="800" showborder="true" title="Levels" source="imagesource">
<cfchartseries query="#layout.querymap[layout.QueryName]#" type="pie" itemcolumn="Title" valuecolumn="DonationAmount" />
</cfchart><cfoutput>
<img src="#imagesource#">
</cfoutput>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM