let xLabel = ["2021年", "2025年", "2030年", "2060年"]; let dataValue = [2, 5, 3, 1]; let dataValue1 = [7, 4, 9, 1]; let option = { color: ["#ff974c", '#00eaff'], backgroundColor: '#0c2d55', tooltip: { trigger: 'axis', axisPointer: { lineStyle: { color: 'rgb(126,199,255)', }, }, }, legend: { show: true, top: '2%', icon: "roundRect", itemWidth: 30, // 图例标记的图形宽度。 itemHeight: 2, // 图例标记的图形高度。 textStyle: { color: '#fff', fontSize: 14, padding: [0, 8, 0, 8] } }, grid: { top: '10%', left: '10%', right: '5%', bottom: '10%', }, xAxis: [ { type: 'category', axisLine: { //坐标轴轴线相关设置。数学上的x轴 show: true, lineStyle: { color: 'rgb(41,188,245)', }, }, axisLabel: { //坐标轴刻度标签的相关设置 textStyle: { color: '#FFFFFF', fontSize: 12, }, }, splitLine: { show: false, lineStyle: { color: '#233653', }, }, axisTick: { show: false, }, data: xLabel, }, ], yAxis: [ { name: "", nameTextStyle: { color: "#fff", fontSize: 12, padding: [0, 60, 0, 0] }, // minInterval: 1, type: 'value', splitLine: { show: true, lineStyle: { color: '#1160a0', type: 'dashed' }, }, axisLine: { show: true, lineStyle: { color: '#008de7', }, }, axisLabel: { show: true, textStyle: { color: '#fff', fontSize: 14 } }, axisTick: { show: false, }, }, ], series: [ { name: '基准情景值', type: 'line', symbol: 'circle', // 默认是空心圆(中间是白色的),改成实心圆 lineStyle: { normal: { width: 2, color: '#ff974c', // 线条颜色 }, }, itemStyle: { normal: { label: { show: true, //开启显示 color: '#fff', position: 'top', //在上方显示 formatter: function (res) { if (res.value) { return res.value } else { return 0 } }, }, }, }, symbolSize: 0, //设定实心点的大小 areaStyle: { normal: { //线性渐变,前4个参数分别是x0,y0,x2,y2(范围0~1);相当于图形包围盒中的百分比。如果最后一个参数是‘true’,则该四个值是绝对像素位置。 color: new echarts.graphic.LinearGradient( 0, 0, 0, 1, [ { offset: 0, color: '#ff974c30', }, { offset: 0.6, color: '#ff974c20', }, { offset: 1, color: '#ff974c10', }, ], false ), }, }, data: dataValue, }, { name: '强化情景值', type: 'line', symbol: 'circle', // 默认是空心圆(中间是白色的),改成实心圆 lineStyle: { normal: { width: 2, color: '#00eaff', // 线条颜色 }, }, itemStyle: { normal: { label: { show: true, //开启显示 color: '#fff', position: 'bottom', //在上方显示 formatter: function (res) { if (res.value) { return res.value } else { return 0 } }, }, }, }, symbolSize: 0, //设定实心点的大小 areaStyle: { normal: { //线性渐变,前4个参数分别是x0,y0,x2,y2(范围0~1);相当于图形包围盒中的百分比。如果最后一个参数是‘true’,则该四个值是绝对像素位置。 color: new echarts.graphic.LinearGradient( 0, 0, 0, 1, [ { offset: 0, color: '#00eaff30', }, { offset: 0.6, color: '#00eaff20', }, { offset: 1, color: '#00eaff10', }, ], false ), }, }, data: dataValue1, } ] }