//1、安装 ECharts npm install echarts --save //2、引入 ECharts import echarts from 'echarts'; //3、创建图表 let myChart = echarts.init(document.getElementById('myChart')); //4、设置图表选项和数据 let option = { title: { text: '示例图表' }, tooltip: {}, legend: { data:['访问量'] }, xAxis: { data: ["百度","谷歌","网易","QQ","淘宝","京东"] }, yAxis: {}, series: [{ name: '访问量', type: 'bar', data: [125, 220, 316, 120, 310, 320] }] }; //5、渲染图表 myChart.setOption(option);