1.折线图位置

注意必须给高度
2..初始化引入

import echarts from “echarts”;

this.$nextTick().then(() => {
this.initEcharts();
});
3.函数体
_setOption(chartData) {<br /> _this_.mycharts.setOption({<br /> // title: {<br /> // text: '商品价格变动图',<br /> // left: '16'<br /> // },<br /> tooltip: {<br /> trigger: "axis",<br /> axisPointer: {<br /> type: "cross",<br /> label: {<br /> background: "#6a7985",<br /> },<br /> },<br /> },<br /> grid: {<br /> left: "20",<br /> right: "20",<br /> bottom: "30",<br /> containLabel: true,<br /> },<br /> active: 0,<br /> legend: {<br /> data: ["浏览PV", "浏览UV", "完成人数", "发放积分", "转发次数"],<br /> bottom: -5,<br /> left: 30,<br /> },<br /> xAxis: [<br /> {<br /> type: "category",<br /> boundaryGap: true, //这个属性可以让x轴空出一格<br /> data: _this_.dataObj2.statisticsDate,<br /> },<br /> ],<br /> yAxis: [<br /> {<br /> type: "value",<br /> boundaryGap: [0, "100%"],<br /> },<br /> ],<br /> series: [<br /> {<br /> name: "浏览PV",<br /> type: "line",itemStyle: {//背景颜色<br /> color: "rgb(255, 70, 131)",<br /> },<br /> lineStyle: { //字体颜色<br /> color: "rgb(255, 70, 131)",<br /> },<br /> smooth: false, //是否每一级会叠加<br /> data: _this_.dataObj2.notesPv,<br /> animationDuration: 2800,<br /> animationEasing: "quadraticOut",<br /> },
{
name: “活动PV”,
type: “line”,
smooth: true,
areaStyle: {},
color: “#7F85E9”,
data: activityPv,
},
],
});
},
