danvk/dygraphs — pull request #132 by klausw-g (2012-02-28 20:05:14+00:00)
Title: Improved handling of points at graph edges

Currently, data points drawn at the graph edges aren't properly visible.
For example, in a 100-pixel high plot area, a Y coordinate of zero on a
graph with yrange [0, ...] will be scaled to domY=100 which is outside
the 0..99 visible area.

The existing avoidMinZero option works around this, but the results
aren't very pretty due to the large 10% Y padding.

This change adds new options for finer-grained control. xAxisPad and
yAxisPad control the extra margin at the graph edges, defaulting to 0
and 0.1 for backwards compatibility.

xAxisAtZero and yAxisAtZero change the position at which the black axis
lines get drawn. If xAxisAtZero is true and Y=0 is visible in the graph
area, draw the X axis at the Y=0 position, and correspondingly for
yAxisAtZero. If the zero point is outside the graph, continue using the
left and bottom edges as usual. This is especially useful with small
padding (for example xAxisPad=0.01 and yAxisPad=0.02), effectively
getting tick marks next to the legend from the grid extending past the
axis.

This intentionally ignores a secondary Y axis, and should not affect
zoomed graphs.