效果图
双y轴折线图设置背景色主要是在series设置areaStyle
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(
0, 0, 0, 1,
[
{ offset: 0, color: "rgba(0,0,128,0.5)" },
{ offset: 0.5, color: "rgba(0,0,128,0.3)" },
{ offset: 1, color: "rgba(0,0,128,0.1)" },
]
)
}
},
完整代码
!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>ECharts</title>
<!-- 引入刚刚下载的 ECharts 文件 -->
<script src="../lib/echarts.min.js"></script>
</head>
<body>
<!-- 为 ECharts 准备一个定义了宽高的 DOM -->
<div id="main" style="width: 600px;hei