Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Axis problem, min/max not working as aspected #1228

jorese opened this Issue Jan 22, 2014 · 7 comments


None yet
3 participants

jorese commented Jan 22, 2014

When assigning max/min values to yaxis 1 and NOT to yaxis 2, the min/max pairs are used also for the yaxis 2, is this by design?
I would suggest the min/max pairs for yaxis 2 is computed in that case.

flotOptions = {
    yaxis: { min:60.0, max:100.0, position:"left"},
    y2axis: { position:"right"}

An example on jsfiddle demonstratate this "feature"


dnschnur commented Jan 25, 2014

I agree that this behavior is unexpected. Thank you for the excellent jsFiddle.

why not set a flag in the axis:{} definitions to make it either global or local? that should make it easy if one wish to define them just once or not.
eg: yaxis: { min:60.0, max:100.0, position:"left", global:true/false},


dnschnur commented Feb 13, 2014

I'd prefer to limit the number of options, and the benefit of a dedicated flag is small; it's pretty easy to just repeat the min/max if one wants them to apply to multiple axes.

thanks for the reply
so what's the fix for this?
not accept min max values if the other graph has overflowed data points in it.


dnschnur commented Feb 13, 2014

The second axis should be auto-scaled, ignoring the min/max on the first.

Sounds like the best way to go


dnschnur commented Apr 14, 2014

It turns out that this actually comes from using x2axis or y2axis rather than xaxes/yaxes. The array form is the proper way to specify multiple axes; the other form has been deprecated for at least two major versions and will be removed in 0.9.

Still, they remain supported in 0.8.x, so I will push a fix shortly.

@dnschnur dnschnur self-assigned this Apr 14, 2014

@dnschnur dnschnur added a commit to dnschnur/flot that referenced this issue Apr 15, 2014

@dnschnur dnschnur Allow x2axis/y2axis with no min/max to auto-scale.
Using x2axis/y2axis to add a second axis is deprecated, but we
currently still support it.  Historically we’ve just extended the first
axis’s options with the second’s, but that is a problem when the first
has min/max and the second doesn’t; it will inherit an inappropriate

We might want to consider not extending at all, but since that’s a
bigger change we’ll for now just ensure that if no min/max is
specified, we respect that.

Fixes #1228.

@dnschnur dnschnur closed this in #1284 Apr 16, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment