@mui/x-charts 6.19.3 → 6.19.4
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.js +11 -9
- package/BarChart/BarElement.d.ts +6 -3
- package/BarChart/BarElement.js +1 -0
- package/BarChart/BarPlot.js +9 -10
- package/CHANGELOG.md +56 -0
- package/ChartsAxis/ChartsAxis.js +4 -4
- package/ChartsLegend/ChartsLegend.js +0 -101
- package/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
- package/ChartsReferenceLine/common.d.ts +2 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +4 -4
- package/ChartsTooltip/ChartsItemTooltipContent.js +3 -3
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -2
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -2
- package/ChartsXAxis/ChartsXAxis.js +13 -9
- package/ChartsYAxis/ChartsYAxis.js +1 -1
- package/LineChart/AreaElement.d.ts +7 -4
- package/LineChart/AreaElement.js +1 -0
- package/LineChart/LineChart.js +11 -9
- package/LineChart/LineElement.d.ts +7 -4
- package/LineChart/LineElement.js +1 -0
- package/LineChart/LineHighlightElement.d.ts +3 -2
- package/LineChart/LineHighlightElement.js +2 -1
- package/LineChart/MarkElement.d.ts +3 -2
- package/LineChart/MarkElement.js +1 -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.js +1 -1
- package/PieChart/PieArcPlot.js +1 -1
- package/PieChart/PieChart.js +11 -9
- package/ScatterChart/Scatter.js +1 -1
- package/ScatterChart/ScatterChart.js +11 -9
- package/SparkLineChart/SparkLineChart.js +3 -2
- package/context/CartesianContextProvider.js +8 -6
- package/context/InteractionProvider.d.ts +2 -2
- package/esm/BarChart/BarChart.js +11 -9
- package/esm/BarChart/BarElement.js +1 -0
- package/esm/BarChart/BarPlot.js +8 -10
- package/esm/ChartsAxis/ChartsAxis.js +4 -4
- package/esm/ChartsLegend/ChartsLegend.js +0 -101
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +4 -4
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +3 -3
- package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -2
- package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -2
- package/esm/ChartsXAxis/ChartsXAxis.js +13 -9
- package/esm/ChartsYAxis/ChartsYAxis.js +1 -1
- package/esm/LineChart/AreaElement.js +1 -0
- package/esm/LineChart/LineChart.js +11 -9
- package/esm/LineChart/LineElement.js +1 -0
- package/esm/LineChart/LineHighlightElement.js +2 -1
- package/esm/LineChart/MarkElement.js +1 -0
- package/esm/PieChart/PieArc.js +1 -0
- package/esm/PieChart/PieArcLabel.js +1 -0
- package/esm/PieChart/PieArcLabelPlot.js +1 -1
- package/esm/PieChart/PieArcPlot.js +1 -1
- package/esm/PieChart/PieChart.js +11 -9
- package/esm/ScatterChart/Scatter.js +1 -1
- package/esm/ScatterChart/ScatterChart.js +11 -9
- package/esm/SparkLineChart/SparkLineChart.js +3 -2
- package/esm/context/CartesianContextProvider.js +8 -6
- package/index.js +1 -1
- package/internals/defaultizeColor.d.ts +15 -15
- package/internals/defaultizeValueFormatter.d.ts +4 -7
- package/internals/stackSeries.d.ts +4 -7
- package/legacy/BarChart/BarChart.js +11 -9
- package/legacy/BarChart/BarElement.js +1 -0
- package/legacy/BarChart/BarPlot.js +10 -10
- package/legacy/ChartsAxis/ChartsAxis.js +4 -4
- package/legacy/ChartsLegend/ChartsLegend.js +0 -101
- package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
- package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +4 -4
- package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +3 -3
- package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -2
- package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -2
- package/legacy/ChartsXAxis/ChartsXAxis.js +12 -8
- package/legacy/ChartsYAxis/ChartsYAxis.js +1 -1
- package/legacy/LineChart/AreaElement.js +1 -0
- package/legacy/LineChart/LineChart.js +11 -9
- package/legacy/LineChart/LineElement.js +1 -0
- package/legacy/LineChart/LineHighlightElement.js +2 -1
- package/legacy/LineChart/MarkElement.js +1 -0
- package/legacy/PieChart/PieArc.js +1 -0
- package/legacy/PieChart/PieArcLabel.js +1 -0
- package/legacy/PieChart/PieArcLabelPlot.js +1 -1
- package/legacy/PieChart/PieArcPlot.js +1 -1
- package/legacy/PieChart/PieChart.js +11 -9
- package/legacy/ScatterChart/Scatter.js +1 -1
- package/legacy/ScatterChart/ScatterChart.js +11 -9
- package/legacy/SparkLineChart/SparkLineChart.js +3 -2
- package/legacy/context/CartesianContextProvider.js +8 -6
- package/legacy/index.js +1 -1
- 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 +11 -9
- package/modern/BarChart/BarElement.js +1 -0
- package/modern/BarChart/BarPlot.js +8 -10
- package/modern/ChartsAxis/ChartsAxis.js +4 -4
- package/modern/ChartsLegend/ChartsLegend.js +0 -101
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +4 -4
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +3 -3
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -2
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -2
- package/modern/ChartsXAxis/ChartsXAxis.js +13 -9
- package/modern/ChartsYAxis/ChartsYAxis.js +1 -1
- package/modern/LineChart/AreaElement.js +1 -0
- package/modern/LineChart/LineChart.js +11 -9
- package/modern/LineChart/LineElement.js +1 -0
- package/modern/LineChart/LineHighlightElement.js +2 -1
- package/modern/LineChart/MarkElement.js +1 -0
- package/modern/PieChart/PieArc.js +1 -0
- package/modern/PieChart/PieArcLabel.js +1 -0
- package/modern/PieChart/PieArcLabelPlot.js +1 -1
- package/modern/PieChart/PieArcPlot.js +1 -1
- package/modern/PieChart/PieChart.js +11 -9
- package/modern/ScatterChart/Scatter.js +1 -1
- package/modern/ScatterChart/ScatterChart.js +11 -9
- package/modern/SparkLineChart/SparkLineChart.js +3 -2
- package/modern/context/CartesianContextProvider.js +8 -6
- package/modern/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["scale", "tickNumber"];
|
|
3
|
+
const _excluded = ["scale", "tickNumber", "reverse"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useSlotProps } from '@mui/base/utils';
|
|
@@ -35,6 +35,7 @@ const useUtilityClasses = ownerState => {
|
|
|
35
35
|
function addLabelDimension(xTicks, {
|
|
36
36
|
tickLabelStyle: style,
|
|
37
37
|
tickLabelInterval,
|
|
38
|
+
reverse,
|
|
38
39
|
isMounted
|
|
39
40
|
}) {
|
|
40
41
|
const withDimension = xTicks.map(tick => {
|
|
@@ -61,8 +62,9 @@ function addLabelDimension(xTicks, {
|
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
// Filter label to avoid overlap
|
|
64
|
-
let
|
|
65
|
-
let
|
|
65
|
+
let currentTextLimit = 0;
|
|
66
|
+
let previouseTextLimit = 0;
|
|
67
|
+
const direction = reverse ? -1 : 1;
|
|
66
68
|
return withDimension.map((item, labelIndex) => {
|
|
67
69
|
const {
|
|
68
70
|
width,
|
|
@@ -74,15 +76,15 @@ function addLabelDimension(xTicks, {
|
|
|
74
76
|
const textPosition = offset + labelOffset;
|
|
75
77
|
const gapRatio = 1.2; // Ratio applied to the minimal distance to add some margin.
|
|
76
78
|
|
|
77
|
-
|
|
78
|
-
if (labelIndex > 0 &&
|
|
79
|
+
currentTextLimit = textPosition - direction * (gapRatio * distance) / 2;
|
|
80
|
+
if (labelIndex > 0 && direction * currentTextLimit < direction * previouseTextLimit) {
|
|
79
81
|
// Except for the first label, we skip all label that overlap with the last accepted.
|
|
80
|
-
// Notice that the early return prevents `
|
|
82
|
+
// Notice that the early return prevents `previouseTextLimit` from being updated.
|
|
81
83
|
return _extends({}, item, {
|
|
82
84
|
skipLabel: true
|
|
83
85
|
});
|
|
84
86
|
}
|
|
85
|
-
|
|
87
|
+
previouseTextLimit = textPosition + direction * (gapRatio * distance) / 2;
|
|
86
88
|
return item;
|
|
87
89
|
});
|
|
88
90
|
}
|
|
@@ -116,7 +118,8 @@ function ChartsXAxis(inProps) {
|
|
|
116
118
|
xAxis: {
|
|
117
119
|
[_ref]: {
|
|
118
120
|
scale: xScale,
|
|
119
|
-
tickNumber
|
|
121
|
+
tickNumber,
|
|
122
|
+
reverse
|
|
120
123
|
}
|
|
121
124
|
}
|
|
122
125
|
} = _React$useContext,
|
|
@@ -178,6 +181,7 @@ function ChartsXAxis(inProps) {
|
|
|
178
181
|
const xTicksWithDimension = addLabelDimension(xTicks, {
|
|
179
182
|
tickLabelStyle: axisTickLabelProps.style,
|
|
180
183
|
tickLabelInterval,
|
|
184
|
+
reverse,
|
|
181
185
|
isMounted
|
|
182
186
|
});
|
|
183
187
|
const labelRefPoint = {
|
|
@@ -241,7 +245,7 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
|
|
|
241
245
|
* The id of the axis to render.
|
|
242
246
|
* If undefined, it will be the first defined axis.
|
|
243
247
|
*/
|
|
244
|
-
axisId: PropTypes.string,
|
|
248
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
245
249
|
/**
|
|
246
250
|
* Override or extend the styles applied to the component.
|
|
247
251
|
*/
|
|
@@ -175,7 +175,7 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
|
|
|
175
175
|
* The id of the axis to render.
|
|
176
176
|
* If undefined, it will be the first defined axis.
|
|
177
177
|
*/
|
|
178
|
-
axisId: PropTypes.string,
|
|
178
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
179
179
|
/**
|
|
180
180
|
* Override or extend the styles applied to the component.
|
|
181
181
|
*/
|
|
@@ -119,6 +119,7 @@ process.env.NODE_ENV !== "production" ? AreaElement.propTypes = {
|
|
|
119
119
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
120
120
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
121
121
|
}),
|
|
122
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
122
123
|
/**
|
|
123
124
|
* The props used for each component slot.
|
|
124
125
|
* @default {}
|
|
@@ -129,7 +129,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
129
129
|
* @default xAxisIds[0] The id of the first provided axis
|
|
130
130
|
*/
|
|
131
131
|
bottomAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
132
|
-
axisId: PropTypes.string,
|
|
132
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
133
133
|
classes: PropTypes.object,
|
|
134
134
|
disableLine: PropTypes.bool,
|
|
135
135
|
disableTicks: PropTypes.bool,
|
|
@@ -183,7 +183,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
183
183
|
* @default yAxisIds[0] The id of the first provided axis
|
|
184
184
|
*/
|
|
185
185
|
leftAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
186
|
-
axisId: PropTypes.string,
|
|
186
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
187
187
|
classes: PropTypes.object,
|
|
188
188
|
disableLine: PropTypes.bool,
|
|
189
189
|
disableTicks: PropTypes.bool,
|
|
@@ -236,7 +236,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
236
236
|
* @default null
|
|
237
237
|
*/
|
|
238
238
|
rightAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
239
|
-
axisId: PropTypes.string,
|
|
239
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
240
240
|
classes: PropTypes.object,
|
|
241
241
|
disableLine: PropTypes.bool,
|
|
242
242
|
disableTicks: PropTypes.bool,
|
|
@@ -269,7 +269,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
269
269
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
270
270
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
271
271
|
}),
|
|
272
|
-
id: PropTypes.string,
|
|
272
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
273
273
|
label: PropTypes.string,
|
|
274
274
|
showMark: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
|
|
275
275
|
stack: PropTypes.string,
|
|
@@ -306,7 +306,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
306
306
|
* @default null
|
|
307
307
|
*/
|
|
308
308
|
topAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
309
|
-
axisId: PropTypes.string,
|
|
309
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
310
310
|
classes: PropTypes.object,
|
|
311
311
|
disableLine: PropTypes.bool,
|
|
312
312
|
disableTicks: PropTypes.bool,
|
|
@@ -343,7 +343,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
343
343
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
344
344
|
*/
|
|
345
345
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
346
|
-
axisId: PropTypes.string,
|
|
346
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
347
347
|
classes: PropTypes.object,
|
|
348
348
|
data: PropTypes.array,
|
|
349
349
|
dataKey: PropTypes.string,
|
|
@@ -351,13 +351,14 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
351
351
|
disableTicks: PropTypes.bool,
|
|
352
352
|
fill: PropTypes.string,
|
|
353
353
|
hideTooltip: PropTypes.bool,
|
|
354
|
-
id: PropTypes.string,
|
|
354
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
355
355
|
label: PropTypes.string,
|
|
356
356
|
labelFontSize: PropTypes.number,
|
|
357
357
|
labelStyle: PropTypes.object,
|
|
358
358
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
359
359
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
360
360
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
361
|
+
reverse: PropTypes.bool,
|
|
361
362
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
362
363
|
slotProps: PropTypes.object,
|
|
363
364
|
slots: PropTypes.object,
|
|
@@ -377,7 +378,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
377
378
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
378
379
|
*/
|
|
379
380
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
380
|
-
axisId: PropTypes.string,
|
|
381
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
381
382
|
classes: PropTypes.object,
|
|
382
383
|
data: PropTypes.array,
|
|
383
384
|
dataKey: PropTypes.string,
|
|
@@ -385,13 +386,14 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
385
386
|
disableTicks: PropTypes.bool,
|
|
386
387
|
fill: PropTypes.string,
|
|
387
388
|
hideTooltip: PropTypes.bool,
|
|
388
|
-
id: PropTypes.string,
|
|
389
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
389
390
|
label: PropTypes.string,
|
|
390
391
|
labelFontSize: PropTypes.number,
|
|
391
392
|
labelStyle: PropTypes.object,
|
|
392
393
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
393
394
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
394
395
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
396
|
+
reverse: PropTypes.bool,
|
|
395
397
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
396
398
|
slotProps: PropTypes.object,
|
|
397
399
|
slots: PropTypes.object,
|
|
@@ -121,6 +121,7 @@ process.env.NODE_ENV !== "production" ? LineElement.propTypes = {
|
|
|
121
121
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
122
122
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
123
123
|
}),
|
|
124
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
124
125
|
/**
|
|
125
126
|
* The props used for each component slot.
|
|
126
127
|
* @default {}
|
|
@@ -73,6 +73,7 @@ process.env.NODE_ENV !== "production" ? LineHighlightElement.propTypes = {
|
|
|
73
73
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
74
74
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
75
75
|
// ----------------------------------------------------------------------
|
|
76
|
-
classes: PropTypes.object
|
|
76
|
+
classes: PropTypes.object,
|
|
77
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired
|
|
77
78
|
} : void 0;
|
|
78
79
|
export { LineHighlightElement };
|
|
@@ -128,6 +128,7 @@ process.env.NODE_ENV !== "production" ? MarkElement.propTypes = {
|
|
|
128
128
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
129
129
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
130
130
|
}),
|
|
131
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
131
132
|
/**
|
|
132
133
|
* The shape of the marker.
|
|
133
134
|
*/
|
|
@@ -95,6 +95,7 @@ process.env.NODE_ENV !== "production" ? PieArc.propTypes = {
|
|
|
95
95
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
96
96
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
97
97
|
}),
|
|
98
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
98
99
|
isFaded: PropTypes.bool.isRequired,
|
|
99
100
|
isHighlighted: PropTypes.bool.isRequired
|
|
100
101
|
} : void 0;
|
|
@@ -98,6 +98,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabel.propTypes = {
|
|
|
98
98
|
// ----------------------------------------------------------------------
|
|
99
99
|
classes: PropTypes.object,
|
|
100
100
|
formattedArcLabel: PropTypes.string,
|
|
101
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
101
102
|
isFaded: PropTypes.bool.isRequired,
|
|
102
103
|
isHighlighted: PropTypes.bool.isRequired
|
|
103
104
|
} : void 0;
|
|
@@ -157,7 +157,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
157
157
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
158
158
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
159
159
|
}),
|
|
160
|
-
id: PropTypes.string.isRequired,
|
|
160
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
161
161
|
/**
|
|
162
162
|
* The radius between circle center and the begining of the arc.
|
|
163
163
|
* @default 0
|
|
@@ -137,7 +137,7 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
137
137
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
138
138
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
139
139
|
}),
|
|
140
|
-
id: PropTypes.string.isRequired,
|
|
140
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
141
141
|
/**
|
|
142
142
|
* The radius between circle center and the begining of the arc.
|
|
143
143
|
* @default 0
|
|
@@ -111,7 +111,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
111
111
|
* @default null
|
|
112
112
|
*/
|
|
113
113
|
bottomAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
114
|
-
axisId: PropTypes.string,
|
|
114
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
115
115
|
classes: PropTypes.object,
|
|
116
116
|
disableLine: PropTypes.bool,
|
|
117
117
|
disableTicks: PropTypes.bool,
|
|
@@ -161,7 +161,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
161
161
|
* @default null
|
|
162
162
|
*/
|
|
163
163
|
leftAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
164
|
-
axisId: PropTypes.string,
|
|
164
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
165
165
|
classes: PropTypes.object,
|
|
166
166
|
disableLine: PropTypes.bool,
|
|
167
167
|
disableTicks: PropTypes.bool,
|
|
@@ -215,7 +215,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
215
215
|
* @default null
|
|
216
216
|
*/
|
|
217
217
|
rightAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
218
|
-
axisId: PropTypes.string,
|
|
218
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
219
219
|
classes: PropTypes.object,
|
|
220
220
|
disableLine: PropTypes.bool,
|
|
221
221
|
disableTicks: PropTypes.bool,
|
|
@@ -273,7 +273,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
273
273
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
274
274
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
275
275
|
}),
|
|
276
|
-
id: PropTypes.string,
|
|
276
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
277
277
|
innerRadius: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
278
278
|
outerRadius: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
279
279
|
paddingAngle: PropTypes.number,
|
|
@@ -309,7 +309,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
309
309
|
* @default null
|
|
310
310
|
*/
|
|
311
311
|
topAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
312
|
-
axisId: PropTypes.string,
|
|
312
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
313
313
|
classes: PropTypes.object,
|
|
314
314
|
disableLine: PropTypes.bool,
|
|
315
315
|
disableTicks: PropTypes.bool,
|
|
@@ -346,7 +346,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
346
346
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
347
347
|
*/
|
|
348
348
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
349
|
-
axisId: PropTypes.string,
|
|
349
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
350
350
|
classes: PropTypes.object,
|
|
351
351
|
data: PropTypes.array,
|
|
352
352
|
dataKey: PropTypes.string,
|
|
@@ -354,13 +354,14 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
354
354
|
disableTicks: PropTypes.bool,
|
|
355
355
|
fill: PropTypes.string,
|
|
356
356
|
hideTooltip: PropTypes.bool,
|
|
357
|
-
id: PropTypes.string,
|
|
357
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
358
358
|
label: PropTypes.string,
|
|
359
359
|
labelFontSize: PropTypes.number,
|
|
360
360
|
labelStyle: PropTypes.object,
|
|
361
361
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
362
362
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
363
363
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
364
|
+
reverse: PropTypes.bool,
|
|
364
365
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
365
366
|
slotProps: PropTypes.object,
|
|
366
367
|
slots: PropTypes.object,
|
|
@@ -380,7 +381,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
380
381
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
381
382
|
*/
|
|
382
383
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
383
|
-
axisId: PropTypes.string,
|
|
384
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
384
385
|
classes: PropTypes.object,
|
|
385
386
|
data: PropTypes.array,
|
|
386
387
|
dataKey: PropTypes.string,
|
|
@@ -388,13 +389,14 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
388
389
|
disableTicks: PropTypes.bool,
|
|
389
390
|
fill: PropTypes.string,
|
|
390
391
|
hideTooltip: PropTypes.bool,
|
|
391
|
-
id: PropTypes.string,
|
|
392
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
392
393
|
label: PropTypes.string,
|
|
393
394
|
labelFontSize: PropTypes.number,
|
|
394
395
|
labelStyle: PropTypes.object,
|
|
395
396
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
396
397
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
397
398
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
399
|
+
reverse: PropTypes.bool,
|
|
398
400
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
399
401
|
slotProps: PropTypes.object,
|
|
400
402
|
slots: PropTypes.object,
|
|
@@ -88,7 +88,7 @@ process.env.NODE_ENV !== "production" ? Scatter.propTypes = {
|
|
|
88
88
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
89
89
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
90
90
|
}),
|
|
91
|
-
id: PropTypes.string.isRequired,
|
|
91
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
92
92
|
label: PropTypes.string,
|
|
93
93
|
markerSize: PropTypes.number,
|
|
94
94
|
type: PropTypes.oneOf(['scatter']).isRequired,
|
|
@@ -88,7 +88,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
88
88
|
* @default xAxisIds[0] The id of the first provided axis
|
|
89
89
|
*/
|
|
90
90
|
bottomAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
91
|
-
axisId: PropTypes.string,
|
|
91
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
92
92
|
classes: PropTypes.object,
|
|
93
93
|
disableLine: PropTypes.bool,
|
|
94
94
|
disableTicks: PropTypes.bool,
|
|
@@ -138,7 +138,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
138
138
|
* @default yAxisIds[0] The id of the first provided axis
|
|
139
139
|
*/
|
|
140
140
|
leftAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
141
|
-
axisId: PropTypes.string,
|
|
141
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
142
142
|
classes: PropTypes.object,
|
|
143
143
|
disableLine: PropTypes.bool,
|
|
144
144
|
disableTicks: PropTypes.bool,
|
|
@@ -191,7 +191,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
191
191
|
* @default null
|
|
192
192
|
*/
|
|
193
193
|
rightAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
194
|
-
axisId: PropTypes.string,
|
|
194
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
195
195
|
classes: PropTypes.object,
|
|
196
196
|
disableLine: PropTypes.bool,
|
|
197
197
|
disableTicks: PropTypes.bool,
|
|
@@ -223,7 +223,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
223
223
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
224
224
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
225
225
|
}),
|
|
226
|
-
id: PropTypes.string,
|
|
226
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
227
227
|
label: PropTypes.string,
|
|
228
228
|
markerSize: PropTypes.number,
|
|
229
229
|
type: PropTypes.oneOf(['scatter']),
|
|
@@ -257,7 +257,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
257
257
|
* @default null
|
|
258
258
|
*/
|
|
259
259
|
topAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
260
|
-
axisId: PropTypes.string,
|
|
260
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
261
261
|
classes: PropTypes.object,
|
|
262
262
|
disableLine: PropTypes.bool,
|
|
263
263
|
disableTicks: PropTypes.bool,
|
|
@@ -294,7 +294,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
294
294
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
295
295
|
*/
|
|
296
296
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
297
|
-
axisId: PropTypes.string,
|
|
297
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
298
298
|
classes: PropTypes.object,
|
|
299
299
|
data: PropTypes.array,
|
|
300
300
|
dataKey: PropTypes.string,
|
|
@@ -302,13 +302,14 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
302
302
|
disableTicks: PropTypes.bool,
|
|
303
303
|
fill: PropTypes.string,
|
|
304
304
|
hideTooltip: PropTypes.bool,
|
|
305
|
-
id: PropTypes.string,
|
|
305
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
306
306
|
label: PropTypes.string,
|
|
307
307
|
labelFontSize: PropTypes.number,
|
|
308
308
|
labelStyle: PropTypes.object,
|
|
309
309
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
310
310
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
311
311
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
312
|
+
reverse: PropTypes.bool,
|
|
312
313
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
313
314
|
slotProps: PropTypes.object,
|
|
314
315
|
slots: PropTypes.object,
|
|
@@ -328,7 +329,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
328
329
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
329
330
|
*/
|
|
330
331
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
331
|
-
axisId: PropTypes.string,
|
|
332
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
332
333
|
classes: PropTypes.object,
|
|
333
334
|
data: PropTypes.array,
|
|
334
335
|
dataKey: PropTypes.string,
|
|
@@ -336,13 +337,14 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
336
337
|
disableTicks: PropTypes.bool,
|
|
337
338
|
fill: PropTypes.string,
|
|
338
339
|
hideTooltip: PropTypes.bool,
|
|
339
|
-
id: PropTypes.string,
|
|
340
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
340
341
|
label: PropTypes.string,
|
|
341
342
|
labelFontSize: PropTypes.number,
|
|
342
343
|
labelStyle: PropTypes.object,
|
|
343
344
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
344
345
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
345
346
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
347
|
+
reverse: PropTypes.bool,
|
|
346
348
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
347
349
|
slotProps: PropTypes.object,
|
|
348
350
|
slots: PropTypes.object,
|
|
@@ -223,7 +223,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
223
223
|
* Notice it is a single configuration object, not an array of configuration.
|
|
224
224
|
*/
|
|
225
225
|
xAxis: PropTypes.shape({
|
|
226
|
-
axisId: PropTypes.string,
|
|
226
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
227
227
|
classes: PropTypes.object,
|
|
228
228
|
data: PropTypes.array,
|
|
229
229
|
dataKey: PropTypes.string,
|
|
@@ -231,13 +231,14 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
231
231
|
disableTicks: PropTypes.bool,
|
|
232
232
|
fill: PropTypes.string,
|
|
233
233
|
hideTooltip: PropTypes.bool,
|
|
234
|
-
id: PropTypes.string,
|
|
234
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
235
235
|
label: PropTypes.string,
|
|
236
236
|
labelFontSize: PropTypes.number,
|
|
237
237
|
labelStyle: PropTypes.object,
|
|
238
238
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
239
239
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
240
240
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
241
|
+
reverse: PropTypes.bool,
|
|
241
242
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
242
243
|
slotProps: PropTypes.object,
|
|
243
244
|
slots: PropTypes.object,
|
|
@@ -107,7 +107,7 @@ function CartesianContextProvider(props) {
|
|
|
107
107
|
allXAxis.forEach((axis, axisIndex) => {
|
|
108
108
|
const isDefaultAxis = axisIndex === 0;
|
|
109
109
|
const [minData, maxData] = getAxisExtremum(axis, xExtremumGetters, isDefaultAxis);
|
|
110
|
-
const range = [drawingArea.left, drawingArea.left + drawingArea.width];
|
|
110
|
+
const range = axis.reverse ? [drawingArea.left + drawingArea.width, drawingArea.left] : [drawingArea.left, drawingArea.left + drawingArea.width];
|
|
111
111
|
if (isBandScaleConfig(axis)) {
|
|
112
112
|
const categoryGapRatio = axis.categoryGapRatio ?? DEFAULT_CATEGORY_GAP_RATIO;
|
|
113
113
|
const barGapRatio = axis.barGapRatio ?? DEFAULT_BAR_GAP_RATIO;
|
|
@@ -156,7 +156,7 @@ function CartesianContextProvider(props) {
|
|
|
156
156
|
allYAxis.forEach((axis, axisIndex) => {
|
|
157
157
|
const isDefaultAxis = axisIndex === 0;
|
|
158
158
|
const [minData, maxData] = getAxisExtremum(axis, yExtremumGetters, isDefaultAxis);
|
|
159
|
-
const range = [drawingArea.top + drawingArea.height, drawingArea.top];
|
|
159
|
+
const range = axis.reverse ? [drawingArea.top, drawingArea.top + drawingArea.height] : [drawingArea.top + drawingArea.height, drawingArea.top];
|
|
160
160
|
if (isBandScaleConfig(axis)) {
|
|
161
161
|
const categoryGapRatio = axis.categoryGapRatio ?? DEFAULT_CATEGORY_GAP_RATIO;
|
|
162
162
|
completedYAxis[axis.id] = _extends({
|
|
@@ -225,7 +225,7 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
225
225
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
226
226
|
*/
|
|
227
227
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
228
|
-
axisId: PropTypes.string,
|
|
228
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
229
229
|
classes: PropTypes.object,
|
|
230
230
|
data: PropTypes.array,
|
|
231
231
|
dataKey: PropTypes.string,
|
|
@@ -233,13 +233,14 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
233
233
|
disableTicks: PropTypes.bool,
|
|
234
234
|
fill: PropTypes.string,
|
|
235
235
|
hideTooltip: PropTypes.bool,
|
|
236
|
-
id: PropTypes.string,
|
|
236
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
237
237
|
label: PropTypes.string,
|
|
238
238
|
labelFontSize: PropTypes.number,
|
|
239
239
|
labelStyle: PropTypes.object,
|
|
240
240
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
241
241
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
242
242
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
243
|
+
reverse: PropTypes.bool,
|
|
243
244
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
244
245
|
slotProps: PropTypes.object,
|
|
245
246
|
slots: PropTypes.object,
|
|
@@ -259,7 +260,7 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
259
260
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
260
261
|
*/
|
|
261
262
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
262
|
-
axisId: PropTypes.string,
|
|
263
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
263
264
|
classes: PropTypes.object,
|
|
264
265
|
data: PropTypes.array,
|
|
265
266
|
dataKey: PropTypes.string,
|
|
@@ -267,13 +268,14 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
267
268
|
disableTicks: PropTypes.bool,
|
|
268
269
|
fill: PropTypes.string,
|
|
269
270
|
hideTooltip: PropTypes.bool,
|
|
270
|
-
id: PropTypes.string,
|
|
271
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
271
272
|
label: PropTypes.string,
|
|
272
273
|
labelFontSize: PropTypes.number,
|
|
273
274
|
labelStyle: PropTypes.object,
|
|
274
275
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
275
276
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
276
277
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
278
|
+
reverse: PropTypes.bool,
|
|
277
279
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
278
280
|
slotProps: PropTypes.object,
|
|
279
281
|
slots: PropTypes.object,
|
package/modern/index.js
CHANGED