我正在尝试在metronic模板上显示融合图表,但是在集成它之后显示一个空白页面。
答案 0 :(得分:0)
据我所知,metronic template是一个模板引擎,工作于Bootstrap 3.3.5 Framework,jQuery 1.10.2等等。我为您提供了一个使用FusionCharts和bootstrap的示例,看看它是如何工作的。检查一下fiddle在这里试试你的代码,看它是否有效。
显示空白页面的一个可能原因可能是脚本未按正确顺序加载。检查控制台,您可能会收到错误“FusionCharts未定义”。
用于在FusionCharts中呈现折线图的说明性JS片段:
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();
});