highcharts,双y轴数据对应问题,series设置yAxis属性


function chat1() {
$('#container1').highcharts({
credits: {
enabled: false
},
title: {
text: '大标题'
},
subtitle: {
text: '小标题'
},
xAxis: {
categories: categories,
crosshair: true
},
yAxis: [{ // 第一条Y轴
labels: {
format: '{value} 元',
style: {
color: Highcharts.getOptions().colors[1]
}
},
title: {
text: '金额(元)',
style: {
color: Highcharts.getOptions().colors[1]
}
},
opposite: true
}, { // 第二条Y轴
labels: {
format: '{value} 位',
style: {
color: Highcharts.getOptions().colors[0]
}
},
title: {
text: '人数(位)',
style: {
color: Highcharts.getOptions().colors[0]
}
}
}],
series: [{
type: 'column',
name: '金额1',
data: []
}, {
type: 'column',
name: '金额2',
data: []
}, {
type: 'spline',
name: '人数1',
yAxis: 1,
data: []
}, {
type: 'spline',
yAxis: 1,
name: '人数2',
data: []
}],
tooltip: {
shared: true,
pointFormatter: function () {
var html = this.series.name + ': ' + this.y.toFixed(2) + '<br/>';
return html;
}
}
});
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM