FusionCharts对excel文件的结果

我使用FusionCharts创build我的图表,但是我必须将它们导出为ex​​cel文件。 我该怎么做。 我的意思是从FusionCharts的ersult导出一个excel文件。

jQuery(window).load(function () { var chart1 = new FusionCharts({ "id":"ChartId1", "type": "mscolumn2d", "renderAt": "chartdiv21", "width": "650", "height": "400", "dataFormat": "json" }); chart1.setJSONUrl("#{request.contextPath}/faces/report/online.chart?info=20"); chart1.render("chartdiv21"); jQuery(this).everyTime(1800000, 'controlled', function () { updateChart('ChartId1', '#{request.contextPath}/faces/report/online.chart?info=20'); 

在通过setJSONUrl FusionCharts API方法设置的JSON数据源中,使用属性exportEnabled并将值设置为1。

渲染图表后,将启用导出选项,并select导出为xls选项。

请检查下面的代码片段。

 $("#chart-container").insertFusionCharts({ type: 'mscolumn2d', width: '100%', id: "mychart", height: '450', dataFormat: 'json', dataSource: { "chart": { "caption": "Comparison of Quarterly Revenue", "xAxisname": "Quarter", "yAxisName": "Revenues (In USD)", "numberPrefix": "$", "plotFillAlpha" : "80", "exportEnabled":"1", //Cosmetics "paletteColors" : "#0075c2,#1aaf5d", "baseFontColor" : "#333333", "baseFont" : "Helvetica Neue,Arial", "captionFontSize" : "14", "subcaptionFontSize" : "14", "subcaptionFontBold" : "0", "showBorder" : "0", "bgColor" : "#ffffff", "showShadow" : "0", "canvasBgColor" : "#ffffff", "canvasBorderAlpha" : "0", "divlineAlpha" : "100", "divlineColor" : "#999999", "divlineThickness" : "1", "divLineIsDashed" : "1", "divLineDashLen" : "1", "divLineGapLen" : "1", "usePlotGradientColor" : "0", "showplotborder" : "0", "valueFontColor" : "#ffffff", "placeValuesInside" : "1", "showHoverEffect" : "1", "rotateValues" : "1", "showXAxisLine" : "1", "xAxisLineThickness" : "1", "xAxisLineColor" : "#999999", "showAlternateHGridColor" : "0", "legendBgAlpha" : "0", "legendBorderAlpha" : "0", "legendShadow" : "0", "legendItemFontSize" : "10", "legendItemFontColor" : "#666666" }, "categories": [ { "category": [ { "label": "Q1" }, { "label": "Q2" }, { "label": "Q3" }, { "label": "Q4" } ] } ], "dataset": [ { "seriesname": "Previous Year", "data": [ { "value": "10000" }, { "value": "11500" }, { "value": "12500" }, { "value": "15000" } ] }, { "seriesname": "Current Year", "data": [ { "value": "25400" }, { "value": "29800" }, { "value": "21800" }, { "value": "26800" } ] } ], "trendlines": [ { "line": [ { "startvalue": "12250", "color": "#0075c2", "displayvalue": "Previous{br}Average", "valueOnRight" : "1", "thickness" : "1", "showBelow" : "1", "tooltext" : "Previous year quarterly target : $13.5K" }, { "startvalue": "25950", "color": "#1aaf5d", "displayvalue": "Current{br}Average", "valueOnRight" : "1", "thickness" : "1", "showBelow" : "1", "tooltext" : "Current year quarterly target : $23K" } ] } ] } }); 

另外确保添加FusionCharts jQuery插件使用下面给出的CDN链接

 http://static.fusioncharts.com/code/latest/fusioncharts.jqueryplugin.js