# PercentageBarChart **📖 Live documentation:** https://cds.coinbase.com/components/charts/PercentageBarChart/ A bar chart component for comparing share or mix across categories as percentages. Supports horizontal and vertical orientations, 100% stacked bars, and a fixed 0–100% value axis. ## Import ```tsx import { PercentageBarChart } from '@coinbase/cds-web-visualization' ``` ## Examples PercentageBarChart is a wrapper for [BarChart](/components/charts/BarChart) that simplifies the creation of segmented, part-to-whole horizontal visualizations. Charts are built using SVGs. ### Basics The only prop required is `series`, which takes an array of series objects. Each series object needs an `id` and a value for `data`. ```jsx live ``` ### Stack Gap Use `stackGap` to add space between segments while keeping the full bar length. ```jsx live ``` ### Border Radius Bars use `borderRadius` like in [BarChart](/components/charts/BarChart/#border-radius). ```jsx live ``` ### Data **Negative** values, **`null`**, and **missing indices** from a shorter `data` array are treated as **zero** for that segment at that category. A **single-number** `data` value applies to the **first** category only—later categories count as zero for that series. ```jsx live ``` If **every** group sums to zero after clamping, nothing is drawn—handle that in surrounding UI (empty state or copy). ### Customization #### Bar Stack Spacing Use `categoryPadding` on the band axis to adjust spacing between stacks. ```jsx live ``` #### Minimum Bar Size `barMinSize` enforces a minimum pixel size for **individual** segments (non-zero values), similar to `BarChart`. Use it when a small share would otherwise be too narrow to see or interact with: ```jsx live ``` #### Custom Components ##### Slanted Stack Gap A custom `BarComponent` that replaces the default rectangular inner edges with **slanted cuts**, creating a parallelogram-shaped gap purely from the path geometry—no `stackGap` needed. Outer ends stay pill-shaped. ```jsx live function SlantedStackExample() { function getSlantedHorizontalBarPath( x, y, width, height, borderRadius, pillLeft, pillRight, slantDx, ) { if (width <= 0 || height <= 0 || pillLeft === pillRight) return undefined; const r = Math.min(borderRadius, height / 2, width / 2); const s = Math.min(Math.max(0, slantDx), width - r * 2); const x0 = x, x1 = x + width, y0 = y, y1 = y + height; if (pillLeft && !pillRight) { return [ `M ${x0 + r} ${y0}`, `L ${x1} ${y0}`, `L ${x1 - s} ${y1}`, `L ${x0 + r} ${y1}`, `A ${r} ${r} 0 0 1 ${x0} ${y1 - r}`, `L ${x0} ${y0 + r}`, `A ${r} ${r} 0 0 1 ${x0 + r} ${y0}`, 'Z', ].join(' '); } return [ `M ${x0 + s} ${y0}`, `L ${x1 - r} ${y0}`, `A ${r} ${r} 0 0 1 ${x1} ${y0 + r}`, `L ${x1} ${y1 - r}`, `A ${r} ${r} 0 0 1 ${x1 - r} ${y1}`, `L ${x0} ${y1}`, 'Z', ].join(' '); } const SLANT_DX = 8; const SlantedStackBar = memo(function SlantedStackBar(props) { const { layout } = useCartesianChartContext(); const { x, y, width, height, borderRadius = 4, roundTop, roundBottom, dataX, d: defaultD, fill, fillOpacity, ...rest } = props; const d = useMemo(() => { if (layout !== 'horizontal') { return ( defaultD ?? getBarPath(x, y, width, height, borderRadius, !!roundTop, !!roundBottom, layout) ); } const isLeftmost = Array.isArray(dataX) && Math.abs(dataX[0]) < 1; return ( getSlantedHorizontalBarPath( x, y, width, height, borderRadius, isLeftmost, !isLeftmost, SLANT_DX, ) ?? defaultD ?? getBarPath(x, y, width, height, borderRadius, !!roundTop, !!roundBottom, layout) ); }, [layout, defaultD, dataX, x, y, width, height, borderRadius, roundTop, roundBottom]); if (!d) return null; return ( ); }); return ( ); } ``` ##### Dotted bar A custom `BarComponent` can render a **dotted fill** (SVG pattern mask plus outline). Set `BarComponent` on **one series** to emphasize a single segment, or on the **chart** to apply the same look to every segment. ```jsx live function DottedBarExamples() { const DOTTED_BAR_OUTLINE_STROKE_WIDTH = 2; const DottedBarComponent = memo((props) => { const { dataX, x, y, width, height, borderRadius = 4, roundTop = true, roundBottom = true, } = props; const { layout } = useCartesianChartContext(); const patternSize = 4; const dotSize = 1; const patternId = useId(); const maskId = useId(); const outlineInset = DOTTED_BAR_OUTLINE_STROKE_WIDTH / 2; const outlineGeometry = useMemo(() => { const insetWidth = width - 2 * outlineInset; const insetHeight = height - 2 * outlineInset; if (insetWidth <= 0 || insetHeight <= 0) { return null; } const insetX = x + outlineInset; const insetY = y + outlineInset; const insetRadius = Math.max(0, borderRadius - outlineInset); return { d: getBarPath( insetX, insetY, insetWidth, insetHeight, insetRadius, roundTop, roundBottom, layout, ), height: insetHeight, width: insetWidth, x: insetX, y: insetY, }; }, [borderRadius, height, layout, outlineInset, roundBottom, roundTop, width, x, y]); const uniqueMaskId = `${maskId}-${dataX}`; const uniquePatternId = `${patternId}-${dataX}`; return ( <> {outlineGeometry ? ( ) : ( )} ); }); const dottedBarSeries = [ { id: 'segment-a', data: 60, label: 'Segment A', color: 'rgb(var(--teal60))', BarComponent: DottedBarComponent, }, { id: 'segment-b', data: 30, label: 'Segment B', color: 'rgb(var(--chartreuse50))' }, { id: 'segment-c', data: 10, label: 'Segment C', color: 'rgb(var(--indigo40))' }, ]; const dottedBarSeriesPlain = [ { id: 'segment-a', data: 60, label: 'Segment A', color: 'rgb(var(--teal60))' }, { id: 'segment-b', data: 30, label: 'Segment B', color: 'rgb(var(--chartreuse50))' }, { id: 'segment-c', data: 10, label: 'Segment C', color: 'rgb(var(--indigo40))' }, ]; return ( First series only Chart-level BarComponent ); } ``` ### Animations Configure motion with the `transitions` prop (forwarded to `BarChart`). Toggle motion with `animate`. ```jsx live function AnimationsExample() { const [animate, setAnimate] = useState(true); function randomShares() { const raw = [Math.random() + 0.1, Math.random() + 0.1, Math.random() + 0.1]; const sum = raw[0] + raw[1] + raw[2]; return raw.map((v) => Math.max(1, Math.round((v / sum) * 100))); } function generateData() { return [randomShares(), randomShares(), randomShares()]; } const [data, setData] = useState(generateData); useEffect(() => { const id = setInterval(() => setData(generateData()), 800); return () => clearInterval(id); }, []); const series = [ { id: 'btc', data: data.map((q) => q[0]), label: 'BTC', color: assets.btc.color }, { id: 'eth', data: data.map((q) => q[1]), label: 'ETH', color: assets.eth.color, }, { id: 'other', data: data.map((q) => q[2]), label: 'Other', color: 'var(--color-fgMuted)', }, ]; return ( setAnimate((v) => !v)}> Animate `${value}%`, }} yAxis={{ categoryPadding: 0.75, data: ['Q1 2025', 'Q2 2025', 'Q3 2025'], position: 'left', requestedTickCount: 5, showTickMarks: true, }} /> ); } ``` ### Composed Examples #### Live-updating Data Using a custom legend, you can create a prediction markets-style chart that stays in sync when data changes. ```jsx live function LiveFeedExample() { const liveFeedSubtitleBase = 100; const liveFeedYesDollarsPerPercentPoint = (182 - liveFeedSubtitleBase) / 50; const liveFeedNoDollarsPerPercentPoint = (222 - liveFeedSubtitleBase) / 50; function getLiveFeedProjectedValue(seriesId, percentage) { const inverseShare = 100 - percentage; if (seriesId === 'yes') { return Math.round(liveFeedSubtitleBase + inverseShare * liveFeedYesDollarsPerPercentPoint); } if (seriesId === 'no') { return Math.round(liveFeedSubtitleBase + inverseShare * liveFeedNoDollarsPerPercentPoint); } return undefined; } const liveFeedCurrencyFormat = { style: 'currency', currency: 'USD', maximumFractionDigits: 0, }; const LiveFeedCTALegendEntry = memo(function LiveFeedCTALegendEntry({ seriesId, label, color }) { const { series } = useCartesianChartContext(); const seriesData = series.find((s) => s.id === seriesId); const percentage = seriesData?.data?.[0] ?? 0; const projectedValue = getLiveFeedProjectedValue(seriesId, percentage); return ( ); }); function LiveFeedChart() { const [tick, setTick] = useState(0); const yesValue = 50 + Math.sin(tick * 0.05) * 49; const noValue = 50 - Math.sin(tick * 0.05) * 49; const series = [ { id: 'yes', data: yesValue, label: 'Yes', color: 'var(--color-fgPositive)' }, { id: 'no', data: noValue, label: 'No', color: 'var(--color-fgNegative)' }, ]; useEffect(() => { const id = setInterval(() => setTick((t) => t + 4), 1000); return () => clearInterval(id); }, []); return ( } legendPosition="bottom" series={series} stackGap={2} /> ); } return ; } ``` #### Vertical Mix Monthly **BTC / ETH / Other** portfolio allocation across a full year, with `layout="vertical"` and the legend on the right. ```jsx live ``` #### Buy vs Sell You can combine a PercentageBarChart with a custom legend to create a buy vs sell chart. ```jsx live function BuyVsSellExample() { const series = [ { id: 'buy', data: 76, color: 'var(--color-fgPositive)', legendShape: 'circle' }, { id: 'sell', data: 24, color: 'var(--color-fgNegative)', legendShape: 'square' }, ]; function BuyVsSellLegend() { const [buy, sell] = series; return ( {`${buy.data}% bought`} } seriesId={buy.id} shape={buy.legendShape} /> {`${sell.data}% sold`} } seriesId={sell.id} shape={sell.legendShape} /> ); } return ( ); } ``` ## Props | Prop | Type | Required | Default | Description | | --- | --- | --- | --- | --- | | `BarComponent` | `BarComponent` | No | `-` | Component to render the bar. | | `BarStackComponent` | `BarStackComponent` | No | `DefaultBarStack` | Custom component to render the stack container. Can be used to add clip paths, outlines, or other custom styling. | | `alignContent` | `ResponsiveProp
` | No | `-` | - | | `alignItems` | `ResponsiveProp
` | No | `-` | - | | `alignSelf` | `ResponsiveProp
` | No | `-` | - | | `animate` | `boolean` | No | `true` | Whether to animate the chart. | | `as` | `div` | No | `-` | The underlying element or component the polymorphic component will render. Changing as also changes the inherited native props (e.g. href for as=a) and the expected ref type. | | `aspectRatio` | `inherit \| auto \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - | | `background` | `currentColor \| fg \| fgMuted \| fgInverse \| fgPrimary \| fgWarning \| fgPositive \| fgNegative \| bg \| bgAlternate \| bgInverse \| bgOverlay \| bgElevation1 \| bgElevation2 \| bgPrimary \| bgPrimaryWash \| bgSecondary \| bgTertiary \| bgSecondaryWash \| bgNegative \| bgNegativeWash \| bgPositive \| bgPositiveWash \| bgWarning \| bgWarningWash \| bgLine \| bgLineHeavy \| bgLineInverse \| bgLinePrimary \| bgLinePrimarySubtle \| accentSubtleRed \| accentBoldRed \| accentSubtleGreen \| accentBoldGreen \| accentSubtleBlue \| accentBoldBlue \| accentSubtlePurple \| accentBoldPurple \| accentSubtleYellow \| accentBoldYellow \| accentSubtleGray \| accentBoldGray \| transparent` | No | `-` | - | | `barMinSize` | `number` | No | `-` | Minimum size for individual bars in the stack. | | `barPadding` | `number` | No | `0.1` | Padding between bar groups (0-1). | | `borderBottomWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - | | `borderColor` | `currentColor \| fg \| fgMuted \| fgInverse \| fgPrimary \| fgWarning \| fgPositive \| fgNegative \| bg \| bgAlternate \| bgInverse \| bgOverlay \| bgElevation1 \| bgElevation2 \| bgPrimary \| bgPrimaryWash \| bgSecondary \| bgTertiary \| bgSecondaryWash \| bgNegative \| bgNegativeWash \| bgPositive \| bgPositiveWash \| bgWarning \| bgWarningWash \| bgLine \| bgLineHeavy \| bgLineInverse \| bgLinePrimary \| bgLinePrimarySubtle \| accentSubtleRed \| accentBoldRed \| accentSubtleGreen \| accentBoldGreen \| accentSubtleBlue \| accentBoldBlue \| accentSubtlePurple \| accentBoldPurple \| accentSubtleYellow \| accentBoldYellow \| accentSubtleGray \| accentBoldGray \| transparent` | No | `-` | - | | `borderEndWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - | | `borderRadius` | `number` | No | `4` | Border radius for the bar. | | `borderStartWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - | | `borderTopWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - | | `borderWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - | | `bordered` | `boolean` | No | `-` | Add a border around all sides of the box. | | `borderedBottom` | `boolean` | No | `-` | Add a border to the bottom side of the box. | | `borderedEnd` | `boolean` | No | `-` | Add a border to the trailing side of the box. | | `borderedHorizontal` | `boolean` | No | `-` | Add a border to the leading and trailing sides of the box. | | `borderedStart` | `boolean` | No | `-` | Add a border to the leading side of the box. | | `borderedTop` | `boolean` | No | `-` | Add a border to the top side of the box. | | `borderedVertical` | `boolean` | No | `-` | Add a border to the top and bottom sides of the box. | | `bottom` | `ResponsiveProp>` | No | `-` | - | | `classNames` | `{ root?: string; chart?: string \| undefined; } \| undefined` | No | `-` | Custom class names for the component. | | `color` | `currentColor \| fg \| fgMuted \| fgInverse \| fgPrimary \| fgWarning \| fgPositive \| fgNegative \| bg \| bgAlternate \| bgInverse \| bgOverlay \| bgElevation1 \| bgElevation2 \| bgPrimary \| bgPrimaryWash \| bgSecondary \| bgTertiary \| bgSecondaryWash \| bgNegative \| bgNegativeWash \| bgPositive \| bgPositiveWash \| bgWarning \| bgWarningWash \| bgLine \| bgLineHeavy \| bgLineInverse \| bgLinePrimary \| bgLinePrimarySubtle \| accentSubtleRed \| accentBoldRed \| accentSubtleGreen \| accentBoldGreen \| accentSubtleBlue \| accentBoldBlue \| accentSubtlePurple \| accentBoldPurple \| accentSubtleYellow \| accentBoldYellow \| accentSubtleGray \| accentBoldGray \| transparent` | No | `-` | - | | `columnGap` | `0 \| 1 \| 2 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10` | No | `-` | - | | `dangerouslySetBackground` | `string` | No | `-` | - | | `display` | `ResponsiveProp` | No | `-` | - | | `elevation` | `0 \| 1 \| 2` | No | `-` | - | | `fillOpacity` | `number` | No | `-` | Fill opacity for the bar. | | `flexBasis` | `ResponsiveProp>` | No | `-` | - | | `flexDirection` | `ResponsiveProp` | No | `-` | - | | `flexGrow` | `inherit \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - | | `flexShrink` | `inherit \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - | | `flexWrap` | `ResponsiveProp` | No | `-` | - | | `font` | `ResponsiveProp` | No | `-` | - | | `fontFamily` | `ResponsiveProp` | No | `-` | - | | `fontSize` | `ResponsiveProp` | No | `-` | - | | `fontWeight` | `ResponsiveProp` | No | `-` | - | | `gap` | `0 \| 1 \| 2 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10` | No | `-` | - | | `grid` | `inherit \| none \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - | | `gridArea` | `inherit \| auto \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - | | `gridAutoColumns` | `ResponsiveProp>` | No | `-` | - | | `gridAutoFlow` | `inherit \| revert \| row \| column \| -moz-initial \| initial \| revert-layer \| unset \| dense` | No | `-` | - | | `gridAutoRows` | `ResponsiveProp>` | No | `-` | - | | `gridColumn` | `inherit \| auto \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - | | `gridColumnEnd` | `inherit \| auto \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - | | `gridColumnStart` | `inherit \| auto \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - | | `gridRow` | `inherit \| auto \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - | | `gridRowEnd` | `inherit \| auto \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - | | `gridRowStart` | `inherit \| auto \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - | | `gridTemplate` | `inherit \| none \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - | | `gridTemplateAreas` | `inherit \| none \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - | | `gridTemplateColumns` | `ResponsiveProp>` | No | `-` | - | | `gridTemplateRows` | `ResponsiveProp>` | No | `-` | - | | `height` | `ResponsiveProp>` | No | `-` | - | | `inset` | `number \| Partial` | No | `0` | Inset around the entire chart (outside the axes). | | `justifyContent` | `ResponsiveProp` | No | `-` | - | | `key` | `Key \| null` | No | `-` | - | | `layout` | `horizontal \| vertical` | No | `'horizontal'` | Chart layout - describes the direction bars/areas grow. - vertical: Bars grow vertically. X is category axis, Y is value axis. - horizontal (default): Bars grow horizontally. Y is category axis, X is value axis. | | `left` | `ResponsiveProp>` | No | `-` | - | | `legend` | `null \| string \| number \| false \| true \| ReactElement> \| Iterable \| ReactPortal` | No | `-` | Whether to show the legend or a custom legend element. - true renders the default Legend component - A React element renders that element as the legend - false or omitted hides the legend | | `legendAccessibilityLabel` | `string` | No | `'Legend'` | Accessibility label for the legend group. | | `legendPosition` | `top \| bottom \| left \| right` | No | `'bottom'` | Position of the legend relative to the chart. | | `lineHeight` | `ResponsiveProp` | No | `-` | - | | `margin` | `ResponsiveProp<0 \| -1 \| -2 \| -0.25 \| -0.5 \| -0.75 \| -1.5 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10>` | No | `-` | - | | `marginBottom` | `ResponsiveProp<0 \| -1 \| -2 \| -0.25 \| -0.5 \| -0.75 \| -1.5 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10>` | No | `-` | - | | `marginEnd` | `ResponsiveProp<0 \| -1 \| -2 \| -0.25 \| -0.5 \| -0.75 \| -1.5 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10>` | No | `-` | - | | `marginStart` | `ResponsiveProp<0 \| -1 \| -2 \| -0.25 \| -0.5 \| -0.75 \| -1.5 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10>` | No | `-` | - | | `marginTop` | `ResponsiveProp<0 \| -1 \| -2 \| -0.25 \| -0.5 \| -0.75 \| -1.5 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10>` | No | `-` | - | | `marginX` | `ResponsiveProp<0 \| -1 \| -2 \| -0.25 \| -0.5 \| -0.75 \| -1.5 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10>` | No | `-` | - | | `marginY` | `ResponsiveProp<0 \| -1 \| -2 \| -0.25 \| -0.5 \| -0.75 \| -1.5 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10>` | No | `-` | - | | `maxHeight` | `ResponsiveProp>` | No | `-` | - | | `maxWidth` | `ResponsiveProp>` | No | `-` | - | | `minHeight` | `ResponsiveProp>` | No | `-` | - | | `minWidth` | `ResponsiveProp>` | No | `-` | - | | `onChange` | `FormEventHandler` | No | `-` | - | | `opacity` | `inherit \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - | | `overflow` | `ResponsiveProp` | No | `-` | - | | `padding` | `0 \| 1 \| 2 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10` | No | `-` | - | | `paddingBottom` | `0 \| 1 \| 2 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10` | No | `-` | - | | `paddingEnd` | `0 \| 1 \| 2 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10` | No | `-` | - | | `paddingStart` | `0 \| 1 \| 2 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10` | No | `-` | - | | `paddingTop` | `0 \| 1 \| 2 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10` | No | `-` | - | | `paddingX` | `0 \| 1 \| 2 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10` | No | `-` | - | | `paddingY` | `0 \| 1 \| 2 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10` | No | `-` | - | | `pin` | `top \| bottom \| left \| right \| all` | No | `-` | Direction in which to absolutely pin the box. | | `position` | `ResponsiveProp` | No | `-` | - | | `ref` | `((instance: SVGSVGElement \| null) => void) \| RefObject \| null` | No | `-` | - | | `right` | `ResponsiveProp>` | No | `-` | - | | `roundBaseline` | `boolean` | No | `true` | Whether to round the baseline of a bar (where the value is 0). | | `rowGap` | `0 \| 1 \| 2 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10` | No | `-` | - | | `series` | `PercentageBarSeries[]` | No | `-` | Configuration objects that define how to visualize the data. Each series contains its own data. | | `showXAxis` | `boolean` | No | `-` | Whether to show the X axis. | | `showYAxis` | `boolean` | No | `-` | Whether to show the Y axis. | | `stackGap` | `number` | No | `-` | Gap between bars in the stack. | | `stackMinSize` | `number` | No | `-` | Minimum size for the entire stack. | | `stroke` | `string` | No | `-` | Stroke color for the bar outline. | | `strokeWidth` | `number` | No | `-` | Stroke width for the bar outline. | | `style` | `CSSProperties` | No | `-` | Custom styles for the root element. | | `styles` | `{ root?: CSSProperties; chart?: CSSProperties \| undefined; } \| undefined` | No | `-` | Custom styles for the component. | | `testID` | `string` | No | `-` | Used to locate this element in unit and end-to-end tests. Under the hood, testID translates to data-testid on Web. On Mobile, testID stays the same - testID | | `textAlign` | `ResponsiveProp
` | No | `-` | - | | `textDecoration` | `ResponsiveProp` | No | `-` | - | | `textTransform` | `ResponsiveProp` | No | `-` | - | | `top` | `ResponsiveProp>` | No | `-` | - | | `transform` | `inherit \| none \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - | | `transition` | `Orchestration & Repeat & Tween \| Orchestration & Repeat & Spring \| Orchestration & Repeat & Keyframes \| Orchestration & Repeat & Inertia \| Orchestration & Repeat & Just \| Orchestration & Repeat & None \| Orchestration & Repeat & PermissiveTransitionDefinition \| Orchestration & Repeat & Tween & { [key: string]: TransitionDefinition; } \| Orchestration & Repeat & Spring & { [key: string]: TransitionDefinition; } \| Orchestration & Repeat & Keyframes & { [key: string]: TransitionDefinition; } \| Orchestration & Repeat & Inertia & { [key: string]: TransitionDefinition; } \| Orchestration & Repeat & Just & { [key: string]: TransitionDefinition; } \| Orchestration & Repeat & None & { [key: string]: TransitionDefinition; } \| Orchestration & Repeat & PermissiveTransitionDefinition & { [key: string]: TransitionDefinition; }` | No | `-` | Transition for updates. | | `transitions` | `{ enter?: BarTransition \| null; enterOpacity?: BarTransition \| null \| undefined; update?: BarTransition \| null \| undefined; } \| undefined` | No | `transitions = {{ enter: { type: 'spring', stiffness: 900, damping: 120, mass: 4, staggerDelay: 0.25 }, enterOpacity: { type: 'tween', duration: 0.2 }, update: { type: 'spring', stiffness: 900, damping: 120, mass: 4 } }}` | Transition configuration for enter and update animations. | | `userSelect` | `ResponsiveProp` | No | `-` | - | | `visibility` | `ResponsiveProp` | No | `-` | - | | `width` | `ResponsiveProp>` | No | `-` | - | | `xAxis` | `(Partial & SharedProps & { bandGridLinePlacement?: AxisBandPlacement; bandTickMarkPlacement?: AxisBandPlacement \| undefined; label?: string \| undefined; labelGap?: number \| undefined; minTickLabelGap?: number \| undefined; requestedTickCount?: number \| undefined; showGrid?: boolean \| undefined; showLine?: boolean \| undefined; showTickMarks?: boolean \| undefined; tickMarkSize?: number \| undefined; ticks?: number[] \| ((value: number) => boolean) \| undefined; tickMarkLabelGap?: number \| undefined; tickInterval?: number \| undefined; tickMinStep?: number \| undefined; tickMaxStep?: number \| undefined; } & { className?: string \| undefined; classNames?: { root?: string \| undefined; label?: string \| undefined; tickLabel?: string \| undefined; gridLine?: string \| undefined; line?: string \| undefined; tickMark?: string \| undefined; } \| undefined; style?: CSSProperties \| undefined; styles?: { root?: CSSProperties \| undefined; label?: CSSProperties \| undefined; tickLabel?: CSSProperties \| undefined; gridLine?: CSSProperties \| undefined; line?: CSSProperties \| undefined; tickMark?: CSSProperties \| undefined; } \| undefined; GridLineComponent?: LineComponent \| undefined; LineComponent?: LineComponent \| undefined; TickMarkLineComponent?: LineComponent \| undefined; tickLabelFormatter?: ((value: number) => ChartTextChildren) \| undefined; TickLabelComponent?: AxisTickLabelComponent \| undefined; } & { axisId?: string \| undefined; position?: top \| bottom \| undefined; height?: number \| undefined; }) \| undefined` | No | `-` | Configuration for x-axis. Accepts axis config and axis props. To show the axis, set showXAxis to true. | | `yAxis` | `(Partial & SharedProps & { bandGridLinePlacement?: AxisBandPlacement; bandTickMarkPlacement?: AxisBandPlacement \| undefined; label?: string \| undefined; labelGap?: number \| undefined; minTickLabelGap?: number \| undefined; requestedTickCount?: number \| undefined; showGrid?: boolean \| undefined; showLine?: boolean \| undefined; showTickMarks?: boolean \| undefined; tickMarkSize?: number \| undefined; ticks?: number[] \| ((value: number) => boolean) \| undefined; tickMarkLabelGap?: number \| undefined; tickInterval?: number \| undefined; tickMinStep?: number \| undefined; tickMaxStep?: number \| undefined; } & { className?: string \| undefined; classNames?: { root?: string \| undefined; label?: string \| undefined; tickLabel?: string \| undefined; gridLine?: string \| undefined; line?: string \| undefined; tickMark?: string \| undefined; } \| undefined; style?: CSSProperties \| undefined; styles?: { root?: CSSProperties \| undefined; label?: CSSProperties \| undefined; tickLabel?: CSSProperties \| undefined; gridLine?: CSSProperties \| undefined; line?: CSSProperties \| undefined; tickMark?: CSSProperties \| undefined; } \| undefined; GridLineComponent?: LineComponent \| undefined; LineComponent?: LineComponent \| undefined; TickMarkLineComponent?: LineComponent \| undefined; tickLabelFormatter?: ((value: number) => ChartTextChildren) \| undefined; TickLabelComponent?: AxisTickLabelComponent \| undefined; } & { axisId?: string \| undefined; position?: left \| right \| undefined; width?: number \| undefined; }) \| undefined` | No | `-` | Configuration for y-axis. Accepts axis config and axis props. To show the axis, set showYAxis to true. | | `zIndex` | `inherit \| auto \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - |