npm install --save echarts
import echartsfrom 'echarts';
<div id="main"ref="myEchart" :style="{width:'600px',height:'400px'}"></div>
data () {
return {
chart:null,
}
}
mounted (){
//var myChart = echarts.init(document.getElementById('main'));
this.initChart();
},
methods: {
initChart() {
console.log('pou');
this.chart =echarts.init(this.$refs.myEchart);
this.chart.setOption({
title: { text:'图表示例' },
tooltip: {},
xAxis: {
data: ["2017-03","2017-04","2017-05","2017-06","2017-07","2017-08"]
},
yAxis: {},
series: [{
name: '销量',
type: 'bar',
data: [15,80,76, 10, 210, 20],
}],
});
}
}
import echartsfrom 'echarts';
<div id="main"ref="myEchart" :style="{width:'600px',height:'400px'}"></div>
data () {
return {
chart:null,
}
}
mounted (){
//var myChart = echarts.init(document.getElementById('main'));
this.initChart();
},
methods: {
initChart() {
console.log('pou');
this.chart =echarts.init(this.$refs.myEchart);
this.chart.setOption({
title: { text:'图表示例' },
tooltip: {},
xAxis: {
data: ["2017-03","2017-04","2017-05","2017-06","2017-07","2017-08"]
},
yAxis: {},
series: [{
name: '销量',
type: 'bar',
data: [15,80,76, 10, 210, 20],
}],
});
}
}