var myChart = echarts.init(document.getElementById('zhexian'));
option = {
// title: {
// text: '最新价格'
// },
tooltip: {
trigger: 'axis'
},
legend: {
data: ['沪铝', '长江', '伦铝']
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: {
type: 'category',
boundaryGap: false,
data: data.time
},
yAxis: [
{
type: 'value',
min: function(value) {
return 10000;
},
axisLabel : {
show:true,
showMinLabel:true,
showMaxLabel:true,
formatter: function (value) {
return "¥"+value/1000+"k";
}
}
},
{
type: 'value',
min: function(value) {
return 1000;
},
axisLabel : {
show:true,
showMinLabel:true,
showMaxLabel:true,
formatter: function (value) {
return "$"+value/1000+"k";
}
}
}
],
series: [{
name: '沪铝',
type: 'line',
yAxisIndex: 0,
data: data.num3
},
{
name: '长江',
type: 'line',
yAxisIndex: 0,
data: data.num4
},
{
name: '伦铝',
type: 'line',
yAxisIndex: 1,
data: data.num5
},
]
};
myChart.setOption(option);
echarts 双y轴
最新推荐文章于 2024-05-22 09:23:54 发布