From e4a179ceb5572a93698b982ae47bddcfe696d258 Mon Sep 17 00:00:00 2001 From: Michael Nesen Date: Mon, 25 Sep 2023 15:22:05 +0000 Subject: [PATCH] Donut Chart UX updates --- packages/polaris-viz-core/src/index.ts | 1 - packages/polaris-viz/CHANGELOG.md | 6 ++++++ packages/polaris-viz/src/components/DonutChart/Chart.tsx | 2 +- packages/polaris-viz/src/constants.ts | 1 - 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/polaris-viz-core/src/index.ts b/packages/polaris-viz-core/src/index.ts index 5cbc1c408f..4fc1a04d5b 100644 --- a/packages/polaris-viz-core/src/index.ts +++ b/packages/polaris-viz-core/src/index.ts @@ -42,7 +42,6 @@ export { MAX_DIAGONAL_VISIBLE_HEIGHT, VERTICAL_LABEL_TARGET_WIDTH, DIAGONAL_LABEL_MIN_WIDTH, - DONUT_CHART_MAX_SERIES_COUNT, HORIZONTAL_LABEL_TARGET_HEIGHT, VERTICAL_LABEL_MIN_WIDTH, Y_AXIS_CHART_SPACING, diff --git a/packages/polaris-viz/CHANGELOG.md b/packages/polaris-viz/CHANGELOG.md index 5803a78a26..e5366a3017 100644 --- a/packages/polaris-viz/CHANGELOG.md +++ b/packages/polaris-viz/CHANGELOG.md @@ -11,6 +11,12 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). - Fixed issue where `` bar width would be 1px when data changes from all 0 values to data with non-zero values. +### Changed + +- Changed `` to include 0 or negative values in data. +- Changed `` to show any number of data points. +- Updated `` wrapper to take full height of container and center contents. + ## [9.12.0] - 2023-09-19 - No updates. Transitive dependency bump. diff --git a/packages/polaris-viz/src/components/DonutChart/Chart.tsx b/packages/polaris-viz/src/components/DonutChart/Chart.tsx index efd8b79627..9dbbec1dd3 100644 --- a/packages/polaris-viz/src/components/DonutChart/Chart.tsx +++ b/packages/polaris-viz/src/components/DonutChart/Chart.tsx @@ -115,7 +115,7 @@ export function Chart({ const {height, width, legend, setLegendDimensions, isLegendMounted} = useLegend({ - data: [{series: data.slice(0, 5), shape: 'Bar'}], + data: [{series: data, shape: 'Bar'}], dimensions, showLegend, direction: legendDirection, diff --git a/packages/polaris-viz/src/constants.ts b/packages/polaris-viz/src/constants.ts index e4c37c090c..e7dc7b4956 100644 --- a/packages/polaris-viz/src/constants.ts +++ b/packages/polaris-viz/src/constants.ts @@ -39,7 +39,6 @@ export { MAX_DIAGONAL_VISIBLE_HEIGHT, VERTICAL_LABEL_TARGET_WIDTH, DIAGONAL_LABEL_MIN_WIDTH, - DONUT_CHART_MAX_SERIES_COUNT, HORIZONTAL_LABEL_TARGET_HEIGHT, VERTICAL_LABEL_MIN_WIDTH, Y_AXIS_CHART_SPACING,