@coinbase/cds-web-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 +122 -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 +99 -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 +303 -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 +56 -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 +45 -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 +101 -392
- package/esm/chart/scrubber/ScrubberBeaconGroup.js +174 -0
- package/esm/chart/scrubber/ScrubberBeaconLabelGroup.js +209 -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
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
const _excluded = ["flexDirection", "justifyContent", "alignItems", "flexWrap", "columnGap", "rowGap", "seriesIds", "EntryComponent", "ShapeComponent", "accessibilityLabel", "className", "classNames", "style", "styles"];
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
8
|
+
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; }
|
|
9
|
+
import { forwardRef, memo, useMemo } from 'react';
|
|
10
|
+
import { Box } from '@coinbase/cds-web/layout';
|
|
11
|
+
import { useCartesianChartContext } from '../ChartProvider';
|
|
12
|
+
import { DefaultLegendEntry } from './DefaultLegendEntry';
|
|
13
|
+
import { DefaultLegendShape } from './DefaultLegendShape';
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
export const Legend = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
|
|
16
|
+
var _classNames$root;
|
|
17
|
+
let {
|
|
18
|
+
flexDirection = 'row',
|
|
19
|
+
justifyContent = 'center',
|
|
20
|
+
alignItems = flexDirection === 'row' ? 'center' : 'flex-start',
|
|
21
|
+
flexWrap = 'wrap',
|
|
22
|
+
columnGap = 2,
|
|
23
|
+
rowGap = 0.75,
|
|
24
|
+
seriesIds,
|
|
25
|
+
EntryComponent = DefaultLegendEntry,
|
|
26
|
+
ShapeComponent = DefaultLegendShape,
|
|
27
|
+
accessibilityLabel = 'Legend',
|
|
28
|
+
className,
|
|
29
|
+
classNames,
|
|
30
|
+
style,
|
|
31
|
+
styles
|
|
32
|
+
} = _ref,
|
|
33
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
34
|
+
const {
|
|
35
|
+
series
|
|
36
|
+
} = useCartesianChartContext();
|
|
37
|
+
const filteredSeries = useMemo(() => {
|
|
38
|
+
if (seriesIds === undefined) return series;
|
|
39
|
+
return series.filter(s => seriesIds.includes(s.id));
|
|
40
|
+
}, [series, seriesIds]);
|
|
41
|
+
if (filteredSeries.length === 0) return;
|
|
42
|
+
return /*#__PURE__*/_jsx(Box, _objectSpread(_objectSpread({
|
|
43
|
+
ref: ref,
|
|
44
|
+
accessibilityLabel: accessibilityLabel,
|
|
45
|
+
alignItems: alignItems,
|
|
46
|
+
className: (_classNames$root = classNames === null || classNames === void 0 ? void 0 : classNames.root) !== null && _classNames$root !== void 0 ? _classNames$root : className,
|
|
47
|
+
columnGap: columnGap,
|
|
48
|
+
flexDirection: flexDirection,
|
|
49
|
+
flexWrap: flexWrap,
|
|
50
|
+
justifyContent: justifyContent,
|
|
51
|
+
role: "group",
|
|
52
|
+
rowGap: rowGap,
|
|
53
|
+
style: _objectSpread(_objectSpread({}, style), styles === null || styles === void 0 ? void 0 : styles.root)
|
|
54
|
+
}, props), {}, {
|
|
55
|
+
children: filteredSeries.map(s => {
|
|
56
|
+
var _s$label;
|
|
57
|
+
return /*#__PURE__*/_jsx(EntryComponent, {
|
|
58
|
+
ShapeComponent: ShapeComponent,
|
|
59
|
+
classNames: {
|
|
60
|
+
root: classNames === null || classNames === void 0 ? void 0 : classNames.entry,
|
|
61
|
+
shape: classNames === null || classNames === void 0 ? void 0 : classNames.entryShape,
|
|
62
|
+
label: classNames === null || classNames === void 0 ? void 0 : classNames.entryLabel
|
|
63
|
+
},
|
|
64
|
+
color: s.color,
|
|
65
|
+
label: (_s$label = s.label) !== null && _s$label !== void 0 ? _s$label : s.id,
|
|
66
|
+
seriesId: s.id,
|
|
67
|
+
shape: s.legendShape,
|
|
68
|
+
styles: {
|
|
69
|
+
root: styles === null || styles === void 0 ? void 0 : styles.entry,
|
|
70
|
+
shape: styles === null || styles === void 0 ? void 0 : styles.entryShape,
|
|
71
|
+
label: styles === null || styles === void 0 ? void 0 : styles.entryLabel
|
|
72
|
+
}
|
|
73
|
+
}, s.id);
|
|
74
|
+
})
|
|
75
|
+
}));
|
|
76
|
+
}));
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
const _excluded = ["color", "elevated", "borderRadius", "inset", "boundsInset", "className", "classNames", "style", "styles"];
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
8
|
+
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; }
|
|
9
|
+
import { memo, useMemo } from 'react';
|
|
10
|
+
import { useCartesianChartContext } from '../ChartProvider';
|
|
11
|
+
import { ChartText } from '../text';
|
|
12
|
+
import { getChartInset } from '../utils';
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
const elevatedInset = {
|
|
15
|
+
top: 8,
|
|
16
|
+
bottom: 8,
|
|
17
|
+
left: 12,
|
|
18
|
+
right: 12
|
|
19
|
+
};
|
|
20
|
+
const elevatedBorderRadius = 4;
|
|
21
|
+
// Default bounds inset when elevated to prevent shadow clipping
|
|
22
|
+
const elevatedBoundsInset = {
|
|
23
|
+
top: 4,
|
|
24
|
+
bottom: 20,
|
|
25
|
+
left: 12,
|
|
26
|
+
right: 12
|
|
27
|
+
};
|
|
28
|
+
const nonElevatedBoundsInset = {
|
|
29
|
+
top: 0,
|
|
30
|
+
bottom: 0,
|
|
31
|
+
left: 0,
|
|
32
|
+
right: 0
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* DefaultReferenceLineLabel is the default label component for ReferenceLine.
|
|
37
|
+
* Provides standard styling with elevation, inset, and color defaults.
|
|
38
|
+
* When elevated, automatically adds bounds to prevent shadow cutoff at chart edges.
|
|
39
|
+
*/
|
|
40
|
+
export const DefaultReferenceLineLabel = /*#__PURE__*/memo(_ref => {
|
|
41
|
+
let {
|
|
42
|
+
color = 'var(--color-fgMuted)',
|
|
43
|
+
elevated,
|
|
44
|
+
borderRadius = elevated ? elevatedBorderRadius : undefined,
|
|
45
|
+
inset = elevated ? elevatedInset : undefined,
|
|
46
|
+
boundsInset: boundsInsetProp,
|
|
47
|
+
className,
|
|
48
|
+
classNames,
|
|
49
|
+
style,
|
|
50
|
+
styles
|
|
51
|
+
} = _ref,
|
|
52
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
53
|
+
const {
|
|
54
|
+
width: chartWidth,
|
|
55
|
+
height: chartHeight
|
|
56
|
+
} = useCartesianChartContext();
|
|
57
|
+
const bounds = useMemo(() => {
|
|
58
|
+
const boundsInset = getChartInset(boundsInsetProp, elevated ? elevatedBoundsInset : nonElevatedBoundsInset);
|
|
59
|
+
return {
|
|
60
|
+
x: boundsInset.left,
|
|
61
|
+
y: boundsInset.top,
|
|
62
|
+
width: chartWidth - boundsInset.left - boundsInset.right,
|
|
63
|
+
height: chartHeight - boundsInset.top - boundsInset.bottom
|
|
64
|
+
};
|
|
65
|
+
}, [elevated, boundsInsetProp, chartWidth, chartHeight]);
|
|
66
|
+
const mergedClassNames = useMemo(() => _objectSpread(_objectSpread({}, className && {
|
|
67
|
+
text: className
|
|
68
|
+
}), classNames), [className, classNames]);
|
|
69
|
+
const mergedStyles = useMemo(() => _objectSpread(_objectSpread({}, style && {
|
|
70
|
+
text: style
|
|
71
|
+
}), styles), [style, styles]);
|
|
72
|
+
return /*#__PURE__*/_jsx(ChartText, _objectSpread({
|
|
73
|
+
borderRadius: borderRadius,
|
|
74
|
+
bounds: bounds,
|
|
75
|
+
classNames: mergedClassNames,
|
|
76
|
+
color: color,
|
|
77
|
+
elevated: elevated,
|
|
78
|
+
inset: inset,
|
|
79
|
+
styles: mergedStyles
|
|
80
|
+
}, props));
|
|
81
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["fill", "stroke", "strokeDasharray", "strokeLinecap", "strokeLinejoin", "strokeOpacity", "strokeWidth", "vectorEffect"];
|
|
1
|
+
const _excluded = ["fill", "stroke", "strokeDasharray", "strokeLinecap", "strokeLinejoin", "strokeOpacity", "strokeWidth", "vectorEffect", "gradient", "yAxisId", "animate", "transitions", "transition", "d"];
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -6,33 +6,57 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
8
8
|
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; }
|
|
9
|
-
import { memo } from 'react';
|
|
9
|
+
import { memo, useId } from 'react';
|
|
10
|
+
import { Gradient } from '../gradient';
|
|
10
11
|
import { Path } from '../Path';
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
13
|
/**
|
|
13
|
-
* A customizable dotted line component
|
|
14
|
+
* A customizable dotted line component.
|
|
15
|
+
* Supports gradient for gradient effects on the dots.
|
|
14
16
|
*/
|
|
15
17
|
export const DottedLine = /*#__PURE__*/memo(_ref => {
|
|
18
|
+
var _transitions$update;
|
|
16
19
|
let {
|
|
17
20
|
fill = 'none',
|
|
18
|
-
stroke = 'var(--color-
|
|
21
|
+
stroke = 'var(--color-fgPrimary)',
|
|
19
22
|
strokeDasharray = '0 4',
|
|
20
23
|
strokeLinecap = 'round',
|
|
21
24
|
strokeLinejoin = 'round',
|
|
22
25
|
strokeOpacity = 1,
|
|
23
26
|
strokeWidth = 2,
|
|
24
|
-
vectorEffect = 'non-scaling-stroke'
|
|
27
|
+
vectorEffect = 'non-scaling-stroke',
|
|
28
|
+
gradient,
|
|
29
|
+
yAxisId,
|
|
30
|
+
animate,
|
|
31
|
+
transitions,
|
|
32
|
+
transition,
|
|
33
|
+
d
|
|
25
34
|
} = _ref,
|
|
26
35
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
const gradientId = useId();
|
|
37
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
38
|
+
children: [gradient && /*#__PURE__*/_jsx("defs", {
|
|
39
|
+
children: /*#__PURE__*/_jsx(Gradient, {
|
|
40
|
+
animate: animate,
|
|
41
|
+
gradient: gradient,
|
|
42
|
+
id: gradientId,
|
|
43
|
+
transition: (_transitions$update = transitions === null || transitions === void 0 ? void 0 : transitions.update) !== null && _transitions$update !== void 0 ? _transitions$update : transition,
|
|
44
|
+
yAxisId: yAxisId
|
|
45
|
+
})
|
|
46
|
+
}), /*#__PURE__*/_jsx(Path, _objectSpread({
|
|
47
|
+
animate: animate,
|
|
48
|
+
clipOffset: strokeWidth,
|
|
49
|
+
d: d,
|
|
50
|
+
fill: fill,
|
|
51
|
+
stroke: gradient ? "url(#".concat(gradientId, ")") : stroke,
|
|
52
|
+
strokeDasharray: strokeDasharray,
|
|
53
|
+
strokeLinecap: strokeLinecap,
|
|
54
|
+
strokeLinejoin: strokeLinejoin,
|
|
55
|
+
strokeOpacity: strokeOpacity,
|
|
56
|
+
strokeWidth: strokeWidth,
|
|
57
|
+
transition: transition,
|
|
58
|
+
transitions: transitions,
|
|
59
|
+
vectorEffect: vectorEffect
|
|
60
|
+
}, props))]
|
|
61
|
+
});
|
|
38
62
|
});
|
package/esm/chart/line/Line.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["seriesId", "curve", "type", "areaType", "areaBaseline", "stroke", "onPointClick", "showArea", "LineComponent", "AreaComponent", "opacity", "
|
|
1
|
+
const _excluded = ["seriesId", "curve", "type", "areaType", "areaBaseline", "stroke", "strokeOpacity", "onPointClick", "showArea", "LineComponent", "AreaComponent", "opacity", "points", "connectNulls", "transitions", "transition", "gradient"];
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -7,31 +7,33 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
7
7
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
8
8
|
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; }
|
|
9
9
|
import React, { memo, useMemo } from 'react';
|
|
10
|
-
import { m as motion } from 'framer-motion';
|
|
11
10
|
import { Area } from '../area/Area';
|
|
12
|
-
import { axisTickLabelsInitialAnimationVariants } from '../axis';
|
|
13
11
|
import { useCartesianChartContext } from '../ChartProvider';
|
|
14
|
-
import { Point } from '../
|
|
15
|
-
import { getLinePath } from '../utils';
|
|
12
|
+
import { Point } from '../point';
|
|
13
|
+
import { evaluateGradientAtValue, getGradientConfig, getLineData, getLinePath } from '../utils';
|
|
16
14
|
import { DottedLine } from './DottedLine';
|
|
17
|
-
import { GradientLine } from './GradientLine';
|
|
18
15
|
import { SolidLine } from './SolidLine';
|
|
19
16
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
17
|
export const Line = /*#__PURE__*/memo(_ref => {
|
|
21
18
|
var _ref2;
|
|
22
19
|
let {
|
|
23
20
|
seriesId,
|
|
24
|
-
curve = '
|
|
21
|
+
curve = 'bump',
|
|
25
22
|
type = 'solid',
|
|
26
23
|
areaType = 'gradient',
|
|
27
24
|
areaBaseline,
|
|
28
|
-
stroke:
|
|
25
|
+
stroke: strokeProp,
|
|
26
|
+
strokeOpacity,
|
|
29
27
|
onPointClick,
|
|
30
28
|
showArea = false,
|
|
31
29
|
LineComponent: SelectedLineComponent,
|
|
32
30
|
AreaComponent,
|
|
33
31
|
opacity = 1,
|
|
34
|
-
|
|
32
|
+
points,
|
|
33
|
+
connectNulls,
|
|
34
|
+
transitions,
|
|
35
|
+
transition,
|
|
36
|
+
gradient: gradientProp
|
|
35
37
|
} = _ref,
|
|
36
38
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
37
39
|
const {
|
|
@@ -40,42 +42,18 @@ export const Line = /*#__PURE__*/memo(_ref => {
|
|
|
40
42
|
getSeriesData,
|
|
41
43
|
getXScale,
|
|
42
44
|
getYScale,
|
|
43
|
-
getXAxis
|
|
45
|
+
getXAxis,
|
|
46
|
+
getYAxis
|
|
44
47
|
} = useCartesianChartContext();
|
|
45
|
-
const matchedSeries = getSeries(seriesId);
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return getSeriesData(seriesId) || null;
|
|
52
|
-
}, [seriesId, getSeriesData]);
|
|
53
|
-
const xAxis = getXAxis();
|
|
54
|
-
const xScale = getXScale();
|
|
55
|
-
const yScale = getYScale(matchedSeries === null || matchedSeries === void 0 ? void 0 : matchedSeries.yAxisId);
|
|
48
|
+
const matchedSeries = useMemo(() => getSeries(seriesId), [getSeries, seriesId]);
|
|
49
|
+
const gradient = useMemo(() => gradientProp !== null && gradientProp !== void 0 ? gradientProp : matchedSeries === null || matchedSeries === void 0 ? void 0 : matchedSeries.gradient, [gradientProp, matchedSeries === null || matchedSeries === void 0 ? void 0 : matchedSeries.gradient]);
|
|
50
|
+
const sourceData = useMemo(() => getSeriesData(seriesId), [getSeriesData, seriesId]);
|
|
51
|
+
const xAxis = useMemo(() => getXAxis(), [getXAxis]);
|
|
52
|
+
const xScale = useMemo(() => getXScale(), [getXScale]);
|
|
53
|
+
const yScale = useMemo(() => getYScale(matchedSeries === null || matchedSeries === void 0 ? void 0 : matchedSeries.yAxisId), [getYScale, matchedSeries === null || matchedSeries === void 0 ? void 0 : matchedSeries.yAxisId]);
|
|
56
54
|
|
|
57
55
|
// Convert sourceData to number array (line only supports numbers, not tuples)
|
|
58
|
-
|
|
59
|
-
const chartData = useMemo(() => {
|
|
60
|
-
if (!sourceData) return [];
|
|
61
|
-
|
|
62
|
-
// Check if this is stacked data (array of tuples)
|
|
63
|
-
const firstNonNull = sourceData.find(d => d !== null);
|
|
64
|
-
if (Array.isArray(firstNonNull)) {
|
|
65
|
-
// Extract actual values from [baseline, value] tuples
|
|
66
|
-
return sourceData.map(d => {
|
|
67
|
-
if (d === null) return null;
|
|
68
|
-
if (Array.isArray(d)) return d[1];
|
|
69
|
-
return d;
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Regular number array
|
|
74
|
-
if (sourceData.every(d => typeof d === 'number' || d === null)) {
|
|
75
|
-
return sourceData;
|
|
76
|
-
}
|
|
77
|
-
return [];
|
|
78
|
-
}, [sourceData]);
|
|
56
|
+
const chartData = useMemo(() => getLineData(sourceData), [sourceData]);
|
|
79
57
|
const path = useMemo(() => {
|
|
80
58
|
if (!xScale || !yScale || chartData.length === 0) return '';
|
|
81
59
|
|
|
@@ -86,9 +64,10 @@ export const Line = /*#__PURE__*/memo(_ref => {
|
|
|
86
64
|
xScale,
|
|
87
65
|
yScale,
|
|
88
66
|
curve,
|
|
89
|
-
xData
|
|
67
|
+
xData,
|
|
68
|
+
connectNulls
|
|
90
69
|
});
|
|
91
|
-
}, [chartData, xScale, yScale, curve, xAxis === null || xAxis === void 0 ? void 0 : xAxis.data]);
|
|
70
|
+
}, [chartData, xScale, yScale, curve, xAxis === null || xAxis === void 0 ? void 0 : xAxis.data, connectNulls]);
|
|
92
71
|
const LineComponent = useMemo(() => {
|
|
93
72
|
if (SelectedLineComponent) {
|
|
94
73
|
return SelectedLineComponent;
|
|
@@ -96,64 +75,97 @@ export const Line = /*#__PURE__*/memo(_ref => {
|
|
|
96
75
|
switch (type) {
|
|
97
76
|
case 'dotted':
|
|
98
77
|
return DottedLine;
|
|
99
|
-
case 'gradient':
|
|
100
|
-
return GradientLine;
|
|
101
|
-
case 'solid':
|
|
102
78
|
default:
|
|
103
79
|
return SolidLine;
|
|
104
80
|
}
|
|
105
81
|
}, [SelectedLineComponent, type]);
|
|
106
82
|
|
|
107
83
|
// Get series color for stroke
|
|
108
|
-
const stroke = (_ref2 =
|
|
84
|
+
const stroke = (_ref2 = strokeProp !== null && strokeProp !== void 0 ? strokeProp : matchedSeries === null || matchedSeries === void 0 ? void 0 : matchedSeries.color) !== null && _ref2 !== void 0 ? _ref2 : 'var(--color-fgPrimary)';
|
|
109
85
|
const xData = useMemo(() => {
|
|
110
86
|
const data = xAxis === null || xAxis === void 0 ? void 0 : xAxis.data;
|
|
111
87
|
return data && Array.isArray(data) && data.length > 0 && typeof data[0] === 'number' ? data : null;
|
|
112
88
|
}, [xAxis === null || xAxis === void 0 ? void 0 : xAxis.data]);
|
|
89
|
+
const gradientConfig = useMemo(() => {
|
|
90
|
+
if (!gradient || !xScale || !yScale) return;
|
|
91
|
+
const gradientScale = gradient.axis === 'x' ? xScale : yScale;
|
|
92
|
+
const stops = getGradientConfig(gradient, xScale, yScale);
|
|
93
|
+
if (!stops) return;
|
|
94
|
+
return {
|
|
95
|
+
scale: gradientScale,
|
|
96
|
+
stops
|
|
97
|
+
};
|
|
98
|
+
}, [gradient, xScale, yScale]);
|
|
99
|
+
if (!xScale || !yScale || !path) return;
|
|
113
100
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
114
101
|
children: [showArea && /*#__PURE__*/_jsx(Area, {
|
|
115
102
|
AreaComponent: AreaComponent,
|
|
116
103
|
baseline: areaBaseline,
|
|
104
|
+
connectNulls: connectNulls,
|
|
117
105
|
curve: curve,
|
|
118
106
|
fill: stroke,
|
|
119
107
|
fillOpacity: opacity,
|
|
108
|
+
gradient: gradient,
|
|
120
109
|
seriesId: seriesId,
|
|
110
|
+
transition: transition,
|
|
111
|
+
transitions: transitions,
|
|
121
112
|
type: areaType
|
|
122
113
|
}), /*#__PURE__*/_jsx(LineComponent, _objectSpread({
|
|
123
114
|
d: path,
|
|
115
|
+
gradient: gradient,
|
|
124
116
|
stroke: stroke,
|
|
125
|
-
strokeOpacity: opacity
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
initial: 'initial',
|
|
132
|
-
variants: axisTickLabelsInitialAnimationVariants
|
|
133
|
-
} : {}), {}, {
|
|
117
|
+
strokeOpacity: strokeOpacity !== null && strokeOpacity !== void 0 ? strokeOpacity : opacity,
|
|
118
|
+
transition: transition,
|
|
119
|
+
transitions: transitions,
|
|
120
|
+
yAxisId: matchedSeries === null || matchedSeries === void 0 ? void 0 : matchedSeries.yAxisId
|
|
121
|
+
}, props)), points && /*#__PURE__*/_jsx("g", {
|
|
122
|
+
"data-component": "line-points-group",
|
|
134
123
|
children: chartData.map((value, index) => {
|
|
135
|
-
var
|
|
136
|
-
if (value === null)
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
124
|
+
var _pointConfig$onClick;
|
|
125
|
+
if (value === null) return;
|
|
139
126
|
const xValue = xData && xData[index] !== undefined ? xData[index] : index;
|
|
140
|
-
|
|
141
|
-
|
|
127
|
+
let pointFill = stroke;
|
|
128
|
+
if (gradientConfig && gradient) {
|
|
129
|
+
var _gradient$axis;
|
|
130
|
+
// Use the appropriate data value based on gradient axis
|
|
131
|
+
const axis = (_gradient$axis = gradient.axis) !== null && _gradient$axis !== void 0 ? _gradient$axis : 'y';
|
|
132
|
+
const dataValue = axis === 'x' ? xValue : value;
|
|
133
|
+
const evaluatedColor = evaluateGradientAtValue(gradientConfig.stops, dataValue, gradientConfig.scale);
|
|
134
|
+
if (evaluatedColor) {
|
|
135
|
+
// Apply gradient color to fill if not explicitly set
|
|
136
|
+
pointFill = evaluatedColor;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Build defaults that would be passed to Point
|
|
141
|
+
const defaults = {
|
|
142
142
|
dataX: xValue,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
143
|
+
dataY: value,
|
|
144
|
+
fill: pointFill,
|
|
145
|
+
yAxisId: matchedSeries === null || matchedSeries === void 0 ? void 0 : matchedSeries.yAxisId,
|
|
146
|
+
opacity,
|
|
147
|
+
testID: undefined
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
// If points is true, render with defaults
|
|
151
|
+
if (points === true) {
|
|
152
|
+
return /*#__PURE__*/_jsx(Point, _objectSpread({
|
|
153
|
+
onClick: onPointClick,
|
|
154
|
+
transition: transition,
|
|
155
|
+
transitions: transitions
|
|
156
|
+
}, defaults), "".concat(seriesId, "-").concat(index));
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Call the function with defaults
|
|
160
|
+
const result = points(defaults);
|
|
161
|
+
if (!result) return;
|
|
162
|
+
const pointConfig = result === true ? {} : result;
|
|
148
163
|
return /*#__PURE__*/_jsx(Point, _objectSpread(_objectSpread({
|
|
149
|
-
dataX: xValue,
|
|
150
|
-
dataY: value
|
|
151
|
-
}, pointConfig), {}, {
|
|
152
|
-
fill: (_pointConfig$fill = pointConfig.fill) !== null && _pointConfig$fill !== void 0 ? _pointConfig$fill : stroke,
|
|
153
164
|
onClick: (_pointConfig$onClick = pointConfig.onClick) !== null && _pointConfig$onClick !== void 0 ? _pointConfig$onClick : onPointClick,
|
|
154
|
-
|
|
155
|
-
|
|
165
|
+
transition: transition,
|
|
166
|
+
transitions: transitions
|
|
167
|
+
}, defaults), pointConfig), "".concat(seriesId, "-").concat(index));
|
|
156
168
|
})
|
|
157
|
-
})
|
|
169
|
+
})]
|
|
158
170
|
});
|
|
159
171
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const _excluded = ["series", "showArea", "areaType", "type", "onPointClick", "LineComponent", "AreaComponent", "curve", "
|
|
1
|
+
const _excluded = ["series", "showArea", "areaType", "type", "onPointClick", "LineComponent", "AreaComponent", "curve", "points", "strokeWidth", "strokeOpacity", "connectNulls", "transitions", "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
|
-
_excluded4 = ["id", "data", "label", "color", "yAxisId"];
|
|
4
|
+
_excluded4 = ["id", "data", "label", "color", "yAxisId", "legendShape"];
|
|
5
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
7
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -26,17 +26,22 @@ export const LineChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
|
|
|
26
26
|
LineComponent,
|
|
27
27
|
AreaComponent,
|
|
28
28
|
curve,
|
|
29
|
-
|
|
29
|
+
points,
|
|
30
30
|
strokeWidth,
|
|
31
|
+
strokeOpacity,
|
|
32
|
+
connectNulls,
|
|
33
|
+
transitions,
|
|
34
|
+
transition,
|
|
35
|
+
opacity,
|
|
31
36
|
showXAxis,
|
|
32
37
|
showYAxis,
|
|
33
38
|
xAxis,
|
|
34
39
|
yAxis,
|
|
35
|
-
inset
|
|
40
|
+
inset,
|
|
36
41
|
children
|
|
37
42
|
} = _ref,
|
|
38
43
|
chartProps = _objectWithoutProperties(_ref, _excluded);
|
|
39
|
-
const calculatedInset = useMemo(() => getChartInset(
|
|
44
|
+
const calculatedInset = useMemo(() => getChartInset(inset, defaultChartInset), [inset]);
|
|
40
45
|
|
|
41
46
|
// Convert LineSeries to Series for Chart context
|
|
42
47
|
const chartSeries = useMemo(() => {
|
|
@@ -44,7 +49,11 @@ export const LineChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
|
|
|
44
49
|
id: s.id,
|
|
45
50
|
data: s.data,
|
|
46
51
|
label: s.label,
|
|
47
|
-
color: s.color
|
|
52
|
+
color: s.color,
|
|
53
|
+
yAxisId: s.yAxisId,
|
|
54
|
+
stackId: s.stackId,
|
|
55
|
+
gradient: s.gradient,
|
|
56
|
+
legendShape: s.legendShape
|
|
48
57
|
}));
|
|
49
58
|
}, [series]);
|
|
50
59
|
|
|
@@ -95,24 +104,31 @@ export const LineChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
|
|
|
95
104
|
children: [showXAxis && /*#__PURE__*/_jsx(XAxis, _objectSpread({}, xAxisVisualProps)), showYAxis && /*#__PURE__*/_jsx(YAxis, _objectSpread({
|
|
96
105
|
axisId: yAxisId
|
|
97
106
|
}, yAxisVisualProps)), series === null || series === void 0 ? void 0 : series.map(_ref4 => {
|
|
107
|
+
var _linePropsFromSeries$, _linePropsFromSeries$2;
|
|
98
108
|
let {
|
|
99
109
|
id,
|
|
100
110
|
data,
|
|
101
111
|
label,
|
|
102
112
|
color,
|
|
103
|
-
yAxisId
|
|
113
|
+
yAxisId,
|
|
114
|
+
legendShape
|
|
104
115
|
} = _ref4,
|
|
105
116
|
linePropsFromSeries = _objectWithoutProperties(_ref4, _excluded4);
|
|
106
117
|
return /*#__PURE__*/_jsx(Line, _objectSpread({
|
|
107
118
|
AreaComponent: AreaComponent,
|
|
108
119
|
LineComponent: LineComponent,
|
|
109
120
|
areaType: areaType,
|
|
121
|
+
connectNulls: connectNulls,
|
|
110
122
|
curve: curve,
|
|
111
123
|
onPointClick: onPointClick,
|
|
112
|
-
|
|
124
|
+
opacity: opacity,
|
|
125
|
+
points: points,
|
|
113
126
|
seriesId: id,
|
|
114
127
|
showArea: showArea,
|
|
128
|
+
strokeOpacity: strokeOpacity,
|
|
115
129
|
strokeWidth: strokeWidth,
|
|
130
|
+
transition: (_linePropsFromSeries$ = linePropsFromSeries.transition) !== null && _linePropsFromSeries$ !== void 0 ? _linePropsFromSeries$ : transition,
|
|
131
|
+
transitions: (_linePropsFromSeries$2 = linePropsFromSeries.transitions) !== null && _linePropsFromSeries$2 !== void 0 ? _linePropsFromSeries$2 : transitions,
|
|
116
132
|
type: type
|
|
117
133
|
}, linePropsFromSeries), id);
|
|
118
134
|
}), children]
|