@coinbase/cds-web-visualization 3.4.0-beta.2 → 3.4.0-beta.20
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 +115 -0
- package/dts/chart/CartesianChart.d.ts +56 -3
- package/dts/chart/CartesianChart.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 +64 -7
- package/dts/chart/Path.d.ts.map +1 -1
- package/dts/chart/PeriodSelector.d.ts +5 -15
- package/dts/chart/PeriodSelector.d.ts.map +1 -1
- package/dts/chart/area/Area.d.ts +50 -25
- package/dts/chart/area/Area.d.ts.map +1 -1
- package/dts/chart/area/AreaChart.d.ts +46 -6
- package/dts/chart/area/AreaChart.d.ts.map +1 -1
- package/dts/chart/area/DottedArea.d.ts +21 -44
- package/dts/chart/area/DottedArea.d.ts.map +1 -1
- package/dts/chart/area/GradientArea.d.ts +21 -12
- package/dts/chart/area/GradientArea.d.ts.map +1 -1
- package/dts/chart/area/SolidArea.d.ts +16 -1
- package/dts/chart/area/SolidArea.d.ts.map +1 -1
- package/dts/chart/axis/Axis.d.ts +109 -63
- package/dts/chart/axis/Axis.d.ts.map +1 -1
- package/dts/chart/axis/DefaultAxisTickLabel.d.ts +8 -0
- package/dts/chart/axis/DefaultAxisTickLabel.d.ts.map +1 -0
- package/dts/chart/axis/XAxis.d.ts +1 -1
- package/dts/chart/axis/XAxis.d.ts.map +1 -1
- package/dts/chart/axis/YAxis.d.ts +2 -2
- package/dts/chart/axis/YAxis.d.ts.map +1 -1
- package/dts/chart/axis/index.d.ts +1 -0
- package/dts/chart/axis/index.d.ts.map +1 -1
- package/dts/chart/bar/Bar.d.ts +50 -12
- package/dts/chart/bar/Bar.d.ts.map +1 -1
- package/dts/chart/bar/BarChart.d.ts +20 -8
- package/dts/chart/bar/BarChart.d.ts.map +1 -1
- package/dts/chart/bar/BarPlot.d.ts +3 -1
- package/dts/chart/bar/BarPlot.d.ts.map +1 -1
- package/dts/chart/bar/BarStack.d.ts +41 -46
- package/dts/chart/bar/BarStack.d.ts.map +1 -1
- package/dts/chart/bar/BarStackGroup.d.ts +2 -0
- 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/gradient/Gradient.d.ts +35 -0
- package/dts/chart/gradient/Gradient.d.ts.map +1 -0
- package/dts/chart/gradient/index.d.ts +2 -0
- package/dts/chart/gradient/index.d.ts.map +1 -0
- package/dts/chart/index.d.ts +3 -1
- package/dts/chart/index.d.ts.map +1 -1
- package/dts/chart/legend/DefaultLegendEntry.d.ts +21 -0
- package/dts/chart/legend/DefaultLegendEntry.d.ts.map +1 -0
- package/dts/chart/legend/DefaultLegendShape.d.ts +7 -0
- package/dts/chart/legend/DefaultLegendShape.d.ts.map +1 -0
- package/dts/chart/legend/Legend.d.ts +169 -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/DefaultReferenceLineLabel.d.ts +9 -0
- package/dts/chart/line/DefaultReferenceLineLabel.d.ts.map +1 -0
- package/dts/chart/line/DottedLine.d.ts +15 -3
- package/dts/chart/line/DottedLine.d.ts.map +1 -1
- package/dts/chart/line/Line.d.ts +84 -28
- package/dts/chart/line/Line.d.ts.map +1 -1
- package/dts/chart/line/LineChart.d.ts +28 -8
- package/dts/chart/line/LineChart.d.ts.map +1 -1
- package/dts/chart/line/ReferenceLine.d.ts +91 -44
- package/dts/chart/line/ReferenceLine.d.ts.map +1 -1
- package/dts/chart/line/SolidLine.d.ts +14 -3
- package/dts/chart/line/SolidLine.d.ts.map +1 -1
- package/dts/chart/line/index.d.ts +1 -1
- package/dts/chart/line/index.d.ts.map +1 -1
- package/dts/chart/point/DefaultPointLabel.d.ts +10 -0
- package/dts/chart/point/DefaultPointLabel.d.ts.map +1 -0
- package/dts/chart/point/Point.d.ts +217 -0
- package/dts/chart/point/Point.d.ts.map +1 -0
- package/dts/chart/point/index.d.ts +3 -0
- package/dts/chart/point/index.d.ts.map +1 -0
- package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts +41 -0
- package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts.map +1 -0
- package/dts/chart/scrubber/DefaultScrubberBeaconLabel.d.ts +12 -0
- package/dts/chart/scrubber/DefaultScrubberBeaconLabel.d.ts.map +1 -0
- package/dts/chart/scrubber/DefaultScrubberLabel.d.ts +10 -0
- package/dts/chart/scrubber/DefaultScrubberLabel.d.ts.map +1 -0
- package/dts/chart/scrubber/Scrubber.d.ts +287 -70
- package/dts/chart/scrubber/Scrubber.d.ts.map +1 -1
- package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts +80 -0
- package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts.map +1 -0
- package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts +47 -0
- package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts.map +1 -0
- package/dts/chart/scrubber/index.d.ts +3 -0
- package/dts/chart/scrubber/index.d.ts.map +1 -1
- package/dts/chart/text/ChartText.d.ts +46 -43
- package/dts/chart/text/ChartText.d.ts.map +1 -1
- package/dts/chart/text/{SmartChartTextGroup.d.ts → ChartTextGroup.d.ts} +9 -3
- package/dts/chart/text/ChartTextGroup.d.ts.map +1 -0
- package/dts/chart/text/index.d.ts +1 -1
- package/dts/chart/text/index.d.ts.map +1 -1
- package/dts/chart/utils/axis.d.ts +25 -1
- package/dts/chart/utils/axis.d.ts.map +1 -1
- package/dts/chart/utils/bar.d.ts +34 -0
- package/dts/chart/utils/bar.d.ts.map +1 -1
- package/dts/chart/utils/chart.d.ts +45 -7
- package/dts/chart/utils/chart.d.ts.map +1 -1
- package/dts/chart/utils/context.d.ts +6 -0
- package/dts/chart/utils/context.d.ts.map +1 -1
- package/dts/chart/utils/gradient.d.ts +104 -0
- package/dts/chart/utils/gradient.d.ts.map +1 -0
- package/dts/chart/utils/index.d.ts +4 -0
- package/dts/chart/utils/index.d.ts.map +1 -1
- package/dts/chart/utils/interpolate.d.ts +112 -0
- package/dts/chart/utils/interpolate.d.ts.map +1 -0
- package/dts/chart/utils/path.d.ts +30 -1
- package/dts/chart/utils/path.d.ts.map +1 -1
- package/dts/chart/utils/point.d.ts +40 -7
- 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 +40 -0
- package/dts/chart/utils/scrubber.d.ts.map +1 -0
- package/dts/chart/utils/transition.d.ts +101 -0
- package/dts/chart/utils/transition.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.d.ts.map +1 -1
- package/esm/chart/CartesianChart.js +170 -83
- package/esm/chart/ChartProvider.js +2 -2
- package/esm/chart/Path.js +59 -54
- package/esm/chart/PeriodSelector.js +36 -32
- package/esm/chart/area/Area.js +26 -34
- package/esm/chart/area/AreaChart.js +29 -15
- package/esm/chart/area/DottedArea.js +39 -89
- package/esm/chart/area/GradientArea.js +37 -80
- package/esm/chart/area/SolidArea.js +32 -11
- package/esm/chart/axis/Axis.js +4 -39
- package/esm/chart/axis/DefaultAxisTickLabel.js +15 -0
- package/esm/chart/axis/XAxis.js +184 -63
- package/esm/chart/axis/YAxis.js +190 -57
- package/esm/chart/axis/index.js +1 -0
- package/esm/chart/bar/Bar.js +7 -1
- package/esm/chart/bar/BarChart.js +17 -32
- package/esm/chart/bar/BarPlot.js +5 -2
- package/esm/chart/bar/BarStack.js +74 -22
- package/esm/chart/bar/BarStackGroup.js +8 -18
- package/esm/chart/bar/DefaultBar.js +23 -28
- package/esm/chart/bar/DefaultBarStack.js +24 -20
- package/esm/chart/gradient/Gradient.js +104 -0
- package/esm/chart/gradient/index.js +1 -0
- package/esm/chart/index.js +3 -1
- package/esm/chart/legend/DefaultLegendEntry.css +1 -0
- package/esm/chart/legend/DefaultLegendEntry.js +50 -0
- package/esm/chart/legend/DefaultLegendShape.css +5 -0
- package/esm/chart/legend/DefaultLegendShape.js +47 -0
- package/esm/chart/legend/Legend.js +76 -0
- package/esm/chart/legend/index.js +3 -0
- package/esm/chart/line/DefaultReferenceLineLabel.js +81 -0
- package/esm/chart/line/DottedLine.js +41 -17
- package/esm/chart/line/Line.js +87 -75
- package/esm/chart/line/LineChart.js +24 -8
- package/esm/chart/line/ReferenceLine.js +41 -43
- package/esm/chart/line/SolidLine.js +39 -15
- package/esm/chart/line/index.js +1 -1
- package/esm/chart/{line/GradientLine.js → point/DefaultPointLabel.js} +31 -45
- package/esm/chart/point/Point.css +2 -0
- package/esm/chart/{Point.js → point/Point.js} +87 -62
- package/esm/chart/point/index.js +2 -0
- package/esm/chart/scrubber/DefaultScrubberBeacon.js +154 -0
- package/esm/chart/scrubber/DefaultScrubberBeaconLabel.js +57 -0
- package/esm/chart/scrubber/{ScrubberBeaconLabel.js → DefaultScrubberLabel.js} +15 -18
- package/esm/chart/scrubber/Scrubber.js +97 -392
- package/esm/chart/scrubber/ScrubberBeaconGroup.js +174 -0
- package/esm/chart/scrubber/ScrubberBeaconLabelGroup.js +201 -0
- package/esm/chart/scrubber/index.js +3 -1
- package/esm/chart/text/ChartText.js +15 -20
- package/esm/chart/text/{SmartChartTextGroup.js → ChartTextGroup.js} +4 -3
- package/esm/chart/text/index.js +1 -1
- package/esm/chart/utils/axis.js +47 -31
- package/esm/chart/utils/bar.js +48 -0
- package/esm/chart/utils/chart.js +42 -3
- package/esm/chart/utils/gradient.js +257 -0
- package/esm/chart/utils/index.js +4 -0
- package/esm/chart/utils/interpolate.js +644 -0
- package/esm/chart/utils/path.js +41 -9
- package/esm/chart/utils/point.js +99 -12
- package/esm/chart/utils/scale.js +13 -2
- package/esm/chart/utils/scrubber.js +137 -0
- package/esm/chart/utils/transition.js +133 -0
- package/esm/sparkline/__figma__/Sparkline.figma.js +1 -1
- package/esm/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.js +8 -4
- package/esm/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.js +1 -1
- package/esm/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.js +1 -1
- package/package.json +12 -11
- package/dts/chart/Point.d.ts +0 -153
- package/dts/chart/Point.d.ts.map +0 -1
- package/dts/chart/line/GradientLine.d.ts +0 -42
- package/dts/chart/line/GradientLine.d.ts.map +0 -1
- package/dts/chart/scrubber/ScrubberBeacon.d.ts +0 -93
- package/dts/chart/scrubber/ScrubberBeacon.d.ts.map +0 -1
- package/dts/chart/scrubber/ScrubberBeaconLabel.d.ts +0 -7
- package/dts/chart/scrubber/ScrubberBeaconLabel.d.ts.map +0 -1
- package/dts/chart/text/SmartChartTextGroup.d.ts.map +0 -1
- package/esm/chart/Point.css +0 -2
- package/esm/chart/scrubber/ScrubberBeacon.js +0 -195
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Rect, SharedProps } from '@coinbase/cds-common/types';
|
|
3
3
|
import { type BoxProps } from '@coinbase/cds-web/layout';
|
|
4
4
|
import { type ChartInset } from '../utils';
|
|
5
5
|
type ValidChartTextChildElements =
|
|
@@ -23,18 +23,50 @@ export type TextHorizontalAlignment = 'left' | 'center' | 'right';
|
|
|
23
23
|
* Vertical alignment options for chart text.
|
|
24
24
|
*/
|
|
25
25
|
export type TextVerticalAlignment = 'top' | 'middle' | 'bottom';
|
|
26
|
-
export type
|
|
26
|
+
export type ChartTextBaseProps = SharedProps & {
|
|
27
|
+
/**
|
|
28
|
+
* The text color.
|
|
29
|
+
* @default 'var(--color-fgMuted)'
|
|
30
|
+
*/
|
|
31
|
+
color?: string;
|
|
32
|
+
/**
|
|
33
|
+
* The background color of the text's background rectangle.
|
|
34
|
+
* @default 'var(--color-bg)' if elevated, otherwise 'transparent'
|
|
35
|
+
*/
|
|
36
|
+
background?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Whether the text should have an elevated appearance with a shadow.
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
elevated?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* When true, disables automatic repositioning to fit within bounds.
|
|
44
|
+
*/
|
|
45
|
+
disableRepositioning?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Optional bounds rectangle to constrain the text within. If provided, text will be positioned
|
|
48
|
+
* to stay within these bounds. Defaults to the full chart bounds when not provided.
|
|
49
|
+
*/
|
|
50
|
+
bounds?: Rect;
|
|
51
|
+
/**
|
|
52
|
+
* Callback fired when text dimensions change.
|
|
53
|
+
* Used for collision detection and smart positioning.
|
|
54
|
+
* Returns the adjusted position and dimensions.
|
|
55
|
+
*/
|
|
56
|
+
onDimensionsChange?: (rect: Rect) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Inset around the text content for the background rect.
|
|
59
|
+
* Only affects the background, text position remains unchanged.
|
|
60
|
+
*/
|
|
61
|
+
inset?: number | ChartInset;
|
|
62
|
+
/**
|
|
63
|
+
* Border radius for the background rectangle.
|
|
64
|
+
* @default 4
|
|
65
|
+
*/
|
|
66
|
+
borderRadius?: number;
|
|
67
|
+
};
|
|
68
|
+
export type ChartTextProps = ChartTextBaseProps &
|
|
27
69
|
Pick<BoxProps<'g'>, 'font' | 'fontFamily' | 'fontSize' | 'fontWeight' | 'opacity'> & {
|
|
28
|
-
/**
|
|
29
|
-
* The text color.
|
|
30
|
-
* @default 'var(--color-fgMuted)'
|
|
31
|
-
*/
|
|
32
|
-
color?: string;
|
|
33
|
-
/**
|
|
34
|
-
* The background color of the text's background rectangle.
|
|
35
|
-
* @default 'transparent' if not elevated, 'var(--color-bg)' if elevated
|
|
36
|
-
*/
|
|
37
|
-
background?: string;
|
|
38
70
|
/**
|
|
39
71
|
* The desired x offset in SVG pixels.
|
|
40
72
|
*/
|
|
@@ -43,10 +75,6 @@ export type ChartTextProps = SharedProps &
|
|
|
43
75
|
* The desired y offset in SVG pixels.
|
|
44
76
|
*/
|
|
45
77
|
dy?: number;
|
|
46
|
-
/**
|
|
47
|
-
* The elevation for the background.
|
|
48
|
-
*/
|
|
49
|
-
elevation?: ElevationLevels;
|
|
50
78
|
/**
|
|
51
79
|
* The text content to display.
|
|
52
80
|
*/
|
|
@@ -62,35 +90,15 @@ export type ChartTextProps = SharedProps &
|
|
|
62
90
|
*/
|
|
63
91
|
y: number;
|
|
64
92
|
/**
|
|
65
|
-
* Horizontal alignment of the
|
|
93
|
+
* Horizontal alignment of the component.
|
|
66
94
|
* @default 'center'
|
|
67
95
|
*/
|
|
68
96
|
horizontalAlignment?: TextHorizontalAlignment;
|
|
69
97
|
/**
|
|
70
|
-
* Vertical alignment of the
|
|
98
|
+
* Vertical alignment of the component.
|
|
71
99
|
* @default 'middle'
|
|
72
100
|
*/
|
|
73
101
|
verticalAlignment?: TextVerticalAlignment;
|
|
74
|
-
/**
|
|
75
|
-
* When true, disables automatic repositioning to fit within bounds.
|
|
76
|
-
*/
|
|
77
|
-
disableRepositioning?: boolean;
|
|
78
|
-
/**
|
|
79
|
-
* Optional bounds rectangle to constrain the text within. If provided, text will be positioned
|
|
80
|
-
* to stay within these bounds. Defaults to the full chart bounds when not provided.
|
|
81
|
-
*/
|
|
82
|
-
bounds?: Rect;
|
|
83
|
-
/**
|
|
84
|
-
* Callback fired when text dimensions change.
|
|
85
|
-
* Used for collision detection and smart positioning.
|
|
86
|
-
* Returns the adjusted position and dimensions.
|
|
87
|
-
*/
|
|
88
|
-
onDimensionsChange?: (rect: Rect) => void;
|
|
89
|
-
/**
|
|
90
|
-
* Inset around the text content for the background rect.
|
|
91
|
-
* Only affects the background, text position remains unchanged.
|
|
92
|
-
*/
|
|
93
|
-
inset?: number | ChartInset;
|
|
94
102
|
style?: React.CSSProperties;
|
|
95
103
|
styles?: {
|
|
96
104
|
root?: React.CSSProperties;
|
|
@@ -103,11 +111,6 @@ export type ChartTextProps = SharedProps &
|
|
|
103
111
|
text?: string;
|
|
104
112
|
backgroundRect?: string;
|
|
105
113
|
};
|
|
106
|
-
/**
|
|
107
|
-
* Border radius for the background rectangle.
|
|
108
|
-
* @default 4
|
|
109
|
-
*/
|
|
110
|
-
borderRadius?: number;
|
|
111
114
|
};
|
|
112
115
|
export declare const ChartText: React.NamedExoticComponent<ChartTextProps>;
|
|
113
116
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartText.d.ts","sourceRoot":"","sources":["../../../src/chart/text/ChartText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqD,MAAM,OAAO,CAAC;AAC1E,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ChartText.d.ts","sourceRoot":"","sources":["../../../src/chart/text/ChartText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqD,MAAM,OAAO,CAAC;AAC1E,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEpE,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAK9D,OAAO,EAAE,KAAK,UAAU,EAAiB,MAAM,UAAU,CAAC;AAG1D,KAAK,2BAA2B,GAC5B,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC,GAC5D,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,UAAU,CAAC,CAAC;AAEvE;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,MAAM,GACN,IAAI,GACJ,SAAS,GACT,2BAA2B,GAC3B,2BAA2B,EAAE,CAAC;AAElC;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM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,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;KACtC,CAAC;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE;QACX,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;CACH,CAAC;AAkCJ,eAAO,MAAM,SAAS,4CA4MrB,CAAC"}
|
|
@@ -23,7 +23,7 @@ export type TextLabelData = {
|
|
|
23
23
|
export type TextLabelDataWithKey = TextLabelData & {
|
|
24
24
|
key: string;
|
|
25
25
|
};
|
|
26
|
-
export type
|
|
26
|
+
export type ChartTextGroupBaseProps = {
|
|
27
27
|
/**
|
|
28
28
|
* Array of text labels to display
|
|
29
29
|
*/
|
|
@@ -42,7 +42,13 @@ export type SmartChartTextGroupProps = {
|
|
|
42
42
|
* Common props to apply to all ChartText components
|
|
43
43
|
*/
|
|
44
44
|
chartTextProps?: Partial<ChartTextProps>;
|
|
45
|
+
/**
|
|
46
|
+
* Custom component to render each label
|
|
47
|
+
* @default ChartText
|
|
48
|
+
*/
|
|
49
|
+
LabelComponent?: React.FC<ChartTextProps>;
|
|
45
50
|
};
|
|
51
|
+
export type ChartTextGroupProps = ChartTextGroupBaseProps;
|
|
46
52
|
/**
|
|
47
53
|
* A smart text display component that prevents label overlap through collision detection.
|
|
48
54
|
*
|
|
@@ -51,5 +57,5 @@ export type SmartChartTextGroupProps = {
|
|
|
51
57
|
*
|
|
52
58
|
* The component focuses solely on overlap prevention logic for better separation of concerns.
|
|
53
59
|
*/
|
|
54
|
-
export declare const
|
|
55
|
-
//# sourceMappingURL=
|
|
60
|
+
export declare const ChartTextGroup: import('react').NamedExoticComponent<ChartTextGroupBaseProps>;
|
|
61
|
+
//# sourceMappingURL=ChartTextGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChartTextGroup.d.ts","sourceRoot":"","sources":["../../../src/chart/text/ChartTextGroup.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAa,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAErF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,KAAK,EAAE,iBAAiB,CAAC;IACzB;;OAEG;IACH,CAAC,EAAE,MAAM,CAAC;IACV;;OAEG;IACH,CAAC,EAAE,MAAM,CAAC;IACV;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnE,MAAM,MAAM,uBAAuB,GAAG;IACpC;;OAEG;IACH,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACzC;;;OAGG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AAiB1D;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,+DA0M1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/chart/text/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/chart/text/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { Rect } from '@coinbase/cds-common/types';
|
|
3
3
|
import { type AxisBounds, type Series } from './chart';
|
|
4
|
-
import { type ChartAxisScaleType, type ChartScaleFunction } from './scale';
|
|
4
|
+
import { type ChartAxisScaleType, type ChartScaleFunction, type PointAnchor } from './scale';
|
|
5
5
|
export declare const defaultAxisId = 'DEFAULT_AXIS_ID';
|
|
6
6
|
export declare const defaultAxisScaleType = 'linear';
|
|
7
|
+
/**
|
|
8
|
+
* Position options for band scale axis elements.
|
|
9
|
+
*
|
|
10
|
+
* - `'start'` - At the start of each step (before bar padding)
|
|
11
|
+
* - `'middle'` - At the center of each band
|
|
12
|
+
* - `'end'` - At the end of each step (after bar padding)
|
|
13
|
+
* - `'edges'` - At start of each tick, plus end for the last tick (encloses the chart)
|
|
14
|
+
*
|
|
15
|
+
* @note These properties only apply when using a band scale (`scaleType: 'band'`).
|
|
16
|
+
*/
|
|
17
|
+
export type AxisBandPlacement = 'start' | 'middle' | 'end' | 'edges';
|
|
18
|
+
/**
|
|
19
|
+
* Converts an AxisBandPlacement to the corresponding PointAnchor for use with getPointOnScale.
|
|
20
|
+
*
|
|
21
|
+
* @param placement - The axis placement value
|
|
22
|
+
* @returns The corresponding PointAnchor for scale calculations
|
|
23
|
+
*/
|
|
24
|
+
export declare const toPointAnchor: (placement: AxisBandPlacement) => PointAnchor;
|
|
7
25
|
/**
|
|
8
26
|
* Axis configuration with computed bounds
|
|
9
27
|
*/
|
|
@@ -154,6 +172,12 @@ type TickGenerationOptions = {
|
|
|
154
172
|
* @default 4
|
|
155
173
|
*/
|
|
156
174
|
minTickCount?: number;
|
|
175
|
+
/**
|
|
176
|
+
* Anchor position for band/categorical scales.
|
|
177
|
+
* Controls where tick labels are positioned within each band.
|
|
178
|
+
* @default 'middle'
|
|
179
|
+
*/
|
|
180
|
+
anchor?: PointAnchor;
|
|
157
181
|
};
|
|
158
182
|
export type GetAxisTicksDataProps = {
|
|
159
183
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axis.d.ts","sourceRoot":"","sources":["../../../src/chart/utils/axis.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EACL,KAAK,UAAU,EAIf,KAAK,MAAM,EACZ,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"axis.d.ts","sourceRoot":"","sources":["../../../src/chart/utils/axis.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EACL,KAAK,UAAU,EAIf,KAAK,MAAM,EACZ,MAAM,SAAS,CAAC;AAEjB,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EAMvB,KAAK,WAAW,EACjB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,aAAa,oBAAoB,CAAC;AAC/C,eAAO,MAAM,oBAAoB,WAAW,CAAC;AAE7C;;;;;;;;;GASG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAC;AAErE;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,WAAW,iBAAiB,KAAG,WAW5D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,+BAA+B;IAC/B,SAAS,EAAE,kBAAkB,CAAC;IAC9B;;OAEG;IACH,MAAM,EAAE,UAAU,CAAC;IACnB;;OAEG;IACH,KAAK,EAAE,UAAU,CAAC;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;IAC3B;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,WAAW,EAAE,MAAM,GAAG,QAAQ,CAAC;CAChC,CAAC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GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;uBAIvB,MAAM,YAAY,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,QAAQ,MAAM;yBAclC,MAAM;CAwB/C,CAAC"}
|
package/dts/chart/utils/bar.d.ts
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
import type { Transition } from 'framer-motion';
|
|
2
|
+
/**
|
|
3
|
+
* A bar-specific transition that extends Transition with stagger support.
|
|
4
|
+
* When `staggerDelay` is provided, bars will animate with increasing delays
|
|
5
|
+
* based on their horizontal position (leftmost starts first, rightmost last).
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* // Bars stagger in from left to right over 0.25s, each animating for 0.75s
|
|
9
|
+
* { type: 'tween', duration: 0.75, staggerDelay: 0.25 }
|
|
10
|
+
*/
|
|
11
|
+
export type BarTransition = Transition & {
|
|
12
|
+
/**
|
|
13
|
+
* Maximum stagger delay (seconds) distributed across bars by x position.
|
|
14
|
+
* Leftmost bar starts immediately, rightmost starts after this delay.
|
|
15
|
+
*/
|
|
16
|
+
staggerDelay?: number;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Strips `staggerDelay` from a transition and computes a positional delay.
|
|
20
|
+
*
|
|
21
|
+
* @param transition - The transition config (may include staggerDelay)
|
|
22
|
+
* @param normalizedX - The bar's normalized x position (0 = left edge, 1 = right edge)
|
|
23
|
+
* @returns A standard Transition with computed delay
|
|
24
|
+
*/
|
|
25
|
+
export declare const withStaggerDelayTransition: (
|
|
26
|
+
transition: BarTransition,
|
|
27
|
+
normalizedX: number,
|
|
28
|
+
) => Transition;
|
|
29
|
+
/**
|
|
30
|
+
* Default bar enter transition. Uses the default spring with a stagger delay
|
|
31
|
+
* so bars spring into place from left to right.
|
|
32
|
+
* `{ type: 'spring', stiffness: 900, damping: 120, mass: 4, staggerDelay: 0.25 }`
|
|
33
|
+
*/
|
|
34
|
+
export declare const defaultBarEnterTransition: BarTransition;
|
|
1
35
|
/**
|
|
2
36
|
* Calculates the size adjustment needed for bars when accounting for gaps between them.
|
|
3
37
|
* This function helps determine how much to reduce each bar's width to accommodate
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bar.d.ts","sourceRoot":"","sources":["../../../src/chart/utils/bar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAM9E"}
|
|
1
|
+
{"version":3,"file":"bar.d.ts","sourceRoot":"","sources":["../../../src/chart/utils/bar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAIhD;;;;;;;;GAQG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG;IACvC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,GACrC,YAAY,aAAa,EACzB,aAAa,MAAM,KAClB,UAOF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,aAGvC,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAM9E"}
|
|
@@ -1,4 +1,17 @@
|
|
|
1
|
+
import type { GradientDefinition } from './gradient';
|
|
1
2
|
export declare const defaultStackId = 'DEFAULT_STACK_ID';
|
|
3
|
+
/**
|
|
4
|
+
* Shape variants available for legend items.
|
|
5
|
+
*/
|
|
6
|
+
export type LegendShapeVariant = 'circle' | 'square' | 'squircle' | 'pill';
|
|
7
|
+
/**
|
|
8
|
+
* Shape for legend items. Can be a preset variant or a custom ReactNode.
|
|
9
|
+
*/
|
|
10
|
+
export type LegendShape = LegendShapeVariant | React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Position of the legend relative to the chart.
|
|
13
|
+
*/
|
|
14
|
+
export type LegendPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
2
15
|
export type AxisBounds = {
|
|
3
16
|
min: number;
|
|
4
17
|
max: number;
|
|
@@ -11,11 +24,11 @@ export type AxisBounds = {
|
|
|
11
24
|
export declare const isValidBounds: (bounds: Partial<AxisBounds>) => bounds is AxisBounds;
|
|
12
25
|
export type Series = {
|
|
13
26
|
/**
|
|
14
|
-
*
|
|
27
|
+
* Id of the series.
|
|
15
28
|
*/
|
|
16
29
|
id: string;
|
|
17
30
|
/**
|
|
18
|
-
*
|
|
31
|
+
* Data array for this series. Use null values to create gaps in the visualization.
|
|
19
32
|
*
|
|
20
33
|
* Can be either:
|
|
21
34
|
* - Array of numbers: `[10, -5, 20]`
|
|
@@ -23,24 +36,38 @@ export type Series = {
|
|
|
23
36
|
*/
|
|
24
37
|
data?: Array<number | null> | Array<[number, number] | null>;
|
|
25
38
|
/**
|
|
26
|
-
*
|
|
39
|
+
* Label of the series.
|
|
40
|
+
* Used for scrubber beacon labels.
|
|
27
41
|
*/
|
|
28
|
-
label?: string
|
|
42
|
+
label?: string;
|
|
29
43
|
/**
|
|
30
|
-
*
|
|
44
|
+
* Color of the series.
|
|
45
|
+
* If gradient is provided, that will be used for chart components
|
|
46
|
+
* Color will still be used by scrubber beacon labels
|
|
31
47
|
*/
|
|
32
48
|
color?: string;
|
|
33
49
|
/**
|
|
34
|
-
*
|
|
50
|
+
* Color gradient configuration.
|
|
51
|
+
* Takes precedence over color except for scrubber beacon labels.
|
|
52
|
+
*/
|
|
53
|
+
gradient?: GradientDefinition;
|
|
54
|
+
/**
|
|
55
|
+
* Id of the y-axis this series uses.
|
|
35
56
|
* Defaults to defaultAxisId if not specified.
|
|
36
57
|
*/
|
|
37
58
|
yAxisId?: string;
|
|
38
59
|
/**
|
|
39
|
-
*
|
|
60
|
+
* Id of the stack group this series belongs to.
|
|
40
61
|
* Series with the same stackId value will be stacked together.
|
|
41
62
|
* If not specified, the series will not be stacked.
|
|
42
63
|
*/
|
|
43
64
|
stackId?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Shape of the legend item for this series.
|
|
67
|
+
* Can be a preset shape variant or a custom ReactNode.
|
|
68
|
+
* @default 'circle'
|
|
69
|
+
*/
|
|
70
|
+
legendShape?: LegendShape;
|
|
44
71
|
};
|
|
45
72
|
/**
|
|
46
73
|
* Calculates the domain of a chart from series data.
|
|
@@ -61,6 +88,17 @@ export declare const getChartDomain: (
|
|
|
61
88
|
export declare const getStackedSeriesData: (
|
|
62
89
|
series: Series[],
|
|
63
90
|
) => Map<string, Array<[number, number] | null>>;
|
|
91
|
+
/**
|
|
92
|
+
* Extracts line data values from series data that may contain tuples.
|
|
93
|
+
* For tuple data [[baseline, value]], extracts the last value.
|
|
94
|
+
* For numeric data [value], returns as-is.
|
|
95
|
+
*
|
|
96
|
+
* @param data - Array of numbers, tuples, or null values
|
|
97
|
+
* @returns Array of numbers or null values
|
|
98
|
+
*/
|
|
99
|
+
export declare const getLineData: (
|
|
100
|
+
data?: Array<number | null> | Array<[number, number] | null>,
|
|
101
|
+
) => Array<number | null>;
|
|
64
102
|
/**
|
|
65
103
|
* Calculates the range of a chart from series data.
|
|
66
104
|
* Range represents the range of y-values from the data.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../../src/chart/utils/chart.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,qBAAqB,CAAC;AAEjD,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,OAAO,CAAC,UAAU,CAAC,KAAG,MAAM,IAAI,UAChB,CAAC;AAEvD,MAAM,MAAM,MAAM,GAAG;IACnB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC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
|
|
59
|
+
/**
|
|
60
|
+
* Length of the data domain.
|
|
61
|
+
* This is equal to the length of xAxis.data or the longest series data length
|
|
62
|
+
* This equals the number of possible scrubber positions
|
|
63
|
+
*/
|
|
64
|
+
dataLength: number;
|
|
59
65
|
/**
|
|
60
66
|
* Registers an axis.
|
|
61
67
|
* Used by axis components to reserve space in the chart, preventing overlap with the drawing area.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/chart/utils/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC;;OAEG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB;;;OAGG;IACH,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACrD;;;;OAIG;IACH,aAAa,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;IACjF;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,MAAM,UAAU,GAAG,SAAS,CAAC;IACvC;;;OAGG;IACH,QAAQ,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,UAAU,GAAG,SAAS,CAAC;IAClD;;OAEG;IACH,SAAS,EAAE,MAAM,kBAAkB,GAAG,SAAS,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AE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAC/D,CAAC;AAEF,eAAO,MAAM,eAAe,2DAA6D,CAAC;AAE1F,eAAO,MAAM,kBAAkB,QAAO,oBAMrC,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { AxisBounds } from './chart';
|
|
2
|
+
import { type ChartScaleFunction } from './scale';
|
|
3
|
+
/**
|
|
4
|
+
* Defines a color transition point in the gradient
|
|
5
|
+
*/
|
|
6
|
+
export type GradientStop = {
|
|
7
|
+
/**
|
|
8
|
+
* Position in data space.
|
|
9
|
+
* Multiple stops at the same offset create hard color transitions.
|
|
10
|
+
*/
|
|
11
|
+
offset: number;
|
|
12
|
+
/** Color at the stop (any valid CSS color) */
|
|
13
|
+
color: string;
|
|
14
|
+
/** Optional opacity (0-1). Defaults to 1. */
|
|
15
|
+
opacity?: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Defines a gradient.
|
|
19
|
+
*/
|
|
20
|
+
export type GradientDefinition = {
|
|
21
|
+
/**
|
|
22
|
+
* Axis that the gradient maps to.
|
|
23
|
+
* @default 'y'
|
|
24
|
+
*/
|
|
25
|
+
axis?: 'x' | 'y';
|
|
26
|
+
/**
|
|
27
|
+
* Gradient stops with colors and positions.
|
|
28
|
+
* Can be an array of stop objects or a function that receives domain bounds.
|
|
29
|
+
*/
|
|
30
|
+
stops: GradientStop[] | ((domain: AxisBounds) => GradientStop[]);
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Evaluates the color at a specific data value based on the gradient stops, ignoring opacity.
|
|
34
|
+
* @param stops - The gradient stops configuration
|
|
35
|
+
* @param dataValue - The data value to evaluate (for band scales, this is the index)
|
|
36
|
+
* @param scale - The scale to use for value mapping (handles log scales correctly)
|
|
37
|
+
* @returns The color string at this data value, or undefined if invalid
|
|
38
|
+
*/
|
|
39
|
+
export declare const evaluateGradientAtValue: (
|
|
40
|
+
stops: GradientStop[],
|
|
41
|
+
dataValue: number,
|
|
42
|
+
scale: ChartScaleFunction,
|
|
43
|
+
) => string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Creates a gradient configuration for SVG components.
|
|
46
|
+
* Processes a GradientDefinition into a renderable GradientConfig.
|
|
47
|
+
* Supports both numeric scales (linear, log) and categorical scales (band).
|
|
48
|
+
*
|
|
49
|
+
* @param gradient - GradientDefinition configuration (required)
|
|
50
|
+
* @param xScale - X-axis scale (required)
|
|
51
|
+
* @param yScale - Y-axis scale (required)
|
|
52
|
+
* @returns GradientConfig or null if gradient processing fails
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* const gradientConfig = useMemo(() => {
|
|
56
|
+
* if (!gradient || !xScale || !yScale) return;
|
|
57
|
+
* return getGradientConfig(gradient, xScale, yScale);
|
|
58
|
+
* }, [gradient, xScale, yScale]);
|
|
59
|
+
*
|
|
60
|
+
* if (gradientConfig) {
|
|
61
|
+
* return (
|
|
62
|
+
* <defs>
|
|
63
|
+
* <Gradient
|
|
64
|
+
* config={gradientConfig}
|
|
65
|
+
* direction={gradient.axis === 'x' ? 'horizontal' : 'vertical'}
|
|
66
|
+
* id={gradientId}
|
|
67
|
+
* />
|
|
68
|
+
* </defs>
|
|
69
|
+
* );
|
|
70
|
+
* }
|
|
71
|
+
*/
|
|
72
|
+
export declare const getGradientConfig: (
|
|
73
|
+
gradient: GradientDefinition,
|
|
74
|
+
xScale: ChartScaleFunction,
|
|
75
|
+
yScale: ChartScaleFunction,
|
|
76
|
+
) => GradientStop[] | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Determines the baseline value for the gradient area by finding the value
|
|
79
|
+
* within the axis bounds that is closest to the target baseline.
|
|
80
|
+
*
|
|
81
|
+
* @param axisBounds - The min and max bounds of the axis
|
|
82
|
+
* @param baseline - The target baseline value (defaults to 0)
|
|
83
|
+
* @returns The value within bounds closest to the baseline
|
|
84
|
+
*/
|
|
85
|
+
export declare const getBaseline: (axisBounds: AxisBounds, baseline?: number) => number;
|
|
86
|
+
/**
|
|
87
|
+
* Generates a gradient definition for the area chart based on the axis bounds
|
|
88
|
+
* and styling parameters. Ensures gradient stops are in ascending order.
|
|
89
|
+
*
|
|
90
|
+
* @param axisBounds - The min and max bounds of the axis
|
|
91
|
+
* @param baselineValue - The baseline value for the gradient
|
|
92
|
+
* @param fill - The color to use for the gradient
|
|
93
|
+
* @param peakOpacity - Opacity at the peak of the gradient
|
|
94
|
+
* @param baselineOpacity - Opacity at the baseline
|
|
95
|
+
* @returns A gradient definition with y-axis stops in ascending order
|
|
96
|
+
*/
|
|
97
|
+
export declare const createGradient: (
|
|
98
|
+
axisBounds: AxisBounds,
|
|
99
|
+
baselineValue: number,
|
|
100
|
+
fill: string,
|
|
101
|
+
peakOpacity: number,
|
|
102
|
+
baselineOpacity: number,
|
|
103
|
+
) => GradientDefinition;
|
|
104
|
+
//# sourceMappingURL=gradient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradient.d.ts","sourceRoot":"","sources":["../../../src/chart/utils/gradient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,KAAK,kBAAkB,EAAsB,MAAM,SAAS,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;OAGG;IACH,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC;IACjB;;;OAGG;IACH,KAAK,EAAE,YAAY,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,UAAU,KAAK,YAAY,EAAE,CAAC,CAAC;CAClE,CAAC;AA8DF;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,GAClC,OAAO,YAAY,EAAE,EACrB,WAAW,MAAM,EACjB,OAAO,kBAAkB,KACxB,MAAM,GAAG,SAiEX,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,iBAAiB,GAC5B,UAAU,kBAAkB,EAC5B,QAAQ,kBAAkB,EAC1B,QAAQ,kBAAkB,KACzB,YAAY,EAAE,GAAG,SAqBnB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,GAAI,YAAY,UAAU,EAAE,WAAU,MAAU,KAAG,MAc1E,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,GACzB,YAAY,UAAU,EACtB,eAAe,MAAM,EACrB,MAAM,MAAM,EACZ,aAAa,MAAM,EACnB,iBAAiB,MAAM,KACtB,kBA0BF,CAAC"}
|
|
@@ -2,7 +2,11 @@ export * from './axis';
|
|
|
2
2
|
export * from './bar';
|
|
3
3
|
export * from './chart';
|
|
4
4
|
export * from './context';
|
|
5
|
+
export * from './gradient';
|
|
6
|
+
export * from './interpolate';
|
|
5
7
|
export * from './path';
|
|
6
8
|
export * from './point';
|
|
7
9
|
export * from './scale';
|
|
10
|
+
export * from './scrubber';
|
|
11
|
+
export * from './transition';
|
|
8
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/chart/utils/index.ts"],"names":[],"mappings":"AACA,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/chart/utils/index.ts"],"names":[],"mappings":"AACA,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
type CommandType =
|
|
2
|
+
| 'M'
|
|
3
|
+
| 'L'
|
|
4
|
+
| 'H'
|
|
5
|
+
| 'V'
|
|
6
|
+
| 'C'
|
|
7
|
+
| 'S'
|
|
8
|
+
| 'Q'
|
|
9
|
+
| 'T'
|
|
10
|
+
| 'A'
|
|
11
|
+
| 'Z'
|
|
12
|
+
| 'm'
|
|
13
|
+
| 'l'
|
|
14
|
+
| 'h'
|
|
15
|
+
| 'v'
|
|
16
|
+
| 'c'
|
|
17
|
+
| 's'
|
|
18
|
+
| 'q'
|
|
19
|
+
| 't'
|
|
20
|
+
| 'a'
|
|
21
|
+
| 'z';
|
|
22
|
+
type PathCommand = {
|
|
23
|
+
type: CommandType;
|
|
24
|
+
x?: number;
|
|
25
|
+
y?: number;
|
|
26
|
+
x1?: number;
|
|
27
|
+
y1?: number;
|
|
28
|
+
x2?: number;
|
|
29
|
+
y2?: number;
|
|
30
|
+
rx?: number;
|
|
31
|
+
ry?: number;
|
|
32
|
+
xAxisRotation?: number;
|
|
33
|
+
largeArcFlag?: number;
|
|
34
|
+
sweepFlag?: number;
|
|
35
|
+
[key: string]: any;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Convert command objects to arrays of points, run de Casteljau's algorithm on it
|
|
39
|
+
* to split into to the desired number of segments.
|
|
40
|
+
*
|
|
41
|
+
* @param {Object} commandStart The start command object
|
|
42
|
+
* @param {Object} commandEnd The end command object
|
|
43
|
+
* @param {Number} segmentCount The number of segments to create
|
|
44
|
+
* @return {Object[]} An array of commands representing the segments in sequence
|
|
45
|
+
*/
|
|
46
|
+
export declare function splitCurve(
|
|
47
|
+
commandStart: PathCommand,
|
|
48
|
+
commandEnd: PathCommand,
|
|
49
|
+
segmentCount?: number,
|
|
50
|
+
): PathCommand[];
|
|
51
|
+
type ExcludeSegmentFn = (commandStart: PathCommand, commandEnd: PathCommand) => boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Takes a path `d` string and converts it into an array of command
|
|
54
|
+
* objects. Drops the `Z` character.
|
|
55
|
+
*
|
|
56
|
+
* @param {String|null} d A path `d` string
|
|
57
|
+
*/
|
|
58
|
+
export declare function pathCommandsFromString(d: string | null | undefined): PathCommand[];
|
|
59
|
+
type InterpolateOptions = {
|
|
60
|
+
excludeSegment?: ExcludeSegmentFn;
|
|
61
|
+
snapEndsToInput?: boolean;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Interpolate from A to B by extending A and B during interpolation to have
|
|
65
|
+
* the same number of points. This allows for a smooth transition when they
|
|
66
|
+
* have a different number of points.
|
|
67
|
+
*
|
|
68
|
+
* Ignores the `Z` command in paths unless both A and B end with it.
|
|
69
|
+
*
|
|
70
|
+
* This function works directly with arrays of command objects instead of with
|
|
71
|
+
* path `d` strings (see interpolatePath for working with `d` strings).
|
|
72
|
+
*
|
|
73
|
+
* @param {Object[]} aCommandsInput Array of path commands
|
|
74
|
+
* @param {Object[]} bCommandsInput Array of path commands
|
|
75
|
+
* @param {(Function|Object)} interpolateOptions
|
|
76
|
+
* @param {Function} interpolateOptions.excludeSegment a function that takes a start command object and
|
|
77
|
+
* end command object and returns true if the segment should be excluded from splitting.
|
|
78
|
+
* @param {Boolean} interpolateOptions.snapEndsToInput a boolean indicating whether end of input should
|
|
79
|
+
* be sourced from input argument or computed.
|
|
80
|
+
* @returns {Function} Interpolation function that maps t ([0, 1]) to an array of path commands.
|
|
81
|
+
*/
|
|
82
|
+
export declare function interpolatePathCommands(
|
|
83
|
+
aCommandsInput: PathCommand[] | null | undefined,
|
|
84
|
+
bCommandsInput: PathCommand[] | null | undefined,
|
|
85
|
+
interpolateOptions?: ExcludeSegmentFn | InterpolateOptions,
|
|
86
|
+
): (t: number) => PathCommand[];
|
|
87
|
+
/**
|
|
88
|
+
* Interpolate from A to B by extending A and B during interpolation to have
|
|
89
|
+
* the same number of points. This allows for a smooth transition when they
|
|
90
|
+
* have a different number of points.
|
|
91
|
+
*
|
|
92
|
+
* Ignores the `Z` character in paths unless both A and B end with it.
|
|
93
|
+
*
|
|
94
|
+
* @param {String} a The `d` attribute for a path
|
|
95
|
+
* @param {String} b The `d` attribute for a path
|
|
96
|
+
* @param {((command1, command2) => boolean|{
|
|
97
|
+
* excludeSegment?: (command1, command2) => boolean;
|
|
98
|
+
* snapEndsToInput?: boolean
|
|
99
|
+
* })} interpolateOptions The excludeSegment function or an options object
|
|
100
|
+
* - interpolateOptions.excludeSegment a function that takes a start command object and
|
|
101
|
+
* end command object and returns true if the segment should be excluded from splitting.
|
|
102
|
+
* - interpolateOptions.snapEndsToInput a boolean indicating whether end of input should
|
|
103
|
+
* be sourced from input argument or computed.
|
|
104
|
+
* @returns {Function} Interpolation function that maps t ([0, 1]) to a path `d` string.
|
|
105
|
+
*/
|
|
106
|
+
export declare function interpolatePath(
|
|
107
|
+
a: string | null | undefined,
|
|
108
|
+
b: string | null | undefined,
|
|
109
|
+
interpolateOptions?: ExcludeSegmentFn | InterpolateOptions,
|
|
110
|
+
): (t: number) => string;
|
|
111
|
+
export {};
|
|
112
|
+
//# sourceMappingURL=interpolate.d.ts.map
|