diff --git a/packages/polaris-viz-core/src/constants.ts b/packages/polaris-viz-core/src/constants.ts index c37967b6c..00478185f 100644 --- a/packages/polaris-viz-core/src/constants.ts +++ b/packages/polaris-viz-core/src/constants.ts @@ -137,6 +137,7 @@ const DEFAULT_GRID_VERTICAL_OVERFLOW = true; const DEFAULT_GRID_HORIZONTAL_MARGIN = 16; const DEFAULT_X_AXIS_HIDE = false; +const DEFAULT_GROUP_LABEL_HIDE = false; const DEFAULT_CROSSHAIR_WIDTH = 1; @@ -212,6 +213,9 @@ export const DEFAULT_THEME: Theme = { backgroundColor: variables.colorGray160, labelColor: variables.colorGray30, }, + groupLabel: { + hide: DEFAULT_GROUP_LABEL_HIDE, + }, crossHair: { color: variables.colorGray70, width: DEFAULT_CROSSHAIR_WIDTH, @@ -317,6 +321,9 @@ export const LIGHT_THEME: Theme = { backgroundColor: variables.colorGray00, labelColor: variables.colorGray100, }, + groupLabel: { + hide: DEFAULT_GROUP_LABEL_HIDE, + }, crossHair: { color: variables.colorGray40, width: DEFAULT_CROSSHAIR_WIDTH, diff --git a/packages/polaris-viz-core/src/types.ts b/packages/polaris-viz-core/src/types.ts index adf997bb9..18ae7b8d3 100644 --- a/packages/polaris-viz-core/src/types.ts +++ b/packages/polaris-viz-core/src/types.ts @@ -111,6 +111,10 @@ export interface YAxisTheme { backgroundColor: string; } +export interface GroupLabelTheme { + hide: boolean; +} + export interface AnnotationsTheme { backgroundColor: string; textColor: string; @@ -173,6 +177,7 @@ export interface PartialTheme { grid?: Partial; xAxis?: Partial; yAxis?: Partial; + groupLabel?: Partial; crossHair?: Partial; legend?: Partial; seriesColors?: Partial; @@ -189,6 +194,7 @@ export interface Theme { grid: GridTheme; xAxis: XAxisTheme; yAxis: YAxisTheme; + groupLabel: GroupLabelTheme; line: LineTheme; crossHair: CrossHairTheme; legend: LegendTheme; diff --git a/packages/polaris-viz/CHANGELOG.md b/packages/polaris-viz/CHANGELOG.md index 557bd63f0..09e9ce0dc 100644 --- a/packages/polaris-viz/CHANGELOG.md +++ b/packages/polaris-viz/CHANGELOG.md @@ -7,6 +7,10 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## Unreleased +### Added + +- Added the group sum labels for the Horizontal Stacked Bar Chart. + ### Fixed - Fixed the positioning of the `` for the Stacked Horizontal Chart when all values are negative. diff --git a/packages/polaris-viz/src/components/BarChart/stories/HorizontalStacked.stories.tsx b/packages/polaris-viz/src/components/BarChart/stories/HorizontalStacked.stories.tsx index c36ccbee3..3b91da2ad 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/HorizontalStacked.stories.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/HorizontalStacked.stories.tsx @@ -5,8 +5,25 @@ export {META as default} from './meta'; import type {BarChartProps} from '../../../components'; import {Template} from './data'; +import {PolarisVizProvider} from '../../PolarisVizProvider'; -export const HorizontalStacked: Story = Template.bind({}); +export const HorizontalStacked: Story = ( + args: BarChartProps, +) => { + return ( + +