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