@coinbase/cds-mobile-visualization 3.4.0-beta.9 → 3.6.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 +150 -0
- package/dts/chart/CartesianChart.d.ts +92 -7
- package/dts/chart/CartesianChart.d.ts.map +1 -1
- package/dts/chart/ChartContextBridge.d.ts.map +1 -1
- package/dts/chart/ChartProvider.d.ts +3 -0
- package/dts/chart/ChartProvider.d.ts.map +1 -1
- package/dts/chart/Path.d.ts +43 -13
- package/dts/chart/Path.d.ts.map +1 -1
- package/dts/chart/PeriodSelector.d.ts +20 -5
- package/dts/chart/PeriodSelector.d.ts.map +1 -1
- package/dts/chart/area/Area.d.ts +14 -11
- package/dts/chart/area/Area.d.ts.map +1 -1
- package/dts/chart/area/AreaChart.d.ts +33 -9
- package/dts/chart/area/AreaChart.d.ts.map +1 -1
- package/dts/chart/area/DottedArea.d.ts.map +1 -1
- package/dts/chart/area/GradientArea.d.ts.map +1 -1
- package/dts/chart/area/SolidArea.d.ts.map +1 -1
- package/dts/chart/axis/Axis.d.ts +22 -42
- package/dts/chart/axis/Axis.d.ts.map +1 -1
- package/dts/chart/axis/XAxis.d.ts +6 -0
- package/dts/chart/axis/XAxis.d.ts.map +1 -1
- package/dts/chart/axis/YAxis.d.ts +1 -0
- package/dts/chart/axis/YAxis.d.ts.map +1 -1
- package/dts/chart/bar/Bar.d.ts +59 -51
- package/dts/chart/bar/Bar.d.ts.map +1 -1
- package/dts/chart/bar/BarChart.d.ts +56 -11
- package/dts/chart/bar/BarChart.d.ts.map +1 -1
- package/dts/chart/bar/BarPlot.d.ts +2 -1
- package/dts/chart/bar/BarPlot.d.ts.map +1 -1
- package/dts/chart/bar/BarStack.d.ts +45 -20
- package/dts/chart/bar/BarStack.d.ts.map +1 -1
- package/dts/chart/bar/BarStackGroup.d.ts +2 -1
- package/dts/chart/bar/BarStackGroup.d.ts.map +1 -1
- package/dts/chart/bar/DefaultBar.d.ts.map +1 -1
- package/dts/chart/bar/DefaultBarStack.d.ts.map +1 -1
- package/dts/chart/bar/PercentageBarChart.d.ts +106 -0
- package/dts/chart/bar/PercentageBarChart.d.ts.map +1 -0
- package/dts/chart/bar/index.d.ts +1 -0
- package/dts/chart/bar/index.d.ts.map +1 -1
- package/dts/chart/gradient/Gradient.d.ts +5 -0
- package/dts/chart/gradient/Gradient.d.ts.map +1 -1
- package/dts/chart/index.d.ts +1 -0
- package/dts/chart/index.d.ts.map +1 -1
- package/dts/chart/legend/DefaultLegendEntry.d.ts +5 -0
- package/dts/chart/legend/DefaultLegendEntry.d.ts.map +1 -0
- package/dts/chart/legend/DefaultLegendShape.d.ts +5 -0
- package/dts/chart/legend/DefaultLegendShape.d.ts.map +1 -0
- package/dts/chart/legend/Legend.d.ts +168 -0
- package/dts/chart/legend/Legend.d.ts.map +1 -0
- package/dts/chart/legend/index.d.ts +4 -0
- package/dts/chart/legend/index.d.ts.map +1 -0
- package/dts/chart/line/DottedLine.d.ts.map +1 -1
- package/dts/chart/line/Line.d.ts +23 -19
- package/dts/chart/line/Line.d.ts.map +1 -1
- package/dts/chart/line/LineChart.d.ts +26 -9
- package/dts/chart/line/LineChart.d.ts.map +1 -1
- package/dts/chart/line/ReferenceLine.d.ts +1 -0
- package/dts/chart/line/ReferenceLine.d.ts.map +1 -1
- package/dts/chart/line/SolidLine.d.ts.map +1 -1
- package/dts/chart/point/Point.d.ts +26 -2
- package/dts/chart/point/Point.d.ts.map +1 -1
- package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts +32 -2
- package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts.map +1 -1
- package/dts/chart/scrubber/DefaultScrubberLabel.d.ts +2 -1
- package/dts/chart/scrubber/DefaultScrubberLabel.d.ts.map +1 -1
- package/dts/chart/scrubber/Scrubber.d.ts +86 -17
- package/dts/chart/scrubber/Scrubber.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/dts/chart/scrubber/ScrubberBeaconGroup.d.ts +10 -0
- package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts.map +1 -1
- package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts +16 -1
- package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts.map +1 -1
- package/dts/chart/scrubber/ScrubberProvider.d.ts.map +1 -1
- package/dts/chart/utils/axis.d.ts +45 -10
- package/dts/chart/utils/axis.d.ts.map +1 -1
- package/dts/chart/utils/bar.d.ts +195 -0
- package/dts/chart/utils/bar.d.ts.map +1 -1
- package/dts/chart/utils/chart.d.ts +32 -0
- package/dts/chart/utils/chart.d.ts.map +1 -1
- package/dts/chart/utils/context.d.ts +21 -6
- package/dts/chart/utils/context.d.ts.map +1 -1
- package/dts/chart/utils/gradient.d.ts +3 -1
- package/dts/chart/utils/gradient.d.ts.map +1 -1
- package/dts/chart/utils/path.d.ts +26 -0
- package/dts/chart/utils/path.d.ts.map +1 -1
- package/dts/chart/utils/point.d.ts +24 -12
- package/dts/chart/utils/point.d.ts.map +1 -1
- package/dts/chart/utils/scale.d.ts +11 -0
- package/dts/chart/utils/scale.d.ts.map +1 -1
- package/dts/chart/utils/scrubber.d.ts +2 -1
- package/dts/chart/utils/scrubber.d.ts.map +1 -1
- package/dts/chart/utils/transition.d.ts +63 -22
- package/dts/chart/utils/transition.d.ts.map +1 -1
- package/dts/sparkline/Sparkline.d.ts +2 -1
- package/dts/sparkline/Sparkline.d.ts.map +1 -1
- package/dts/sparkline/SparklineArea.d.ts +2 -1
- package/dts/sparkline/SparklineArea.d.ts.map +1 -1
- package/dts/sparkline/SparklineGradient.d.ts +2 -1
- package/dts/sparkline/SparklineGradient.d.ts.map +1 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractive.d.ts +2 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractive.d.ts.map +1 -1
- package/esm/chart/CartesianChart.js +176 -82
- package/esm/chart/ChartContextBridge.js +14 -3
- package/esm/chart/ChartProvider.js +2 -2
- package/esm/chart/Path.js +68 -31
- package/esm/chart/PeriodSelector.js +5 -1
- package/esm/chart/__stories__/CartesianChart.stories.js +16 -80
- package/esm/chart/__stories__/ChartAccessibility.stories.js +721 -0
- package/esm/chart/__stories__/ChartTransitions.stories.js +625 -0
- package/esm/chart/__stories__/PeriodSelector.stories.js +99 -1
- package/esm/chart/area/Area.js +21 -9
- package/esm/chart/area/AreaChart.js +18 -13
- package/esm/chart/area/DottedArea.js +28 -18
- package/esm/chart/area/GradientArea.js +14 -7
- package/esm/chart/area/SolidArea.js +6 -2
- package/esm/chart/area/__stories__/AreaChart.stories.js +47 -5
- package/esm/chart/axis/Axis.js +5 -41
- package/esm/chart/axis/XAxis.js +116 -47
- package/esm/chart/axis/YAxis.js +105 -26
- package/esm/chart/axis/__stories__/Axis.stories.js +324 -48
- package/esm/chart/bar/Bar.js +17 -15
- package/esm/chart/bar/BarChart.js +38 -33
- package/esm/chart/bar/BarPlot.js +40 -45
- package/esm/chart/bar/BarStack.js +92 -475
- package/esm/chart/bar/BarStackGroup.js +37 -27
- package/esm/chart/bar/DefaultBar.js +41 -18
- package/esm/chart/bar/DefaultBarStack.js +25 -9
- package/esm/chart/bar/PercentageBarChart.js +99 -0
- package/esm/chart/bar/__stories__/BarChart.stories.js +721 -54
- package/esm/chart/bar/__stories__/PercentageBarChart.stories.js +833 -0
- package/esm/chart/bar/index.js +1 -0
- package/esm/chart/gradient/Gradient.js +2 -1
- package/esm/chart/index.js +1 -0
- package/esm/chart/legend/DefaultLegendEntry.js +42 -0
- package/esm/chart/legend/DefaultLegendShape.js +64 -0
- package/esm/chart/legend/Legend.js +59 -0
- package/esm/chart/legend/__stories__/Legend.stories.js +574 -0
- package/esm/chart/legend/index.js +3 -0
- package/esm/chart/line/DottedLine.js +6 -2
- package/esm/chart/line/Line.js +42 -38
- package/esm/chart/line/LineChart.js +36 -12
- package/esm/chart/line/SolidLine.js +6 -2
- package/esm/chart/line/__stories__/LineChart.stories.js +236 -590
- package/esm/chart/line/__stories__/ReferenceLine.stories.js +95 -1
- package/esm/chart/point/Point.js +35 -36
- package/esm/chart/scrubber/DefaultScrubberBeacon.js +41 -38
- package/esm/chart/scrubber/DefaultScrubberLabel.js +26 -10
- package/esm/chart/scrubber/Scrubber.js +67 -35
- package/esm/chart/scrubber/ScrubberAccessibilityView.js +177 -0
- package/esm/chart/scrubber/ScrubberBeaconGroup.js +30 -22
- package/esm/chart/scrubber/ScrubberBeaconLabelGroup.js +35 -8
- package/esm/chart/scrubber/ScrubberProvider.js +29 -24
- package/esm/chart/scrubber/__stories__/Scrubber.stories.js +946 -0
- package/esm/chart/utils/axis.js +88 -44
- package/esm/chart/utils/bar.js +829 -0
- package/esm/chart/utils/chart.js +34 -7
- package/esm/chart/utils/context.js +7 -0
- package/esm/chart/utils/gradient.js +8 -4
- package/esm/chart/utils/path.js +91 -61
- package/esm/chart/utils/point.js +92 -39
- package/esm/chart/utils/scale.js +13 -2
- package/esm/chart/utils/scrubber.js +12 -5
- package/esm/chart/utils/transition.js +116 -60
- package/esm/sparkline/Sparkline.js +2 -1
- package/esm/sparkline/SparklineArea.js +2 -1
- package/esm/sparkline/SparklineGradient.js +2 -1
- package/esm/sparkline/__figma__/Sparkline.figma.js +1 -1
- package/esm/sparkline/sparkline-interactive/SparklineInteractive.js +2 -1
- package/esm/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.js +1 -1
- package/esm/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.js +1 -1
- package/esm/sparkline/sparkline-interactive-header/__stories__/SparklineInteractiveHeader.stories.js +2 -0
- package/package.json +5 -6
- package/esm/chart/__stories__/Chart.stories.js +0 -77
|
@@ -18,17 +18,33 @@ import { type SkPath } from '@shopify/react-native-skia';
|
|
|
18
18
|
* // Timing animation
|
|
19
19
|
* { type: 'timing', duration: 500, easing: Easing.inOut(Easing.ease) }
|
|
20
20
|
*/
|
|
21
|
-
export type Transition =
|
|
21
|
+
export type Transition = (
|
|
22
22
|
| ({
|
|
23
23
|
type: 'timing';
|
|
24
24
|
} & WithTimingConfig)
|
|
25
25
|
| ({
|
|
26
26
|
type: 'spring';
|
|
27
|
-
} & WithSpringConfig)
|
|
27
|
+
} & WithSpringConfig)
|
|
28
|
+
) & {
|
|
29
|
+
/**
|
|
30
|
+
* Delay in milliseconds (ms) before the animation starts.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* // Wait 2 seconds before animating
|
|
34
|
+
* { type: 'timing', duration: 500, delay: 2000 }
|
|
35
|
+
*/
|
|
36
|
+
delay?: number;
|
|
37
|
+
};
|
|
28
38
|
/**
|
|
29
|
-
* Default transition
|
|
39
|
+
* Default update transition used across all chart components.
|
|
40
|
+
* `{ type: 'spring', stiffness: 900, damping: 120 }`
|
|
30
41
|
*/
|
|
31
42
|
export declare const defaultTransition: Transition;
|
|
43
|
+
/**
|
|
44
|
+
* Instant transition that completes immediately with no animation.
|
|
45
|
+
* Used when a transition is set to `null`.
|
|
46
|
+
*/
|
|
47
|
+
export declare const instantTransition: Transition;
|
|
32
48
|
/**
|
|
33
49
|
* Duration in milliseconds for accessory elements to fade in.
|
|
34
50
|
*/
|
|
@@ -38,19 +54,20 @@ export declare const accessoryFadeTransitionDuration = 150;
|
|
|
38
54
|
*/
|
|
39
55
|
export declare const accessoryFadeTransitionDelay = 350;
|
|
40
56
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* @param progress - Shared value between 0 and 1
|
|
45
|
-
* @param fromPath - Starting path as SVG string
|
|
46
|
-
* @param toPath - Ending path as SVG string
|
|
47
|
-
* @returns Interpolated SkPath as a shared value
|
|
57
|
+
* Default enter transition for accessory elements (Point, Scrubber beacons).
|
|
58
|
+
* `{ type: 'timing', duration: 150, delay: 350 }`
|
|
48
59
|
*/
|
|
49
|
-
export declare const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
60
|
+
export declare const defaultAccessoryEnterTransition: Transition;
|
|
61
|
+
/**
|
|
62
|
+
* Resolves a transition value based on the animation state and a default.
|
|
63
|
+
* @note Passing in null will disable an animation.
|
|
64
|
+
* @note Passing in undefined will use the provided default.
|
|
65
|
+
*/
|
|
66
|
+
export declare const getTransition: (
|
|
67
|
+
value: Transition | null | undefined,
|
|
68
|
+
animate: boolean,
|
|
69
|
+
defaultValue: Transition,
|
|
70
|
+
) => Transition | null;
|
|
54
71
|
/**
|
|
55
72
|
* @worklet
|
|
56
73
|
*/
|
|
@@ -90,21 +107,25 @@ export declare const useInterpolator: <T>(
|
|
|
90
107
|
* // Timing animation
|
|
91
108
|
* progress.value = buildTransition(1, { type: 'timing', duration: 500 });
|
|
92
109
|
*/
|
|
93
|
-
export declare const buildTransition: (
|
|
110
|
+
export declare const buildTransition: (
|
|
111
|
+
targetValue: number,
|
|
112
|
+
transition: Transition | null,
|
|
113
|
+
) => number;
|
|
94
114
|
/**
|
|
95
115
|
* Hook for path animation state and transitions.
|
|
96
116
|
*
|
|
97
117
|
* @param currentPath - Current target path to animate to
|
|
98
118
|
* @param initialPath - Initial path for enter animation. When provided, the first animation will go from initialPath to currentPath.
|
|
99
|
-
* @param
|
|
119
|
+
* @param transitions - Transition configuration for enter and update animations
|
|
100
120
|
* @returns Animated SkPath as a shared value
|
|
101
121
|
*
|
|
102
122
|
* @example
|
|
103
123
|
* // Simple path transition
|
|
104
124
|
* const path = usePathTransition({
|
|
105
125
|
* currentPath: d ?? '',
|
|
106
|
-
*
|
|
107
|
-
*
|
|
126
|
+
* transitions: {
|
|
127
|
+
* update: { type: 'timing', duration: 3000 },
|
|
128
|
+
* },
|
|
108
129
|
* });
|
|
109
130
|
*
|
|
110
131
|
* @example
|
|
@@ -112,13 +133,16 @@ export declare const buildTransition: (targetValue: number, transition: Transiti
|
|
|
112
133
|
* const path = usePathTransition({
|
|
113
134
|
* currentPath: targetPath,
|
|
114
135
|
* initialPath: baselinePath,
|
|
115
|
-
*
|
|
116
|
-
*
|
|
136
|
+
* transitions: {
|
|
137
|
+
* enter: { type: 'tween', duration: 500 },
|
|
138
|
+
* update: { type: 'spring', stiffness: 900, damping: 120 },
|
|
139
|
+
* },
|
|
117
140
|
* });
|
|
118
141
|
*/
|
|
119
142
|
export declare const usePathTransition: ({
|
|
120
143
|
currentPath,
|
|
121
144
|
initialPath,
|
|
145
|
+
transitions,
|
|
122
146
|
transition,
|
|
123
147
|
}: {
|
|
124
148
|
/**
|
|
@@ -132,7 +156,24 @@ export declare const usePathTransition: ({
|
|
|
132
156
|
*/
|
|
133
157
|
initialPath?: string;
|
|
134
158
|
/**
|
|
135
|
-
* Transition configuration
|
|
159
|
+
* Transition configuration for enter and update animations.
|
|
160
|
+
*/
|
|
161
|
+
transitions?: {
|
|
162
|
+
/**
|
|
163
|
+
* Transition for the initial enter animation (initialPath → currentPath).
|
|
164
|
+
* Only used when `initialPath` is provided.
|
|
165
|
+
* If not provided, falls back to `update`.
|
|
166
|
+
*/
|
|
167
|
+
enter?: Transition | null;
|
|
168
|
+
/**
|
|
169
|
+
* Transition for subsequent data update animations.
|
|
170
|
+
* @default defaultTransition
|
|
171
|
+
*/
|
|
172
|
+
update?: Transition | null;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Transition for updates.
|
|
176
|
+
* @deprecated Use `transitions.update` instead.
|
|
136
177
|
*/
|
|
137
178
|
transition?: Transition;
|
|
138
179
|
}) => SharedValue<SkPath>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transition.d.ts","sourceRoot":"","sources":["../../../src/chart/utils/transition.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"transition.d.ts","sourceRoot":"","sources":["../../../src/chart/utils/transition.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAK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AAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,eAAe,GAAI,aAAa,MAAM,EAAE,YAAY,UAAU,GAAG,IAAI,KAAG,MA4BpF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,iBAAiB,GAAI,wDAK/B;IACD;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,WAAW,CAAC,EAAE;QACZ;;;;WAIG;QACH,KAAK,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;QAC1B;;;WAGG;QACH,MAAM,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;KAC5B,CAAC;IACF;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,KAAG,WAAW,CAAC,MAAM,CAsFrB,CAAC"}
|
|
@@ -35,7 +35,8 @@ export type SparklineBaseProps = SharedProps & {
|
|
|
35
35
|
};
|
|
36
36
|
export type SparklineProps = SparklineBaseProps;
|
|
37
37
|
/**
|
|
38
|
-
* @deprecated Use LineChart instead.
|
|
38
|
+
* @deprecated Use LineChart instead. This will be removed in a future major release.
|
|
39
|
+
* @deprecationExpectedRemoval v4
|
|
39
40
|
*/
|
|
40
41
|
export declare const Sparkline: React.MemoExoticComponent<
|
|
41
42
|
React.ForwardRefExoticComponent<
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sparkline.d.ts","sourceRoot":"","sources":["../../src/sparkline/Sparkline.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AACjE,OAAO,EAAiC,IAAI,EAAmB,MAAM,kBAAkB,CAAC;AAGxF,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAQ/E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAG9D,MA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AM,CAAC;IACpB,oQAAoQ;IACpQ,KAAK,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,kWAAkW;IAClW,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,eAAe,CAAC,sBAAsB,CAAC,CAAC;IACnD,oOAAoO;IACpO,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,SAAS;IAnCpB,iPAAiP;iBACpO,MAAM;IACnB,oQAAoQ;WAC7P,MAAM;IACb,8BAA8B;YACtB,MAAM;IACd,kWAAkW;WAC3V,MAAM;IACb,6BAA6B;WACtB,MAAM;IACb,0EAA0E;eAC/D,eAAe,CAAC,sBAAsB,CAAC;IAClD,oOAAoO;yBAC/M,MAAM;IAC3B;;;;;;OAMG;iBACU,mBAAmB;IAChC;;;OAGG;eACQ,iBAAiB;sCAkK7B,CAAC"}
|
|
@@ -6,7 +6,8 @@ export type SparklineAreaBaseProps = {
|
|
|
6
6
|
maskId?: string;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
|
-
* @deprecated Use AreaChart instead.
|
|
9
|
+
* @deprecated Use AreaChart instead. This will be removed in a future major release.
|
|
10
|
+
* @deprecationExpectedRemoval v4
|
|
10
11
|
*/
|
|
11
12
|
export declare const SparklineArea: React.MemoExoticComponent<
|
|
12
13
|
React.ForwardRefExoticComponent<SparklineAreaBaseProps & React.RefAttributes<Path | null>>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SparklineArea.d.ts","sourceRoot":"","sources":["../../src/sparkline/SparklineArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"SparklineArea.d.ts","sourceRoot":"","sources":["../../src/sparkline/SparklineArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,uHAazB,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Path } from 'react-native-svg';
|
|
3
3
|
/**
|
|
4
|
-
* @deprecated Use LineChart instead.
|
|
4
|
+
* @deprecated Use LineChart instead. This will be removed in a future major release.
|
|
5
|
+
* @deprecationExpectedRemoval v4
|
|
5
6
|
*/
|
|
6
7
|
export declare const SparklineGradient: React.MemoExoticComponent<
|
|
7
8
|
React.ForwardRefExoticComponent<
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SparklineGradient.d.ts","sourceRoot":"","sources":["../../src/sparkline/SparklineGradient.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AACjE,OAAO,EAA2B,IAAI,EAAa,MAAM,kBAAkB,CAAC;AAY5E
|
|
1
|
+
{"version":3,"file":"SparklineGradient.d.ts","sourceRoot":"","sources":["../../src/sparkline/SparklineGradient.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AACjE,OAAO,EAA2B,IAAI,EAAa,MAAM,kBAAkB,CAAC;AAY5E;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;sCAqD7B,CAAC"}
|
|
@@ -178,7 +178,8 @@ declare function SparklineInteractiveWithGeneric<Period extends string>({
|
|
|
178
178
|
...props
|
|
179
179
|
}: SparklineInteractiveProps<Period>): import('react/jsx-runtime').JSX.Element;
|
|
180
180
|
/**
|
|
181
|
-
* @deprecated Use LineChart instead.
|
|
181
|
+
* @deprecated Use LineChart instead. This will be removed in a future major release.
|
|
182
|
+
* @deprecationExpectedRemoval v4
|
|
182
183
|
*/
|
|
183
184
|
export declare const SparklineInteractive: typeof SparklineInteractiveWithGeneric;
|
|
184
185
|
//# sourceMappingURL=SparklineInteractive.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SparklineInteractive.d.ts","sourceRoot":"","sources":["../../../src/sparkline/sparkline-interactive/SparklineInteractive.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkE,MAAM,OAAO,CAAC;AACvF,OAAO,EAAY,KAAK,SAAS,EAAoB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,EACV,SAAS,EAET,iBAAiB,EACjB,eAAe,EAEf,gBAAgB,EAChB,eAAe,EAChB,MAAM,kCAAkC,CAAC;AA2B1C,cAAc,kCAAkC,CAAC;AAEjD,MAAM,MAAM,6BAA6B,CAAC,MAAM,SAAS,MAAM,IAAI;IACjE;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IACjC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,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AG,KAAK,EACT,EAAE,yBAAyB,CAAC,MAAM,CAAC,2CAMnC;AAED
|
|
1
|
+
{"version":3,"file":"SparklineInteractive.d.ts","sourceRoot":"","sources":["../../../src/sparkline/sparkline-interactive/SparklineInteractive.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkE,MAAM,OAAO,CAAC;AACvF,OAAO,EAAY,KAAK,SAAS,EAAoB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,EACV,SAAS,EAET,iBAAiB,EACjB,eAAe,EAEf,gBAAgB,EAChB,eAAe,EAChB,MAAM,kCAAkC,CAAC;AA2B1C,cAAc,kCAAkC,CAAC;AAEjD,MAAM,MAAM,6BAA6B,CAAC,MAAM,SAAS,MAAM,IAAI;IACjE;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IACjC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACjC;;OAEG;IACH,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5C;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IACrD;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;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AAM,IACzD,6BAA6B,CAAC,MAAM,CAAC,GAAG;IACtC;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;OAEG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IAEtC;;;;OAIG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC;IAEzB;;;;;OAKG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;OAEG;IACH,MAAM,CAAC,EAAE;QACP;;WAEG;QACH,MAAM,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAC9B;;WAEG;QACH,IAAI,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;KAC7B,CAAC;IACF,6BAA6B;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEJ,iBAAS,+BAA+B,CAAC,MAAM,SAAS,MAAM,EAAE,EAC9D,OAAO,EACP,MAAM,EACN,GAAG,KAAK,EACT,EAAE,yBAAyB,CAAC,MAAM,CAAC,2CAMnC;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAE5B,OAAO,+BAA+B,CAAC"}
|
|
@@ -1,23 +1,32 @@
|
|
|
1
|
-
const _excluded = ["series", "children", "animate", "enableScrubbing", "xAxis", "yAxis", "inset", "onScrubberPositionChange", "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';
|
|
11
12
|
import { CartesianChartProvider } from './ChartProvider';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
13
|
+
import { Legend } from './legend';
|
|
14
|
+
import { defaultAxisId, defaultHorizontalLayoutChartInset, defaultVerticalLayoutChartInset, getAxisConfig, getAxisRange, getCartesianAxisDomain, getCartesianAxisScale, getChartInset, getStackedSeriesData as calculateStackedSeriesData, useTotalAxisPadding } from './utils';
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
16
|
const ChartCanvas = /*#__PURE__*/memo(_ref => {
|
|
15
17
|
let {
|
|
16
18
|
children,
|
|
17
|
-
style
|
|
19
|
+
style,
|
|
20
|
+
accessible = true,
|
|
21
|
+
accessibilityLabel,
|
|
22
|
+
accessibilityLiveRegion = 'polite'
|
|
18
23
|
} = _ref;
|
|
19
24
|
const ContextBridge = useChartContextBridge();
|
|
25
|
+
const isAccessible = accessible && accessibilityLabel !== null;
|
|
20
26
|
return /*#__PURE__*/_jsx(Canvas, {
|
|
27
|
+
accessibilityLabel: isAccessible ? accessibilityLabel : undefined,
|
|
28
|
+
accessibilityLiveRegion: isAccessible ? accessibilityLiveRegion : undefined,
|
|
29
|
+
accessible: isAccessible,
|
|
21
30
|
style: [{
|
|
22
31
|
width: '100%',
|
|
23
32
|
height: '100%'
|
|
@@ -31,12 +40,18 @@ export const CartesianChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref2,
|
|
|
31
40
|
let {
|
|
32
41
|
series,
|
|
33
42
|
children,
|
|
43
|
+
layout = 'vertical',
|
|
34
44
|
animate = true,
|
|
35
45
|
enableScrubbing,
|
|
46
|
+
getScrubberAccessibilityLabel,
|
|
47
|
+
scrubberAccessibilityLabelStep,
|
|
36
48
|
xAxis: xAxisConfigProp,
|
|
37
49
|
yAxis: yAxisConfigProp,
|
|
38
50
|
inset,
|
|
39
51
|
onScrubberPositionChange,
|
|
52
|
+
legend,
|
|
53
|
+
legendPosition = 'bottom',
|
|
54
|
+
legendAccessibilityLabel,
|
|
40
55
|
width = '100%',
|
|
41
56
|
height = '100%',
|
|
42
57
|
style,
|
|
@@ -47,17 +62,27 @@ export const CartesianChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref2,
|
|
|
47
62
|
// React Native will collapse views by default when only used
|
|
48
63
|
// to group children, which interferes with gesture-handler
|
|
49
64
|
// https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/gesture-detector/#:~:text=%7B%0A%20%20return%20%3C-,View,-collapsable%3D%7B
|
|
50
|
-
collapsable = false
|
|
65
|
+
collapsable = false,
|
|
66
|
+
accessible = true,
|
|
67
|
+
accessibilityLabel,
|
|
68
|
+
accessibilityLiveRegion = 'polite'
|
|
51
69
|
} = _ref2,
|
|
52
70
|
props = _objectWithoutPropertiesLoose(_ref2, _excluded);
|
|
53
71
|
const [containerLayout, onContainerLayout] = useLayout();
|
|
54
72
|
const chartWidth = containerLayout.width;
|
|
55
73
|
const chartHeight = containerLayout.height;
|
|
56
|
-
const calculatedInset = useMemo(() => getChartInset(inset,
|
|
57
|
-
|
|
58
|
-
// there can only be one x axis but the helper function always returns an array
|
|
59
|
-
const xAxisConfig = useMemo(() => getAxisConfig('x', xAxisConfigProp)[0], [xAxisConfigProp]);
|
|
74
|
+
const calculatedInset = useMemo(() => getChartInset(inset, layout === 'horizontal' ? defaultHorizontalLayoutChartInset : defaultVerticalLayoutChartInset), [inset, layout]);
|
|
75
|
+
const xAxisConfig = useMemo(() => getAxisConfig('x', xAxisConfigProp), [xAxisConfigProp]);
|
|
60
76
|
const yAxisConfig = useMemo(() => getAxisConfig('y', yAxisConfigProp), [yAxisConfigProp]);
|
|
77
|
+
|
|
78
|
+
// Horizontal layout supports multiple value axes on x, but only a single category axis on y.
|
|
79
|
+
// Vertical layout keeps a single x-axis to preserve existing behavior.
|
|
80
|
+
if (layout === 'horizontal' && yAxisConfig.length > 1) {
|
|
81
|
+
throw new Error('When layout="horizontal", only one y-axis is supported. See https://cds.coinbase.com/components/charts/CartesianChart.');
|
|
82
|
+
}
|
|
83
|
+
if (layout !== 'horizontal' && xAxisConfig.length > 1) {
|
|
84
|
+
throw new Error('Multiple x-axes are only supported when layout="horizontal". See https://cds.coinbase.com/components/charts/CartesianChart.');
|
|
85
|
+
}
|
|
61
86
|
const {
|
|
62
87
|
renderedAxes,
|
|
63
88
|
registerAxis,
|
|
@@ -87,54 +112,76 @@ export const CartesianChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref2,
|
|
|
87
112
|
};
|
|
88
113
|
}, [chartHeight, chartWidth, totalInset]);
|
|
89
114
|
const {
|
|
90
|
-
|
|
91
|
-
|
|
115
|
+
xAxes,
|
|
116
|
+
xScales
|
|
92
117
|
} = useMemo(() => {
|
|
118
|
+
const axes = new Map();
|
|
119
|
+
const scales = new Map();
|
|
93
120
|
if (!chartRect || chartRect.width <= 0 || chartRect.height <= 0) return {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
};
|
|
97
|
-
const domain = getAxisDomain(xAxisConfig, series != null ? series : [], 'x');
|
|
98
|
-
const range = getAxisRange(xAxisConfig, chartRect, 'x');
|
|
99
|
-
const axisConfig = {
|
|
100
|
-
scaleType: xAxisConfig.scaleType,
|
|
101
|
-
domain,
|
|
102
|
-
range,
|
|
103
|
-
data: xAxisConfig.data,
|
|
104
|
-
categoryPadding: xAxisConfig.categoryPadding,
|
|
105
|
-
domainLimit: xAxisConfig.domainLimit
|
|
121
|
+
xAxes: axes,
|
|
122
|
+
xScales: scales
|
|
106
123
|
};
|
|
124
|
+
xAxisConfig.forEach(axisParam => {
|
|
125
|
+
var _axisParam$id, _series$filter, _axisParam$domainLimi;
|
|
126
|
+
const axisId = (_axisParam$id = axisParam.id) != null ? _axisParam$id : defaultAxisId;
|
|
107
127
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
128
|
+
// Get relevant series data.
|
|
129
|
+
const relevantSeries = xAxisConfig.length > 1 ? (_series$filter = series == null ? void 0 : series.filter(s => {
|
|
130
|
+
var _s$xAxisId;
|
|
131
|
+
return ((_s$xAxisId = s.xAxisId) != null ? _s$xAxisId : defaultAxisId) === axisId;
|
|
132
|
+
})) != null ? _series$filter : [] : series != null ? series : [];
|
|
133
|
+
|
|
134
|
+
// Calculate domain and range.
|
|
135
|
+
const dataDomain = getCartesianAxisDomain(axisParam, relevantSeries, 'x', layout);
|
|
136
|
+
const range = getAxisRange(axisParam, chartRect, 'x');
|
|
137
|
+
const axisConfig = {
|
|
138
|
+
scaleType: axisParam.scaleType,
|
|
139
|
+
domain: dataDomain,
|
|
140
|
+
range,
|
|
141
|
+
data: axisParam.data,
|
|
142
|
+
categoryPadding: axisParam.categoryPadding,
|
|
143
|
+
domainLimit: (_axisParam$domainLimi = axisParam.domainLimit) != null ? _axisParam$domainLimi : layout === 'horizontal' ? 'nice' : 'strict'
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
// Create the scale.
|
|
147
|
+
const scale = getCartesianAxisScale({
|
|
148
|
+
config: axisConfig,
|
|
149
|
+
type: 'x',
|
|
150
|
+
range: axisConfig.range,
|
|
151
|
+
dataDomain: axisConfig.domain,
|
|
152
|
+
layout
|
|
153
|
+
});
|
|
154
|
+
if (scale) {
|
|
155
|
+
scales.set(axisId, scale);
|
|
119
156
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
157
|
+
// Update axis config with actual scale domain (after .nice() or other adjustments).
|
|
158
|
+
const scaleDomain = scale.domain();
|
|
159
|
+
const actualDomain = Array.isArray(scaleDomain) && scaleDomain.length === 2 ? {
|
|
160
|
+
min: scaleDomain[0],
|
|
161
|
+
max: scaleDomain[1]
|
|
162
|
+
} : axisConfig.domain;
|
|
163
|
+
axes.set(axisId, _extends({}, axisConfig, {
|
|
164
|
+
domain: actualDomain
|
|
165
|
+
}));
|
|
166
|
+
}
|
|
128
167
|
});
|
|
129
168
|
return {
|
|
130
|
-
|
|
131
|
-
|
|
169
|
+
xAxes: axes,
|
|
170
|
+
xScales: scales
|
|
132
171
|
};
|
|
133
|
-
}, [xAxisConfig, series, chartRect]);
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
172
|
+
}, [xAxisConfig, series, chartRect, layout]);
|
|
173
|
+
|
|
174
|
+
// We need a set of serialized scales usable in UI thread.
|
|
175
|
+
const xSerializableScales = useMemo(() => {
|
|
176
|
+
const serializableScales = new Map();
|
|
177
|
+
xScales.forEach((scale, id) => {
|
|
178
|
+
const serializableScale = convertToSerializableScale(scale);
|
|
179
|
+
if (serializableScale) {
|
|
180
|
+
serializableScales.set(id, serializableScale);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
return serializableScales;
|
|
184
|
+
}, [xScales]);
|
|
138
185
|
const {
|
|
139
186
|
yAxes,
|
|
140
187
|
yScales
|
|
@@ -146,17 +193,17 @@ export const CartesianChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref2,
|
|
|
146
193
|
yScales: scales
|
|
147
194
|
};
|
|
148
195
|
yAxisConfig.forEach(axisParam => {
|
|
149
|
-
var _axisParam$
|
|
150
|
-
const axisId = (_axisParam$
|
|
196
|
+
var _axisParam$id2, _series$filter2, _axisParam$domainLimi2;
|
|
197
|
+
const axisId = (_axisParam$id2 = axisParam.id) != null ? _axisParam$id2 : defaultAxisId;
|
|
151
198
|
|
|
152
|
-
// Get relevant series data
|
|
153
|
-
const relevantSeries = (_series$
|
|
199
|
+
// Get relevant series data.
|
|
200
|
+
const relevantSeries = yAxisConfig.length > 1 ? (_series$filter2 = series == null ? void 0 : series.filter(s => {
|
|
154
201
|
var _s$yAxisId;
|
|
155
202
|
return ((_s$yAxisId = s.yAxisId) != null ? _s$yAxisId : defaultAxisId) === axisId;
|
|
156
|
-
})) != null ? _series$
|
|
203
|
+
})) != null ? _series$filter2 : [] : series != null ? series : [];
|
|
157
204
|
|
|
158
|
-
// Calculate domain and range
|
|
159
|
-
const dataDomain =
|
|
205
|
+
// Calculate domain and range.
|
|
206
|
+
const dataDomain = getCartesianAxisDomain(axisParam, relevantSeries, 'y', layout);
|
|
160
207
|
const range = getAxisRange(axisParam, chartRect, 'y');
|
|
161
208
|
const axisConfig = {
|
|
162
209
|
scaleType: axisParam.scaleType,
|
|
@@ -164,20 +211,21 @@ export const CartesianChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref2,
|
|
|
164
211
|
range,
|
|
165
212
|
data: axisParam.data,
|
|
166
213
|
categoryPadding: axisParam.categoryPadding,
|
|
167
|
-
domainLimit: (_axisParam$
|
|
214
|
+
domainLimit: (_axisParam$domainLimi2 = axisParam.domainLimit) != null ? _axisParam$domainLimi2 : layout === 'horizontal' ? 'strict' : 'nice'
|
|
168
215
|
};
|
|
169
216
|
|
|
170
|
-
// Create the scale
|
|
171
|
-
const scale =
|
|
217
|
+
// Create the scale.
|
|
218
|
+
const scale = getCartesianAxisScale({
|
|
172
219
|
config: axisConfig,
|
|
173
220
|
type: 'y',
|
|
174
221
|
range: axisConfig.range,
|
|
175
|
-
dataDomain: axisConfig.domain
|
|
222
|
+
dataDomain: axisConfig.domain,
|
|
223
|
+
layout
|
|
176
224
|
});
|
|
177
225
|
if (scale) {
|
|
178
226
|
scales.set(axisId, scale);
|
|
179
227
|
|
|
180
|
-
// Update axis config with actual scale domain (after .nice() or other adjustments)
|
|
228
|
+
// Update axis config with actual scale domain (after .nice() or other adjustments).
|
|
181
229
|
const scaleDomain = scale.domain();
|
|
182
230
|
const actualDomain = Array.isArray(scaleDomain) && scaleDomain.length === 2 ? {
|
|
183
231
|
min: scaleDomain[0],
|
|
@@ -192,7 +240,7 @@ export const CartesianChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref2,
|
|
|
192
240
|
yAxes: axes,
|
|
193
241
|
yScales: scales
|
|
194
242
|
};
|
|
195
|
-
}, [yAxisConfig, series, chartRect]);
|
|
243
|
+
}, [yAxisConfig, series, chartRect, layout]);
|
|
196
244
|
|
|
197
245
|
// We need a set of serialized scales usable in UI thread
|
|
198
246
|
const ySerializableScales = useMemo(() => {
|
|
@@ -205,11 +253,11 @@ export const CartesianChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref2,
|
|
|
205
253
|
});
|
|
206
254
|
return serializableScales;
|
|
207
255
|
}, [yScales]);
|
|
208
|
-
const getXAxis = useCallback(
|
|
256
|
+
const getXAxis = useCallback(id => xAxes.get(id != null ? id : defaultAxisId), [xAxes]);
|
|
209
257
|
const getYAxis = useCallback(id => yAxes.get(id != null ? id : defaultAxisId), [yAxes]);
|
|
210
|
-
const getXScale = useCallback(
|
|
258
|
+
const getXScale = useCallback(id => xScales.get(id != null ? id : defaultAxisId), [xScales]);
|
|
211
259
|
const getYScale = useCallback(id => yScales.get(id != null ? id : defaultAxisId), [yScales]);
|
|
212
|
-
const getXSerializableScale = useCallback(
|
|
260
|
+
const getXSerializableScale = useCallback(id => xSerializableScales.get(id != null ? id : defaultAxisId), [xSerializableScales]);
|
|
213
261
|
const getYSerializableScale = useCallback(id => ySerializableScales.get(id != null ? id : defaultAxisId), [ySerializableScales]);
|
|
214
262
|
const getSeries = useCallback(seriesId => series == null ? void 0 : series.find(s => s.id === seriesId), [series]);
|
|
215
263
|
const stackedDataMap = useMemo(() => {
|
|
@@ -220,20 +268,27 @@ export const CartesianChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref2,
|
|
|
220
268
|
if (!seriesId) return undefined;
|
|
221
269
|
return stackedDataMap.get(seriesId);
|
|
222
270
|
}, [stackedDataMap]);
|
|
271
|
+
const categoryAxisIsX = useMemo(() => {
|
|
272
|
+
return layout !== 'horizontal';
|
|
273
|
+
}, [layout]);
|
|
274
|
+
const categoryAxisConfig = useMemo(() => {
|
|
275
|
+
var _xAxisConfig$, _yAxisConfig$;
|
|
276
|
+
return categoryAxisIsX ? (_xAxisConfig$ = xAxisConfig[0]) != null ? _xAxisConfig$ : yAxisConfig[0] : (_yAxisConfig$ = yAxisConfig[0]) != null ? _yAxisConfig$ : xAxisConfig[0];
|
|
277
|
+
}, [categoryAxisIsX, xAxisConfig, yAxisConfig]);
|
|
223
278
|
const dataLength = useMemo(() => {
|
|
224
|
-
// If
|
|
225
|
-
if (
|
|
226
|
-
return
|
|
279
|
+
// If category axis has categorical data, use that length.
|
|
280
|
+
if (categoryAxisConfig.data && categoryAxisConfig.data.length > 0) {
|
|
281
|
+
return categoryAxisConfig.data.length;
|
|
227
282
|
}
|
|
228
283
|
|
|
229
|
-
// Otherwise, find the longest series
|
|
284
|
+
// Otherwise, find the longest series.
|
|
230
285
|
if (!series || series.length === 0) return 0;
|
|
231
286
|
return series.reduce((max, s) => {
|
|
232
287
|
var _seriesData$length;
|
|
233
288
|
const seriesData = getStackedSeriesData(s.id);
|
|
234
289
|
return Math.max(max, (_seriesData$length = seriesData == null ? void 0 : seriesData.length) != null ? _seriesData$length : 0);
|
|
235
290
|
}, 0);
|
|
236
|
-
}, [
|
|
291
|
+
}, [categoryAxisConfig, series, getStackedSeriesData]);
|
|
237
292
|
const getAxisBounds = useCallback(axisId => {
|
|
238
293
|
const axis = renderedAxes.get(axisId);
|
|
239
294
|
if (!axis || !chartRect) return;
|
|
@@ -286,6 +341,7 @@ export const CartesianChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref2,
|
|
|
286
341
|
return Skia.TypefaceFontProvider.Make();
|
|
287
342
|
}, [fontProviderProp]);
|
|
288
343
|
const contextValue = useMemo(() => ({
|
|
344
|
+
layout,
|
|
289
345
|
series: series != null ? series : [],
|
|
290
346
|
getSeries,
|
|
291
347
|
getSeriesData: getStackedSeriesData,
|
|
@@ -305,30 +361,68 @@ export const CartesianChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref2,
|
|
|
305
361
|
registerAxis,
|
|
306
362
|
unregisterAxis,
|
|
307
363
|
getAxisBounds
|
|
308
|
-
}), [series, getSeries, getStackedSeriesData, animate, chartWidth, chartHeight, fontFamilies, fontProvider, getXAxis, getYAxis, getXScale, getYScale, getXSerializableScale, getYSerializableScale, chartRect, dataLength, registerAxis, unregisterAxis, getAxisBounds]);
|
|
364
|
+
}), [layout, series, getSeries, getStackedSeriesData, animate, chartWidth, chartHeight, fontFamilies, fontProvider, getXAxis, getYAxis, getXScale, getYScale, getXSerializableScale, getYSerializableScale, chartRect, dataLength, registerAxis, unregisterAxis, getAxisBounds]);
|
|
309
365
|
const rootStyles = useMemo(() => {
|
|
310
366
|
return [style, styles == null ? void 0 : styles.root];
|
|
311
367
|
}, [style, styles == null ? void 0 : styles.root]);
|
|
368
|
+
const legendElement = useMemo(() => {
|
|
369
|
+
if (!legend) return;
|
|
370
|
+
if (legend === true) {
|
|
371
|
+
const isHorizontal = legendPosition === 'top' || legendPosition === 'bottom';
|
|
372
|
+
const flexDirection = isHorizontal ? 'row' : 'column';
|
|
373
|
+
return /*#__PURE__*/_jsx(Legend, {
|
|
374
|
+
accessibilityLabel: legendAccessibilityLabel,
|
|
375
|
+
flexDirection: flexDirection
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
return legend;
|
|
379
|
+
}, [legend, legendAccessibilityLabel, legendPosition]);
|
|
380
|
+
const rootBoxProps = useMemo(() => _extends({
|
|
381
|
+
ref,
|
|
382
|
+
height,
|
|
383
|
+
style: rootStyles,
|
|
384
|
+
width
|
|
385
|
+
}, props), [ref, height, rootStyles, width, props]);
|
|
312
386
|
return /*#__PURE__*/_jsx(CartesianChartProvider, {
|
|
313
387
|
value: contextValue,
|
|
314
388
|
children: /*#__PURE__*/_jsx(ScrubberProvider, {
|
|
315
389
|
allowOverflowGestures: allowOverflowGestures,
|
|
316
390
|
enableScrubbing: enableScrubbing,
|
|
317
391
|
onScrubberPositionChange: onScrubberPositionChange,
|
|
318
|
-
children: /*#__PURE__*/
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
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, {
|
|
396
|
+
collapsable: collapsable,
|
|
397
|
+
onLayout: onContainerLayout,
|
|
398
|
+
style: {
|
|
399
|
+
flex: 1
|
|
400
|
+
},
|
|
401
|
+
children: [/*#__PURE__*/_jsx(ChartCanvas, {
|
|
402
|
+
accessibilityLabel: accessibilityLabel,
|
|
403
|
+
accessibilityLiveRegion: accessibilityLiveRegion,
|
|
404
|
+
accessible: accessible,
|
|
405
|
+
style: styles == null ? void 0 : styles.chart,
|
|
406
|
+
children: children
|
|
407
|
+
}), /*#__PURE__*/_jsx(ScrubberAccessibilityView, {
|
|
408
|
+
accessibilityLabel: getScrubberAccessibilityLabel,
|
|
409
|
+
accessibilityStep: scrubberAccessibilityLabelStep
|
|
410
|
+
})]
|
|
411
|
+
}), (legendPosition === 'bottom' || legendPosition === 'right') && legendElement]
|
|
412
|
+
})) : /*#__PURE__*/_jsxs(Box, _extends({
|
|
322
413
|
collapsable: collapsable,
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
414
|
+
onLayout: onContainerLayout
|
|
415
|
+
}, rootBoxProps, {
|
|
416
|
+
children: [/*#__PURE__*/_jsx(ChartCanvas, {
|
|
417
|
+
accessibilityLabel: accessibilityLabel,
|
|
418
|
+
accessibilityLiveRegion: accessibilityLiveRegion,
|
|
419
|
+
accessible: accessible,
|
|
329
420
|
style: styles == null ? void 0 : styles.chart,
|
|
330
421
|
children: children
|
|
331
|
-
})
|
|
422
|
+
}), /*#__PURE__*/_jsx(ScrubberAccessibilityView, {
|
|
423
|
+
accessibilityLabel: getScrubberAccessibilityLabel,
|
|
424
|
+
accessibilityStep: scrubberAccessibilityLabelStep
|
|
425
|
+
})]
|
|
332
426
|
}))
|
|
333
427
|
})
|
|
334
428
|
});
|