var AlarmChart = null; function alarmChartReBuild(totalNum, alarmNum) { var alarmPart = (alarmNum * 100.0) / (totalNum * 1.0); var isSliced = 1; if (alarmPart == 0) { isSliced = 0; } var chartdata = alarmChartBuild(100 - alarmPart, alarmPart, isSliced); AlarmChart.setChartData(chartdata, "json"); } function init_AlarmChart() { var chartdata = alarmChartBuild(100, 0, 0); FusionCharts.ready(function() { AlarmChart = new FusionCharts({ type: "doughnut3d", renderAt: "chart-container", "100%", height: "100%", dataFormat: "json", dataSource: chartdata }); //AlarmChart.setTransparent();//背景透明 设置上这个 AlarmChart.render(); }); } function alarmChartBuild(normalPart, alarmPart, isSliced) { return { "chart": { "caption": "综合运行率", "numberPrefix": "%", //"bgAlpha": "0,0", //"canvasBgAlpha": "0", "skipOverlapLabels": "0", "startingAngle": "15", "showLegend": "1", "defaultCenterLabel": "Total revenue: $64.08K", "centerLabel": "Revenue from $label: $value", "centerLabelBold": "1", "showTooltip": "0", "decimals": "0", "paletteColors": "#1aaf5d,#f45b00,#0075c2,#f2c500,#8e0000", "theme": "fusion" }, "data": [{ "label": "正常", "value": normalPart }, { "label": "异常", "isSliced": isSliced, "value": alarmPart }] }; }
两个好用的网址:
FusionCharts使用教程:Fusioncharts API参考方法(Functions)总结
https://www.ev我的get.com/article/2014/5/9/20959.html
FusionCharts的使用方法(超详细)
http://www.cnblogs.com/aspphp/p/6209286.html