The current implementation does not allow to have multiple domain keys per scale. We have a domain key for each scale. This does not allow to have multi-line chart or equivalent charts without having to grow the dataset (with a normalized data structure) and doing a "group by" operation.
I think we need to :
Define scales as context providers
Treat the colors as a scale
Let the chart recipe define it's own way to toggle data via the legend.
Dissociate the domain key used in the shapes from the one defined in the scale definition.
The current PR includes the following :
Adding three scale providers : CartesianScale, ColorScale and LinearScale (we may add additional ones when needed).
Each child component (shape, axis, ..) would access the needed scale through the context instead of passing them to the chart context provider as props.
Added domain key props such as "xDomainKey", "yDomainKey", etc. Thus allowing to have a different domain key than the one supplied in the scale definition.
As a proof of concept, this PR includes a multi-line chart :
Other changes
There's also some unrelated minor changes :
Moved the legend data toggle logic to the recipe level and removed the "color" and "isActive" from the NormalizedDatum type.
Allow foreign components to access the chart scales using registerScale() and getScale() (like the legend is in HTML and cannot live under the ColorScale context provider).
useAnimation Hook : Cancel previous animation when starting a new one
Refactor ScaledDatumValue() in ez-core
Adjust tooltip so it displays the datum attributes (inc. CSS updates)
Refactor the legend component to make it chart agnostic.
Unit tests updates
Core updates
Re-order imports
Mino typo fixes
Type of change
Please delete options that are not relevant.
[ ] Bug fix (non-breaking change which fixes an issue)
[X] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
[X] This change requires a documentation update
Checklist:
[x] I have done the work for both react and vue
[ ] I have performed a self-review of my own code
[x] I have commented my code, particularly in hard-to-understand areas
[x] I have made corresponding changes to the documentation (Storybook)
[x] I have added unit tests that prove my fix is effective or that my feature works
[x] New and existing unit tests pass locally with my changes
Motivation
The current implementation does not allow to have multiple domain keys per scale. We have a domain key for each scale. This does not allow to have multi-line chart or equivalent charts without having to grow the dataset (with a normalized data structure) and doing a "group by" operation.
I think we need to :
The current PR includes the following :
As a proof of concept, this PR includes a multi-line chart :
Other changes
There's also some unrelated minor changes :
Type of change
Please delete options that are not relevant.
Checklist: