Black Lives Matter. Please consider donating to Black Girls Code today.

Y Axis Scale on Zoom


I would be able to ensure that the negative axis is never visible on zooming out, and that the highest Y value is always visible by scaling the axis when zooming in.

Something similar to this d3js example,, is it possible?

Here’s how:

Thanks for your response.

I already have that defined in my layout for both my yaxis and yaxis2, but it doesn’t seem to work. Are there any other layout rules which would override this?


There shouldn’t be any. Can you share a reproducible example?

I think I’ve figured it out.

I was using “fixedrange” : true, which didn’t work. I am now using fixedrange: true without quotations which is working. I guess the problem arose since I was generating the layout json via php. Sorted now, thanks!