Fill linear charts when necessary #1607
Merged
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.
What does this implement/fix?
Now that we're allowing consumers to create custom charts, we're getting into issues where we have a
LineChart
, but the data provided doesn't include all the data we expect.For example, we assume that linear data isn't matched up to keys and that each item would be index based.
For example, we don't care about the labels themselves. We take the series with the longest
DataSeries.data
length and use those keys as the labels. When this chart is rendered we will render the following labels:January February March April May June July August September October November December
So when we start looping through the
This Year
data set, we don't care ifJanuary
is actuallyJanuary
it's rendered in the0
index and then moves to the next item.It's assumed that linear charts should contain the same amount of keys with the same date provided.
The exception is data sets with
isComparison: true
because those keys could be different when timestamps are provided.The issue (...finally)
The image above shows a set of linear data, but based on the dimensions we have some days that include come products and other days that don't.
An example is that we have
Biltong Taster Pack
andChili Biltong Slab 8oz
both included on the 6th, but don't share any other days.You can see that before all the items were placed at the beginning of the chart, even though their dates didn't start at the beginning. Now they start in the right position.
Before merging
Check your changes on a variety of browsers and devices.
Update the Changelog's Unreleased section with your changes.
Update relevant documentation, tests, and Storybook.
Make sure you're exporting any new shared Components, Types and Utilities from the top level index file of the package