Home Forums Chart Support Bar Graph 2 axis but same max value? Reply To: Bar Graph 2 axis but same max value?

#39666

Hey,

Thank your for your help.

It work great. But it will only set Y2 axis with the maximum value of Y axis. But I need it to be dynamic. If Y2 is > than Y1, than use Y2 maximum value, else, use Y1 maximum value.

Maybe, with the get method, I can combine with javascript if function like :

if (chart.axisY[0].get("maximum") >= chart.axisY2[0].get("maximum")) {
     chart.axisY2[0].set("maximum", chart.axisY[0].get("maximum"));
} else {
    chart.axisY[0].set("maximum", chart.axisY2[0].get("maximum"));
}

I still didn’t try this code yet. If there is a best method with canjavjs function, would be happy to learn it.

Thank you !