Reputation: 93
I am using angular4 and Highcharts . I want to create graph with two y-axis.
So :
how can I do that ?
I.e.
Upvotes: 0
Views: 826
Reputation: 5826
Refer to this live demo: http://jsfiddle.net/kkulig/dhsgo47z/
If you want the secondary axis to have the same extremes as the primary one then a good place add the new axis is a load event (because it doesn't utilize hardcoded values):
chart: {
events: {
load: function() {
var primaryYAxis = this.yAxis[0];
this.addAxis({
title: {
text: 'Secondary'
},
min: primaryYAxis.min,
max: primaryYAxis.max,
tickPositions: [0, primaryYAxis.max],
endOnTick: false,
labels: {
formatter: function() {
return this.isLast ? "Maximum" : this.value;
}
}
}, false);
}
}
},
tickPositiones
serves to set the exact positions of ticks (there'll be no more and no less than defined). labels.formatter
is used to give the second tick a custom string value.
API reference:
Upvotes: 1