1

如何显示带有值的 %。labelForms="percent" 似乎不起作用,将其添加到项目中很笨拙,我是否缺少格式化它的方法?:

<CFSET PercentLocked = 0>
<cfset PercentUnlocked = 0>
<cfset PercentOpenQueries = 0>
<cfset PercentOpenErrors = 29>
<cfset PercentClean = 71>

<cfchart    
    type="pie"                                          
    chartWidth="800"  
    show3d="true"
    font="times"
    style="blue"
    labelformat="percent">
    <cfchartseries >    
        <cfchartdata item="Locked Forms (#Percentlocked#%)" value="#PercentLocked#" > 
        <cfchartdata item="unLocked Forms (#PercentUnlocked#%)" value="#PercentUnlocked#">  
        <cfchartdata item="Forms w/Open Queries (#PercentOpenQueries#%) " value="#PercentOpenQueries#"> 
        <cfchartdata item="forms w/Errors  (#PercentOpenErrors#%) " value="#PercentOpenErrors#">
        <cfchartdata item="Clean forms (#PercentClean#%)" value = "#PercentClean#">
    </cfchartseries>
</cfchart>

饼形图

4

1 回答 1

0

谷歌搜索导致了这个涉及“情节”属性的 ZingChart 示例。根据ZingChart 饼图文档,支持使用多个“标记”来自定义显示的文本/值

  • %npv- 饼图切片(节点)相对于整个饼图(所有节点的总和)的百分比值
  • %t- 当前情节的文本,从情节/系列对象中的文本属性中提取

此示例同时显示项目文本和值(以百分比形式):

TryCF.com 示例

<cfset plot = { "value-box":{
      "visible":true,
      "placement":"out",
      "text":"%t (%npv%)"
    }}>

<cfchart    
    type="pie"                                          
    chartWidth="800"  
    show3d="true"
    font="times"
    style="blue"
    plot="#plot#">
    <cfchartseries >    
        <cfchartdata item="Locked Forms" value="0" > 
        <cfchartdata item="UnLocked Forms" value="0">  
        <cfchartdata item="Forms w/Open Queries" value="0"> 
        <cfchartdata item="forms w/Errors" value="29">
        <cfchartdata item="Clean Forms" value = "71">
    </cfchartseries>
</cfchart>

带标签的饼图

于 2021-10-08T16:43:18.947 回答