<div
v-for="(item, index) in picturelist"
:key="index"
>
<div v-show="item.show">
<p>{{ item.title}}</p>
<div :id="'moreChart' + index" ></div>
</div>
</div>
import echarts from "echarts";
for (var i = 0; i < this.picturelist.length; i++) {
let echars = document.getElementById("moreChart" + i);
this.chart = echarts.init(echars);
this.chart.setOption(this.picturelist[i].option);
}
//option 的内部结构根据想要画的图来定 (柱状图如下)
option: {
title: {
text: "Biu~简单柱状图示例",
},
tooltip: {},
legend: {
data: ["销量"],
},
xAxis: {
data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"],
},
yAxis: {},
series: {
name: "销量",
type: "bar",
// data:[6,100,200,800,900,300],
data: [5, 20, 36, 10, 10, 20],
color: ["#66FF99"],
},
},
echarts 如何通过id同时画多个图
最新推荐文章于 2024-02-17 17:22:44 发布