我正在使用Fusionchart XT,它应该生成一个javaScript,后者会生成一个图表。
这是第一个正在运行的脚本:
<!-- Using ASP.NET FusionCharts Wrapper and JavaScript rendering --><!-- START Script Block for Chart Kund_Sprache -->
<div id='Kund_Sprache_div' >
Chart...
</div>
<script type="text/javascript">
FusionCharts && FusionCharts.ready(function () {
if (FusionCharts("Kund_Sprache") ) FusionCharts("Kund_Sprache").dispose();
var chart_Kund_Sprache = new FusionCharts({
"width" : "50%",
"height" : "100% ",
"id" : "Kund_Sprache",
"type" : "Pie2D",
"dataSource" : "<chart logoURL='coins.png' caption='Sprache' showvalues='1' showlabels='0' showlegend='1' legendborder='0' legendposition='right' theme='flat'><set label='DE' value='239'/><set label='FR' value='50'/><set label='IT' value='60'/><set label='EN' value=70'/></chart>",
"dataFormat" : "xml",
"renderAt" : "Kund_Sprache_div",
}).render();
});
</script>
<!-- END Script Block for Chart Kund_Sprache -->
然后,我得到了第二个,它不起作用,只显示“ Chart ...”:
<!-- Using ASP.NET FusionCharts Wrapper and JavaScript rendering --><!-- START Script Block for Chart Kund -->
<div id='Kund_div' >
Chart...
</div>
<script type="text/javascript">
FusionCharts && FusionCharts.ready(function () {
if (FusionCharts("Kund") ) FusionCharts("Kund").dispose();
var chart_Kund = new FusionCharts({
"width" : "50%",
"height" : "100%",
"id" : "Kund",
"type" : "Pie2D",
"dataSource" : "<chart showvalues='1' caption='Kund' showlabels='0' showlegend='1' legendborder='0' legendposition='right' theme='flat'><set label='1 St' value='26'/><set label='2 St' value='41'/><set label='3 St' value='9'/></chart>",
"dataFormat" : "xml",
"renderAt" : "Kund_div",
}).render();
});
</script>
<!-- END Script Block for Chart Kund -->
有人看到差异吗?还是为什么在第二个脚本中不执行javascript? (仅显示第一个div)
最佳答案
我忘了在head标签内链接FusionChart脚本:
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
<script src="/Fusioncharts/fusioncharts.js"></script>
<script src="/Fusioncharts/themes/fusioncharts.theme.flat.js"></script>
</asp:Content>