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.
pull/1/head
David Schnur 13 years ago
parent d7c58b59f3
commit 126cb072fc

@ -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"));

Loading…
Cancel
Save