Commit 126cb072 authored by David Schnur's avatar David Schnur

Added a 'zero' option for lines and bars.

Area and bar plots normally use a minimum of zero, since their purpose
is to show size, and using an auto-scaled minimum distorts the plot's
meaning.  But this behavior is undesirable in cases where the plot type
is used in more of a decorative sense.

The zero option provides a way to control this behavior.  It defauls to
true for bars and filled lines.
parent d7c58b59
......@@ -106,6 +106,8 @@ Licensed under the MIT license.
fill: false,
fillColor: null,
steps: false
// Omit 'zero', so we can later default its value to
// match that of the 'fill' option.
},
bars: {
show: false,
......@@ -114,7 +116,8 @@ Licensed under the MIT license.
fill: true,
fillColor: null,
align: "left", // "left", "right", or "center"
horizontal: false
horizontal: false,
zero: true
},
shadowSize: 3,
highlightColor: null
......@@ -498,6 +501,13 @@ Licensed under the MIT license.
s.lines.show = true;
}
// If nothing was provided for lines.zero, default it to match
// lines.fill, since areas by default should extend to zero.
if (s.lines.show && s.lines.zero == null) {
s.lines.zero = !!s.lines.fill;
}
// setup axes
s.xaxis = getOrCreateAxis(xaxes, axisNumber(s, "x"));
s.yaxis = getOrCreateAxis(yaxes, axisNumber(s, "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