danvk/dygraphs — pull request #248 by klausw-g (2013-05-22 20:49:50+00:00)
Title: Refactoring to fix stacked graphs with NaNs.

For stacked graphs, draw gaps for just the specific parts of series that are
missing data, and use interpolation to help ensure that the overall graph shape
doesn't get distorted for missing points.

This replaces https://github.com/danvk/dygraphs/pull/139 "Fix NaN handling for
stacked graphs" which had aggressively propagated NaNs to ensure that graphs
don't get drawn with incorrect stacking.

Fixes issue 446 - Improve handling of NaNs in stacked graphs.

Detailed changes:

- Remove layouts_.datasets, instead create point object arrays directly from
gatherDatasets_(). This was necessary since the pre-stacked datasets aren't
able to store the additional data needed for handling gaps.

- For stacked graphs, track yval_stacked/y_stacked separately from yval as point
properties.

- Remove unstackPointAtIndex which is now no longer necessary, since the points
keep the original yval. This helps ensure that the returned values keep their
original NaN value and don't expose the interpolated stacked values used for
drawing gaps.

- Remove evaluateWithError, evaluateLineCharts and Dygraph.seriesToPoints_ now
handle error bars directly.

- In gatherDatasets_, remove the unconditional copy of rolledSeries, the
refactoring appears to have fixed the bug related to zooming with
error bars on. (I could reproduce it in the original code by zooming
dygraphs/tests/custom-bars.html.) For date windows (horizontal zoom),
use .splice() instead of manually coping.