@coinbase/cds-mcp-server 8.52.0 → 8.52.1
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 +4 -0
- package/mcp-docs/mobile/components/AreaChart.txt +12 -222
- package/mcp-docs/mobile/components/BarChart.txt +222 -333
- package/mcp-docs/mobile/components/CartesianChart.txt +6 -3
- package/mcp-docs/mobile/components/Chip.txt +74 -29
- package/mcp-docs/mobile/components/LineChart.txt +54 -134
- package/mcp-docs/mobile/components/Point.txt +1 -0
- package/mcp-docs/mobile/components/Scrubber.txt +2 -1
- package/mcp-docs/mobile/components/XAxis.txt +54 -1
- package/mcp-docs/mobile/components/YAxis.txt +3 -1
- package/mcp-docs/mobile/routes.txt +1 -1
- package/mcp-docs/web/components/AreaChart.txt +26 -118
- package/mcp-docs/web/components/BarChart.txt +228 -116
- package/mcp-docs/web/components/CartesianChart.txt +6 -3
- package/mcp-docs/web/components/Chip.txt +74 -29
- package/mcp-docs/web/components/FocusTrap.txt +2 -1
- package/mcp-docs/web/components/FullscreenModal.txt +2 -2
- package/mcp-docs/web/components/FullscreenModalLayout.txt +2 -2
- package/mcp-docs/web/components/LineChart.txt +42 -2
- package/mcp-docs/web/components/Modal.txt +67 -2
- package/mcp-docs/web/components/Point.txt +1 -0
- package/mcp-docs/web/components/ReferenceLine.txt +1 -1
- package/mcp-docs/web/components/Scrubber.txt +2 -1
- package/mcp-docs/web/components/Tray.txt +69 -2
- package/mcp-docs/web/components/XAxis.txt +55 -2
- package/mcp-docs/web/components/YAxis.txt +4 -2
- package/mcp-docs/web/routes.txt +1 -1
- package/package.json +1 -1
|
@@ -265,7 +265,9 @@ function SeriesStacks() {
|
|
|
265
265
|
|
|
266
266
|
### Axes
|
|
267
267
|
|
|
268
|
-
You can configure your x and y axes with the `xAxis` and `yAxis` props. `xAxis` accepts an object while `yAxis` accepts an object or array.
|
|
268
|
+
You can configure your x and y axes with the `xAxis` and `yAxis` props. `xAxis` accepts an object or array, while `yAxis` accepts an object or array.
|
|
269
|
+
|
|
270
|
+
When `layout="horizontal"`, you can define multiple x-axes (for multiple value scales) but only one y-axis.
|
|
269
271
|
|
|
270
272
|
```jsx
|
|
271
273
|
<CartesianChart
|
|
@@ -1100,6 +1102,7 @@ function TradingTrends() {
|
|
|
1100
1102
|
| `inset` | `number \| Partial<ChartInset>` | No | `-` | Inset around the entire chart (outside the axes). |
|
|
1101
1103
|
| `justifyContent` | `flex-start \| flex-end \| center \| space-between \| space-around \| space-evenly` | No | `-` | - |
|
|
1102
1104
|
| `key` | `Key \| null` | No | `-` | - |
|
|
1105
|
+
| `layout` | `horizontal \| vertical` | No | `'vertical'` | Chart layout - describes the direction bars/areas grow. - vertical (default): Bars grow vertically. X is category axis, Y is value axis. - horizontal: Bars grow horizontally. Y is category axis, X is value axis. |
|
|
1103
1106
|
| `left` | `string \| number` | No | `-` | - |
|
|
1104
1107
|
| `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 |
|
|
1105
1108
|
| `legendAccessibilityLabel` | `string` | No | `'Legend'` | Accessibility label for the legend group. |
|
|
@@ -1155,8 +1158,8 @@ function TradingTrends() {
|
|
|
1155
1158
|
| `transform` | `string \| (({ perspective: AnimatableNumericValue; } & { rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ rotate: AnimatableStringValue; } & { perspective?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ rotateX: AnimatableStringValue; } & { perspective?: undefined; rotate?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ rotateY: AnimatableStringValue; } & { perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateZ?: undefined; scale?: undefined; scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ rotateZ: AnimatableStringValue; } & { perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; scale?: undefined; scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ scale: AnimatableNumericValue; } & { perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ scaleX: AnimatableNumericValue; } & { perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ scaleY: AnimatableNumericValue; } & { perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; scaleX?: undefined; translateX?: undefined; translateY?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ translateX: AnimatableNumericValue \| ${number}%; } & { perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; scaleX?: undefined; scaleY?: undefined; translateY?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ translateY: AnimatableNumericValue \| ${number}%; } & { perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; scaleX?: undefined; scaleY?: undefined; translateX?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ skewX: AnimatableStringValue; } & { perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ skewY: AnimatableStringValue; } & { perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; skewX?: undefined; matrix?: undefined; }) \| ({ matrix: AnimatableNumericValue[]; } & { perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; skewX?: undefined; skewY?: undefined; }))[]` | No | `-` | - |
|
|
1156
1159
|
| `userSelect` | `none \| auto \| text \| contain \| all` | No | `-` | - |
|
|
1157
1160
|
| `width` | `string \| number` | No | `-` | - |
|
|
1158
|
-
| `xAxis` | `Partial<
|
|
1159
|
-
| `yAxis` | `Partial<
|
|
1161
|
+
| `xAxis` | `Partial<CartesianAxisConfigProps> \| Partial<CartesianAxisConfigProps>[]` | No | `-` | Configuration for x-axis(es). Can be a single config or array of configs. |
|
|
1162
|
+
| `yAxis` | `Partial<Omit<CartesianAxisConfigProps, data>> \| Partial<Omit<CartesianAxisConfigProps, data>>[]` | No | `-` | Configuration for y-axis(es). Can be a single config or array of configs. |
|
|
1160
1163
|
| `zIndex` | `number` | No | `-` | - |
|
|
1161
1164
|
|
|
1162
1165
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Chip
|
|
2
2
|
|
|
3
|
-
A compact,
|
|
3
|
+
A compact content element for tags, filters, and selections.
|
|
4
4
|
|
|
5
5
|
## Import
|
|
6
6
|
|
|
@@ -10,60 +10,46 @@ import { Chip } from '@coinbase/cds-mobile/chips/Chip'
|
|
|
10
10
|
|
|
11
11
|
## Examples
|
|
12
12
|
|
|
13
|
-
###
|
|
13
|
+
### Basics
|
|
14
|
+
|
|
15
|
+
Render a Chip with text. Without `onPress`, it displays as a static pill. With `onPress`, it becomes a pressable element. Use `disabled` to prevent interaction on an otherwise interactive chip.
|
|
14
16
|
|
|
15
17
|
```tsx
|
|
16
18
|
function Example() {
|
|
17
19
|
return (
|
|
18
|
-
<HStack gap={2}>
|
|
20
|
+
<HStack gap={2} flexWrap="wrap">
|
|
19
21
|
<Chip>Basic Chip</Chip>
|
|
20
|
-
<Chip disabled>Disabled Chip</Chip>
|
|
21
22
|
<Chip onPress={() => alert('Pressed!')}>Interactive Chip</Chip>
|
|
23
|
+
<Chip disabled onPress={() => alert('Pressed!')}>
|
|
24
|
+
Disabled Chip
|
|
25
|
+
</Chip>
|
|
22
26
|
</HStack>
|
|
23
27
|
);
|
|
24
28
|
}
|
|
25
29
|
```
|
|
26
30
|
|
|
27
|
-
###
|
|
28
|
-
|
|
29
|
-
```tsx
|
|
30
|
-
function Example() {
|
|
31
|
-
return (
|
|
32
|
-
<VStack gap={2}>
|
|
33
|
-
<HStack gap={2}>
|
|
34
|
-
<Chip compact>Compact</Chip>
|
|
35
|
-
<Chip inverted>Inverted</Chip>
|
|
36
|
-
<Chip maxWidth={100} numberOfLines={1}>
|
|
37
|
-
Long text that should truncate nicely
|
|
38
|
-
</Chip>
|
|
39
|
-
</HStack>
|
|
40
|
-
</VStack>
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### With Icons and Images
|
|
31
|
+
### Icons and Images
|
|
46
32
|
|
|
47
33
|
```tsx
|
|
48
34
|
function Example() {
|
|
49
35
|
return (
|
|
50
36
|
<VStack gap={2}>
|
|
51
|
-
<HStack gap={2}>
|
|
37
|
+
<HStack gap={2} flexWrap="wrap">
|
|
52
38
|
<Chip start={<Icon name="star" />}>With Start Icon</Chip>
|
|
53
|
-
<Chip end={<Icon name="
|
|
54
|
-
<Chip start={<Icon name="star" />} end={<Icon name="
|
|
39
|
+
<Chip end={<Icon name="caretDown" />}>With End Icon</Chip>
|
|
40
|
+
<Chip start={<Icon name="star" />} end={<Icon name="caretDown" />}>
|
|
55
41
|
Both Icons
|
|
56
42
|
</Chip>
|
|
57
43
|
</HStack>
|
|
58
|
-
<HStack gap={2}>
|
|
44
|
+
<HStack gap={2} flexWrap="wrap">
|
|
59
45
|
<Chip
|
|
60
|
-
start={<RemoteImage source={assets.btc.imageUrl} width={
|
|
46
|
+
start={<RemoteImage source={assets.btc.imageUrl} width={24} height={24} shape="circle" />}
|
|
61
47
|
onPress={() => alert('BTC selected')}
|
|
62
48
|
>
|
|
63
49
|
BTC
|
|
64
50
|
</Chip>
|
|
65
51
|
<Chip
|
|
66
|
-
start={<RemoteImage source={assets.eth.imageUrl} width={
|
|
52
|
+
start={<RemoteImage source={assets.eth.imageUrl} width={24} height={24} shape="circle" />}
|
|
67
53
|
onPress={() => alert('ETH selected')}
|
|
68
54
|
>
|
|
69
55
|
ETH
|
|
@@ -74,6 +60,65 @@ function Example() {
|
|
|
74
60
|
}
|
|
75
61
|
```
|
|
76
62
|
|
|
63
|
+
### Styling
|
|
64
|
+
|
|
65
|
+
#### Color
|
|
66
|
+
|
|
67
|
+
Use `invertColorScheme` to invert foreground and background for emphasis.
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
function Example() {
|
|
71
|
+
return (
|
|
72
|
+
<HStack gap={2} flexWrap="wrap">
|
|
73
|
+
<Chip>Default</Chip>
|
|
74
|
+
<Chip invertColorScheme>Inverted</Chip>
|
|
75
|
+
</HStack>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
#### Compact
|
|
81
|
+
|
|
82
|
+
Use `compact` for smaller chips with reduced padding.
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
function Example() {
|
|
86
|
+
return (
|
|
87
|
+
<HStack gap={2} flexWrap="wrap">
|
|
88
|
+
<Chip>Default</Chip>
|
|
89
|
+
<Chip compact>Compact</Chip>
|
|
90
|
+
</HStack>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Accessibility
|
|
96
|
+
|
|
97
|
+
When using `onPress`, provide an `accessibilityLabel` for screen readers, especially when the label text alone is ambiguous or when the chip has non-text content.
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
function Example() {
|
|
101
|
+
return (
|
|
102
|
+
<HStack gap={2} flexWrap="wrap">
|
|
103
|
+
<Chip
|
|
104
|
+
accessibilityLabel="Select Bitcoin"
|
|
105
|
+
onPress={() => alert('BTC')}
|
|
106
|
+
start={<RemoteImage source={assets.btc.imageUrl} width={24} height={24} shape="circle" />}
|
|
107
|
+
>
|
|
108
|
+
BTC
|
|
109
|
+
</Chip>
|
|
110
|
+
<Chip
|
|
111
|
+
accessibilityLabel="Filter by category"
|
|
112
|
+
end={<Icon name="caretDown" />}
|
|
113
|
+
onPress={() => alert('Filter')}
|
|
114
|
+
>
|
|
115
|
+
Category
|
|
116
|
+
</Chip>
|
|
117
|
+
</HStack>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
77
122
|
## Props
|
|
78
123
|
|
|
79
124
|
| Prop | Type | Required | Default | Description |
|
|
@@ -33,6 +33,45 @@ The only prop required is `series`, which takes an array of series objects. Each
|
|
|
33
33
|
/>
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
+
### Layout
|
|
37
|
+
|
|
38
|
+
Lines can be rendered horizontally or vertically by setting the `layout` prop.
|
|
39
|
+
|
|
40
|
+
```jsx
|
|
41
|
+
function HorizontalLine() {
|
|
42
|
+
const dataset = [
|
|
43
|
+
{ month: 'Jan', seoul: 21 },
|
|
44
|
+
{ month: 'Feb', seoul: 28 },
|
|
45
|
+
{ month: 'Mar', seoul: 41 },
|
|
46
|
+
{ month: 'Apr', seoul: 73 },
|
|
47
|
+
{ month: 'May', seoul: 99 },
|
|
48
|
+
{ month: 'June', seoul: 144 },
|
|
49
|
+
{ month: 'July', seoul: 319 },
|
|
50
|
+
{ month: 'Aug', seoul: 249 },
|
|
51
|
+
{ month: 'Sept', seoul: 131 },
|
|
52
|
+
{ month: 'Oct', seoul: 55 },
|
|
53
|
+
{ month: 'Nov', seoul: 48 },
|
|
54
|
+
{ month: 'Dec', seoul: 25 },
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<LineChart
|
|
59
|
+
height={400}
|
|
60
|
+
layout="horizontal"
|
|
61
|
+
series={[
|
|
62
|
+
{ id: 'seoul', data: dataset.map((d) => d.seoul), color: 'var(--color-accentBoldBlue)' },
|
|
63
|
+
]}
|
|
64
|
+
showXAxis
|
|
65
|
+
showYAxis
|
|
66
|
+
xAxis={{ label: 'rainfall (mm)' }}
|
|
67
|
+
yAxis={{
|
|
68
|
+
data: dataset.map((d) => d.month),
|
|
69
|
+
}}
|
|
70
|
+
/>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
36
75
|
LineChart also supports multiple lines, interaction, and axes.
|
|
37
76
|
Other props, such as `areaType` can be applied to the chart as a whole or per series.
|
|
38
77
|
|
|
@@ -557,140 +596,20 @@ By default, charts will not track gestures that go outside of the chart bounds.
|
|
|
557
596
|
You can configure chart transitions using `transitions` on Line (or LineChart) and `transitions` on [Scrubber](/components/charts/Scrubber). The `transitions` prop accepts an object with `enter` (the reveal animation) and `update` (data change animation) keys. Set either to `null` to disable that animation phase. You can also disable animations by setting `animate` on LineChart to `false`.
|
|
558
597
|
|
|
559
598
|
```tsx
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
const myTransitionConfig: Transition = { type: 'spring', stiffness: 700, damping: 20 };
|
|
570
|
-
const negativeColor = `rgb(${theme.spectrum.gray15})`;
|
|
571
|
-
const positiveColor = theme.color.fgPositive;
|
|
572
|
-
|
|
573
|
-
function generateNextValue(previousValue: number) {
|
|
574
|
-
const range = maxStepOffset - minStepOffset;
|
|
575
|
-
const offset = Math.random() * range + minStepOffset;
|
|
576
|
-
|
|
577
|
-
let direction;
|
|
578
|
-
if (previousValue >= maxDataOffset) {
|
|
579
|
-
direction = -1;
|
|
580
|
-
} else if (previousValue <= -maxDataOffset) {
|
|
581
|
-
direction = 1;
|
|
582
|
-
} else {
|
|
583
|
-
direction = Math.random() < 0.5 ? -1 : 1;
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
let newValue = previousValue + offset * direction;
|
|
587
|
-
newValue = Math.max(-maxDataOffset, Math.min(maxDataOffset, newValue));
|
|
588
|
-
return newValue;
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
function generateInitialData() {
|
|
592
|
-
const data = [];
|
|
593
|
-
|
|
594
|
-
let previousValue = Math.random() * 2 * maxDataOffset - maxDataOffset;
|
|
595
|
-
data.push(previousValue);
|
|
596
|
-
|
|
597
|
-
for (let i = 1; i < dataCount; i++) {
|
|
598
|
-
const newValue = generateNextValue(previousValue);
|
|
599
|
-
data.push(newValue);
|
|
600
|
-
previousValue = newValue;
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
return data;
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
const MyGradient = memo((props: DottedAreaProps) => {
|
|
607
|
-
const areaGradient = {
|
|
608
|
-
stops: ({ min, max }: AxisBounds) => [
|
|
609
|
-
{ offset: min, color: negativeColor, opacity: 1 },
|
|
610
|
-
{ offset: 0, color: negativeColor, opacity: 0 },
|
|
611
|
-
{ offset: 0, color: positiveColor, opacity: 0 },
|
|
612
|
-
{ offset: max, color: positiveColor, opacity: 1 },
|
|
613
|
-
],
|
|
614
|
-
};
|
|
615
|
-
|
|
616
|
-
return <DottedArea {...props} gradient={areaGradient} />;
|
|
617
|
-
});
|
|
618
|
-
|
|
619
|
-
function CustomTransitionsChart() {
|
|
620
|
-
const [data, setData] = useState(generateInitialData);
|
|
621
|
-
|
|
622
|
-
useEffect(() => {
|
|
623
|
-
const intervalId = setInterval(() => {
|
|
624
|
-
setData((currentData) => {
|
|
625
|
-
const lastValue = currentData[currentData.length - 1] ?? 0;
|
|
626
|
-
const newValue = generateNextValue(lastValue);
|
|
627
|
-
|
|
628
|
-
return [...currentData.slice(1), newValue];
|
|
629
|
-
});
|
|
630
|
-
}, updateInterval);
|
|
631
|
-
|
|
632
|
-
return () => clearInterval(intervalId);
|
|
633
|
-
}, []);
|
|
634
|
-
|
|
635
|
-
const tickLabelFormatter = useCallback(
|
|
636
|
-
(value: number) =>
|
|
637
|
-
new Intl.NumberFormat('en-US', {
|
|
638
|
-
style: 'currency',
|
|
639
|
-
currency: 'USD',
|
|
640
|
-
maximumFractionDigits: 0,
|
|
641
|
-
}).format(value),
|
|
642
|
-
[],
|
|
643
|
-
);
|
|
644
|
-
|
|
645
|
-
const valueAtIndexFormatter = useCallback(
|
|
646
|
-
(dataIndex: number) =>
|
|
647
|
-
new Intl.NumberFormat('en-US', {
|
|
648
|
-
style: 'currency',
|
|
649
|
-
currency: 'USD',
|
|
650
|
-
}).format(data[dataIndex]),
|
|
651
|
-
[data],
|
|
652
|
-
);
|
|
653
|
-
|
|
654
|
-
const lineGradient = {
|
|
655
|
-
stops: [
|
|
656
|
-
{ offset: 0, color: negativeColor },
|
|
657
|
-
{ offset: 0, color: positiveColor },
|
|
658
|
-
],
|
|
659
|
-
};
|
|
599
|
+
<Line
|
|
600
|
+
{...lineProps}
|
|
601
|
+
transitions={{ update: { type: 'spring', stiffness: 700, damping: 20 } }}
|
|
602
|
+
/>
|
|
603
|
+
<Scrubber
|
|
604
|
+
{...scrubberProps}
|
|
605
|
+
transitions={{ update: { type: 'spring', stiffness: 700, damping: 20 } }}
|
|
606
|
+
/>
|
|
607
|
+
```
|
|
660
608
|
|
|
661
|
-
|
|
662
|
-
<CartesianChart
|
|
663
|
-
enableScrubbing
|
|
664
|
-
height={200}
|
|
665
|
-
inset={{ top: 32, bottom: 32, left: 16, right: 16 }}
|
|
666
|
-
series={[
|
|
667
|
-
{
|
|
668
|
-
id: 'prices',
|
|
669
|
-
data: data,
|
|
670
|
-
gradient: lineGradient,
|
|
671
|
-
},
|
|
672
|
-
]}
|
|
673
|
-
yAxis={{ domain: { min: -domainLimit, max: domainLimit } }}
|
|
674
|
-
>
|
|
675
|
-
<YAxis showGrid requestedTickCount={2} tickLabelFormatter={tickLabelFormatter} />
|
|
676
|
-
<Line
|
|
677
|
-
showArea
|
|
678
|
-
AreaComponent={MyGradient}
|
|
679
|
-
seriesId="prices"
|
|
680
|
-
strokeWidth={3}
|
|
681
|
-
transitions={{ update: myTransitionConfig }}
|
|
682
|
-
/>
|
|
683
|
-
<Scrubber
|
|
684
|
-
hideOverlay
|
|
685
|
-
label={valueAtIndexFormatter}
|
|
686
|
-
transitions={{ update: myTransitionConfig }}
|
|
687
|
-
/>
|
|
688
|
-
</CartesianChart>
|
|
689
|
-
);
|
|
690
|
-
}
|
|
609
|
+
Also, you can toggle animations by setting `animate` to `true` or `false`.
|
|
691
610
|
|
|
692
|
-
|
|
693
|
-
}
|
|
611
|
+
```tsx
|
|
612
|
+
<LineChart {...props} animate={false} />
|
|
694
613
|
```
|
|
695
614
|
|
|
696
615
|
### Accessibility
|
|
@@ -1963,6 +1882,7 @@ function ForecastAssetPrice() {
|
|
|
1963
1882
|
| `inset` | `number \| Partial<ChartInset>` | No | `-` | Inset around the entire chart (outside the axes). |
|
|
1964
1883
|
| `justifyContent` | `flex-start \| flex-end \| center \| space-between \| space-around \| space-evenly` | No | `-` | - |
|
|
1965
1884
|
| `key` | `Key \| null` | No | `-` | - |
|
|
1885
|
+
| `layout` | `horizontal \| vertical` | No | `'vertical'` | Chart layout - describes the direction bars/areas grow. - vertical (default): Bars grow vertically. X is category axis, Y is value axis. - horizontal: Bars grow horizontally. Y is category axis, X is value axis. |
|
|
1966
1886
|
| `left` | `string \| number` | No | `-` | - |
|
|
1967
1887
|
| `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 |
|
|
1968
1888
|
| `legendAccessibilityLabel` | `string` | No | `'Legend'` | Accessibility label for the legend group. |
|
|
@@ -2027,8 +1947,8 @@ function ForecastAssetPrice() {
|
|
|
2027
1947
|
| `type` | `solid \| dotted` | No | `'solid'` | The type of line to render. |
|
|
2028
1948
|
| `userSelect` | `none \| auto \| text \| contain \| all` | No | `-` | - |
|
|
2029
1949
|
| `width` | `string \| number` | No | `-` | - |
|
|
2030
|
-
| `xAxis` | `(Partial<
|
|
2031
|
-
| `yAxis` | `(Partial<
|
|
1950
|
+
| `xAxis` | `(Partial<CartesianAxisConfigProps> & AxisBaseProps & { GridLineComponent?: LineComponent; 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. |
|
|
1951
|
+
| `yAxis` | `(Partial<CartesianAxisConfigProps> & AxisBaseProps & { GridLineComponent?: LineComponent; 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. |
|
|
2032
1952
|
| `zIndex` | `number` | No | `-` | - |
|
|
2033
1953
|
|
|
2034
1954
|
|
|
@@ -305,6 +305,7 @@ function ScatterplotWithCustomLabels() {
|
|
|
305
305
|
| `strokeWidth` | `number` | No | `2` | Outer stroke width of the point. Set to 0 to remove the stroke. |
|
|
306
306
|
| `transition` | `{ type: timing; } & TimingConfig & { delay?: number \| undefined; } \| { type: spring; } & { stiffness?: number \| undefined; overshootClamping?: boolean \| undefined; restDisplacementThreshold?: number \| undefined; restSpeedThreshold?: number \| undefined; velocity?: number \| undefined; reduceMotion?: ReduceMotion \| undefined; } & { mass?: number \| undefined; damping?: number \| undefined; duration?: undefined; dampingRatio?: undefined; clamp?: undefined; } & { delay?: number \| undefined; } \| { type: spring; } & { stiffness?: number \| undefined; overshootClamping?: boolean \| undefined; restDisplacementThreshold?: number \| undefined; restSpeedThreshold?: number \| undefined; velocity?: number \| undefined; reduceMotion?: ReduceMotion \| undefined; } & { mass?: undefined; damping?: undefined; duration?: number \| undefined; dampingRatio?: number \| undefined; clamp?: { min?: number \| undefined; max?: number \| undefined; } \| undefined; } & { delay?: number \| undefined; }` | No | `-` | Transition for updates. |
|
|
307
307
|
| `transitions` | `{ enter?: Transition \| null; update?: Transition \| null \| undefined; } \| undefined` | No | `-` | Transition configuration for enter and update animations. |
|
|
308
|
+
| `xAxisId` | `string` | No | `first x-axis defined in chart props.` | Optional X-axis id to specify which axis to plot along. |
|
|
308
309
|
| `yAxisId` | `string` | No | `first y-axis defined in chart props.` | Optional Y-axis id to specify which axis to plot along. |
|
|
309
310
|
|
|
310
311
|
|
|
@@ -35,6 +35,7 @@ Scrubber can be used to provide horizontal interaction with a chart. As you drag
|
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
All series will be scrubbed by default. You can set `seriesIds` to show only specific series.
|
|
38
|
+
In `layout="horizontal"`, beacon labels are intentionally hidden to avoid overlap with scrubber beacons.
|
|
38
39
|
|
|
39
40
|
```jsx
|
|
40
41
|
<LineChart
|
|
@@ -1002,7 +1003,7 @@ function MatchupBeaconLabels() {
|
|
|
1002
1003
|
| `beaconLabelPreferredSide` | `left \| right` | No | `'right'` | Preferred side for beacon labels. |
|
|
1003
1004
|
| `beaconStroke` | `string` | No | `theme.color.bg` | Stroke color of the scrubber beacon circle. |
|
|
1004
1005
|
| `beaconTransitions` | `{ enter?: Transition \| null; update?: Transition \| null \| undefined; pulse?: Transition \| undefined; pulseRepeatDelay?: number \| undefined; } \| undefined` | No | `-` | Transition configuration for the scrubber beacon. |
|
|
1005
|
-
| `hideBeaconLabels` | `boolean` | No |
|
|
1006
|
+
| `hideBeaconLabels` | `boolean` | No | `true in horizontal layout, false in vertical layout.` | Hides the beacon labels while keeping the line label visible (if provided). |
|
|
1006
1007
|
| `hideLine` | `boolean` | No | `-` | Hides the scrubber line. |
|
|
1007
1008
|
| `hideOverlay` | `boolean` | No | `-` | Hides the overlay rect which obscures data beyond the scrubber position. |
|
|
1008
1009
|
| `idlePulse` | `boolean` | No | `-` | Pulse the beacons while at rest. |
|
|
@@ -34,6 +34,58 @@ The XAxis component provides a horizontal axis for charts with automatic tick ge
|
|
|
34
34
|
</CartesianChart>
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
+
### Multiple X Axes (Horizontal Layout)
|
|
38
|
+
|
|
39
|
+
When `layout="horizontal"`, you can configure multiple x-axes and bind each series to an axis with `xAxisId`.
|
|
40
|
+
Use `XAxis`'s `axisId` prop to render each axis configuration.
|
|
41
|
+
|
|
42
|
+
```jsx
|
|
43
|
+
<CartesianChart
|
|
44
|
+
enableScrubbing
|
|
45
|
+
height={300}
|
|
46
|
+
layout="horizontal"
|
|
47
|
+
series={[
|
|
48
|
+
{
|
|
49
|
+
id: 'temperature',
|
|
50
|
+
label: 'Temperature',
|
|
51
|
+
data: [72, 68, 74, 70],
|
|
52
|
+
color: 'var(--color-accentBoldBlue)',
|
|
53
|
+
xAxisId: 'temperature-axis',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: 'volume',
|
|
57
|
+
label: 'Volume',
|
|
58
|
+
data: [1200, 900, 1500, 1100],
|
|
59
|
+
color: 'var(--color-accentBoldOrange)',
|
|
60
|
+
xAxisId: 'volume-axis',
|
|
61
|
+
},
|
|
62
|
+
]}
|
|
63
|
+
xAxis={[
|
|
64
|
+
{
|
|
65
|
+
id: 'temperature-axis',
|
|
66
|
+
domain: { min: 60, max: 80 },
|
|
67
|
+
domainLimit: 'strict',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: 'volume-axis',
|
|
71
|
+
domain: { min: 0, max: 2000 },
|
|
72
|
+
domainLimit: 'strict',
|
|
73
|
+
},
|
|
74
|
+
]}
|
|
75
|
+
yAxis={{
|
|
76
|
+
scaleType: 'band',
|
|
77
|
+
data: ['Mon', 'Tue', 'Wed', 'Thu'],
|
|
78
|
+
}}
|
|
79
|
+
>
|
|
80
|
+
<YAxis showLine showTickMarks />
|
|
81
|
+
<XAxis axisId="temperature-axis" label="Temp (F)" position="bottom" showLine />
|
|
82
|
+
<XAxis axisId="volume-axis" label="Volume" position="top" showLine />
|
|
83
|
+
<Line seriesId="temperature" />
|
|
84
|
+
<Line seriesId="volume" />
|
|
85
|
+
<Scrubber />
|
|
86
|
+
</CartesianChart>
|
|
87
|
+
```
|
|
88
|
+
|
|
37
89
|
### Axis Config
|
|
38
90
|
|
|
39
91
|
Properties related to the scale of an axis are set on the Chart component. This includes `scaleType`, `domain`, `domainLimit`, `range`, `data`, and `categoryPadding`.
|
|
@@ -733,6 +785,7 @@ function CustomTickLabelExample() {
|
|
|
733
785
|
| `LineComponent` | `LineComponent` | No | `SolidLine` | Component to render the axis line. |
|
|
734
786
|
| `TickLabelComponent` | `AxisTickLabelComponent` | No | `DefaultAxisTickLabel` | Component to render tick labels. Allows for custom styling and formatting that works cross-platform. |
|
|
735
787
|
| `TickMarkLineComponent` | `LineComponent` | No | `SolidLine` | Component to render the tick marks. |
|
|
788
|
+
| `axisId` | `string` | No | `-` | The ID of the axis to render. Defaults to defaultAxisId if not specified. |
|
|
736
789
|
| `bandGridLinePlacement` | `end \| start \| middle \| edges` | No | `'edges'` | Placement of grid lines relative to each band. Options: start, middle, end, edges |
|
|
737
790
|
| `bandTickMarkPlacement` | `end \| start \| middle \| edges` | No | `'middle'` | Placement of tick marks relative to each band. Options: start, middle, end, edges |
|
|
738
791
|
| `height` | `number` | No | `32 when no label is provided, 52 when a label is provided` | Height of the axis. This value is inclusive of the padding. |
|
|
@@ -740,7 +793,7 @@ function CustomTickLabelExample() {
|
|
|
740
793
|
| `labelGap` | `number` | No | `4` | Gap between the tick labels and the axis label. |
|
|
741
794
|
| `minTickLabelGap` | `number` | No | `4` | Minimum gap between tick labels. Labels will be hidden if they are closer than this gap. |
|
|
742
795
|
| `position` | `top \| bottom` | No | `'bottom'` | The position of the axis relative to the charts drawing area. |
|
|
743
|
-
| `requestedTickCount` | `number` | No | `5
|
|
796
|
+
| `requestedTickCount` | `number` | No | `5 for value axes by layout: - X axis when chart layout is horizontal - Y axis when chart layout is vertical` | Requested number of ticks to display. This value is passed into d3 and may not be respected. |
|
|
744
797
|
| `showGrid` | `boolean` | No | `-` | Whether to show grid lines at each tick position. |
|
|
745
798
|
| `showLine` | `boolean` | No | `-` | Whether to show the axis line. |
|
|
746
799
|
| `showTickMarks` | `boolean` | No | `-` | Whether to show tick marks on the axis. |
|
|
@@ -158,6 +158,8 @@ You can set the position of an axis to `left` or `right` (default).
|
|
|
158
158
|
</CartesianChart>
|
|
159
159
|
```
|
|
160
160
|
|
|
161
|
+
When `layout="horizontal"`, CartesianChart supports only one y-axis configuration.
|
|
162
|
+
|
|
161
163
|
#### Grid
|
|
162
164
|
|
|
163
165
|
You can show grid lines at each tick position using the `showGrid` prop.
|
|
@@ -611,7 +613,7 @@ function MultipleYAxesExample() {
|
|
|
611
613
|
| `labelGap` | `number` | No | `4` | Gap between the tick labels and the axis label. |
|
|
612
614
|
| `minTickLabelGap` | `number` | No | `4` | Minimum gap between tick labels. Labels will be hidden if they are closer than this gap. |
|
|
613
615
|
| `position` | `left \| right` | No | `'right'` | The position of the axis relative to the charts drawing area. |
|
|
614
|
-
| `requestedTickCount` | `number` | No | `5
|
|
616
|
+
| `requestedTickCount` | `number` | No | `5 for value axes by layout: - X axis when chart layout is horizontal - Y axis when chart layout is vertical` | Requested number of ticks to display. This value is passed into d3 and may not be respected. |
|
|
615
617
|
| `showGrid` | `boolean` | No | `-` | Whether to show grid lines at each tick position. |
|
|
616
618
|
| `showLine` | `boolean` | No | `-` | Whether to show the axis line. |
|
|
617
619
|
| `showTickMarks` | `boolean` | No | `-` | Whether to show tick marks on the axis. |
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
- [IconButton](mobile/components/IconButton.txt): A Button with an Icon for content.
|
|
96
96
|
- [ControlGroup](mobile/components/ControlGroup.txt): A layout component that arranges and manages a group of related controls, such as radio buttons, switches, or checkboxes.
|
|
97
97
|
- [Combobox](mobile/components/Combobox.txt): A flexible combobox component for both single and multi-selection, built for mobile applications with comprehensive accessibility support.
|
|
98
|
-
- [Chip](mobile/components/Chip.txt): A compact,
|
|
98
|
+
- [Chip](mobile/components/Chip.txt): A compact content element for tags, filters, and selections.
|
|
99
99
|
- [CheckboxGroup](mobile/components/CheckboxGroup.txt): CheckboxGroup is a control component that allows users to select multiple options from a set of choices. It manages the state and layout of multiple checkbox inputs as a cohesive group.
|
|
100
100
|
- [CheckboxCell](mobile/components/CheckboxCell.txt): A selectable cell that pairs a checkbox with a title and description for multi-choice selections.
|
|
101
101
|
- [Checkbox](mobile/components/Checkbox.txt): Checkbox is a type of control component that allows user to select one or more options from a set. They can also be used alone to switch between on and off.
|