@coinbase/cds-mobile-visualization 3.4.0-beta.23 → 3.4.0-beta.24
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 +6 -0
- package/dts/chart/CartesianChart.d.ts +19 -0
- package/dts/chart/CartesianChart.d.ts.map +1 -1
- package/dts/chart/line/LineChart.d.ts +17 -3
- package/dts/chart/line/LineChart.d.ts.map +1 -1
- package/dts/chart/scrubber/ScrubberAccessibilityView.d.ts +12 -0
- package/dts/chart/scrubber/ScrubberAccessibilityView.d.ts.map +1 -0
- package/esm/chart/CartesianChart.js +39 -14
- package/esm/chart/__stories__/CartesianChart.stories.js +10 -0
- package/esm/chart/__stories__/ChartAccessibility.stories.js +721 -0
- package/esm/chart/area/__stories__/AreaChart.stories.js +17 -3
- package/esm/chart/axis/__stories__/Axis.stories.js +65 -48
- package/esm/chart/bar/__stories__/BarChart.stories.js +6 -0
- package/esm/chart/line/LineChart.js +22 -1
- package/esm/chart/line/__stories__/LineChart.stories.js +84 -46
- package/esm/chart/scrubber/ScrubberAccessibilityView.js +177 -0
- package/esm/chart/scrubber/__stories__/Scrubber.stories.js +57 -5
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,12 @@ All notable changes to this project will be documented in this file.
|
|
|
8
8
|
|
|
9
9
|
<!-- template-start -->
|
|
10
10
|
|
|
11
|
+
## 3.4.0-beta.24 (3/12/2026 PST)
|
|
12
|
+
|
|
13
|
+
#### 🚀 Updates
|
|
14
|
+
|
|
15
|
+
- Improve chart accessibility. [[#492](https://github.com/coinbase/cds/pull/492)]
|
|
16
|
+
|
|
11
17
|
## 3.4.0-beta.23 (3/10/2026 PST)
|
|
12
18
|
|
|
13
19
|
#### 🚀 Updates
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { type StyleProp, type View, type ViewStyle } from 'react-native';
|
|
3
3
|
import type { BoxBaseProps, BoxProps } from '@coinbase/cds-mobile/layout';
|
|
4
4
|
import { type SkTypefaceFontProvider } from '@shopify/react-native-skia';
|
|
5
|
+
import { type ScrubberAccessibilityViewProps } from './scrubber/ScrubberAccessibilityView';
|
|
5
6
|
import { type ScrubberProviderProps } from './scrubber/ScrubberProvider';
|
|
6
7
|
import {
|
|
7
8
|
type CartesianAxisConfigProps,
|
|
@@ -80,6 +81,15 @@ export type CartesianChartProps = CartesianChartBaseProps &
|
|
|
80
81
|
* If not provided, the only available fonts will be those defined by the system.
|
|
81
82
|
*/
|
|
82
83
|
fontProvider?: SkTypefaceFontProvider;
|
|
84
|
+
/**
|
|
85
|
+
* Function that returns the accessibility label for each scrubber point.
|
|
86
|
+
* Receives `dataIndex` for each scrubber point label.
|
|
87
|
+
*/
|
|
88
|
+
getScrubberAccessibilityLabel?: ScrubberAccessibilityViewProps['accessibilityLabel'];
|
|
89
|
+
/**
|
|
90
|
+
* Number of data points to move between screen-reader samples.
|
|
91
|
+
*/
|
|
92
|
+
scrubberAccessibilityLabelStep?: number;
|
|
83
93
|
/**
|
|
84
94
|
* Custom styles for the root element.
|
|
85
95
|
*/
|
|
@@ -168,6 +178,15 @@ export declare const CartesianChart: React.MemoExoticComponent<
|
|
|
168
178
|
* If not provided, the only available fonts will be those defined by the system.
|
|
169
179
|
*/
|
|
170
180
|
fontProvider?: SkTypefaceFontProvider;
|
|
181
|
+
/**
|
|
182
|
+
* Function that returns the accessibility label for each scrubber point.
|
|
183
|
+
* Receives `dataIndex` for each scrubber point label.
|
|
184
|
+
*/
|
|
185
|
+
getScrubberAccessibilityLabel?: ScrubberAccessibilityViewProps['accessibilityLabel'];
|
|
186
|
+
/**
|
|
187
|
+
* Number of data points to move between screen-reader samples.
|
|
188
|
+
*/
|
|
189
|
+
scrubberAccessibilityLabelStep?: number;
|
|
171
190
|
/**
|
|
172
191
|
* Custom styles for the root element.
|
|
173
192
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CartesianChart.d.ts","sourceRoot":"","sources":["../../src/chart/CartesianChart.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiD,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzE,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAE1E,OAAO,EAAgB,KAAK,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEvF,OAAO,EAAoB,KAAK,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAK3F,OAAO,EAEL,KAAK,wBAAwB,EAE7B,KAAK,oBAAoB,EACzB,KAAK,UAAU,EAWf,KAAK,cAAc,EACnB,KAAK,MAAM,EAEZ,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"CartesianChart.d.ts","sourceRoot":"","sources":["../../src/chart/CartesianChart.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiD,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzE,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAE1E,OAAO,EAAgB,KAAK,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEvF,OAAO,EAEL,KAAK,8BAA8B,EACpC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAoB,KAAK,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAK3F,OAAO,EAEL,KAAK,wBAAwB,EAE7B,KAAK,oBAAoB,EACzB,KAAK,UAAU,EAWf,KAAK,cAAc,EACnB,KAAK,MAAM,EAEZ,MAAM,SAAS,CAAC;AAkCjB,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,GACpE,IAAI,CAAC,qBAAqB,EAAE,iBAAiB,GAAG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ACH,IAAI,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAC5B;;WAEG;QACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;KAC9B,CAAC;CACH,CAAC;AAEJ,eAAO,MAAM,cAAc;IAjGvB;;;OAGG;aACM,KAAK,CAAC,MAAM,CAAC;IACtB;;;;;OAKG;aACM,oBAAoB;IAC7B;;;OAGG;cACO,OAAO;IACjB;;;;OAIG;YACK,OAAO,CAAC,wBAAwB,CAAC,GAAG,OAAO,CAAC,wBAAwB,CAAC,EAAE;IAC/E;;;;OAIG;YAEC,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC,GAC/C,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC,EAAE;IACrD;;OAEG;YACK,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IACpC;;;;;OAKG;aACM,OAAO,GAAG,KAAK,CAAC,SAAS;IAClC;;;OAGG;qBACc,cAAc;IAC/B;;;OAGG;+BACwB,MAAM;;IAMjC;;;;;OAKG;mBACY,MAAM,EAAE;IACvB;;;OAGG;mBACY,sBAAsB;IACrC;;;OAGG;oCAC6B,8BAA8B,CAAC,oBAAoB,CAAC;IACpF;;OAEG;qCAC8B,MAAM;IACvC;;OAEG;YACK,SAAS,CAAC,SAAS,CAAC;IAC5B;;OAEG;aACM;QACP;;WAEG;QACH,IAAI,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAC5B;;WAEG;QACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;KAC9B;+BAkeJ,CAAC"}
|
|
@@ -69,7 +69,13 @@ export type LineChartBaseProps = Omit<CartesianChartBaseProps, 'xAxis' | 'yAxis'
|
|
|
69
69
|
yAxis?: Partial<CartesianAxisConfigProps> & YAxisProps;
|
|
70
70
|
};
|
|
71
71
|
export type LineChartProps = LineChartBaseProps &
|
|
72
|
-
Omit<CartesianChartProps, 'xAxis' | 'yAxis' | 'series'
|
|
72
|
+
Omit<CartesianChartProps, 'xAxis' | 'yAxis' | 'series' | 'scrubberAccessibilityLabelStep'> & {
|
|
73
|
+
/**
|
|
74
|
+
* Number of data points to move between screen-reader samples.
|
|
75
|
+
* @default Computed from data length (targeting 10 samples)
|
|
76
|
+
*/
|
|
77
|
+
scrubberAccessibilityLabelStep?: number;
|
|
78
|
+
};
|
|
73
79
|
export declare const LineChart: import('react').MemoExoticComponent<
|
|
74
80
|
import('react').ForwardRefExoticComponent<
|
|
75
81
|
Omit<CartesianChartBaseProps, 'series' | 'xAxis' | 'yAxis'> &
|
|
@@ -114,8 +120,16 @@ export declare const LineChart: import('react').MemoExoticComponent<
|
|
|
114
120
|
* To show the axis, set `showYAxis` to true.
|
|
115
121
|
*/
|
|
116
122
|
yAxis?: Partial<CartesianAxisConfigProps> & YAxisProps;
|
|
117
|
-
} & Omit<
|
|
118
|
-
|
|
123
|
+
} & Omit<
|
|
124
|
+
CartesianChartProps,
|
|
125
|
+
'series' | 'xAxis' | 'yAxis' | 'scrubberAccessibilityLabelStep'
|
|
126
|
+
> & {
|
|
127
|
+
/**
|
|
128
|
+
* Number of data points to move between screen-reader samples.
|
|
129
|
+
* @default Computed from data length (targeting 10 samples)
|
|
130
|
+
*/
|
|
131
|
+
scrubberAccessibilityLabelStep?: number;
|
|
132
|
+
} & import('react').RefAttributes<View>
|
|
119
133
|
>
|
|
120
134
|
>;
|
|
121
135
|
//# sourceMappingURL=LineChart.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineChart.d.ts","sourceRoot":"","sources":["../../../src/chart/line/LineChart.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EA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E,KAAK,CAAC,UAAU,CAAC,CAAC;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,GAAG,UAAU,CAAC;IACvD;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,GAAG,UAAU,CAAC;CACxD,CAAC;AAEJ,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAC7C,IAAI,CAAC,mBAAmB,EAAE,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,gCAAgC,CAAC,GAAG;IAC3F;;;OAGG;IACH,8BAA8B,CAAC,EAAE,MAAM,CAAC;CACzC,CAAC;AAEJ,eAAO,MAAM,SAAS;IApClB;;;OAGG;aACM,KAAK,CAAC,UAAU,CAAC;IAC1B;;OAEG;gBACS,OAAO;IACnB;;OAEG;gBACS,OAAO;IACnB;;;;OAIG;YACK,OAAO,CAAC,wBAAwB,CAAC,GAAG,UAAU;IACtD;;;;OAIG;YACK,OAAO,CAAC,wBAAwB,CAAC,GAAG,UAAU;;IAKtD;;;OAGG;qCAC8B,MAAM;yCA+I1C,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type ScrubberAccessibilityViewProps = {
|
|
3
|
+
accessibilityLabel?: (dataIndex: number) => string;
|
|
4
|
+
accessibilityStep?: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const ScrubberAccessibilityView: React.MemoExoticComponent<
|
|
7
|
+
({
|
|
8
|
+
accessibilityLabel,
|
|
9
|
+
accessibilityStep,
|
|
10
|
+
}: ScrubberAccessibilityViewProps) => import('react/jsx-runtime').JSX.Element | undefined
|
|
11
|
+
>;
|
|
12
|
+
//# sourceMappingURL=ScrubberAccessibilityView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrubberAccessibilityView.d.ts","sourceRoot":"","sources":["../../../src/chart/scrubber/ScrubberAccessibilityView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAqI1D,MAAM,MAAM,8BAA8B,GAAG;IAC3C,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IACnD,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,yBAAyB,wEACQ,8BAA8B,yDAmH3E,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
const _excluded = ["series", "children", "layout", "animate", "enableScrubbing", "xAxis", "yAxis", "inset", "onScrubberPositionChange", "legend", "legendPosition", "legendAccessibilityLabel", "width", "height", "style", "styles", "allowOverflowGestures", "fontFamilies", "fontProvider", "collapsable"];
|
|
1
|
+
const _excluded = ["series", "children", "layout", "animate", "enableScrubbing", "getScrubberAccessibilityLabel", "scrubberAccessibilityLabelStep", "xAxis", "yAxis", "inset", "onScrubberPositionChange", "legend", "legendPosition", "legendAccessibilityLabel", "width", "height", "style", "styles", "allowOverflowGestures", "fontFamilies", "fontProvider", "collapsable", "accessible", "accessibilityLabel", "accessibilityLiveRegion"];
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
4
|
import React, { forwardRef, memo, useCallback, useMemo } from 'react';
|
|
5
5
|
import { useLayout } from '@coinbase/cds-mobile/hooks/useLayout';
|
|
6
6
|
import { Box } from '@coinbase/cds-mobile/layout';
|
|
7
7
|
import { Canvas, Skia } from '@shopify/react-native-skia';
|
|
8
|
+
import { ScrubberAccessibilityView } from './scrubber/ScrubberAccessibilityView';
|
|
8
9
|
import { ScrubberProvider } from './scrubber/ScrubberProvider';
|
|
9
10
|
import { convertToSerializableScale } from './utils/scale';
|
|
10
11
|
import { useChartContextBridge } from './ChartContextBridge';
|
|
@@ -15,10 +16,17 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
15
16
|
const ChartCanvas = /*#__PURE__*/memo(_ref => {
|
|
16
17
|
let {
|
|
17
18
|
children,
|
|
18
|
-
style
|
|
19
|
+
style,
|
|
20
|
+
accessible = true,
|
|
21
|
+
accessibilityLabel,
|
|
22
|
+
accessibilityLiveRegion = 'polite'
|
|
19
23
|
} = _ref;
|
|
20
24
|
const ContextBridge = useChartContextBridge();
|
|
25
|
+
const isAccessible = accessible && accessibilityLabel !== null;
|
|
21
26
|
return /*#__PURE__*/_jsx(Canvas, {
|
|
27
|
+
accessibilityLabel: isAccessible ? accessibilityLabel : undefined,
|
|
28
|
+
accessibilityLiveRegion: isAccessible ? accessibilityLiveRegion : undefined,
|
|
29
|
+
accessible: isAccessible,
|
|
22
30
|
style: [{
|
|
23
31
|
width: '100%',
|
|
24
32
|
height: '100%'
|
|
@@ -35,6 +43,8 @@ export const CartesianChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref2,
|
|
|
35
43
|
layout = 'vertical',
|
|
36
44
|
animate = true,
|
|
37
45
|
enableScrubbing,
|
|
46
|
+
getScrubberAccessibilityLabel,
|
|
47
|
+
scrubberAccessibilityLabelStep,
|
|
38
48
|
xAxis: xAxisConfigProp,
|
|
39
49
|
yAxis: yAxisConfigProp,
|
|
40
50
|
inset,
|
|
@@ -52,7 +62,10 @@ export const CartesianChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref2,
|
|
|
52
62
|
// React Native will collapse views by default when only used
|
|
53
63
|
// to group children, which interferes with gesture-handler
|
|
54
64
|
// https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/gesture-detector/#:~:text=%7B%0A%20%20return%20%3C-,View,-collapsable%3D%7B
|
|
55
|
-
collapsable = false
|
|
65
|
+
collapsable = false,
|
|
66
|
+
accessible = true,
|
|
67
|
+
accessibilityLabel,
|
|
68
|
+
accessibilityLiveRegion = 'polite'
|
|
56
69
|
} = _ref2,
|
|
57
70
|
props = _objectWithoutPropertiesLoose(_ref2, _excluded);
|
|
58
71
|
const [containerLayout, onContainerLayout] = useLayout();
|
|
@@ -366,8 +379,6 @@ export const CartesianChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref2,
|
|
|
366
379
|
}, [legend, legendAccessibilityLabel, legendPosition]);
|
|
367
380
|
const rootBoxProps = useMemo(() => _extends({
|
|
368
381
|
ref,
|
|
369
|
-
accessibilityLiveRegion: 'polite',
|
|
370
|
-
accessibilityRole: 'image',
|
|
371
382
|
height,
|
|
372
383
|
style: rootStyles,
|
|
373
384
|
width
|
|
@@ -378,26 +389,40 @@ export const CartesianChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref2,
|
|
|
378
389
|
allowOverflowGestures: allowOverflowGestures,
|
|
379
390
|
enableScrubbing: enableScrubbing,
|
|
380
391
|
onScrubberPositionChange: onScrubberPositionChange,
|
|
381
|
-
children: legend ? /*#__PURE__*/_jsxs(Box, _extends({
|
|
382
|
-
flexDirection: legendPosition === 'top' || legendPosition === 'bottom' ? 'column' : 'row'
|
|
383
|
-
|
|
392
|
+
children: legend ? /*#__PURE__*/_jsxs(Box, _extends({
|
|
393
|
+
flexDirection: legendPosition === 'top' || legendPosition === 'bottom' ? 'column' : 'row'
|
|
394
|
+
}, rootBoxProps, {
|
|
395
|
+
children: [(legendPosition === 'top' || legendPosition === 'left') && legendElement, /*#__PURE__*/_jsxs(Box, {
|
|
384
396
|
collapsable: collapsable,
|
|
385
397
|
onLayout: onContainerLayout,
|
|
386
398
|
style: {
|
|
387
399
|
flex: 1
|
|
388
400
|
},
|
|
389
|
-
children: /*#__PURE__*/_jsx(ChartCanvas, {
|
|
401
|
+
children: [/*#__PURE__*/_jsx(ChartCanvas, {
|
|
402
|
+
accessibilityLabel: accessibilityLabel,
|
|
403
|
+
accessibilityLiveRegion: accessibilityLiveRegion,
|
|
404
|
+
accessible: accessible,
|
|
390
405
|
style: styles == null ? void 0 : styles.chart,
|
|
391
406
|
children: children
|
|
392
|
-
})
|
|
407
|
+
}), /*#__PURE__*/_jsx(ScrubberAccessibilityView, {
|
|
408
|
+
accessibilityLabel: getScrubberAccessibilityLabel,
|
|
409
|
+
accessibilityStep: scrubberAccessibilityLabelStep
|
|
410
|
+
})]
|
|
393
411
|
}), (legendPosition === 'bottom' || legendPosition === 'right') && legendElement]
|
|
394
|
-
})) : /*#__PURE__*/
|
|
412
|
+
})) : /*#__PURE__*/_jsxs(Box, _extends({
|
|
395
413
|
collapsable: collapsable,
|
|
396
|
-
onLayout: onContainerLayout
|
|
397
|
-
|
|
414
|
+
onLayout: onContainerLayout
|
|
415
|
+
}, rootBoxProps, {
|
|
416
|
+
children: [/*#__PURE__*/_jsx(ChartCanvas, {
|
|
417
|
+
accessibilityLabel: accessibilityLabel,
|
|
418
|
+
accessibilityLiveRegion: accessibilityLiveRegion,
|
|
419
|
+
accessible: accessible,
|
|
398
420
|
style: styles == null ? void 0 : styles.chart,
|
|
399
421
|
children: children
|
|
400
|
-
})
|
|
422
|
+
}), /*#__PURE__*/_jsx(ScrubberAccessibilityView, {
|
|
423
|
+
accessibilityLabel: getScrubberAccessibilityLabel,
|
|
424
|
+
accessibilityStep: scrubberAccessibilityLabelStep
|
|
425
|
+
})]
|
|
401
426
|
}))
|
|
402
427
|
})
|
|
403
428
|
});
|
|
@@ -250,11 +250,21 @@ const PriceWithVolumeChart = /*#__PURE__*/memo(_ref3 => {
|
|
|
250
250
|
day: 'numeric'
|
|
251
251
|
});
|
|
252
252
|
}, []);
|
|
253
|
+
const formatVolume = useCallback(volume => {
|
|
254
|
+
return (volume / 1000).toFixed(2) + "K";
|
|
255
|
+
}, []);
|
|
253
256
|
const scrubberLabel = useCallback(dataIndex => {
|
|
254
257
|
return formatDate(btcDates[dataIndex]);
|
|
255
258
|
}, [formatDate]);
|
|
259
|
+
const chartAccessibilityLabel = useMemo(() => {
|
|
260
|
+
const lastIndex = btcPrices.length - 1;
|
|
261
|
+
return "Bitcoin chart. Current date " + formatDate(btcDates[lastIndex]) + ". Current price " + formatPriceInThousands(btcPrices[lastIndex]) + ". Current volume " + formatVolume(btcVolumes[lastIndex]) + ".";
|
|
262
|
+
}, [formatDate, formatPriceInThousands, formatVolume]);
|
|
263
|
+
const getScrubberAccessibilityLabel = useCallback(dataIndex => "Bitcoin on " + formatDate(btcDates[dataIndex]) + ". Price " + formatPriceInThousands(btcPrices[dataIndex]) + ". Volume " + formatVolume(btcVolumes[dataIndex]) + ".", [formatDate, formatPriceInThousands, formatVolume]);
|
|
256
264
|
return /*#__PURE__*/_jsxs(CartesianChart, {
|
|
257
265
|
enableScrubbing: true,
|
|
266
|
+
accessibilityLabel: chartAccessibilityLabel,
|
|
267
|
+
getScrubberAccessibilityLabel: getScrubberAccessibilityLabel,
|
|
258
268
|
height: defaultChartHeight,
|
|
259
269
|
onScrubberPositionChange: onScrubberPositionChange,
|
|
260
270
|
series: [{
|