@coinbase/cds-mcp-server 8.62.0 → 8.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/mcp-docs/mobile/components/Accordion.txt +2 -0
- package/mcp-docs/mobile/components/AccordionItem.txt +2 -0
- package/mcp-docs/mobile/components/Alert.txt +2 -0
- package/mcp-docs/mobile/components/AreaChart.txt +3 -1
- package/mcp-docs/mobile/components/Avatar.txt +2 -0
- package/mcp-docs/mobile/components/AvatarButton.txt +2 -0
- package/mcp-docs/mobile/components/Banner.txt +3 -1
- package/mcp-docs/mobile/components/BarChart.txt +3 -1
- package/mcp-docs/mobile/components/Box.txt +2 -0
- package/mcp-docs/mobile/components/BrowserBar.txt +2 -0
- package/mcp-docs/mobile/components/Button.txt +4 -2
- package/mcp-docs/mobile/components/ButtonGroup.txt +2 -0
- package/mcp-docs/mobile/components/Calendar.txt +2 -0
- package/mcp-docs/mobile/components/Carousel.txt +2 -0
- package/mcp-docs/mobile/components/CartesianChart.txt +2 -0
- package/mcp-docs/mobile/components/CellMedia.txt +3 -1
- package/mcp-docs/mobile/components/Checkbox.txt +2 -0
- package/mcp-docs/mobile/components/CheckboxCell.txt +2 -0
- package/mcp-docs/mobile/components/CheckboxGroup.txt +2 -0
- package/mcp-docs/mobile/components/Chip.txt +2 -0
- package/mcp-docs/mobile/components/Coachmark.txt +2 -0
- package/mcp-docs/mobile/components/Collapsible.txt +2 -0
- package/mcp-docs/mobile/components/Combobox.txt +2 -0
- package/mcp-docs/mobile/components/ContainedAssetCard.txt +2 -0
- package/mcp-docs/mobile/components/ContentCard.txt +2 -0
- package/mcp-docs/mobile/components/ContentCardBody.txt +2 -0
- package/mcp-docs/mobile/components/ContentCardFooter.txt +2 -0
- package/mcp-docs/mobile/components/ContentCardHeader.txt +2 -0
- package/mcp-docs/mobile/components/ContentCell.txt +2 -0
- package/mcp-docs/mobile/components/ControlGroup.txt +2 -0
- package/mcp-docs/mobile/components/DataCard.txt +56 -0
- package/mcp-docs/mobile/components/DateInput.txt +2 -0
- package/mcp-docs/mobile/components/DatePicker.txt +2 -0
- package/mcp-docs/mobile/components/Divider.txt +2 -0
- package/mcp-docs/mobile/components/DotCount.txt +2 -0
- package/mcp-docs/mobile/components/DotStatusColor.txt +2 -0
- package/mcp-docs/mobile/components/DotSymbol.txt +3 -1
- package/mcp-docs/mobile/components/Fallback.txt +2 -0
- package/mcp-docs/mobile/components/FloatingAssetCard.txt +2 -0
- package/mcp-docs/mobile/components/HStack.txt +2 -0
- package/mcp-docs/mobile/components/HeroSquare.txt +3 -1
- package/mcp-docs/mobile/components/Icon.txt +3 -1
- package/mcp-docs/mobile/components/IconButton.txt +3 -1
- package/mcp-docs/mobile/components/InputChip.txt +2 -0
- package/mcp-docs/mobile/components/Interactable.txt +2 -0
- package/mcp-docs/mobile/components/Legend.txt +2 -0
- package/mcp-docs/mobile/components/LineChart.txt +3 -1
- package/mcp-docs/mobile/components/Link.txt +2 -0
- package/mcp-docs/mobile/components/ListCell.txt +2 -0
- package/mcp-docs/mobile/components/LogoMark.txt +2 -0
- package/mcp-docs/mobile/components/LogoWordMark.txt +2 -0
- package/mcp-docs/mobile/components/Lottie.txt +2 -0
- package/mcp-docs/mobile/components/LottieStatusAnimation.txt +2 -0
- package/mcp-docs/mobile/components/MediaCard.txt +2 -0
- package/mcp-docs/mobile/components/MediaChip.txt +2 -0
- package/mcp-docs/mobile/components/MessagingCard.txt +2 -0
- package/mcp-docs/mobile/components/Modal.txt +2 -0
- package/mcp-docs/mobile/components/ModalBody.txt +2 -0
- package/mcp-docs/mobile/components/ModalFooter.txt +2 -0
- package/mcp-docs/mobile/components/ModalHeader.txt +3 -1
- package/mcp-docs/mobile/components/MultiContentModule.txt +2 -0
- package/mcp-docs/mobile/components/NavigationTitle.txt +2 -0
- package/mcp-docs/mobile/components/NavigationTitleSelect.txt +2 -0
- package/mcp-docs/mobile/components/NudgeCard.txt +2 -0
- package/mcp-docs/mobile/components/Numpad.txt +2 -0
- package/mcp-docs/mobile/components/Overlay.txt +2 -0
- package/mcp-docs/mobile/components/PageFooter.txt +2 -0
- package/mcp-docs/mobile/components/PageHeader.txt +2 -0
- package/mcp-docs/mobile/components/PercentageBarChart.txt +819 -0
- package/mcp-docs/mobile/components/PeriodSelector.txt +4 -2
- package/mcp-docs/mobile/components/Pictogram.txt +2 -0
- package/mcp-docs/mobile/components/Point.txt +2 -0
- package/mcp-docs/mobile/components/PortalProvider.txt +2 -0
- package/mcp-docs/mobile/components/Pressable.txt +2 -0
- package/mcp-docs/mobile/components/ProgressBar.txt +2 -0
- package/mcp-docs/mobile/components/ProgressBarWithFixedLabels.txt +2 -0
- package/mcp-docs/mobile/components/ProgressBarWithFloatLabel.txt +2 -0
- package/mcp-docs/mobile/components/ProgressCircle.txt +2 -0
- package/mcp-docs/mobile/components/Radio.txt +2 -0
- package/mcp-docs/mobile/components/RadioCell.txt +2 -0
- package/mcp-docs/mobile/components/RadioGroup.txt +2 -0
- package/mcp-docs/mobile/components/ReferenceLine.txt +2 -0
- package/mcp-docs/mobile/components/RemoteImage.txt +2 -0
- package/mcp-docs/mobile/components/RemoteImageGroup.txt +2 -0
- package/mcp-docs/mobile/components/RollingNumber.txt +2 -0
- package/mcp-docs/mobile/components/Scrubber.txt +2 -0
- package/mcp-docs/mobile/components/SearchInput.txt +2 -0
- package/mcp-docs/mobile/components/SectionHeader.txt +2 -0
- package/mcp-docs/mobile/components/SegmentedTabs.txt +4 -2
- package/mcp-docs/mobile/components/Select.txt +2 -0
- package/mcp-docs/mobile/components/SelectAlpha.txt +2 -0
- package/mcp-docs/mobile/components/SelectChip.txt +2 -0
- package/mcp-docs/mobile/components/SelectChipAlpha.txt +2 -0
- package/mcp-docs/mobile/components/SelectOption.txt +2 -0
- package/mcp-docs/mobile/components/SlideButton.txt +2 -0
- package/mcp-docs/mobile/components/Spacer.txt +2 -0
- package/mcp-docs/mobile/components/Sparkline.txt +2 -0
- package/mcp-docs/mobile/components/SparklineGradient.txt +2 -0
- package/mcp-docs/mobile/components/SparklineInteractive.txt +2 -0
- package/mcp-docs/mobile/components/SparklineInteractiveHeader.txt +2 -0
- package/mcp-docs/mobile/components/Spinner.txt +2 -0
- package/mcp-docs/mobile/components/SpotIcon.txt +2 -0
- package/mcp-docs/mobile/components/SpotRectangle.txt +2 -0
- package/mcp-docs/mobile/components/SpotSquare.txt +2 -0
- package/mcp-docs/mobile/components/Stepper.txt +2 -0
- package/mcp-docs/mobile/components/SubBrandLogoMark.txt +2 -0
- package/mcp-docs/mobile/components/SubBrandLogoWordMark.txt +2 -0
- package/mcp-docs/mobile/components/Switch.txt +2 -0
- package/mcp-docs/mobile/components/TabIndicator.txt +2 -0
- package/mcp-docs/mobile/components/TabLabel.txt +2 -0
- package/mcp-docs/mobile/components/TabNavigation.txt +2 -0
- package/mcp-docs/mobile/components/TabbedChips.txt +2 -0
- package/mcp-docs/mobile/components/TabbedChipsAlpha.txt +2 -0
- package/mcp-docs/mobile/components/Tabs.txt +69 -107
- package/mcp-docs/mobile/components/Tag.txt +4 -2
- package/mcp-docs/mobile/components/Text.txt +2 -0
- package/mcp-docs/mobile/components/TextInput.txt +2 -0
- package/mcp-docs/mobile/components/ThemeProvider.txt +2 -0
- package/mcp-docs/mobile/components/Toast.txt +2 -0
- package/mcp-docs/mobile/components/Tooltip.txt +2 -0
- package/mcp-docs/mobile/components/TopNavBar.txt +2 -0
- package/mcp-docs/mobile/components/Tour.txt +13 -0
- package/mcp-docs/mobile/components/Tray.txt +2 -0
- package/mcp-docs/mobile/components/UpsellCard.txt +2 -0
- package/mcp-docs/mobile/components/VStack.txt +2 -0
- package/mcp-docs/mobile/components/XAxis.txt +2 -0
- package/mcp-docs/mobile/components/YAxis.txt +2 -0
- package/mcp-docs/mobile/getting-started/ai-overview.txt +2 -0
- package/mcp-docs/mobile/getting-started/colors.txt +66 -0
- package/mcp-docs/mobile/getting-started/installation.txt +2 -0
- package/mcp-docs/mobile/getting-started/introduction.txt +2 -0
- package/mcp-docs/mobile/getting-started/playground.txt +2 -0
- package/mcp-docs/mobile/getting-started/styling.txt +2 -0
- package/mcp-docs/mobile/getting-started/templates.txt +2 -0
- package/mcp-docs/mobile/getting-started/theming.txt +2 -0
- package/mcp-docs/mobile/guides/v8-migration-guide.txt +2 -0
- package/mcp-docs/mobile/hooks/useDimensions.txt +2 -0
- package/mcp-docs/mobile/hooks/useEventHandler.txt +2 -0
- package/mcp-docs/mobile/hooks/useMergeRefs.txt +2 -0
- package/mcp-docs/mobile/hooks/useOverlayContentContext.txt +2 -0
- package/mcp-docs/mobile/hooks/usePreviousValue.txt +2 -0
- package/mcp-docs/mobile/hooks/useRefMap.txt +2 -0
- package/mcp-docs/mobile/hooks/useTheme.txt +2 -0
- package/mcp-docs/mobile/routes.txt +3 -1
- package/mcp-docs/web/components/Accordion.txt +2 -0
- package/mcp-docs/web/components/AccordionItem.txt +2 -0
- package/mcp-docs/web/components/Alert.txt +2 -0
- package/mcp-docs/web/components/AreaChart.txt +3 -1
- package/mcp-docs/web/components/Avatar.txt +2 -0
- package/mcp-docs/web/components/AvatarButton.txt +2 -0
- package/mcp-docs/web/components/Banner.txt +3 -1
- package/mcp-docs/web/components/BarChart.txt +3 -1
- package/mcp-docs/web/components/Box.txt +2 -0
- package/mcp-docs/web/components/Button.txt +4 -2
- package/mcp-docs/web/components/ButtonGroup.txt +2 -0
- package/mcp-docs/web/components/Calendar.txt +2 -0
- package/mcp-docs/web/components/Carousel.txt +2 -0
- package/mcp-docs/web/components/CartesianChart.txt +2 -0
- package/mcp-docs/web/components/CellMedia.txt +3 -1
- package/mcp-docs/web/components/Checkbox.txt +2 -0
- package/mcp-docs/web/components/CheckboxCell.txt +2 -0
- package/mcp-docs/web/components/CheckboxGroup.txt +2 -0
- package/mcp-docs/web/components/Chip.txt +2 -0
- package/mcp-docs/web/components/Coachmark.txt +2 -0
- package/mcp-docs/web/components/Collapsible.txt +2 -0
- package/mcp-docs/web/components/Combobox.txt +2 -0
- package/mcp-docs/web/components/ContainedAssetCard.txt +2 -0
- package/mcp-docs/web/components/ContentCard.txt +2 -0
- package/mcp-docs/web/components/ContentCardBody.txt +2 -0
- package/mcp-docs/web/components/ContentCardFooter.txt +2 -0
- package/mcp-docs/web/components/ContentCardHeader.txt +2 -0
- package/mcp-docs/web/components/ContentCell.txt +2 -0
- package/mcp-docs/web/components/ControlGroup.txt +2 -0
- package/mcp-docs/web/components/DataCard.txt +100 -0
- package/mcp-docs/web/components/DateInput.txt +2 -0
- package/mcp-docs/web/components/DatePicker.txt +2 -0
- package/mcp-docs/web/components/Divider.txt +2 -0
- package/mcp-docs/web/components/DotCount.txt +2 -0
- package/mcp-docs/web/components/DotStatusColor.txt +2 -0
- package/mcp-docs/web/components/DotSymbol.txt +3 -1
- package/mcp-docs/web/components/Dropdown.txt +2 -0
- package/mcp-docs/web/components/Fallback.txt +2 -0
- package/mcp-docs/web/components/FloatingAssetCard.txt +2 -0
- package/mcp-docs/web/components/FocusTrap.txt +2 -0
- package/mcp-docs/web/components/FullscreenAlert.txt +3 -1
- package/mcp-docs/web/components/FullscreenModal.txt +2 -0
- package/mcp-docs/web/components/FullscreenModalLayout.txt +2 -0
- package/mcp-docs/web/components/Grid.txt +2 -0
- package/mcp-docs/web/components/GridColumn.txt +2 -0
- package/mcp-docs/web/components/HStack.txt +2 -0
- package/mcp-docs/web/components/HeroSquare.txt +3 -1
- package/mcp-docs/web/components/Icon.txt +3 -1
- package/mcp-docs/web/components/IconButton.txt +3 -1
- package/mcp-docs/web/components/InputChip.txt +2 -0
- package/mcp-docs/web/components/Interactable.txt +2 -0
- package/mcp-docs/web/components/Legend.txt +2 -0
- package/mcp-docs/web/components/LineChart.txt +3 -1
- package/mcp-docs/web/components/Link.txt +2 -0
- package/mcp-docs/web/components/ListCell.txt +2 -0
- package/mcp-docs/web/components/LogoMark.txt +2 -0
- package/mcp-docs/web/components/LogoWordMark.txt +2 -0
- package/mcp-docs/web/components/Lottie.txt +2 -0
- package/mcp-docs/web/components/LottieStatusAnimation.txt +2 -0
- package/mcp-docs/web/components/MediaCard.txt +2 -0
- package/mcp-docs/web/components/MediaChip.txt +2 -0
- package/mcp-docs/web/components/MediaQueryProvider.txt +2 -0
- package/mcp-docs/web/components/MessagingCard.txt +2 -0
- package/mcp-docs/web/components/Modal.txt +2 -0
- package/mcp-docs/web/components/ModalBody.txt +2 -0
- package/mcp-docs/web/components/ModalFooter.txt +2 -0
- package/mcp-docs/web/components/ModalHeader.txt +3 -1
- package/mcp-docs/web/components/MultiContentModule.txt +2 -0
- package/mcp-docs/web/components/NavigationBar.txt +2 -0
- package/mcp-docs/web/components/NavigationTitle.txt +2 -0
- package/mcp-docs/web/components/NavigationTitleSelect.txt +2 -0
- package/mcp-docs/web/components/NudgeCard.txt +2 -0
- package/mcp-docs/web/components/Overlay.txt +2 -0
- package/mcp-docs/web/components/PageFooter.txt +2 -0
- package/mcp-docs/web/components/PageHeader.txt +2 -0
- package/mcp-docs/web/components/Pagination.txt +2 -0
- package/mcp-docs/web/components/PercentageBarChart.txt +814 -0
- package/mcp-docs/web/components/PeriodSelector.txt +4 -2
- package/mcp-docs/web/components/Pictogram.txt +2 -0
- package/mcp-docs/web/components/Point.txt +2 -0
- package/mcp-docs/web/components/PopoverPanel.txt +283 -0
- package/mcp-docs/web/components/PortalProvider.txt +2 -0
- package/mcp-docs/web/components/Pressable.txt +2 -0
- package/mcp-docs/web/components/ProgressBar.txt +2 -0
- package/mcp-docs/web/components/ProgressBarWithFixedLabels.txt +2 -0
- package/mcp-docs/web/components/ProgressBarWithFloatLabel.txt +2 -0
- package/mcp-docs/web/components/ProgressCircle.txt +2 -0
- package/mcp-docs/web/components/Radio.txt +2 -0
- package/mcp-docs/web/components/RadioCell.txt +2 -0
- package/mcp-docs/web/components/RadioGroup.txt +2 -0
- package/mcp-docs/web/components/ReferenceLine.txt +2 -0
- package/mcp-docs/web/components/RemoteImage.txt +2 -0
- package/mcp-docs/web/components/RemoteImageGroup.txt +2 -0
- package/mcp-docs/web/components/RollingNumber.txt +2 -0
- package/mcp-docs/web/components/Scrubber.txt +2 -0
- package/mcp-docs/web/components/SearchInput.txt +2 -0
- package/mcp-docs/web/components/SectionHeader.txt +2 -0
- package/mcp-docs/web/components/SegmentedControl.txt +2 -0
- package/mcp-docs/web/components/SegmentedTabs.txt +4 -2
- package/mcp-docs/web/components/Select.txt +2 -0
- package/mcp-docs/web/components/SelectAlpha.txt +2 -0
- package/mcp-docs/web/components/SelectChip.txt +2 -0
- package/mcp-docs/web/components/SelectChipAlpha.txt +2 -0
- package/mcp-docs/web/components/SelectOption.txt +2 -0
- package/mcp-docs/web/components/Sidebar.txt +2 -0
- package/mcp-docs/web/components/SidebarItem.txt +3 -1
- package/mcp-docs/web/components/SidebarMoreMenu.txt +2 -0
- package/mcp-docs/web/components/Spacer.txt +2 -0
- package/mcp-docs/web/components/Sparkline.txt +2 -0
- package/mcp-docs/web/components/SparklineGradient.txt +2 -0
- package/mcp-docs/web/components/SparklineInteractive.txt +2 -0
- package/mcp-docs/web/components/SparklineInteractiveHeader.txt +2 -0
- package/mcp-docs/web/components/Spinner.txt +2 -0
- package/mcp-docs/web/components/SpotIcon.txt +2 -0
- package/mcp-docs/web/components/SpotRectangle.txt +2 -0
- package/mcp-docs/web/components/SpotSquare.txt +2 -0
- package/mcp-docs/web/components/Stepper.txt +2 -0
- package/mcp-docs/web/components/SubBrandLogoMark.txt +2 -0
- package/mcp-docs/web/components/SubBrandLogoWordMark.txt +2 -0
- package/mcp-docs/web/components/Switch.txt +2 -0
- package/mcp-docs/web/components/TabIndicator.txt +2 -0
- package/mcp-docs/web/components/TabLabel.txt +2 -0
- package/mcp-docs/web/components/TabNavigation.txt +2 -0
- package/mcp-docs/web/components/TabbedChips.txt +2 -0
- package/mcp-docs/web/components/TabbedChipsAlpha.txt +2 -0
- package/mcp-docs/web/components/Table.txt +2 -0
- package/mcp-docs/web/components/TableBody.txt +2 -0
- package/mcp-docs/web/components/TableCaption.txt +2 -0
- package/mcp-docs/web/components/TableCell.txt +2 -0
- package/mcp-docs/web/components/TableCellFallback.txt +2 -0
- package/mcp-docs/web/components/TableFooter.txt +2 -0
- package/mcp-docs/web/components/TableHeader.txt +2 -0
- package/mcp-docs/web/components/TableRow.txt +2 -0
- package/mcp-docs/web/components/Tabs.txt +72 -104
- package/mcp-docs/web/components/Tag.txt +4 -2
- package/mcp-docs/web/components/Text.txt +2 -0
- package/mcp-docs/web/components/TextInput.txt +2 -0
- package/mcp-docs/web/components/ThemeProvider.txt +2 -0
- package/mcp-docs/web/components/TileButton.txt +2 -0
- package/mcp-docs/web/components/Toast.txt +2 -0
- package/mcp-docs/web/components/Tooltip.txt +2 -0
- package/mcp-docs/web/components/Tour.txt +14 -0
- package/mcp-docs/web/components/Tray.txt +2 -0
- package/mcp-docs/web/components/UpsellCard.txt +2 -0
- package/mcp-docs/web/components/VStack.txt +2 -0
- package/mcp-docs/web/components/XAxis.txt +2 -0
- package/mcp-docs/web/components/YAxis.txt +2 -0
- package/mcp-docs/web/getting-started/ai-overview.txt +2 -0
- package/mcp-docs/web/getting-started/colors.txt +66 -0
- package/mcp-docs/web/getting-started/installation.txt +3 -1
- package/mcp-docs/web/getting-started/introduction.txt +2 -0
- package/mcp-docs/web/getting-started/playground.txt +2 -0
- package/mcp-docs/web/getting-started/styling.txt +2 -0
- package/mcp-docs/web/getting-started/templates.txt +2 -0
- package/mcp-docs/web/getting-started/theming.txt +2 -0
- package/mcp-docs/web/guides/v8-migration-guide.txt +2 -0
- package/mcp-docs/web/hooks/useBreakpoints.txt +2 -0
- package/mcp-docs/web/hooks/useDimensions.txt +2 -0
- package/mcp-docs/web/hooks/useEventHandler.txt +2 -0
- package/mcp-docs/web/hooks/useHasMounted.txt +2 -0
- package/mcp-docs/web/hooks/useIsoEffect.txt +2 -0
- package/mcp-docs/web/hooks/useMediaQuery.txt +2 -0
- package/mcp-docs/web/hooks/useMergeRefs.txt +2 -0
- package/mcp-docs/web/hooks/useOverlayContentContext.txt +2 -0
- package/mcp-docs/web/hooks/usePreviousValue.txt +2 -0
- package/mcp-docs/web/hooks/useRefMap.txt +2 -0
- package/mcp-docs/web/hooks/useScrollBlocker.txt +2 -0
- package/mcp-docs/web/hooks/useTheme.txt +2 -0
- package/mcp-docs/web/routes.txt +4 -1
- package/package.json +1 -1
|
@@ -0,0 +1,814 @@
|
|
|
1
|
+
# PercentageBarChart
|
|
2
|
+
|
|
3
|
+
**📖 Live documentation:** https://cds.coinbase.com/components/charts/PercentageBarChart/
|
|
4
|
+
|
|
5
|
+
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.
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { PercentageBarChart } from '@coinbase/cds-web-visualization'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Examples
|
|
14
|
+
|
|
15
|
+
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.
|
|
16
|
+
|
|
17
|
+
### Basics
|
|
18
|
+
|
|
19
|
+
The only prop required is `series`, which takes an array of series objects. Each series object needs an `id` and a value for `data`.
|
|
20
|
+
|
|
21
|
+
```jsx live
|
|
22
|
+
<PercentageBarChart
|
|
23
|
+
height={16}
|
|
24
|
+
series={[
|
|
25
|
+
{ id: 'a', data: 70, label: 'Segment A', color: 'var(--color-fgPositive)' },
|
|
26
|
+
{ id: 'b', data: 45, label: 'Segment B', color: 'var(--color-fgNegative)' },
|
|
27
|
+
]}
|
|
28
|
+
/>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Stack Gap
|
|
32
|
+
|
|
33
|
+
Use `stackGap` to add space between segments while keeping the full bar length.
|
|
34
|
+
|
|
35
|
+
```jsx live
|
|
36
|
+
<PercentageBarChart
|
|
37
|
+
height={20}
|
|
38
|
+
series={[
|
|
39
|
+
{ id: 'a', data: 40, label: 'A', color: 'var(--color-fgPositive)' },
|
|
40
|
+
{ id: 'b', data: 35, label: 'B', color: 'var(--color-fgWarning)' },
|
|
41
|
+
{ id: 'c', data: 20, label: 'C', color: 'var(--color-accentBoldPurple)' },
|
|
42
|
+
]}
|
|
43
|
+
stackGap={6}
|
|
44
|
+
/>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Border Radius
|
|
48
|
+
|
|
49
|
+
Bars use `borderRadius` like in [BarChart](/components/charts/BarChart/#border-radius).
|
|
50
|
+
|
|
51
|
+
```jsx live
|
|
52
|
+
<PercentageBarChart
|
|
53
|
+
borderRadius={1000}
|
|
54
|
+
height={28}
|
|
55
|
+
series={[
|
|
56
|
+
{ id: 'a', data: 45, color: 'rgb(var(--purple30))', label: 'A' },
|
|
57
|
+
{ id: 'b', data: 30, color: 'rgb(var(--blue30))', label: 'B' },
|
|
58
|
+
{ id: 'c', data: 20, color: 'rgb(var(--teal30))', label: 'C' },
|
|
59
|
+
]}
|
|
60
|
+
stackGap={2}
|
|
61
|
+
/>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Data
|
|
65
|
+
|
|
66
|
+
**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.
|
|
67
|
+
|
|
68
|
+
```jsx live
|
|
69
|
+
<PercentageBarChart
|
|
70
|
+
height={100}
|
|
71
|
+
showXAxis
|
|
72
|
+
showYAxis
|
|
73
|
+
barMinSize={12}
|
|
74
|
+
borderRadius={8}
|
|
75
|
+
series={[
|
|
76
|
+
{ id: 'a', data: [40, null, 20], label: 'A', color: 'var(--color-fgPositive)' },
|
|
77
|
+
{ id: 'b', data: [-10, 60, 30], label: 'B', color: 'var(--color-fgWarning)' },
|
|
78
|
+
{ id: 'c', data: [null, 50], label: 'C', color: 'var(--color-fgMuted)' },
|
|
79
|
+
{ id: 'd', data: 45, label: 'D', color: 'var(--color-fgNegative)' },
|
|
80
|
+
]}
|
|
81
|
+
stackGap={2}
|
|
82
|
+
xAxis={{ showTickMarks: true }}
|
|
83
|
+
yAxis={{
|
|
84
|
+
data: ['Q1', 'Q2', 'Q3'],
|
|
85
|
+
position: 'left',
|
|
86
|
+
categoryPadding: 0.45,
|
|
87
|
+
}}
|
|
88
|
+
/>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
If **every** group sums to zero after clamping, nothing is drawn—handle that in surrounding UI (empty state or copy).
|
|
92
|
+
|
|
93
|
+
### Customization
|
|
94
|
+
|
|
95
|
+
#### Bar Stack Spacing
|
|
96
|
+
|
|
97
|
+
Use `categoryPadding` on the band axis to adjust spacing between stacks.
|
|
98
|
+
|
|
99
|
+
```jsx live
|
|
100
|
+
<PercentageBarChart
|
|
101
|
+
legend
|
|
102
|
+
showXAxis
|
|
103
|
+
showYAxis
|
|
104
|
+
barMinSize={18}
|
|
105
|
+
borderRadius={24}
|
|
106
|
+
height={240}
|
|
107
|
+
series={[
|
|
108
|
+
{ id: 'a', data: [55, 40, 35], label: 'A', color: 'var(--color-fgWarning)' },
|
|
109
|
+
{ id: 'b', data: [30, 45, 25], label: 'B', color: 'var(--color-accentBoldPurple)' },
|
|
110
|
+
{ id: 'c', data: [15, 15, 40], label: 'C', color: 'var(--color-fgMuted)' },
|
|
111
|
+
]}
|
|
112
|
+
stackGap={4}
|
|
113
|
+
xAxis={{ showTickMarks: true }}
|
|
114
|
+
yAxis={{
|
|
115
|
+
data: ['Q1', 'Q2', 'Q3'],
|
|
116
|
+
position: 'left',
|
|
117
|
+
categoryPadding: 0.7,
|
|
118
|
+
}}
|
|
119
|
+
/>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
#### Minimum Bar Size
|
|
123
|
+
|
|
124
|
+
`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:
|
|
125
|
+
|
|
126
|
+
```jsx live
|
|
127
|
+
<PercentageBarChart
|
|
128
|
+
barMinSize={16}
|
|
129
|
+
height={16}
|
|
130
|
+
series={[
|
|
131
|
+
{ id: 'a', data: 99, label: 'Segment A', color: 'var(--color-fgPositive)' },
|
|
132
|
+
{ id: 'b', data: 0.001, label: 'Segment B', color: 'var(--color-fgNegative)' },
|
|
133
|
+
]}
|
|
134
|
+
stackGap={2}
|
|
135
|
+
/>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
#### Custom Components
|
|
139
|
+
|
|
140
|
+
##### Slanted Stack Gap
|
|
141
|
+
|
|
142
|
+
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.
|
|
143
|
+
|
|
144
|
+
```jsx live
|
|
145
|
+
function SlantedStackExample() {
|
|
146
|
+
function getSlantedHorizontalBarPath(
|
|
147
|
+
x,
|
|
148
|
+
y,
|
|
149
|
+
width,
|
|
150
|
+
height,
|
|
151
|
+
borderRadius,
|
|
152
|
+
pillLeft,
|
|
153
|
+
pillRight,
|
|
154
|
+
slantDx,
|
|
155
|
+
) {
|
|
156
|
+
if (width <= 0 || height <= 0 || pillLeft === pillRight) return undefined;
|
|
157
|
+
|
|
158
|
+
const r = Math.min(borderRadius, height / 2, width / 2);
|
|
159
|
+
const s = Math.min(Math.max(0, slantDx), width - r * 2);
|
|
160
|
+
const x0 = x,
|
|
161
|
+
x1 = x + width,
|
|
162
|
+
y0 = y,
|
|
163
|
+
y1 = y + height;
|
|
164
|
+
|
|
165
|
+
if (pillLeft && !pillRight) {
|
|
166
|
+
return [
|
|
167
|
+
`M ${x0 + r} ${y0}`,
|
|
168
|
+
`L ${x1} ${y0}`,
|
|
169
|
+
`L ${x1 - s} ${y1}`,
|
|
170
|
+
`L ${x0 + r} ${y1}`,
|
|
171
|
+
`A ${r} ${r} 0 0 1 ${x0} ${y1 - r}`,
|
|
172
|
+
`L ${x0} ${y0 + r}`,
|
|
173
|
+
`A ${r} ${r} 0 0 1 ${x0 + r} ${y0}`,
|
|
174
|
+
'Z',
|
|
175
|
+
].join(' ');
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return [
|
|
179
|
+
`M ${x0 + s} ${y0}`,
|
|
180
|
+
`L ${x1 - r} ${y0}`,
|
|
181
|
+
`A ${r} ${r} 0 0 1 ${x1} ${y0 + r}`,
|
|
182
|
+
`L ${x1} ${y1 - r}`,
|
|
183
|
+
`A ${r} ${r} 0 0 1 ${x1 - r} ${y1}`,
|
|
184
|
+
`L ${x0} ${y1}`,
|
|
185
|
+
'Z',
|
|
186
|
+
].join(' ');
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const SLANT_DX = 8;
|
|
190
|
+
|
|
191
|
+
const SlantedStackBar = memo(function SlantedStackBar(props) {
|
|
192
|
+
const { layout } = useCartesianChartContext();
|
|
193
|
+
const {
|
|
194
|
+
x,
|
|
195
|
+
y,
|
|
196
|
+
width,
|
|
197
|
+
height,
|
|
198
|
+
borderRadius = 4,
|
|
199
|
+
roundTop,
|
|
200
|
+
roundBottom,
|
|
201
|
+
dataX,
|
|
202
|
+
d: defaultD,
|
|
203
|
+
fill,
|
|
204
|
+
fillOpacity,
|
|
205
|
+
...rest
|
|
206
|
+
} = props;
|
|
207
|
+
|
|
208
|
+
const d = useMemo(() => {
|
|
209
|
+
if (layout !== 'horizontal') {
|
|
210
|
+
return (
|
|
211
|
+
defaultD ??
|
|
212
|
+
getBarPath(x, y, width, height, borderRadius, !!roundTop, !!roundBottom, layout)
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
const isLeftmost = Array.isArray(dataX) && Math.abs(dataX[0]) < 1;
|
|
216
|
+
return (
|
|
217
|
+
getSlantedHorizontalBarPath(
|
|
218
|
+
x,
|
|
219
|
+
y,
|
|
220
|
+
width,
|
|
221
|
+
height,
|
|
222
|
+
borderRadius,
|
|
223
|
+
isLeftmost,
|
|
224
|
+
!isLeftmost,
|
|
225
|
+
SLANT_DX,
|
|
226
|
+
) ??
|
|
227
|
+
defaultD ??
|
|
228
|
+
getBarPath(x, y, width, height, borderRadius, !!roundTop, !!roundBottom, layout)
|
|
229
|
+
);
|
|
230
|
+
}, [layout, defaultD, dataX, x, y, width, height, borderRadius, roundTop, roundBottom]);
|
|
231
|
+
|
|
232
|
+
if (!d) return null;
|
|
233
|
+
|
|
234
|
+
return (
|
|
235
|
+
<Path
|
|
236
|
+
{...rest}
|
|
237
|
+
animate
|
|
238
|
+
clipRect={null}
|
|
239
|
+
d={d}
|
|
240
|
+
fill={fill}
|
|
241
|
+
fillOpacity={fillOpacity}
|
|
242
|
+
transitions={props.transitions}
|
|
243
|
+
/>
|
|
244
|
+
);
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
return (
|
|
248
|
+
<PercentageBarChart
|
|
249
|
+
animate={false}
|
|
250
|
+
BarComponent={SlantedStackBar}
|
|
251
|
+
barMinSize={12}
|
|
252
|
+
borderRadius={24}
|
|
253
|
+
height={12}
|
|
254
|
+
series={[
|
|
255
|
+
{ id: 'team-a', data: 40, color: 'rgb(var(--teal60))' },
|
|
256
|
+
{ id: 'team-b', data: 61, color: 'var(--color-accentBoldBlue)' },
|
|
257
|
+
]}
|
|
258
|
+
/>
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
##### Dotted bar
|
|
264
|
+
|
|
265
|
+
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.
|
|
266
|
+
|
|
267
|
+
```jsx live
|
|
268
|
+
function DottedBarExamples() {
|
|
269
|
+
const DOTTED_BAR_OUTLINE_STROKE_WIDTH = 2;
|
|
270
|
+
|
|
271
|
+
const DottedBarComponent = memo((props) => {
|
|
272
|
+
const {
|
|
273
|
+
dataX,
|
|
274
|
+
x,
|
|
275
|
+
y,
|
|
276
|
+
width,
|
|
277
|
+
height,
|
|
278
|
+
borderRadius = 4,
|
|
279
|
+
roundTop = true,
|
|
280
|
+
roundBottom = true,
|
|
281
|
+
} = props;
|
|
282
|
+
const { layout } = useCartesianChartContext();
|
|
283
|
+
const patternSize = 4;
|
|
284
|
+
const dotSize = 1;
|
|
285
|
+
const patternId = useId();
|
|
286
|
+
const maskId = useId();
|
|
287
|
+
const outlineInset = DOTTED_BAR_OUTLINE_STROKE_WIDTH / 2;
|
|
288
|
+
|
|
289
|
+
const outlineGeometry = useMemo(() => {
|
|
290
|
+
const insetWidth = width - 2 * outlineInset;
|
|
291
|
+
const insetHeight = height - 2 * outlineInset;
|
|
292
|
+
if (insetWidth <= 0 || insetHeight <= 0) {
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
295
|
+
const insetX = x + outlineInset;
|
|
296
|
+
const insetY = y + outlineInset;
|
|
297
|
+
const insetRadius = Math.max(0, borderRadius - outlineInset);
|
|
298
|
+
return {
|
|
299
|
+
d: getBarPath(
|
|
300
|
+
insetX,
|
|
301
|
+
insetY,
|
|
302
|
+
insetWidth,
|
|
303
|
+
insetHeight,
|
|
304
|
+
insetRadius,
|
|
305
|
+
roundTop,
|
|
306
|
+
roundBottom,
|
|
307
|
+
layout,
|
|
308
|
+
),
|
|
309
|
+
height: insetHeight,
|
|
310
|
+
width: insetWidth,
|
|
311
|
+
x: insetX,
|
|
312
|
+
y: insetY,
|
|
313
|
+
};
|
|
314
|
+
}, [borderRadius, height, layout, outlineInset, roundBottom, roundTop, width, x, y]);
|
|
315
|
+
|
|
316
|
+
const uniqueMaskId = `${maskId}-${dataX}`;
|
|
317
|
+
const uniquePatternId = `${patternId}-${dataX}`;
|
|
318
|
+
return (
|
|
319
|
+
<>
|
|
320
|
+
<defs>
|
|
321
|
+
<pattern
|
|
322
|
+
height={patternSize}
|
|
323
|
+
id={uniquePatternId}
|
|
324
|
+
patternUnits="userSpaceOnUse"
|
|
325
|
+
width={patternSize}
|
|
326
|
+
x={x}
|
|
327
|
+
y={y}
|
|
328
|
+
>
|
|
329
|
+
<circle cx={patternSize / 2} cy={patternSize / 2} fill="white" r={dotSize} />
|
|
330
|
+
</pattern>
|
|
331
|
+
<mask id={uniqueMaskId}>
|
|
332
|
+
<DefaultBar {...props} fill={`url(#${uniquePatternId})`} />
|
|
333
|
+
</mask>
|
|
334
|
+
</defs>
|
|
335
|
+
<g mask={`url(#${uniqueMaskId})`}>
|
|
336
|
+
<DefaultBar {...props} />
|
|
337
|
+
</g>
|
|
338
|
+
{outlineGeometry ? (
|
|
339
|
+
<DefaultBar
|
|
340
|
+
{...props}
|
|
341
|
+
{...outlineGeometry}
|
|
342
|
+
fill="transparent"
|
|
343
|
+
stroke={props.fill}
|
|
344
|
+
strokeWidth={DOTTED_BAR_OUTLINE_STROKE_WIDTH}
|
|
345
|
+
/>
|
|
346
|
+
) : (
|
|
347
|
+
<DefaultBar
|
|
348
|
+
{...props}
|
|
349
|
+
fill="transparent"
|
|
350
|
+
stroke={props.fill}
|
|
351
|
+
strokeWidth={DOTTED_BAR_OUTLINE_STROKE_WIDTH}
|
|
352
|
+
/>
|
|
353
|
+
)}
|
|
354
|
+
</>
|
|
355
|
+
);
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
const dottedBarSeries = [
|
|
359
|
+
{
|
|
360
|
+
id: 'segment-a',
|
|
361
|
+
data: 60,
|
|
362
|
+
label: 'Segment A',
|
|
363
|
+
color: 'rgb(var(--teal60))',
|
|
364
|
+
BarComponent: DottedBarComponent,
|
|
365
|
+
},
|
|
366
|
+
{ id: 'segment-b', data: 30, label: 'Segment B', color: 'rgb(var(--chartreuse50))' },
|
|
367
|
+
{ id: 'segment-c', data: 10, label: 'Segment C', color: 'rgb(var(--indigo40))' },
|
|
368
|
+
];
|
|
369
|
+
|
|
370
|
+
const dottedBarSeriesPlain = [
|
|
371
|
+
{ id: 'segment-a', data: 60, label: 'Segment A', color: 'rgb(var(--teal60))' },
|
|
372
|
+
{ id: 'segment-b', data: 30, label: 'Segment B', color: 'rgb(var(--chartreuse50))' },
|
|
373
|
+
{ id: 'segment-c', data: 10, label: 'Segment C', color: 'rgb(var(--indigo40))' },
|
|
374
|
+
];
|
|
375
|
+
|
|
376
|
+
return (
|
|
377
|
+
<VStack gap={3}>
|
|
378
|
+
<VStack gap={1}>
|
|
379
|
+
<Text color="fgMuted" font="label2">
|
|
380
|
+
First series only
|
|
381
|
+
</Text>
|
|
382
|
+
<PercentageBarChart barMinSize={24} height={24} series={dottedBarSeries} stackGap={4} />
|
|
383
|
+
</VStack>
|
|
384
|
+
<VStack gap={1}>
|
|
385
|
+
<Text color="fgMuted" font="label2">
|
|
386
|
+
Chart-level BarComponent
|
|
387
|
+
</Text>
|
|
388
|
+
<PercentageBarChart
|
|
389
|
+
BarComponent={DottedBarComponent}
|
|
390
|
+
barMinSize={24}
|
|
391
|
+
height={24}
|
|
392
|
+
series={dottedBarSeriesPlain}
|
|
393
|
+
stackGap={4}
|
|
394
|
+
/>
|
|
395
|
+
</VStack>
|
|
396
|
+
</VStack>
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
### Animations
|
|
402
|
+
|
|
403
|
+
Configure motion with the `transitions` prop (forwarded to `BarChart`). Toggle motion with `animate`.
|
|
404
|
+
|
|
405
|
+
```jsx live
|
|
406
|
+
function AnimationsExample() {
|
|
407
|
+
const [animate, setAnimate] = useState(true);
|
|
408
|
+
|
|
409
|
+
function randomShares() {
|
|
410
|
+
const raw = [Math.random() + 0.1, Math.random() + 0.1, Math.random() + 0.1];
|
|
411
|
+
const sum = raw[0] + raw[1] + raw[2];
|
|
412
|
+
return raw.map((v) => Math.max(1, Math.round((v / sum) * 100)));
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
function generateData() {
|
|
416
|
+
return [randomShares(), randomShares(), randomShares()];
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const [data, setData] = useState(generateData);
|
|
420
|
+
|
|
421
|
+
useEffect(() => {
|
|
422
|
+
const id = setInterval(() => setData(generateData()), 800);
|
|
423
|
+
return () => clearInterval(id);
|
|
424
|
+
}, []);
|
|
425
|
+
|
|
426
|
+
const series = [
|
|
427
|
+
{ id: 'btc', data: data.map((q) => q[0]), label: 'BTC', color: assets.btc.color },
|
|
428
|
+
{
|
|
429
|
+
id: 'eth',
|
|
430
|
+
data: data.map((q) => q[1]),
|
|
431
|
+
label: 'ETH',
|
|
432
|
+
color: assets.eth.color,
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
id: 'other',
|
|
436
|
+
data: data.map((q) => q[2]),
|
|
437
|
+
label: 'Other',
|
|
438
|
+
color: 'var(--color-fgMuted)',
|
|
439
|
+
},
|
|
440
|
+
];
|
|
441
|
+
|
|
442
|
+
return (
|
|
443
|
+
<VStack gap={2}>
|
|
444
|
+
<HStack justifyContent="flex-end" alignItems="center" gap={1}>
|
|
445
|
+
<Switch checked={animate} onChange={() => setAnimate((v) => !v)}>
|
|
446
|
+
Animate
|
|
447
|
+
</Switch>
|
|
448
|
+
</HStack>
|
|
449
|
+
<PercentageBarChart
|
|
450
|
+
animate={animate}
|
|
451
|
+
legend
|
|
452
|
+
showXAxis
|
|
453
|
+
showYAxis
|
|
454
|
+
barMinSize={14}
|
|
455
|
+
borderRadius={48}
|
|
456
|
+
height={220}
|
|
457
|
+
inset={{ left: 24, right: 0, top: 0, bottom: 0 }}
|
|
458
|
+
legendPosition="top"
|
|
459
|
+
transitions={{
|
|
460
|
+
enter: { type: 'tween', staggerDelay: 0.5 },
|
|
461
|
+
update: { type: 'tween' },
|
|
462
|
+
}}
|
|
463
|
+
series={series}
|
|
464
|
+
stackGap={2}
|
|
465
|
+
xAxis={{
|
|
466
|
+
showTickMarks: true,
|
|
467
|
+
tickLabelFormatter: (value) => `${value}%`,
|
|
468
|
+
}}
|
|
469
|
+
yAxis={{
|
|
470
|
+
categoryPadding: 0.75,
|
|
471
|
+
data: ['Q1 2025', 'Q2 2025', 'Q3 2025'],
|
|
472
|
+
position: 'left',
|
|
473
|
+
requestedTickCount: 5,
|
|
474
|
+
showTickMarks: true,
|
|
475
|
+
}}
|
|
476
|
+
/>
|
|
477
|
+
</VStack>
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
### Composed Examples
|
|
483
|
+
|
|
484
|
+
#### Live-updating Data
|
|
485
|
+
|
|
486
|
+
Using a custom legend, you can create a prediction markets-style chart that stays in sync when data changes.
|
|
487
|
+
|
|
488
|
+
```jsx live
|
|
489
|
+
function LiveFeedExample() {
|
|
490
|
+
const liveFeedSubtitleBase = 100;
|
|
491
|
+
const liveFeedYesDollarsPerPercentPoint = (182 - liveFeedSubtitleBase) / 50;
|
|
492
|
+
const liveFeedNoDollarsPerPercentPoint = (222 - liveFeedSubtitleBase) / 50;
|
|
493
|
+
|
|
494
|
+
function getLiveFeedProjectedValue(seriesId, percentage) {
|
|
495
|
+
const inverseShare = 100 - percentage;
|
|
496
|
+
if (seriesId === 'yes') {
|
|
497
|
+
return Math.round(liveFeedSubtitleBase + inverseShare * liveFeedYesDollarsPerPercentPoint);
|
|
498
|
+
}
|
|
499
|
+
if (seriesId === 'no') {
|
|
500
|
+
return Math.round(liveFeedSubtitleBase + inverseShare * liveFeedNoDollarsPerPercentPoint);
|
|
501
|
+
}
|
|
502
|
+
return undefined;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
const liveFeedCurrencyFormat = {
|
|
506
|
+
style: 'currency',
|
|
507
|
+
currency: 'USD',
|
|
508
|
+
maximumFractionDigits: 0,
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
const LiveFeedCTALegendEntry = memo(function LiveFeedCTALegendEntry({ seriesId, label, color }) {
|
|
512
|
+
const { series } = useCartesianChartContext();
|
|
513
|
+
const seriesData = series.find((s) => s.id === seriesId);
|
|
514
|
+
const percentage = seriesData?.data?.[0] ?? 0;
|
|
515
|
+
const projectedValue = getLiveFeedProjectedValue(seriesId, percentage);
|
|
516
|
+
|
|
517
|
+
return (
|
|
518
|
+
<Button
|
|
519
|
+
compact
|
|
520
|
+
borderRadius={200}
|
|
521
|
+
style={{ backgroundColor: color, borderColor: color }}
|
|
522
|
+
width="25%"
|
|
523
|
+
>
|
|
524
|
+
<VStack alignItems="center" gap={0.25}>
|
|
525
|
+
<HStack alignItems="center" gap={0.5}>
|
|
526
|
+
<Text color="fgInverse" font="label1">
|
|
527
|
+
{label} {'· '}
|
|
528
|
+
</Text>
|
|
529
|
+
<RollingNumber
|
|
530
|
+
color="fgInverse"
|
|
531
|
+
font="label1"
|
|
532
|
+
format={{ style: 'percent', maximumFractionDigits: 0 }}
|
|
533
|
+
value={percentage / 100}
|
|
534
|
+
/>
|
|
535
|
+
</HStack>
|
|
536
|
+
{projectedValue != null && (
|
|
537
|
+
<HStack alignItems="center" gap={0.5}>
|
|
538
|
+
<Text color="fgInverse" font="legal">
|
|
539
|
+
${liveFeedSubtitleBase} →
|
|
540
|
+
</Text>
|
|
541
|
+
<RollingNumber
|
|
542
|
+
color="fgInverse"
|
|
543
|
+
font="legal"
|
|
544
|
+
format={liveFeedCurrencyFormat}
|
|
545
|
+
value={projectedValue}
|
|
546
|
+
/>
|
|
547
|
+
</HStack>
|
|
548
|
+
)}
|
|
549
|
+
</VStack>
|
|
550
|
+
</Button>
|
|
551
|
+
);
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
function LiveFeedChart() {
|
|
555
|
+
const [tick, setTick] = useState(0);
|
|
556
|
+
|
|
557
|
+
const yesValue = 50 + Math.sin(tick * 0.05) * 49;
|
|
558
|
+
const noValue = 50 - Math.sin(tick * 0.05) * 49;
|
|
559
|
+
|
|
560
|
+
const series = [
|
|
561
|
+
{ id: 'yes', data: yesValue, label: 'Yes', color: 'var(--color-fgPositive)' },
|
|
562
|
+
{ id: 'no', data: noValue, label: 'No', color: 'var(--color-fgNegative)' },
|
|
563
|
+
];
|
|
564
|
+
|
|
565
|
+
useEffect(() => {
|
|
566
|
+
const id = setInterval(() => setTick((t) => t + 4), 1000);
|
|
567
|
+
return () => clearInterval(id);
|
|
568
|
+
}, []);
|
|
569
|
+
|
|
570
|
+
return (
|
|
571
|
+
<PercentageBarChart
|
|
572
|
+
barMinSize={16}
|
|
573
|
+
borderRadius={1000}
|
|
574
|
+
height={64}
|
|
575
|
+
legend={
|
|
576
|
+
<Legend
|
|
577
|
+
EntryComponent={LiveFeedCTALegendEntry}
|
|
578
|
+
justifyContent="space-evenly"
|
|
579
|
+
paddingTop={1}
|
|
580
|
+
/>
|
|
581
|
+
}
|
|
582
|
+
legendPosition="bottom"
|
|
583
|
+
series={series}
|
|
584
|
+
stackGap={2}
|
|
585
|
+
/>
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
return <LiveFeedChart />;
|
|
590
|
+
}
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
#### Vertical Mix
|
|
594
|
+
|
|
595
|
+
Monthly **BTC / ETH / Other** portfolio allocation across a full year, with `layout="vertical"` and the legend on the right.
|
|
596
|
+
|
|
597
|
+
```jsx live
|
|
598
|
+
<PercentageBarChart
|
|
599
|
+
legend
|
|
600
|
+
showXAxis
|
|
601
|
+
showYAxis
|
|
602
|
+
barMinSize={28}
|
|
603
|
+
borderRadius={48}
|
|
604
|
+
height={240}
|
|
605
|
+
layout="vertical"
|
|
606
|
+
legendPosition="right"
|
|
607
|
+
series={[
|
|
608
|
+
{
|
|
609
|
+
id: 'btc',
|
|
610
|
+
data: [55, 52, 48, 45, 50, 58, 62, 57, 53, 49, 44, 46],
|
|
611
|
+
label: 'BTC',
|
|
612
|
+
color: assets.btc.color,
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
id: 'eth',
|
|
616
|
+
data: [30, 33, 35, 38, 32, 27, 25, 29, 34, 37, 40, 38],
|
|
617
|
+
label: 'ETH',
|
|
618
|
+
color: assets.eth.color,
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
id: 'other',
|
|
622
|
+
data: [15, 15, 17, 17, 18, 15, 13, 14, 13, 14, 16, 16],
|
|
623
|
+
label: 'Other',
|
|
624
|
+
color: 'var(--color-fgMuted)',
|
|
625
|
+
},
|
|
626
|
+
]}
|
|
627
|
+
stackGap={1}
|
|
628
|
+
xAxis={{
|
|
629
|
+
categoryPadding: 0.5,
|
|
630
|
+
data: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
|
631
|
+
position: 'bottom',
|
|
632
|
+
showTickMarks: true,
|
|
633
|
+
}}
|
|
634
|
+
/>
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
#### Buy vs Sell
|
|
638
|
+
|
|
639
|
+
You can combine a PercentageBarChart with a custom legend to create a buy vs sell chart.
|
|
640
|
+
|
|
641
|
+
```jsx live
|
|
642
|
+
function BuyVsSellExample() {
|
|
643
|
+
const series = [
|
|
644
|
+
{ id: 'buy', data: 76, color: 'var(--color-fgPositive)', legendShape: 'circle' },
|
|
645
|
+
{ id: 'sell', data: 24, color: 'var(--color-fgNegative)', legendShape: 'square' },
|
|
646
|
+
];
|
|
647
|
+
|
|
648
|
+
function BuyVsSellLegend() {
|
|
649
|
+
const [buy, sell] = series;
|
|
650
|
+
return (
|
|
651
|
+
<HStack gap={1} justifyContent="space-between">
|
|
652
|
+
<DefaultLegendEntry
|
|
653
|
+
color={buy.color}
|
|
654
|
+
label={
|
|
655
|
+
<Text color="fgMuted" font="legal">
|
|
656
|
+
{`${buy.data}% bought`}
|
|
657
|
+
</Text>
|
|
658
|
+
}
|
|
659
|
+
seriesId={buy.id}
|
|
660
|
+
shape={buy.legendShape}
|
|
661
|
+
/>
|
|
662
|
+
<DefaultLegendEntry
|
|
663
|
+
color={sell.color}
|
|
664
|
+
label={
|
|
665
|
+
<Text color="fgMuted" font="legal">
|
|
666
|
+
{`${sell.data}% sold`}
|
|
667
|
+
</Text>
|
|
668
|
+
}
|
|
669
|
+
seriesId={sell.id}
|
|
670
|
+
shape={sell.legendShape}
|
|
671
|
+
/>
|
|
672
|
+
</HStack>
|
|
673
|
+
);
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
return (
|
|
677
|
+
<VStack gap={1.5}>
|
|
678
|
+
<PercentageBarChart
|
|
679
|
+
barMinSize={8}
|
|
680
|
+
borderRadius={24}
|
|
681
|
+
height={8}
|
|
682
|
+
series={series}
|
|
683
|
+
stackGap={4}
|
|
684
|
+
/>
|
|
685
|
+
<BuyVsSellLegend />
|
|
686
|
+
</VStack>
|
|
687
|
+
);
|
|
688
|
+
}
|
|
689
|
+
```
|
|
690
|
+
|
|
691
|
+
## Props
|
|
692
|
+
|
|
693
|
+
| Prop | Type | Required | Default | Description |
|
|
694
|
+
| --- | --- | --- | --- | --- |
|
|
695
|
+
| `BarComponent` | `BarComponent` | No | `-` | Component to render the bar. |
|
|
696
|
+
| `BarStackComponent` | `BarStackComponent` | No | `DefaultBarStack` | Custom component to render the stack container. Can be used to add clip paths, outlines, or other custom styling. |
|
|
697
|
+
| `alignContent` | `ResponsiveProp<center \| normal \| start \| end \| flex-start \| flex-end \| space-between \| space-around \| space-evenly \| stretch \| baseline \| first baseline \| last baseline>` | No | `-` | - |
|
|
698
|
+
| `alignItems` | `ResponsiveProp<center \| normal \| start \| end \| flex-start \| flex-end \| stretch \| baseline \| first baseline \| last baseline \| self-start \| self-end>` | No | `-` | - |
|
|
699
|
+
| `alignSelf` | `ResponsiveProp<center \| auto \| normal \| start \| end \| flex-start \| flex-end \| stretch \| baseline \| first baseline \| last baseline \| self-start \| self-end>` | No | `-` | - |
|
|
700
|
+
| `animate` | `boolean` | No | `true` | Whether to animate the chart. |
|
|
701
|
+
| `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. |
|
|
702
|
+
| `aspectRatio` | `inherit \| auto \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - |
|
|
703
|
+
| `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 | `-` | - |
|
|
704
|
+
| `barMinSize` | `number` | No | `-` | Minimum size for individual bars in the stack. |
|
|
705
|
+
| `barPadding` | `number` | No | `0.1` | Padding between bar groups (0-1). |
|
|
706
|
+
| `borderBottomWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
707
|
+
| `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 | `-` | - |
|
|
708
|
+
| `borderEndWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
709
|
+
| `borderRadius` | `number` | No | `4` | Border radius for the bar. |
|
|
710
|
+
| `borderStartWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
711
|
+
| `borderTopWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
712
|
+
| `borderWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
713
|
+
| `bordered` | `boolean` | No | `-` | Add a border around all sides of the box. |
|
|
714
|
+
| `borderedBottom` | `boolean` | No | `-` | Add a border to the bottom side of the box. |
|
|
715
|
+
| `borderedEnd` | `boolean` | No | `-` | Add a border to the trailing side of the box. |
|
|
716
|
+
| `borderedHorizontal` | `boolean` | No | `-` | Add a border to the leading and trailing sides of the box. |
|
|
717
|
+
| `borderedStart` | `boolean` | No | `-` | Add a border to the leading side of the box. |
|
|
718
|
+
| `borderedTop` | `boolean` | No | `-` | Add a border to the top side of the box. |
|
|
719
|
+
| `borderedVertical` | `boolean` | No | `-` | Add a border to the top and bottom sides of the box. |
|
|
720
|
+
| `bottom` | `ResponsiveProp<Bottom<string \| number>>` | No | `-` | - |
|
|
721
|
+
| `classNames` | `{ root?: string; chart?: string \| undefined; } \| undefined` | No | `-` | Custom class names for the component. |
|
|
722
|
+
| `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 | `-` | - |
|
|
723
|
+
| `columnGap` | `0 \| 1 \| 2 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10` | No | `-` | - |
|
|
724
|
+
| `dangerouslySetBackground` | `string` | No | `-` | - |
|
|
725
|
+
| `display` | `ResponsiveProp<grid \| none \| block \| inline \| inline-block \| flex \| inline-flex \| inline-grid \| contents \| flow-root \| revert \| list-item>` | No | `-` | - |
|
|
726
|
+
| `elevation` | `0 \| 1 \| 2` | No | `-` | - |
|
|
727
|
+
| `fillOpacity` | `number` | No | `-` | Fill opacity for the bar. |
|
|
728
|
+
| `flexBasis` | `ResponsiveProp<FlexBasis<string \| number>>` | No | `-` | - |
|
|
729
|
+
| `flexDirection` | `ResponsiveProp<row \| row-reverse \| column \| column-reverse>` | No | `-` | - |
|
|
730
|
+
| `flexGrow` | `inherit \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - |
|
|
731
|
+
| `flexShrink` | `inherit \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - |
|
|
732
|
+
| `flexWrap` | `ResponsiveProp<nowrap \| wrap \| wrap-reverse>` | No | `-` | - |
|
|
733
|
+
| `font` | `ResponsiveProp<FontFamily \| inherit>` | No | `-` | - |
|
|
734
|
+
| `fontFamily` | `ResponsiveProp<FontFamily \| inherit>` | No | `-` | - |
|
|
735
|
+
| `fontSize` | `ResponsiveProp<inherit \| FontSize>` | No | `-` | - |
|
|
736
|
+
| `fontWeight` | `ResponsiveProp<inherit \| FontWeight>` | No | `-` | - |
|
|
737
|
+
| `gap` | `0 \| 1 \| 2 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10` | No | `-` | - |
|
|
738
|
+
| `grid` | `inherit \| none \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - |
|
|
739
|
+
| `gridArea` | `inherit \| auto \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - |
|
|
740
|
+
| `gridAutoColumns` | `ResponsiveProp<GridAutoColumns<string \| number>>` | No | `-` | - |
|
|
741
|
+
| `gridAutoFlow` | `inherit \| revert \| row \| column \| -moz-initial \| initial \| revert-layer \| unset \| dense` | No | `-` | - |
|
|
742
|
+
| `gridAutoRows` | `ResponsiveProp<GridAutoRows<string \| number>>` | No | `-` | - |
|
|
743
|
+
| `gridColumn` | `inherit \| auto \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - |
|
|
744
|
+
| `gridColumnEnd` | `inherit \| auto \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - |
|
|
745
|
+
| `gridColumnStart` | `inherit \| auto \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - |
|
|
746
|
+
| `gridRow` | `inherit \| auto \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - |
|
|
747
|
+
| `gridRowEnd` | `inherit \| auto \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - |
|
|
748
|
+
| `gridRowStart` | `inherit \| auto \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - |
|
|
749
|
+
| `gridTemplate` | `inherit \| none \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - |
|
|
750
|
+
| `gridTemplateAreas` | `inherit \| none \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - |
|
|
751
|
+
| `gridTemplateColumns` | `ResponsiveProp<GridTemplateColumns<string \| number>>` | No | `-` | - |
|
|
752
|
+
| `gridTemplateRows` | `ResponsiveProp<GridTemplateRows<string \| number>>` | No | `-` | - |
|
|
753
|
+
| `height` | `ResponsiveProp<Height<string \| number>>` | No | `-` | - |
|
|
754
|
+
| `inset` | `number \| Partial<ChartInset>` | No | `0` | Inset around the entire chart (outside the axes). |
|
|
755
|
+
| `justifyContent` | `ResponsiveProp<left \| right \| center \| normal \| start \| end \| flex-start \| flex-end \| space-between \| space-around \| space-evenly \| stretch>` | No | `-` | - |
|
|
756
|
+
| `key` | `Key \| null` | No | `-` | - |
|
|
757
|
+
| `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. |
|
|
758
|
+
| `left` | `ResponsiveProp<Left<string \| number>>` | No | `-` | - |
|
|
759
|
+
| `legend` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| 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 |
|
|
760
|
+
| `legendAccessibilityLabel` | `string` | No | `'Legend'` | Accessibility label for the legend group. |
|
|
761
|
+
| `legendPosition` | `top \| bottom \| left \| right` | No | `'bottom'` | Position of the legend relative to the chart. |
|
|
762
|
+
| `lineHeight` | `ResponsiveProp<inherit \| LineHeight>` | No | `-` | - |
|
|
763
|
+
| `margin` | `ResponsiveProp<0 \| -1 \| -2 \| -0.25 \| -0.5 \| -0.75 \| -1.5 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10>` | No | `-` | - |
|
|
764
|
+
| `marginBottom` | `ResponsiveProp<0 \| -1 \| -2 \| -0.25 \| -0.5 \| -0.75 \| -1.5 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10>` | No | `-` | - |
|
|
765
|
+
| `marginEnd` | `ResponsiveProp<0 \| -1 \| -2 \| -0.25 \| -0.5 \| -0.75 \| -1.5 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10>` | No | `-` | - |
|
|
766
|
+
| `marginStart` | `ResponsiveProp<0 \| -1 \| -2 \| -0.25 \| -0.5 \| -0.75 \| -1.5 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10>` | No | `-` | - |
|
|
767
|
+
| `marginTop` | `ResponsiveProp<0 \| -1 \| -2 \| -0.25 \| -0.5 \| -0.75 \| -1.5 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10>` | No | `-` | - |
|
|
768
|
+
| `marginX` | `ResponsiveProp<0 \| -1 \| -2 \| -0.25 \| -0.5 \| -0.75 \| -1.5 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10>` | No | `-` | - |
|
|
769
|
+
| `marginY` | `ResponsiveProp<0 \| -1 \| -2 \| -0.25 \| -0.5 \| -0.75 \| -1.5 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10>` | No | `-` | - |
|
|
770
|
+
| `maxHeight` | `ResponsiveProp<MaxHeight<string \| number>>` | No | `-` | - |
|
|
771
|
+
| `maxWidth` | `ResponsiveProp<MaxWidth<string \| number>>` | No | `-` | - |
|
|
772
|
+
| `minHeight` | `ResponsiveProp<MinHeight<string \| number>>` | No | `-` | - |
|
|
773
|
+
| `minWidth` | `ResponsiveProp<MinWidth<string \| number>>` | No | `-` | - |
|
|
774
|
+
| `onChange` | `FormEventHandler<HTMLDivElement>` | No | `-` | - |
|
|
775
|
+
| `opacity` | `inherit \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - |
|
|
776
|
+
| `overflow` | `ResponsiveProp<hidden \| auto \| visible \| clip \| scroll>` | No | `-` | - |
|
|
777
|
+
| `padding` | `0 \| 1 \| 2 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10` | No | `-` | - |
|
|
778
|
+
| `paddingBottom` | `0 \| 1 \| 2 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10` | No | `-` | - |
|
|
779
|
+
| `paddingEnd` | `0 \| 1 \| 2 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10` | No | `-` | - |
|
|
780
|
+
| `paddingStart` | `0 \| 1 \| 2 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10` | No | `-` | - |
|
|
781
|
+
| `paddingTop` | `0 \| 1 \| 2 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10` | No | `-` | - |
|
|
782
|
+
| `paddingX` | `0 \| 1 \| 2 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10` | No | `-` | - |
|
|
783
|
+
| `paddingY` | `0 \| 1 \| 2 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10` | No | `-` | - |
|
|
784
|
+
| `pin` | `top \| bottom \| left \| right \| all` | No | `-` | Direction in which to absolutely pin the box. |
|
|
785
|
+
| `position` | `ResponsiveProp<static \| relative \| absolute \| fixed \| sticky>` | No | `-` | - |
|
|
786
|
+
| `ref` | `((instance: SVGSVGElement \| null) => void) \| RefObject<SVGSVGElement> \| null` | No | `-` | - |
|
|
787
|
+
| `right` | `ResponsiveProp<Right<string \| number>>` | No | `-` | - |
|
|
788
|
+
| `roundBaseline` | `boolean` | No | `true` | Whether to round the baseline of a bar (where the value is 0). |
|
|
789
|
+
| `rowGap` | `0 \| 1 \| 2 \| 0.25 \| 0.5 \| 0.75 \| 1.5 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10` | No | `-` | - |
|
|
790
|
+
| `series` | `PercentageBarSeries[]` | No | `-` | Configuration objects that define how to visualize the data. Each series contains its own data. |
|
|
791
|
+
| `showXAxis` | `boolean` | No | `-` | Whether to show the X axis. |
|
|
792
|
+
| `showYAxis` | `boolean` | No | `-` | Whether to show the Y axis. |
|
|
793
|
+
| `stackGap` | `number` | No | `-` | Gap between bars in the stack. |
|
|
794
|
+
| `stackMinSize` | `number` | No | `-` | Minimum size for the entire stack. |
|
|
795
|
+
| `stroke` | `string` | No | `-` | Stroke color for the bar outline. |
|
|
796
|
+
| `strokeWidth` | `number` | No | `-` | Stroke width for the bar outline. |
|
|
797
|
+
| `style` | `CSSProperties` | No | `-` | Custom styles for the root element. |
|
|
798
|
+
| `styles` | `{ root?: CSSProperties; chart?: CSSProperties \| undefined; } \| undefined` | No | `-` | Custom styles for the component. |
|
|
799
|
+
| `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 |
|
|
800
|
+
| `textAlign` | `ResponsiveProp<center \| start \| end \| justify>` | No | `-` | - |
|
|
801
|
+
| `textDecoration` | `ResponsiveProp<none \| underline \| overline \| line-through \| underline overline \| underline double>` | No | `-` | - |
|
|
802
|
+
| `textTransform` | `ResponsiveProp<none \| uppercase \| lowercase \| capitalize>` | No | `-` | - |
|
|
803
|
+
| `top` | `ResponsiveProp<Top<string \| number>>` | No | `-` | - |
|
|
804
|
+
| `transform` | `inherit \| none \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - |
|
|
805
|
+
| `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. |
|
|
806
|
+
| `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. |
|
|
807
|
+
| `userSelect` | `ResponsiveProp<text \| none \| all \| auto>` | No | `-` | - |
|
|
808
|
+
| `visibility` | `ResponsiveProp<hidden \| visible>` | No | `-` | - |
|
|
809
|
+
| `width` | `ResponsiveProp<Width<string \| number>>` | No | `-` | - |
|
|
810
|
+
| `xAxis` | `(Partial<CartesianAxisConfigProps> & 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. |
|
|
811
|
+
| `yAxis` | `(Partial<CartesianAxisConfigProps> & 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. |
|
|
812
|
+
| `zIndex` | `inherit \| auto \| revert \| -moz-initial \| initial \| revert-layer \| unset` | No | `-` | - |
|
|
813
|
+
|
|
814
|
+
|