vue画图插件echarts
官网:echarts官网先安装npm install echarts --save到main.js引入import echarts from 'echarts'Vue.prototype.echarts = echarts然后就能使用了<div id="myEcharts" :style="{width: '400px', height: '400px',fontSize:'25px'}"&
·
官网: echarts官网
先安装
npm install echarts --save
到main.js引入
import echarts from 'echarts'
Vue.prototype.echarts = echarts
然后就能使用了
<div id="myEcharts" :style="{width: '400px', height: '400px',fontSize:'25px'}"></div>
mounted() {
this.drawing()
},
methods:{
drawing(){
this.echarts.init(document.getElementById('myEcharts')).setOption({
series: {
type: 'pie',
data: [
{name: '故障', value: 1},
{name: '正常', value: 2},
],
center: ['50%', '50%'],
grid:{left:'3%',right:'3%',bottom:'10%', containLabel:true},
itemStyle:{normal:{label:{
show: true, formatter: '{b}',textStyle:{fontSize : 16}
},color:function (params) {
var colorList = [
'red','#0bd687'
];
return colorList[params.dataIndex]
}
}}
}
});
}
}
更多推荐
已为社区贡献6条内容
所有评论(0)