@coinbase/cds-mcp-server 8.17.2 → 8.17.4
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 +8 -0
- package/mcp-docs/mobile/components/Accordion.txt +188 -0
- package/mcp-docs/mobile/components/AccordionItem.txt +29 -0
- package/mcp-docs/mobile/components/Alert.txt +155 -0
- package/mcp-docs/mobile/components/AreaChart.txt +265 -0
- package/mcp-docs/mobile/components/Avatar.txt +195 -0
- package/mcp-docs/mobile/components/AvatarButton.txt +225 -0
- package/mcp-docs/mobile/components/Banner.txt +221 -0
- package/mcp-docs/mobile/components/BarChart.txt +815 -0
- package/mcp-docs/mobile/components/Box.txt +173 -0
- package/mcp-docs/mobile/components/BrowserBar.txt +146 -0
- package/mcp-docs/mobile/components/Button.txt +198 -0
- package/mcp-docs/mobile/components/ButtonGroup.txt +79 -0
- package/mcp-docs/mobile/components/Carousel.txt +1083 -0
- package/mcp-docs/mobile/components/CartesianChart.txt +825 -0
- package/mcp-docs/mobile/components/CellMedia.txt +70 -0
- package/mcp-docs/mobile/components/Checkbox.txt +245 -0
- package/mcp-docs/mobile/components/CheckboxCell.txt +201 -0
- package/mcp-docs/mobile/components/CheckboxGroup.txt +284 -0
- package/mcp-docs/mobile/components/Chip.txt +194 -0
- package/mcp-docs/mobile/components/Coachmark.txt +157 -0
- package/mcp-docs/mobile/components/Collapsible.txt +104 -0
- package/mcp-docs/mobile/components/ContainedAssetCard.txt +134 -0
- package/mcp-docs/mobile/components/ContentCard.txt +365 -0
- package/mcp-docs/mobile/components/ContentCardBody.txt +135 -0
- package/mcp-docs/mobile/components/ContentCardFooter.txt +127 -0
- package/mcp-docs/mobile/components/ContentCardHeader.txt +145 -0
- package/mcp-docs/mobile/components/ContentCell.txt +226 -0
- package/mcp-docs/mobile/components/ControlGroup.txt +443 -0
- package/mcp-docs/mobile/components/DatePicker.txt +496 -0
- package/mcp-docs/mobile/components/Divider.txt +138 -0
- package/mcp-docs/mobile/components/DotCount.txt +145 -0
- package/mcp-docs/mobile/components/DotStatusColor.txt +58 -0
- package/mcp-docs/mobile/components/DotSymbol.txt +134 -0
- package/mcp-docs/mobile/components/Fallback.txt +157 -0
- package/mcp-docs/mobile/components/FloatingAssetCard.txt +155 -0
- package/mcp-docs/mobile/components/HStack.txt +234 -0
- package/mcp-docs/mobile/components/HeroSquare.txt +47 -0
- package/mcp-docs/mobile/components/Icon.txt +51 -0
- package/mcp-docs/mobile/components/IconButton.txt +268 -0
- package/mcp-docs/mobile/components/InputChip.txt +187 -0
- package/mcp-docs/mobile/components/Interactable.txt +186 -0
- package/mcp-docs/mobile/components/LineChart.txt +1324 -0
- package/mcp-docs/mobile/components/Link.txt +291 -0
- package/mcp-docs/mobile/components/ListCell.txt +412 -0
- package/mcp-docs/mobile/components/LogoMark.txt +84 -0
- package/mcp-docs/mobile/components/LogoWordMark.txt +93 -0
- package/mcp-docs/mobile/components/Lottie.txt +138 -0
- package/mcp-docs/mobile/components/LottieStatusAnimation.txt +46 -0
- package/mcp-docs/mobile/components/Modal.txt +83 -0
- package/mcp-docs/mobile/components/ModalBody.txt +33 -0
- package/mcp-docs/mobile/components/ModalFooter.txt +24 -0
- package/mcp-docs/mobile/components/ModalHeader.txt +27 -0
- package/mcp-docs/mobile/components/MultiContentModule.txt +379 -0
- package/mcp-docs/mobile/components/NavigationTitle.txt +131 -0
- package/mcp-docs/mobile/components/NavigationTitleSelect.txt +141 -0
- package/mcp-docs/mobile/components/NudgeCard.txt +89 -0
- package/mcp-docs/mobile/components/Numpad.txt +340 -0
- package/mcp-docs/mobile/components/Overlay.txt +151 -0
- package/mcp-docs/mobile/components/PageFooter.txt +160 -0
- package/mcp-docs/mobile/components/PageHeader.txt +185 -0
- package/mcp-docs/mobile/components/PeriodSelector.txt +407 -0
- package/mcp-docs/mobile/components/Pictogram.txt +47 -0
- package/mcp-docs/mobile/components/Point.txt +204 -0
- package/mcp-docs/mobile/components/PortalProvider.txt +78 -0
- package/mcp-docs/mobile/components/Pressable.txt +210 -0
- package/mcp-docs/mobile/components/ProgressBar.txt +129 -0
- package/mcp-docs/mobile/components/ProgressBarWithFixedLabels.txt +160 -0
- package/mcp-docs/mobile/components/ProgressBarWithFloatLabel.txt +137 -0
- package/mcp-docs/mobile/components/ProgressCircle.txt +236 -0
- package/mcp-docs/mobile/components/Radio.txt +241 -0
- package/mcp-docs/mobile/components/RadioCell.txt +201 -0
- package/mcp-docs/mobile/components/RadioGroup.txt +281 -0
- package/mcp-docs/mobile/components/ReferenceLine.txt +152 -0
- package/mcp-docs/mobile/components/RemoteImage.txt +105 -0
- package/mcp-docs/mobile/components/RemoteImageGroup.txt +60 -0
- package/mcp-docs/mobile/components/RollingNumber.txt +788 -0
- package/mcp-docs/mobile/components/Scrubber.txt +203 -0
- package/mcp-docs/mobile/components/SearchInput.txt +191 -0
- package/mcp-docs/mobile/components/SectionHeader.txt +204 -0
- package/mcp-docs/mobile/components/SegmentedTabs.txt +315 -0
- package/mcp-docs/mobile/components/Select.txt +211 -0
- package/mcp-docs/mobile/components/SelectChip.txt +323 -0
- package/mcp-docs/mobile/components/SelectOption.txt +84 -0
- package/mcp-docs/mobile/components/SlideButton.txt +330 -0
- package/mcp-docs/mobile/components/Spacer.txt +83 -0
- package/mcp-docs/mobile/components/Sparkline.txt +122 -0
- package/mcp-docs/mobile/components/SparklineGradient.txt +106 -0
- package/mcp-docs/mobile/components/SparklineInteractive.txt +156 -0
- package/mcp-docs/mobile/components/SparklineInteractiveHeader.txt +72 -0
- package/mcp-docs/mobile/components/Spinner.txt +48 -0
- package/mcp-docs/mobile/components/SpotIcon.txt +47 -0
- package/mcp-docs/mobile/components/SpotRectangle.txt +47 -0
- package/mcp-docs/mobile/components/SpotSquare.txt +47 -0
- package/mcp-docs/mobile/components/Stepper.txt +527 -0
- package/mcp-docs/mobile/components/SubBrandLogoMark.txt +125 -0
- package/mcp-docs/mobile/components/SubBrandLogoWordMark.txt +125 -0
- package/mcp-docs/mobile/components/Switch.txt +97 -0
- package/mcp-docs/mobile/components/TabIndicator.txt +48 -0
- package/mcp-docs/mobile/components/TabLabel.txt +153 -0
- package/mcp-docs/mobile/components/TabNavigation.txt +146 -0
- package/mcp-docs/mobile/components/TabbedChips.txt +142 -0
- package/mcp-docs/mobile/components/Tabs.txt +190 -0
- package/mcp-docs/mobile/components/Tag.txt +300 -0
- package/mcp-docs/mobile/components/Text.txt +211 -0
- package/mcp-docs/mobile/components/TextInput.txt +717 -0
- package/mcp-docs/mobile/components/ThemeProvider.txt +132 -0
- package/mcp-docs/mobile/components/Toast.txt +196 -0
- package/mcp-docs/mobile/components/Tooltip.txt +59 -0
- package/mcp-docs/mobile/components/TopNavBar.txt +161 -0
- package/mcp-docs/mobile/components/Tour.txt +158 -0
- package/mcp-docs/mobile/components/Tray.txt +252 -0
- package/mcp-docs/mobile/components/UpsellCard.txt +321 -0
- package/mcp-docs/mobile/components/VStack.txt +222 -0
- package/mcp-docs/mobile/components/XAxis.txt +621 -0
- package/mcp-docs/mobile/components/YAxis.txt +567 -0
- package/mcp-docs/mobile/getting-started/ai-overview.txt +108 -0
- package/mcp-docs/mobile/getting-started/installation.txt +57 -0
- package/mcp-docs/mobile/getting-started/introduction.txt +102 -0
- package/mcp-docs/mobile/getting-started/playground.txt +28 -0
- package/mcp-docs/mobile/getting-started/styling.txt +84 -0
- package/mcp-docs/mobile/getting-started/theming.txt +286 -0
- package/mcp-docs/mobile/hooks/useDimensions.txt +72 -0
- package/mcp-docs/mobile/hooks/useEventHandler.txt +120 -0
- package/mcp-docs/mobile/hooks/useMergeRefs.txt +116 -0
- package/mcp-docs/mobile/hooks/useOverlayContentContext.txt +280 -0
- package/mcp-docs/mobile/hooks/usePreviousValue.txt +74 -0
- package/mcp-docs/mobile/hooks/useRefMap.txt +178 -0
- package/mcp-docs/mobile/hooks/useTheme.txt +321 -0
- package/mcp-docs/mobile/routes.txt +139 -0
- package/mcp-docs/web/components/Accordion.txt +189 -0
- package/mcp-docs/web/components/AccordionItem.txt +31 -0
- package/mcp-docs/web/components/Alert.txt +164 -0
- package/mcp-docs/web/components/AreaChart.txt +510 -0
- package/mcp-docs/web/components/Avatar.txt +211 -0
- package/mcp-docs/web/components/AvatarButton.txt +240 -0
- package/mcp-docs/web/components/Banner.txt +226 -0
- package/mcp-docs/web/components/BarChart.txt +1267 -0
- package/mcp-docs/web/components/Box.txt +175 -0
- package/mcp-docs/web/components/Button.txt +212 -0
- package/mcp-docs/web/components/ButtonGroup.txt +79 -0
- package/mcp-docs/web/components/Calendar.txt +181 -0
- package/mcp-docs/web/components/Carousel.txt +1575 -0
- package/mcp-docs/web/components/CartesianChart.txt +1044 -0
- package/mcp-docs/web/components/CellMedia.txt +56 -0
- package/mcp-docs/web/components/Checkbox.txt +188 -0
- package/mcp-docs/web/components/CheckboxCell.txt +202 -0
- package/mcp-docs/web/components/CheckboxGroup.txt +219 -0
- package/mcp-docs/web/components/Chip.txt +196 -0
- package/mcp-docs/web/components/Coachmark.txt +188 -0
- package/mcp-docs/web/components/Collapsible.txt +119 -0
- package/mcp-docs/web/components/ContainedAssetCard.txt +232 -0
- package/mcp-docs/web/components/ContentCard.txt +367 -0
- package/mcp-docs/web/components/ContentCardBody.txt +137 -0
- package/mcp-docs/web/components/ContentCardFooter.txt +129 -0
- package/mcp-docs/web/components/ContentCardHeader.txt +147 -0
- package/mcp-docs/web/components/ContentCell.txt +219 -0
- package/mcp-docs/web/components/ControlGroup.txt +436 -0
- package/mcp-docs/web/components/DatePicker.txt +505 -0
- package/mcp-docs/web/components/Divider.txt +143 -0
- package/mcp-docs/web/components/DotCount.txt +149 -0
- package/mcp-docs/web/components/DotStatusColor.txt +58 -0
- package/mcp-docs/web/components/DotSymbol.txt +137 -0
- package/mcp-docs/web/components/Dropdown.txt +119 -0
- package/mcp-docs/web/components/Fallback.txt +163 -0
- package/mcp-docs/web/components/FloatingAssetCard.txt +250 -0
- package/mcp-docs/web/components/FullscreenAlert.txt +69 -0
- package/mcp-docs/web/components/FullscreenModal.txt +145 -0
- package/mcp-docs/web/components/FullscreenModalLayout.txt +187 -0
- package/mcp-docs/web/components/Grid.txt +236 -0
- package/mcp-docs/web/components/GridColumn.txt +209 -0
- package/mcp-docs/web/components/HStack.txt +236 -0
- package/mcp-docs/web/components/HeroSquare.txt +48 -0
- package/mcp-docs/web/components/Icon.txt +145 -0
- package/mcp-docs/web/components/IconButton.txt +390 -0
- package/mcp-docs/web/components/InputChip.txt +187 -0
- package/mcp-docs/web/components/Interactable.txt +193 -0
- package/mcp-docs/web/components/LineChart.txt +1576 -0
- package/mcp-docs/web/components/Link.txt +243 -0
- package/mcp-docs/web/components/ListCell.txt +418 -0
- package/mcp-docs/web/components/LogoMark.txt +84 -0
- package/mcp-docs/web/components/LogoWordMark.txt +93 -0
- package/mcp-docs/web/components/Lottie.txt +157 -0
- package/mcp-docs/web/components/LottieStatusAnimation.txt +57 -0
- package/mcp-docs/web/components/MediaQueryProvider.txt +108 -0
- package/mcp-docs/web/components/Modal.txt +196 -0
- package/mcp-docs/web/components/ModalBody.txt +117 -0
- package/mcp-docs/web/components/ModalFooter.txt +119 -0
- package/mcp-docs/web/components/ModalHeader.txt +123 -0
- package/mcp-docs/web/components/MultiContentModule.txt +381 -0
- package/mcp-docs/web/components/NavigationBar.txt +102 -0
- package/mcp-docs/web/components/NavigationTitle.txt +25 -0
- package/mcp-docs/web/components/NavigationTitleSelect.txt +45 -0
- package/mcp-docs/web/components/NudgeCard.txt +181 -0
- package/mcp-docs/web/components/Overlay.txt +171 -0
- package/mcp-docs/web/components/PageFooter.txt +184 -0
- package/mcp-docs/web/components/PageHeader.txt +243 -0
- package/mcp-docs/web/components/Pagination.txt +499 -0
- package/mcp-docs/web/components/PeriodSelector.txt +703 -0
- package/mcp-docs/web/components/Pictogram.txt +48 -0
- package/mcp-docs/web/components/Point.txt +460 -0
- package/mcp-docs/web/components/PortalProvider.txt +76 -0
- package/mcp-docs/web/components/Pressable.txt +193 -0
- package/mcp-docs/web/components/ProgressBar.txt +163 -0
- package/mcp-docs/web/components/ProgressBarWithFixedLabels.txt +212 -0
- package/mcp-docs/web/components/ProgressBarWithFloatLabel.txt +181 -0
- package/mcp-docs/web/components/ProgressCircle.txt +443 -0
- package/mcp-docs/web/components/Radio.txt +219 -0
- package/mcp-docs/web/components/RadioCell.txt +215 -0
- package/mcp-docs/web/components/RadioGroup.txt +288 -0
- package/mcp-docs/web/components/ReferenceLine.txt +451 -0
- package/mcp-docs/web/components/RemoteImage.txt +165 -0
- package/mcp-docs/web/components/RemoteImageGroup.txt +86 -0
- package/mcp-docs/web/components/RollingNumber.txt +1021 -0
- package/mcp-docs/web/components/Scrubber.txt +231 -0
- package/mcp-docs/web/components/SearchInput.txt +117 -0
- package/mcp-docs/web/components/SectionHeader.txt +217 -0
- package/mcp-docs/web/components/SegmentedTabs.txt +324 -0
- package/mcp-docs/web/components/Select.txt +224 -0
- package/mcp-docs/web/components/SelectChip.txt +314 -0
- package/mcp-docs/web/components/SelectOption.txt +165 -0
- package/mcp-docs/web/components/Sidebar.txt +349 -0
- package/mcp-docs/web/components/SidebarItem.txt +131 -0
- package/mcp-docs/web/components/SidebarMoreMenu.txt +30 -0
- package/mcp-docs/web/components/Spacer.txt +173 -0
- package/mcp-docs/web/components/Sparkline.txt +122 -0
- package/mcp-docs/web/components/SparklineGradient.txt +106 -0
- package/mcp-docs/web/components/SparklineInteractive.txt +153 -0
- package/mcp-docs/web/components/SparklineInteractiveHeader.txt +76 -0
- package/mcp-docs/web/components/Spinner.txt +128 -0
- package/mcp-docs/web/components/SpotIcon.txt +48 -0
- package/mcp-docs/web/components/SpotRectangle.txt +48 -0
- package/mcp-docs/web/components/SpotSquare.txt +48 -0
- package/mcp-docs/web/components/Stepper.txt +682 -0
- package/mcp-docs/web/components/SubBrandLogoMark.txt +125 -0
- package/mcp-docs/web/components/SubBrandLogoWordMark.txt +125 -0
- package/mcp-docs/web/components/Switch.txt +85 -0
- package/mcp-docs/web/components/TabIndicator.txt +48 -0
- package/mcp-docs/web/components/TabLabel.txt +158 -0
- package/mcp-docs/web/components/TabNavigation.txt +159 -0
- package/mcp-docs/web/components/TabbedChips.txt +155 -0
- package/mcp-docs/web/components/Table.txt +367 -0
- package/mcp-docs/web/components/TableBody.txt +83 -0
- package/mcp-docs/web/components/TableCaption.txt +102 -0
- package/mcp-docs/web/components/TableCell.txt +165 -0
- package/mcp-docs/web/components/TableCellFallback.txt +97 -0
- package/mcp-docs/web/components/TableFooter.txt +83 -0
- package/mcp-docs/web/components/TableHeader.txt +100 -0
- package/mcp-docs/web/components/TableRow.txt +140 -0
- package/mcp-docs/web/components/Tabs.txt +212 -0
- package/mcp-docs/web/components/Tag.txt +304 -0
- package/mcp-docs/web/components/Text.txt +232 -0
- package/mcp-docs/web/components/TextInput.txt +652 -0
- package/mcp-docs/web/components/ThemeProvider.txt +199 -0
- package/mcp-docs/web/components/TileButton.txt +158 -0
- package/mcp-docs/web/components/Toast.txt +203 -0
- package/mcp-docs/web/components/Tooltip.txt +89 -0
- package/mcp-docs/web/components/Tour.txt +179 -0
- package/mcp-docs/web/components/Tray.txt +288 -0
- package/mcp-docs/web/components/UpsellCard.txt +319 -0
- package/mcp-docs/web/components/VStack.txt +224 -0
- package/mcp-docs/web/components/XAxis.txt +619 -0
- package/mcp-docs/web/components/YAxis.txt +548 -0
- package/mcp-docs/web/getting-started/ai-overview.txt +108 -0
- package/mcp-docs/web/getting-started/installation.txt +103 -0
- package/mcp-docs/web/getting-started/introduction.txt +102 -0
- package/mcp-docs/web/getting-started/playground.txt +28 -0
- package/mcp-docs/web/getting-started/styling.txt +161 -0
- package/mcp-docs/web/getting-started/templates.txt +121 -0
- package/mcp-docs/web/getting-started/theming.txt +426 -0
- package/mcp-docs/web/hooks/useBreakpoints.txt +61 -0
- package/mcp-docs/web/hooks/useDimensions.txt +114 -0
- package/mcp-docs/web/hooks/useEventHandler.txt +120 -0
- package/mcp-docs/web/hooks/useHasMounted.txt +75 -0
- package/mcp-docs/web/hooks/useIsoEffect.txt +58 -0
- package/mcp-docs/web/hooks/useMediaQuery.txt +114 -0
- package/mcp-docs/web/hooks/useMergeRefs.txt +116 -0
- package/mcp-docs/web/hooks/useOverlayContentContext.txt +279 -0
- package/mcp-docs/web/hooks/usePreviousValue.txt +74 -0
- package/mcp-docs/web/hooks/useRefMap.txt +178 -0
- package/mcp-docs/web/hooks/useScrollBlocker.txt +82 -0
- package/mcp-docs/web/hooks/useTheme.txt +364 -0
- package/mcp-docs/web/routes.txt +163 -0
- package/package.json +1 -1
|
@@ -0,0 +1,621 @@
|
|
|
1
|
+
# XAxis
|
|
2
|
+
|
|
3
|
+
A horizontal axis component for CartesianChart. Displays tick marks, labels, gridlines, and supports custom formatting, positioning, and data domains.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { XAxis } from '@coinbase/cds-mobile-visualization'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
### Basic Example
|
|
14
|
+
|
|
15
|
+
The XAxis component provides a horizontal axis for charts with automatic tick generation and labeling.
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
<CartesianChart
|
|
19
|
+
enableScrubbing
|
|
20
|
+
height={250}
|
|
21
|
+
series={[
|
|
22
|
+
{
|
|
23
|
+
id: 'prices',
|
|
24
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
25
|
+
},
|
|
26
|
+
]}
|
|
27
|
+
xAxis={{
|
|
28
|
+
data: ['April 1', 'April 2', 'April 3', 'April 4', 'April 5', 'April 6', 'April 7'],
|
|
29
|
+
}}
|
|
30
|
+
>
|
|
31
|
+
<XAxis showLine showTickMarks showGrid />
|
|
32
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
33
|
+
<Scrubber />
|
|
34
|
+
</CartesianChart>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Axis Config
|
|
38
|
+
|
|
39
|
+
Properties related to the scale of an axis are set on the Chart component. This includes `scaleType`, `domain`, `domainLimit`, `range`, `data`, and `categoryPadding`.
|
|
40
|
+
|
|
41
|
+
#### Scale Type
|
|
42
|
+
|
|
43
|
+
XAxis supports `linear` (default), `log`, and `band` scale types.
|
|
44
|
+
`linear` and `log` are numeric scales while `band` is a categorical scale.
|
|
45
|
+
`band` scale is required for bar charts.
|
|
46
|
+
|
|
47
|
+
```jsx
|
|
48
|
+
<CartesianChart
|
|
49
|
+
height={250}
|
|
50
|
+
series={[
|
|
51
|
+
{
|
|
52
|
+
id: 'prices',
|
|
53
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
54
|
+
},
|
|
55
|
+
]}
|
|
56
|
+
xAxis={{
|
|
57
|
+
scaleType: 'band',
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
60
|
+
<XAxis showLine showTickMarks showGrid />
|
|
61
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
62
|
+
</CartesianChart>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
#### Domain
|
|
66
|
+
|
|
67
|
+
An axis's domain is the range of values that the axis will display.
|
|
68
|
+
You can pass in either an object (AxisBounds) with `min` and `max` properties (both optional), or a function that receives initial `AxisBounds` and returns an adjusted `AxisBounds`.
|
|
69
|
+
|
|
70
|
+
```jsx
|
|
71
|
+
<CartesianChart
|
|
72
|
+
height={250}
|
|
73
|
+
series={[
|
|
74
|
+
{
|
|
75
|
+
id: 'prices',
|
|
76
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
77
|
+
},
|
|
78
|
+
]}
|
|
79
|
+
xAxis={{
|
|
80
|
+
domain: ({ min, max }) => ({ min: min - 5, max: max + 5 }),
|
|
81
|
+
}}
|
|
82
|
+
>
|
|
83
|
+
<XAxis showLine showTickMarks showGrid tickInterval={16} />
|
|
84
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
85
|
+
</CartesianChart>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
##### Domain Limit
|
|
89
|
+
|
|
90
|
+
For numeric scales, you can set the domain limit to `nice` or `strict` (default for XAxis). `nice` will round the domain to human-friendly values, while `strict` will use the exact min/max values from the data. See [d3-scale](https://d3js.org/d3-scale/linear#linear_nice) for more details.
|
|
91
|
+
|
|
92
|
+
#### Range
|
|
93
|
+
|
|
94
|
+
An axis's range is the range of values that the axis will display in pixels. This is most useful for adjusting the sizing of the data inside of the chart's drawing area.
|
|
95
|
+
|
|
96
|
+
You can pass in either an object (AxisBounds) with `min` and `max` properties (both optional), or a function that receives initial `AxisBounds` and returns an adjusted `AxisBounds`.
|
|
97
|
+
|
|
98
|
+
```jsx
|
|
99
|
+
<CartesianChart
|
|
100
|
+
height={250}
|
|
101
|
+
series={[
|
|
102
|
+
{
|
|
103
|
+
id: 'prices',
|
|
104
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
105
|
+
},
|
|
106
|
+
]}
|
|
107
|
+
xAxis={{
|
|
108
|
+
range: ({ min, max }) => ({ min, max: max - 64 }),
|
|
109
|
+
}}
|
|
110
|
+
>
|
|
111
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
112
|
+
</CartesianChart>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
#### Data
|
|
116
|
+
|
|
117
|
+
Data sets x values for the axis.
|
|
118
|
+
|
|
119
|
+
##### String Data
|
|
120
|
+
|
|
121
|
+
Using string data will allow you to set string x values for each data point.
|
|
122
|
+
|
|
123
|
+
```jsx
|
|
124
|
+
<CartesianChart
|
|
125
|
+
height={250}
|
|
126
|
+
series={[
|
|
127
|
+
{
|
|
128
|
+
id: 'prices',
|
|
129
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
130
|
+
},
|
|
131
|
+
]}
|
|
132
|
+
xAxis={{
|
|
133
|
+
data: ['April 1', 'April 2', 'April 3', 'April 4', 'April 5', 'April 6', 'April 7'],
|
|
134
|
+
}}
|
|
135
|
+
>
|
|
136
|
+
<XAxis showLine showTickMarks showGrid />
|
|
137
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
138
|
+
</CartesianChart>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
##### Number Data
|
|
142
|
+
|
|
143
|
+
Using number data with a numeric scale will allow you to adjust the x values for each data point.
|
|
144
|
+
|
|
145
|
+
```jsx
|
|
146
|
+
<LineChart
|
|
147
|
+
enableScrubbing
|
|
148
|
+
series={[
|
|
149
|
+
{
|
|
150
|
+
id: 'line',
|
|
151
|
+
data: [2, 5.5, 2, 8.5, 1.5, 5],
|
|
152
|
+
},
|
|
153
|
+
]}
|
|
154
|
+
height={250}
|
|
155
|
+
showArea
|
|
156
|
+
renderPoints={() => true}
|
|
157
|
+
curve="natural"
|
|
158
|
+
showXAxis
|
|
159
|
+
xAxis={{ data: [1, 2, 3, 5, 8, 10], showLine: true, showTickMarks: true, showGrid: true }}
|
|
160
|
+
showYAxis
|
|
161
|
+
yAxis={{
|
|
162
|
+
domain: { min: 0 },
|
|
163
|
+
position: 'left',
|
|
164
|
+
showLine: true,
|
|
165
|
+
showTickMarks: true,
|
|
166
|
+
showGrid: true,
|
|
167
|
+
}}
|
|
168
|
+
>
|
|
169
|
+
<Scrubber />
|
|
170
|
+
</LineChart>
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
#### Category Padding
|
|
174
|
+
|
|
175
|
+
For band scales, you can set the category padding to adjust the spacing between categories. The default is 0.1. This is a value between 0 and 1, where 0.1 = 10% spacing.
|
|
176
|
+
|
|
177
|
+
```jsx
|
|
178
|
+
<BarChart
|
|
179
|
+
showXAxis
|
|
180
|
+
height={400}
|
|
181
|
+
series={[
|
|
182
|
+
{
|
|
183
|
+
id: 'weekly-data',
|
|
184
|
+
data: [45, 52, 38, 45, 19, 23, 32],
|
|
185
|
+
},
|
|
186
|
+
]}
|
|
187
|
+
xAxis={{
|
|
188
|
+
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
|
189
|
+
showTickMarks: true,
|
|
190
|
+
showLine: true,
|
|
191
|
+
categoryPadding: 0.5,
|
|
192
|
+
}}
|
|
193
|
+
/>
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Axis Props
|
|
197
|
+
|
|
198
|
+
Properties related to the visual appearance of the XAxis are set on the component itself. This includes `position`, `showGrid`, `showLine`, `showTickMarks`, `size`, `tickInterval`, `ticks`, `tickLabelFormatter`, and `tickMarkSize`.
|
|
199
|
+
|
|
200
|
+
#### Position
|
|
201
|
+
|
|
202
|
+
You can set the position of an axis to `top` or `bottom` (default).
|
|
203
|
+
|
|
204
|
+
```jsx
|
|
205
|
+
function XAxisPositionExample() {
|
|
206
|
+
const theme = useTheme();
|
|
207
|
+
const lineA = [5, 5, 10, 90, 85, 70, 30, 25, 25];
|
|
208
|
+
const lineB = [90, 85, 70, 25, 23, 40, 45, 40, 50];
|
|
209
|
+
|
|
210
|
+
const timeData = useMemo(
|
|
211
|
+
() =>
|
|
212
|
+
[
|
|
213
|
+
new Date(2023, 7, 31),
|
|
214
|
+
new Date(2023, 7, 31, 12),
|
|
215
|
+
new Date(2023, 8, 1),
|
|
216
|
+
new Date(2023, 8, 1, 12),
|
|
217
|
+
new Date(2023, 8, 2),
|
|
218
|
+
new Date(2023, 8, 2, 12),
|
|
219
|
+
new Date(2023, 8, 3),
|
|
220
|
+
new Date(2023, 8, 3, 12),
|
|
221
|
+
new Date(2023, 8, 4),
|
|
222
|
+
].map((d) => d.getTime()),
|
|
223
|
+
[],
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
const dateFormatter = useCallback(
|
|
227
|
+
(index: number) => {
|
|
228
|
+
return new Date(timeData[index]).toLocaleDateString('en-US', {
|
|
229
|
+
month: '2-digit',
|
|
230
|
+
day: '2-digit',
|
|
231
|
+
});
|
|
232
|
+
},
|
|
233
|
+
[timeData],
|
|
234
|
+
);
|
|
235
|
+
|
|
236
|
+
const timeOfDayFormatter = useCallback(
|
|
237
|
+
(index: number) => {
|
|
238
|
+
return new Date(timeData[index]).toLocaleTimeString('en-US', {
|
|
239
|
+
hour: '2-digit',
|
|
240
|
+
});
|
|
241
|
+
},
|
|
242
|
+
[timeData],
|
|
243
|
+
);
|
|
244
|
+
|
|
245
|
+
const timeOfDayTicks = useMemo(() => {
|
|
246
|
+
return timeData.map((d, index) => index);
|
|
247
|
+
}, [timeData]);
|
|
248
|
+
|
|
249
|
+
const dateTicks = useMemo(() => {
|
|
250
|
+
return timeData.map((d, index) => index).filter((d) => d % 2 === 0);
|
|
251
|
+
}, [timeData]);
|
|
252
|
+
|
|
253
|
+
return (
|
|
254
|
+
<LineChart
|
|
255
|
+
enableScrubbing
|
|
256
|
+
curve="monotone"
|
|
257
|
+
height={400}
|
|
258
|
+
series={[
|
|
259
|
+
{
|
|
260
|
+
id: 'lineA',
|
|
261
|
+
data: lineA,
|
|
262
|
+
color: theme.color.accentBoldBlue,
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
id: 'lineB',
|
|
266
|
+
data: lineB,
|
|
267
|
+
color: theme.color.accentBoldGreen,
|
|
268
|
+
},
|
|
269
|
+
]}
|
|
270
|
+
yAxis={{
|
|
271
|
+
domain: { min: 0, max: 100 },
|
|
272
|
+
}}
|
|
273
|
+
>
|
|
274
|
+
<XAxis
|
|
275
|
+
showLine
|
|
276
|
+
showTickMarks
|
|
277
|
+
position="top"
|
|
278
|
+
tickLabelFormatter={dateFormatter}
|
|
279
|
+
ticks={dateTicks}
|
|
280
|
+
/>
|
|
281
|
+
<XAxis
|
|
282
|
+
showGrid
|
|
283
|
+
showLine
|
|
284
|
+
showTickMarks
|
|
285
|
+
tickLabelFormatter={timeOfDayFormatter}
|
|
286
|
+
ticks={timeOfDayTicks}
|
|
287
|
+
/>
|
|
288
|
+
<Scrubber />
|
|
289
|
+
</LineChart>
|
|
290
|
+
);
|
|
291
|
+
};
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
#### Grid
|
|
295
|
+
|
|
296
|
+
You can show grid lines at each tick position using the `showGrid` prop.
|
|
297
|
+
|
|
298
|
+
```jsx
|
|
299
|
+
function XAxisGridExample() {
|
|
300
|
+
const [showGrid, setShowGrid] = useState(true);
|
|
301
|
+
return (
|
|
302
|
+
<VStack gap={2}>
|
|
303
|
+
<HStack gap={2} style={{ flexWrap: 'wrap' }}>
|
|
304
|
+
<Switch checked={showGrid} onChange={() => setShowGrid(!showGrid)}>
|
|
305
|
+
Show Grid
|
|
306
|
+
</Switch>
|
|
307
|
+
</HStack>
|
|
308
|
+
<CartesianChart
|
|
309
|
+
enableScrubbing
|
|
310
|
+
height={250}
|
|
311
|
+
series={[
|
|
312
|
+
{
|
|
313
|
+
id: 'prices',
|
|
314
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
315
|
+
},
|
|
316
|
+
]}
|
|
317
|
+
xAxis={{
|
|
318
|
+
data: ['April 1', 'April 2', 'April 3', 'April 4', 'April 5', 'April 6', 'April 7'],
|
|
319
|
+
}}
|
|
320
|
+
>
|
|
321
|
+
<XAxis showLine showTickMarks showGrid={showGrid} />
|
|
322
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
323
|
+
<Scrubber />
|
|
324
|
+
</CartesianChart>
|
|
325
|
+
</VStack>
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
You can also customize the grid lines using the `GridLineComponent` prop.
|
|
331
|
+
|
|
332
|
+
```jsx
|
|
333
|
+
function CustomGridLineExample() {
|
|
334
|
+
const ThinSolidLine = memo((props: SolidLineProps) => <SolidLine {...props} strokeWidth={1} />);
|
|
335
|
+
|
|
336
|
+
return (
|
|
337
|
+
<CartesianChart
|
|
338
|
+
enableScrubbing
|
|
339
|
+
height={250}
|
|
340
|
+
series={[
|
|
341
|
+
{
|
|
342
|
+
id: 'prices',
|
|
343
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
344
|
+
},
|
|
345
|
+
]}
|
|
346
|
+
xAxis={{
|
|
347
|
+
data: ['April 1', 'April 2', 'April 3', 'April 4', 'April 5', 'April 6', 'April 7'],
|
|
348
|
+
}}
|
|
349
|
+
>
|
|
350
|
+
<XAxis showLine showTickMarks showGrid GridLineComponent={ThinSolidLine} />
|
|
351
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
352
|
+
<Scrubber />
|
|
353
|
+
</CartesianChart>
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
#### Line
|
|
359
|
+
|
|
360
|
+
You can show the axis line using the `showLine` prop.
|
|
361
|
+
|
|
362
|
+
```jsx
|
|
363
|
+
function XAxisLineExample() {
|
|
364
|
+
const [showLine, setShowLine] = useState(true);
|
|
365
|
+
return (
|
|
366
|
+
<VStack gap={2}>
|
|
367
|
+
<HStack gap={2} style={{ flexWrap: 'wrap' }}>
|
|
368
|
+
<Switch checked={showLine} onChange={() => setShowLine(!showLine)}>
|
|
369
|
+
Show Line
|
|
370
|
+
</Switch>
|
|
371
|
+
</HStack>
|
|
372
|
+
<CartesianChart
|
|
373
|
+
enableScrubbing
|
|
374
|
+
height={250}
|
|
375
|
+
series={[
|
|
376
|
+
{
|
|
377
|
+
id: 'prices',
|
|
378
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
379
|
+
},
|
|
380
|
+
]}
|
|
381
|
+
xAxis={{
|
|
382
|
+
data: ['April 1', 'April 2', 'April 3', 'April 4', 'April 5', 'April 6', 'April 7'],
|
|
383
|
+
}}
|
|
384
|
+
>
|
|
385
|
+
<XAxis showLine={showLine} showTickMarks showGrid />
|
|
386
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
387
|
+
<Scrubber />
|
|
388
|
+
</CartesianChart>
|
|
389
|
+
</VStack>
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
You can also customize the axis line using the `styles` props.
|
|
395
|
+
|
|
396
|
+
```jsx
|
|
397
|
+
function XAxisLineStylesExample() {
|
|
398
|
+
const theme = useTheme();
|
|
399
|
+
const [showLine, setShowLine] = useState(true);
|
|
400
|
+
return (
|
|
401
|
+
<VStack gap={2}>
|
|
402
|
+
<HStack gap={2} style={{ flexWrap: 'wrap' }}>
|
|
403
|
+
<Switch checked={showLine} onChange={() => setShowLine(!showLine)}>
|
|
404
|
+
Show Line
|
|
405
|
+
</Switch>
|
|
406
|
+
</HStack>
|
|
407
|
+
<CartesianChart
|
|
408
|
+
enableScrubbing
|
|
409
|
+
height={250}
|
|
410
|
+
series={[
|
|
411
|
+
{
|
|
412
|
+
id: 'prices',
|
|
413
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
414
|
+
},
|
|
415
|
+
]}
|
|
416
|
+
>
|
|
417
|
+
<XAxis
|
|
418
|
+
showLine={showLine}
|
|
419
|
+
showGrid
|
|
420
|
+
styles={{ line: { stroke: theme.color.accentBoldGreen, strokeWidth: 4 } }}
|
|
421
|
+
/>
|
|
422
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
423
|
+
<Scrubber />
|
|
424
|
+
</CartesianChart>
|
|
425
|
+
</VStack>
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
#### Size
|
|
431
|
+
|
|
432
|
+
The `size` prop sets the size of the axis in pixels. The default is 32 for XAxis, but can be adjusted to fit the size of your data.
|
|
433
|
+
|
|
434
|
+
```jsx
|
|
435
|
+
<CartesianChart
|
|
436
|
+
enableScrubbing
|
|
437
|
+
height={250}
|
|
438
|
+
series={[
|
|
439
|
+
{
|
|
440
|
+
id: 'prices',
|
|
441
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
442
|
+
},
|
|
443
|
+
]}
|
|
444
|
+
xAxis={{
|
|
445
|
+
data: ['April 1', 'April 2', 'April 3', 'April 4', 'April 5', 'April 6', 'April 7'],
|
|
446
|
+
}}
|
|
447
|
+
>
|
|
448
|
+
<XAxis showLine showTickMarks showGrid height={64} />
|
|
449
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
450
|
+
<Scrubber />
|
|
451
|
+
</CartesianChart>
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
#### Ticks
|
|
455
|
+
|
|
456
|
+
You can use the `ticks`, `requestedTickCount`, and `tickInterval` (default for XAxis) props to control the number and placement of ticks on the XAxis.
|
|
457
|
+
|
|
458
|
+
`ticks` accepts an array of numbers, which corresponds to the values of that axis that you would like to display ticks for.
|
|
459
|
+
|
|
460
|
+
```jsx
|
|
461
|
+
<CartesianChart
|
|
462
|
+
enableScrubbing
|
|
463
|
+
height={250}
|
|
464
|
+
series={[
|
|
465
|
+
{
|
|
466
|
+
id: 'prices',
|
|
467
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
468
|
+
},
|
|
469
|
+
]}
|
|
470
|
+
>
|
|
471
|
+
<XAxis showLine showTickMarks showGrid ticks={[0, 2, 4, 6]} />
|
|
472
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
473
|
+
<Scrubber />
|
|
474
|
+
</CartesianChart>
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
Using `requestedTickCount` will use [D3's ticks function](https://d3js.org/d3-array/ticks#ticks) to determine the number and placement of ticks. Note that this count is not guaranteed to be respected.
|
|
478
|
+
|
|
479
|
+
```jsx
|
|
480
|
+
<CartesianChart
|
|
481
|
+
enableScrubbing
|
|
482
|
+
height={250}
|
|
483
|
+
series={[
|
|
484
|
+
{
|
|
485
|
+
id: 'prices',
|
|
486
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
487
|
+
},
|
|
488
|
+
]}
|
|
489
|
+
>
|
|
490
|
+
<XAxis showLine showTickMarks showGrid requestedTickCount={4} />
|
|
491
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
492
|
+
<Scrubber />
|
|
493
|
+
</CartesianChart>
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
`tickInterval`, which accepts a number for the gap between ticks in pixels, will measure the available space and try to create evenly spaced ticks. It will always include the first and last values of the domain.
|
|
497
|
+
|
|
498
|
+
```jsx
|
|
499
|
+
<CartesianChart
|
|
500
|
+
enableScrubbing
|
|
501
|
+
height={250}
|
|
502
|
+
series={[
|
|
503
|
+
{
|
|
504
|
+
id: 'prices',
|
|
505
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
506
|
+
},
|
|
507
|
+
]}
|
|
508
|
+
>
|
|
509
|
+
<XAxis showLine showTickMarks showGrid tickInterval={16} />
|
|
510
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
511
|
+
<Scrubber />
|
|
512
|
+
</CartesianChart>
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
#### Tick Marks
|
|
516
|
+
|
|
517
|
+
You can show tick marks on the axis using the `showTickMarks` prop. You can also customize the tick mark size using the `tickMarkSize` prop.
|
|
518
|
+
|
|
519
|
+
```jsx
|
|
520
|
+
function XAxisTickMarksExample() {
|
|
521
|
+
const [showTickMarks, setShowTickMarks] = useState(true);
|
|
522
|
+
return (
|
|
523
|
+
<VStack gap={2}>
|
|
524
|
+
<HStack gap={2} style={{ flexWrap: 'wrap' }}>
|
|
525
|
+
<Switch checked={showTickMarks} onChange={() => setShowTickMarks(!showTickMarks)}>
|
|
526
|
+
Show Tick Marks
|
|
527
|
+
</Switch>
|
|
528
|
+
</HStack>
|
|
529
|
+
<CartesianChart
|
|
530
|
+
enableScrubbing
|
|
531
|
+
height={250}
|
|
532
|
+
series={[
|
|
533
|
+
{
|
|
534
|
+
id: 'prices',
|
|
535
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
536
|
+
},
|
|
537
|
+
]}
|
|
538
|
+
xAxis={{
|
|
539
|
+
data: ['April 1', 'April 2', 'April 3', 'April 4', 'April 5', 'April 6', 'April 7'],
|
|
540
|
+
}}
|
|
541
|
+
>
|
|
542
|
+
<XAxis showLine showTickMarks={showTickMarks} tickMarkSize={16} showGrid />
|
|
543
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
544
|
+
<Scrubber />
|
|
545
|
+
</CartesianChart>
|
|
546
|
+
</VStack>
|
|
547
|
+
);
|
|
548
|
+
}
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
#### Tick Labels
|
|
552
|
+
|
|
553
|
+
You can customize the tick labels using the `tickLabelFormatter` prop. It will receive the x data value of the tick. Meaning, if data is provided for the axis, it will receive the string label for the tick.
|
|
554
|
+
|
|
555
|
+
```jsx
|
|
556
|
+
<CartesianChart
|
|
557
|
+
enableScrubbing
|
|
558
|
+
height={250}
|
|
559
|
+
series={[
|
|
560
|
+
{
|
|
561
|
+
id: 'prices',
|
|
562
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
563
|
+
},
|
|
564
|
+
]}
|
|
565
|
+
xAxis={{
|
|
566
|
+
data: ['April 1', 'April 2', 'April 3', 'April 4', 'April 5', 'April 6', 'April 7'],
|
|
567
|
+
}}
|
|
568
|
+
>
|
|
569
|
+
<XAxis showGrid tickLabelFormatter={(value) => `Day of ${value}`} />
|
|
570
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
571
|
+
<Scrubber />
|
|
572
|
+
</CartesianChart>
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
If no data is set for the axis, it will receive the regular number value of the tick, which is normally the index corresponding to each value in the series.
|
|
576
|
+
|
|
577
|
+
```jsx
|
|
578
|
+
<CartesianChart
|
|
579
|
+
enableScrubbing
|
|
580
|
+
height={250}
|
|
581
|
+
series={[
|
|
582
|
+
{
|
|
583
|
+
id: 'prices',
|
|
584
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
585
|
+
},
|
|
586
|
+
]}
|
|
587
|
+
xAxis={{
|
|
588
|
+
domain: { min: -4, max: 16 },
|
|
589
|
+
}}
|
|
590
|
+
>
|
|
591
|
+
<XAxis showGrid tickLabelFormatter={(value) => value * 2} />
|
|
592
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
593
|
+
<Scrubber />
|
|
594
|
+
</CartesianChart>
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
## Props
|
|
598
|
+
|
|
599
|
+
| Prop | Type | Required | Default | Description |
|
|
600
|
+
| --- | --- | --- | --- | --- |
|
|
601
|
+
| `GridLineComponent` | `LineComponent` | No | `DottedLine` | Component to render the grid lines. |
|
|
602
|
+
| `className` | `string` | No | `-` | Custom className for the axis. |
|
|
603
|
+
| `classNames` | `{ root?: string; tickLabel?: string \| undefined; gridLine?: string \| undefined; line?: string \| undefined; tickMark?: string \| undefined; } \| undefined` | No | `-` | Custom classNames for the axis. |
|
|
604
|
+
| `height` | `number` | No | `32` | Height of the axis. This value is inclusive of the padding. |
|
|
605
|
+
| `minTickLabelGap` | `number` | No | `4` | Minimum gap between tick labels. Labels will be hidden if they are closer than this gap. |
|
|
606
|
+
| `position` | `top \| bottom` | No | `'bottom'` | The position of the axis relative to the charts drawing area. |
|
|
607
|
+
| `requestedTickCount` | `number` | No | `5 (for y-axis)` | Requested number of ticks to display. This value is passed into d3 and may not be respected. |
|
|
608
|
+
| `showGrid` | `boolean` | No | `-` | Whether to show grid lines at each tick position. |
|
|
609
|
+
| `showLine` | `boolean` | No | `-` | Whether to show the axis line. |
|
|
610
|
+
| `showTickMarks` | `boolean` | No | `-` | Whether to show tick marks on the axis. |
|
|
611
|
+
| `style` | `CSSProperties` | No | `-` | Custom style for the axis. |
|
|
612
|
+
| `styles` | `{ root?: CSSProperties; tickLabel?: CSSProperties \| undefined; gridLine?: CSSProperties \| undefined; line?: CSSProperties \| undefined; tickMark?: CSSProperties \| undefined; } \| undefined` | No | `-` | Custom styles for the axis. |
|
|
613
|
+
| `tickInterval` | `number` | No | `32 (for x-axis)` | Interval at which to show ticks. When provided, calculates tick count based on available space. |
|
|
614
|
+
| `tickLabelFormatter` | `((value: any) => ChartTextChildren)` | No | `-` | Formatter function for axis tick values. Tick values will be wrapped in ChartText component. |
|
|
615
|
+
| `tickMarkLabelGap` | `number` | No | `2 for x-axis, 8 for y-axis` | Space between the axis tick mark and labels. If tick marks are not shown, this is the gap between the axis and the chart. |
|
|
616
|
+
| `tickMarkSize` | `number` | No | `4` | Size of the tick marks. |
|
|
617
|
+
| `tickMaxStep` | `number` | No | `-` | Maximum step size for tick generation. Prevents the step from being larger than this value. |
|
|
618
|
+
| `tickMinStep` | `number` | No | `1` | Minimum step size for tick generation. Prevents the step from being smaller than this value. |
|
|
619
|
+
| `ticks` | `number[] \| ((value: number) => boolean)` | No | `-` | Custom tick configuration for the axis. When provided, this overrides the requestedTickCount property. - **Array**: Uses these exact values for tick positioning and labels. - **Function**: Filters based on the predicate function. - For **x-axis**: Checks every data index (0, 1, 2, ..., dataLength-1) - For **y-axis**: Filters d3-generated tick values |
|
|
620
|
+
|
|
621
|
+
|