2017-05-01 3 views
0

私はFusionChartsを使用してグラフを作成しますが、Excelファイルにエクスポートする必要があります。どうすればいいの?私の主張は、FusionChartsのersultからExcelファイルをエクスポートすることです。 setJSONUrl FusionChartsのAPIメソッドを介して設定JSONデータソースでFusionChartsの結果をファイルに変換する

  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');  

答えて

2

属性を使用をexportEnabledとエクスポートオプションチャートをレンダリングした後1.

として値を設定するには、有効になっており、オプションのエクスポートを選択することになります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 
を使用追加することを確認
関連する問題