See this JSFiddle. How do I get the y-axis zero to align?
I've had issue with all the answers as it didn't support values on negative Y axis. To center on 0, i applied below logic
Find min/max of the series and pad it so 0 comes in center
if(max > 0 && min < 0){
{
const diff = max + min;
if(diff > 0){
min = min - diff
}
else{
max = max + -1 * diff
}
}
else if (max > 0){
max = min * -1
}
else{
min = max * -1
}
Then when defining axis on chart, use the min/max values from above, this will ensure 0 shows in center