@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
|
}
|
|
@@ -117,7 +119,8 @@ function ChartsXAxis(inProps) {
|
|
|
117
119
|
xAxis: {
|
|
118
120
|
[_ref]: {
|
|
119
121
|
scale: xScale,
|
|
120
|
-
tickNumber
|
|
122
|
+
tickNumber,
|
|
123
|
+
reverse
|
|
121
124
|
}
|
|
122
125
|
}
|
|
123
126
|
} = _React$useContext,
|
|
@@ -179,6 +182,7 @@ function ChartsXAxis(inProps) {
|
|
|
179
182
|
const xTicksWithDimension = addLabelDimension(xTicks, {
|
|
180
183
|
tickLabelStyle: axisTickLabelProps.style,
|
|
181
184
|
tickLabelInterval,
|
|
185
|
+
reverse,
|
|
182
186
|
isMounted
|
|
183
187
|
});
|
|
184
188
|
const labelRefPoint = {
|
|
@@ -242,7 +246,7 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
|
|
|
242
246
|
* The id of the axis to render.
|
|
243
247
|
* If undefined, it will be the first defined axis.
|
|
244
248
|
*/
|
|
245
|
-
axisId: PropTypes.string,
|
|
249
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
246
250
|
/**
|
|
247
251
|
* Override or extend the styles applied to the component.
|
|
248
252
|
*/
|
|
@@ -176,7 +176,7 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
|
|
|
176
176
|
* The id of the axis to render.
|
|
177
177
|
* If undefined, it will be the first defined axis.
|
|
178
178
|
*/
|
|
179
|
-
axisId: PropTypes.string,
|
|
179
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
180
180
|
/**
|
|
181
181
|
* Override or extend the styles applied to the component.
|
|
182
182
|
*/
|
|
@@ -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,
|
|
@@ -97,7 +97,7 @@ process.env.NODE_ENV !== "production" ? AreaElement.propTypes = {
|
|
|
97
97
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
98
98
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
99
99
|
}),
|
|
100
|
-
id: PropTypes.string.isRequired,
|
|
100
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
101
101
|
/**
|
|
102
102
|
* If `true`, animations are skipped.
|
|
103
103
|
* @default false
|
|
@@ -146,7 +146,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
146
146
|
* @default xAxisIds[0] The id of the first provided axis
|
|
147
147
|
*/
|
|
148
148
|
bottomAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
149
|
-
axisId: PropTypes.string,
|
|
149
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
150
150
|
classes: PropTypes.object,
|
|
151
151
|
disableLine: PropTypes.bool,
|
|
152
152
|
disableTicks: PropTypes.bool,
|
|
@@ -200,7 +200,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
200
200
|
* @default yAxisIds[0] The id of the first provided axis
|
|
201
201
|
*/
|
|
202
202
|
leftAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
203
|
-
axisId: PropTypes.string,
|
|
203
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
204
204
|
classes: PropTypes.object,
|
|
205
205
|
disableLine: PropTypes.bool,
|
|
206
206
|
disableTicks: PropTypes.bool,
|
|
@@ -263,7 +263,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
263
263
|
* @default null
|
|
264
264
|
*/
|
|
265
265
|
rightAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
266
|
-
axisId: PropTypes.string,
|
|
266
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
267
267
|
classes: PropTypes.object,
|
|
268
268
|
disableLine: PropTypes.bool,
|
|
269
269
|
disableTicks: PropTypes.bool,
|
|
@@ -316,7 +316,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
316
316
|
* @default null
|
|
317
317
|
*/
|
|
318
318
|
topAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
319
|
-
axisId: PropTypes.string,
|
|
319
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
320
320
|
classes: PropTypes.object,
|
|
321
321
|
disableLine: PropTypes.bool,
|
|
322
322
|
disableTicks: PropTypes.bool,
|
|
@@ -353,7 +353,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
353
353
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
354
354
|
*/
|
|
355
355
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
356
|
-
axisId: PropTypes.string,
|
|
356
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
357
357
|
classes: PropTypes.object,
|
|
358
358
|
data: PropTypes.array,
|
|
359
359
|
dataKey: PropTypes.string,
|
|
@@ -361,13 +361,14 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
361
361
|
disableTicks: PropTypes.bool,
|
|
362
362
|
fill: PropTypes.string,
|
|
363
363
|
hideTooltip: PropTypes.bool,
|
|
364
|
-
id: PropTypes.string,
|
|
364
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
365
365
|
label: PropTypes.string,
|
|
366
366
|
labelFontSize: PropTypes.number,
|
|
367
367
|
labelStyle: PropTypes.object,
|
|
368
368
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
369
369
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
370
370
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
371
|
+
reverse: PropTypes.bool,
|
|
371
372
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
372
373
|
slotProps: PropTypes.object,
|
|
373
374
|
slots: PropTypes.object,
|
|
@@ -387,7 +388,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
387
388
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
388
389
|
*/
|
|
389
390
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
390
|
-
axisId: PropTypes.string,
|
|
391
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
391
392
|
classes: PropTypes.object,
|
|
392
393
|
data: PropTypes.array,
|
|
393
394
|
dataKey: PropTypes.string,
|
|
@@ -395,13 +396,14 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
395
396
|
disableTicks: PropTypes.bool,
|
|
396
397
|
fill: PropTypes.string,
|
|
397
398
|
hideTooltip: PropTypes.bool,
|
|
398
|
-
id: PropTypes.string,
|
|
399
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
399
400
|
label: PropTypes.string,
|
|
400
401
|
labelFontSize: PropTypes.number,
|
|
401
402
|
labelStyle: PropTypes.object,
|
|
402
403
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
403
404
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
404
405
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
406
|
+
reverse: PropTypes.bool,
|
|
405
407
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
406
408
|
slotProps: PropTypes.object,
|
|
407
409
|
slots: PropTypes.object,
|
|
@@ -97,7 +97,7 @@ process.env.NODE_ENV !== "production" ? LineElement.propTypes = {
|
|
|
97
97
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
98
98
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
99
99
|
}),
|
|
100
|
-
id: PropTypes.string.isRequired,
|
|
100
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
101
101
|
/**
|
|
102
102
|
* If `true`, animations are skipped.
|
|
103
103
|
* @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 };
|
|
@@ -137,6 +137,7 @@ process.env.NODE_ENV !== "production" ? MarkElement.propTypes = {
|
|
|
137
137
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
138
138
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
139
139
|
}),
|
|
140
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
140
141
|
/**
|
|
141
142
|
* The shape of the marker.
|
|
142
143
|
*/
|
package/esm/PieChart/PieArc.js
CHANGED
|
@@ -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;
|
|
@@ -159,7 +159,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
159
159
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
160
160
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
161
161
|
}),
|
|
162
|
-
id: PropTypes.string.isRequired,
|
|
162
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
163
163
|
/**
|
|
164
164
|
* The radius between circle center and the begining of the arc.
|
|
165
165
|
* @default 0
|
|
@@ -138,7 +138,7 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
138
138
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
139
139
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
140
140
|
}),
|
|
141
|
-
id: PropTypes.string.isRequired,
|
|
141
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
142
142
|
/**
|
|
143
143
|
* The radius between circle center and the begining of the arc.
|
|
144
144
|
* @default 0
|
package/esm/PieChart/PieChart.js
CHANGED
|
@@ -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,
|
|
@@ -178,7 +178,7 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
178
178
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
179
179
|
*/
|
|
180
180
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
181
|
-
axisId: PropTypes.string,
|
|
181
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
182
182
|
classes: PropTypes.object,
|
|
183
183
|
data: PropTypes.array,
|
|
184
184
|
dataKey: PropTypes.string,
|
|
@@ -186,13 +186,14 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
186
186
|
disableTicks: PropTypes.bool,
|
|
187
187
|
fill: PropTypes.string,
|
|
188
188
|
hideTooltip: PropTypes.bool,
|
|
189
|
-
id: PropTypes.string,
|
|
189
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
190
190
|
label: PropTypes.string,
|
|
191
191
|
labelFontSize: PropTypes.number,
|
|
192
192
|
labelStyle: PropTypes.object,
|
|
193
193
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
194
194
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
195
195
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
196
|
+
reverse: PropTypes.bool,
|
|
196
197
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
197
198
|
slotProps: PropTypes.object,
|
|
198
199
|
slots: PropTypes.object,
|
|
@@ -212,7 +213,7 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
212
213
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
213
214
|
*/
|
|
214
215
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
215
|
-
axisId: PropTypes.string,
|
|
216
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
216
217
|
classes: PropTypes.object,
|
|
217
218
|
data: PropTypes.array,
|
|
218
219
|
dataKey: PropTypes.string,
|
|
@@ -220,13 +221,14 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
220
221
|
disableTicks: PropTypes.bool,
|
|
221
222
|
fill: PropTypes.string,
|
|
222
223
|
hideTooltip: PropTypes.bool,
|
|
223
|
-
id: PropTypes.string,
|
|
224
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
224
225
|
label: PropTypes.string,
|
|
225
226
|
labelFontSize: PropTypes.number,
|
|
226
227
|
labelStyle: PropTypes.object,
|
|
227
228
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
228
229
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
229
230
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
231
|
+
reverse: PropTypes.bool,
|
|
230
232
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
231
233
|
slotProps: PropTypes.object,
|
|
232
234
|
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,
|
|
@@ -110,7 +110,7 @@ function CartesianContextProvider(props) {
|
|
|
110
110
|
var _axis$scaleType, _axis$min, _axis$max, _axis$min2, _axis$max2;
|
|
111
111
|
const isDefaultAxis = axisIndex === 0;
|
|
112
112
|
const [minData, maxData] = getAxisExtremum(axis, xExtremumGetters, isDefaultAxis);
|
|
113
|
-
const range = [drawingArea.left, drawingArea.left + drawingArea.width];
|
|
113
|
+
const range = axis.reverse ? [drawingArea.left + drawingArea.width, drawingArea.left] : [drawingArea.left, drawingArea.left + drawingArea.width];
|
|
114
114
|
if (isBandScaleConfig(axis)) {
|
|
115
115
|
var _axis$categoryGapRati, _axis$barGapRatio;
|
|
116
116
|
const categoryGapRatio = (_axis$categoryGapRati = axis.categoryGapRatio) != null ? _axis$categoryGapRati : DEFAULT_CATEGORY_GAP_RATIO;
|
|
@@ -161,7 +161,7 @@ function CartesianContextProvider(props) {
|
|
|
161
161
|
var _axis$scaleType2, _axis$min3, _axis$max3, _axis$min4, _axis$max4;
|
|
162
162
|
const isDefaultAxis = axisIndex === 0;
|
|
163
163
|
const [minData, maxData] = getAxisExtremum(axis, yExtremumGetters, isDefaultAxis);
|
|
164
|
-
const range = [drawingArea.top + drawingArea.height, drawingArea.top];
|
|
164
|
+
const range = axis.reverse ? [drawingArea.top, drawingArea.top + drawingArea.height] : [drawingArea.top + drawingArea.height, drawingArea.top];
|
|
165
165
|
if (isBandScaleConfig(axis)) {
|
|
166
166
|
var _axis$categoryGapRati2;
|
|
167
167
|
const categoryGapRatio = (_axis$categoryGapRati2 = axis.categoryGapRatio) != null ? _axis$categoryGapRati2 : DEFAULT_CATEGORY_GAP_RATIO;
|
|
@@ -231,7 +231,7 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
231
231
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
232
232
|
*/
|
|
233
233
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
234
|
-
axisId: PropTypes.string,
|
|
234
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
235
235
|
classes: PropTypes.object,
|
|
236
236
|
data: PropTypes.array,
|
|
237
237
|
dataKey: PropTypes.string,
|
|
@@ -239,13 +239,14 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
239
239
|
disableTicks: PropTypes.bool,
|
|
240
240
|
fill: PropTypes.string,
|
|
241
241
|
hideTooltip: PropTypes.bool,
|
|
242
|
-
id: PropTypes.string,
|
|
242
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
243
243
|
label: PropTypes.string,
|
|
244
244
|
labelFontSize: PropTypes.number,
|
|
245
245
|
labelStyle: PropTypes.object,
|
|
246
246
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
247
247
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
248
248
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
249
|
+
reverse: PropTypes.bool,
|
|
249
250
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
250
251
|
slotProps: PropTypes.object,
|
|
251
252
|
slots: PropTypes.object,
|
|
@@ -265,7 +266,7 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
265
266
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
266
267
|
*/
|
|
267
268
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
268
|
-
axisId: PropTypes.string,
|
|
269
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
269
270
|
classes: PropTypes.object,
|
|
270
271
|
data: PropTypes.array,
|
|
271
272
|
dataKey: PropTypes.string,
|
|
@@ -273,13 +274,14 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
273
274
|
disableTicks: PropTypes.bool,
|
|
274
275
|
fill: PropTypes.string,
|
|
275
276
|
hideTooltip: PropTypes.bool,
|
|
276
|
-
id: PropTypes.string,
|
|
277
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
277
278
|
label: PropTypes.string,
|
|
278
279
|
labelFontSize: PropTypes.number,
|
|
279
280
|
labelStyle: PropTypes.object,
|
|
280
281
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
281
282
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
282
283
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
284
|
+
reverse: PropTypes.bool,
|
|
283
285
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
284
286
|
slotProps: PropTypes.object,
|
|
285
287
|
slots: PropTypes.object,
|
package/index.js
CHANGED