Commit 86f7ab1e authored by David Schnur's avatar David Schnur

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
min/max.

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.
parent 3aec7ce0
...@@ -814,10 +814,24 @@ Licensed under the MIT license. ...@@ -814,10 +814,24 @@ Licensed under the MIT license.
if (options.x2axis) { if (options.x2axis) {
options.xaxes[1] = $.extend(true, {}, options.xaxis, options.x2axis); options.xaxes[1] = $.extend(true, {}, options.xaxis, options.x2axis);
options.xaxes[1].position = "top"; options.xaxes[1].position = "top";
// Override the inherit to allow the axis to auto-scale
if (options.x2axis.min == null) {
options.xaxes[1].min = null;
}
if (options.x2axis.max == null) {
options.xaxes[1].max = null;
}
} }
if (options.y2axis) { if (options.y2axis) {
options.yaxes[1] = $.extend(true, {}, options.yaxis, options.y2axis); options.yaxes[1] = $.extend(true, {}, options.yaxis, options.y2axis);
options.yaxes[1].position = "right"; options.yaxes[1].position = "right";
// Override the inherit to allow the axis to auto-scale
if (options.y2axis.min == null) {
options.yaxes[1].min = null;
}
if (options.y2axis.max == null) {
options.yaxes[1].max = null;
}
} }
if (options.grid.coloredAreas) if (options.grid.coloredAreas)
options.grid.markings = options.grid.coloredAreas; options.grid.markings = options.grid.coloredAreas;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment