0
我想在堆积的条形图上添加第二个y轴。 我想要Y轴对应于提供的类别。与多个yAxis的堆积条形图
的jsfiddle - http://jsfiddle.net/akshayasharma/qf3escqn/2/
$(function() {
Highcharts.chart('container', {
chart: {
zoomType: 'xy'
},
title: {
text: 'Average temperature and rainfall of first quarter'
},
subtitle: {
text: 'Source: WorldClimate.com'
},
xAxis: [{
categories: ['Rainfall', 'Temperature'],
crosshair: true
}],
yAxis: [{ // Primary yAxis
labels: {
format: '{value}°C',
style: {
color: Highcharts.getOptions().colors[1]
}
},
title: {
text: 'Temperature',
style: {
color: Highcharts.getOptions().colors[1]
}
}
}, { // Secondary yAxis
title: {
text: 'Rainfall',
style: {
color: Highcharts.getOptions().colors[0]
}
},
labels: {
format: '{value} mm',
style: {
color: Highcharts.getOptions().colors[0]
}
},
opposite: true
}],
tooltip: {
shared: true
},
legend: {
align: 'center',
verticalAlign: 'bottom',
backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
},
plotOptions: {
column: {
stacking: 'normal'
}
},
series: [{
name: 'Jan',
type: 'column',
data: [49.9, 7]
}, {
name: 'Feb',
type: 'column',
data: [71.5, 6.9]
}, {
name: 'Mar',
type: 'column',
data: [106.4, 9.5]
}]
});
});
以我上面的例子中,我想只有两个堆叠bars-一个表示降雨和另一个显示温度和应关联到不同的y轴这些堆积条形图。温度应该遵循主要y轴(标记为℃),降雨应该关注次要y轴(标记为mm)。
每个堆栈将显示对应各月的降雨/温度的值。
有人可以告诉我如何分配yAxis的降雨量和温度。 因为我有系列数据作为月份(1月,2月和3月)的系列数据的阵列,而我希望我的yaxis特定于提供降雨和温度类别。
感谢morganfree。它帮助了我。 –
如果它解决了你的问题,那么接受我的答案,这样问题就不会保持“开放”。 – morganfree