You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. I wanted to create a graph with 3 different yAxis and saw that highcharts has this feature (https://www.highcharts.com/demo/highcharts/combo-multi-axes) by using yAxis = 0, yAxis = 1, yAxis =2, ... but it was not working in the skin. Setting yAxis to anything over 1 seemed to be ignored. After some probing, I found that this was hardcoded in belchertown.js.tmpl. I made some minor modifications and now have multiple yAxis working. I'm not a coder and not sure if my method was correct so posting it here in case anyone wants to fix it, use it, or incorporate it into the next release. In this snippet, I made 3 small changes:
line 2350: return item.yAxis == 1 changed to return item.yAxis >= 1
line 2354: if (s.yAxis == "1") changed to if (s.yAxis >= "1")
line 2364: s.yAxis = 1 changed to s.yAxis = s.yAxis
` // Find if any series have yAxis = 1. If so, save the array number so we can set labels correctly.
// We really care if yAxis is in array 1+, so we can go back and set yAxis 0 to the right label.
var yAxis_index = options.series.findIndex(function(item) {return item.yAxis >= 1})
// Handle series specific data, overrides and non-Highcharts options that we passed through
options.series.forEach(s => {
if (s.yAxis >= "1") {
// If yAxis = 1 is set for the observation, add a new yAxis and associate that observation to the right side of the chart
yAxis1_active = true;
options.yAxis.push({ // Secondary yAxis
opposite: true,
title: {
text: s.yAxis_label,
},
}),
// Associate this series to the new yAxis 1
s.yAxis = s.yAxis
`
Hope this is helpful! The graph now has one axis on the left and two on the right and looks like this:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi. I wanted to create a graph with 3 different yAxis and saw that highcharts has this feature (https://www.highcharts.com/demo/highcharts/combo-multi-axes) by using yAxis = 0, yAxis = 1, yAxis =2, ... but it was not working in the skin. Setting yAxis to anything over 1 seemed to be ignored. After some probing, I found that this was hardcoded in belchertown.js.tmpl. I made some minor modifications and now have multiple yAxis working. I'm not a coder and not sure if my method was correct so posting it here in case anyone wants to fix it, use it, or incorporate it into the next release. In this snippet, I made 3 small changes:
line 2350: return item.yAxis == 1 changed to return item.yAxis >= 1
line 2354: if (s.yAxis == "1") changed to if (s.yAxis >= "1")
line 2364: s.yAxis = 1 changed to s.yAxis = s.yAxis
` // Find if any series have yAxis = 1. If so, save the array number so we can set labels correctly.
// We really care if yAxis is in array 1+, so we can go back and set yAxis 0 to the right label.
var yAxis_index = options.series.findIndex(function(item) {return item.yAxis >= 1})
`
Hope this is helpful! The graph now has one axis on the left and two on the right and looks like this:
Beta Was this translation helpful? Give feedback.
All reactions