@mui/x-charts 7.3.0 → 7.3.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 -0
- package/BarChart/BarChart.js +8 -97
- package/BarChart/BarElement.d.ts +63 -62
- package/BarChart/BarElement.js +1 -2
- package/BarChart/BarPlot.js +3 -3
- package/CHANGELOG.md +79 -2
- package/ChartContainer/ChartContainer.js +3 -1
- package/ChartsAxis/ChartsAxis.js +7 -99
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/ChartsClipPath/ChartsClipPath.js +1 -1
- package/ChartsGrid/ChartsGrid.js +1 -1
- package/ChartsLegend/ChartsLegend.js +1 -1
- package/ChartsLegend/DefaultChartsLegend.js +1 -1
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
- package/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
- package/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/ChartsSurface.js +1 -1
- package/ChartsText/ChartsText.js +1 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +17 -4
- package/ChartsTooltip/ChartsItemTooltipContent.js +20 -4
- package/ChartsTooltip/ChartsTooltip.js +1 -1
- package/ChartsTooltip/ChartsTooltipTable.d.ts +3 -7
- package/ChartsTooltip/ChartsTooltipTable.js +8 -9
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -5
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -4
- package/ChartsTooltip/utils.js +1 -1
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +1 -1
- package/ChartsXAxis/ChartsXAxis.js +1 -1
- package/ChartsYAxis/ChartsYAxis.js +1 -1
- package/Gauge/Gauge.js +1 -1
- package/Gauge/GaugeContainer.js +1 -1
- package/Gauge/GaugeProvider.js +1 -1
- package/Gauge/GaugeReferenceArc.js +1 -1
- package/Gauge/GaugeValueArc.js +1 -1
- package/Gauge/GaugeValueText.js +1 -1
- package/LineChart/AnimatedArea.d.ts +63 -62
- package/LineChart/AnimatedArea.js +1 -1
- package/LineChart/AnimatedLine.d.ts +63 -62
- package/LineChart/AnimatedLine.js +1 -1
- package/LineChart/AreaElement.js +1 -1
- package/LineChart/AreaPlot.js +1 -1
- package/LineChart/LineChart.d.ts +1 -0
- package/LineChart/LineChart.js +8 -97
- package/LineChart/LineElement.js +1 -1
- package/LineChart/LineHighlightElement.js +1 -1
- package/LineChart/LineHighlightPlot.js +1 -1
- package/LineChart/LinePlot.js +1 -1
- package/LineChart/MarkElement.js +1 -1
- package/LineChart/MarkPlot.js +1 -1
- package/PieChart/PieArc.d.ts +1 -0
- package/PieChart/PieArc.js +1 -1
- package/PieChart/PieArcLabel.d.ts +1 -0
- package/PieChart/PieArcLabel.js +1 -1
- package/PieChart/PieArcLabelPlot.js +1 -1
- package/PieChart/PieArcPlot.js +1 -1
- package/PieChart/PieChart.d.ts +1 -0
- package/PieChart/PieChart.js +8 -97
- package/PieChart/PiePlot.js +1 -1
- package/PieChart/dataTransform/transition.d.ts +1 -0
- package/PieChart/dataTransform/useTransformData.js +1 -1
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +3 -1
- package/ResponsiveChartContainer/useChartContainerDimensions.js +1 -1
- package/ScatterChart/Scatter.js +1 -1
- package/ScatterChart/ScatterChart.d.ts +3 -1
- package/ScatterChart/ScatterChart.js +63 -124
- package/ScatterChart/ScatterPlot.js +9 -2
- package/ScatterChart/getColor.d.ts +2 -1
- package/ScatterChart/getColor.js +18 -1
- package/SparkLineChart/SparkLineChart.js +1 -1
- package/context/CartesianContextProvider.d.ts +2 -1
- package/context/CartesianContextProvider.js +1 -1
- package/context/DrawingProvider.js +1 -1
- package/context/HighlightProvider.js +1 -1
- package/context/InteractionProvider.js +1 -1
- package/context/SeriesContextProvider.js +1 -1
- package/context/ZAxisContextProvider.d.ts +33 -0
- package/context/ZAxisContextProvider.js +98 -0
- package/context/index.d.ts +2 -0
- package/context/index.js +8 -1
- package/esm/BarChart/BarChart.js +8 -98
- package/esm/BarChart/BarElement.js +0 -1
- package/esm/BarChart/BarPlot.js +2 -2
- package/esm/ChartContainer/ChartContainer.js +3 -2
- package/esm/ChartsAxis/ChartsAxis.js +7 -100
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -2
- package/esm/ChartsGrid/ChartsGrid.js +1 -2
- package/esm/ChartsLegend/DefaultChartsLegend.js +1 -2
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +1 -2
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +1 -2
- package/esm/ChartsSurface.js +1 -2
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +16 -3
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +19 -3
- package/esm/ChartsTooltip/ChartsTooltipTable.js +8 -8
- package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -6
- package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -5
- package/esm/ChartsXAxis/ChartsXAxis.js +1 -2
- package/esm/ChartsYAxis/ChartsYAxis.js +1 -2
- package/esm/Gauge/Gauge.js +1 -2
- package/esm/LineChart/AnimatedArea.js +1 -2
- package/esm/LineChart/AnimatedLine.js +1 -2
- package/esm/LineChart/LineChart.js +8 -98
- package/esm/PieChart/PieChart.js +8 -98
- package/esm/PieChart/PiePlot.js +1 -2
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -0
- package/esm/ScatterChart/ScatterChart.js +63 -125
- package/esm/ScatterChart/ScatterPlot.js +8 -1
- package/esm/ScatterChart/getColor.js +18 -1
- package/esm/SparkLineChart/SparkLineChart.js +1 -2
- package/esm/context/ZAxisContextProvider.js +89 -0
- package/esm/context/index.js +1 -1
- package/esm/internals/colorGetter.js +2 -2
- package/esm/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +1 -2
- package/esm/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +1 -2
- package/esm/models/z-axis.js +1 -0
- package/hooks/useAxisEvents.js +1 -1
- package/hooks/useChartDimensions.js +1 -1
- package/hooks/useChartId.js +1 -1
- package/hooks/useDrawingArea.js +1 -1
- package/hooks/useInteractionItemProps.js +1 -1
- package/hooks/useMounted.js +1 -1
- package/hooks/useScale.js +1 -1
- package/hooks/useSeries.js +1 -1
- package/hooks/useSvgRef.js +1 -1
- package/hooks/useTicks.js +1 -1
- package/index.js +1 -1
- package/internals/colorGetter.d.ts +3 -1
- package/internals/colorGetter.js +2 -2
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +1 -1
- package/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +1 -1
- package/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +1 -1
- package/internals/defaultizeColor.d.ts +1 -0
- package/internals/useAnimatedPath.d.ts +1 -0
- package/internals/useAnimatedPath.js +1 -1
- package/models/colorMapping.d.ts +3 -2
- package/models/seriesType/pie.d.ts +5 -0
- package/models/seriesType/scatter.d.ts +5 -0
- package/models/z-axis.d.ts +14 -0
- package/models/z-axis.js +5 -0
- package/modern/BarChart/BarChart.js +8 -98
- package/modern/BarChart/BarElement.js +0 -1
- package/modern/BarChart/BarPlot.js +2 -2
- package/modern/ChartContainer/ChartContainer.js +3 -2
- package/modern/ChartsAxis/ChartsAxis.js +7 -100
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -2
- package/modern/ChartsGrid/ChartsGrid.js +1 -2
- package/modern/ChartsLegend/DefaultChartsLegend.js +1 -2
- package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +1 -2
- package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +1 -2
- package/modern/ChartsSurface.js +1 -2
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +16 -3
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +19 -3
- package/modern/ChartsTooltip/ChartsTooltipTable.js +8 -8
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -6
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -5
- package/modern/ChartsXAxis/ChartsXAxis.js +1 -2
- package/modern/ChartsYAxis/ChartsYAxis.js +1 -2
- package/modern/Gauge/Gauge.js +1 -2
- package/modern/LineChart/AnimatedArea.js +1 -2
- package/modern/LineChart/AnimatedLine.js +1 -2
- package/modern/LineChart/LineChart.js +8 -98
- package/modern/PieChart/PieChart.js +8 -98
- package/modern/PieChart/PiePlot.js +1 -2
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -0
- package/modern/ScatterChart/ScatterChart.js +63 -125
- package/modern/ScatterChart/ScatterPlot.js +8 -1
- package/modern/ScatterChart/getColor.js +18 -1
- package/modern/SparkLineChart/SparkLineChart.js +1 -2
- package/modern/context/ZAxisContextProvider.js +89 -0
- package/modern/context/index.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/colorGetter.js +2 -2
- package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +1 -2
- package/modern/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +1 -2
- package/modern/models/z-axis.js +1 -0
- package/package.json +3 -5
|
@@ -16,9 +16,10 @@ var _ChartsLegend = require("../ChartsLegend");
|
|
|
16
16
|
var _ChartsAxisHighlight = require("../ChartsAxisHighlight");
|
|
17
17
|
var _ChartsVoronoiHandler = require("../ChartsVoronoiHandler/ChartsVoronoiHandler");
|
|
18
18
|
var _ChartsGrid = require("../ChartsGrid");
|
|
19
|
+
var _ZAxisContextProvider = require("../context/ZAxisContextProvider");
|
|
19
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
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); }
|
|
21
|
-
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 &&
|
|
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; }
|
|
22
23
|
/**
|
|
23
24
|
* Demos:
|
|
24
25
|
*
|
|
@@ -33,6 +34,7 @@ const ScatterChart = exports.ScatterChart = /*#__PURE__*/React.forwardRef(functi
|
|
|
33
34
|
const {
|
|
34
35
|
xAxis,
|
|
35
36
|
yAxis,
|
|
37
|
+
zAxis,
|
|
36
38
|
series,
|
|
37
39
|
tooltip,
|
|
38
40
|
axisHighlight,
|
|
@@ -54,7 +56,7 @@ const ScatterChart = exports.ScatterChart = /*#__PURE__*/React.forwardRef(functi
|
|
|
54
56
|
slots,
|
|
55
57
|
slotProps
|
|
56
58
|
} = props;
|
|
57
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
59
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ResponsiveChartContainer.ResponsiveChartContainer, {
|
|
58
60
|
ref: ref,
|
|
59
61
|
series: series.map(s => (0, _extends2.default)({
|
|
60
62
|
type: 'scatter'
|
|
@@ -66,32 +68,35 @@ const ScatterChart = exports.ScatterChart = /*#__PURE__*/React.forwardRef(functi
|
|
|
66
68
|
xAxis: xAxis,
|
|
67
69
|
yAxis: yAxis,
|
|
68
70
|
sx: sx,
|
|
69
|
-
children:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
71
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ZAxisContextProvider.ZAxisContextProvider, {
|
|
72
|
+
zAxis: zAxis,
|
|
73
|
+
children: [!disableVoronoi && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsVoronoiHandler.ChartsVoronoiHandler, {
|
|
74
|
+
voronoiMaxRadius: voronoiMaxRadius,
|
|
75
|
+
onItemClick: onItemClick
|
|
76
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, {
|
|
77
|
+
topAxis: topAxis,
|
|
78
|
+
leftAxis: leftAxis,
|
|
79
|
+
rightAxis: rightAxis,
|
|
80
|
+
bottomAxis: bottomAxis,
|
|
81
|
+
slots: slots,
|
|
82
|
+
slotProps: slotProps
|
|
83
|
+
}), grid && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, {
|
|
84
|
+
vertical: grid.vertical,
|
|
85
|
+
horizontal: grid.horizontal
|
|
86
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScatterPlot.ScatterPlot, {
|
|
87
|
+
slots: slots,
|
|
88
|
+
slotProps: slotProps,
|
|
89
|
+
onItemClick: disableVoronoi ? onItemClick : undefined
|
|
90
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legend, {
|
|
91
|
+
slots: slots,
|
|
92
|
+
slotProps: slotProps
|
|
93
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({
|
|
94
|
+
x: "none",
|
|
95
|
+
y: "none"
|
|
96
|
+
}, axisHighlight)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({
|
|
97
|
+
trigger: "item"
|
|
98
|
+
}, tooltip)), children]
|
|
99
|
+
})
|
|
95
100
|
});
|
|
96
101
|
});
|
|
97
102
|
process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
@@ -113,30 +118,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
113
118
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
114
119
|
* @default xAxisIds[0] The id of the first provided axis
|
|
115
120
|
*/
|
|
116
|
-
bottomAxis: _propTypes.default.oneOfType([_propTypes.default.
|
|
117
|
-
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
118
|
-
classes: _propTypes.default.object,
|
|
119
|
-
disableLine: _propTypes.default.bool,
|
|
120
|
-
disableTicks: _propTypes.default.bool,
|
|
121
|
-
fill: _propTypes.default.string,
|
|
122
|
-
label: _propTypes.default.string,
|
|
123
|
-
labelFontSize: _propTypes.default.number,
|
|
124
|
-
labelStyle: _propTypes.default.object,
|
|
125
|
-
position: _propTypes.default.oneOf(['bottom', 'top']),
|
|
126
|
-
slotProps: _propTypes.default.object,
|
|
127
|
-
slots: _propTypes.default.object,
|
|
128
|
-
stroke: _propTypes.default.string,
|
|
129
|
-
tickFontSize: _propTypes.default.number,
|
|
130
|
-
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
131
|
-
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
132
|
-
tickLabelPlacement: _propTypes.default.oneOf(['middle', 'tick']),
|
|
133
|
-
tickLabelStyle: _propTypes.default.object,
|
|
134
|
-
tickMaxStep: _propTypes.default.number,
|
|
135
|
-
tickMinStep: _propTypes.default.number,
|
|
136
|
-
tickNumber: _propTypes.default.number,
|
|
137
|
-
tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
138
|
-
tickSize: _propTypes.default.number
|
|
139
|
-
}), _propTypes.default.string]),
|
|
121
|
+
bottomAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
140
122
|
children: _propTypes.default.node,
|
|
141
123
|
className: _propTypes.default.string,
|
|
142
124
|
/**
|
|
@@ -176,30 +158,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
176
158
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
177
159
|
* @default yAxisIds[0] The id of the first provided axis
|
|
178
160
|
*/
|
|
179
|
-
leftAxis: _propTypes.default.oneOfType([_propTypes.default.
|
|
180
|
-
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
181
|
-
classes: _propTypes.default.object,
|
|
182
|
-
disableLine: _propTypes.default.bool,
|
|
183
|
-
disableTicks: _propTypes.default.bool,
|
|
184
|
-
fill: _propTypes.default.string,
|
|
185
|
-
label: _propTypes.default.string,
|
|
186
|
-
labelFontSize: _propTypes.default.number,
|
|
187
|
-
labelStyle: _propTypes.default.object,
|
|
188
|
-
position: _propTypes.default.oneOf(['left', 'right']),
|
|
189
|
-
slotProps: _propTypes.default.object,
|
|
190
|
-
slots: _propTypes.default.object,
|
|
191
|
-
stroke: _propTypes.default.string,
|
|
192
|
-
tickFontSize: _propTypes.default.number,
|
|
193
|
-
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
194
|
-
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
195
|
-
tickLabelPlacement: _propTypes.default.oneOf(['middle', 'tick']),
|
|
196
|
-
tickLabelStyle: _propTypes.default.object,
|
|
197
|
-
tickMaxStep: _propTypes.default.number,
|
|
198
|
-
tickMinStep: _propTypes.default.number,
|
|
199
|
-
tickNumber: _propTypes.default.number,
|
|
200
|
-
tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
201
|
-
tickSize: _propTypes.default.number
|
|
202
|
-
}), _propTypes.default.string]),
|
|
161
|
+
leftAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
203
162
|
/**
|
|
204
163
|
* @deprecated Consider using `slotProps.legend` instead.
|
|
205
164
|
*/
|
|
@@ -237,32 +196,10 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
237
196
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
238
197
|
* @default null
|
|
239
198
|
*/
|
|
240
|
-
rightAxis: _propTypes.default.oneOfType([_propTypes.default.
|
|
241
|
-
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
242
|
-
classes: _propTypes.default.object,
|
|
243
|
-
disableLine: _propTypes.default.bool,
|
|
244
|
-
disableTicks: _propTypes.default.bool,
|
|
245
|
-
fill: _propTypes.default.string,
|
|
246
|
-
label: _propTypes.default.string,
|
|
247
|
-
labelFontSize: _propTypes.default.number,
|
|
248
|
-
labelStyle: _propTypes.default.object,
|
|
249
|
-
position: _propTypes.default.oneOf(['left', 'right']),
|
|
250
|
-
slotProps: _propTypes.default.object,
|
|
251
|
-
slots: _propTypes.default.object,
|
|
252
|
-
stroke: _propTypes.default.string,
|
|
253
|
-
tickFontSize: _propTypes.default.number,
|
|
254
|
-
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
255
|
-
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
256
|
-
tickLabelPlacement: _propTypes.default.oneOf(['middle', 'tick']),
|
|
257
|
-
tickLabelStyle: _propTypes.default.object,
|
|
258
|
-
tickMaxStep: _propTypes.default.number,
|
|
259
|
-
tickMinStep: _propTypes.default.number,
|
|
260
|
-
tickNumber: _propTypes.default.number,
|
|
261
|
-
tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
262
|
-
tickSize: _propTypes.default.number
|
|
263
|
-
}), _propTypes.default.string]),
|
|
199
|
+
rightAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
264
200
|
/**
|
|
265
201
|
* The series to display in the scatter chart.
|
|
202
|
+
* An array of [[ScatterSeriesType]] objects.
|
|
266
203
|
*/
|
|
267
204
|
series: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
|
268
205
|
/**
|
|
@@ -295,30 +232,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
295
232
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
296
233
|
* @default null
|
|
297
234
|
*/
|
|
298
|
-
topAxis: _propTypes.default.oneOfType([_propTypes.default.
|
|
299
|
-
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
300
|
-
classes: _propTypes.default.object,
|
|
301
|
-
disableLine: _propTypes.default.bool,
|
|
302
|
-
disableTicks: _propTypes.default.bool,
|
|
303
|
-
fill: _propTypes.default.string,
|
|
304
|
-
label: _propTypes.default.string,
|
|
305
|
-
labelFontSize: _propTypes.default.number,
|
|
306
|
-
labelStyle: _propTypes.default.object,
|
|
307
|
-
position: _propTypes.default.oneOf(['bottom', 'top']),
|
|
308
|
-
slotProps: _propTypes.default.object,
|
|
309
|
-
slots: _propTypes.default.object,
|
|
310
|
-
stroke: _propTypes.default.string,
|
|
311
|
-
tickFontSize: _propTypes.default.number,
|
|
312
|
-
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
313
|
-
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
314
|
-
tickLabelPlacement: _propTypes.default.oneOf(['middle', 'tick']),
|
|
315
|
-
tickLabelStyle: _propTypes.default.object,
|
|
316
|
-
tickMaxStep: _propTypes.default.number,
|
|
317
|
-
tickMinStep: _propTypes.default.number,
|
|
318
|
-
tickNumber: _propTypes.default.number,
|
|
319
|
-
tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
320
|
-
tickSize: _propTypes.default.number
|
|
321
|
-
}), _propTypes.default.string]),
|
|
235
|
+
topAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
322
236
|
viewBox: _propTypes.default.shape({
|
|
323
237
|
height: _propTypes.default.number,
|
|
324
238
|
width: _propTypes.default.number,
|
|
@@ -337,6 +251,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
337
251
|
/**
|
|
338
252
|
* The configuration of the x-axes.
|
|
339
253
|
* If not provided, a default axis config is used.
|
|
254
|
+
* An array of [[AxisConfig]] objects.
|
|
340
255
|
*/
|
|
341
256
|
xAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
342
257
|
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
@@ -389,6 +304,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
389
304
|
/**
|
|
390
305
|
* The configuration of the y-axes.
|
|
391
306
|
* If not provided, a default axis config is used.
|
|
307
|
+
* An array of [[AxisConfig]] objects.
|
|
392
308
|
*/
|
|
393
309
|
yAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
394
310
|
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
@@ -437,5 +353,28 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
437
353
|
tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
438
354
|
tickSize: _propTypes.default.number,
|
|
439
355
|
valueFormatter: _propTypes.default.func
|
|
356
|
+
})),
|
|
357
|
+
/**
|
|
358
|
+
* The configuration of the z-axes.
|
|
359
|
+
*/
|
|
360
|
+
zAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
361
|
+
colorMap: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
362
|
+
color: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string.isRequired), _propTypes.default.func]).isRequired,
|
|
363
|
+
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
364
|
+
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
365
|
+
type: _propTypes.default.oneOf(['continuous']).isRequired
|
|
366
|
+
}), _propTypes.default.shape({
|
|
367
|
+
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
368
|
+
thresholds: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]).isRequired).isRequired,
|
|
369
|
+
type: _propTypes.default.oneOf(['piecewise']).isRequired
|
|
370
|
+
}), _propTypes.default.shape({
|
|
371
|
+
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
372
|
+
type: _propTypes.default.oneOf(['ordinal']).isRequired,
|
|
373
|
+
unknownColor: _propTypes.default.string,
|
|
374
|
+
values: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired)
|
|
375
|
+
})]),
|
|
376
|
+
data: _propTypes.default.array,
|
|
377
|
+
dataKey: _propTypes.default.string,
|
|
378
|
+
id: _propTypes.default.string
|
|
440
379
|
}))
|
|
441
380
|
} : void 0;
|
|
@@ -12,9 +12,10 @@ var _Scatter = require("./Scatter");
|
|
|
12
12
|
var _SeriesContextProvider = require("../context/SeriesContextProvider");
|
|
13
13
|
var _CartesianContextProvider = require("../context/CartesianContextProvider");
|
|
14
14
|
var _getColor = _interopRequireDefault(require("./getColor"));
|
|
15
|
+
var _ZAxisContextProvider = require("../context/ZAxisContextProvider");
|
|
15
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
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); }
|
|
17
|
-
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 &&
|
|
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; }
|
|
18
19
|
/**
|
|
19
20
|
* Demos:
|
|
20
21
|
*
|
|
@@ -33,6 +34,10 @@ function ScatterPlot(props) {
|
|
|
33
34
|
} = props;
|
|
34
35
|
const seriesData = React.useContext(_SeriesContextProvider.SeriesContext).scatter;
|
|
35
36
|
const axisData = React.useContext(_CartesianContextProvider.CartesianContext);
|
|
37
|
+
const {
|
|
38
|
+
zAxis,
|
|
39
|
+
zAxisIds
|
|
40
|
+
} = React.useContext(_ZAxisContextProvider.ZAxisContext);
|
|
36
41
|
if (seriesData === undefined) {
|
|
37
42
|
return null;
|
|
38
43
|
}
|
|
@@ -48,6 +53,7 @@ function ScatterPlot(props) {
|
|
|
48
53
|
} = axisData;
|
|
49
54
|
const defaultXAxisId = xAxisIds[0];
|
|
50
55
|
const defaultYAxisId = yAxisIds[0];
|
|
56
|
+
const defaultZAxisId = zAxisIds[0];
|
|
51
57
|
const ScatterItems = slots?.scatter ?? _Scatter.Scatter;
|
|
52
58
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
|
|
53
59
|
children: seriesOrder.map(seriesId => {
|
|
@@ -55,10 +61,11 @@ function ScatterPlot(props) {
|
|
|
55
61
|
id,
|
|
56
62
|
xAxisKey,
|
|
57
63
|
yAxisKey,
|
|
64
|
+
zAxisKey,
|
|
58
65
|
markerSize,
|
|
59
66
|
color
|
|
60
67
|
} = series[seriesId];
|
|
61
|
-
const colorGetter = (0, _getColor.default)(series[seriesId], xAxis[xAxisKey ?? defaultXAxisId], yAxis[yAxisKey ?? defaultYAxisId]);
|
|
68
|
+
const colorGetter = (0, _getColor.default)(series[seriesId], xAxis[xAxisKey ?? defaultXAxisId], yAxis[yAxisKey ?? defaultYAxisId], zAxis[zAxisKey ?? defaultZAxisId]);
|
|
62
69
|
const xScale = xAxis[xAxisKey ?? defaultXAxisId].scale;
|
|
63
70
|
const yScale = yAxis[yAxisKey ?? defaultYAxisId].scale;
|
|
64
71
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ScatterItems, (0, _extends2.default)({
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { AxisDefaultized } from '../models/axis';
|
|
2
|
+
import { ZAxisDefaultized } from '../models/z-axis';
|
|
2
3
|
import { DefaultizedScatterSeriesType } from '../models/seriesType/scatter';
|
|
3
|
-
export default function getColor(series: DefaultizedScatterSeriesType, xAxis: AxisDefaultized, yAxis: AxisDefaultized): (dataIndex: number) => string;
|
|
4
|
+
export default function getColor(series: DefaultizedScatterSeriesType, xAxis: AxisDefaultized, yAxis: AxisDefaultized, zAxis?: ZAxisDefaultized): (dataIndex: number) => string;
|
package/ScatterChart/getColor.js
CHANGED
|
@@ -4,9 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = getColor;
|
|
7
|
-
function getColor(series, xAxis, yAxis) {
|
|
7
|
+
function getColor(series, xAxis, yAxis, zAxis) {
|
|
8
|
+
const zColorScale = zAxis?.colorScale;
|
|
8
9
|
const yColorScale = yAxis.colorScale;
|
|
9
10
|
const xColorScale = xAxis.colorScale;
|
|
11
|
+
if (zColorScale) {
|
|
12
|
+
return dataIndex => {
|
|
13
|
+
if (zAxis?.data?.[dataIndex] !== undefined) {
|
|
14
|
+
const color = zColorScale(zAxis?.data?.[dataIndex]);
|
|
15
|
+
if (color !== null) {
|
|
16
|
+
return color;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const value = series.data[dataIndex];
|
|
20
|
+
const color = value === null ? series.color : zColorScale(value.z);
|
|
21
|
+
if (color === null) {
|
|
22
|
+
return series.color;
|
|
23
|
+
}
|
|
24
|
+
return color;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
10
27
|
if (yColorScale) {
|
|
11
28
|
return dataIndex => {
|
|
12
29
|
const value = series.data[dataIndex];
|
|
@@ -16,7 +16,7 @@ var _ChartsTooltip = require("../ChartsTooltip");
|
|
|
16
16
|
var _ChartsAxisHighlight = require("../ChartsAxisHighlight");
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
18
|
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); }
|
|
19
|
-
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 &&
|
|
19
|
+
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; }
|
|
20
20
|
const SPARKLINE_DEFAULT_MARGIN = {
|
|
21
21
|
top: 5,
|
|
22
22
|
bottom: 5,
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { AxisConfig, AxisDefaultized } from '../models/axis';
|
|
3
|
-
import { DEFAULT_X_AXIS_KEY } from '../constants';
|
|
4
3
|
import { DatasetType } from '../models/seriesType/config';
|
|
5
4
|
import { MakeOptional } from '../models/helpers';
|
|
6
5
|
export type CartesianContextProviderProps = {
|
|
7
6
|
/**
|
|
8
7
|
* The configuration of the x-axes.
|
|
9
8
|
* If not provided, a default axis config is used.
|
|
9
|
+
* An array of [[AxisConfig]] objects.
|
|
10
10
|
*/
|
|
11
11
|
xAxis?: MakeOptional<AxisConfig, 'id'>[];
|
|
12
12
|
/**
|
|
13
13
|
* The configuration of the y-axes.
|
|
14
14
|
* If not provided, a default axis config is used.
|
|
15
|
+
* An array of [[AxisConfig]] objects.
|
|
15
16
|
*/
|
|
16
17
|
yAxis?: MakeOptional<AxisConfig, 'id'>[];
|
|
17
18
|
/**
|
|
@@ -21,7 +21,7 @@ var _useDrawingArea = require("../hooks/useDrawingArea");
|
|
|
21
21
|
var _colorScale = require("../internals/colorScale");
|
|
22
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
23
|
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); }
|
|
24
|
-
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 &&
|
|
24
|
+
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; }
|
|
25
25
|
const DEFAULT_CATEGORY_GAP_RATIO = 0.2;
|
|
26
26
|
const DEFAULT_BAR_GAP_RATIO = 0.1;
|
|
27
27
|
|
|
@@ -13,7 +13,7 @@ var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
|
13
13
|
var _useChartDimensions = _interopRequireDefault(require("../hooks/useChartDimensions"));
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
15
|
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); }
|
|
16
|
-
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 &&
|
|
16
|
+
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; }
|
|
17
17
|
/**
|
|
18
18
|
* Defines the area in which it is possible to draw the charts.
|
|
19
19
|
*/
|
|
@@ -10,7 +10,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
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); }
|
|
13
|
-
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 &&
|
|
13
|
+
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; }
|
|
14
14
|
const defaultScope = {
|
|
15
15
|
highlighted: 'none',
|
|
16
16
|
faded: 'none'
|
|
@@ -10,7 +10,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
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); }
|
|
13
|
-
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 &&
|
|
13
|
+
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; }
|
|
14
14
|
const InteractionContext = exports.InteractionContext = /*#__PURE__*/React.createContext({
|
|
15
15
|
item: null,
|
|
16
16
|
axis: {
|
|
@@ -17,7 +17,7 @@ var _defaultizeColor = require("../internals/defaultizeColor");
|
|
|
17
17
|
var _colorPalettes = require("../colorPalettes");
|
|
18
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
19
|
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); }
|
|
20
|
-
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 &&
|
|
20
|
+
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; }
|
|
21
21
|
const SeriesContext = exports.SeriesContext = /*#__PURE__*/React.createContext({});
|
|
22
22
|
if (process.env.NODE_ENV !== 'production') {
|
|
23
23
|
SeriesContext.displayName = 'SeriesContext';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { DatasetType } from '../models/seriesType/config';
|
|
3
|
+
import { MakeOptional } from '../models/helpers';
|
|
4
|
+
import { ZAxisConfig, ZAxisDefaultized } from '../models/z-axis';
|
|
5
|
+
export type ZAxisContextProviderProps = {
|
|
6
|
+
/**
|
|
7
|
+
* The configuration of the z-axes.
|
|
8
|
+
*/
|
|
9
|
+
zAxis?: MakeOptional<ZAxisConfig, 'id'>[];
|
|
10
|
+
/**
|
|
11
|
+
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
12
|
+
*/
|
|
13
|
+
dataset?: DatasetType;
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
};
|
|
16
|
+
type DefaultizedZAxisConfig = {
|
|
17
|
+
[axisKey: string]: ZAxisDefaultized;
|
|
18
|
+
};
|
|
19
|
+
export declare const ZAxisContext: React.Context<{
|
|
20
|
+
/**
|
|
21
|
+
* Mapping from z-axis key to scaling configuration.
|
|
22
|
+
*/
|
|
23
|
+
zAxis: DefaultizedZAxisConfig;
|
|
24
|
+
/**
|
|
25
|
+
* The z-axes IDs sorted by order they got provided.
|
|
26
|
+
*/
|
|
27
|
+
zAxisIds: string[];
|
|
28
|
+
}>;
|
|
29
|
+
declare function ZAxisContextProvider(props: ZAxisContextProviderProps): React.JSX.Element;
|
|
30
|
+
declare namespace ZAxisContextProvider {
|
|
31
|
+
var propTypes: any;
|
|
32
|
+
}
|
|
33
|
+
export { ZAxisContextProvider };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ZAxisContext = void 0;
|
|
8
|
+
exports.ZAxisContextProvider = ZAxisContextProvider;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _colorScale = require("../internals/colorScale");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
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); }
|
|
15
|
+
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; }
|
|
16
|
+
const ZAxisContext = exports.ZAxisContext = /*#__PURE__*/React.createContext({
|
|
17
|
+
zAxis: {},
|
|
18
|
+
zAxisIds: []
|
|
19
|
+
});
|
|
20
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
21
|
+
ZAxisContext.displayName = 'ZAxisContext';
|
|
22
|
+
}
|
|
23
|
+
function ZAxisContextProvider(props) {
|
|
24
|
+
const {
|
|
25
|
+
zAxis: inZAxis,
|
|
26
|
+
dataset,
|
|
27
|
+
children
|
|
28
|
+
} = props;
|
|
29
|
+
const zAxis = React.useMemo(() => inZAxis?.map(axisConfig => {
|
|
30
|
+
const dataKey = axisConfig.dataKey;
|
|
31
|
+
if (dataKey === undefined || axisConfig.data !== undefined) {
|
|
32
|
+
return axisConfig;
|
|
33
|
+
}
|
|
34
|
+
if (dataset === undefined) {
|
|
35
|
+
throw Error('MUI X Charts: z-axis uses `dataKey` but no `dataset` is provided.');
|
|
36
|
+
}
|
|
37
|
+
return (0, _extends2.default)({}, axisConfig, {
|
|
38
|
+
data: dataset.map(d => d[dataKey])
|
|
39
|
+
});
|
|
40
|
+
}), [inZAxis, dataset]);
|
|
41
|
+
const value = React.useMemo(() => {
|
|
42
|
+
const allZAxis = zAxis?.map((axis, index) => (0, _extends2.default)({
|
|
43
|
+
id: `defaultized-z-axis-${index}`
|
|
44
|
+
}, axis)) ?? [];
|
|
45
|
+
const completedZAxis = {};
|
|
46
|
+
allZAxis.forEach(axis => {
|
|
47
|
+
completedZAxis[axis.id] = (0, _extends2.default)({}, axis, {
|
|
48
|
+
colorScale: axis.colorMap && (axis.colorMap.type === 'ordinal' && axis.data ? (0, _colorScale.getOrdinalColorScale)((0, _extends2.default)({
|
|
49
|
+
values: axis.data
|
|
50
|
+
}, axis.colorMap)) : (0, _colorScale.getColorScale)(axis.colorMap))
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
zAxis: completedZAxis,
|
|
55
|
+
zAxisIds: allZAxis.map(({
|
|
56
|
+
id
|
|
57
|
+
}) => id)
|
|
58
|
+
};
|
|
59
|
+
}, [zAxis]);
|
|
60
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ZAxisContext.Provider, {
|
|
61
|
+
value: value,
|
|
62
|
+
children: children
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
process.env.NODE_ENV !== "production" ? ZAxisContextProvider.propTypes = {
|
|
66
|
+
// ----------------------------- Warning --------------------------------
|
|
67
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
68
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
69
|
+
// ----------------------------------------------------------------------
|
|
70
|
+
children: _propTypes.default.node,
|
|
71
|
+
/**
|
|
72
|
+
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
73
|
+
*/
|
|
74
|
+
dataset: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
75
|
+
/**
|
|
76
|
+
* The configuration of the z-axes.
|
|
77
|
+
*/
|
|
78
|
+
zAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
79
|
+
colorMap: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
80
|
+
color: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string.isRequired), _propTypes.default.func]).isRequired,
|
|
81
|
+
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
82
|
+
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
83
|
+
type: _propTypes.default.oneOf(['continuous']).isRequired
|
|
84
|
+
}), _propTypes.default.shape({
|
|
85
|
+
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
86
|
+
thresholds: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]).isRequired).isRequired,
|
|
87
|
+
type: _propTypes.default.oneOf(['piecewise']).isRequired
|
|
88
|
+
}), _propTypes.default.shape({
|
|
89
|
+
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
90
|
+
type: _propTypes.default.oneOf(['ordinal']).isRequired,
|
|
91
|
+
unknownColor: _propTypes.default.string,
|
|
92
|
+
values: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired)
|
|
93
|
+
})]),
|
|
94
|
+
data: _propTypes.default.array,
|
|
95
|
+
dataKey: _propTypes.default.string,
|
|
96
|
+
id: _propTypes.default.string
|
|
97
|
+
}))
|
|
98
|
+
} : void 0;
|
package/context/index.d.ts
CHANGED
package/context/index.js
CHANGED
|
@@ -2,4 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
|
-
});
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "ZAxisContextProvider", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _ZAxisContextProvider.ZAxisContextProvider;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _ZAxisContextProvider = require("./ZAxisContextProvider");
|