@coinbase/cds-mobile-visualization 3.4.0-beta.2 → 3.4.0-beta.21
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 +128 -0
- package/dts/chart/CartesianChart.d.ts +92 -34
- package/dts/chart/CartesianChart.d.ts.map +1 -1
- package/dts/chart/ChartContextBridge.d.ts +28 -0
- package/dts/chart/ChartContextBridge.d.ts.map +1 -0
- package/dts/chart/ChartProvider.d.ts +3 -0
- package/dts/chart/ChartProvider.d.ts.map +1 -1
- package/dts/chart/Path.d.ts +97 -32
- package/dts/chart/Path.d.ts.map +1 -1
- package/dts/chart/PeriodSelector.d.ts +6 -13
- package/dts/chart/PeriodSelector.d.ts.map +1 -1
- package/dts/chart/area/Area.d.ts +39 -28
- package/dts/chart/area/Area.d.ts.map +1 -1
- package/dts/chart/area/AreaChart.d.ts +51 -10
- package/dts/chart/area/AreaChart.d.ts.map +1 -1
- package/dts/chart/area/DottedArea.d.ts +21 -2
- package/dts/chart/area/DottedArea.d.ts.map +1 -1
- package/dts/chart/area/GradientArea.d.ts +19 -13
- package/dts/chart/area/GradientArea.d.ts.map +1 -1
- package/dts/chart/area/SolidArea.d.ts +17 -2
- package/dts/chart/area/SolidArea.d.ts.map +1 -1
- package/dts/chart/axis/Axis.d.ts +86 -118
- 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 +49 -12
- package/dts/chart/bar/Bar.d.ts.map +1 -1
- package/dts/chart/bar/BarChart.d.ts +40 -19
- 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 +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 +25 -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 +4 -1
- 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/DefaultReferenceLineLabel.d.ts +9 -0
- package/dts/chart/line/DefaultReferenceLineLabel.d.ts.map +1 -0
- package/dts/chart/line/DottedLine.d.ts +13 -5
- package/dts/chart/line/DottedLine.d.ts.map +1 -1
- package/dts/chart/line/Line.d.ts +61 -27
- package/dts/chart/line/Line.d.ts.map +1 -1
- package/dts/chart/line/LineChart.d.ts +43 -9
- package/dts/chart/line/LineChart.d.ts.map +1 -1
- package/dts/chart/line/ReferenceLine.d.ts +68 -20
- package/dts/chart/line/ReferenceLine.d.ts.map +1 -1
- package/dts/chart/line/SolidLine.d.ts +8 -5
- 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 +136 -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 +38 -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 +11 -0
- package/dts/chart/scrubber/DefaultScrubberLabel.d.ts.map +1 -0
- package/dts/chart/scrubber/Scrubber.d.ts +230 -42
- package/dts/chart/scrubber/Scrubber.d.ts.map +1 -1
- package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts +54 -0
- package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts.map +1 -0
- package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts +46 -0
- package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts.map +1 -0
- package/dts/chart/scrubber/ScrubberProvider.d.ts +6 -3
- package/dts/chart/scrubber/ScrubberProvider.d.ts.map +1 -1
- 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 +151 -77
- 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 +52 -7
- package/dts/chart/utils/chart.d.ts.map +1 -1
- package/dts/chart/utils/context.d.ts +28 -7
- package/dts/chart/utils/context.d.ts.map +1 -1
- package/dts/chart/utils/gradient.d.ts +117 -0
- package/dts/chart/utils/gradient.d.ts.map +1 -0
- package/dts/chart/utils/index.d.ts +3 -0
- package/dts/chart/utils/index.d.ts.map +1 -1
- package/dts/chart/utils/path.d.ts +59 -0
- package/dts/chart/utils/path.d.ts.map +1 -1
- package/dts/chart/utils/point.d.ts +71 -7
- package/dts/chart/utils/point.d.ts.map +1 -1
- package/dts/chart/utils/scale.d.ts +102 -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 +178 -0
- package/dts/chart/utils/transition.d.ts.map +1 -0
- package/esm/chart/CartesianChart.js +199 -75
- package/esm/chart/ChartContextBridge.js +159 -0
- package/esm/chart/ChartProvider.js +2 -2
- package/esm/chart/Path.js +200 -114
- package/esm/chart/PeriodSelector.js +7 -3
- package/esm/chart/__stories__/CartesianChart.stories.js +307 -134
- package/esm/chart/__stories__/ChartTransitions.stories.js +629 -0
- package/esm/chart/__stories__/PeriodSelector.stories.js +201 -75
- package/esm/chart/area/Area.js +27 -35
- package/esm/chart/area/AreaChart.js +17 -12
- package/esm/chart/area/DottedArea.js +64 -108
- package/esm/chart/area/GradientArea.js +37 -91
- package/esm/chart/area/SolidArea.js +24 -8
- package/esm/chart/area/__stories__/AreaChart.stories.js +1 -1
- package/esm/chart/axis/Axis.js +5 -39
- package/esm/chart/axis/DefaultAxisTickLabel.js +11 -0
- package/esm/chart/axis/XAxis.js +148 -66
- package/esm/chart/axis/YAxis.js +149 -65
- package/esm/chart/axis/__stories__/Axis.stories.js +259 -1
- package/esm/chart/axis/index.js +1 -0
- package/esm/chart/bar/Bar.js +7 -1
- package/esm/chart/bar/BarChart.js +17 -37
- package/esm/chart/bar/BarPlot.js +43 -35
- package/esm/chart/bar/BarStack.js +84 -37
- package/esm/chart/bar/BarStackGroup.js +7 -17
- package/esm/chart/bar/DefaultBar.js +29 -51
- package/esm/chart/bar/DefaultBarStack.js +34 -58
- package/esm/chart/bar/__stories__/BarChart.stories.js +948 -88
- package/esm/chart/gradient/Gradient.js +53 -0
- package/esm/chart/gradient/index.js +1 -0
- package/esm/chart/index.js +4 -1
- 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/DefaultReferenceLineLabel.js +66 -0
- package/esm/chart/line/DottedLine.js +31 -14
- package/esm/chart/line/Line.js +96 -68
- package/esm/chart/line/LineChart.js +21 -14
- package/esm/chart/line/ReferenceLine.js +80 -63
- package/esm/chart/line/SolidLine.js +27 -10
- package/esm/chart/line/__stories__/LineChart.stories.js +1748 -2048
- package/esm/chart/line/__stories__/ReferenceLine.stories.js +177 -28
- package/esm/chart/line/index.js +1 -1
- package/esm/chart/point/DefaultPointLabel.js +39 -0
- package/esm/chart/point/Point.js +186 -0
- package/esm/chart/point/index.js +2 -0
- package/esm/chart/scrubber/DefaultScrubberBeacon.js +180 -0
- package/esm/chart/scrubber/DefaultScrubberBeaconLabel.js +43 -0
- package/esm/chart/scrubber/DefaultScrubberLabel.js +28 -0
- package/esm/chart/scrubber/Scrubber.js +130 -144
- package/esm/chart/scrubber/ScrubberBeaconGroup.js +165 -0
- package/esm/chart/scrubber/ScrubberBeaconLabelGroup.js +208 -0
- package/esm/chart/scrubber/ScrubberProvider.js +46 -54
- package/esm/chart/scrubber/__stories__/Scrubber.stories.js +760 -0
- package/esm/chart/scrubber/index.js +3 -1
- package/esm/chart/text/ChartText.js +242 -174
- package/esm/chart/text/{SmartChartTextGroup.js → ChartTextGroup.js} +6 -5
- package/esm/chart/text/index.js +1 -1
- package/esm/chart/utils/axis.js +47 -31
- package/esm/chart/utils/bar.js +43 -0
- package/esm/chart/utils/chart.js +57 -3
- package/esm/chart/utils/gradient.js +305 -0
- package/esm/chart/utils/index.js +3 -0
- package/esm/chart/utils/path.js +84 -8
- package/esm/chart/utils/point.js +171 -17
- package/esm/chart/utils/scale.js +242 -2
- package/esm/chart/utils/scrubber.js +146 -0
- package/esm/chart/utils/transition.js +215 -0
- package/esm/sparkline/__figma__/Sparkline.figma.js +1 -1
- package/esm/sparkline/__stories__/Sparkline.stories.js +11 -7
- package/esm/sparkline/__stories__/SparklineGradient.stories.js +7 -4
- package/esm/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.js +1 -1
- package/esm/sparkline/sparkline-interactive/__stories__/SparklineInteractive.stories.js +51 -26
- package/esm/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.js +1 -1
- package/esm/sparkline/sparkline-interactive-header/__stories__/SparklineInteractiveHeader.stories.js +17 -9
- package/package.json +15 -10
- package/dts/chart/Point.d.ts +0 -103
- package/dts/chart/Point.d.ts.map +0 -1
- package/dts/chart/line/GradientLine.d.ts +0 -45
- package/dts/chart/line/GradientLine.d.ts.map +0 -1
- package/dts/chart/scrubber/ScrubberBeacon.d.ts +0 -75
- package/dts/chart/scrubber/ScrubberBeacon.d.ts.map +0 -1
- package/dts/chart/text/SmartChartTextGroup.d.ts.map +0 -1
- package/esm/chart/Point.js +0 -111
- package/esm/chart/__stories__/Chart.stories.js +0 -79
- package/esm/chart/line/GradientLine.js +0 -62
- package/esm/chart/scrubber/ScrubberBeacon.js +0 -199
|
@@ -1,35 +1,52 @@
|
|
|
1
|
-
const _excluded = ["fill", "stroke", "
|
|
1
|
+
const _excluded = ["fill", "stroke", "dashIntervals", "strokeCap", "strokeJoin", "strokeOpacity", "strokeWidth", "gradient", "yAxisId", "d", "animate", "transitions", "transition"];
|
|
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 { memo } from 'react';
|
|
5
5
|
import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
|
|
6
|
+
import { DashPathEffect } from '@shopify/react-native-skia';
|
|
7
|
+
import { Gradient } from '../gradient';
|
|
6
8
|
import { Path } from '../Path';
|
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
10
|
/**
|
|
9
|
-
* A customizable dotted line component
|
|
11
|
+
* A customizable dotted line component.
|
|
12
|
+
* Supports gradient for gradient effects on the dots and smooth data transitions via AnimatedPath.
|
|
10
13
|
*/
|
|
11
14
|
export const DottedLine = /*#__PURE__*/memo(_ref => {
|
|
12
15
|
let {
|
|
13
16
|
fill = 'none',
|
|
14
17
|
stroke,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
dashIntervals = [0, 4],
|
|
19
|
+
strokeCap = 'round',
|
|
20
|
+
strokeJoin = 'round',
|
|
18
21
|
strokeOpacity = 1,
|
|
19
22
|
strokeWidth = 2,
|
|
20
|
-
|
|
23
|
+
gradient,
|
|
24
|
+
yAxisId,
|
|
25
|
+
d,
|
|
26
|
+
animate,
|
|
27
|
+
transitions,
|
|
28
|
+
transition
|
|
21
29
|
} = _ref,
|
|
22
30
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
23
31
|
const theme = useTheme();
|
|
24
|
-
return /*#__PURE__*/
|
|
32
|
+
return /*#__PURE__*/_jsxs(Path, _extends({
|
|
33
|
+
animate: animate,
|
|
25
34
|
clipOffset: strokeWidth,
|
|
35
|
+
d: d,
|
|
26
36
|
fill: fill,
|
|
27
|
-
stroke: stroke != null ? stroke : theme.color.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
strokeLinejoin: strokeLinejoin,
|
|
37
|
+
stroke: stroke != null ? stroke : theme.color.fgPrimary,
|
|
38
|
+
strokeCap: strokeCap,
|
|
39
|
+
strokeJoin: strokeJoin,
|
|
31
40
|
strokeOpacity: strokeOpacity,
|
|
32
41
|
strokeWidth: strokeWidth,
|
|
33
|
-
|
|
34
|
-
|
|
42
|
+
transition: transition,
|
|
43
|
+
transitions: transitions
|
|
44
|
+
}, props, {
|
|
45
|
+
children: [/*#__PURE__*/_jsx(DashPathEffect, {
|
|
46
|
+
intervals: dashIntervals
|
|
47
|
+
}), gradient && /*#__PURE__*/_jsx(Gradient, {
|
|
48
|
+
gradient: gradient,
|
|
49
|
+
yAxisId: yAxisId
|
|
50
|
+
})]
|
|
51
|
+
}));
|
|
35
52
|
});
|
package/esm/chart/line/Line.js
CHANGED
|
@@ -1,70 +1,57 @@
|
|
|
1
|
-
const _excluded = ["seriesId", "curve", "type", "areaType", "areaBaseline", "stroke", "showArea", "LineComponent", "AreaComponent", "opacity", "
|
|
1
|
+
const _excluded = ["seriesId", "curve", "type", "areaType", "areaBaseline", "stroke", "strokeOpacity", "showArea", "LineComponent", "AreaComponent", "opacity", "points", "connectNulls", "transitions", "transition", "gradient"];
|
|
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, { memo, useMemo } from 'react';
|
|
5
|
-
import { useTheme } from '@coinbase/cds-mobile
|
|
5
|
+
import { useTheme } from '@coinbase/cds-mobile';
|
|
6
|
+
import { Group } from '@shopify/react-native-skia';
|
|
6
7
|
import { Area } from '../area/Area';
|
|
7
8
|
import { useCartesianChartContext } from '../ChartProvider';
|
|
8
|
-
import { Point } from '../
|
|
9
|
-
import { getLinePath } from '../utils';
|
|
9
|
+
import { Point } from '../point';
|
|
10
|
+
import { getLineData, getLinePath } from '../utils';
|
|
11
|
+
import { evaluateGradientAtValue, getGradientStops } from '../utils/gradient';
|
|
12
|
+
import { convertToSerializableScale } from '../utils/scale';
|
|
10
13
|
import { DottedLine } from './DottedLine';
|
|
11
|
-
import { GradientLine } from './GradientLine';
|
|
12
14
|
import { SolidLine } from './SolidLine';
|
|
13
15
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
16
|
export const Line = /*#__PURE__*/memo(_ref => {
|
|
15
17
|
var _ref2;
|
|
16
18
|
let {
|
|
17
19
|
seriesId,
|
|
18
|
-
curve = '
|
|
20
|
+
curve = 'bump',
|
|
19
21
|
type = 'solid',
|
|
20
22
|
areaType = 'gradient',
|
|
21
23
|
areaBaseline,
|
|
22
|
-
stroke:
|
|
23
|
-
|
|
24
|
+
stroke: strokeProp,
|
|
25
|
+
strokeOpacity,
|
|
26
|
+
showArea,
|
|
24
27
|
LineComponent: SelectedLineComponent,
|
|
25
28
|
AreaComponent,
|
|
26
29
|
opacity = 1,
|
|
27
|
-
|
|
30
|
+
points,
|
|
31
|
+
connectNulls,
|
|
32
|
+
transitions,
|
|
33
|
+
transition,
|
|
34
|
+
gradient: gradientProp
|
|
28
35
|
} = _ref,
|
|
29
36
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
30
37
|
const theme = useTheme();
|
|
31
38
|
const {
|
|
39
|
+
animate,
|
|
32
40
|
getSeries,
|
|
33
41
|
getSeriesData,
|
|
34
42
|
getXScale,
|
|
35
43
|
getYScale,
|
|
36
44
|
getXAxis
|
|
37
45
|
} = useCartesianChartContext();
|
|
38
|
-
const matchedSeries = getSeries(seriesId);
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const yScale = getYScale(matchedSeries == null ? void 0 : matchedSeries.yAxisId);
|
|
46
|
+
const matchedSeries = useMemo(() => getSeries(seriesId), [getSeries, seriesId]);
|
|
47
|
+
const gradient = useMemo(() => gradientProp != null ? gradientProp : matchedSeries == null ? void 0 : matchedSeries.gradient, [gradientProp, matchedSeries == null ? void 0 : matchedSeries.gradient]);
|
|
48
|
+
const sourceData = useMemo(() => getSeriesData(seriesId), [getSeriesData, seriesId]);
|
|
49
|
+
const xAxis = useMemo(() => getXAxis(), [getXAxis]);
|
|
50
|
+
const xScale = useMemo(() => getXScale(), [getXScale]);
|
|
51
|
+
const yScale = useMemo(() => getYScale(matchedSeries == null ? void 0 : matchedSeries.yAxisId), [getYScale, matchedSeries == null ? void 0 : matchedSeries.yAxisId]);
|
|
45
52
|
|
|
46
53
|
// Convert sourceData to number array (line only supports numbers, not tuples)
|
|
47
|
-
|
|
48
|
-
const chartData = useMemo(() => {
|
|
49
|
-
if (!sourceData) return [];
|
|
50
|
-
|
|
51
|
-
// Check if this is stacked data (array of tuples)
|
|
52
|
-
const firstNonNull = sourceData.find(d => d !== null);
|
|
53
|
-
if (Array.isArray(firstNonNull)) {
|
|
54
|
-
// Extract actual values from [baseline, value] tuples
|
|
55
|
-
return sourceData.map(d => {
|
|
56
|
-
if (d === null) return null;
|
|
57
|
-
if (Array.isArray(d)) return d[1];
|
|
58
|
-
return d;
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Regular number array
|
|
63
|
-
if (sourceData.every(d => typeof d === 'number' || d === null)) {
|
|
64
|
-
return sourceData;
|
|
65
|
-
}
|
|
66
|
-
return [];
|
|
67
|
-
}, [sourceData]);
|
|
54
|
+
const chartData = useMemo(() => getLineData(sourceData), [sourceData]);
|
|
68
55
|
const path = useMemo(() => {
|
|
69
56
|
if (!xScale || !yScale || chartData.length === 0) return '';
|
|
70
57
|
|
|
@@ -75,9 +62,10 @@ export const Line = /*#__PURE__*/memo(_ref => {
|
|
|
75
62
|
xScale,
|
|
76
63
|
yScale,
|
|
77
64
|
curve,
|
|
78
|
-
xData
|
|
65
|
+
xData,
|
|
66
|
+
connectNulls
|
|
79
67
|
});
|
|
80
|
-
}, [chartData, xScale, yScale, curve, xAxis == null ? void 0 : xAxis.data]);
|
|
68
|
+
}, [chartData, xScale, yScale, curve, xAxis == null ? void 0 : xAxis.data, connectNulls]);
|
|
81
69
|
const LineComponent = useMemo(() => {
|
|
82
70
|
if (SelectedLineComponent) {
|
|
83
71
|
return SelectedLineComponent;
|
|
@@ -85,55 +73,95 @@ export const Line = /*#__PURE__*/memo(_ref => {
|
|
|
85
73
|
switch (type) {
|
|
86
74
|
case 'dotted':
|
|
87
75
|
return DottedLine;
|
|
88
|
-
case 'gradient':
|
|
89
|
-
return GradientLine;
|
|
90
|
-
case 'solid':
|
|
91
76
|
default:
|
|
92
77
|
return SolidLine;
|
|
93
78
|
}
|
|
94
79
|
}, [SelectedLineComponent, type]);
|
|
95
|
-
|
|
80
|
+
|
|
81
|
+
// Get series color for stroke
|
|
82
|
+
const stroke = (_ref2 = strokeProp != null ? strokeProp : matchedSeries == null ? void 0 : matchedSeries.color) != null ? _ref2 : theme.color.fgPrimary;
|
|
96
83
|
const xData = useMemo(() => {
|
|
97
84
|
const data = xAxis == null ? void 0 : xAxis.data;
|
|
98
85
|
return data && Array.isArray(data) && data.length > 0 && typeof data[0] === 'number' ? data : null;
|
|
99
86
|
}, [xAxis == null ? void 0 : xAxis.data]);
|
|
100
|
-
|
|
87
|
+
const gradientConfig = useMemo(() => {
|
|
88
|
+
if (!gradient || !xScale || !yScale) return;
|
|
89
|
+
const gradientScale = gradient.axis === 'x' ? xScale : yScale;
|
|
90
|
+
const serializableScale = convertToSerializableScale(gradientScale);
|
|
91
|
+
if (!serializableScale) return;
|
|
92
|
+
const domain = {
|
|
93
|
+
min: serializableScale.domain[0],
|
|
94
|
+
max: serializableScale.domain[1]
|
|
95
|
+
};
|
|
96
|
+
const stops = getGradientStops(gradient.stops, domain);
|
|
97
|
+
return {
|
|
98
|
+
scale: serializableScale,
|
|
99
|
+
stops
|
|
100
|
+
};
|
|
101
|
+
}, [gradient, xScale, yScale]);
|
|
102
|
+
if (!xScale || !yScale || !path) return;
|
|
101
103
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
102
104
|
children: [showArea && /*#__PURE__*/_jsx(Area, {
|
|
103
105
|
AreaComponent: AreaComponent,
|
|
104
106
|
baseline: areaBaseline,
|
|
107
|
+
connectNulls: connectNulls,
|
|
105
108
|
curve: curve,
|
|
106
109
|
fill: stroke,
|
|
107
110
|
fillOpacity: opacity,
|
|
111
|
+
gradient: gradient,
|
|
108
112
|
seriesId: seriesId,
|
|
113
|
+
transition: transition,
|
|
114
|
+
transitions: transitions,
|
|
109
115
|
type: areaType
|
|
110
116
|
}), /*#__PURE__*/_jsx(LineComponent, _extends({
|
|
111
117
|
d: path,
|
|
118
|
+
gradient: gradient,
|
|
112
119
|
stroke: stroke,
|
|
113
|
-
strokeOpacity: opacity
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
120
|
+
strokeOpacity: strokeOpacity != null ? strokeOpacity : opacity,
|
|
121
|
+
transition: transition,
|
|
122
|
+
transitions: transitions,
|
|
123
|
+
yAxisId: matchedSeries == null ? void 0 : matchedSeries.yAxisId
|
|
124
|
+
}, props)), points && /*#__PURE__*/_jsx(Group, {
|
|
125
|
+
children: chartData.map((value, index) => {
|
|
126
|
+
if (value === null) return;
|
|
127
|
+
const xValue = xData && xData[index] !== undefined ? xData[index] : index;
|
|
128
|
+
let pointFill = stroke;
|
|
129
|
+
if (gradientConfig && gradient) {
|
|
130
|
+
var _gradient$axis;
|
|
131
|
+
// Use the appropriate data value based on gradient axis
|
|
132
|
+
const axis = (_gradient$axis = gradient.axis) != null ? _gradient$axis : 'y';
|
|
133
|
+
const dataValue = axis === 'x' ? xValue : value;
|
|
134
|
+
const evaluatedColor = evaluateGradientAtValue(gradientConfig.stops, dataValue, gradientConfig.scale);
|
|
135
|
+
if (evaluatedColor) {
|
|
136
|
+
// Apply gradient color to fill if not explicitly set
|
|
137
|
+
pointFill = evaluatedColor;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Build defaults that would be passed to Point
|
|
142
|
+
const defaults = {
|
|
143
|
+
dataX: xValue,
|
|
144
|
+
dataY: value,
|
|
145
|
+
fill: pointFill,
|
|
146
|
+
yAxisId: matchedSeries == null ? void 0 : matchedSeries.yAxisId,
|
|
147
|
+
opacity
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
// If points is true, render with defaults
|
|
151
|
+
if (points === true) {
|
|
152
|
+
return /*#__PURE__*/_jsx(Point, _extends({
|
|
153
|
+
transition: transition
|
|
154
|
+
}, defaults), seriesId + "-" + xValue);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Call the function with defaults
|
|
158
|
+
const result = points(defaults);
|
|
159
|
+
if (!result) return;
|
|
160
|
+
const pointConfig = result === true ? {} : result;
|
|
161
|
+
return /*#__PURE__*/_jsx(Point, _extends({
|
|
162
|
+
transition: transition
|
|
163
|
+
}, defaults, pointConfig), seriesId + "-" + xValue);
|
|
164
|
+
})
|
|
137
165
|
})]
|
|
138
166
|
});
|
|
139
167
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["series", "showArea", "areaType", "type", "LineComponent", "AreaComponent", "curve", "
|
|
1
|
+
const _excluded = ["series", "showArea", "areaType", "type", "LineComponent", "AreaComponent", "curve", "points", "strokeWidth", "strokeOpacity", "connectNulls", "transition", "opacity", "showXAxis", "showYAxis", "xAxis", "yAxis", "inset", "children"],
|
|
2
2
|
_excluded2 = ["scaleType", "data", "categoryPadding", "domain", "domainLimit", "range"],
|
|
3
3
|
_excluded3 = ["scaleType", "data", "categoryPadding", "domain", "domainLimit", "range", "id"],
|
|
4
4
|
_excluded4 = ["id", "data", "label", "color", "yAxisId"];
|
|
@@ -20,23 +20,21 @@ export const LineChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
|
|
|
20
20
|
LineComponent,
|
|
21
21
|
AreaComponent,
|
|
22
22
|
curve,
|
|
23
|
-
|
|
23
|
+
points,
|
|
24
24
|
strokeWidth,
|
|
25
|
+
strokeOpacity,
|
|
26
|
+
connectNulls,
|
|
27
|
+
transition,
|
|
28
|
+
opacity,
|
|
25
29
|
showXAxis,
|
|
26
30
|
showYAxis,
|
|
27
31
|
xAxis,
|
|
28
32
|
yAxis,
|
|
29
|
-
inset
|
|
33
|
+
inset,
|
|
30
34
|
children
|
|
31
35
|
} = _ref,
|
|
32
36
|
chartProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
33
|
-
const calculatedInset = useMemo(() => getChartInset(
|
|
34
|
-
|
|
35
|
-
// Check if we have valid data across all series
|
|
36
|
-
const hasData = useMemo(() => {
|
|
37
|
-
if (!series || series.length === 0) return false;
|
|
38
|
-
return series.some(s => s.data && s.data.length > 0);
|
|
39
|
-
}, [series]);
|
|
37
|
+
const calculatedInset = useMemo(() => getChartInset(inset, defaultChartInset), [inset]);
|
|
40
38
|
|
|
41
39
|
// Convert LineSeries to Series for Chart context
|
|
42
40
|
const chartSeries = useMemo(() => {
|
|
@@ -44,7 +42,11 @@ export const LineChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
|
|
|
44
42
|
id: s.id,
|
|
45
43
|
data: s.data,
|
|
46
44
|
label: s.label,
|
|
47
|
-
color: s.color
|
|
45
|
+
color: s.color,
|
|
46
|
+
yAxisId: s.yAxisId,
|
|
47
|
+
stackId: s.stackId,
|
|
48
|
+
gradient: s.gradient,
|
|
49
|
+
legendShape: s.legendShape
|
|
48
50
|
}));
|
|
49
51
|
}, [series]);
|
|
50
52
|
|
|
@@ -94,7 +96,8 @@ export const LineChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
|
|
|
94
96
|
yAxis: yAxisConfig,
|
|
95
97
|
children: [showXAxis && /*#__PURE__*/_jsx(XAxis, _extends({}, xAxisVisualProps)), showYAxis && /*#__PURE__*/_jsx(YAxis, _extends({
|
|
96
98
|
axisId: yAxisId
|
|
97
|
-
}, yAxisVisualProps)),
|
|
99
|
+
}, yAxisVisualProps)), series == null ? void 0 : series.map(_ref4 => {
|
|
100
|
+
var _linePropsFromSeries$;
|
|
98
101
|
let {
|
|
99
102
|
id
|
|
100
103
|
} = _ref4,
|
|
@@ -103,13 +106,17 @@ export const LineChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
|
|
|
103
106
|
AreaComponent: AreaComponent,
|
|
104
107
|
LineComponent: LineComponent,
|
|
105
108
|
areaType: areaType,
|
|
109
|
+
connectNulls: connectNulls,
|
|
106
110
|
curve: curve,
|
|
107
|
-
|
|
111
|
+
opacity: opacity,
|
|
112
|
+
points: points,
|
|
108
113
|
seriesId: id,
|
|
109
114
|
showArea: showArea,
|
|
115
|
+
strokeOpacity: strokeOpacity,
|
|
110
116
|
strokeWidth: strokeWidth,
|
|
117
|
+
transition: (_linePropsFromSeries$ = linePropsFromSeries.transition) != null ? _linePropsFromSeries$ : transition,
|
|
111
118
|
type: type
|
|
112
119
|
}, linePropsFromSeries), id);
|
|
113
|
-
})
|
|
120
|
+
}), children]
|
|
114
121
|
}));
|
|
115
122
|
}));
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { G } from 'react-native-svg';
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
import { useDerivedValue } from 'react-native-reanimated';
|
|
4
3
|
import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
|
|
5
4
|
import { useCartesianChartContext } from '../ChartProvider';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { unwrapAnimatedValue } from '../utils';
|
|
6
|
+
import { getPointOnSerializableScale } from '../utils/point';
|
|
7
|
+
import { DefaultReferenceLineLabel } from './DefaultReferenceLineLabel';
|
|
8
8
|
import { DottedLine } from './DottedLine';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Configuration for ReferenceLine label rendering using ChartText.
|
|
12
|
-
*/
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
10
|
export const ReferenceLine = /*#__PURE__*/memo(_ref => {
|
|
15
11
|
let {
|
|
16
12
|
dataX,
|
|
@@ -18,44 +14,60 @@ export const ReferenceLine = /*#__PURE__*/memo(_ref => {
|
|
|
18
14
|
yAxisId,
|
|
19
15
|
label,
|
|
20
16
|
labelPosition = dataY !== undefined ? 'right' : 'top',
|
|
21
|
-
testID,
|
|
22
17
|
LineComponent = DottedLine,
|
|
18
|
+
LabelComponent = DefaultReferenceLineLabel,
|
|
19
|
+
labelElevated,
|
|
20
|
+
labelFont,
|
|
21
|
+
labelDx,
|
|
22
|
+
labelDy,
|
|
23
|
+
labelHorizontalAlignment,
|
|
24
|
+
labelVerticalAlignment,
|
|
25
|
+
labelBoundsInset,
|
|
23
26
|
stroke,
|
|
24
|
-
|
|
27
|
+
opacity = 1
|
|
25
28
|
} = _ref;
|
|
26
29
|
const theme = useTheme();
|
|
27
30
|
const {
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
getXSerializableScale,
|
|
32
|
+
getYSerializableScale,
|
|
30
33
|
drawingArea
|
|
31
34
|
} = useCartesianChartContext();
|
|
35
|
+
const xScale = getXSerializableScale();
|
|
36
|
+
const yScale = getYSerializableScale(yAxisId);
|
|
32
37
|
const effectiveLineStroke = stroke != null ? stroke : theme.color.bgLine;
|
|
33
38
|
|
|
34
|
-
//
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}, dataY
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
|
|
39
|
+
// For horizontal lines (dataY defined): default to verticalAlignment: 'middle'
|
|
40
|
+
// For vertical lines (dataX defined): default to horizontalAlignment: 'center'
|
|
41
|
+
const isHorizontal = dataY !== undefined;
|
|
42
|
+
const xPixel = useDerivedValue(() => {
|
|
43
|
+
const dataXValue = unwrapAnimatedValue(dataX);
|
|
44
|
+
return dataXValue !== undefined && xScale ? getPointOnSerializableScale(dataXValue, xScale) : undefined;
|
|
45
|
+
}, [dataX, xScale]);
|
|
46
|
+
const yPixel = useDerivedValue(() => {
|
|
47
|
+
const dataYValue = unwrapAnimatedValue(dataY);
|
|
48
|
+
return dataYValue !== undefined && yScale ? getPointOnSerializableScale(dataYValue, yScale) : undefined;
|
|
49
|
+
}, [dataY, yScale]);
|
|
50
|
+
const horizontalLine = useDerivedValue(() => {
|
|
51
|
+
if (yPixel.value === undefined) return;
|
|
52
|
+
return "M" + drawingArea.x + "," + yPixel.value + " L" + (drawingArea.x + drawingArea.width) + "," + yPixel.value;
|
|
53
|
+
}, [drawingArea, yPixel]);
|
|
54
|
+
const verticalLine = useDerivedValue(() => {
|
|
55
|
+
if (xPixel.value === undefined) return;
|
|
56
|
+
return "M" + xPixel.value + "," + drawingArea.y + " L" + xPixel.value + "," + (drawingArea.y + drawingArea.height);
|
|
57
|
+
}, [drawingArea, xPixel]);
|
|
58
|
+
const labelXPixel = useDerivedValue(() => {
|
|
59
|
+
var _xPixel$value;
|
|
60
|
+
return (_xPixel$value = xPixel.value) != null ? _xPixel$value : 0;
|
|
61
|
+
}, [xPixel]);
|
|
62
|
+
const labelYPixel = useDerivedValue(() => {
|
|
63
|
+
var _yPixel$value;
|
|
64
|
+
return (_yPixel$value = yPixel.value) != null ? _yPixel$value : 0;
|
|
65
|
+
}, [yPixel]);
|
|
66
|
+
const labelOpacity = useDerivedValue(() => {
|
|
67
|
+
const isVisible = dataY !== undefined && yPixel.value !== undefined || dataX !== undefined && xPixel.value !== undefined;
|
|
68
|
+
return isVisible ? unwrapAnimatedValue(opacity) : 0;
|
|
69
|
+
}, [yPixel, xPixel, opacity]);
|
|
50
70
|
if (dataY !== undefined) {
|
|
51
|
-
const yScale = getYScale(yAxisId);
|
|
52
|
-
|
|
53
|
-
// Don't render if we don't have a scale
|
|
54
|
-
if (!yScale) {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
const yPixel = yScale(dataY);
|
|
58
|
-
if (yPixel === undefined) return null;
|
|
59
71
|
let labelX;
|
|
60
72
|
if (labelPosition === 'left') {
|
|
61
73
|
labelX = drawingArea.x;
|
|
@@ -64,30 +76,30 @@ export const ReferenceLine = /*#__PURE__*/memo(_ref => {
|
|
|
64
76
|
} else {
|
|
65
77
|
labelX = drawingArea.x + drawingArea.width;
|
|
66
78
|
}
|
|
67
|
-
return /*#__PURE__*/_jsxs(
|
|
68
|
-
"data-testid": testID,
|
|
79
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
69
80
|
children: [/*#__PURE__*/_jsx(LineComponent, {
|
|
70
81
|
animate: false,
|
|
71
|
-
d:
|
|
72
|
-
stroke: effectiveLineStroke
|
|
73
|
-
|
|
82
|
+
d: horizontalLine,
|
|
83
|
+
stroke: effectiveLineStroke,
|
|
84
|
+
strokeOpacity: opacity
|
|
85
|
+
}), label && /*#__PURE__*/_jsx(LabelComponent, {
|
|
86
|
+
boundsInset: labelBoundsInset,
|
|
87
|
+
dx: labelDx,
|
|
88
|
+
dy: labelDy,
|
|
89
|
+
elevated: labelElevated,
|
|
90
|
+
font: labelFont,
|
|
91
|
+
horizontalAlignment: labelHorizontalAlignment,
|
|
92
|
+
opacity: labelOpacity,
|
|
93
|
+
verticalAlignment: labelVerticalAlignment != null ? labelVerticalAlignment : isHorizontal ? 'middle' : undefined,
|
|
74
94
|
x: labelX,
|
|
75
|
-
y:
|
|
95
|
+
y: labelYPixel,
|
|
76
96
|
children: label
|
|
77
|
-
})
|
|
97
|
+
})]
|
|
78
98
|
});
|
|
79
99
|
}
|
|
80
100
|
|
|
81
101
|
// Vertical reference line logic
|
|
82
102
|
if (dataX !== undefined) {
|
|
83
|
-
const xScale = getXScale();
|
|
84
|
-
|
|
85
|
-
// Don't render if we don't have scales
|
|
86
|
-
if (!xScale) {
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
const xPixel = getPointOnScale(dataX, xScale);
|
|
90
|
-
if (xPixel === undefined) return null;
|
|
91
103
|
let labelY;
|
|
92
104
|
if (labelPosition === 'top') {
|
|
93
105
|
labelY = drawingArea.y;
|
|
@@ -96,20 +108,25 @@ export const ReferenceLine = /*#__PURE__*/memo(_ref => {
|
|
|
96
108
|
} else {
|
|
97
109
|
labelY = drawingArea.y + drawingArea.height;
|
|
98
110
|
}
|
|
99
|
-
return /*#__PURE__*/_jsxs(
|
|
100
|
-
"data-testid": testID,
|
|
111
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
101
112
|
children: [/*#__PURE__*/_jsx(LineComponent, {
|
|
102
113
|
animate: false,
|
|
103
|
-
d:
|
|
104
|
-
stroke: effectiveLineStroke
|
|
105
|
-
|
|
106
|
-
|
|
114
|
+
d: verticalLine,
|
|
115
|
+
stroke: effectiveLineStroke,
|
|
116
|
+
strokeOpacity: opacity
|
|
117
|
+
}), label && /*#__PURE__*/_jsx(LabelComponent, {
|
|
118
|
+
boundsInset: labelBoundsInset,
|
|
119
|
+
dx: labelDx,
|
|
120
|
+
dy: labelDy,
|
|
121
|
+
elevated: labelElevated,
|
|
122
|
+
font: labelFont,
|
|
123
|
+
horizontalAlignment: labelHorizontalAlignment != null ? labelHorizontalAlignment : !isHorizontal ? 'center' : undefined,
|
|
124
|
+
opacity: labelOpacity,
|
|
125
|
+
verticalAlignment: labelVerticalAlignment,
|
|
126
|
+
x: labelXPixel,
|
|
107
127
|
y: labelY,
|
|
108
128
|
children: label
|
|
109
|
-
})
|
|
129
|
+
})]
|
|
110
130
|
});
|
|
111
131
|
}
|
|
112
|
-
|
|
113
|
-
// Should not reach here if types are correct
|
|
114
|
-
return null;
|
|
115
132
|
});
|
|
@@ -1,31 +1,48 @@
|
|
|
1
|
-
const _excluded = ["fill", "stroke", "
|
|
1
|
+
const _excluded = ["fill", "stroke", "strokeCap", "strokeJoin", "strokeOpacity", "strokeWidth", "gradient", "yAxisId", "d", "animate", "transitions", "transition"];
|
|
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 { memo } from 'react';
|
|
5
5
|
import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
|
|
6
|
+
import { Gradient } from '../gradient';
|
|
6
7
|
import { Path } from '../Path';
|
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
9
|
/**
|
|
9
|
-
* A customizable solid line component
|
|
10
|
+
* A customizable solid line component.
|
|
11
|
+
* Supports gradient for gradient effects and smooth data transitions via AnimatedPath.
|
|
10
12
|
*/
|
|
11
13
|
export const SolidLine = /*#__PURE__*/memo(_ref => {
|
|
12
14
|
let {
|
|
13
15
|
fill = 'none',
|
|
14
16
|
stroke,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
strokeCap = 'round',
|
|
18
|
+
strokeJoin = 'round',
|
|
17
19
|
strokeOpacity = 1,
|
|
18
|
-
strokeWidth = 2
|
|
20
|
+
strokeWidth = 2,
|
|
21
|
+
gradient,
|
|
22
|
+
yAxisId,
|
|
23
|
+
d,
|
|
24
|
+
animate,
|
|
25
|
+
transitions,
|
|
26
|
+
transition
|
|
19
27
|
} = _ref,
|
|
20
28
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
21
29
|
const theme = useTheme();
|
|
22
30
|
return /*#__PURE__*/_jsx(Path, _extends({
|
|
31
|
+
animate: animate,
|
|
23
32
|
clipOffset: strokeWidth,
|
|
33
|
+
d: d,
|
|
24
34
|
fill: fill,
|
|
25
|
-
stroke: stroke != null ? stroke : theme.color.
|
|
26
|
-
|
|
27
|
-
|
|
35
|
+
stroke: stroke != null ? stroke : theme.color.fgPrimary,
|
|
36
|
+
strokeCap: strokeCap,
|
|
37
|
+
strokeJoin: strokeJoin,
|
|
28
38
|
strokeOpacity: strokeOpacity,
|
|
29
|
-
strokeWidth: strokeWidth
|
|
30
|
-
|
|
39
|
+
strokeWidth: strokeWidth,
|
|
40
|
+
transition: transition,
|
|
41
|
+
transitions: transitions
|
|
42
|
+
}, props, {
|
|
43
|
+
children: gradient && /*#__PURE__*/_jsx(Gradient, {
|
|
44
|
+
gradient: gradient,
|
|
45
|
+
yAxisId: yAxisId
|
|
46
|
+
})
|
|
47
|
+
}));
|
|
31
48
|
});
|