【问题标题】:Lucee 5.3.8 CFChart URL DisableLucee 5.3.8 CFChart URL 禁用
【发布时间】:2022-12-23 06:07:18
【问题描述】:

来自查询标记的 Lucee CFChart 类型饼图:

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

创建这个 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">

我只想要静态图像;没有 href 链接,没有区域标签,没有地图标签。

空的 url 属性不起作用;文档搜索是徒劳的。

【问题讨论】:

    标签: coldfusion lucee cfchart


    【解决方案1】:

    使用 cfchartsource 属性。它将生成图像的src属性存储在指定的变量中。

    <cfchart source="myChartImage" ...>
      <cfchartseries ...>
    </cfchart>
    
    <cfdump var="#myChartImage#">
    

    使用您的示例,myChartImage 将是一个值为 /lucee/graph.cfm?img=f09a50705458509f66c5f37628f0bdea&amp;type=png 的字符串。

    如果您想在不调用/lucee/graph.cfm 的情况下将生成的图表图像存储为实际文件,则需要使用getAsBinary 属性通过cfhttp 请求URI,并将数据检索为字节数组。然后您可以将其写入磁盘或将其编码为 base64 或 hex 等。

    【讨论】:

      【解决方案2】:

      @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>
      

      【讨论】:

        猜你喜欢
        • 2012-02-01
        • 2015-11-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多