首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >FusionCharts到excel文件的结果

FusionCharts到excel文件的结果
EN

Stack Overflow用户
提问于 2017-05-01 14:01:39
回答 1查看 48关注 0票数 0

我使用FusionCharts创建我的图表,但我必须将它们导出到excel文件中。我该怎么做呢。我的观点是从FusionCharts的ersult中导出一个excel文件。

代码语言:javascript
复制
            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');       
EN

回答 1

Stack Overflow用户

发布于 2017-05-03 19:23:52

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

在呈现图表之后,将启用导出选项,并选择导出为xls选项。

请检查以下代码片段。

代码语言:javascript
复制
$("#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"
                        }
                    ]
                }
            ]
        }
});

还要确保使用以下给定的CDN链接添加FusionCharts jQuery插件

代码语言:javascript
复制
http://static.fusioncharts.com/code/latest/fusioncharts.jqueryplugin.js
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43714962

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档