@mui/x-charts 7.6.2 → 7.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/BarChart.d.ts +1 -1
- package/BarChart/BarChart.js +21 -104
- package/BarChart/BarLabel/BarLabelPlot.d.ts +0 -3
- package/BarChart/BarLabel/BarLabelPlot.js +1 -24
- package/BarChart/BarPlot.js +2 -2
- package/BarChart/checkScaleErrors.d.ts +5 -9
- package/BarChart/types.d.ts +2 -2
- package/BarChart/useBarChartProps.d.ts +102 -0
- package/BarChart/useBarChartProps.js +143 -0
- package/CHANGELOG.md +163 -0
- package/ChartContainer/ChartContainer.d.ts +4 -4
- package/ChartContainer/ChartContainer.js +64 -31
- package/ChartContainer/useChartContainerHooks.d.ts +11 -0
- package/ChartContainer/useChartContainerHooks.js +34 -0
- package/ChartContainer/usePluginsMerge.d.ts +1 -2
- package/ChartsAxis/ChartsAxis.js +2 -2
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +2 -2
- package/ChartsGrid/ChartsGrid.js +2 -2
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/ChartsOverlay/index.d.ts +1 -0
- package/ChartsReferenceLine/ChartsXReferenceLine.js +3 -5
- package/ChartsReferenceLine/ChartsYReferenceLine.js +3 -5
- package/ChartsText/ChartsText.js +1 -3
- package/ChartsTooltip/ChartsAxisTooltipContent.js +8 -14
- package/ChartsTooltip/ChartsItemTooltipContent.js +8 -18
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +3 -3
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -2
- package/ChartsXAxis/ChartsXAxis.js +2 -2
- package/ChartsYAxis/ChartsYAxis.js +2 -2
- package/LineChart/AreaPlot.js +2 -2
- package/LineChart/LineChart.d.ts +2 -2
- package/LineChart/LineChart.js +25 -107
- package/LineChart/LineHighlightPlot.js +2 -2
- package/LineChart/LinePlot.js +2 -2
- package/LineChart/MarkPlot.js +2 -2
- package/LineChart/useLineChartProps.d.ts +117 -0
- package/LineChart/useLineChartProps.js +152 -0
- package/PieChart/PieChart.d.ts +2 -2
- package/PieChart/PieChart.js +1 -1
- package/ResponsiveChartContainer/ResizableContainer.d.ts +10 -0
- package/ResponsiveChartContainer/ResizableContainer.js +32 -0
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +25 -22
- package/ScatterChart/ScatterChart.d.ts +1 -1
- package/ScatterChart/ScatterChart.js +21 -76
- package/ScatterChart/ScatterPlot.js +2 -2
- package/ScatterChart/useScatterChartProps.d.ts +86 -0
- package/ScatterChart/useScatterChartProps.js +116 -0
- package/SparkLineChart/SparkLineChart.d.ts +8 -3
- package/SparkLineChart/SparkLineChart.js +57 -1
- package/context/CartesianProvider/CartesianContext.d.ts +25 -0
- package/context/CartesianProvider/CartesianContext.js +21 -0
- package/context/CartesianProvider/CartesianProvider.d.ts +34 -0
- package/context/CartesianProvider/CartesianProvider.js +44 -0
- package/context/CartesianProvider/computeValue.d.ts +19 -0
- package/context/CartesianProvider/computeValue.js +89 -0
- package/context/CartesianProvider/getAxisExtremum.d.ts +4 -0
- package/context/CartesianProvider/getAxisExtremum.js +28 -0
- package/context/CartesianProvider/index.d.ts +9 -0
- package/context/CartesianProvider/index.js +51 -0
- package/context/CartesianProvider/normalizeAxis.d.ts +5 -0
- package/context/CartesianProvider/normalizeAxis.js +23 -0
- package/context/CartesianProvider/useCartesianContext.d.ts +2 -0
- package/context/CartesianProvider/useCartesianContext.js +17 -0
- package/context/ColorProvider.d.ts +12 -0
- package/context/ColorProvider.js +25 -0
- package/esm/BarChart/BarChart.js +21 -104
- package/esm/BarChart/BarLabel/BarLabelPlot.js +0 -23
- package/esm/BarChart/BarPlot.js +2 -2
- package/esm/BarChart/useBarChartProps.js +136 -0
- package/esm/ChartContainer/ChartContainer.js +65 -32
- package/esm/ChartContainer/useChartContainerHooks.js +24 -0
- package/esm/ChartsAxis/ChartsAxis.js +2 -2
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +2 -2
- package/esm/ChartsGrid/ChartsGrid.js +2 -2
- package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +3 -5
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +3 -5
- package/esm/ChartsText/ChartsText.js +1 -3
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +8 -14
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +8 -18
- package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +3 -3
- package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -2
- package/esm/ChartsXAxis/ChartsXAxis.js +2 -2
- package/esm/ChartsYAxis/ChartsYAxis.js +2 -2
- package/esm/LineChart/AreaPlot.js +2 -2
- package/esm/LineChart/LineChart.js +25 -107
- package/esm/LineChart/LineHighlightPlot.js +2 -2
- package/esm/LineChart/LinePlot.js +2 -2
- package/esm/LineChart/MarkPlot.js +2 -2
- package/esm/LineChart/useLineChartProps.js +144 -0
- package/esm/PieChart/PieChart.js +1 -1
- package/esm/ResponsiveChartContainer/ResizableContainer.js +26 -0
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +24 -21
- package/esm/ScatterChart/ScatterChart.js +21 -76
- package/esm/ScatterChart/ScatterPlot.js +2 -2
- package/esm/ScatterChart/useScatterChartProps.js +108 -0
- package/esm/SparkLineChart/SparkLineChart.js +57 -1
- package/esm/context/CartesianProvider/CartesianContext.js +13 -0
- package/esm/context/CartesianProvider/CartesianProvider.js +37 -0
- package/esm/context/CartesianProvider/computeValue.js +82 -0
- package/esm/context/CartesianProvider/getAxisExtremum.js +21 -0
- package/esm/context/CartesianProvider/index.js +10 -0
- package/esm/context/CartesianProvider/normalizeAxis.js +15 -0
- package/esm/context/CartesianProvider/useCartesianContext.js +8 -0
- package/esm/context/ColorProvider.js +16 -0
- package/esm/hooks/index.js +1 -0
- package/esm/hooks/useAxisEvents.js +2 -2
- package/esm/hooks/useColor.js +9 -0
- package/esm/hooks/useColorScale.js +27 -0
- package/esm/hooks/useReducedMotion.js +7 -0
- package/esm/hooks/useScale.js +3 -4
- package/esm/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +2 -2
- package/esm/internals/index.js +31 -1
- package/esm/internals/warning.js +13 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +12 -0
- package/hooks/useAxisEvents.js +2 -2
- package/hooks/useColor.d.ts +4 -0
- package/hooks/useColor.js +17 -0
- package/hooks/useColorScale.d.ts +4 -0
- package/hooks/useColorScale.js +37 -0
- package/hooks/useDrawingArea.d.ts +2 -8
- package/hooks/useReducedMotion.js +7 -0
- package/hooks/useScale.js +3 -6
- package/index.js +1 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.d.ts +2 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +2 -2
- package/internals/defaultizeColor.d.ts +8 -8
- package/internals/index.d.ts +22 -0
- package/internals/index.js +231 -0
- package/internals/warning.d.ts +1 -0
- package/internals/warning.js +19 -0
- package/models/axis.d.ts +1 -2
- package/models/plugin.d.ts +4 -1
- package/modern/BarChart/BarChart.js +21 -104
- package/modern/BarChart/BarLabel/BarLabelPlot.js +0 -23
- package/modern/BarChart/BarPlot.js +2 -2
- package/modern/BarChart/useBarChartProps.js +136 -0
- package/modern/ChartContainer/ChartContainer.js +65 -32
- package/modern/ChartContainer/useChartContainerHooks.js +24 -0
- package/modern/ChartsAxis/ChartsAxis.js +2 -2
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +2 -2
- package/modern/ChartsGrid/ChartsGrid.js +2 -2
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +3 -5
- package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +3 -5
- package/modern/ChartsText/ChartsText.js +1 -3
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +8 -14
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +8 -18
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +3 -3
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -2
- package/modern/ChartsXAxis/ChartsXAxis.js +2 -2
- package/modern/ChartsYAxis/ChartsYAxis.js +2 -2
- package/modern/LineChart/AreaPlot.js +2 -2
- package/modern/LineChart/LineChart.js +25 -107
- package/modern/LineChart/LineHighlightPlot.js +2 -2
- package/modern/LineChart/LinePlot.js +2 -2
- package/modern/LineChart/MarkPlot.js +2 -2
- package/modern/LineChart/useLineChartProps.js +144 -0
- package/modern/PieChart/PieChart.js +1 -1
- package/modern/ResponsiveChartContainer/ResizableContainer.js +26 -0
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +24 -21
- package/modern/ScatterChart/ScatterChart.js +21 -76
- package/modern/ScatterChart/ScatterPlot.js +2 -2
- package/modern/ScatterChart/useScatterChartProps.js +108 -0
- package/modern/SparkLineChart/SparkLineChart.js +57 -1
- package/modern/context/CartesianProvider/CartesianContext.js +13 -0
- package/modern/context/CartesianProvider/CartesianProvider.js +37 -0
- package/modern/context/CartesianProvider/computeValue.js +82 -0
- package/modern/context/CartesianProvider/getAxisExtremum.js +21 -0
- package/modern/context/CartesianProvider/index.js +10 -0
- package/modern/context/CartesianProvider/normalizeAxis.js +15 -0
- package/modern/context/CartesianProvider/useCartesianContext.js +8 -0
- package/modern/context/ColorProvider.js +16 -0
- package/modern/hooks/index.js +1 -0
- package/modern/hooks/useAxisEvents.js +2 -2
- package/modern/hooks/useColor.js +9 -0
- package/modern/hooks/useColorScale.js +27 -0
- package/modern/hooks/useReducedMotion.js +7 -0
- package/modern/hooks/useScale.js +3 -4
- package/modern/index.js +1 -1
- package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +2 -2
- package/modern/internals/index.js +31 -1
- package/modern/internals/warning.js +13 -0
- package/package.json +4 -4
- package/themeAugmentation/components.d.ts +12 -12
- package/context/CartesianContextProvider.d.ts +0 -53
- package/context/CartesianContextProvider.js +0 -233
- package/esm/context/CartesianContextProvider.js +0 -224
- package/esm/internals/colorGetter.js +0 -22
- package/internals/colorGetter.d.ts +0 -7
- package/internals/colorGetter.js +0 -29
- package/modern/context/CartesianContextProvider.js +0 -224
- package/modern/internals/colorGetter.js +0 -22
package/LineChart/LineChart.js
CHANGED
|
@@ -7,14 +7,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.LineChart = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
11
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
11
|
var _AreaPlot = require("./AreaPlot");
|
|
13
12
|
var _LinePlot = require("./LinePlot");
|
|
14
13
|
var _ResponsiveChartContainer = require("../ResponsiveChartContainer");
|
|
15
14
|
var _MarkPlot = require("./MarkPlot");
|
|
16
15
|
var _ChartsAxis = require("../ChartsAxis/ChartsAxis");
|
|
17
|
-
var _constants = require("../constants");
|
|
18
16
|
var _ChartsTooltip = require("../ChartsTooltip");
|
|
19
17
|
var _ChartsLegend = require("../ChartsLegend");
|
|
20
18
|
var _ChartsAxisHighlight = require("../ChartsAxisHighlight");
|
|
@@ -22,7 +20,8 @@ var _ChartsClipPath = require("../ChartsClipPath");
|
|
|
22
20
|
var _LineHighlightPlot = require("./LineHighlightPlot");
|
|
23
21
|
var _ChartsGrid = require("../ChartsGrid");
|
|
24
22
|
var _ChartsOnAxisClickHandler = require("../ChartsOnAxisClickHandler");
|
|
25
|
-
var _ChartsOverlay = require("../ChartsOverlay
|
|
23
|
+
var _ChartsOverlay = require("../ChartsOverlay");
|
|
24
|
+
var _useLineChartProps = require("./useLineChartProps");
|
|
26
25
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
26
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
28
27
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -38,110 +37,29 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
38
37
|
*/
|
|
39
38
|
const LineChart = exports.LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
|
|
40
39
|
const {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
grid,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
bottomAxis,
|
|
65
|
-
children,
|
|
66
|
-
slots,
|
|
67
|
-
slotProps,
|
|
68
|
-
skipAnimation,
|
|
69
|
-
loading,
|
|
70
|
-
highlightedItem,
|
|
71
|
-
onHighlightChange
|
|
72
|
-
} = props;
|
|
73
|
-
const id = (0, _useId.default)();
|
|
74
|
-
const clipPathId = `${id}-clip-path`;
|
|
75
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ResponsiveChartContainer.ResponsiveChartContainer, {
|
|
76
|
-
ref: ref,
|
|
77
|
-
series: series.map(s => (0, _extends2.default)({
|
|
78
|
-
disableHighlight: !!disableLineItemHighlight,
|
|
79
|
-
type: 'line'
|
|
80
|
-
}, s)),
|
|
81
|
-
width: width,
|
|
82
|
-
height: height,
|
|
83
|
-
margin: margin,
|
|
84
|
-
xAxis: xAxis ?? [{
|
|
85
|
-
id: _constants.DEFAULT_X_AXIS_KEY,
|
|
86
|
-
scaleType: 'point',
|
|
87
|
-
data: Array.from({
|
|
88
|
-
length: Math.max(...series.map(s => (s.data ?? dataset ?? []).length))
|
|
89
|
-
}, (_, index) => index)
|
|
90
|
-
}],
|
|
91
|
-
yAxis: yAxis,
|
|
92
|
-
colors: colors,
|
|
93
|
-
dataset: dataset,
|
|
94
|
-
sx: sx,
|
|
95
|
-
disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
|
|
96
|
-
highlightedItem: highlightedItem,
|
|
97
|
-
onHighlightChange: onHighlightChange,
|
|
98
|
-
children: [onAxisClick && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOnAxisClickHandler.ChartsOnAxisClickHandler, {
|
|
99
|
-
onAxisClick: onAxisClick
|
|
100
|
-
}), grid && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, {
|
|
101
|
-
vertical: grid.vertical,
|
|
102
|
-
horizontal: grid.horizontal
|
|
103
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
|
|
104
|
-
clipPath: `url(#${clipPathId})`,
|
|
105
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_AreaPlot.AreaPlot, {
|
|
106
|
-
slots: slots,
|
|
107
|
-
slotProps: slotProps,
|
|
108
|
-
onItemClick: onAreaClick,
|
|
109
|
-
skipAnimation: skipAnimation
|
|
110
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinePlot.LinePlot, {
|
|
111
|
-
slots: slots,
|
|
112
|
-
slotProps: slotProps,
|
|
113
|
-
onItemClick: onLineClick,
|
|
114
|
-
skipAnimation: skipAnimation
|
|
115
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, {
|
|
116
|
-
loading: loading,
|
|
117
|
-
slots: slots,
|
|
118
|
-
slotProps: slotProps
|
|
119
|
-
})]
|
|
120
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, {
|
|
121
|
-
topAxis: topAxis,
|
|
122
|
-
leftAxis: leftAxis,
|
|
123
|
-
rightAxis: rightAxis,
|
|
124
|
-
bottomAxis: bottomAxis,
|
|
125
|
-
slots: slots,
|
|
126
|
-
slotProps: slotProps
|
|
127
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlight)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_MarkPlot.MarkPlot, {
|
|
128
|
-
slots: slots,
|
|
129
|
-
slotProps: slotProps,
|
|
130
|
-
onItemClick: onMarkClick,
|
|
131
|
-
skipAnimation: skipAnimation
|
|
132
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineHighlightPlot.LineHighlightPlot, {
|
|
133
|
-
slots: slots,
|
|
134
|
-
slotProps: slotProps
|
|
135
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legend, {
|
|
136
|
-
slots: slots,
|
|
137
|
-
slotProps: slotProps
|
|
138
|
-
})), !loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltip, {
|
|
139
|
-
slots: slots,
|
|
140
|
-
slotProps: slotProps
|
|
141
|
-
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, {
|
|
142
|
-
id: clipPathId
|
|
143
|
-
}), children]
|
|
144
|
-
});
|
|
40
|
+
chartContainerProps,
|
|
41
|
+
axisClickHandlerProps,
|
|
42
|
+
gridProps,
|
|
43
|
+
clipPathProps,
|
|
44
|
+
clipPathGroupProps,
|
|
45
|
+
areaPlotProps,
|
|
46
|
+
linePlotProps,
|
|
47
|
+
markPlotProps,
|
|
48
|
+
overlayProps,
|
|
49
|
+
chartsAxisProps,
|
|
50
|
+
axisHighlightProps,
|
|
51
|
+
lineHighlightPlotProps,
|
|
52
|
+
legendProps,
|
|
53
|
+
tooltipProps,
|
|
54
|
+
children
|
|
55
|
+
} = (0, _useLineChartProps.useLineChartProps)(props);
|
|
56
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ResponsiveChartContainer.ResponsiveChartContainer, (0, _extends2.default)({
|
|
57
|
+
ref: ref
|
|
58
|
+
}, chartContainerProps, {
|
|
59
|
+
children: [props.onAxisClick && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOnAxisClickHandler.ChartsOnAxisClickHandler, (0, _extends2.default)({}, axisClickHandlerProps)), props.grid && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", (0, _extends2.default)({}, clipPathGroupProps, {
|
|
60
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_AreaPlot.AreaPlot, (0, _extends2.default)({}, areaPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinePlot.LinePlot, (0, _extends2.default)({}, linePlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps))]
|
|
61
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_MarkPlot.MarkPlot, (0, _extends2.default)({}, markPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineHighlightPlot.LineHighlightPlot, (0, _extends2.default)({}, lineHighlightPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltipProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, (0, _extends2.default)({}, clipPathProps)), children]
|
|
62
|
+
}));
|
|
145
63
|
});
|
|
146
64
|
process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
147
65
|
// ----------------------------- Warning --------------------------------
|
|
@@ -9,7 +9,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
-
var
|
|
12
|
+
var _CartesianProvider = require("../context/CartesianProvider");
|
|
13
13
|
var _LineHighlightElement = require("./LineHighlightElement");
|
|
14
14
|
var _useScale = require("../hooks/useScale");
|
|
15
15
|
var _InteractionProvider = require("../context/InteractionProvider");
|
|
@@ -37,7 +37,7 @@ function LineHighlightPlot(props) {
|
|
|
37
37
|
} = props,
|
|
38
38
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
39
39
|
const seriesData = (0, _useSeries.useLineSeries)();
|
|
40
|
-
const axisData =
|
|
40
|
+
const axisData = (0, _CartesianProvider.useCartesianContext)();
|
|
41
41
|
const {
|
|
42
42
|
axis
|
|
43
43
|
} = React.useContext(_InteractionProvider.InteractionContext);
|
package/LineChart/LinePlot.js
CHANGED
|
@@ -10,7 +10,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _d3Shape = require("d3-shape");
|
|
13
|
-
var
|
|
13
|
+
var _CartesianProvider = require("../context/CartesianProvider");
|
|
14
14
|
var _LineElement = require("./LineElement");
|
|
15
15
|
var _useScale = require("../hooks/useScale");
|
|
16
16
|
var _getCurve = _interopRequireDefault(require("../internals/getCurve"));
|
|
@@ -23,7 +23,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
23
23
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
24
24
|
const useAggregatedData = () => {
|
|
25
25
|
const seriesData = (0, _useSeries.useLineSeries)();
|
|
26
|
-
const axisData =
|
|
26
|
+
const axisData = (0, _CartesianProvider.useCartesianContext)();
|
|
27
27
|
if (seriesData === undefined) {
|
|
28
28
|
return [];
|
|
29
29
|
}
|
package/LineChart/MarkPlot.js
CHANGED
|
@@ -9,7 +9,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
-
var
|
|
12
|
+
var _CartesianProvider = require("../context/CartesianProvider");
|
|
13
13
|
var _MarkElement = require("./MarkElement");
|
|
14
14
|
var _useScale = require("../hooks/useScale");
|
|
15
15
|
var _useChartId = require("../hooks/useChartId");
|
|
@@ -40,7 +40,7 @@ function MarkPlot(props) {
|
|
|
40
40
|
} = props,
|
|
41
41
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
42
42
|
const seriesData = (0, _useSeries.useLineSeries)();
|
|
43
|
-
const axisData =
|
|
43
|
+
const axisData = (0, _CartesianProvider.useCartesianContext)();
|
|
44
44
|
const chartId = (0, _useChartId.useChartId)();
|
|
45
45
|
const Mark = slots?.mark ?? _MarkElement.MarkElement;
|
|
46
46
|
if (seriesData === undefined) {
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { LineChartProps } from './LineChart';
|
|
3
|
+
/**
|
|
4
|
+
* A helper function that extracts LineChartProps from the input props
|
|
5
|
+
* and returns an object with props for the children components of LineChart.
|
|
6
|
+
*
|
|
7
|
+
* @param props The input props for LineChart
|
|
8
|
+
* @returns An object with props for the children components of LineChart
|
|
9
|
+
*/
|
|
10
|
+
export declare const useLineChartProps: (props: LineChartProps) => {
|
|
11
|
+
chartContainerProps: {
|
|
12
|
+
series: {
|
|
13
|
+
color?: string | undefined;
|
|
14
|
+
area?: boolean | undefined;
|
|
15
|
+
data?: (number | null)[] | undefined;
|
|
16
|
+
label?: string | ((location: "tooltip" | "legend") => string) | undefined;
|
|
17
|
+
id?: import("../internals").SeriesId | undefined;
|
|
18
|
+
dataKey?: string | undefined;
|
|
19
|
+
stackOffset?: import("..").StackOffsetType | undefined;
|
|
20
|
+
valueFormatter?: import("../internals").SeriesValueFormatter<number | null> | undefined;
|
|
21
|
+
highlightScope?: Partial<import("..").HighlightScope> | undefined;
|
|
22
|
+
xAxisKey?: string | undefined;
|
|
23
|
+
yAxisKey?: string | undefined;
|
|
24
|
+
stack?: string | undefined;
|
|
25
|
+
stackOrder?: import("..").StackOrderType | undefined;
|
|
26
|
+
curve?: import("..").CurveType | undefined;
|
|
27
|
+
showMark?: boolean | ((params: import("..").ShowMarkParams<number | Date>) => boolean) | undefined;
|
|
28
|
+
disableHighlight: boolean;
|
|
29
|
+
connectNulls?: boolean | undefined;
|
|
30
|
+
type: "line";
|
|
31
|
+
}[];
|
|
32
|
+
width: number | undefined;
|
|
33
|
+
height: number | undefined;
|
|
34
|
+
margin: Partial<import("..").CardinalDirections<number>> | undefined;
|
|
35
|
+
colors: import("..").ChartsColorPalette | undefined;
|
|
36
|
+
dataset: import("../internals").DatasetType | undefined;
|
|
37
|
+
xAxis: import("../internals").MakeOptional<import("..").AxisConfig<import("..").ScaleName, any, import("..").ChartsXAxisProps>, "id">[];
|
|
38
|
+
yAxis: import("../internals").MakeOptional<import("..").AxisConfig<import("..").ScaleName, any, import("..").ChartsYAxisProps>, "id">[] | undefined;
|
|
39
|
+
sx: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
|
|
40
|
+
highlightedItem: import("..").HighlightItemData | null | undefined;
|
|
41
|
+
onHighlightChange: ((highlightedItem: import("..").HighlightItemData | null) => void) | undefined;
|
|
42
|
+
disableAxisListener: boolean;
|
|
43
|
+
};
|
|
44
|
+
axisClickHandlerProps: {
|
|
45
|
+
onAxisClick: ((event: MouseEvent, data: {
|
|
46
|
+
dataIndex: number;
|
|
47
|
+
axisValue?: string | number | Date | undefined;
|
|
48
|
+
seriesValues: Record<string, number | null | undefined>;
|
|
49
|
+
} | null) => void) | undefined;
|
|
50
|
+
};
|
|
51
|
+
gridProps: {
|
|
52
|
+
vertical: boolean | undefined;
|
|
53
|
+
horizontal: boolean | undefined;
|
|
54
|
+
};
|
|
55
|
+
clipPathProps: {
|
|
56
|
+
id: string;
|
|
57
|
+
};
|
|
58
|
+
clipPathGroupProps: {
|
|
59
|
+
clipPath: string;
|
|
60
|
+
};
|
|
61
|
+
areaPlotProps: {
|
|
62
|
+
slots: import("./LineChart").LineChartSlots | undefined;
|
|
63
|
+
slotProps: import("./LineChart").LineChartSlotProps | undefined;
|
|
64
|
+
onAreaClick: ((event: import("react").MouseEvent<SVGElement, MouseEvent>, lineItemIdentifier: import("..").LineItemIdentifier) => void) | undefined;
|
|
65
|
+
skipAnimation: boolean | undefined;
|
|
66
|
+
};
|
|
67
|
+
linePlotProps: {
|
|
68
|
+
slots: import("./LineChart").LineChartSlots | undefined;
|
|
69
|
+
slotProps: import("./LineChart").LineChartSlotProps | undefined;
|
|
70
|
+
onLineClick: ((event: import("react").MouseEvent<SVGElement, MouseEvent>, lineItemIdentifier: import("..").LineItemIdentifier) => void) | undefined;
|
|
71
|
+
skipAnimation: boolean | undefined;
|
|
72
|
+
};
|
|
73
|
+
markPlotProps: {
|
|
74
|
+
slots: import("./LineChart").LineChartSlots | undefined;
|
|
75
|
+
slotProps: import("./LineChart").LineChartSlotProps | undefined;
|
|
76
|
+
onMarkClick: ((event: import("react").MouseEvent<SVGElement, MouseEvent>, lineItemIdentifier: import("..").LineItemIdentifier) => void) | undefined;
|
|
77
|
+
skipAnimation: boolean | undefined;
|
|
78
|
+
};
|
|
79
|
+
overlayProps: {
|
|
80
|
+
slots: import("./LineChart").LineChartSlots | undefined;
|
|
81
|
+
slotProps: import("./LineChart").LineChartSlotProps | undefined;
|
|
82
|
+
loading: boolean | undefined;
|
|
83
|
+
};
|
|
84
|
+
chartsAxisProps: {
|
|
85
|
+
topAxis: string | import("..").ChartsXAxisProps | null | undefined;
|
|
86
|
+
leftAxis: string | import("..").ChartsYAxisProps | null | undefined;
|
|
87
|
+
rightAxis: string | import("..").ChartsYAxisProps | null | undefined;
|
|
88
|
+
bottomAxis: string | import("..").ChartsXAxisProps | null | undefined;
|
|
89
|
+
slots: import("./LineChart").LineChartSlots | undefined;
|
|
90
|
+
slotProps: import("./LineChart").LineChartSlotProps | undefined;
|
|
91
|
+
};
|
|
92
|
+
axisHighlightProps: {
|
|
93
|
+
x: "none" | "line" | "band";
|
|
94
|
+
y?: ("none" | "line" | "band") | undefined;
|
|
95
|
+
};
|
|
96
|
+
lineHighlightPlotProps: {
|
|
97
|
+
slots: import("./LineChart").LineChartSlots | undefined;
|
|
98
|
+
slotProps: import("./LineChart").LineChartSlotProps | undefined;
|
|
99
|
+
};
|
|
100
|
+
legendProps: {
|
|
101
|
+
slots: import("./LineChart").LineChartSlots | undefined;
|
|
102
|
+
slotProps: import("./LineChart").LineChartSlotProps | undefined;
|
|
103
|
+
position?: import("..").AnchorPosition | undefined;
|
|
104
|
+
classes?: Partial<import("..").ChartsLegendClasses> | undefined;
|
|
105
|
+
hidden?: boolean | undefined;
|
|
106
|
+
direction?: import("..").Direction | undefined;
|
|
107
|
+
};
|
|
108
|
+
tooltipProps: {
|
|
109
|
+
slots: import("./LineChart").LineChartSlots | undefined;
|
|
110
|
+
slotProps: import("./LineChart").LineChartSlotProps | undefined;
|
|
111
|
+
trigger?: import("../ChartsTooltip/utils").TriggerOptions | undefined;
|
|
112
|
+
itemContent?: import("react").ElementType<import("..").ChartsItemContentProps<any>, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
113
|
+
axisContent?: import("react").ElementType<import("..").ChartsAxisContentProps, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
114
|
+
classes?: Partial<import("..").ChartsTooltipClasses> | undefined;
|
|
115
|
+
};
|
|
116
|
+
children: import("react").ReactNode;
|
|
117
|
+
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useLineChartProps = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
10
|
+
var _constants = require("../constants");
|
|
11
|
+
/**
|
|
12
|
+
* A helper function that extracts LineChartProps from the input props
|
|
13
|
+
* and returns an object with props for the children components of LineChart.
|
|
14
|
+
*
|
|
15
|
+
* @param props The input props for LineChart
|
|
16
|
+
* @returns An object with props for the children components of LineChart
|
|
17
|
+
*/
|
|
18
|
+
const useLineChartProps = props => {
|
|
19
|
+
const {
|
|
20
|
+
xAxis,
|
|
21
|
+
yAxis,
|
|
22
|
+
series,
|
|
23
|
+
width,
|
|
24
|
+
height,
|
|
25
|
+
margin,
|
|
26
|
+
colors,
|
|
27
|
+
dataset,
|
|
28
|
+
sx,
|
|
29
|
+
tooltip,
|
|
30
|
+
onAxisClick,
|
|
31
|
+
onAreaClick,
|
|
32
|
+
onLineClick,
|
|
33
|
+
onMarkClick,
|
|
34
|
+
axisHighlight,
|
|
35
|
+
disableLineItemHighlight,
|
|
36
|
+
legend,
|
|
37
|
+
grid,
|
|
38
|
+
topAxis,
|
|
39
|
+
leftAxis,
|
|
40
|
+
rightAxis,
|
|
41
|
+
bottomAxis,
|
|
42
|
+
children,
|
|
43
|
+
slots,
|
|
44
|
+
slotProps,
|
|
45
|
+
skipAnimation,
|
|
46
|
+
loading,
|
|
47
|
+
highlightedItem,
|
|
48
|
+
onHighlightChange
|
|
49
|
+
} = props;
|
|
50
|
+
const id = (0, _useId.default)();
|
|
51
|
+
const clipPathId = `${id}-clip-path`;
|
|
52
|
+
const chartContainerProps = {
|
|
53
|
+
series: series.map(s => (0, _extends2.default)({
|
|
54
|
+
disableHighlight: !!disableLineItemHighlight,
|
|
55
|
+
type: 'line'
|
|
56
|
+
}, s)),
|
|
57
|
+
width,
|
|
58
|
+
height,
|
|
59
|
+
margin,
|
|
60
|
+
colors,
|
|
61
|
+
dataset,
|
|
62
|
+
xAxis: xAxis ?? [{
|
|
63
|
+
id: _constants.DEFAULT_X_AXIS_KEY,
|
|
64
|
+
scaleType: 'point',
|
|
65
|
+
data: Array.from({
|
|
66
|
+
length: Math.max(...series.map(s => (s.data ?? dataset ?? []).length))
|
|
67
|
+
}, (_, index) => index)
|
|
68
|
+
}],
|
|
69
|
+
yAxis,
|
|
70
|
+
sx,
|
|
71
|
+
highlightedItem,
|
|
72
|
+
onHighlightChange,
|
|
73
|
+
disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick
|
|
74
|
+
};
|
|
75
|
+
const axisClickHandlerProps = {
|
|
76
|
+
onAxisClick
|
|
77
|
+
};
|
|
78
|
+
const gridProps = {
|
|
79
|
+
vertical: grid?.vertical,
|
|
80
|
+
horizontal: grid?.horizontal
|
|
81
|
+
};
|
|
82
|
+
const clipPathGroupProps = {
|
|
83
|
+
clipPath: `url(#${clipPathId})`
|
|
84
|
+
};
|
|
85
|
+
const clipPathProps = {
|
|
86
|
+
id: clipPathId
|
|
87
|
+
};
|
|
88
|
+
const areaPlotProps = {
|
|
89
|
+
slots,
|
|
90
|
+
slotProps,
|
|
91
|
+
onAreaClick,
|
|
92
|
+
skipAnimation
|
|
93
|
+
};
|
|
94
|
+
const linePlotProps = {
|
|
95
|
+
slots,
|
|
96
|
+
slotProps,
|
|
97
|
+
onLineClick,
|
|
98
|
+
skipAnimation
|
|
99
|
+
};
|
|
100
|
+
const markPlotProps = {
|
|
101
|
+
slots,
|
|
102
|
+
slotProps,
|
|
103
|
+
onMarkClick,
|
|
104
|
+
skipAnimation
|
|
105
|
+
};
|
|
106
|
+
const overlayProps = {
|
|
107
|
+
slots,
|
|
108
|
+
slotProps,
|
|
109
|
+
loading
|
|
110
|
+
};
|
|
111
|
+
const chartsAxisProps = {
|
|
112
|
+
topAxis,
|
|
113
|
+
leftAxis,
|
|
114
|
+
rightAxis,
|
|
115
|
+
bottomAxis,
|
|
116
|
+
slots,
|
|
117
|
+
slotProps
|
|
118
|
+
};
|
|
119
|
+
const axisHighlightProps = (0, _extends2.default)({
|
|
120
|
+
x: 'line'
|
|
121
|
+
}, axisHighlight);
|
|
122
|
+
const lineHighlightPlotProps = {
|
|
123
|
+
slots,
|
|
124
|
+
slotProps
|
|
125
|
+
};
|
|
126
|
+
const legendProps = (0, _extends2.default)({}, legend, {
|
|
127
|
+
slots,
|
|
128
|
+
slotProps
|
|
129
|
+
});
|
|
130
|
+
const tooltipProps = (0, _extends2.default)({}, tooltip, {
|
|
131
|
+
slots,
|
|
132
|
+
slotProps
|
|
133
|
+
});
|
|
134
|
+
return {
|
|
135
|
+
chartContainerProps,
|
|
136
|
+
axisClickHandlerProps,
|
|
137
|
+
gridProps,
|
|
138
|
+
clipPathProps,
|
|
139
|
+
clipPathGroupProps,
|
|
140
|
+
areaPlotProps,
|
|
141
|
+
linePlotProps,
|
|
142
|
+
markPlotProps,
|
|
143
|
+
overlayProps,
|
|
144
|
+
chartsAxisProps,
|
|
145
|
+
axisHighlightProps,
|
|
146
|
+
lineHighlightPlotProps,
|
|
147
|
+
legendProps,
|
|
148
|
+
tooltipProps,
|
|
149
|
+
children
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
exports.useLineChartProps = useLineChartProps;
|
package/PieChart/PieChart.d.ts
CHANGED
|
@@ -9,12 +9,12 @@ import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
|
|
|
9
9
|
import { PiePlotProps, PiePlotSlotProps, PiePlotSlots } from './PiePlot';
|
|
10
10
|
import { PieValueType } from '../models/seriesType/pie';
|
|
11
11
|
import { ChartsAxisSlots, ChartsAxisSlotProps, ChartsXAxisProps, ChartsYAxisProps } from '../models/axis';
|
|
12
|
-
import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from '../ChartsOverlay
|
|
12
|
+
import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from '../ChartsOverlay';
|
|
13
13
|
export interface PieChartSlots extends ChartsAxisSlots, PiePlotSlots, ChartsLegendSlots, ChartsTooltipSlots, ChartsOverlaySlots {
|
|
14
14
|
}
|
|
15
15
|
export interface PieChartSlotProps extends ChartsAxisSlotProps, PiePlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps, ChartsOverlaySlotProps {
|
|
16
16
|
}
|
|
17
|
-
export interface PieChartProps extends Omit<ResponsiveChartContainerProps, 'series' | 'leftAxis' | 'bottomAxis' | 'plugins'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<PiePlotProps, 'skipAnimation'> {
|
|
17
|
+
export interface PieChartProps extends Omit<ResponsiveChartContainerProps, 'series' | 'leftAxis' | 'bottomAxis' | 'plugins' | 'zAxis'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<PiePlotProps, 'skipAnimation'> {
|
|
18
18
|
/**
|
|
19
19
|
* Indicate which axis to display the bottom of the charts.
|
|
20
20
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
package/PieChart/PieChart.js
CHANGED
|
@@ -16,7 +16,7 @@ var _ChartsLegend = require("../ChartsLegend");
|
|
|
16
16
|
var _ChartsAxisHighlight = require("../ChartsAxisHighlight");
|
|
17
17
|
var _PiePlot = require("./PiePlot");
|
|
18
18
|
var _useIsRTL = require("../internals/useIsRTL");
|
|
19
|
-
var _ChartsOverlay = require("../ChartsOverlay
|
|
19
|
+
var _ChartsOverlay = require("../ChartsOverlay");
|
|
20
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
21
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
22
22
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ResponsiveChartContainerProps } from './ResponsiveChartContainer';
|
|
3
|
+
/**
|
|
4
|
+
* Wrapping div that take the shape of its parent.
|
|
5
|
+
*
|
|
6
|
+
* @ignore - do not document.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ResizableContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
9
|
+
ownerState: Pick<ResponsiveChartContainerProps, 'width' | 'height'>;
|
|
10
|
+
}, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("react").ClassAttributes<HTMLDivElement> | keyof import("react").HTMLAttributes<HTMLDivElement>>, {}>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ResizableContainer = void 0;
|
|
7
|
+
var _styles = require("@mui/material/styles");
|
|
8
|
+
/**
|
|
9
|
+
* Wrapping div that take the shape of its parent.
|
|
10
|
+
*
|
|
11
|
+
* @ignore - do not document.
|
|
12
|
+
*/
|
|
13
|
+
const ResizableContainer = exports.ResizableContainer = (0, _styles.styled)('div', {
|
|
14
|
+
name: 'MuiResponsiveChart',
|
|
15
|
+
slot: 'Container'
|
|
16
|
+
})(({
|
|
17
|
+
ownerState
|
|
18
|
+
}) => ({
|
|
19
|
+
width: ownerState.width ?? '100%',
|
|
20
|
+
height: ownerState.height ?? '100%',
|
|
21
|
+
display: 'flex',
|
|
22
|
+
position: 'relative',
|
|
23
|
+
flexGrow: 1,
|
|
24
|
+
flexDirection: 'column',
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
justifyContent: 'center',
|
|
27
|
+
overflow: 'hidden',
|
|
28
|
+
'&>svg': {
|
|
29
|
+
width: '100%',
|
|
30
|
+
height: '100%'
|
|
31
|
+
}
|
|
32
|
+
}));
|
|
@@ -9,33 +9,13 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
-
var _styles = require("@mui/material/styles");
|
|
13
12
|
var _ChartContainer = require("../ChartContainer");
|
|
14
13
|
var _useChartContainerDimensions = require("./useChartContainerDimensions");
|
|
14
|
+
var _ResizableContainer = require("./ResizableContainer");
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
16
|
const _excluded = ["width", "height"];
|
|
17
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
|
-
const ResizableContainer = (0, _styles.styled)('div', {
|
|
20
|
-
name: 'MuiResponsiveChart',
|
|
21
|
-
slot: 'Container'
|
|
22
|
-
})(({
|
|
23
|
-
ownerState
|
|
24
|
-
}) => ({
|
|
25
|
-
width: ownerState.width ?? '100%',
|
|
26
|
-
height: ownerState.height ?? '100%',
|
|
27
|
-
display: 'flex',
|
|
28
|
-
position: 'relative',
|
|
29
|
-
flexGrow: 1,
|
|
30
|
-
flexDirection: 'column',
|
|
31
|
-
alignItems: 'center',
|
|
32
|
-
justifyContent: 'center',
|
|
33
|
-
overflow: 'hidden',
|
|
34
|
-
'&>svg': {
|
|
35
|
-
width: '100%',
|
|
36
|
-
height: '100%'
|
|
37
|
-
}
|
|
38
|
-
}));
|
|
39
19
|
const ResponsiveChartContainer = exports.ResponsiveChartContainer = /*#__PURE__*/React.forwardRef(function ResponsiveChartContainer(props, ref) {
|
|
40
20
|
const {
|
|
41
21
|
width: inWidth,
|
|
@@ -43,7 +23,7 @@ const ResponsiveChartContainer = exports.ResponsiveChartContainer = /*#__PURE__*
|
|
|
43
23
|
} = props,
|
|
44
24
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
45
25
|
const [containerRef, width, height] = (0, _useChartContainerDimensions.useChartContainerDimensions)(inWidth, inHeight);
|
|
46
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ResizableContainer, {
|
|
26
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ResizableContainer.ResizableContainer, {
|
|
47
27
|
ref: containerRef,
|
|
48
28
|
ownerState: {
|
|
49
29
|
width: inWidth,
|
|
@@ -236,5 +216,28 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
236
216
|
tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
237
217
|
tickSize: _propTypes.default.number,
|
|
238
218
|
valueFormatter: _propTypes.default.func
|
|
219
|
+
})),
|
|
220
|
+
/**
|
|
221
|
+
* The configuration of the z-axes.
|
|
222
|
+
*/
|
|
223
|
+
zAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
224
|
+
colorMap: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
225
|
+
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
226
|
+
type: _propTypes.default.oneOf(['ordinal']).isRequired,
|
|
227
|
+
unknownColor: _propTypes.default.string,
|
|
228
|
+
values: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired)
|
|
229
|
+
}), _propTypes.default.shape({
|
|
230
|
+
color: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string.isRequired), _propTypes.default.func]).isRequired,
|
|
231
|
+
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
232
|
+
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
233
|
+
type: _propTypes.default.oneOf(['continuous']).isRequired
|
|
234
|
+
}), _propTypes.default.shape({
|
|
235
|
+
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
236
|
+
thresholds: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]).isRequired).isRequired,
|
|
237
|
+
type: _propTypes.default.oneOf(['piecewise']).isRequired
|
|
238
|
+
})]),
|
|
239
|
+
data: _propTypes.default.array,
|
|
240
|
+
dataKey: _propTypes.default.string,
|
|
241
|
+
id: _propTypes.default.string
|
|
239
242
|
}))
|
|
240
243
|
} : void 0;
|
|
@@ -6,7 +6,7 @@ import { ScatterSeriesType } from '../models/seriesType/scatter';
|
|
|
6
6
|
import { MakeOptional } from '../models/helpers';
|
|
7
7
|
import { ChartsTooltipProps, ChartsTooltipSlotProps, ChartsTooltipSlots } from '../ChartsTooltip';
|
|
8
8
|
import { ChartsLegendProps, ChartsLegendSlotProps, ChartsLegendSlots } from '../ChartsLegend';
|
|
9
|
-
import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from '../ChartsOverlay
|
|
9
|
+
import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from '../ChartsOverlay';
|
|
10
10
|
import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
|
|
11
11
|
import { ChartsAxisSlots, ChartsAxisSlotProps } from '../models/axis';
|
|
12
12
|
import { ChartsVoronoiHandlerProps } from '../ChartsVoronoiHandler/ChartsVoronoiHandler';
|