feat (analytics): better sparkline management + link brushing #2561
+982
−200
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Previously I exposed a
@max
event which was supposed to communicate the local manipulation of the passed in data. With that event the parent was supposed to feed that value back in given a maximum 'max' value across all sparklines rendered. This required the developer to understand and think about how sparklines work far more than was useful. This change allows users to render sparklines at any scale and by simply providing agroupKey
and achartKey
the sparkline itself can manage keeping scales in sync. Simpler development and more consistent usage should be the result.Along those same lines, link brushing is fairly trivial to support in sparklines for two reasons. First, they are generally displayed at the same scale, so the X axis is consistent for each one which allows us to just take the raw x position of the mouse relative to the chart and apply it across all sparklines. Second, this implementation of sparklines forces all the data to be a certain type (lists of timestamps) and therefore we don't have to take any guesses on what will be displayed or how it will convey information. A simple vertical line is sufficient.
WIP
Work in progress, adding in some unit tests