Commit 6412dafc authored by David Schnur's avatar David Schnur

Restrict zero to bars and filled lines only.

This also includes a tweak to zero's default.  Previously zero only
received a value if lines were visible; now it always receives a value,
matching the behavior of other contextual options.
parent b6924a96
...@@ -501,12 +501,12 @@ Licensed under the MIT license. ...@@ -501,12 +501,12 @@ Licensed under the MIT license.
s.lines.show = true; s.lines.show = true;
} }
// If nothing was provided for lines.zero, default it to match // If nothing was provided for lines.zero, default it to match
// lines.fill, since areas by default should extend to zero. // lines.fill, since areas by default should extend to zero.
if (s.lines.show && s.lines.zero == null) { if (s.lines.zero == null) {
s.lines.zero = !!s.lines.fill; s.lines.zero = !!s.lines.fill;
} }
// setup axes // setup axes
s.xaxis = getOrCreateAxis(xaxes, axisNumber(s, "x")); s.xaxis = getOrCreateAxis(xaxes, axisNumber(s, "x"));
...@@ -556,8 +556,8 @@ Licensed under the MIT license. ...@@ -556,8 +556,8 @@ Licensed under the MIT license.
format.push({ x: true, number: true, required: true }); format.push({ x: true, number: true, required: true });
format.push({ y: true, number: true, required: true }); format.push({ y: true, number: true, required: true });
if (s.bars.show || (s.lines.show && (s.lines.fill || s.lines.zero))) { if (s.bars.show || (s.lines.show && s.lines.fill)) {
var autoscale = !!((s.bars.show && s.bars.zero) || (s.lines.show && s.lines.zero)); var autoscale = !!((s.bars.show && s.bars.zero) || (s.lines.show && s.lines.zero));
format.push({ y: true, number: true, required: false, defaultValue: 0, autoscale: autoscale }); format.push({ y: true, number: true, required: false, defaultValue: 0, autoscale: autoscale });
if (s.bars.horizontal) { if (s.bars.horizontal) {
delete format[format.length - 1].y; delete format[format.length - 1].y;
......
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