如何在Fusion Chart中显示带有图例的总值

时间:2014-01-07 11:01:11

标签: fusioncharts

通过使用Fusion Chart我可以在阅读融合图表提供的文档后显示2d圆环图,但在下面的代码中,我在左侧使用图例,我希望在图例下方显示相关数据标签即可。

例如,此代码中的标签为Electric Power Generation,其值为20,因此我希望在图例标签下方显示20。

如果有可能,请告诉我如何做到这一点。

<html>
  <head>        
    <title>My First chart using FusionCharts - Using JavaScript</title>         
    <script type="text/javascript" src="FusionCharts.js"></script>
  </head>   
  <body>     
    <div id="chartContainer">FusionCharts XT will load here!</div>   
     <div id="chartContainer1" style="margin-left: 50%;
margin-right: 10%;
margin-top: -22%;">FusionCharts XT will load here!</div>   
    <script type="text/javascript"><!--

      var myChart = new FusionCharts( "Doughnut2D.swf", 
                    "myChartId", "500", "300",  "0", "0");
var dataString ='<chart caption="View Indusries" showLabels="0" showValues="0" showLegend="1"  legendPosition="RIGHT" chartrightmargin="40" bgcolor="ECF5FF" bgalpha="70" bordercolor="C6D2DF"\n\
 basefontcolor="2F2F2F" basefontsize="11" showpercentvalues="1" bgratio="0" startingangle="200" animation="1">\n\
 <set value="20" label="Electric Power Generation" color="005C8E"/>\n\
 <set value="32" label="Industrial Processes" color="00759B"/>\n\
 <set value="12" label="Residential and Commercial Activities" color="0296D2"/>\n\
 <set value="20" label="Agriculture" color="40C7F9"/>\n\
 <set value="2" label="Waste Disposal" color="00496C"/>\n\
 </chart>';
  myChart.setXMLData( dataString );
 myChart.render("chartContainer"); 

    // -->  
    </script>      
  </body> 
</html>

1 个答案:

答案 0 :(得分:0)

我得到了下面给出的解决方案

var toalval = 20000;
<set value="20" label="Electric Power Generation \r\ '+dsa+'" displayValue="Electric Power Generation" color="005C8E"/>\n\