安装echarts
npm install echarts -S
引入echarts 在main.js中
import echarts from 'echarts'
Vue.prototype.$echarts = echarts
HTML结构
<div id="main" style="width: 750px;height:400px;"></div>
js部分
export default {
name: "power",
data() {
return {
options: {
tooltip: {
trigger: "axis",
},
legend: {
data: ["总流量", "发送流量", "接收流量"],
},
grid: {
left: "10%",
right: "2%",
bottom: "3%",
containLabel: true,
},
xAxis: {
type: "category",
boundaryGap: false,
data: ["周一", "周二", "周三", "周四"