@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
|
@@ -9,8 +9,7 @@ import { ChartsLegend } from '../ChartsLegend';
|
|
|
9
9
|
import { ChartsAxisHighlight } from '../ChartsAxisHighlight';
|
|
10
10
|
import { PiePlot } from './PiePlot';
|
|
11
11
|
import { useIsRTL } from '../internals/useIsRTL';
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
13
|
const defaultMargin = {
|
|
15
14
|
top: 5,
|
|
16
15
|
bottom: 5,
|
|
@@ -124,30 +123,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
124
123
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
125
124
|
* @default null
|
|
126
125
|
*/
|
|
127
|
-
bottomAxis: PropTypes.oneOfType([PropTypes.
|
|
128
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
129
|
-
classes: PropTypes.object,
|
|
130
|
-
disableLine: PropTypes.bool,
|
|
131
|
-
disableTicks: PropTypes.bool,
|
|
132
|
-
fill: PropTypes.string,
|
|
133
|
-
label: PropTypes.string,
|
|
134
|
-
labelFontSize: PropTypes.number,
|
|
135
|
-
labelStyle: PropTypes.object,
|
|
136
|
-
position: PropTypes.oneOf(['bottom', 'top']),
|
|
137
|
-
slotProps: PropTypes.object,
|
|
138
|
-
slots: PropTypes.object,
|
|
139
|
-
stroke: PropTypes.string,
|
|
140
|
-
tickFontSize: PropTypes.number,
|
|
141
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
142
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
143
|
-
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
144
|
-
tickLabelStyle: PropTypes.object,
|
|
145
|
-
tickMaxStep: PropTypes.number,
|
|
146
|
-
tickMinStep: PropTypes.number,
|
|
147
|
-
tickNumber: PropTypes.number,
|
|
148
|
-
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
149
|
-
tickSize: PropTypes.number
|
|
150
|
-
}), PropTypes.string]),
|
|
126
|
+
bottomAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
151
127
|
children: PropTypes.node,
|
|
152
128
|
className: PropTypes.string,
|
|
153
129
|
/**
|
|
@@ -175,30 +151,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
175
151
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
176
152
|
* @default null
|
|
177
153
|
*/
|
|
178
|
-
leftAxis: PropTypes.oneOfType([PropTypes.
|
|
179
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
180
|
-
classes: PropTypes.object,
|
|
181
|
-
disableLine: PropTypes.bool,
|
|
182
|
-
disableTicks: PropTypes.bool,
|
|
183
|
-
fill: PropTypes.string,
|
|
184
|
-
label: PropTypes.string,
|
|
185
|
-
labelFontSize: PropTypes.number,
|
|
186
|
-
labelStyle: PropTypes.object,
|
|
187
|
-
position: PropTypes.oneOf(['left', 'right']),
|
|
188
|
-
slotProps: PropTypes.object,
|
|
189
|
-
slots: PropTypes.object,
|
|
190
|
-
stroke: PropTypes.string,
|
|
191
|
-
tickFontSize: PropTypes.number,
|
|
192
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
193
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
194
|
-
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
195
|
-
tickLabelStyle: PropTypes.object,
|
|
196
|
-
tickMaxStep: PropTypes.number,
|
|
197
|
-
tickMinStep: PropTypes.number,
|
|
198
|
-
tickNumber: PropTypes.number,
|
|
199
|
-
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
200
|
-
tickSize: PropTypes.number
|
|
201
|
-
}), PropTypes.string]),
|
|
154
|
+
leftAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
202
155
|
/**
|
|
203
156
|
* The props of the legend.
|
|
204
157
|
* @default { direction: 'column', position: { vertical: 'middle', horizontal: 'right' } }
|
|
@@ -236,32 +189,10 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
236
189
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
237
190
|
* @default null
|
|
238
191
|
*/
|
|
239
|
-
rightAxis: PropTypes.oneOfType([PropTypes.
|
|
240
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
241
|
-
classes: PropTypes.object,
|
|
242
|
-
disableLine: PropTypes.bool,
|
|
243
|
-
disableTicks: PropTypes.bool,
|
|
244
|
-
fill: PropTypes.string,
|
|
245
|
-
label: PropTypes.string,
|
|
246
|
-
labelFontSize: PropTypes.number,
|
|
247
|
-
labelStyle: PropTypes.object,
|
|
248
|
-
position: PropTypes.oneOf(['left', 'right']),
|
|
249
|
-
slotProps: PropTypes.object,
|
|
250
|
-
slots: PropTypes.object,
|
|
251
|
-
stroke: PropTypes.string,
|
|
252
|
-
tickFontSize: PropTypes.number,
|
|
253
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
254
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
255
|
-
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
256
|
-
tickLabelStyle: PropTypes.object,
|
|
257
|
-
tickMaxStep: PropTypes.number,
|
|
258
|
-
tickMinStep: PropTypes.number,
|
|
259
|
-
tickNumber: PropTypes.number,
|
|
260
|
-
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
261
|
-
tickSize: PropTypes.number
|
|
262
|
-
}), PropTypes.string]),
|
|
192
|
+
rightAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
263
193
|
/**
|
|
264
194
|
* The series to display in the pie chart.
|
|
195
|
+
* An array of [[PieSeriesType]] objects.
|
|
265
196
|
*/
|
|
266
197
|
series: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
267
198
|
/**
|
|
@@ -299,30 +230,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
299
230
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
300
231
|
* @default null
|
|
301
232
|
*/
|
|
302
|
-
topAxis: PropTypes.oneOfType([PropTypes.
|
|
303
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
304
|
-
classes: PropTypes.object,
|
|
305
|
-
disableLine: PropTypes.bool,
|
|
306
|
-
disableTicks: PropTypes.bool,
|
|
307
|
-
fill: PropTypes.string,
|
|
308
|
-
label: PropTypes.string,
|
|
309
|
-
labelFontSize: PropTypes.number,
|
|
310
|
-
labelStyle: PropTypes.object,
|
|
311
|
-
position: PropTypes.oneOf(['bottom', 'top']),
|
|
312
|
-
slotProps: PropTypes.object,
|
|
313
|
-
slots: PropTypes.object,
|
|
314
|
-
stroke: PropTypes.string,
|
|
315
|
-
tickFontSize: PropTypes.number,
|
|
316
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
317
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
318
|
-
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
319
|
-
tickLabelStyle: PropTypes.object,
|
|
320
|
-
tickMaxStep: PropTypes.number,
|
|
321
|
-
tickMinStep: PropTypes.number,
|
|
322
|
-
tickNumber: PropTypes.number,
|
|
323
|
-
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
324
|
-
tickSize: PropTypes.number
|
|
325
|
-
}), PropTypes.string]),
|
|
233
|
+
topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
326
234
|
viewBox: PropTypes.shape({
|
|
327
235
|
height: PropTypes.number,
|
|
328
236
|
width: PropTypes.number,
|
|
@@ -335,11 +243,27 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
335
243
|
width: PropTypes.number,
|
|
336
244
|
/**
|
|
337
245
|
* The configuration of the x-axes.
|
|
338
|
-
* If not provided, a default axis config is used
|
|
246
|
+
* If not provided, a default axis config is used.
|
|
247
|
+
* An array of [[AxisConfig]] objects.
|
|
339
248
|
*/
|
|
340
249
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
341
250
|
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
342
251
|
classes: PropTypes.object,
|
|
252
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
253
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
254
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
255
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
256
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
257
|
+
}), PropTypes.shape({
|
|
258
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
259
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
260
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
261
|
+
}), PropTypes.shape({
|
|
262
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
263
|
+
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
264
|
+
unknownColor: PropTypes.string,
|
|
265
|
+
values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
|
|
266
|
+
})]),
|
|
343
267
|
data: PropTypes.array,
|
|
344
268
|
dataKey: PropTypes.string,
|
|
345
269
|
disableLine: PropTypes.bool,
|
|
@@ -372,11 +296,27 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
372
296
|
})),
|
|
373
297
|
/**
|
|
374
298
|
* The configuration of the y-axes.
|
|
375
|
-
* If not provided, a default axis config is used
|
|
299
|
+
* If not provided, a default axis config is used.
|
|
300
|
+
* An array of [[AxisConfig]] objects.
|
|
376
301
|
*/
|
|
377
302
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
378
303
|
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
379
304
|
classes: PropTypes.object,
|
|
305
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
306
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
307
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
308
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
309
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
310
|
+
}), PropTypes.shape({
|
|
311
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
312
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
313
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
314
|
+
}), PropTypes.shape({
|
|
315
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
316
|
+
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
317
|
+
unknownColor: PropTypes.string,
|
|
318
|
+
values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
|
|
319
|
+
})]),
|
|
380
320
|
data: PropTypes.array,
|
|
381
321
|
dataKey: PropTypes.string,
|
|
382
322
|
disableLine: PropTypes.bool,
|
|
@@ -5,8 +5,8 @@ import { DrawingContext } from '../context/DrawingProvider';
|
|
|
5
5
|
import { PieArcPlot } from './PieArcPlot';
|
|
6
6
|
import { PieArcLabelPlot } from './PieArcLabelPlot';
|
|
7
7
|
import { getPercentageValue } from '../internals/utils';
|
|
8
|
-
import {
|
|
9
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { getPieCoordinates } from './getPieCoordinates';
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
/**
|
|
11
11
|
* Demos:
|
|
12
12
|
*
|
|
@@ -34,7 +34,6 @@ function PiePlot(props) {
|
|
|
34
34
|
if (seriesData === undefined) {
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
37
|
-
const availableRadius = Math.min(width, height) / 2;
|
|
38
37
|
const {
|
|
39
38
|
series,
|
|
40
39
|
seriesOrder
|
|
@@ -53,10 +52,19 @@ function PiePlot(props) {
|
|
|
53
52
|
faded,
|
|
54
53
|
highlightScope
|
|
55
54
|
} = series[seriesId];
|
|
55
|
+
const {
|
|
56
|
+
cx,
|
|
57
|
+
cy,
|
|
58
|
+
availableRadius
|
|
59
|
+
} = getPieCoordinates({
|
|
60
|
+
cx: cxParam,
|
|
61
|
+
cy: cyParam
|
|
62
|
+
}, {
|
|
63
|
+
width,
|
|
64
|
+
height
|
|
65
|
+
});
|
|
56
66
|
const outerRadius = getPercentageValue(outerRadiusParam ?? availableRadius, availableRadius);
|
|
57
67
|
const innerRadius = getPercentageValue(innerRadiusParam ?? 0, availableRadius);
|
|
58
|
-
const cx = getPercentageValue(cxParam ?? '50%', width);
|
|
59
|
-
const cy = getPercentageValue(cyParam ?? '50%', height);
|
|
60
68
|
return /*#__PURE__*/_jsx("g", {
|
|
61
69
|
transform: `translate(${left + cx}, ${top + cy})`,
|
|
62
70
|
children: /*#__PURE__*/_jsx(PieArcPlot, {
|
|
@@ -89,11 +97,20 @@ function PiePlot(props) {
|
|
|
89
97
|
cy: cyParam,
|
|
90
98
|
highlightScope
|
|
91
99
|
} = series[seriesId];
|
|
100
|
+
const {
|
|
101
|
+
cx,
|
|
102
|
+
cy,
|
|
103
|
+
availableRadius
|
|
104
|
+
} = getPieCoordinates({
|
|
105
|
+
cx: cxParam,
|
|
106
|
+
cy: cyParam
|
|
107
|
+
}, {
|
|
108
|
+
width,
|
|
109
|
+
height
|
|
110
|
+
});
|
|
92
111
|
const outerRadius = getPercentageValue(outerRadiusParam ?? availableRadius, availableRadius);
|
|
93
112
|
const innerRadius = getPercentageValue(innerRadiusParam ?? 0, availableRadius);
|
|
94
113
|
const arcLabelRadius = arcLabelRadiusParam === undefined ? (outerRadius + innerRadius) / 2 : getPercentageValue(arcLabelRadiusParam, availableRadius);
|
|
95
|
-
const cx = getPercentageValue(cxParam ?? '50%', width);
|
|
96
|
-
const cy = getPercentageValue(cyParam ?? '50%', height);
|
|
97
114
|
return /*#__PURE__*/_jsx("g", {
|
|
98
115
|
transform: `translate(${left + cx}, ${top + cy})`,
|
|
99
116
|
children: /*#__PURE__*/_jsx(PieArcLabelPlot, {
|
|
@@ -107,7 +124,9 @@ function PiePlot(props) {
|
|
|
107
124
|
skipAnimation: skipAnimation,
|
|
108
125
|
arcLabel: arcLabel,
|
|
109
126
|
arcLabelMinAngle: arcLabelMinAngle,
|
|
110
|
-
highlightScope: highlightScope
|
|
127
|
+
highlightScope: highlightScope,
|
|
128
|
+
slots: slots,
|
|
129
|
+
slotProps: slotProps
|
|
111
130
|
})
|
|
112
131
|
}, seriesId);
|
|
113
132
|
})]
|
|
@@ -28,8 +28,10 @@ const formatter = params => {
|
|
|
28
28
|
}, series[seriesId], {
|
|
29
29
|
data: series[seriesId].data.map((item, index) => _extends({}, item, {
|
|
30
30
|
id: item.id ?? `auto-generated-pie-id-${seriesId}-${index}`
|
|
31
|
-
}, arcs[index])).map(item => _extends({}, item, {
|
|
32
|
-
formattedValue: series[seriesId].valueFormatter?.(item
|
|
31
|
+
}, arcs[index])).map((item, index) => _extends({}, item, {
|
|
32
|
+
formattedValue: series[seriesId].valueFormatter?.(item, {
|
|
33
|
+
dataIndex: index
|
|
34
|
+
}) ?? item.value.toLocaleString()
|
|
33
35
|
}))
|
|
34
36
|
});
|
|
35
37
|
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getPercentageValue } from '../internals/utils';
|
|
2
|
+
export function getPieCoordinates(series, drawing) {
|
|
3
|
+
const {
|
|
4
|
+
height,
|
|
5
|
+
width
|
|
6
|
+
} = drawing;
|
|
7
|
+
const {
|
|
8
|
+
cx: cxParam,
|
|
9
|
+
cy: cyParam
|
|
10
|
+
} = series;
|
|
11
|
+
const availableRadius = Math.min(width, height) / 2;
|
|
12
|
+
const cx = getPercentageValue(cxParam ?? '50%', width);
|
|
13
|
+
const cy = getPercentageValue(cyParam ?? '50%', height);
|
|
14
|
+
return {
|
|
15
|
+
cx,
|
|
16
|
+
cy,
|
|
17
|
+
availableRadius
|
|
18
|
+
};
|
|
19
|
+
}
|
package/modern/PieChart/index.js
CHANGED
|
@@ -106,11 +106,27 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
106
106
|
width: PropTypes.number,
|
|
107
107
|
/**
|
|
108
108
|
* The configuration of the x-axes.
|
|
109
|
-
* If not provided, a default axis config is used
|
|
109
|
+
* If not provided, a default axis config is used.
|
|
110
|
+
* An array of [[AxisConfig]] objects.
|
|
110
111
|
*/
|
|
111
112
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
112
113
|
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
113
114
|
classes: PropTypes.object,
|
|
115
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
116
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
117
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
118
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
119
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
120
|
+
}), PropTypes.shape({
|
|
121
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
122
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
123
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
124
|
+
}), PropTypes.shape({
|
|
125
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
126
|
+
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
127
|
+
unknownColor: PropTypes.string,
|
|
128
|
+
values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
|
|
129
|
+
})]),
|
|
114
130
|
data: PropTypes.array,
|
|
115
131
|
dataKey: PropTypes.string,
|
|
116
132
|
disableLine: PropTypes.bool,
|
|
@@ -143,11 +159,27 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
143
159
|
})),
|
|
144
160
|
/**
|
|
145
161
|
* The configuration of the y-axes.
|
|
146
|
-
* If not provided, a default axis config is used
|
|
162
|
+
* If not provided, a default axis config is used.
|
|
163
|
+
* An array of [[AxisConfig]] objects.
|
|
147
164
|
*/
|
|
148
165
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
149
166
|
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
150
167
|
classes: PropTypes.object,
|
|
168
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
169
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
170
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
171
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
172
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
173
|
+
}), PropTypes.shape({
|
|
174
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
175
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
176
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
177
|
+
}), PropTypes.shape({
|
|
178
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
179
|
+
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
180
|
+
unknownColor: PropTypes.string,
|
|
181
|
+
values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
|
|
182
|
+
})]),
|
|
151
183
|
data: PropTypes.array,
|
|
152
184
|
dataKey: PropTypes.string,
|
|
153
185
|
disableLine: PropTypes.bool,
|
|
@@ -21,6 +21,7 @@ function Scatter(props) {
|
|
|
21
21
|
xScale,
|
|
22
22
|
yScale,
|
|
23
23
|
color,
|
|
24
|
+
colorGetter,
|
|
24
25
|
markerSize,
|
|
25
26
|
onItemClick
|
|
26
27
|
} = props;
|
|
@@ -63,19 +64,20 @@ function Scatter(props) {
|
|
|
63
64
|
isFaded: !isHighlighted && getIsFaded(item, pointCtx, highlightScope),
|
|
64
65
|
interactionProps: getInteractionItemProps(pointCtx),
|
|
65
66
|
id: scatterPoint.id,
|
|
66
|
-
dataIndex: i
|
|
67
|
+
dataIndex: i,
|
|
68
|
+
color: colorGetter ? colorGetter(i) : color
|
|
67
69
|
});
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
return temp;
|
|
71
|
-
}, [xScale, yScale, series.data, series.id, item, highlightScope, getInteractionItemProps]);
|
|
73
|
+
}, [xScale, yScale, series.data, series.id, item, highlightScope, getInteractionItemProps, color, colorGetter]);
|
|
72
74
|
return /*#__PURE__*/_jsx("g", {
|
|
73
75
|
children: cleanData.map(dataPoint => /*#__PURE__*/_jsx("circle", _extends({
|
|
74
76
|
cx: 0,
|
|
75
77
|
cy: 0,
|
|
76
78
|
r: (dataPoint.isHighlighted ? 1.2 : 1) * markerSize,
|
|
77
79
|
transform: `translate(${dataPoint.x}, ${dataPoint.y})`,
|
|
78
|
-
fill: color,
|
|
80
|
+
fill: dataPoint.color,
|
|
79
81
|
opacity: dataPoint.isFaded && 0.3 || 1,
|
|
80
82
|
onClick: onItemClick && (event => onItemClick(event, {
|
|
81
83
|
type: 'scatter',
|
|
@@ -92,6 +94,7 @@ process.env.NODE_ENV !== "production" ? Scatter.propTypes = {
|
|
|
92
94
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
93
95
|
// ----------------------------------------------------------------------
|
|
94
96
|
color: PropTypes.string.isRequired,
|
|
97
|
+
colorGetter: PropTypes.func,
|
|
95
98
|
markerSize: PropTypes.number.isRequired,
|
|
96
99
|
/**
|
|
97
100
|
* Callback fired when clicking on a scatter item.
|