@mui/x-charts 7.0.0-beta.1 → 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.js +10 -8
- package/BarChart/BarElement.d.ts +20 -13
- package/BarChart/BarElement.js +1 -0
- package/BarChart/BarPlot.d.ts +3 -5
- package/BarChart/BarPlot.js +9 -10
- package/CHANGELOG.md +159 -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/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/ChartsReferenceLine/common.d.ts +2 -1
- package/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +1 -1
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/ChartsTooltip/utils.d.ts +1 -0
- package/ChartsTooltip/utils.js +7 -0
- package/ChartsXAxis/ChartsXAxis.js +13 -9
- package/ChartsYAxis/ChartsYAxis.js +1 -1
- package/LineChart/AnimatedArea.js +1 -1
- package/LineChart/AnimatedLine.js +1 -1
- package/LineChart/AreaElement.d.ts +2 -1
- package/LineChart/AreaElement.js +1 -1
- package/LineChart/LineChart.js +10 -8
- package/LineChart/LineElement.d.ts +2 -1
- package/LineChart/LineElement.js +1 -1
- 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 +10 -8
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +6 -4
- package/ScatterChart/ScatterChart.js +10 -8
- package/SparkLineChart/SparkLineChart.d.ts +1 -1
- package/SparkLineChart/SparkLineChart.js +5 -4
- package/context/CartesianContextProvider.js +8 -6
- package/esm/BarChart/BarChart.js +10 -8
- package/esm/BarChart/BarElement.js +1 -0
- package/esm/BarChart/BarPlot.js +8 -10
- 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/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -2
- package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/esm/ChartsTooltip/utils.js +6 -0
- package/esm/ChartsXAxis/ChartsXAxis.js +13 -9
- package/esm/ChartsYAxis/ChartsYAxis.js +1 -1
- package/esm/LineChart/AnimatedArea.js +1 -1
- package/esm/LineChart/AnimatedLine.js +1 -1
- package/esm/LineChart/AreaElement.js +1 -1
- package/esm/LineChart/LineChart.js +10 -8
- package/esm/LineChart/LineElement.js +1 -1
- 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 +10 -8
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +6 -4
- package/esm/ScatterChart/ScatterChart.js +10 -8
- package/esm/SparkLineChart/SparkLineChart.js +5 -4
- package/esm/context/CartesianContextProvider.js +8 -6
- package/index.js +1 -1
- package/internals/defaultizeColor.d.ts +16 -16
- package/internals/defaultizeValueFormatter.d.ts +4 -7
- package/internals/stackSeries.d.ts +4 -7
- package/legacy/BarChart/BarChart.js +10 -8
- package/legacy/BarChart/BarElement.js +1 -0
- package/legacy/BarChart/BarPlot.js +10 -10
- 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/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -2
- package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/legacy/ChartsTooltip/utils.js +6 -0
- package/legacy/ChartsXAxis/ChartsXAxis.js +12 -8
- package/legacy/ChartsYAxis/ChartsYAxis.js +1 -1
- package/legacy/LineChart/AnimatedArea.js +1 -1
- package/legacy/LineChart/AnimatedLine.js +1 -1
- package/legacy/LineChart/AreaElement.js +1 -1
- package/legacy/LineChart/LineChart.js +10 -8
- package/legacy/LineChart/LineElement.js +1 -1
- 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 +10 -8
- package/legacy/ResponsiveChartContainer/ResponsiveChartContainer.js +6 -4
- package/legacy/ScatterChart/ScatterChart.js +10 -8
- package/legacy/SparkLineChart/SparkLineChart.js +6 -5
- 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 +10 -8
- package/modern/BarChart/BarElement.js +1 -0
- package/modern/BarChart/BarPlot.js +8 -10
- 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/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -2
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/modern/ChartsTooltip/utils.js +6 -0
- package/modern/ChartsXAxis/ChartsXAxis.js +13 -9
- package/modern/ChartsYAxis/ChartsYAxis.js +1 -1
- package/modern/LineChart/AnimatedArea.js +1 -1
- package/modern/LineChart/AnimatedLine.js +1 -1
- package/modern/LineChart/AreaElement.js +1 -1
- package/modern/LineChart/LineChart.js +10 -8
- package/modern/LineChart/LineElement.js +1 -1
- 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 +10 -8
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +6 -4
- package/modern/ScatterChart/ScatterChart.js +10 -8
- package/modern/SparkLineChart/SparkLineChart.js +5 -4
- package/modern/context/CartesianContextProvider.js +8 -6
- package/modern/index.js +1 -1
- package/package.json +1 -1
|
@@ -84,4 +84,10 @@ export function isCartesianSeriesType(seriesType) {
|
|
|
84
84
|
}
|
|
85
85
|
export function isCartesianSeries(series) {
|
|
86
86
|
return isCartesianSeriesType(series.type);
|
|
87
|
+
}
|
|
88
|
+
export function utcFormatter(v) {
|
|
89
|
+
if (v instanceof Date) {
|
|
90
|
+
return v.toUTCString();
|
|
91
|
+
}
|
|
92
|
+
return v.toLocaleString();
|
|
87
93
|
}
|
|
@@ -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
|
*/
|
|
@@ -90,7 +90,7 @@ process.env.NODE_ENV !== "production" ? AnimatedArea.propTypes = {
|
|
|
90
90
|
ownerState: PropTypes.shape({
|
|
91
91
|
classes: PropTypes.object,
|
|
92
92
|
color: PropTypes.string.isRequired,
|
|
93
|
-
id: PropTypes.string.isRequired,
|
|
93
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
94
94
|
isFaded: PropTypes.bool.isRequired,
|
|
95
95
|
isHighlighted: PropTypes.bool.isRequired
|
|
96
96
|
}).isRequired,
|
|
@@ -92,7 +92,7 @@ process.env.NODE_ENV !== "production" ? AnimatedLine.propTypes = {
|
|
|
92
92
|
ownerState: PropTypes.shape({
|
|
93
93
|
classes: PropTypes.object,
|
|
94
94
|
color: PropTypes.string.isRequired,
|
|
95
|
-
id: PropTypes.string.isRequired,
|
|
95
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
96
96
|
isFaded: PropTypes.bool.isRequired,
|
|
97
97
|
isHighlighted: PropTypes.bool.isRequired
|
|
98
98
|
}).isRequired,
|
|
@@ -96,7 +96,7 @@ process.env.NODE_ENV !== "production" ? AreaElement.propTypes = {
|
|
|
96
96
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
97
97
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
98
98
|
}),
|
|
99
|
-
id: PropTypes.string.isRequired,
|
|
99
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
100
100
|
/**
|
|
101
101
|
* If `true`, animations are skipped.
|
|
102
102
|
* @default false
|
|
@@ -143,7 +143,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
143
143
|
* @default xAxisIds[0] The id of the first provided axis
|
|
144
144
|
*/
|
|
145
145
|
bottomAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
146
|
-
axisId: PropTypes.string,
|
|
146
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
147
147
|
classes: PropTypes.object,
|
|
148
148
|
disableLine: PropTypes.bool,
|
|
149
149
|
disableTicks: PropTypes.bool,
|
|
@@ -197,7 +197,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
197
197
|
* @default yAxisIds[0] The id of the first provided axis
|
|
198
198
|
*/
|
|
199
199
|
leftAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
200
|
-
axisId: PropTypes.string,
|
|
200
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
201
201
|
classes: PropTypes.object,
|
|
202
202
|
disableLine: PropTypes.bool,
|
|
203
203
|
disableTicks: PropTypes.bool,
|
|
@@ -260,7 +260,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
260
260
|
* @default null
|
|
261
261
|
*/
|
|
262
262
|
rightAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
263
|
-
axisId: PropTypes.string,
|
|
263
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
264
264
|
classes: PropTypes.object,
|
|
265
265
|
disableLine: PropTypes.bool,
|
|
266
266
|
disableTicks: PropTypes.bool,
|
|
@@ -313,7 +313,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
313
313
|
* @default null
|
|
314
314
|
*/
|
|
315
315
|
topAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
316
|
-
axisId: PropTypes.string,
|
|
316
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
317
317
|
classes: PropTypes.object,
|
|
318
318
|
disableLine: PropTypes.bool,
|
|
319
319
|
disableTicks: PropTypes.bool,
|
|
@@ -350,7 +350,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
350
350
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
351
351
|
*/
|
|
352
352
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
353
|
-
axisId: PropTypes.string,
|
|
353
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
354
354
|
classes: PropTypes.object,
|
|
355
355
|
data: PropTypes.array,
|
|
356
356
|
dataKey: PropTypes.string,
|
|
@@ -358,13 +358,14 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
358
358
|
disableTicks: PropTypes.bool,
|
|
359
359
|
fill: PropTypes.string,
|
|
360
360
|
hideTooltip: PropTypes.bool,
|
|
361
|
-
id: PropTypes.string,
|
|
361
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
362
362
|
label: PropTypes.string,
|
|
363
363
|
labelFontSize: PropTypes.number,
|
|
364
364
|
labelStyle: PropTypes.object,
|
|
365
365
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
366
366
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
367
367
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
368
|
+
reverse: PropTypes.bool,
|
|
368
369
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
369
370
|
slotProps: PropTypes.object,
|
|
370
371
|
slots: PropTypes.object,
|
|
@@ -384,7 +385,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
384
385
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
385
386
|
*/
|
|
386
387
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
387
|
-
axisId: PropTypes.string,
|
|
388
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
388
389
|
classes: PropTypes.object,
|
|
389
390
|
data: PropTypes.array,
|
|
390
391
|
dataKey: PropTypes.string,
|
|
@@ -392,13 +393,14 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
392
393
|
disableTicks: PropTypes.bool,
|
|
393
394
|
fill: PropTypes.string,
|
|
394
395
|
hideTooltip: PropTypes.bool,
|
|
395
|
-
id: PropTypes.string,
|
|
396
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
396
397
|
label: PropTypes.string,
|
|
397
398
|
labelFontSize: PropTypes.number,
|
|
398
399
|
labelStyle: PropTypes.object,
|
|
399
400
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
400
401
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
401
402
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
403
|
+
reverse: PropTypes.bool,
|
|
402
404
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
403
405
|
slotProps: PropTypes.object,
|
|
404
406
|
slots: PropTypes.object,
|
|
@@ -96,7 +96,7 @@ process.env.NODE_ENV !== "production" ? LineElement.propTypes = {
|
|
|
96
96
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
97
97
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
98
98
|
}),
|
|
99
|
-
id: PropTypes.string.isRequired,
|
|
99
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
100
100
|
/**
|
|
101
101
|
* If `true`, animations are skipped.
|
|
102
102
|
* @default false
|
|
@@ -74,6 +74,7 @@ process.env.NODE_ENV !== "production" ? LineHighlightElement.propTypes = {
|
|
|
74
74
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
75
75
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
76
76
|
// ----------------------------------------------------------------------
|
|
77
|
-
classes: PropTypes.object
|
|
77
|
+
classes: PropTypes.object,
|
|
78
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired
|
|
78
79
|
} : void 0;
|
|
79
80
|
export { LineHighlightElement };
|
|
@@ -136,6 +136,7 @@ process.env.NODE_ENV !== "production" ? MarkElement.propTypes = {
|
|
|
136
136
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
137
137
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
138
138
|
}),
|
|
139
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
139
140
|
/**
|
|
140
141
|
* The shape of the marker.
|
|
141
142
|
*/
|
|
@@ -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,
|
|
@@ -264,7 +264,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
264
264
|
* @default null
|
|
265
265
|
*/
|
|
266
266
|
topAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
267
|
-
axisId: PropTypes.string,
|
|
267
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
268
268
|
classes: PropTypes.object,
|
|
269
269
|
disableLine: PropTypes.bool,
|
|
270
270
|
disableTicks: PropTypes.bool,
|
|
@@ -301,7 +301,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
301
301
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
302
302
|
*/
|
|
303
303
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
304
|
-
axisId: PropTypes.string,
|
|
304
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
305
305
|
classes: PropTypes.object,
|
|
306
306
|
data: PropTypes.array,
|
|
307
307
|
dataKey: PropTypes.string,
|
|
@@ -309,13 +309,14 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
309
309
|
disableTicks: PropTypes.bool,
|
|
310
310
|
fill: PropTypes.string,
|
|
311
311
|
hideTooltip: PropTypes.bool,
|
|
312
|
-
id: PropTypes.string,
|
|
312
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
313
313
|
label: PropTypes.string,
|
|
314
314
|
labelFontSize: PropTypes.number,
|
|
315
315
|
labelStyle: PropTypes.object,
|
|
316
316
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
317
317
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
318
318
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
319
|
+
reverse: PropTypes.bool,
|
|
319
320
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
320
321
|
slotProps: PropTypes.object,
|
|
321
322
|
slots: PropTypes.object,
|
|
@@ -335,7 +336,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
335
336
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
336
337
|
*/
|
|
337
338
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
338
|
-
axisId: PropTypes.string,
|
|
339
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
339
340
|
classes: PropTypes.object,
|
|
340
341
|
data: PropTypes.array,
|
|
341
342
|
dataKey: PropTypes.string,
|
|
@@ -343,13 +344,14 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
343
344
|
disableTicks: PropTypes.bool,
|
|
344
345
|
fill: PropTypes.string,
|
|
345
346
|
hideTooltip: PropTypes.bool,
|
|
346
|
-
id: PropTypes.string,
|
|
347
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
347
348
|
label: PropTypes.string,
|
|
348
349
|
labelFontSize: PropTypes.number,
|
|
349
350
|
labelStyle: PropTypes.object,
|
|
350
351
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
351
352
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
352
353
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
354
|
+
reverse: PropTypes.bool,
|
|
353
355
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
354
356
|
slotProps: PropTypes.object,
|
|
355
357
|
slots: PropTypes.object,
|
|
@@ -175,7 +175,7 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
175
175
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
176
176
|
*/
|
|
177
177
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
178
|
-
axisId: PropTypes.string,
|
|
178
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
179
179
|
classes: PropTypes.object,
|
|
180
180
|
data: PropTypes.array,
|
|
181
181
|
dataKey: PropTypes.string,
|
|
@@ -183,13 +183,14 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
183
183
|
disableTicks: PropTypes.bool,
|
|
184
184
|
fill: PropTypes.string,
|
|
185
185
|
hideTooltip: PropTypes.bool,
|
|
186
|
-
id: PropTypes.string,
|
|
186
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
187
187
|
label: PropTypes.string,
|
|
188
188
|
labelFontSize: PropTypes.number,
|
|
189
189
|
labelStyle: PropTypes.object,
|
|
190
190
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
191
191
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
192
192
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
193
|
+
reverse: PropTypes.bool,
|
|
193
194
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
194
195
|
slotProps: PropTypes.object,
|
|
195
196
|
slots: PropTypes.object,
|
|
@@ -209,7 +210,7 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
209
210
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
210
211
|
*/
|
|
211
212
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
212
|
-
axisId: PropTypes.string,
|
|
213
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
213
214
|
classes: PropTypes.object,
|
|
214
215
|
data: PropTypes.array,
|
|
215
216
|
dataKey: PropTypes.string,
|
|
@@ -217,13 +218,14 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
217
218
|
disableTicks: PropTypes.bool,
|
|
218
219
|
fill: PropTypes.string,
|
|
219
220
|
hideTooltip: PropTypes.bool,
|
|
220
|
-
id: PropTypes.string,
|
|
221
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
221
222
|
label: PropTypes.string,
|
|
222
223
|
labelFontSize: PropTypes.number,
|
|
223
224
|
labelStyle: PropTypes.object,
|
|
224
225
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
225
226
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
226
227
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
228
|
+
reverse: PropTypes.bool,
|
|
227
229
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
228
230
|
slotProps: PropTypes.object,
|
|
229
231
|
slots: PropTypes.object,
|
|
@@ -96,7 +96,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
96
96
|
* @default xAxisIds[0] The id of the first provided axis
|
|
97
97
|
*/
|
|
98
98
|
bottomAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
99
|
-
axisId: PropTypes.string,
|
|
99
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
100
100
|
classes: PropTypes.object,
|
|
101
101
|
disableLine: PropTypes.bool,
|
|
102
102
|
disableTicks: PropTypes.bool,
|
|
@@ -151,7 +151,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
151
151
|
* @default yAxisIds[0] The id of the first provided axis
|
|
152
152
|
*/
|
|
153
153
|
leftAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
154
|
-
axisId: PropTypes.string,
|
|
154
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
155
155
|
classes: PropTypes.object,
|
|
156
156
|
disableLine: PropTypes.bool,
|
|
157
157
|
disableTicks: PropTypes.bool,
|
|
@@ -210,7 +210,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
210
210
|
* @default null
|
|
211
211
|
*/
|
|
212
212
|
rightAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
213
|
-
axisId: PropTypes.string,
|
|
213
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
214
214
|
classes: PropTypes.object,
|
|
215
215
|
disableLine: PropTypes.bool,
|
|
216
216
|
disableTicks: PropTypes.bool,
|
|
@@ -258,7 +258,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
258
258
|
* @default null
|
|
259
259
|
*/
|
|
260
260
|
topAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
261
|
-
axisId: PropTypes.string,
|
|
261
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
262
262
|
classes: PropTypes.object,
|
|
263
263
|
disableLine: PropTypes.bool,
|
|
264
264
|
disableTicks: PropTypes.bool,
|
|
@@ -301,7 +301,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
301
301
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
302
302
|
*/
|
|
303
303
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
304
|
-
axisId: PropTypes.string,
|
|
304
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
305
305
|
classes: PropTypes.object,
|
|
306
306
|
data: PropTypes.array,
|
|
307
307
|
dataKey: PropTypes.string,
|
|
@@ -309,13 +309,14 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
309
309
|
disableTicks: PropTypes.bool,
|
|
310
310
|
fill: PropTypes.string,
|
|
311
311
|
hideTooltip: PropTypes.bool,
|
|
312
|
-
id: PropTypes.string,
|
|
312
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
313
313
|
label: PropTypes.string,
|
|
314
314
|
labelFontSize: PropTypes.number,
|
|
315
315
|
labelStyle: PropTypes.object,
|
|
316
316
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
317
317
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
318
318
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
319
|
+
reverse: PropTypes.bool,
|
|
319
320
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
320
321
|
slotProps: PropTypes.object,
|
|
321
322
|
slots: PropTypes.object,
|
|
@@ -335,7 +336,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
335
336
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
336
337
|
*/
|
|
337
338
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
338
|
-
axisId: PropTypes.string,
|
|
339
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
339
340
|
classes: PropTypes.object,
|
|
340
341
|
data: PropTypes.array,
|
|
341
342
|
dataKey: PropTypes.string,
|
|
@@ -343,13 +344,14 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
343
344
|
disableTicks: PropTypes.bool,
|
|
344
345
|
fill: PropTypes.string,
|
|
345
346
|
hideTooltip: PropTypes.bool,
|
|
346
|
-
id: PropTypes.string,
|
|
347
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
347
348
|
label: PropTypes.string,
|
|
348
349
|
labelFontSize: PropTypes.number,
|
|
349
350
|
labelStyle: PropTypes.object,
|
|
350
351
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
351
352
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
352
353
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
354
|
+
reverse: PropTypes.bool,
|
|
353
355
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
354
356
|
slotProps: PropTypes.object,
|
|
355
357
|
slots: PropTypes.object,
|
|
@@ -42,7 +42,7 @@ const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(pro
|
|
|
42
42
|
slotProps,
|
|
43
43
|
data,
|
|
44
44
|
plotType = 'line',
|
|
45
|
-
valueFormatter =
|
|
45
|
+
valueFormatter = value => value === null ? '' : value.toString(),
|
|
46
46
|
area,
|
|
47
47
|
curve = 'linear'
|
|
48
48
|
} = props;
|
|
@@ -207,7 +207,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
207
207
|
* Formatter used by the tooltip.
|
|
208
208
|
* @param {number} value The value to format.
|
|
209
209
|
* @returns {string} the formatted value.
|
|
210
|
-
* @default (
|
|
210
|
+
* @default (value: number | null) => (value === null ? '' : value.toString())
|
|
211
211
|
*/
|
|
212
212
|
valueFormatter: PropTypes.func,
|
|
213
213
|
viewBox: PropTypes.shape({
|
|
@@ -226,7 +226,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
226
226
|
* Notice it is a single configuration object, not an array of configuration.
|
|
227
227
|
*/
|
|
228
228
|
xAxis: PropTypes.shape({
|
|
229
|
-
axisId: PropTypes.string,
|
|
229
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
230
230
|
classes: PropTypes.object,
|
|
231
231
|
data: PropTypes.array,
|
|
232
232
|
dataKey: PropTypes.string,
|
|
@@ -234,13 +234,14 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
234
234
|
disableTicks: PropTypes.bool,
|
|
235
235
|
fill: PropTypes.string,
|
|
236
236
|
hideTooltip: PropTypes.bool,
|
|
237
|
-
id: PropTypes.string,
|
|
237
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
238
238
|
label: PropTypes.string,
|
|
239
239
|
labelFontSize: PropTypes.number,
|
|
240
240
|
labelStyle: PropTypes.object,
|
|
241
241
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
242
242
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
243
243
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
244
|
+
reverse: PropTypes.bool,
|
|
244
245
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
245
246
|
slotProps: PropTypes.object,
|
|
246
247
|
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