Feature: Selection Modes#696
Conversation
This is a proposed implementation for danvk#371. Selection modes are defined in `src/dygraph-selection-modes.js` with the ability to override them on a per graph basis with the option `selectionMode` when instantiating the Dygraph.
|
Thanks for this change! I'll make an effort to review it this week. |
|
I left a few smaller comments, but overall I'm not sure I understand what's going on. I thought the idea of this change was to support both "select by closest x-distance" and "select by closest euclidean distance," but the latter doesn't seem to be a part of this change. What's the difference between Review status: 0 of 5 files reviewed at latest revision, 7 unresolved discussions. src/dygraph-options-reference.js, line 854 [r1] (raw file): src/dygraph-options-reference.js, line 855 [r1] (raw file): src/dygraph-options-reference.js, line 858 [r1] (raw file): src/dygraph-selection-modes.js, line 8 [r1] (raw file): src/dygraph-selection-modes.js, line 10 [r1] (raw file): src/dygraph-selection-modes.js, line 17 [r1] (raw file): src/dygraph.js, line 3578 [r1] (raw file): Dygraph.SelectionModes = DygraphSelectionModes;? Comments from the review on Reviewable.io |
|
The difference is that with selectByRow, if the selected row does not have a value for a series, the selection will not include a value for that series. selectByClosestX starts at the current row, but if no value is found for a series, it looks for the last defined value for that series in row numbers less than the selected row. Perhaps a more appropriate name would be something like "selectByLatestDefinedValue"? Perhaps I let my needs dilute my understanding of the original feature request I'm exclusively visualizing time-series data. One chart type in particular has data where a single row would almost never have defined values for every series. My goal was to get the highlight dots and the legend reporting the last value reported for the series up until the current time, but never after, and have the legend report the time value of the latest data point. Here's a GIF of the interaction I needed. This is the most extreme case, but I have other examples if needed. I'm not too concerned about this specific selection model making it into the library if we can't agree about the semantics of the selection mode. I'm mostly concerned about the callback option being exposed. Review status: 0 of 5 files reviewed at latest revision, 3 unresolved discussions. src/dygraph-options-reference.js, line 855 [r1] (raw file): src/dygraph-selection-modes.js, line 17 [r1] (raw file): src/dygraph.js, line 3578 [r1] (raw file): Comments from the review on Reviewable.io |
|
I'd accept a version of this if I saw a demonstration that it could be used to fix #371, i.e. support selecting the closest point by euclidean distance. Ideally that would share code with the existing mechanism via |
|
Ok. I'll see if I can do that. I'm, probably just going to maintain a On Thu, Dec 3, 2015 at 2:17 PM Dan Vanderkam notifications@github.com
|
|
Closing for now. Will reopen if a fix for #371 is implemented. |
This is a proposed implementation for #371.
Selection modes are defined in
src/dygraph-selection-modes.jswith theability to override them on a per graph basis with the option
selectionModewhen instantiating the Dygraph.