@mui/x-charts 7.2.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 +40 -99
- package/BarChart/BarElement.d.ts +63 -62
- package/BarChart/BarElement.js +1 -2
- package/BarChart/BarPlot.js +14 -7
- package/BarChart/getColor.d.ts +3 -0
- package/BarChart/getColor.js +33 -0
- package/CHANGELOG.md +204 -2
- package/ChartContainer/ChartContainer.js +38 -5
- package/ChartsAxis/ChartsAxis.js +11 -103
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/ChartsClipPath/ChartsClipPath.js +3 -3
- package/ChartsGrid/ChartsGrid.js +1 -1
- package/ChartsLegend/ChartsLegend.js +3 -3
- 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.d.ts +4 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +21 -3
- package/ChartsTooltip/ChartsItemTooltipContent.d.ts +6 -0
- package/ChartsTooltip/ChartsItemTooltipContent.js +32 -2
- package/ChartsTooltip/ChartsTooltip.js +1 -1
- package/ChartsTooltip/ChartsTooltipTable.d.ts +3 -7
- package/ChartsTooltip/ChartsTooltipTable.js +8 -9
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +7 -7
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +15 -8
- package/ChartsTooltip/utils.d.ts +5 -1
- package/ChartsTooltip/utils.js +1 -1
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +7 -7
- package/ChartsXAxis/ChartsXAxis.js +3 -3
- package/ChartsYAxis/ChartsYAxis.js +3 -3
- package/Gauge/Gauge.js +1 -1
- package/Gauge/GaugeContainer.js +1 -1
- package/Gauge/GaugeProvider.js +6 -6
- 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 +7 -6
- package/LineChart/AnimatedLine.d.ts +63 -62
- package/LineChart/AnimatedLine.js +8 -6
- package/LineChart/AreaElement.d.ts +1 -0
- package/LineChart/AreaElement.js +5 -2
- package/LineChart/AreaPlot.js +8 -2
- package/LineChart/LineChart.d.ts +1 -0
- package/LineChart/LineChart.js +40 -99
- package/LineChart/LineElement.d.ts +1 -0
- package/LineChart/LineElement.js +5 -2
- package/LineChart/LineHighlightElement.js +1 -1
- package/LineChart/LineHighlightPlot.js +5 -2
- package/LineChart/LinePlot.js +8 -2
- package/LineChart/MarkElement.js +1 -1
- package/LineChart/MarkPlot.js +6 -6
- package/LineChart/getColor.d.ts +3 -0
- package/LineChart/getColor.js +31 -0
- 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 +40 -99
- package/PieChart/PiePlot.js +27 -7
- package/PieChart/dataTransform/transition.d.ts +1 -0
- package/PieChart/dataTransform/useTransformData.js +1 -1
- package/PieChart/formatter.js +4 -2
- package/PieChart/getColor.d.ts +2 -0
- package/PieChart/getColor.js +11 -0
- package/PieChart/getPieCoordinates.d.ts +7 -0
- package/PieChart/getPieCoordinates.js +25 -0
- package/PieChart/index.d.ts +1 -0
- package/PieChart/index.js +11 -0
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +35 -3
- package/ResponsiveChartContainer/useChartContainerDimensions.js +1 -1
- package/ScatterChart/Scatter.d.ts +1 -0
- package/ScatterChart/Scatter.js +7 -4
- package/ScatterChart/ScatterChart.d.ts +3 -1
- package/ScatterChart/ScatterChart.js +95 -126
- package/ScatterChart/ScatterPlot.js +11 -1
- package/ScatterChart/getColor.d.ts +4 -0
- package/ScatterChart/getColor.js +48 -0
- package/SparkLineChart/SparkLineChart.js +16 -1
- package/context/CartesianContextProvider.d.ts +4 -3
- package/context/CartesianContextProvider.js +24 -9
- 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 +40 -100
- package/esm/BarChart/BarElement.js +0 -1
- package/esm/BarChart/BarPlot.js +15 -7
- package/esm/BarChart/getColor.js +27 -0
- package/esm/ChartContainer/ChartContainer.js +38 -5
- package/esm/ChartsAxis/ChartsAxis.js +11 -104
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -2
- package/esm/ChartsClipPath/ChartsClipPath.js +2 -2
- package/esm/ChartsGrid/ChartsGrid.js +1 -2
- package/esm/ChartsLegend/ChartsLegend.js +2 -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 +20 -2
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +31 -1
- package/esm/ChartsTooltip/ChartsTooltipTable.js +8 -8
- package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +7 -8
- package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +15 -9
- package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +6 -6
- package/esm/ChartsXAxis/ChartsXAxis.js +3 -4
- package/esm/ChartsYAxis/ChartsYAxis.js +3 -4
- package/esm/Gauge/Gauge.js +1 -2
- package/esm/Gauge/GaugeProvider.js +5 -5
- package/esm/LineChart/AnimatedArea.js +7 -7
- package/esm/LineChart/AnimatedLine.js +8 -7
- package/esm/LineChart/AreaElement.js +4 -1
- package/esm/LineChart/AreaPlot.js +7 -1
- package/esm/LineChart/LineChart.js +40 -100
- package/esm/LineChart/LineElement.js +4 -1
- package/esm/LineChart/LineHighlightPlot.js +4 -1
- package/esm/LineChart/LinePlot.js +7 -1
- package/esm/LineChart/MarkPlot.js +5 -5
- package/esm/LineChart/getColor.js +25 -0
- package/esm/PieChart/PieChart.js +40 -100
- package/esm/PieChart/PiePlot.js +27 -8
- package/esm/PieChart/formatter.js +4 -2
- package/esm/PieChart/getColor.js +5 -0
- package/esm/PieChart/getPieCoordinates.js +19 -0
- package/esm/PieChart/index.js +2 -1
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +34 -2
- package/esm/ScatterChart/Scatter.js +6 -3
- package/esm/ScatterChart/ScatterChart.js +95 -127
- package/esm/ScatterChart/ScatterPlot.js +10 -0
- package/esm/ScatterChart/getColor.js +42 -0
- package/esm/SparkLineChart/SparkLineChart.js +16 -2
- package/esm/context/CartesianContextProvider.js +23 -8
- package/esm/context/ZAxisContextProvider.js +89 -0
- package/esm/context/index.js +1 -1
- package/esm/hooks/index.js +4 -1
- package/esm/hooks/useAxisEvents.js +7 -6
- package/esm/hooks/useChartId.js +8 -0
- package/esm/hooks/useSeries.js +64 -0
- package/esm/hooks/useSvgRef.js +9 -0
- package/esm/internals/colorGetter.js +22 -0
- package/esm/internals/colorScale.js +16 -0
- package/esm/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +95 -0
- package/esm/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +55 -0
- package/esm/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +40 -0
- package/esm/internals/components/ChartsAxesGradients/index.js +1 -0
- package/esm/models/colorMapping.js +1 -0
- package/esm/models/seriesType/index.js +6 -1
- package/esm/models/z-axis.js +1 -0
- package/hooks/index.d.ts +3 -0
- package/hooks/index.js +65 -1
- package/hooks/useAxisEvents.js +8 -7
- package/hooks/useChartDimensions.js +1 -1
- package/hooks/useChartId.d.ts +1 -0
- package/hooks/useChartId.js +16 -0
- 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.d.ts +45 -0
- package/hooks/useSeries.js +75 -0
- package/hooks/useSvgRef.d.ts +2 -0
- package/hooks/useSvgRef.js +17 -0
- package/hooks/useTicks.js +1 -1
- package/index.js +1 -1
- package/internals/colorGetter.d.ts +7 -0
- package/internals/colorGetter.js +29 -0
- package/internals/colorScale.d.ts +5 -0
- package/internals/colorScale.js +24 -0
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.d.ts +3 -0
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +105 -0
- package/internals/components/ChartsAxesGradients/ChartsContinuousGradient.d.ts +13 -0
- package/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +63 -0
- package/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.d.ts +12 -0
- package/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +48 -0
- package/internals/components/ChartsAxesGradients/index.d.ts +1 -0
- package/internals/components/ChartsAxesGradients/index.js +16 -0
- package/internals/defaultizeColor.d.ts +5 -4
- package/internals/defaultizeValueFormatter.d.ts +5 -5
- package/internals/getScale.d.ts +2 -2
- package/internals/useAnimatedPath.d.ts +1 -0
- package/internals/useAnimatedPath.js +1 -1
- package/models/axis.d.ts +44 -4
- package/models/colorMapping.d.ts +46 -0
- package/models/colorMapping.js +5 -0
- package/models/index.d.ts +1 -1
- package/models/seriesType/common.d.ts +10 -2
- package/models/seriesType/index.d.ts +2 -0
- package/models/seriesType/index.js +17 -1
- 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 +40 -100
- package/modern/BarChart/BarElement.js +0 -1
- package/modern/BarChart/BarPlot.js +15 -7
- package/modern/BarChart/getColor.js +27 -0
- package/modern/ChartContainer/ChartContainer.js +38 -5
- package/modern/ChartsAxis/ChartsAxis.js +11 -104
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -2
- package/modern/ChartsClipPath/ChartsClipPath.js +2 -2
- package/modern/ChartsGrid/ChartsGrid.js +1 -2
- package/modern/ChartsLegend/ChartsLegend.js +2 -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 +20 -2
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +31 -1
- package/modern/ChartsTooltip/ChartsTooltipTable.js +8 -8
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +7 -8
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +15 -9
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +6 -6
- package/modern/ChartsXAxis/ChartsXAxis.js +3 -4
- package/modern/ChartsYAxis/ChartsYAxis.js +3 -4
- package/modern/Gauge/Gauge.js +1 -2
- package/modern/Gauge/GaugeProvider.js +5 -5
- package/modern/LineChart/AnimatedArea.js +7 -7
- package/modern/LineChart/AnimatedLine.js +8 -7
- package/modern/LineChart/AreaElement.js +4 -1
- package/modern/LineChart/AreaPlot.js +7 -1
- package/modern/LineChart/LineChart.js +40 -100
- package/modern/LineChart/LineElement.js +4 -1
- package/modern/LineChart/LineHighlightPlot.js +4 -1
- package/modern/LineChart/LinePlot.js +7 -1
- package/modern/LineChart/MarkPlot.js +5 -5
- package/modern/LineChart/getColor.js +25 -0
- package/modern/PieChart/PieChart.js +40 -100
- package/modern/PieChart/PiePlot.js +27 -8
- package/modern/PieChart/formatter.js +4 -2
- package/modern/PieChart/getColor.js +5 -0
- package/modern/PieChart/getPieCoordinates.js +19 -0
- package/modern/PieChart/index.js +2 -1
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +34 -2
- package/modern/ScatterChart/Scatter.js +6 -3
- package/modern/ScatterChart/ScatterChart.js +95 -127
- package/modern/ScatterChart/ScatterPlot.js +10 -0
- package/modern/ScatterChart/getColor.js +42 -0
- package/modern/SparkLineChart/SparkLineChart.js +16 -2
- package/modern/context/CartesianContextProvider.js +23 -8
- package/modern/context/ZAxisContextProvider.js +89 -0
- package/modern/context/index.js +1 -1
- package/modern/hooks/index.js +4 -1
- package/modern/hooks/useAxisEvents.js +7 -6
- package/modern/hooks/useChartId.js +8 -0
- package/modern/hooks/useSeries.js +64 -0
- package/modern/hooks/useSvgRef.js +9 -0
- package/modern/index.js +1 -1
- package/modern/internals/colorGetter.js +22 -0
- package/modern/internals/colorScale.js +16 -0
- package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +95 -0
- package/modern/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +55 -0
- package/modern/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +40 -0
- package/modern/internals/components/ChartsAxesGradients/index.js +1 -0
- package/modern/models/colorMapping.js +1 -0
- package/modern/models/seriesType/index.js +6 -1
- package/modern/models/z-axis.js +1 -0
- package/package.json +3 -5
package/PieChart/PieChart.js
CHANGED
|
@@ -18,7 +18,7 @@ var _PiePlot = require("./PiePlot");
|
|
|
18
18
|
var _useIsRTL = require("../internals/useIsRTL");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
20
|
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 &&
|
|
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 && {}.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
22
|
const defaultMargin = {
|
|
23
23
|
top: 5,
|
|
24
24
|
bottom: 5,
|
|
@@ -132,30 +132,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
132
132
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
133
133
|
* @default null
|
|
134
134
|
*/
|
|
135
|
-
bottomAxis: _propTypes.default.oneOfType([_propTypes.default.
|
|
136
|
-
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
137
|
-
classes: _propTypes.default.object,
|
|
138
|
-
disableLine: _propTypes.default.bool,
|
|
139
|
-
disableTicks: _propTypes.default.bool,
|
|
140
|
-
fill: _propTypes.default.string,
|
|
141
|
-
label: _propTypes.default.string,
|
|
142
|
-
labelFontSize: _propTypes.default.number,
|
|
143
|
-
labelStyle: _propTypes.default.object,
|
|
144
|
-
position: _propTypes.default.oneOf(['bottom', 'top']),
|
|
145
|
-
slotProps: _propTypes.default.object,
|
|
146
|
-
slots: _propTypes.default.object,
|
|
147
|
-
stroke: _propTypes.default.string,
|
|
148
|
-
tickFontSize: _propTypes.default.number,
|
|
149
|
-
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
150
|
-
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
151
|
-
tickLabelPlacement: _propTypes.default.oneOf(['middle', 'tick']),
|
|
152
|
-
tickLabelStyle: _propTypes.default.object,
|
|
153
|
-
tickMaxStep: _propTypes.default.number,
|
|
154
|
-
tickMinStep: _propTypes.default.number,
|
|
155
|
-
tickNumber: _propTypes.default.number,
|
|
156
|
-
tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
157
|
-
tickSize: _propTypes.default.number
|
|
158
|
-
}), _propTypes.default.string]),
|
|
135
|
+
bottomAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
159
136
|
children: _propTypes.default.node,
|
|
160
137
|
className: _propTypes.default.string,
|
|
161
138
|
/**
|
|
@@ -183,30 +160,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
183
160
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
184
161
|
* @default null
|
|
185
162
|
*/
|
|
186
|
-
leftAxis: _propTypes.default.oneOfType([_propTypes.default.
|
|
187
|
-
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
188
|
-
classes: _propTypes.default.object,
|
|
189
|
-
disableLine: _propTypes.default.bool,
|
|
190
|
-
disableTicks: _propTypes.default.bool,
|
|
191
|
-
fill: _propTypes.default.string,
|
|
192
|
-
label: _propTypes.default.string,
|
|
193
|
-
labelFontSize: _propTypes.default.number,
|
|
194
|
-
labelStyle: _propTypes.default.object,
|
|
195
|
-
position: _propTypes.default.oneOf(['left', 'right']),
|
|
196
|
-
slotProps: _propTypes.default.object,
|
|
197
|
-
slots: _propTypes.default.object,
|
|
198
|
-
stroke: _propTypes.default.string,
|
|
199
|
-
tickFontSize: _propTypes.default.number,
|
|
200
|
-
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
201
|
-
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
202
|
-
tickLabelPlacement: _propTypes.default.oneOf(['middle', 'tick']),
|
|
203
|
-
tickLabelStyle: _propTypes.default.object,
|
|
204
|
-
tickMaxStep: _propTypes.default.number,
|
|
205
|
-
tickMinStep: _propTypes.default.number,
|
|
206
|
-
tickNumber: _propTypes.default.number,
|
|
207
|
-
tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
208
|
-
tickSize: _propTypes.default.number
|
|
209
|
-
}), _propTypes.default.string]),
|
|
163
|
+
leftAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
210
164
|
/**
|
|
211
165
|
* The props of the legend.
|
|
212
166
|
* @default { direction: 'column', position: { vertical: 'middle', horizontal: 'right' } }
|
|
@@ -244,32 +198,10 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
244
198
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
245
199
|
* @default null
|
|
246
200
|
*/
|
|
247
|
-
rightAxis: _propTypes.default.oneOfType([_propTypes.default.
|
|
248
|
-
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
249
|
-
classes: _propTypes.default.object,
|
|
250
|
-
disableLine: _propTypes.default.bool,
|
|
251
|
-
disableTicks: _propTypes.default.bool,
|
|
252
|
-
fill: _propTypes.default.string,
|
|
253
|
-
label: _propTypes.default.string,
|
|
254
|
-
labelFontSize: _propTypes.default.number,
|
|
255
|
-
labelStyle: _propTypes.default.object,
|
|
256
|
-
position: _propTypes.default.oneOf(['left', 'right']),
|
|
257
|
-
slotProps: _propTypes.default.object,
|
|
258
|
-
slots: _propTypes.default.object,
|
|
259
|
-
stroke: _propTypes.default.string,
|
|
260
|
-
tickFontSize: _propTypes.default.number,
|
|
261
|
-
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
262
|
-
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
263
|
-
tickLabelPlacement: _propTypes.default.oneOf(['middle', 'tick']),
|
|
264
|
-
tickLabelStyle: _propTypes.default.object,
|
|
265
|
-
tickMaxStep: _propTypes.default.number,
|
|
266
|
-
tickMinStep: _propTypes.default.number,
|
|
267
|
-
tickNumber: _propTypes.default.number,
|
|
268
|
-
tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
269
|
-
tickSize: _propTypes.default.number
|
|
270
|
-
}), _propTypes.default.string]),
|
|
201
|
+
rightAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
271
202
|
/**
|
|
272
203
|
* The series to display in the pie chart.
|
|
204
|
+
* An array of [[PieSeriesType]] objects.
|
|
273
205
|
*/
|
|
274
206
|
series: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
|
275
207
|
/**
|
|
@@ -307,30 +239,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
307
239
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
308
240
|
* @default null
|
|
309
241
|
*/
|
|
310
|
-
topAxis: _propTypes.default.oneOfType([_propTypes.default.
|
|
311
|
-
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
312
|
-
classes: _propTypes.default.object,
|
|
313
|
-
disableLine: _propTypes.default.bool,
|
|
314
|
-
disableTicks: _propTypes.default.bool,
|
|
315
|
-
fill: _propTypes.default.string,
|
|
316
|
-
label: _propTypes.default.string,
|
|
317
|
-
labelFontSize: _propTypes.default.number,
|
|
318
|
-
labelStyle: _propTypes.default.object,
|
|
319
|
-
position: _propTypes.default.oneOf(['bottom', 'top']),
|
|
320
|
-
slotProps: _propTypes.default.object,
|
|
321
|
-
slots: _propTypes.default.object,
|
|
322
|
-
stroke: _propTypes.default.string,
|
|
323
|
-
tickFontSize: _propTypes.default.number,
|
|
324
|
-
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
325
|
-
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
326
|
-
tickLabelPlacement: _propTypes.default.oneOf(['middle', 'tick']),
|
|
327
|
-
tickLabelStyle: _propTypes.default.object,
|
|
328
|
-
tickMaxStep: _propTypes.default.number,
|
|
329
|
-
tickMinStep: _propTypes.default.number,
|
|
330
|
-
tickNumber: _propTypes.default.number,
|
|
331
|
-
tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
332
|
-
tickSize: _propTypes.default.number
|
|
333
|
-
}), _propTypes.default.string]),
|
|
242
|
+
topAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
334
243
|
viewBox: _propTypes.default.shape({
|
|
335
244
|
height: _propTypes.default.number,
|
|
336
245
|
width: _propTypes.default.number,
|
|
@@ -343,11 +252,27 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
343
252
|
width: _propTypes.default.number,
|
|
344
253
|
/**
|
|
345
254
|
* The configuration of the x-axes.
|
|
346
|
-
* If not provided, a default axis config is used
|
|
255
|
+
* If not provided, a default axis config is used.
|
|
256
|
+
* An array of [[AxisConfig]] objects.
|
|
347
257
|
*/
|
|
348
258
|
xAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
349
259
|
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
350
260
|
classes: _propTypes.default.object,
|
|
261
|
+
colorMap: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
262
|
+
color: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string.isRequired), _propTypes.default.func]).isRequired,
|
|
263
|
+
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
264
|
+
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
265
|
+
type: _propTypes.default.oneOf(['continuous']).isRequired
|
|
266
|
+
}), _propTypes.default.shape({
|
|
267
|
+
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
268
|
+
thresholds: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]).isRequired).isRequired,
|
|
269
|
+
type: _propTypes.default.oneOf(['piecewise']).isRequired
|
|
270
|
+
}), _propTypes.default.shape({
|
|
271
|
+
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
272
|
+
type: _propTypes.default.oneOf(['ordinal']).isRequired,
|
|
273
|
+
unknownColor: _propTypes.default.string,
|
|
274
|
+
values: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired)
|
|
275
|
+
})]),
|
|
351
276
|
data: _propTypes.default.array,
|
|
352
277
|
dataKey: _propTypes.default.string,
|
|
353
278
|
disableLine: _propTypes.default.bool,
|
|
@@ -380,11 +305,27 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
380
305
|
})),
|
|
381
306
|
/**
|
|
382
307
|
* The configuration of the y-axes.
|
|
383
|
-
* If not provided, a default axis config is used
|
|
308
|
+
* If not provided, a default axis config is used.
|
|
309
|
+
* An array of [[AxisConfig]] objects.
|
|
384
310
|
*/
|
|
385
311
|
yAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
386
312
|
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
387
313
|
classes: _propTypes.default.object,
|
|
314
|
+
colorMap: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
315
|
+
color: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string.isRequired), _propTypes.default.func]).isRequired,
|
|
316
|
+
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
317
|
+
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
318
|
+
type: _propTypes.default.oneOf(['continuous']).isRequired
|
|
319
|
+
}), _propTypes.default.shape({
|
|
320
|
+
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
321
|
+
thresholds: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]).isRequired).isRequired,
|
|
322
|
+
type: _propTypes.default.oneOf(['piecewise']).isRequired
|
|
323
|
+
}), _propTypes.default.shape({
|
|
324
|
+
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
325
|
+
type: _propTypes.default.oneOf(['ordinal']).isRequired,
|
|
326
|
+
unknownColor: _propTypes.default.string,
|
|
327
|
+
values: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired)
|
|
328
|
+
})]),
|
|
388
329
|
data: _propTypes.default.array,
|
|
389
330
|
dataKey: _propTypes.default.string,
|
|
390
331
|
disableLine: _propTypes.default.bool,
|
package/PieChart/PiePlot.js
CHANGED
|
@@ -12,9 +12,10 @@ var _DrawingProvider = require("../context/DrawingProvider");
|
|
|
12
12
|
var _PieArcPlot = require("./PieArcPlot");
|
|
13
13
|
var _PieArcLabelPlot = require("./PieArcLabelPlot");
|
|
14
14
|
var _utils = require("../internals/utils");
|
|
15
|
+
var _getPieCoordinates = require("./getPieCoordinates");
|
|
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
|
*
|
|
@@ -42,7 +43,6 @@ function PiePlot(props) {
|
|
|
42
43
|
if (seriesData === undefined) {
|
|
43
44
|
return null;
|
|
44
45
|
}
|
|
45
|
-
const availableRadius = Math.min(width, height) / 2;
|
|
46
46
|
const {
|
|
47
47
|
series,
|
|
48
48
|
seriesOrder
|
|
@@ -61,10 +61,19 @@ function PiePlot(props) {
|
|
|
61
61
|
faded,
|
|
62
62
|
highlightScope
|
|
63
63
|
} = series[seriesId];
|
|
64
|
+
const {
|
|
65
|
+
cx,
|
|
66
|
+
cy,
|
|
67
|
+
availableRadius
|
|
68
|
+
} = (0, _getPieCoordinates.getPieCoordinates)({
|
|
69
|
+
cx: cxParam,
|
|
70
|
+
cy: cyParam
|
|
71
|
+
}, {
|
|
72
|
+
width,
|
|
73
|
+
height
|
|
74
|
+
});
|
|
64
75
|
const outerRadius = (0, _utils.getPercentageValue)(outerRadiusParam ?? availableRadius, availableRadius);
|
|
65
76
|
const innerRadius = (0, _utils.getPercentageValue)(innerRadiusParam ?? 0, availableRadius);
|
|
66
|
-
const cx = (0, _utils.getPercentageValue)(cxParam ?? '50%', width);
|
|
67
|
-
const cy = (0, _utils.getPercentageValue)(cyParam ?? '50%', height);
|
|
68
77
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
69
78
|
transform: `translate(${left + cx}, ${top + cy})`,
|
|
70
79
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PieArcPlot.PieArcPlot, {
|
|
@@ -97,11 +106,20 @@ function PiePlot(props) {
|
|
|
97
106
|
cy: cyParam,
|
|
98
107
|
highlightScope
|
|
99
108
|
} = series[seriesId];
|
|
109
|
+
const {
|
|
110
|
+
cx,
|
|
111
|
+
cy,
|
|
112
|
+
availableRadius
|
|
113
|
+
} = (0, _getPieCoordinates.getPieCoordinates)({
|
|
114
|
+
cx: cxParam,
|
|
115
|
+
cy: cyParam
|
|
116
|
+
}, {
|
|
117
|
+
width,
|
|
118
|
+
height
|
|
119
|
+
});
|
|
100
120
|
const outerRadius = (0, _utils.getPercentageValue)(outerRadiusParam ?? availableRadius, availableRadius);
|
|
101
121
|
const innerRadius = (0, _utils.getPercentageValue)(innerRadiusParam ?? 0, availableRadius);
|
|
102
122
|
const arcLabelRadius = arcLabelRadiusParam === undefined ? (outerRadius + innerRadius) / 2 : (0, _utils.getPercentageValue)(arcLabelRadiusParam, availableRadius);
|
|
103
|
-
const cx = (0, _utils.getPercentageValue)(cxParam ?? '50%', width);
|
|
104
|
-
const cy = (0, _utils.getPercentageValue)(cyParam ?? '50%', height);
|
|
105
123
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
106
124
|
transform: `translate(${left + cx}, ${top + cy})`,
|
|
107
125
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PieArcLabelPlot.PieArcLabelPlot, {
|
|
@@ -115,7 +133,9 @@ function PiePlot(props) {
|
|
|
115
133
|
skipAnimation: skipAnimation,
|
|
116
134
|
arcLabel: arcLabel,
|
|
117
135
|
arcLabelMinAngle: arcLabelMinAngle,
|
|
118
|
-
highlightScope: highlightScope
|
|
136
|
+
highlightScope: highlightScope,
|
|
137
|
+
slots: slots,
|
|
138
|
+
slotProps: slotProps
|
|
119
139
|
})
|
|
120
140
|
}, seriesId);
|
|
121
141
|
})]
|
|
@@ -10,7 +10,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _InteractionProvider = require("../../context/InteractionProvider");
|
|
11
11
|
var _useInteractionItemProps = require("../../hooks/useInteractionItemProps");
|
|
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
|
function useTransformData(series) {
|
|
15
15
|
const {
|
|
16
16
|
id: seriesId,
|
package/PieChart/formatter.js
CHANGED
|
@@ -35,8 +35,10 @@ const formatter = params => {
|
|
|
35
35
|
}, series[seriesId], {
|
|
36
36
|
data: series[seriesId].data.map((item, index) => (0, _extends2.default)({}, item, {
|
|
37
37
|
id: item.id ?? `auto-generated-pie-id-${seriesId}-${index}`
|
|
38
|
-
}, arcs[index])).map(item => (0, _extends2.default)({}, item, {
|
|
39
|
-
formattedValue: series[seriesId].valueFormatter?.(item
|
|
38
|
+
}, arcs[index])).map((item, index) => (0, _extends2.default)({}, item, {
|
|
39
|
+
formattedValue: series[seriesId].valueFormatter?.(item, {
|
|
40
|
+
dataIndex: index
|
|
41
|
+
}) ?? item.value.toLocaleString()
|
|
40
42
|
}))
|
|
41
43
|
});
|
|
42
44
|
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DrawingArea } from '../context/DrawingProvider';
|
|
2
|
+
import { DefaultizedPieSeriesType } from '../models/seriesType/pie';
|
|
3
|
+
export declare function getPieCoordinates(series: Pick<DefaultizedPieSeriesType, 'cx' | 'cy'>, drawing: Pick<DrawingArea, 'width' | 'height'>): {
|
|
4
|
+
cx: number;
|
|
5
|
+
cy: number;
|
|
6
|
+
availableRadius: number;
|
|
7
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getPieCoordinates = getPieCoordinates;
|
|
7
|
+
var _utils = require("../internals/utils");
|
|
8
|
+
function getPieCoordinates(series, drawing) {
|
|
9
|
+
const {
|
|
10
|
+
height,
|
|
11
|
+
width
|
|
12
|
+
} = drawing;
|
|
13
|
+
const {
|
|
14
|
+
cx: cxParam,
|
|
15
|
+
cy: cyParam
|
|
16
|
+
} = series;
|
|
17
|
+
const availableRadius = Math.min(width, height) / 2;
|
|
18
|
+
const cx = (0, _utils.getPercentageValue)(cxParam ?? '50%', width);
|
|
19
|
+
const cy = (0, _utils.getPercentageValue)(cyParam ?? '50%', height);
|
|
20
|
+
return {
|
|
21
|
+
cx,
|
|
22
|
+
cy,
|
|
23
|
+
availableRadius
|
|
24
|
+
};
|
|
25
|
+
}
|
package/PieChart/index.d.ts
CHANGED
package/PieChart/index.js
CHANGED
|
@@ -68,4 +68,15 @@ Object.keys(_PieArcLabel).forEach(function (key) {
|
|
|
68
68
|
return _PieArcLabel[key];
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
|
+
});
|
|
72
|
+
var _getPieCoordinates = require("./getPieCoordinates");
|
|
73
|
+
Object.keys(_getPieCoordinates).forEach(function (key) {
|
|
74
|
+
if (key === "default" || key === "__esModule") return;
|
|
75
|
+
if (key in exports && exports[key] === _getPieCoordinates[key]) return;
|
|
76
|
+
Object.defineProperty(exports, key, {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () {
|
|
79
|
+
return _getPieCoordinates[key];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
71
82
|
});
|
|
@@ -15,7 +15,7 @@ var _useChartContainerDimensions = require("./useChartContainerDimensions");
|
|
|
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
|
-
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; }
|
|
19
19
|
const ResizableContainer = (0, _styles.styled)('div', {
|
|
20
20
|
name: 'MuiResponsiveChart',
|
|
21
21
|
slot: 'Container'
|
|
@@ -115,11 +115,27 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
115
115
|
width: _propTypes.default.number,
|
|
116
116
|
/**
|
|
117
117
|
* The configuration of the x-axes.
|
|
118
|
-
* If not provided, a default axis config is used
|
|
118
|
+
* If not provided, a default axis config is used.
|
|
119
|
+
* An array of [[AxisConfig]] objects.
|
|
119
120
|
*/
|
|
120
121
|
xAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
121
122
|
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
122
123
|
classes: _propTypes.default.object,
|
|
124
|
+
colorMap: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
125
|
+
color: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string.isRequired), _propTypes.default.func]).isRequired,
|
|
126
|
+
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
127
|
+
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
128
|
+
type: _propTypes.default.oneOf(['continuous']).isRequired
|
|
129
|
+
}), _propTypes.default.shape({
|
|
130
|
+
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
131
|
+
thresholds: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]).isRequired).isRequired,
|
|
132
|
+
type: _propTypes.default.oneOf(['piecewise']).isRequired
|
|
133
|
+
}), _propTypes.default.shape({
|
|
134
|
+
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
135
|
+
type: _propTypes.default.oneOf(['ordinal']).isRequired,
|
|
136
|
+
unknownColor: _propTypes.default.string,
|
|
137
|
+
values: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired)
|
|
138
|
+
})]),
|
|
123
139
|
data: _propTypes.default.array,
|
|
124
140
|
dataKey: _propTypes.default.string,
|
|
125
141
|
disableLine: _propTypes.default.bool,
|
|
@@ -152,11 +168,27 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
152
168
|
})),
|
|
153
169
|
/**
|
|
154
170
|
* The configuration of the y-axes.
|
|
155
|
-
* If not provided, a default axis config is used
|
|
171
|
+
* If not provided, a default axis config is used.
|
|
172
|
+
* An array of [[AxisConfig]] objects.
|
|
156
173
|
*/
|
|
157
174
|
yAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
158
175
|
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
159
176
|
classes: _propTypes.default.object,
|
|
177
|
+
colorMap: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
178
|
+
color: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string.isRequired), _propTypes.default.func]).isRequired,
|
|
179
|
+
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
180
|
+
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
181
|
+
type: _propTypes.default.oneOf(['continuous']).isRequired
|
|
182
|
+
}), _propTypes.default.shape({
|
|
183
|
+
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
184
|
+
thresholds: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]).isRequired).isRequired,
|
|
185
|
+
type: _propTypes.default.oneOf(['piecewise']).isRequired
|
|
186
|
+
}), _propTypes.default.shape({
|
|
187
|
+
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
188
|
+
type: _propTypes.default.oneOf(['ordinal']).isRequired,
|
|
189
|
+
unknownColor: _propTypes.default.string,
|
|
190
|
+
values: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired)
|
|
191
|
+
})]),
|
|
160
192
|
data: _propTypes.default.array,
|
|
161
193
|
dataKey: _propTypes.default.string,
|
|
162
194
|
disableLine: _propTypes.default.bool,
|
|
@@ -9,7 +9,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
|
|
10
10
|
var _ownerWindow = _interopRequireDefault(require("@mui/utils/ownerWindow"));
|
|
11
11
|
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); }
|
|
12
|
-
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 &&
|
|
12
|
+
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; }
|
|
13
13
|
const useChartContainerDimensions = (inWidth, inHeight) => {
|
|
14
14
|
const rootRef = React.useRef(null);
|
|
15
15
|
const displayError = React.useRef(false);
|
|
@@ -7,6 +7,7 @@ export interface ScatterProps {
|
|
|
7
7
|
yScale: D3Scale;
|
|
8
8
|
markerSize: number;
|
|
9
9
|
color: string;
|
|
10
|
+
colorGetter?: (dataIndex: number) => string;
|
|
10
11
|
/**
|
|
11
12
|
* Callback fired when clicking on a scatter item.
|
|
12
13
|
* @param {MouseEvent} event Mouse event recorded on the `<svg/>` element.
|
package/ScatterChart/Scatter.js
CHANGED
|
@@ -13,7 +13,7 @@ var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
|
|
|
13
13
|
var _InteractionProvider = require("../context/InteractionProvider");
|
|
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
|
* Demos:
|
|
19
19
|
*
|
|
@@ -30,6 +30,7 @@ function Scatter(props) {
|
|
|
30
30
|
xScale,
|
|
31
31
|
yScale,
|
|
32
32
|
color,
|
|
33
|
+
colorGetter,
|
|
33
34
|
markerSize,
|
|
34
35
|
onItemClick
|
|
35
36
|
} = props;
|
|
@@ -72,19 +73,20 @@ function Scatter(props) {
|
|
|
72
73
|
isFaded: !isHighlighted && (0, _useInteractionItemProps.getIsFaded)(item, pointCtx, highlightScope),
|
|
73
74
|
interactionProps: getInteractionItemProps(pointCtx),
|
|
74
75
|
id: scatterPoint.id,
|
|
75
|
-
dataIndex: i
|
|
76
|
+
dataIndex: i,
|
|
77
|
+
color: colorGetter ? colorGetter(i) : color
|
|
76
78
|
});
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
81
|
return temp;
|
|
80
|
-
}, [xScale, yScale, series.data, series.id, item, highlightScope, getInteractionItemProps]);
|
|
82
|
+
}, [xScale, yScale, series.data, series.id, item, highlightScope, getInteractionItemProps, color, colorGetter]);
|
|
81
83
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
82
84
|
children: cleanData.map(dataPoint => /*#__PURE__*/(0, _jsxRuntime.jsx)("circle", (0, _extends2.default)({
|
|
83
85
|
cx: 0,
|
|
84
86
|
cy: 0,
|
|
85
87
|
r: (dataPoint.isHighlighted ? 1.2 : 1) * markerSize,
|
|
86
88
|
transform: `translate(${dataPoint.x}, ${dataPoint.y})`,
|
|
87
|
-
fill: color,
|
|
89
|
+
fill: dataPoint.color,
|
|
88
90
|
opacity: dataPoint.isFaded && 0.3 || 1,
|
|
89
91
|
onClick: onItemClick && (event => onItemClick(event, {
|
|
90
92
|
type: 'scatter',
|
|
@@ -101,6 +103,7 @@ process.env.NODE_ENV !== "production" ? Scatter.propTypes = {
|
|
|
101
103
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
102
104
|
// ----------------------------------------------------------------------
|
|
103
105
|
color: _propTypes.default.string.isRequired,
|
|
106
|
+
colorGetter: _propTypes.default.func,
|
|
104
107
|
markerSize: _propTypes.default.number.isRequired,
|
|
105
108
|
/**
|
|
106
109
|
* Callback fired when clicking on a scatter item.
|
|
@@ -10,13 +10,15 @@ import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
|
|
|
10
10
|
import { ChartsAxisSlots, ChartsAxisSlotProps } from '../models/axis';
|
|
11
11
|
import { ChartsVoronoiHandlerProps } from '../ChartsVoronoiHandler/ChartsVoronoiHandler';
|
|
12
12
|
import { ChartsGridProps } from '../ChartsGrid';
|
|
13
|
+
import { ZAxisContextProviderProps } from '../context/ZAxisContextProvider';
|
|
13
14
|
export interface ScatterChartSlots extends ChartsAxisSlots, ScatterPlotSlots, ChartsLegendSlots, ChartsTooltipSlots {
|
|
14
15
|
}
|
|
15
16
|
export interface ScatterChartSlotProps extends ChartsAxisSlotProps, ScatterPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps {
|
|
16
17
|
}
|
|
17
|
-
export interface ScatterChartProps extends Omit<ResponsiveChartContainerProps, 'series'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsVoronoiHandlerProps, 'onItemClick'> {
|
|
18
|
+
export interface ScatterChartProps extends Omit<ResponsiveChartContainerProps, 'series'>, Omit<ZAxisContextProviderProps, 'children' | 'dataset'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsVoronoiHandlerProps, 'onItemClick'> {
|
|
18
19
|
/**
|
|
19
20
|
* The series to display in the scatter chart.
|
|
21
|
+
* An array of [[ScatterSeriesType]] objects.
|
|
20
22
|
*/
|
|
21
23
|
series: MakeOptional<ScatterSeriesType, 'type'>[];
|
|
22
24
|
/**
|