<div id="main" style="width: 600px;height:400px;"></div>
//2.为echarts准备一个具备宽高的DOM
//1.导入echarts
import * as echarts from 'echarts'
//3.在mounted函数中,基于准备好的DOM,初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
//4.准备数据和配置项
varoption = {
title:{
text:'ECharts 数据统计'
},
tooltip:{},
legend:{
data:['用户来源']
},
xAxis:{
data:["Android","IOS","PC","Ohter"]
},
yAxis:{},
series:[{
name:'访问量',
type:'line',
data:[500,200,360,100]
}]
};
//5.展示数据
myChart.setOption(option);
网友评论