Skip to content

Commit

Permalink
Merge pull request #1597 from Shopify/donut-chart-renderInnerValueCon…
Browse files Browse the repository at this point in the history
…tent-active-index

Changed RenderInnerValueContent type to include active index
  • Loading branch information
envex authored Oct 2, 2023
2 parents 3e1dc09 + 30a03f0 commit 3f45d06
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/polaris-viz/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

<!-- ## Unreleased -->
## Unreleased

### Changed

- Changed `RenderInnerValueContent` type to include active index


## [9.13.0] - 2023-09-26

Expand Down
1 change: 1 addition & 0 deletions packages/polaris-viz/src/components/DonutChart/Chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ export function Chart({
</svg>
<InnerValue
activeValue={activeValue}
activeIndex={activeIndex}
isAnimated={shouldAnimate}
totalValue={totalValue}
comparisonMetric={comparisonMetric}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import styles from '../../DonutChart.scss';

interface Props {
activeValue: number | null | undefined;
activeIndex: number;
labelFormatter: LabelFormatter;
isAnimated: boolean;
totalValue: number;
Expand All @@ -20,6 +21,7 @@ interface Props {

export function InnerValue({
activeValue,
activeIndex,
comparisonMetric,
labelFormatter,
isAnimated,
Expand Down Expand Up @@ -52,6 +54,7 @@ export function InnerValue({

const innerContent = renderInnerValueContent?.({
activeValue,
activeIndex,
animatedTotalValue,
totalValue,
}) ?? (
Expand Down
1 change: 1 addition & 0 deletions packages/polaris-viz/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ export type SortedBarChartData = (number | null)[][];

export interface InnerValueContents {
activeValue: number | null | undefined;
activeIndex: number;
animatedTotalValue: ReactNode;
totalValue: number;
}
Expand Down

0 comments on commit 3f45d06

Please sign in to comment.