记录一下echarts表格属性 重点是y轴属性名的调整
var option = { title: {
text: "日生产曲线"
},
color: colors,
tooltip: { //辅助线
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
grid: { //图的上下左右边距
x: 50,
y: 100,
x2: "25%",
y2: 100,
borderWidth: 10
},
xAxis: {
type: 'category',
data: this.dayLine
},
yAxis:
{
//日产油
type: 'value',
name: `日\n产\n油\n(t)`,//es6字符串写法 加上下面的name设置可以让y轴刻度命垂直
nameRotate: 360,
nameGap: 30,
nameLocation: 'middle',
boundaryGap: false,
axisLine: { //刻度样式
lineStyle: {
color: colors[0],
}
}
},
series: {
data: this.dayOil,
name: '日产油',
type: 'line',
smooth: true, // 小圆点的显示
yAxisIndex: 0, //对应的y轴索引
lineStyle: {
normal: {
color: colors[0],
width: 4
}
},
markPoint: {
label: {
normal: {
show: false,
position: 'right',
fontSize: 14
}
},
}
}
}