highcharts两个(Y)轴的混合图

作者:朋克周 | 创建时间: 2023-03-26
利用highcharts图表画多个坐标轴,首先配置两个Y轴的参数,再配置对应的数据集...
highcharts两个(Y)轴的混合图

操作方法

yAxis: [{ //第一个Y轴,序号为0 labels: { format: '{value}°C', style: { color: '#89A54E' } }, title: { text: 'Temperature', style: { color: '#89A54E' } } }, { //第二个Y轴,序号为1 title: { text: 'Rainfall', style: { color: '#4572A7' } }, labels: { format: '{value} mm', style: { color: '#4572A7' } }, opposite: true }],

series: [{ //第二个Y轴的数据 name: 'Rainfall', color: '#4572A7', type: 'column', yAxis: 1,//坐标轴序号 data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4], tooltip: { valueSuffix: ' mm' } }, { //第一个Y轴的数据 name: 'Temperature', color: '#89A54E', type: 'spline', data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6], tooltip: { valueSuffix: '°C' } }]

点击展开全文

更多推荐