Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow bar chart to fill missing data even when comparisons are provided #1618

Merged
merged 1 commit into from
Jan 17, 2024

Conversation

envex
Copy link
Collaborator

@envex envex commented Jan 17, 2024

What does this implement/fix?

When filling missing data we originally did not fill data that contained comparison data because we can't match the keys 1:1, which resulted in a LineChart rendering with the lines apart from each other.

image

With a BarChart having (non linear) charts with comparison data is a validuse-case, so now we only want to ignore data that includes comparisons if the data is linear.

image

Fixes issue with linear BarCharts crashing in https://github.com/Shopify/web/pull/114196

Storybook link

https://6062ad4a2d14cd0021539c1b-zoyhctyboe.chromatic.com/?path=/story/polaris-viz-charts-barchart-playground--mis-matched-web-data

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

const data = fillMissingDataPoints(dataSeries);
const data = fillMissingDataPoints(
dataSeries,
isValidDate(dataSeries[0]?.data[0]?.key),
Copy link
Collaborator Author

@envex envex Jan 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of passing a prop like isLinear we're going to naively check if a data point is a date.

@envex envex requested a review from maryamkaka January 17, 2024 16:21
Copy link

github-actions bot commented Jan 17, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
polaris-viz-core-cjs 61.35 KB (0%) 1.3 s (0%) 853 ms (+18.23% 🔺) 2.1 s
polaris-viz-cjs 213.46 KB (+0.05% 🔺) 4.3 s (+0.05% 🔺) 2.8 s (+53.1% 🔺) 7.1 s
polaris-viz-esm 174.07 KB (+0.04% 🔺) 3.5 s (+0.04% 🔺) 1.7 s (+6.48% 🔺) 5.2 s
polaris-viz-css 4.73 KB (0%) 95 ms (0%) 335 ms (-11.2% 🔽) 430 ms
polaris-viz-esnext 179.44 KB (+0.05% 🔺) 3.6 s (+0.05% 🔺) 1.4 s (-4.52% 🔽) 5 s

@envex envex force-pushed the envex/fill-non-linear-comparisons branch from b90b6f2 to 29da89a Compare January 17, 2024 16:24
@envex envex force-pushed the envex/fill-non-linear-comparisons branch from 29da89a to a4e414b Compare January 17, 2024 16:25
@envex envex merged commit 6403de7 into main Jan 17, 2024
6 checks passed
@envex envex deleted the envex/fill-non-linear-comparisons branch September 12, 2024 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants