@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,548 @@
|
|
|
1
|
+
# YAxis
|
|
2
|
+
|
|
3
|
+
A vertical 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 { YAxis } from '@coinbase/cds-web-visualization'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
### Basic Example
|
|
14
|
+
|
|
15
|
+
The YAxis component provides a vertical axis for charts with automatic tick generation and labeling.
|
|
16
|
+
|
|
17
|
+
```jsx live
|
|
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
|
+
>
|
|
28
|
+
<YAxis showGrid />
|
|
29
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
30
|
+
<Scrubber />
|
|
31
|
+
</CartesianChart>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Axis Config
|
|
35
|
+
|
|
36
|
+
Properties related to the scale of an axis are set on the Chart component. This includes `scaleType`, `domain`, `domainLimit`, `range`, `data`, and `categoryPadding`.
|
|
37
|
+
|
|
38
|
+
#### Scale Type
|
|
39
|
+
|
|
40
|
+
YAxis supports `linear` (default) and `log` scale types. Both `linear` and `log` are numeric scales.
|
|
41
|
+
|
|
42
|
+
```jsx live
|
|
43
|
+
<CartesianChart
|
|
44
|
+
height={400}
|
|
45
|
+
series={[
|
|
46
|
+
{
|
|
47
|
+
id: 'growthExponential',
|
|
48
|
+
data: [
|
|
49
|
+
1, 2, 4, 8, 15, 30, 65, 140, 280, 580, 1200, 2400, 4800, 9500, 19000, 38000, 75000, 150000,
|
|
50
|
+
],
|
|
51
|
+
color: 'var(--color-fgPositive)',
|
|
52
|
+
},
|
|
53
|
+
]}
|
|
54
|
+
yAxis={{
|
|
55
|
+
scaleType: 'log',
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
<Line seriesId="growthExponential" />
|
|
59
|
+
<YAxis
|
|
60
|
+
showGrid
|
|
61
|
+
showLine
|
|
62
|
+
showTickMarks
|
|
63
|
+
requestedTickCount={6}
|
|
64
|
+
width={70}
|
|
65
|
+
tickLabelFormatter={(value) => value.toLocaleString()}
|
|
66
|
+
/>
|
|
67
|
+
</CartesianChart>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
#### Domain
|
|
71
|
+
|
|
72
|
+
An axis's domain is the range of values that the axis will display.
|
|
73
|
+
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`.
|
|
74
|
+
|
|
75
|
+
```jsx live
|
|
76
|
+
<CartesianChart
|
|
77
|
+
height={250}
|
|
78
|
+
series={[
|
|
79
|
+
{
|
|
80
|
+
id: 'prices',
|
|
81
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
82
|
+
},
|
|
83
|
+
]}
|
|
84
|
+
yAxis={{
|
|
85
|
+
domain: ({ min, max }) => ({ min: min - 50, max: max + 50 }),
|
|
86
|
+
}}
|
|
87
|
+
>
|
|
88
|
+
<YAxis showGrid />
|
|
89
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
90
|
+
</CartesianChart>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
##### Domain Limit
|
|
94
|
+
|
|
95
|
+
You can set the domain limit to `nice` (default for YAxis) or `strict`. `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.
|
|
96
|
+
|
|
97
|
+
#### Range
|
|
98
|
+
|
|
99
|
+
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.
|
|
100
|
+
|
|
101
|
+
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`.
|
|
102
|
+
|
|
103
|
+
```jsx live
|
|
104
|
+
<CartesianChart
|
|
105
|
+
height={250}
|
|
106
|
+
series={[
|
|
107
|
+
{
|
|
108
|
+
id: 'prices',
|
|
109
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
110
|
+
},
|
|
111
|
+
]}
|
|
112
|
+
yAxis={{
|
|
113
|
+
range: ({ min, max }) => ({ min: min + 96, max: max - 96 }),
|
|
114
|
+
}}
|
|
115
|
+
>
|
|
116
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
117
|
+
</CartesianChart>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Axis Props
|
|
121
|
+
|
|
122
|
+
Properties related to the visual appearance of the YAxis are set on the component itself. This includes `position`, `showGrid`, `showLine`, `showTickMarks`, `size`, `tickInterval`, `ticks`, `tickLabelFormatter`, and `tickMarkSize`.
|
|
123
|
+
|
|
124
|
+
#### Position
|
|
125
|
+
|
|
126
|
+
You can set the position of an axis to `left` or `right` (default).
|
|
127
|
+
|
|
128
|
+
```jsx live
|
|
129
|
+
<CartesianChart
|
|
130
|
+
enableScrubbing
|
|
131
|
+
height={512}
|
|
132
|
+
series={[
|
|
133
|
+
{
|
|
134
|
+
id: 'linear',
|
|
135
|
+
yAxisId: 'linearAxis',
|
|
136
|
+
data: [1, 10, 30, 50, 70, 90, 100],
|
|
137
|
+
label: 'linear',
|
|
138
|
+
},
|
|
139
|
+
{ id: 'log', yAxisId: 'logAxis', data: [1, 10, 30, 50, 70, 90, 100], label: 'log' },
|
|
140
|
+
]}
|
|
141
|
+
xAxis={[{ data: [1, 10, 30, 50, 70, 90, 100] }]}
|
|
142
|
+
yAxis={[
|
|
143
|
+
{ id: 'linearAxis', scaleType: 'linear' },
|
|
144
|
+
{ id: 'logAxis', scaleType: 'log' },
|
|
145
|
+
]}
|
|
146
|
+
>
|
|
147
|
+
<YAxis showLine showTickMarks axisId="logAxis" position="left" />
|
|
148
|
+
<YAxis showLine showTickMarks axisId="linearAxis" />
|
|
149
|
+
<Line curve="natural" seriesId="linear" />
|
|
150
|
+
<Line curve="natural" seriesId="log" />
|
|
151
|
+
<Scrubber />
|
|
152
|
+
</CartesianChart>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
#### Grid
|
|
156
|
+
|
|
157
|
+
You can show grid lines at each tick position using the `showGrid` prop.
|
|
158
|
+
|
|
159
|
+
```jsx live
|
|
160
|
+
function YAxisGridExample() {
|
|
161
|
+
const [showGrid, setShowGrid] = useState(true);
|
|
162
|
+
return (
|
|
163
|
+
<VStack gap={2}>
|
|
164
|
+
<HStack gap={2} style={{ flexWrap: 'wrap' }}>
|
|
165
|
+
<Switch checked={showGrid} onChange={() => setShowGrid(!showGrid)}>
|
|
166
|
+
Show Grid
|
|
167
|
+
</Switch>
|
|
168
|
+
</HStack>
|
|
169
|
+
<CartesianChart
|
|
170
|
+
enableScrubbing
|
|
171
|
+
height={250}
|
|
172
|
+
series={[
|
|
173
|
+
{
|
|
174
|
+
id: 'prices',
|
|
175
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
176
|
+
},
|
|
177
|
+
]}
|
|
178
|
+
>
|
|
179
|
+
<YAxis showGrid={showGrid} />
|
|
180
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
181
|
+
<Scrubber />
|
|
182
|
+
</CartesianChart>
|
|
183
|
+
</VStack>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
You can also customize the grid lines using the `GridLineComponent` prop.
|
|
189
|
+
|
|
190
|
+
```jsx live
|
|
191
|
+
function CustomGridLineExample() {
|
|
192
|
+
const ThinSolidLine = memo((props: SolidLineProps) => <SolidLine {...props} strokeWidth={1} />);
|
|
193
|
+
|
|
194
|
+
const categories = Array.from({ length: 31 }, (_, i) => `3/${i + 1}`);
|
|
195
|
+
const gains = [
|
|
196
|
+
5, 0, 6, 18, 0, 5, 12, 0, 12, 22, 28, 18, 0, 12, 6, 0, 0, 24, 0, 0, 4, 0, 18, 0, 0, 14, 10, 16,
|
|
197
|
+
0, 0, 0,
|
|
198
|
+
];
|
|
199
|
+
const losses = [
|
|
200
|
+
-4, 0, -8, -12, -6, 0, 0, 0, -18, 0, -12, 0, -9, -6, 0, 0, 0, 0, -22, -8, 0, 0, -10, -14, 0, 0,
|
|
201
|
+
0, 0, 0, -12, -10,
|
|
202
|
+
];
|
|
203
|
+
const series = [
|
|
204
|
+
{ id: 'gains', data: gains, color: 'var(--color-fgPositive)', stackId: 'bars' },
|
|
205
|
+
{ id: 'losses', data: losses, color: 'var(--color-fgNegative)', stackId: 'bars' },
|
|
206
|
+
];
|
|
207
|
+
|
|
208
|
+
return (
|
|
209
|
+
<CartesianChart
|
|
210
|
+
height={420}
|
|
211
|
+
padding={4}
|
|
212
|
+
series={series}
|
|
213
|
+
xAxis={{ data: categories, scaleType: 'band' }}
|
|
214
|
+
>
|
|
215
|
+
<XAxis />
|
|
216
|
+
<YAxis
|
|
217
|
+
showGrid
|
|
218
|
+
GridLineComponent={ThinSolidLine}
|
|
219
|
+
tickLabelFormatter={(value) => `$${value}M`}
|
|
220
|
+
/>
|
|
221
|
+
<BarPlot />
|
|
222
|
+
<ReferenceLine LineComponent={SolidLine} dataY={0} />
|
|
223
|
+
</CartesianChart>
|
|
224
|
+
);
|
|
225
|
+
};
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
#### Line
|
|
229
|
+
|
|
230
|
+
You can show the axis line using the `showLine` prop.
|
|
231
|
+
|
|
232
|
+
```jsx live
|
|
233
|
+
function YAxisLineExample() {
|
|
234
|
+
const [showLine, setShowLine] = useState(true);
|
|
235
|
+
return (
|
|
236
|
+
<VStack gap={2}>
|
|
237
|
+
<HStack gap={2} style={{ flexWrap: 'wrap' }}>
|
|
238
|
+
<Switch checked={showLine} onChange={() => setShowLine(!showLine)}>
|
|
239
|
+
Show Line
|
|
240
|
+
</Switch>
|
|
241
|
+
</HStack>
|
|
242
|
+
<CartesianChart
|
|
243
|
+
enableScrubbing
|
|
244
|
+
height={250}
|
|
245
|
+
series={[
|
|
246
|
+
{
|
|
247
|
+
id: 'prices',
|
|
248
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
249
|
+
},
|
|
250
|
+
]}
|
|
251
|
+
>
|
|
252
|
+
<YAxis showLine={showLine} />
|
|
253
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
254
|
+
<Scrubber />
|
|
255
|
+
</CartesianChart>
|
|
256
|
+
</VStack>
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
You can also customize the axis line using the `classNames` and `styles` props.
|
|
262
|
+
|
|
263
|
+
```jsx live
|
|
264
|
+
function YAxisLineStylesExample() {
|
|
265
|
+
const [showLine, setShowLine] = useState(true);
|
|
266
|
+
return (
|
|
267
|
+
<VStack gap={2}>
|
|
268
|
+
<HStack gap={2} style={{ flexWrap: 'wrap' }}>
|
|
269
|
+
<Switch checked={showLine} onChange={() => setShowLine(!showLine)}>
|
|
270
|
+
Show Line
|
|
271
|
+
</Switch>
|
|
272
|
+
</HStack>
|
|
273
|
+
<CartesianChart
|
|
274
|
+
enableScrubbing
|
|
275
|
+
height={250}
|
|
276
|
+
series={[
|
|
277
|
+
{
|
|
278
|
+
id: 'prices',
|
|
279
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
280
|
+
},
|
|
281
|
+
]}
|
|
282
|
+
>
|
|
283
|
+
<YAxis
|
|
284
|
+
showLine={showLine}
|
|
285
|
+
showGrid
|
|
286
|
+
styles={{ line: { stroke: 'var(--color-accentBoldGreen)', strokeWidth: 4 } }}
|
|
287
|
+
/>
|
|
288
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
289
|
+
<Scrubber />
|
|
290
|
+
</CartesianChart>
|
|
291
|
+
</VStack>
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
#### Size
|
|
297
|
+
|
|
298
|
+
The `size` prop sets the size of the axis in pixels. The default is 44 for YAxis, but can be adjusted to fit the size of your data.
|
|
299
|
+
|
|
300
|
+
```jsx live
|
|
301
|
+
<CartesianChart
|
|
302
|
+
height={400}
|
|
303
|
+
series={[
|
|
304
|
+
{
|
|
305
|
+
id: 'growthExponential',
|
|
306
|
+
data: [
|
|
307
|
+
1, 2, 4, 8, 15, 30, 65, 140, 280, 580, 1200, 2400, 4800, 9500, 19000, 38000, 75000, 150000,
|
|
308
|
+
],
|
|
309
|
+
color: 'var(--color-fgPositive)',
|
|
310
|
+
},
|
|
311
|
+
]}
|
|
312
|
+
>
|
|
313
|
+
<Line curve="natural" showArea seriesId="growthExponential" />
|
|
314
|
+
<YAxis
|
|
315
|
+
showGrid
|
|
316
|
+
showLine
|
|
317
|
+
showTickMarks
|
|
318
|
+
requestedTickCount={6}
|
|
319
|
+
width={70}
|
|
320
|
+
tickLabelFormatter={(value) => value.toLocaleString()}
|
|
321
|
+
/>
|
|
322
|
+
</CartesianChart>
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
#### Ticks
|
|
326
|
+
|
|
327
|
+
You can use the `ticks`, `requestedTickCount` (default for YAxis), and `tickInterval` props to control the number and placement of ticks on the YAxis.
|
|
328
|
+
|
|
329
|
+
`ticks` accepts an array of numbers, which corresponds to the values of that axis that you would like to display ticks for.
|
|
330
|
+
|
|
331
|
+
```jsx live
|
|
332
|
+
<CartesianChart
|
|
333
|
+
enableScrubbing
|
|
334
|
+
height={250}
|
|
335
|
+
series={[
|
|
336
|
+
{
|
|
337
|
+
id: 'prices',
|
|
338
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
339
|
+
},
|
|
340
|
+
]}
|
|
341
|
+
>
|
|
342
|
+
<YAxis showLine showTickMarks showGrid ticks={[34, 56, 80]} />
|
|
343
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
344
|
+
<Scrubber />
|
|
345
|
+
</CartesianChart>
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
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.
|
|
349
|
+
|
|
350
|
+
This is the default behavior for YAxis, and defaults to `5`.
|
|
351
|
+
|
|
352
|
+
```jsx live
|
|
353
|
+
<CartesianChart
|
|
354
|
+
enableScrubbing
|
|
355
|
+
height={250}
|
|
356
|
+
series={[
|
|
357
|
+
{
|
|
358
|
+
id: 'prices',
|
|
359
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
360
|
+
},
|
|
361
|
+
]}
|
|
362
|
+
>
|
|
363
|
+
<YAxis showLine showTickMarks showGrid requestedTickCount={5} />
|
|
364
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
365
|
+
<Scrubber />
|
|
366
|
+
</CartesianChart>
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
`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.
|
|
370
|
+
|
|
371
|
+
```jsx live
|
|
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
|
+
>
|
|
382
|
+
<YAxis showLine showTickMarks showGrid tickInterval={8} />
|
|
383
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
384
|
+
<Scrubber />
|
|
385
|
+
</CartesianChart>
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
#### Tick Marks
|
|
389
|
+
|
|
390
|
+
You can show tick marks on the axis using the `showTickMarks` prop.
|
|
391
|
+
You can also customize the tick mark size using the `tickMarkSize` prop.
|
|
392
|
+
|
|
393
|
+
```jsx live
|
|
394
|
+
function YAxisTickMarksExample() {
|
|
395
|
+
const [showTickMarks, setShowTickMarks] = useState(true);
|
|
396
|
+
return (
|
|
397
|
+
<VStack gap={2}>
|
|
398
|
+
<HStack gap={2} style={{ flexWrap: 'wrap' }}>
|
|
399
|
+
<Switch checked={showTickMarks} onChange={() => setShowTickMarks(!showTickMarks)}>
|
|
400
|
+
Show Tick Marks
|
|
401
|
+
</Switch>
|
|
402
|
+
</HStack>
|
|
403
|
+
<CartesianChart
|
|
404
|
+
enableScrubbing
|
|
405
|
+
height={250}
|
|
406
|
+
series={[
|
|
407
|
+
{
|
|
408
|
+
id: 'prices',
|
|
409
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
410
|
+
},
|
|
411
|
+
]}
|
|
412
|
+
>
|
|
413
|
+
<YAxis showLine showTickMarks={showTickMarks} tickMarkSize={16} showGrid />
|
|
414
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
415
|
+
<Scrubber />
|
|
416
|
+
</CartesianChart>
|
|
417
|
+
</VStack>
|
|
418
|
+
);
|
|
419
|
+
}
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
#### Tick Labels
|
|
423
|
+
|
|
424
|
+
You can customize the tick labels using the `tickLabelFormatter` prop.
|
|
425
|
+
|
|
426
|
+
```jsx live
|
|
427
|
+
<CartesianChart
|
|
428
|
+
enableScrubbing
|
|
429
|
+
height={250}
|
|
430
|
+
series={[
|
|
431
|
+
{
|
|
432
|
+
id: 'prices',
|
|
433
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
434
|
+
},
|
|
435
|
+
]}
|
|
436
|
+
>
|
|
437
|
+
<YAxis showGrid tickLabelFormatter={(value) => `$${value}`} />
|
|
438
|
+
<Line seriesId="prices" curve="monotone" showArea />
|
|
439
|
+
<Scrubber />
|
|
440
|
+
</CartesianChart>
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
### Customization
|
|
444
|
+
|
|
445
|
+
#### Multiple Y Axes
|
|
446
|
+
|
|
447
|
+
```jsx live
|
|
448
|
+
<VStack gap={2}>
|
|
449
|
+
<CartesianChart
|
|
450
|
+
height={400}
|
|
451
|
+
series={[
|
|
452
|
+
{
|
|
453
|
+
id: 'revenue',
|
|
454
|
+
data: [455, 520, 380, 455, 285, 235],
|
|
455
|
+
yAxisId: 'revenue',
|
|
456
|
+
color: 'var(--color-accentBoldYellow)',
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
id: 'profitMargin',
|
|
460
|
+
data: [23, 20, 16, 38, 12, 9],
|
|
461
|
+
yAxisId: 'profitMargin',
|
|
462
|
+
color: 'var(--color-fgPositive)',
|
|
463
|
+
},
|
|
464
|
+
]}
|
|
465
|
+
xAxis={{
|
|
466
|
+
data: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
|
|
467
|
+
scaleType: 'band',
|
|
468
|
+
}}
|
|
469
|
+
yAxis={[
|
|
470
|
+
{
|
|
471
|
+
id: 'revenue',
|
|
472
|
+
domain: { min: 0 },
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
id: 'profitMargin',
|
|
476
|
+
domain: { min: 0, max: 100 },
|
|
477
|
+
},
|
|
478
|
+
]}
|
|
479
|
+
>
|
|
480
|
+
<XAxis showLine showTickMarks />
|
|
481
|
+
<YAxis
|
|
482
|
+
showGrid
|
|
483
|
+
showLine
|
|
484
|
+
showTickMarks
|
|
485
|
+
axisId="revenue"
|
|
486
|
+
position="left"
|
|
487
|
+
requestedTickCount={5}
|
|
488
|
+
width={60}
|
|
489
|
+
tickLabelFormatter={(value) => `$${value}k`}
|
|
490
|
+
/>
|
|
491
|
+
<YAxis
|
|
492
|
+
showLine
|
|
493
|
+
showTickMarks
|
|
494
|
+
axisId="profitMargin"
|
|
495
|
+
requestedTickCount={5}
|
|
496
|
+
tickLabelFormatter={(value) => `${value}%`}
|
|
497
|
+
/>
|
|
498
|
+
<BarPlot />
|
|
499
|
+
</CartesianChart>
|
|
500
|
+
<HStack justifyContent="center" gap={2}>
|
|
501
|
+
<Box alignItems="center" gap={0.5}>
|
|
502
|
+
<Box
|
|
503
|
+
borderRadius={1000}
|
|
504
|
+
width={10}
|
|
505
|
+
height={10}
|
|
506
|
+
style={{ background: 'var(--color-accentBoldYellow)' }}
|
|
507
|
+
/>
|
|
508
|
+
<Text font="label2">Revenue ($)</Text>
|
|
509
|
+
</Box>
|
|
510
|
+
<Box alignItems="center" gap={0.5}>
|
|
511
|
+
<Box
|
|
512
|
+
borderRadius={1000}
|
|
513
|
+
width={10}
|
|
514
|
+
height={10}
|
|
515
|
+
style={{ background: 'var(--color-fgPositive)' }}
|
|
516
|
+
/>
|
|
517
|
+
<Text font="label2">Profit Margin (%)</Text>
|
|
518
|
+
</Box>
|
|
519
|
+
</HStack>
|
|
520
|
+
</VStack>
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
## Props
|
|
524
|
+
|
|
525
|
+
| Prop | Type | Required | Default | Description |
|
|
526
|
+
| --- | --- | --- | --- | --- |
|
|
527
|
+
| `GridLineComponent` | `LineComponent` | No | `DottedLine` | Component to render the grid lines. |
|
|
528
|
+
| `axisId` | `string` | No | `-` | The ID of the axis to render. Defaults to defaultAxisId if not specified. |
|
|
529
|
+
| `className` | `string` | No | `-` | Custom className for the axis. |
|
|
530
|
+
| `classNames` | `{ root?: string; tickLabel?: string \| undefined; gridLine?: string \| undefined; line?: string \| undefined; tickMark?: string \| undefined; } \| undefined` | No | `-` | Custom classNames for the axis. |
|
|
531
|
+
| `minTickLabelGap` | `number` | No | `4` | Minimum gap between tick labels. Labels will be hidden if they are closer than this gap. |
|
|
532
|
+
| `position` | `left \| right` | No | `'right'` | The position of the axis relative to the charts drawing area. |
|
|
533
|
+
| `requestedTickCount` | `number` | No | `5 (for y-axis)` | Requested number of ticks to display. This value is passed into d3 and may not be respected. |
|
|
534
|
+
| `showGrid` | `boolean` | No | `-` | Whether to show grid lines at each tick position. |
|
|
535
|
+
| `showLine` | `boolean` | No | `-` | Whether to show the axis line. |
|
|
536
|
+
| `showTickMarks` | `boolean` | No | `-` | Whether to show tick marks on the axis. |
|
|
537
|
+
| `style` | `CSSProperties` | No | `-` | Custom style for the axis. |
|
|
538
|
+
| `styles` | `{ root?: CSSProperties; tickLabel?: CSSProperties \| undefined; gridLine?: CSSProperties \| undefined; line?: CSSProperties \| undefined; tickMark?: CSSProperties \| undefined; } \| undefined` | No | `-` | Custom styles for the axis. |
|
|
539
|
+
| `tickInterval` | `number` | No | `32 (for x-axis)` | Interval at which to show ticks. When provided, calculates tick count based on available space. |
|
|
540
|
+
| `tickLabelFormatter` | `((value: any) => ChartTextChildren)` | No | `-` | Formatter function for axis tick values. Tick values will be wrapped in ChartText component. |
|
|
541
|
+
| `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. |
|
|
542
|
+
| `tickMarkSize` | `number` | No | `4` | Size of the tick marks. |
|
|
543
|
+
| `tickMaxStep` | `number` | No | `-` | Maximum step size for tick generation. Prevents the step from being larger than this value. |
|
|
544
|
+
| `tickMinStep` | `number` | No | `1` | Minimum step size for tick generation. Prevents the step from being smaller than this value. |
|
|
545
|
+
| `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 |
|
|
546
|
+
| `width` | `number` | No | `44` | Width of the axis. This value is inclusive of the padding. |
|
|
547
|
+
|
|
548
|
+
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: ai-overview
|
|
3
|
+
title: AI Overview
|
|
4
|
+
hide_title: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
import { VStack } from '@coinbase/cds-web/layout';
|
|
8
|
+
import { MDXSection } from '@site/src/components/page/MDXSection';
|
|
9
|
+
import { MDXArticle } from '@site/src/components/page/MDXArticle';
|
|
10
|
+
import { ContentHeader } from '@site/src/components/page/ContentHeader';
|
|
11
|
+
|
|
12
|
+
<VStack gap={5}>
|
|
13
|
+
<ContentHeader
|
|
14
|
+
title="AI Overview"
|
|
15
|
+
description="Use AI as your CDS development partner to build consistent, accessible user interfaces across web and mobile platforms."
|
|
16
|
+
/>
|
|
17
|
+
|
|
18
|
+
<MDXSection>
|
|
19
|
+
<MDXArticle>
|
|
20
|
+
|
|
21
|
+
## MCP Server
|
|
22
|
+
|
|
23
|
+
The CDS MCP Server provides direct CDS context to LLMs, allowing AI models to understand and work with CDS APIs and components.
|
|
24
|
+
|
|
25
|
+
From [modelcontextprotocol.io](https://modelcontextprotocol.io/docs/getting-started/intro):
|
|
26
|
+
|
|
27
|
+
> _MCP is an open protocol that standardizes how applications provide context to large language models (LLMs). MCP provides a standardized way to connect AI models to different data sources and tools._
|
|
28
|
+
|
|
29
|
+
### First time setup
|
|
30
|
+
|
|
31
|
+
Run the setup command to install the CDS MCP Server for Cursor or Claude Code, then enable the MCP server in your agent.
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx --package=@coinbase/cds-mcp-server cds-mcp-setup
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
:::tip
|
|
38
|
+
Make sure to enable the MCP server after installation.<br />
|
|
39
|
+
See the [Cursor docs here](https://cursor.com/docs/context/mcp#using-mcp-in-chat) and the [Claude Code docs here](https://docs.claude.com/en/docs/claude-code/mcp#managing-your-servers) for more information.
|
|
40
|
+
:::
|
|
41
|
+
|
|
42
|
+
### Using the MCP server
|
|
43
|
+
|
|
44
|
+
Once the CDS MCP Server is enabled in your agent, the agent will automatically be able to use the CDS MCP tools to interact with the CDS APIs and components.
|
|
45
|
+
|
|
46
|
+
Try asking a question like "How can I add an icon to a CDS Button?" or "How can I customize the CDS Stepper component behavior?"
|
|
47
|
+
|
|
48
|
+
### Advanced installation
|
|
49
|
+
|
|
50
|
+
To install the MCP server separately as a standalone package and add it as a dependency to your project:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm install @coinbase/cds-mcp-server
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Or with Yarn:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
yarn add @coinbase/cds-mcp-server
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
:::tip
|
|
63
|
+
Avoid installing mismatched versions of the CDS libraries and the CDS MCP Server. The MCP server is automatically included as a dependency of the CDS libraries.
|
|
64
|
+
:::
|
|
65
|
+
|
|
66
|
+
</MDXArticle>
|
|
67
|
+
</MDXSection>
|
|
68
|
+
|
|
69
|
+
<MDXSection>
|
|
70
|
+
<MDXArticle>
|
|
71
|
+
|
|
72
|
+
## Documentation
|
|
73
|
+
|
|
74
|
+
Documentation pages include "View as markdown" and "Copy page" buttons in a markdown like format.
|
|
75
|
+
This is useful when pasting documentation into ChatGPT, Claude, or Perplexity for help with implementation.
|
|
76
|
+
|
|
77
|
+
### Documentation indexes
|
|
78
|
+
|
|
79
|
+
CDS also provides a comprehensive index of documentation in markdown format per platform:
|
|
80
|
+
|
|
81
|
+
**Web:**
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
https://cds.coinbase.com/llms/web/routes.txt
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Mobile:**
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
https://cds.coinbase.com/llms/mobile/routes.txt
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Each routes file contains links to all component documentation, React hooks, getting started guides, and brief descriptions for each item.
|
|
94
|
+
|
|
95
|
+
#### Adding indexes to Cursor
|
|
96
|
+
|
|
97
|
+
You can add these indexes to Cursor for searchable access to the entire CDS documentation library:
|
|
98
|
+
|
|
99
|
+
1. Open Cursor Settings
|
|
100
|
+
2. Navigate to "Indexing & Docs"
|
|
101
|
+
3. Add the docs URL for your platform (web or mobile) using the routes links above
|
|
102
|
+
4. AI will automatically fetch relevant docs when you reference components
|
|
103
|
+
|
|
104
|
+
Other AI IDEs and assistants can be given these indexes as needed or added to their rule files.
|
|
105
|
+
|
|
106
|
+
</MDXArticle>
|
|
107
|
+
</MDXSection>
|
|
108
|
+
</VStack>
|