This PR adds support to the histogram for 'background data'
~This lets the user provide an array of HistogramData that will be used as a fallback when a bucket value is 0.~
This is data that is rendered behind the actual data, filled with 'unselectedColor'.
This is particularly useful when filtering a visualization with the histogram and setting the resulting data back to it. If you keep a "global" version of the histogram, you will get some context in the background.
~Right now, this is always applied, but we should consider if it only makes sense when a selection is present. Thoughts? cc @ivanmalagon~
I've included an example that deals with a simulated scenario. When you change the selection, the histogram data is set to those buckets only. By default it has no background data, and there's buttons to change the background data and the data to new ranges
There's some special logic behind this. The background data is validated, and if it's not compatible* with the current data, is kept but ignored. On the next data update, the compatibility is checked again, and only if it compatible will the data be rendered.
*Compatible === equal in length, contains the same ranges or categories in the same bucket.
WIP because:
[x] Documented
[x] Add example for docs, not just development.
~We should decide whether this should be always on or only when selections are present~
[x] Time series support, might be tricky since there's some data transformation already in place
This PR adds support to the histogram for 'background data'
~This lets the user provide an array of HistogramData that will be used as a fallback when a bucket value is 0.~
This is data that is rendered behind the actual data, filled with 'unselectedColor'.
This is particularly useful when filtering a visualization with the histogram and setting the resulting data back to it. If you keep a "global" version of the histogram, you will get some context in the background.
~Right now, this is always applied, but we should consider if it only makes sense when a selection is present. Thoughts? cc @ivanmalagon~
I've included an example that deals with a simulated scenario. When you change the selection, the histogram data is set to those buckets only. By default it has no background data, and there's buttons to change the background data and the data to new ranges
There's some special logic behind this. The background data is validated, and if it's not compatible* with the current data, is kept but ignored. On the next data update, the compatibility is checked again, and only if it compatible will the data be rendered.
*Compatible === equal in length, contains the same ranges or categories in the same bucket.
WIP because: