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 #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.
Squashed commit of the following:
commit
56efaef6a50c737b99a8e4e6a36e55c83fde237f
Author: Klaus Weidner <klausw@google.com>
Date: Mon Jun 3 16:50:16 2013 -0700
Style fixes as per Robert's requests.
commit
83bb38a071f407560abcca53b7f6e07d6b0ca0e5
Author: Klaus Weidner <klausw@google.com>
Date: Mon Jun 3 15:53:59 2013 -0700
Add stackedGraphNaNFill option to control NaN handling.
Add a test for this, and add a docstring to the stackPoints_ method.
commit
e16e3c381d5cc7bec9896b31dddebc627a941c33
Author: Klaus Weidner <klausw@google.com>
Date: Mon Jun 3 15:20:24 2013 -0700
Revert name back to .addDataset, add docstring.
commit
d3e66a60c84656364829e8a5bb83ed0e2b9fb403
Author: Klaus Weidner <klausw@google.com>
Date: Mon Jun 3 15:15:19 2013 -0700
Add more type annotations to make the flow of point data clearer.
Unfortunately it's still not very clear, the logic is a bit convoluted.
commit
33db3d27501c8b5f2f84baa4dd92bf8d6f0a35a3
Author: Klaus Weidner <klausw@google.com>
Date: Mon Jun 3 15:00:38 2013 -0700
Rename fixPathAttrs_ to cleanPathAttrs_ as requested.
commit
f39168785efcbacd1de9a6275aa02c8e34e4c5a7
Author: Klaus Weidner <klausw@google.com>
Date: Mon Jun 3 14:58:26 2013 -0700
Add comment explaining baseline, as requested by Robert.
commit
80348ed3c9e677fb5ff1ef393056e1e2bea1bbf7
Author: Klaus Weidner <klausw@google.com>
Date: Mon Jun 3 13:16:51 2013 -0700
Track stroke/fill in CanvasAssertions.
For lineTo operations, set strokeStyle to undefined if the path is
filled (not stroked), and set fillStyle to undefined if the path
is stroked only.
Fix assertions in missing_points tests, those were apparently expecting the
inflated numbers.
Remove the strokeStyle='#000000' hack in dygraph-canvas which is now
no longer needed.
commit
4f47af82ac297d27dc0ac9d5c6fd256e00cccec5
Author: Klaus Weidner <klausw@google.com>
Date: Mon Jun 3 11:57:56 2013 -0700
fix CanvasAssertions which was calling .match wrong, remove now-redundant check.
commit
8c53e9e0f3d362e58204ff5a777c90ddb3b589d5
Author: Klaus Weidner <klausw@google.com>
Date: Thu May 23 11:00:50 2013 -0700
Restore hasOwnProperty.
commit
621cc37cfaf33821d04de2a94aea63021f7a9647
Author: Klaus Weidner <klausw@google.com>
Date: Wed May 22 15:35:16 2013 -0700
Fix all-NaN series stacking and Proxy return values.
Ensure that all-NaN series get treated as zero for stacking
purposes, and that nextPoint gets set to null past the last
stackable point. We want interpolation, but not extrapolation.
The Proxy class didn't return values from calls, breaking
testCorrectColors since it didn't get pixel data as expected.
Update the input data for testInterpolation to check corner cases,
including an all-NaN series.
commit
eb52ff1c1bbdd55312cb2881b5182731c91c155c
Author: Klaus Weidner <klausw@google.com>
Date: Wed May 22 12:40:44 2013 -0700
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.