【问题标题】:Integrating FusionCharts with Metronic template将 FusionCharts 与 Metronic 模板集成
【发布时间】:2016-11-18 22:01:34
【问题描述】:

我正在尝试在 metronic 模板上显示融合图,但在集成后显示为空白页。

【问题讨论】:

  • 有代码示例吗?

标签: twitter-bootstrap-3 fusioncharts


【解决方案1】:

据我了解,metronic template 是一个模板引擎,适用于 Bootstrap 3.3.5 框架、jQuery 1.10.2 等等。我为您提供了一个使用 FusionCharts 和 bootstrap 的示例,看看它是如何工作的。检查这个fiddle 在此处尝试您的代码,看看它是否有效。

显示空白页的一个可能原因可能是脚本未按正确顺序加载。检查控制台,您可能会收到错误“FusionCharts is not defined”。

一个说明性的 JS sn-p 在 FusionCharts 中渲染折线图:

FusionCharts.ready(function () {
    var visitChart = new FusionCharts({
        type: 'msline',
        renderAt: 'chart-container',
        width: '550',
        height: '350',
        dataFormat: 'json',
        dataSource: {
            "chart": {
                "caption": "Number of visitors last week",
                "subCaption": "Bakersfield Central vs Los Angeles Topanga",
                "captionFontSize": "14",
                "subcaptionFontSize": "14",
                "subcaptionFontBold": "0",
                "paletteColors": "#0075c2,#1aaf5d",
                "bgcolor": "#ffffff",
                "legendBgColor": "#d9ffb3",
                "showBorder": "0",
                "showShadow": "0",
                "showCanvasBorder": "0",
                "usePlotGradientColor": "0",
                "legendBorderAlpha": "0",
                "legendShadow": "0",
                "showAxisLines": "0",
                "showAlternateHGridColor": "0",
                "divlineThickness": "1",
                "divLineIsDashed": "1",
                "divLineDashLen": "1",
                "divLineGapLen": "1",
                "xAxisName": "Day",
                "showValues": "0"               
            },
            "categories": [
                {
                    "category": [
                        { "label": "Mon" }, 
                        { "label": "Tue" }, 
                        { "label": "Wed" },
                        {
                            "vline": "true",
                            "lineposition": "0",
                            "color": "#6baa01",
                            "labelHAlign": "center",
                            "labelPosition": "0",
                            "label": "National holiday",
                            "dashed":"1"
                        },
                        { "label": "Thu" }, 
                        { "label": "Fri" }, 
                        { "label": "Sat" }, 
                        { "label": "Sun" }
                    ]
                }
            ],
            "dataset": [
                {
                    "seriesname": "Bakersfield Central",
                    "data": [
                        { "value": "15123" }, 
                        { "value": "14233" }, 
                        { "value": "25507" }, 
                        { "value": "9110" }, 
                        { "value": "15529" }, 
                        { "value": "20803" }, 
                        { "value": "19202" }
                    ]
                }, 
                {
                    "seriesname": "Los Angeles Topanga",
                    "data": [
                        { "value": "13400" }, 
                        { "value": "12800" }, 
                        { "value": "22800" }, 
                        { "value": "12400" }, 
                        { "value": "15800" }, 
                        { "value": "19800" }, 
                        { "value": "21800" }
                    ]
                }
            ], 
            "trendlines": [
                {
                    "line": [
                        {
                            "startvalue": "17022",
                            "color": "#6baa01",
                            "valueOnRight": "1",
                            "displayvalue": "Average"
                        }
                    ]
                }
            ]
        }
    }).render();
});

【讨论】:

    猜你喜欢
    • 2021-11-26
    • 1970-01-01
    • 2021-09-10
    • 2013-03-18
    • 1970-01-01
    • 2011-04-28
    • 1970-01-01
    • 2010-11-18
    • 2019-06-29
    相关资源
    最近更新 更多