echarts 曲线图带水平线

应用echarts 绘制带有平均值的曲线,…直接上代码
<div ref="echartstopref" style="width: 100%; height: 50%"></div>
const myechartstop = ref(null);
onMounted(() => {
myechartstop.value = markRaw(echarts.init(echartstopref.value));
echartstopInfo();
});
const echartstopInfo = () => {
optiontopInfo();
window.addEventListener("resize", () => {
myechartstop.value.resize();
});
};
const optiontopInfo = () => {
myechartstop.value.setOption({
title: [
{
text: "某某平均借出时长",
top: 16,
left: 15,
textStyle: {
fontSize: 18,
color: "#000",
fontWeight: "600",
},
},
{
text: `${dataday.value}天`,
top: "55%",
left: 16,
textStyle: {
fontSize: 15,
color: "#434343",
fontWeight: "600",
},
},
],
grid: {
top: "40%",
left: "25%",
right: "10%",
bottom: "-10%",
containLabel: true,
},
xAxis: {
type: "category",
show: false,
boundaryGap: false,
},
yAxis: {
type: "value",
show: false,
},
series: [
{
type: "line",
smooth: true,
symbol: "none",
data: datatop.value,
silent: true,
itemStyle: {
color: "#7863FF",
},
markLine: {
symbol: ["none"],
show: false,
data: [
{
type: "average",
label: {
show: false,
},
lineStyle: {
type: "solid",
color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
{ offset: 0, color: "rgba(2, 182, 169, 0)" },
{ offset: 0.5, color: "rgba(2, 182, 169, 0.5)" },
{ offset: 1, color: "rgba(2, 182, 169, 0)" },
]),
width: 15,
},
},
{
type: "average",
label: {
show: false,
},
lineStyle: {
type: "solid",
color: "#02B6A9",
width: 1,
shadowColor: "rgba(2, 182, 169, 1)",
shadowBlur: 10,
shadowOffsetX: 1,
shadowOffsetY: 1,
},
},
],
},
},
],
});
};