// 必须引入 vue-fusioncharts 和 fusioncharts
import VueFusionCharts from 'vue-fusioncharts';
import FusionCharts from 'fusioncharts/core';
// 可选,引入扁平画主题
import FusionTheme from 'fusioncharts/themes/es/fusioncharts.theme.fusion'
// 想显示图形,必须引入图形类型模块。
// 比如饼状图如下
import Pie2D from 'fusioncharts/viz/pie2d';
import Column2D from 'fusioncharts/fusioncharts.charts';
Vue.use(VueFusionCharts, FusionCharts,FusionTheme,Pie2D ,Column2D); // 添加多个类型图形,就在后面添加上。
按照文档中引入 中间有一步 import FusionCharts from 'fusioncharts/core'; core这个有人说要带上 官网上没有带上
<div id="chart-container">
<fusioncharts
:type="type"
:width="width"
:height="height"
:dataformat="dataformat"
:datasource="datasource"
>
</fusioncharts>
</div>
return {
type: 'pie2d', // 记住此类型需要在 main.js 内进行添加上
width: '550',
height: '350',
dataFormat: 'json',
dataSource: {
"chart": {
"caption": "Split of revenue by product categories",
"subCaption": "Last year",
"numberPrefix": "$",
"showPercentInTooltip": "0",
"decimals": "1",
"useDataPlotColorForLabels": "1",
//Theme
"theme": "fusion"
},
"data": [{
"label": "Food",
"value": "285040"
}, {
"label": "Apparels",
"value": "146330"
}, {
"label": "Electronics",
"value": "105070"
}, {
"label": "Household",
"value": "49100"
}]
}
}
数据都是跟着来的 但是图表没有出来 而且出现死循环
下面是地址
https://www.fusioncharts.com/...