@mui/x-charts 7.0.0-beta.0 → 7.0.0-beta.2
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 +2 -1
- package/BarChart/BarChart.js +33 -12
- package/BarChart/BarElement.d.ts +20 -13
- package/BarChart/BarElement.js +7 -3
- package/BarChart/BarPlot.d.ts +11 -6
- package/BarChart/BarPlot.js +28 -15
- package/BarChart/formatter.js +1 -1
- package/CHANGELOG.md +406 -1
- package/ChartContainer/ChartContainer.js +6 -4
- package/ChartsAxis/ChartsAxis.js +4 -4
- package/ChartsLegend/ChartsLegend.d.ts +5 -54
- package/ChartsLegend/ChartsLegend.js +2 -307
- package/ChartsLegend/DefaultChartsLegend.d.ts +60 -0
- package/ChartsLegend/DefaultChartsLegend.js +294 -0
- package/ChartsLegend/index.d.ts +1 -0
- package/ChartsLegend/index.js +11 -0
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.d.ts +20 -0
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +83 -0
- package/ChartsOnAxisClickHandler/index.d.ts +1 -0
- package/ChartsOnAxisClickHandler/index.js +16 -0
- package/ChartsOnAxisClickHandler/package.json +6 -0
- package/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/ChartsReferenceLine/common.d.ts +2 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +6 -5
- package/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +7 -5
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/ChartsTooltip/utils.d.ts +4 -1
- package/ChartsTooltip/utils.js +15 -0
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.d.ts +7 -0
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +92 -44
- package/ChartsXAxis/ChartsXAxis.js +13 -9
- package/ChartsYAxis/ChartsYAxis.js +1 -1
- package/LineChart/AnimatedArea.d.ts +1361 -0
- package/LineChart/AnimatedArea.js +111 -0
- package/LineChart/AnimatedLine.d.ts +1361 -0
- package/LineChart/AnimatedLine.js +113 -0
- package/LineChart/AreaElement.d.ts +19 -18
- package/LineChart/AreaElement.js +17 -34
- package/LineChart/AreaPlot.d.ts +12 -7
- package/LineChart/AreaPlot.js +91 -58
- package/LineChart/LineChart.d.ts +13 -4
- package/LineChart/LineChart.js +45 -14
- package/LineChart/LineElement.d.ts +19 -18
- package/LineChart/LineElement.js +16 -36
- package/LineChart/LineHighlightElement.d.ts +3 -2
- package/LineChart/LineHighlightElement.js +5 -3
- package/LineChart/LinePlot.d.ts +12 -7
- package/LineChart/LinePlot.js +89 -56
- package/LineChart/MarkElement.d.ts +8 -4
- package/LineChart/MarkElement.js +27 -13
- package/LineChart/MarkPlot.d.ts +8 -1
- package/LineChart/MarkPlot.js +80 -51
- package/LineChart/formatter.js +1 -1
- package/LineChart/index.d.ts +2 -0
- package/LineChart/index.js +22 -0
- package/PieChart/PieArc.d.ts +3 -2
- package/PieChart/PieArc.js +1 -0
- package/PieChart/PieArcLabel.d.ts +3 -2
- package/PieChart/PieArcLabel.js +1 -0
- package/PieChart/PieArcLabelPlot.d.ts +1 -1
- package/PieChart/PieArcLabelPlot.js +2 -2
- package/PieChart/PieArcPlot.d.ts +2 -2
- package/PieChart/PieArcPlot.js +7 -7
- package/PieChart/PieChart.d.ts +1 -1
- package/PieChart/PieChart.js +14 -12
- package/PieChart/PiePlot.d.ts +1 -1
- package/PieChart/PiePlot.js +4 -4
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +6 -4
- package/ScatterChart/Scatter.d.ts +7 -1
- package/ScatterChart/Scatter.js +17 -3
- package/ScatterChart/ScatterChart.d.ts +8 -2
- package/ScatterChart/ScatterChart.js +21 -10
- package/ScatterChart/ScatterPlot.d.ts +1 -1
- package/ScatterChart/ScatterPlot.js +10 -2
- package/SparkLineChart/SparkLineChart.d.ts +1 -1
- package/SparkLineChart/SparkLineChart.js +7 -4
- package/context/CartesianContextProvider.js +8 -6
- package/context/DrawingProvider.d.ts +6 -1
- package/context/DrawingProvider.js +9 -2
- package/context/InteractionProvider.d.ts +3 -3
- package/esm/BarChart/BarChart.js +33 -12
- package/esm/BarChart/BarElement.js +7 -3
- package/esm/BarChart/BarPlot.js +27 -15
- package/esm/BarChart/formatter.js +1 -1
- package/esm/ChartContainer/ChartContainer.js +6 -4
- package/esm/ChartsAxis/ChartsAxis.js +4 -4
- package/esm/ChartsLegend/ChartsLegend.js +2 -307
- package/esm/ChartsLegend/DefaultChartsLegend.js +286 -0
- package/esm/ChartsLegend/index.js +1 -0
- package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +77 -0
- package/esm/ChartsOnAxisClickHandler/index.js +1 -0
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +6 -5
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +8 -5
- package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/esm/ChartsTooltip/utils.js +12 -0
- package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +92 -44
- package/esm/ChartsXAxis/ChartsXAxis.js +13 -9
- package/esm/ChartsYAxis/ChartsYAxis.js +1 -1
- package/esm/LineChart/AnimatedArea.js +103 -0
- package/esm/LineChart/AnimatedLine.js +105 -0
- package/esm/LineChart/AreaElement.js +16 -33
- package/esm/LineChart/AreaPlot.js +92 -59
- package/esm/LineChart/LineChart.js +45 -14
- package/esm/LineChart/LineElement.js +16 -35
- package/esm/LineChart/LineHighlightElement.js +5 -3
- package/esm/LineChart/LinePlot.js +90 -57
- package/esm/LineChart/MarkElement.js +27 -13
- package/esm/LineChart/MarkPlot.js +80 -51
- package/esm/LineChart/formatter.js +1 -1
- package/esm/LineChart/index.js +2 -0
- package/esm/PieChart/PieArc.js +1 -0
- package/esm/PieChart/PieArcLabel.js +1 -0
- package/esm/PieChart/PieArcLabelPlot.js +2 -2
- package/esm/PieChart/PieArcPlot.js +7 -7
- package/esm/PieChart/PieChart.js +14 -12
- package/esm/PieChart/PiePlot.js +4 -4
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +6 -4
- package/esm/ScatterChart/Scatter.js +17 -3
- package/esm/ScatterChart/ScatterChart.js +21 -10
- package/esm/ScatterChart/ScatterPlot.js +10 -2
- package/esm/SparkLineChart/SparkLineChart.js +7 -4
- package/esm/context/CartesianContextProvider.js +8 -6
- package/esm/context/DrawingProvider.js +9 -2
- package/esm/hooks/useDrawingArea.js +7 -3
- package/esm/index.js +1 -0
- package/esm/internals/geometry.js +1 -1
- package/esm/internals/useAnimatedPath.js +29 -0
- package/esm/internals/utils.js +7 -0
- package/hooks/useDrawingArea.d.ts +2 -0
- package/hooks/useDrawingArea.js +7 -3
- package/index.d.ts +1 -0
- package/index.js +12 -1
- package/internals/defaultizeColor.d.ts +16 -16
- package/internals/defaultizeValueFormatter.d.ts +4 -7
- package/internals/geometry.js +1 -1
- package/internals/stackSeries.d.ts +4 -7
- package/internals/useAnimatedPath.d.ts +1 -0
- package/internals/useAnimatedPath.js +38 -0
- package/internals/utils.d.ts +4 -0
- package/internals/utils.js +8 -0
- package/legacy/BarChart/BarChart.js +33 -12
- package/legacy/BarChart/BarElement.js +6 -2
- package/legacy/BarChart/BarPlot.js +28 -14
- package/legacy/BarChart/formatter.js +1 -1
- package/legacy/ChartContainer/ChartContainer.js +6 -4
- package/legacy/ChartsAxis/ChartsAxis.js +4 -4
- package/legacy/ChartsLegend/ChartsLegend.js +2 -323
- package/legacy/ChartsLegend/DefaultChartsLegend.js +302 -0
- package/legacy/ChartsLegend/index.js +1 -0
- package/legacy/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +75 -0
- package/legacy/ChartsOnAxisClickHandler/index.js +1 -0
- package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +6 -7
- package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +8 -5
- package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/legacy/ChartsTooltip/utils.js +12 -0
- package/legacy/ChartsVoronoiHandler/ChartsVoronoiHandler.js +88 -44
- package/legacy/ChartsXAxis/ChartsXAxis.js +12 -8
- package/legacy/ChartsYAxis/ChartsYAxis.js +1 -1
- package/legacy/LineChart/AnimatedArea.js +102 -0
- package/legacy/LineChart/AnimatedLine.js +104 -0
- package/legacy/LineChart/AreaElement.js +15 -35
- package/legacy/LineChart/AreaPlot.js +102 -66
- package/legacy/LineChart/LineChart.js +45 -14
- package/legacy/LineChart/LineElement.js +15 -37
- package/legacy/LineChart/LineHighlightElement.js +5 -3
- package/legacy/LineChart/LinePlot.js +97 -63
- package/legacy/LineChart/MarkElement.js +30 -12
- package/legacy/LineChart/MarkPlot.js +83 -53
- package/legacy/LineChart/formatter.js +1 -1
- package/legacy/LineChart/index.js +2 -0
- package/legacy/PieChart/PieArc.js +1 -0
- package/legacy/PieChart/PieArcLabel.js +1 -0
- package/legacy/PieChart/PieArcLabelPlot.js +2 -2
- package/legacy/PieChart/PieArcPlot.js +7 -7
- package/legacy/PieChart/PieChart.js +14 -12
- package/legacy/PieChart/PiePlot.js +4 -4
- package/legacy/ResponsiveChartContainer/ResponsiveChartContainer.js +6 -4
- package/legacy/ScatterChart/Scatter.js +19 -3
- package/legacy/ScatterChart/ScatterChart.js +21 -10
- package/legacy/ScatterChart/ScatterPlot.js +10 -2
- package/legacy/SparkLineChart/SparkLineChart.js +8 -5
- package/legacy/context/CartesianContextProvider.js +8 -6
- package/legacy/context/DrawingProvider.js +11 -2
- package/legacy/hooks/useDrawingArea.js +7 -3
- package/legacy/index.js +2 -1
- package/legacy/internals/geometry.js +1 -1
- package/legacy/internals/useAnimatedPath.js +32 -0
- package/legacy/internals/utils.js +7 -0
- package/models/axis.d.ts +7 -2
- package/models/seriesType/common.d.ts +2 -1
- package/models/seriesType/config.d.ts +7 -12
- package/models/seriesType/line.d.ts +2 -2
- package/models/seriesType/pie.d.ts +7 -3
- package/models/seriesType/scatter.d.ts +5 -2
- package/modern/BarChart/BarChart.js +33 -12
- package/modern/BarChart/BarElement.js +7 -3
- package/modern/BarChart/BarPlot.js +27 -15
- package/modern/BarChart/formatter.js +1 -1
- package/modern/ChartContainer/ChartContainer.js +6 -4
- package/modern/ChartsAxis/ChartsAxis.js +4 -4
- package/modern/ChartsLegend/ChartsLegend.js +2 -307
- package/modern/ChartsLegend/DefaultChartsLegend.js +286 -0
- package/modern/ChartsLegend/index.js +1 -0
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +75 -0
- package/modern/ChartsOnAxisClickHandler/index.js +1 -0
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +6 -5
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +7 -5
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/modern/ChartsTooltip/utils.js +12 -0
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +92 -44
- package/modern/ChartsXAxis/ChartsXAxis.js +13 -9
- package/modern/ChartsYAxis/ChartsYAxis.js +1 -1
- package/modern/LineChart/AnimatedArea.js +103 -0
- package/modern/LineChart/AnimatedLine.js +105 -0
- package/modern/LineChart/AreaElement.js +16 -33
- package/modern/LineChart/AreaPlot.js +91 -58
- package/modern/LineChart/LineChart.js +45 -14
- package/modern/LineChart/LineElement.js +16 -35
- package/modern/LineChart/LineHighlightElement.js +5 -3
- package/modern/LineChart/LinePlot.js +89 -56
- package/modern/LineChart/MarkElement.js +27 -13
- package/modern/LineChart/MarkPlot.js +80 -51
- package/modern/LineChart/formatter.js +1 -1
- package/modern/LineChart/index.js +2 -0
- package/modern/PieChart/PieArc.js +1 -0
- package/modern/PieChart/PieArcLabel.js +1 -0
- package/modern/PieChart/PieArcLabelPlot.js +2 -2
- package/modern/PieChart/PieArcPlot.js +7 -7
- package/modern/PieChart/PieChart.js +14 -12
- package/modern/PieChart/PiePlot.js +4 -4
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +6 -4
- package/modern/ScatterChart/Scatter.js +17 -3
- package/modern/ScatterChart/ScatterChart.js +21 -10
- package/modern/ScatterChart/ScatterPlot.js +10 -2
- package/modern/SparkLineChart/SparkLineChart.js +7 -4
- package/modern/context/CartesianContextProvider.js +8 -6
- package/modern/context/DrawingProvider.js +9 -2
- package/modern/hooks/useDrawingArea.js +7 -3
- package/modern/index.js +2 -1
- package/modern/internals/geometry.js +1 -1
- package/modern/internals/useAnimatedPath.js +29 -0
- package/modern/internals/utils.js +7 -0
- package/package.json +6 -5
|
@@ -66,7 +66,7 @@ function PieChart(props) {
|
|
|
66
66
|
children = props.children,
|
|
67
67
|
slots = props.slots,
|
|
68
68
|
slotProps = props.slotProps,
|
|
69
|
-
|
|
69
|
+
onItemClick = props.onItemClick;
|
|
70
70
|
var margin = _extends({}, defaultMargin, marginProps);
|
|
71
71
|
return /*#__PURE__*/_jsxs(ResponsiveChartContainer, {
|
|
72
72
|
series: series.map(function (s) {
|
|
@@ -100,7 +100,7 @@ function PieChart(props) {
|
|
|
100
100
|
}), /*#__PURE__*/_jsx(PiePlot, {
|
|
101
101
|
slots: slots,
|
|
102
102
|
slotProps: slotProps,
|
|
103
|
-
|
|
103
|
+
onItemClick: onItemClick,
|
|
104
104
|
skipAnimation: skipAnimation
|
|
105
105
|
}), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend, {
|
|
106
106
|
slots: slots,
|
|
@@ -123,7 +123,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
123
123
|
* @default null
|
|
124
124
|
*/
|
|
125
125
|
bottomAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
126
|
-
axisId: PropTypes.string,
|
|
126
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
127
127
|
classes: PropTypes.object,
|
|
128
128
|
disableLine: PropTypes.bool,
|
|
129
129
|
disableTicks: PropTypes.bool,
|
|
@@ -173,7 +173,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
173
173
|
* @default null
|
|
174
174
|
*/
|
|
175
175
|
leftAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
176
|
-
axisId: PropTypes.string,
|
|
176
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
177
177
|
classes: PropTypes.object,
|
|
178
178
|
disableLine: PropTypes.bool,
|
|
179
179
|
disableTicks: PropTypes.bool,
|
|
@@ -220,14 +220,14 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
220
220
|
right: PropTypes.number,
|
|
221
221
|
top: PropTypes.number
|
|
222
222
|
}),
|
|
223
|
-
|
|
223
|
+
onItemClick: PropTypes.func,
|
|
224
224
|
/**
|
|
225
225
|
* Indicate which axis to display the right of the charts.
|
|
226
226
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
227
227
|
* @default null
|
|
228
228
|
*/
|
|
229
229
|
rightAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
230
|
-
axisId: PropTypes.string,
|
|
230
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
231
231
|
classes: PropTypes.object,
|
|
232
232
|
disableLine: PropTypes.bool,
|
|
233
233
|
disableTicks: PropTypes.bool,
|
|
@@ -250,7 +250,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
250
250
|
}), PropTypes.string]),
|
|
251
251
|
series: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
252
252
|
/**
|
|
253
|
-
* If `true`, animations are
|
|
253
|
+
* If `true`, animations are skipped.
|
|
254
254
|
* @default false
|
|
255
255
|
*/
|
|
256
256
|
skipAnimation: PropTypes.bool,
|
|
@@ -276,7 +276,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
276
276
|
* @default null
|
|
277
277
|
*/
|
|
278
278
|
topAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
279
|
-
axisId: PropTypes.string,
|
|
279
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
280
280
|
classes: PropTypes.object,
|
|
281
281
|
disableLine: PropTypes.bool,
|
|
282
282
|
disableTicks: PropTypes.bool,
|
|
@@ -313,7 +313,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
313
313
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
314
314
|
*/
|
|
315
315
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
316
|
-
axisId: PropTypes.string,
|
|
316
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
317
317
|
classes: PropTypes.object,
|
|
318
318
|
data: PropTypes.array,
|
|
319
319
|
dataKey: PropTypes.string,
|
|
@@ -321,13 +321,14 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
321
321
|
disableTicks: PropTypes.bool,
|
|
322
322
|
fill: PropTypes.string,
|
|
323
323
|
hideTooltip: PropTypes.bool,
|
|
324
|
-
id: PropTypes.string,
|
|
324
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
325
325
|
label: PropTypes.string,
|
|
326
326
|
labelFontSize: PropTypes.number,
|
|
327
327
|
labelStyle: PropTypes.object,
|
|
328
328
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
329
329
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
330
330
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
331
|
+
reverse: PropTypes.bool,
|
|
331
332
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
332
333
|
slotProps: PropTypes.object,
|
|
333
334
|
slots: PropTypes.object,
|
|
@@ -347,7 +348,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
347
348
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
348
349
|
*/
|
|
349
350
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
350
|
-
axisId: PropTypes.string,
|
|
351
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
351
352
|
classes: PropTypes.object,
|
|
352
353
|
data: PropTypes.array,
|
|
353
354
|
dataKey: PropTypes.string,
|
|
@@ -355,13 +356,14 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
355
356
|
disableTicks: PropTypes.bool,
|
|
356
357
|
fill: PropTypes.string,
|
|
357
358
|
hideTooltip: PropTypes.bool,
|
|
358
|
-
id: PropTypes.string,
|
|
359
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
359
360
|
label: PropTypes.string,
|
|
360
361
|
labelFontSize: PropTypes.number,
|
|
361
362
|
labelStyle: PropTypes.object,
|
|
362
363
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
363
364
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
364
365
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
366
|
+
reverse: PropTypes.bool,
|
|
365
367
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
366
368
|
slotProps: PropTypes.object,
|
|
367
369
|
slots: PropTypes.object,
|
|
@@ -21,7 +21,7 @@ function PiePlot(props) {
|
|
|
21
21
|
var skipAnimation = props.skipAnimation,
|
|
22
22
|
slots = props.slots,
|
|
23
23
|
slotProps = props.slotProps,
|
|
24
|
-
|
|
24
|
+
onItemClick = props.onItemClick;
|
|
25
25
|
var seriesData = React.useContext(SeriesContext).pie;
|
|
26
26
|
var _React$useContext = React.useContext(DrawingContext),
|
|
27
27
|
left = _React$useContext.left,
|
|
@@ -64,7 +64,7 @@ function PiePlot(props) {
|
|
|
64
64
|
highlightScope: highlightScope,
|
|
65
65
|
highlighted: highlighted,
|
|
66
66
|
faded: faded,
|
|
67
|
-
|
|
67
|
+
onItemClick: onItemClick,
|
|
68
68
|
slots: slots,
|
|
69
69
|
slotProps: slotProps
|
|
70
70
|
})
|
|
@@ -117,9 +117,9 @@ process.env.NODE_ENV !== "production" ? PiePlot.propTypes = {
|
|
|
117
117
|
* @param {PieItemIdentifier} pieItemIdentifier The pie item identifier.
|
|
118
118
|
* @param {DefaultizedPieValueType} item The pie item.
|
|
119
119
|
*/
|
|
120
|
-
|
|
120
|
+
onItemClick: PropTypes.func,
|
|
121
121
|
/**
|
|
122
|
-
* If `true`, animations are
|
|
122
|
+
* If `true`, animations are skipped.
|
|
123
123
|
* @default false
|
|
124
124
|
*/
|
|
125
125
|
skipAnimation: PropTypes.bool,
|
|
@@ -186,7 +186,7 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
186
186
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
187
187
|
*/
|
|
188
188
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
189
|
-
axisId: PropTypes.string,
|
|
189
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
190
190
|
classes: PropTypes.object,
|
|
191
191
|
data: PropTypes.array,
|
|
192
192
|
dataKey: PropTypes.string,
|
|
@@ -194,13 +194,14 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
194
194
|
disableTicks: PropTypes.bool,
|
|
195
195
|
fill: PropTypes.string,
|
|
196
196
|
hideTooltip: PropTypes.bool,
|
|
197
|
-
id: PropTypes.string,
|
|
197
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
198
198
|
label: PropTypes.string,
|
|
199
199
|
labelFontSize: PropTypes.number,
|
|
200
200
|
labelStyle: PropTypes.object,
|
|
201
201
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
202
202
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
203
203
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
204
|
+
reverse: PropTypes.bool,
|
|
204
205
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
205
206
|
slotProps: PropTypes.object,
|
|
206
207
|
slots: PropTypes.object,
|
|
@@ -220,7 +221,7 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
220
221
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
221
222
|
*/
|
|
222
223
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
223
|
-
axisId: PropTypes.string,
|
|
224
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
224
225
|
classes: PropTypes.object,
|
|
225
226
|
data: PropTypes.array,
|
|
226
227
|
dataKey: PropTypes.string,
|
|
@@ -228,13 +229,14 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
228
229
|
disableTicks: PropTypes.bool,
|
|
229
230
|
fill: PropTypes.string,
|
|
230
231
|
hideTooltip: PropTypes.bool,
|
|
231
|
-
id: PropTypes.string,
|
|
232
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
232
233
|
label: PropTypes.string,
|
|
233
234
|
labelFontSize: PropTypes.number,
|
|
234
235
|
labelStyle: PropTypes.object,
|
|
235
236
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
236
237
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
237
238
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
239
|
+
reverse: PropTypes.bool,
|
|
238
240
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
239
241
|
slotProps: PropTypes.object,
|
|
240
242
|
slots: PropTypes.object,
|
|
@@ -21,7 +21,8 @@ function Scatter(props) {
|
|
|
21
21
|
xScale = props.xScale,
|
|
22
22
|
yScale = props.yScale,
|
|
23
23
|
color = props.color,
|
|
24
|
-
markerSize = props.markerSize
|
|
24
|
+
markerSize = props.markerSize,
|
|
25
|
+
onItemClick = props.onItemClick;
|
|
25
26
|
var highlightScope = React.useMemo(function () {
|
|
26
27
|
return _extends({
|
|
27
28
|
highlighted: 'item',
|
|
@@ -61,7 +62,8 @@ function Scatter(props) {
|
|
|
61
62
|
isHighlighted: isHighlighted,
|
|
62
63
|
isFaded: !isHighlighted && getIsFaded(item, pointCtx, highlightScope),
|
|
63
64
|
interactionProps: getInteractionItemProps(pointCtx),
|
|
64
|
-
id: scatterPoint.id
|
|
65
|
+
id: scatterPoint.id,
|
|
66
|
+
dataIndex: i
|
|
65
67
|
});
|
|
66
68
|
}
|
|
67
69
|
}
|
|
@@ -75,7 +77,15 @@ function Scatter(props) {
|
|
|
75
77
|
r: (dataPoint.isHighlighted ? 1.2 : 1) * markerSize,
|
|
76
78
|
transform: "translate(".concat(dataPoint.x, ", ").concat(dataPoint.y, ")"),
|
|
77
79
|
fill: color,
|
|
78
|
-
opacity: dataPoint.isFaded && 0.3 || 1
|
|
80
|
+
opacity: dataPoint.isFaded && 0.3 || 1,
|
|
81
|
+
onClick: onItemClick && function (event) {
|
|
82
|
+
return onItemClick(event, {
|
|
83
|
+
type: 'scatter',
|
|
84
|
+
seriesId: series.id,
|
|
85
|
+
dataIndex: dataPoint.dataIndex
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
cursor: onItemClick ? 'pointer' : 'unset'
|
|
79
89
|
}, dataPoint.interactionProps), dataPoint.id);
|
|
80
90
|
})
|
|
81
91
|
});
|
|
@@ -87,6 +97,12 @@ process.env.NODE_ENV !== "production" ? Scatter.propTypes = {
|
|
|
87
97
|
// ----------------------------------------------------------------------
|
|
88
98
|
color: PropTypes.string.isRequired,
|
|
89
99
|
markerSize: PropTypes.number.isRequired,
|
|
100
|
+
/**
|
|
101
|
+
* Callback fired when clicking on a scatter item.
|
|
102
|
+
* @param {MouseEvent} event Mouse event recorded on the `<svg/>` element.
|
|
103
|
+
* @param {ScatterItemIdentifier} scatterItemIdentifier The scatter item identifier.
|
|
104
|
+
*/
|
|
105
|
+
onItemClick: PropTypes.func,
|
|
90
106
|
series: PropTypes.object.isRequired,
|
|
91
107
|
xScale: PropTypes.func.isRequired,
|
|
92
108
|
yScale: PropTypes.func.isRequired
|
|
@@ -38,6 +38,7 @@ var ScatterChart = /*#__PURE__*/React.forwardRef(function ScatterChart(props, re
|
|
|
38
38
|
leftAxis = props.leftAxis,
|
|
39
39
|
rightAxis = props.rightAxis,
|
|
40
40
|
bottomAxis = props.bottomAxis,
|
|
41
|
+
onItemClick = props.onItemClick,
|
|
41
42
|
children = props.children,
|
|
42
43
|
slots = props.slots,
|
|
43
44
|
slotProps = props.slotProps;
|
|
@@ -56,7 +57,8 @@ var ScatterChart = /*#__PURE__*/React.forwardRef(function ScatterChart(props, re
|
|
|
56
57
|
yAxis: yAxis,
|
|
57
58
|
sx: sx,
|
|
58
59
|
children: [!disableVoronoi && /*#__PURE__*/_jsx(ChartsVoronoiHandler, {
|
|
59
|
-
voronoiMaxRadius: voronoiMaxRadius
|
|
60
|
+
voronoiMaxRadius: voronoiMaxRadius,
|
|
61
|
+
onItemClick: onItemClick
|
|
60
62
|
}), /*#__PURE__*/_jsx(ChartsAxis, {
|
|
61
63
|
topAxis: topAxis,
|
|
62
64
|
leftAxis: leftAxis,
|
|
@@ -66,7 +68,8 @@ var ScatterChart = /*#__PURE__*/React.forwardRef(function ScatterChart(props, re
|
|
|
66
68
|
slotProps: slotProps
|
|
67
69
|
}), /*#__PURE__*/_jsx(ScatterPlot, {
|
|
68
70
|
slots: slots,
|
|
69
|
-
slotProps: slotProps
|
|
71
|
+
slotProps: slotProps,
|
|
72
|
+
onItemClick: disableVoronoi ? onItemClick : undefined
|
|
70
73
|
}), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend, {
|
|
71
74
|
slots: slots,
|
|
72
75
|
slotProps: slotProps
|
|
@@ -93,7 +96,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
93
96
|
* @default xAxisIds[0] The id of the first provided axis
|
|
94
97
|
*/
|
|
95
98
|
bottomAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
96
|
-
axisId: PropTypes.string,
|
|
99
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
97
100
|
classes: PropTypes.object,
|
|
98
101
|
disableLine: PropTypes.bool,
|
|
99
102
|
disableTicks: PropTypes.bool,
|
|
@@ -148,7 +151,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
148
151
|
* @default yAxisIds[0] The id of the first provided axis
|
|
149
152
|
*/
|
|
150
153
|
leftAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
151
|
-
axisId: PropTypes.string,
|
|
154
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
152
155
|
classes: PropTypes.object,
|
|
153
156
|
disableLine: PropTypes.bool,
|
|
154
157
|
disableTicks: PropTypes.bool,
|
|
@@ -195,13 +198,19 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
195
198
|
right: PropTypes.number,
|
|
196
199
|
top: PropTypes.number
|
|
197
200
|
}),
|
|
201
|
+
/**
|
|
202
|
+
* Callback fired when clicking on a scatter item.
|
|
203
|
+
* @param {MouseEvent} event The mouse event recorded on the `<svg/>` element if using Voronoi cells. Or the Mouse event from the scatter element, when `disableVoronoi=true`.
|
|
204
|
+
* @param {ScatterItemIdentifier} scatterItemIdentifier The scatter item identifier.
|
|
205
|
+
*/
|
|
206
|
+
onItemClick: PropTypes.func,
|
|
198
207
|
/**
|
|
199
208
|
* Indicate which axis to display the right of the charts.
|
|
200
209
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
201
210
|
* @default null
|
|
202
211
|
*/
|
|
203
212
|
rightAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
204
|
-
axisId: PropTypes.string,
|
|
213
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
205
214
|
classes: PropTypes.object,
|
|
206
215
|
disableLine: PropTypes.bool,
|
|
207
216
|
disableTicks: PropTypes.bool,
|
|
@@ -249,7 +258,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
249
258
|
* @default null
|
|
250
259
|
*/
|
|
251
260
|
topAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
252
|
-
axisId: PropTypes.string,
|
|
261
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
253
262
|
classes: PropTypes.object,
|
|
254
263
|
disableLine: PropTypes.bool,
|
|
255
264
|
disableTicks: PropTypes.bool,
|
|
@@ -292,7 +301,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
292
301
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
293
302
|
*/
|
|
294
303
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
295
|
-
axisId: PropTypes.string,
|
|
304
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
296
305
|
classes: PropTypes.object,
|
|
297
306
|
data: PropTypes.array,
|
|
298
307
|
dataKey: PropTypes.string,
|
|
@@ -300,13 +309,14 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
300
309
|
disableTicks: PropTypes.bool,
|
|
301
310
|
fill: PropTypes.string,
|
|
302
311
|
hideTooltip: PropTypes.bool,
|
|
303
|
-
id: PropTypes.string,
|
|
312
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
304
313
|
label: PropTypes.string,
|
|
305
314
|
labelFontSize: PropTypes.number,
|
|
306
315
|
labelStyle: PropTypes.object,
|
|
307
316
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
308
317
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
309
318
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
319
|
+
reverse: PropTypes.bool,
|
|
310
320
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
311
321
|
slotProps: PropTypes.object,
|
|
312
322
|
slots: PropTypes.object,
|
|
@@ -326,7 +336,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
326
336
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
327
337
|
*/
|
|
328
338
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
329
|
-
axisId: PropTypes.string,
|
|
339
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
330
340
|
classes: PropTypes.object,
|
|
331
341
|
data: PropTypes.array,
|
|
332
342
|
dataKey: PropTypes.string,
|
|
@@ -334,13 +344,14 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
334
344
|
disableTicks: PropTypes.bool,
|
|
335
345
|
fill: PropTypes.string,
|
|
336
346
|
hideTooltip: PropTypes.bool,
|
|
337
|
-
id: PropTypes.string,
|
|
347
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
338
348
|
label: PropTypes.string,
|
|
339
349
|
labelFontSize: PropTypes.number,
|
|
340
350
|
labelStyle: PropTypes.object,
|
|
341
351
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
342
352
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
343
353
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
354
|
+
reverse: PropTypes.bool,
|
|
344
355
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
345
356
|
slotProps: PropTypes.object,
|
|
346
357
|
slots: PropTypes.object,
|
|
@@ -18,7 +18,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
18
18
|
function ScatterPlot(props) {
|
|
19
19
|
var _slots$scatter;
|
|
20
20
|
var slots = props.slots,
|
|
21
|
-
slotProps = props.slotProps
|
|
21
|
+
slotProps = props.slotProps,
|
|
22
|
+
onItemClick = props.onItemClick;
|
|
22
23
|
var seriesData = React.useContext(SeriesContext).scatter;
|
|
23
24
|
var axisData = React.useContext(CartesianContext);
|
|
24
25
|
if (seriesData === undefined) {
|
|
@@ -48,7 +49,8 @@ function ScatterPlot(props) {
|
|
|
48
49
|
yScale: yScale,
|
|
49
50
|
color: color,
|
|
50
51
|
markerSize: markerSize != null ? markerSize : 4,
|
|
51
|
-
series: series[seriesId]
|
|
52
|
+
series: series[seriesId],
|
|
53
|
+
onItemClick: onItemClick
|
|
52
54
|
}, slotProps == null ? void 0 : slotProps.scatter), id);
|
|
53
55
|
})
|
|
54
56
|
});
|
|
@@ -58,6 +60,12 @@ process.env.NODE_ENV !== "production" ? ScatterPlot.propTypes = {
|
|
|
58
60
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
59
61
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
60
62
|
// ----------------------------------------------------------------------
|
|
63
|
+
/**
|
|
64
|
+
* Callback fired when clicking on a scatter item.
|
|
65
|
+
* @param {MouseEvent} event Mouse event recorded on the `<svg/>` element.
|
|
66
|
+
* @param {ScatterItemIdentifier} scatterItemIdentifier The scatter item identifier.
|
|
67
|
+
*/
|
|
68
|
+
onItemClick: PropTypes.func,
|
|
61
69
|
/**
|
|
62
70
|
* The props used for each component slot.
|
|
63
71
|
* @default {}
|
|
@@ -44,8 +44,8 @@ var SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(props
|
|
|
44
44
|
_props$plotType = props.plotType,
|
|
45
45
|
plotType = _props$plotType === void 0 ? 'line' : _props$plotType,
|
|
46
46
|
_props$valueFormatter = props.valueFormatter,
|
|
47
|
-
valueFormatter = _props$valueFormatter === void 0 ? function (
|
|
48
|
-
return
|
|
47
|
+
valueFormatter = _props$valueFormatter === void 0 ? function (value) {
|
|
48
|
+
return value === null ? '' : value.toString();
|
|
49
49
|
} : _props$valueFormatter,
|
|
50
50
|
area = props.area,
|
|
51
51
|
_props$curve = props.curve,
|
|
@@ -92,9 +92,11 @@ var SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(props
|
|
|
92
92
|
}
|
|
93
93
|
}), plotType === 'line' && /*#__PURE__*/_jsxs(React.Fragment, {
|
|
94
94
|
children: [/*#__PURE__*/_jsx(AreaPlot, {
|
|
95
|
+
skipAnimation: true,
|
|
95
96
|
slots: slots,
|
|
96
97
|
slotProps: slotProps
|
|
97
98
|
}), /*#__PURE__*/_jsx(LinePlot, {
|
|
99
|
+
skipAnimation: true,
|
|
98
100
|
slots: slots,
|
|
99
101
|
slotProps: slotProps
|
|
100
102
|
}), /*#__PURE__*/_jsx(LineHighlightPlot, {
|
|
@@ -211,7 +213,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
211
213
|
* Formatter used by the tooltip.
|
|
212
214
|
* @param {number} value The value to format.
|
|
213
215
|
* @returns {string} the formatted value.
|
|
214
|
-
* @default (
|
|
216
|
+
* @default (value: number | null) => (value === null ? '' : value.toString())
|
|
215
217
|
*/
|
|
216
218
|
valueFormatter: PropTypes.func,
|
|
217
219
|
viewBox: PropTypes.shape({
|
|
@@ -230,7 +232,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
230
232
|
* Notice it is a single configuration object, not an array of configuration.
|
|
231
233
|
*/
|
|
232
234
|
xAxis: PropTypes.shape({
|
|
233
|
-
axisId: PropTypes.string,
|
|
235
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
234
236
|
classes: PropTypes.object,
|
|
235
237
|
data: PropTypes.array,
|
|
236
238
|
dataKey: PropTypes.string,
|
|
@@ -238,13 +240,14 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
238
240
|
disableTicks: PropTypes.bool,
|
|
239
241
|
fill: PropTypes.string,
|
|
240
242
|
hideTooltip: PropTypes.bool,
|
|
241
|
-
id: PropTypes.string,
|
|
243
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
242
244
|
label: PropTypes.string,
|
|
243
245
|
labelFontSize: PropTypes.number,
|
|
244
246
|
labelStyle: PropTypes.object,
|
|
245
247
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
246
248
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
247
249
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
250
|
+
reverse: PropTypes.bool,
|
|
248
251
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
249
252
|
slotProps: PropTypes.object,
|
|
250
253
|
slots: PropTypes.object,
|
|
@@ -129,7 +129,7 @@ function CartesianContextProvider(props) {
|
|
|
129
129
|
_getAxisExtremum2 = _slicedToArray(_getAxisExtremum, 2),
|
|
130
130
|
minData = _getAxisExtremum2[0],
|
|
131
131
|
maxData = _getAxisExtremum2[1];
|
|
132
|
-
var range = [drawingArea.left, drawingArea.left + drawingArea.width];
|
|
132
|
+
var range = axis.reverse ? [drawingArea.left + drawingArea.width, drawingArea.left] : [drawingArea.left, drawingArea.left + drawingArea.width];
|
|
133
133
|
if (isBandScaleConfig(axis)) {
|
|
134
134
|
var _axis$categoryGapRati, _axis$barGapRatio;
|
|
135
135
|
var categoryGapRatio = (_axis$categoryGapRati = axis.categoryGapRatio) != null ? _axis$categoryGapRati : DEFAULT_CATEGORY_GAP_RATIO;
|
|
@@ -186,7 +186,7 @@ function CartesianContextProvider(props) {
|
|
|
186
186
|
_getAxisExtremum4 = _slicedToArray(_getAxisExtremum3, 2),
|
|
187
187
|
minData = _getAxisExtremum4[0],
|
|
188
188
|
maxData = _getAxisExtremum4[1];
|
|
189
|
-
var range = [drawingArea.top + drawingArea.height, drawingArea.top];
|
|
189
|
+
var range = axis.reverse ? [drawingArea.top, drawingArea.top + drawingArea.height] : [drawingArea.top + drawingArea.height, drawingArea.top];
|
|
190
190
|
if (isBandScaleConfig(axis)) {
|
|
191
191
|
var _axis$categoryGapRati2;
|
|
192
192
|
var categoryGapRatio = (_axis$categoryGapRati2 = axis.categoryGapRatio) != null ? _axis$categoryGapRati2 : DEFAULT_CATEGORY_GAP_RATIO;
|
|
@@ -258,7 +258,7 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
258
258
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
259
259
|
*/
|
|
260
260
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
261
|
-
axisId: PropTypes.string,
|
|
261
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
262
262
|
classes: PropTypes.object,
|
|
263
263
|
data: PropTypes.array,
|
|
264
264
|
dataKey: PropTypes.string,
|
|
@@ -266,13 +266,14 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
266
266
|
disableTicks: PropTypes.bool,
|
|
267
267
|
fill: PropTypes.string,
|
|
268
268
|
hideTooltip: PropTypes.bool,
|
|
269
|
-
id: PropTypes.string,
|
|
269
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
270
270
|
label: PropTypes.string,
|
|
271
271
|
labelFontSize: PropTypes.number,
|
|
272
272
|
labelStyle: PropTypes.object,
|
|
273
273
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
274
274
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
275
275
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
276
|
+
reverse: PropTypes.bool,
|
|
276
277
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
277
278
|
slotProps: PropTypes.object,
|
|
278
279
|
slots: PropTypes.object,
|
|
@@ -292,7 +293,7 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
292
293
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
293
294
|
*/
|
|
294
295
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
295
|
-
axisId: PropTypes.string,
|
|
296
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
296
297
|
classes: PropTypes.object,
|
|
297
298
|
data: PropTypes.array,
|
|
298
299
|
dataKey: PropTypes.string,
|
|
@@ -300,13 +301,14 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
300
301
|
disableTicks: PropTypes.bool,
|
|
301
302
|
fill: PropTypes.string,
|
|
302
303
|
hideTooltip: PropTypes.bool,
|
|
303
|
-
id: PropTypes.string,
|
|
304
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
304
305
|
label: PropTypes.string,
|
|
305
306
|
labelFontSize: PropTypes.number,
|
|
306
307
|
labelStyle: PropTypes.object,
|
|
307
308
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
308
309
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
309
310
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
311
|
+
reverse: PropTypes.bool,
|
|
310
312
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
311
313
|
slotProps: PropTypes.object,
|
|
312
314
|
slots: PropTypes.object,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
4
|
+
import useId from '@mui/utils/useId';
|
|
3
5
|
import useChartDimensions from '../hooks/useChartDimensions';
|
|
4
6
|
|
|
5
7
|
/**
|
|
@@ -12,7 +14,8 @@ export var DrawingContext = /*#__PURE__*/React.createContext({
|
|
|
12
14
|
bottom: 0,
|
|
13
15
|
right: 0,
|
|
14
16
|
height: 300,
|
|
15
|
-
width: 400
|
|
17
|
+
width: 400,
|
|
18
|
+
chartId: ''
|
|
16
19
|
});
|
|
17
20
|
export var SVGContext = /*#__PURE__*/React.createContext({
|
|
18
21
|
current: null
|
|
@@ -30,10 +33,16 @@ function DrawingProvider(props) {
|
|
|
30
33
|
svgRef = props.svgRef,
|
|
31
34
|
children = props.children;
|
|
32
35
|
var drawingArea = useChartDimensions(width, height, margin);
|
|
36
|
+
var chartId = useId();
|
|
37
|
+
var value = React.useMemo(function () {
|
|
38
|
+
return _extends({
|
|
39
|
+
chartId: chartId != null ? chartId : ''
|
|
40
|
+
}, drawingArea);
|
|
41
|
+
}, [chartId, drawingArea]);
|
|
33
42
|
return /*#__PURE__*/_jsx(SVGContext.Provider, {
|
|
34
43
|
value: svgRef,
|
|
35
44
|
children: /*#__PURE__*/_jsx(DrawingContext.Provider, {
|
|
36
|
-
value:
|
|
45
|
+
value: value,
|
|
37
46
|
children: children
|
|
38
47
|
})
|
|
39
48
|
});
|
|
@@ -5,13 +5,17 @@ export function useDrawingArea() {
|
|
|
5
5
|
left = _React$useContext.left,
|
|
6
6
|
top = _React$useContext.top,
|
|
7
7
|
width = _React$useContext.width,
|
|
8
|
-
height = _React$useContext.height
|
|
8
|
+
height = _React$useContext.height,
|
|
9
|
+
bottom = _React$useContext.bottom,
|
|
10
|
+
right = _React$useContext.right;
|
|
9
11
|
return React.useMemo(function () {
|
|
10
12
|
return {
|
|
11
13
|
left: left,
|
|
12
14
|
top: top,
|
|
13
15
|
width: width,
|
|
14
|
-
height: height
|
|
16
|
+
height: height,
|
|
17
|
+
bottom: bottom,
|
|
18
|
+
right: right
|
|
15
19
|
};
|
|
16
|
-
}, [height, left, top, width]);
|
|
20
|
+
}, [height, left, top, width, bottom, right]);
|
|
17
21
|
}
|
package/legacy/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts v7.0.0-beta.
|
|
2
|
+
* @mui/x-charts v7.0.0-beta.2
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -20,6 +20,7 @@ export * from './ChartsTooltip';
|
|
|
20
20
|
export * from './ChartsLegend';
|
|
21
21
|
export * from './ChartsAxisHighlight';
|
|
22
22
|
export * from './ChartsVoronoiHandler';
|
|
23
|
+
export * from './ChartsOnAxisClickHandler';
|
|
23
24
|
export * from './BarChart';
|
|
24
25
|
export * from './LineChart';
|
|
25
26
|
export * from './PieChart';
|
|
@@ -15,7 +15,7 @@ export function getMinXTranslation(width, height) {
|
|
|
15
15
|
if (process.env.NODE_ENV !== 'production') {
|
|
16
16
|
if (!warnedOnce && angle > 90 && angle < -90) {
|
|
17
17
|
warnedOnce = true;
|
|
18
|
-
console.warn(["MUI X: It seems you applied an angle larger than 90\xB0 or smaller than -90\xB0 to an axis text.", "This could cause some text overlapping.", "If you encounter a use case where it's needed, please open an issue."].join('\n'));
|
|
18
|
+
console.warn(["MUI X Charts: It seems you applied an angle larger than 90\xB0 or smaller than -90\xB0 to an axis text.", "This could cause some text overlapping.", "If you encounter a use case where it's needed, please open an issue."].join('\n'));
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
var standardAngle = Math.min(Math.abs(angle) % 180, Math.abs(Math.abs(angle) % 180 - 180) % 180); // Map from R to [0, 90]
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { interpolateString } from 'd3-interpolate';
|
|
3
|
+
import { useSpring, to } from '@react-spring/web';
|
|
4
|
+
function usePrevious(value) {
|
|
5
|
+
var ref = React.useRef(null);
|
|
6
|
+
React.useEffect(function () {
|
|
7
|
+
ref.current = value;
|
|
8
|
+
}, [value]);
|
|
9
|
+
return ref.current;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Taken from Nivo
|
|
13
|
+
export var useAnimatedPath = function useAnimatedPath(path, skipAnimation) {
|
|
14
|
+
var previousPath = usePrevious(path);
|
|
15
|
+
var interpolator = React.useMemo(function () {
|
|
16
|
+
return previousPath ? interpolateString(previousPath, path) : function () {
|
|
17
|
+
return path;
|
|
18
|
+
};
|
|
19
|
+
}, [previousPath, path]);
|
|
20
|
+
var _useSpring = useSpring({
|
|
21
|
+
from: {
|
|
22
|
+
value: 0
|
|
23
|
+
},
|
|
24
|
+
to: {
|
|
25
|
+
value: 1
|
|
26
|
+
},
|
|
27
|
+
reset: true,
|
|
28
|
+
immediate: skipAnimation
|
|
29
|
+
}),
|
|
30
|
+
value = _useSpring.value;
|
|
31
|
+
return to([value], interpolator);
|
|
32
|
+
};
|
|
@@ -42,4 +42,11 @@ export function getPercentageValue(value, refValue) {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
throw Error("MUI-Charts: Received an unknown value \"".concat(value, "\". It should be a number, or a string with a percentage value."));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Remove spaces to have viable ids
|
|
49
|
+
*/
|
|
50
|
+
export function cleanId(id) {
|
|
51
|
+
return id.replace(' ', '_');
|
|
45
52
|
}
|