echarts双Y折线图随机实例
时间: 2023-10-17 08:06:38 浏览: 31
好的,以下是一个随机生成数据的双Y折线图实例:
```
var option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
legend: {
data:['蒸发量','降水量','平均温度']
},
xAxis: {
type: 'category',
data: ['周一','周二','周三','周四','周五','周六','周日']
},
yAxis: [
{
type: 'value',
name: '蒸发量',
min: 0,
max: 250,
axisLabel: {
formatter: '{value} ml'
}
},
{
type: 'value',
name: '降水量',
min: 0,
max: 250,
axisLabel: {
formatter: '{value} ml'
}
},
{
type: 'value',
name: '平均温度',
min: 0,
max: 25,
axisLabel: {
formatter: '{value} °C'
}
}
],
series: [
{
name:'蒸发量',
type:'bar',
data:[72, 91, 142, 178, 135, 104, 70]
},
{
name:'降水量',
type:'bar',
yAxisIndex: 1,
data:[112, 145, 189, 207, 176, 136, 92]
},
{
name:'平均温度',
type:'line',
yAxisIndex: 2,
data:[18, 19, 20, 22, 22, 21, 20]
}
]
};
```
这个实例中,我们使用了echarts的bar和line系列进行了绘制。同时使用了两个yAxis来展示不同的量纲。具体细节可以查看echarts的官方文档。