@mui/x-charts 6.19.3 → 6.19.5
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 +117 -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.d.ts +7 -1
- package/SparkLineChart/SparkLineChart.js +14 -5
- 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 +14 -5
- 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 +16 -6
- 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 +14 -5
- package/modern/context/CartesianContextProvider.js +8 -6
- package/modern/index.js +1 -1
- package/package.json +1 -1
|
@@ -123,7 +123,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
123
123
|
* @default null
|
|
124
124
|
*/
|
|
125
125
|
bottomAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
126
|
-
axisId: PropTypes.string,
|
|
126
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
127
127
|
classes: PropTypes.object,
|
|
128
128
|
disableLine: PropTypes.bool,
|
|
129
129
|
disableTicks: PropTypes.bool,
|
|
@@ -173,7 +173,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
173
173
|
* @default null
|
|
174
174
|
*/
|
|
175
175
|
leftAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
176
|
-
axisId: PropTypes.string,
|
|
176
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
177
177
|
classes: PropTypes.object,
|
|
178
178
|
disableLine: PropTypes.bool,
|
|
179
179
|
disableTicks: PropTypes.bool,
|
|
@@ -227,7 +227,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
227
227
|
* @default null
|
|
228
228
|
*/
|
|
229
229
|
rightAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
230
|
-
axisId: PropTypes.string,
|
|
230
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
231
231
|
classes: PropTypes.object,
|
|
232
232
|
disableLine: PropTypes.bool,
|
|
233
233
|
disableTicks: PropTypes.bool,
|
|
@@ -285,7 +285,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
285
285
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
286
286
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
287
287
|
}),
|
|
288
|
-
id: PropTypes.string,
|
|
288
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
289
289
|
innerRadius: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
290
290
|
outerRadius: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
291
291
|
paddingAngle: PropTypes.number,
|
|
@@ -321,7 +321,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
321
321
|
* @default null
|
|
322
322
|
*/
|
|
323
323
|
topAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
324
|
-
axisId: PropTypes.string,
|
|
324
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
325
325
|
classes: PropTypes.object,
|
|
326
326
|
disableLine: PropTypes.bool,
|
|
327
327
|
disableTicks: PropTypes.bool,
|
|
@@ -358,7 +358,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
358
358
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
359
359
|
*/
|
|
360
360
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
361
|
-
axisId: PropTypes.string,
|
|
361
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
362
362
|
classes: PropTypes.object,
|
|
363
363
|
data: PropTypes.array,
|
|
364
364
|
dataKey: PropTypes.string,
|
|
@@ -366,13 +366,14 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
366
366
|
disableTicks: PropTypes.bool,
|
|
367
367
|
fill: PropTypes.string,
|
|
368
368
|
hideTooltip: PropTypes.bool,
|
|
369
|
-
id: PropTypes.string,
|
|
369
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
370
370
|
label: PropTypes.string,
|
|
371
371
|
labelFontSize: PropTypes.number,
|
|
372
372
|
labelStyle: PropTypes.object,
|
|
373
373
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
374
374
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
375
375
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
376
|
+
reverse: PropTypes.bool,
|
|
376
377
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
377
378
|
slotProps: PropTypes.object,
|
|
378
379
|
slots: PropTypes.object,
|
|
@@ -392,7 +393,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
392
393
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
393
394
|
*/
|
|
394
395
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
395
|
-
axisId: PropTypes.string,
|
|
396
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
396
397
|
classes: PropTypes.object,
|
|
397
398
|
data: PropTypes.array,
|
|
398
399
|
dataKey: PropTypes.string,
|
|
@@ -400,13 +401,14 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
400
401
|
disableTicks: PropTypes.bool,
|
|
401
402
|
fill: PropTypes.string,
|
|
402
403
|
hideTooltip: PropTypes.bool,
|
|
403
|
-
id: PropTypes.string,
|
|
404
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
404
405
|
label: PropTypes.string,
|
|
405
406
|
labelFontSize: PropTypes.number,
|
|
406
407
|
labelStyle: PropTypes.object,
|
|
407
408
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
408
409
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
409
410
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
411
|
+
reverse: PropTypes.bool,
|
|
410
412
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
411
413
|
slotProps: PropTypes.object,
|
|
412
414
|
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,
|
|
@@ -44,12 +44,14 @@ var SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(props
|
|
|
44
44
|
_props$plotType = props.plotType,
|
|
45
45
|
plotType = _props$plotType === void 0 ? 'line' : _props$plotType,
|
|
46
46
|
_props$valueFormatter = props.valueFormatter,
|
|
47
|
-
valueFormatter = _props$valueFormatter === void 0 ? function (
|
|
48
|
-
return
|
|
47
|
+
valueFormatter = _props$valueFormatter === void 0 ? function (value) {
|
|
48
|
+
return value === null ? '' : value.toString();
|
|
49
49
|
} : _props$valueFormatter,
|
|
50
50
|
area = props.area,
|
|
51
51
|
_props$curve = props.curve,
|
|
52
|
-
curve = _props$curve === void 0 ? 'linear' : _props$curve
|
|
52
|
+
curve = _props$curve === void 0 ? 'linear' : _props$curve,
|
|
53
|
+
_props$skipAnimation = props.skipAnimation,
|
|
54
|
+
skipAnimation = _props$skipAnimation === void 0 ? false : _props$skipAnimation;
|
|
53
55
|
var defaultXHighlight = showHighlight && plotType === 'bar' ? {
|
|
54
56
|
x: 'band'
|
|
55
57
|
} : {
|
|
@@ -84,6 +86,7 @@ var SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(props
|
|
|
84
86
|
sx: sx,
|
|
85
87
|
disableAxisListener: (!showTooltip || (tooltip == null ? void 0 : tooltip.trigger) !== 'axis') && (axisHighlight == null ? void 0 : axisHighlight.x) === 'none' && (axisHighlight == null ? void 0 : axisHighlight.y) === 'none',
|
|
86
88
|
children: [plotType === 'bar' && /*#__PURE__*/_jsx(BarPlot, {
|
|
89
|
+
skipAnimation: skipAnimation,
|
|
87
90
|
slots: slots,
|
|
88
91
|
slotProps: slotProps,
|
|
89
92
|
sx: {
|
|
@@ -186,6 +189,12 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
186
189
|
* @default false
|
|
187
190
|
*/
|
|
188
191
|
showTooltip: PropTypes.bool,
|
|
192
|
+
/**
|
|
193
|
+
* If `true`, bar animations are skiped.
|
|
194
|
+
* @deprecated In v7 animations are skipped for sparkline.
|
|
195
|
+
* @default false
|
|
196
|
+
*/
|
|
197
|
+
skipAnimation: PropTypes.bool,
|
|
189
198
|
/**
|
|
190
199
|
* The props used for each component slot.
|
|
191
200
|
* @default {}
|
|
@@ -210,7 +219,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
210
219
|
* Formatter used by the tooltip.
|
|
211
220
|
* @param {number} value The value to format.
|
|
212
221
|
* @returns {string} the formatted value.
|
|
213
|
-
* @default (
|
|
222
|
+
* @default (value: number | null) => (value === null ? '' : value.toString())
|
|
214
223
|
*/
|
|
215
224
|
valueFormatter: PropTypes.func,
|
|
216
225
|
viewBox: PropTypes.shape({
|
|
@@ -229,7 +238,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
229
238
|
* Notice it is a single configuration object, not an array of configuration.
|
|
230
239
|
*/
|
|
231
240
|
xAxis: PropTypes.shape({
|
|
232
|
-
axisId: PropTypes.string,
|
|
241
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
233
242
|
classes: PropTypes.object,
|
|
234
243
|
data: PropTypes.array,
|
|
235
244
|
dataKey: PropTypes.string,
|
|
@@ -237,13 +246,14 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
237
246
|
disableTicks: PropTypes.bool,
|
|
238
247
|
fill: PropTypes.string,
|
|
239
248
|
hideTooltip: PropTypes.bool,
|
|
240
|
-
id: PropTypes.string,
|
|
249
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
241
250
|
label: PropTypes.string,
|
|
242
251
|
labelFontSize: PropTypes.number,
|
|
243
252
|
labelStyle: PropTypes.object,
|
|
244
253
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
245
254
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
246
255
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
256
|
+
reverse: PropTypes.bool,
|
|
247
257
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
248
258
|
slotProps: PropTypes.object,
|
|
249
259
|
slots: PropTypes.object,
|
|
@@ -129,7 +129,7 @@ function CartesianContextProvider(props) {
|
|
|
129
129
|
_getAxisExtremum2 = _slicedToArray(_getAxisExtremum, 2),
|
|
130
130
|
minData = _getAxisExtremum2[0],
|
|
131
131
|
maxData = _getAxisExtremum2[1];
|
|
132
|
-
var range = [drawingArea.left, drawingArea.left + drawingArea.width];
|
|
132
|
+
var range = axis.reverse ? [drawingArea.left + drawingArea.width, drawingArea.left] : [drawingArea.left, drawingArea.left + drawingArea.width];
|
|
133
133
|
if (isBandScaleConfig(axis)) {
|
|
134
134
|
var _axis$categoryGapRati, _axis$barGapRatio;
|
|
135
135
|
var categoryGapRatio = (_axis$categoryGapRati = axis.categoryGapRatio) != null ? _axis$categoryGapRati : DEFAULT_CATEGORY_GAP_RATIO;
|
|
@@ -186,7 +186,7 @@ function CartesianContextProvider(props) {
|
|
|
186
186
|
_getAxisExtremum4 = _slicedToArray(_getAxisExtremum3, 2),
|
|
187
187
|
minData = _getAxisExtremum4[0],
|
|
188
188
|
maxData = _getAxisExtremum4[1];
|
|
189
|
-
var range = [drawingArea.top + drawingArea.height, drawingArea.top];
|
|
189
|
+
var range = axis.reverse ? [drawingArea.top, drawingArea.top + drawingArea.height] : [drawingArea.top + drawingArea.height, drawingArea.top];
|
|
190
190
|
if (isBandScaleConfig(axis)) {
|
|
191
191
|
var _axis$categoryGapRati2;
|
|
192
192
|
var categoryGapRatio = (_axis$categoryGapRati2 = axis.categoryGapRatio) != null ? _axis$categoryGapRati2 : DEFAULT_CATEGORY_GAP_RATIO;
|
|
@@ -258,7 +258,7 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
258
258
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
259
259
|
*/
|
|
260
260
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
261
|
-
axisId: PropTypes.string,
|
|
261
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
262
262
|
classes: PropTypes.object,
|
|
263
263
|
data: PropTypes.array,
|
|
264
264
|
dataKey: PropTypes.string,
|
|
@@ -266,13 +266,14 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
266
266
|
disableTicks: PropTypes.bool,
|
|
267
267
|
fill: PropTypes.string,
|
|
268
268
|
hideTooltip: PropTypes.bool,
|
|
269
|
-
id: PropTypes.string,
|
|
269
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
270
270
|
label: PropTypes.string,
|
|
271
271
|
labelFontSize: PropTypes.number,
|
|
272
272
|
labelStyle: PropTypes.object,
|
|
273
273
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
274
274
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
275
275
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
276
|
+
reverse: PropTypes.bool,
|
|
276
277
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
277
278
|
slotProps: PropTypes.object,
|
|
278
279
|
slots: PropTypes.object,
|
|
@@ -292,7 +293,7 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
292
293
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
293
294
|
*/
|
|
294
295
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
295
|
-
axisId: PropTypes.string,
|
|
296
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
296
297
|
classes: PropTypes.object,
|
|
297
298
|
data: PropTypes.array,
|
|
298
299
|
dataKey: PropTypes.string,
|
|
@@ -300,13 +301,14 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
300
301
|
disableTicks: PropTypes.bool,
|
|
301
302
|
fill: PropTypes.string,
|
|
302
303
|
hideTooltip: PropTypes.bool,
|
|
303
|
-
id: PropTypes.string,
|
|
304
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
304
305
|
label: PropTypes.string,
|
|
305
306
|
labelFontSize: PropTypes.number,
|
|
306
307
|
labelStyle: PropTypes.object,
|
|
307
308
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
308
309
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
309
310
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
311
|
+
reverse: PropTypes.bool,
|
|
310
312
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
311
313
|
slotProps: PropTypes.object,
|
|
312
314
|
slots: PropTypes.object,
|
package/legacy/index.js
CHANGED
package/models/axis.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { ScaleBand, ScaleLogarithmic, ScalePower, ScaleTime, ScaleLinear, S
|
|
|
3
3
|
import { ChartsAxisClasses } from '../ChartsAxis/axisClasses';
|
|
4
4
|
import type { TickParams } from '../hooks/useTicks';
|
|
5
5
|
import { ChartsTextProps } from '../ChartsText';
|
|
6
|
+
export type AxisId = string | number;
|
|
6
7
|
export type D3Scale<Domain extends {
|
|
7
8
|
toString(): string;
|
|
8
9
|
} = number | Date | string, Range = number, Output = number> = ScaleBand<Domain> | ScaleLogarithmic<Range, Output> | ScalePoint<Domain> | ScalePower<Range, Output> | ScaleTime<Range, Output> | ScaleLinear<Range, Output>;
|
|
@@ -24,7 +25,7 @@ export interface ChartsAxisProps extends TickParams {
|
|
|
24
25
|
* The id of the axis to render.
|
|
25
26
|
* If undefined, it will be the first defined axis.
|
|
26
27
|
*/
|
|
27
|
-
axisId?:
|
|
28
|
+
axisId?: AxisId;
|
|
28
29
|
/**
|
|
29
30
|
* If true, the axis line is disabled.
|
|
30
31
|
* @default false
|
|
@@ -160,7 +161,7 @@ export type AxisConfig<S extends ScaleName = ScaleName, V = any> = {
|
|
|
160
161
|
/**
|
|
161
162
|
* Id used to identify the axis.
|
|
162
163
|
*/
|
|
163
|
-
id:
|
|
164
|
+
id: AxisId;
|
|
164
165
|
/**
|
|
165
166
|
* The minimal value of the domain.
|
|
166
167
|
* If not provided, it gets computed to display the entire chart data.
|
|
@@ -184,6 +185,10 @@ export type AxisConfig<S extends ScaleName = ScaleName, V = any> = {
|
|
|
184
185
|
* If `true`, hide this value in the tooltip
|
|
185
186
|
*/
|
|
186
187
|
hideTooltip?: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* If `true`, Reverse the axis scaleBand.
|
|
190
|
+
*/
|
|
191
|
+
reverse?: boolean;
|
|
187
192
|
} & Partial<ChartsXAxisProps | ChartsYAxisProps> & Partial<Omit<AxisScaleConfig[S], 'scale'>> & TickParams;
|
|
188
193
|
export type AxisDefaultized<S extends ScaleName = ScaleName, V = any> = Omit<AxisConfig<S, V>, 'scaleType'> & AxisScaleConfig[S] & {
|
|
189
194
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { HighlightScope } from '../../context/HighlightProvider';
|
|
2
2
|
import type { StackOffsetType, StackOrderType } from '../stacking';
|
|
3
|
+
export type SeriesId = number | string;
|
|
3
4
|
export type CommonSeriesType<TValue> = {
|
|
4
|
-
id?:
|
|
5
|
+
id?: SeriesId;
|
|
5
6
|
color?: string;
|
|
6
7
|
/**
|
|
7
8
|
* Formatter used to render values in tooltip or other data display.
|
|
@@ -5,6 +5,7 @@ import { PieSeriesType, DefaultizedPieSeriesType, PieItemIdentifier, PieValueTyp
|
|
|
5
5
|
import { AxisConfig } from '../axis';
|
|
6
6
|
import { DefaultizedProps, MakeOptional } from '../helpers';
|
|
7
7
|
import { StackingGroupsType } from '../../internals/stackSeries';
|
|
8
|
+
import { SeriesId } from './common';
|
|
8
9
|
interface ChartsSeriesConfig {
|
|
9
10
|
bar: {
|
|
10
11
|
seriesInput: DefaultizedProps<BarSeriesType, 'id'> & {
|
|
@@ -53,25 +54,19 @@ export type ChartSeriesDefaultized<T extends ChartSeriesType> = ChartsSeriesConf
|
|
|
53
54
|
} : ChartsSeriesConfig[T]['series'];
|
|
54
55
|
export type ChartItemIdentifier<T extends ChartSeriesType> = ChartsSeriesConfig[T]['itemIdentifier'];
|
|
55
56
|
type ExtremumGetterParams<T extends ChartSeriesType> = {
|
|
56
|
-
series:
|
|
57
|
-
[id: string]: ChartSeries<T>;
|
|
58
|
-
};
|
|
57
|
+
series: Record<SeriesId, ChartSeries<T>>;
|
|
59
58
|
axis: AxisConfig;
|
|
60
59
|
isDefaultAxis: boolean;
|
|
61
60
|
};
|
|
62
61
|
export type ExtremumGetterResult = [number, number] | [null, null];
|
|
63
62
|
export type ExtremumGetter<T extends ChartSeriesType> = (params: ExtremumGetterParams<T>) => ExtremumGetterResult;
|
|
64
63
|
export type FormatterParams<T extends ChartSeriesType> = {
|
|
65
|
-
series:
|
|
66
|
-
|
|
67
|
-
};
|
|
68
|
-
seriesOrder: string[];
|
|
64
|
+
series: Record<SeriesId, ChartsSeriesConfig[T]['seriesInput']>;
|
|
65
|
+
seriesOrder: SeriesId[];
|
|
69
66
|
};
|
|
70
67
|
export type FormatterResult<T extends ChartSeriesType> = {
|
|
71
|
-
series:
|
|
72
|
-
|
|
73
|
-
};
|
|
74
|
-
seriesOrder: string[];
|
|
68
|
+
series: Record<SeriesId, ChartSeriesDefaultized<T>>;
|
|
69
|
+
seriesOrder: SeriesId[];
|
|
75
70
|
} & (ChartsSeriesConfig[T] extends {
|
|
76
71
|
canBeStacked: true;
|
|
77
72
|
} ? {
|
|
@@ -95,7 +90,7 @@ export type LegendParams = {
|
|
|
95
90
|
* The identifier of the legend element.
|
|
96
91
|
* Used for internal purpose such as `key` props
|
|
97
92
|
*/
|
|
98
|
-
id:
|
|
93
|
+
id: SeriesId;
|
|
99
94
|
};
|
|
100
95
|
export type LegendGetter<T extends ChartSeriesType> = (series: FormatterResult<T>) => LegendParams[];
|
|
101
96
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DefaultizedProps } from '../helpers';
|
|
2
2
|
import type { StackOffsetType } from '../stacking';
|
|
3
|
-
import { CartesianSeriesType, CommonDefaultizedProps, CommonSeriesType, StackableSeriesType } from './common';
|
|
3
|
+
import { CartesianSeriesType, CommonDefaultizedProps, CommonSeriesType, SeriesId, StackableSeriesType } from './common';
|
|
4
4
|
export type CurveType = 'catmullRom' | 'linear' | 'monotoneX' | 'monotoneY' | 'natural' | 'step' | 'stepBefore' | 'stepAfter';
|
|
5
5
|
export interface ShowMarkParams<AxisValue = number | Date> {
|
|
6
6
|
/**
|
|
@@ -66,7 +66,7 @@ export interface LineSeriesType extends CommonSeriesType<number>, CartesianSerie
|
|
|
66
66
|
*/
|
|
67
67
|
export type LineItemIdentifier = {
|
|
68
68
|
type: 'line';
|
|
69
|
-
seriesId:
|
|
69
|
+
seriesId: SeriesId;
|
|
70
70
|
/**
|
|
71
71
|
* `dataIndex` can be `undefined` if the mouse is over the area and not a specific item.
|
|
72
72
|
*/
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { PieArcDatum as D3PieArcDatum } from 'd3-shape';
|
|
2
2
|
import { DefaultizedProps } from '../helpers';
|
|
3
|
-
import { CommonDefaultizedProps, CommonSeriesType } from './common';
|
|
3
|
+
import { CommonDefaultizedProps, CommonSeriesType, SeriesId } from './common';
|
|
4
|
+
export type PieItemId = string | number;
|
|
4
5
|
export type PieValueType = {
|
|
5
|
-
|
|
6
|
+
/**
|
|
7
|
+
* A unique identifier of the pie slice.
|
|
8
|
+
*/
|
|
9
|
+
id: PieItemId;
|
|
6
10
|
value: number;
|
|
7
11
|
label?: string;
|
|
8
12
|
color?: string;
|
|
@@ -119,7 +123,7 @@ export interface PieSeriesType<Tdata = PieValueType> extends CommonSeriesType<Td
|
|
|
119
123
|
*/
|
|
120
124
|
export type PieItemIdentifier = {
|
|
121
125
|
type: 'pie';
|
|
122
|
-
seriesId:
|
|
126
|
+
seriesId: SeriesId;
|
|
123
127
|
dataIndex: number;
|
|
124
128
|
};
|
|
125
129
|
export interface DefaultizedPieSeriesType extends DefaultizedProps<PieSeriesType, CommonDefaultizedProps> {
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { DefaultizedProps } from '../helpers';
|
|
2
|
-
import { CartesianSeriesType, CommonDefaultizedProps, CommonSeriesType } from './common';
|
|
2
|
+
import { CartesianSeriesType, CommonDefaultizedProps, CommonSeriesType, SeriesId } from './common';
|
|
3
3
|
export type ScatterValueType = {
|
|
4
4
|
x: number;
|
|
5
5
|
y: number;
|
|
6
|
+
/**
|
|
7
|
+
* A unique identifier for the scatter point
|
|
8
|
+
*/
|
|
6
9
|
id: string | number;
|
|
7
10
|
};
|
|
8
11
|
export interface ScatterSeriesType extends CommonSeriesType<ScatterValueType>, CartesianSeriesType {
|
|
@@ -17,7 +20,7 @@ export interface ScatterSeriesType extends CommonSeriesType<ScatterValueType>, C
|
|
|
17
20
|
*/
|
|
18
21
|
export type ScatterItemIdentifier = {
|
|
19
22
|
type: 'scatter';
|
|
20
|
-
seriesId:
|
|
23
|
+
seriesId: SeriesId;
|
|
21
24
|
dataIndex: number;
|
|
22
25
|
};
|
|
23
26
|
export interface DefaultizedScatterSeriesType extends DefaultizedProps<ScatterSeriesType, CommonDefaultizedProps | 'color'> {
|
|
@@ -128,7 +128,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
128
128
|
* @default xAxisIds[0] The id of the first provided axis
|
|
129
129
|
*/
|
|
130
130
|
bottomAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
131
|
-
axisId: PropTypes.string,
|
|
131
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
132
132
|
classes: PropTypes.object,
|
|
133
133
|
disableLine: PropTypes.bool,
|
|
134
134
|
disableTicks: PropTypes.bool,
|
|
@@ -179,7 +179,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
179
179
|
* @default yAxisIds[0] The id of the first provided axis
|
|
180
180
|
*/
|
|
181
181
|
leftAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
182
|
-
axisId: PropTypes.string,
|
|
182
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
183
183
|
classes: PropTypes.object,
|
|
184
184
|
disableLine: PropTypes.bool,
|
|
185
185
|
disableTicks: PropTypes.bool,
|
|
@@ -232,7 +232,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
232
232
|
* @default null
|
|
233
233
|
*/
|
|
234
234
|
rightAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
235
|
-
axisId: PropTypes.string,
|
|
235
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
236
236
|
classes: PropTypes.object,
|
|
237
237
|
disableLine: PropTypes.bool,
|
|
238
238
|
disableTicks: PropTypes.bool,
|
|
@@ -261,7 +261,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
261
261
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
262
262
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
263
263
|
}),
|
|
264
|
-
id: PropTypes.string,
|
|
264
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
265
265
|
label: PropTypes.string,
|
|
266
266
|
layout: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
267
267
|
stack: PropTypes.string,
|
|
@@ -303,7 +303,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
303
303
|
* @default null
|
|
304
304
|
*/
|
|
305
305
|
topAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
306
|
-
axisId: PropTypes.string,
|
|
306
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
307
307
|
classes: PropTypes.object,
|
|
308
308
|
disableLine: PropTypes.bool,
|
|
309
309
|
disableTicks: PropTypes.bool,
|
|
@@ -340,7 +340,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
340
340
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
341
341
|
*/
|
|
342
342
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
343
|
-
axisId: PropTypes.string,
|
|
343
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
344
344
|
classes: PropTypes.object,
|
|
345
345
|
data: PropTypes.array,
|
|
346
346
|
dataKey: PropTypes.string,
|
|
@@ -348,13 +348,14 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
348
348
|
disableTicks: PropTypes.bool,
|
|
349
349
|
fill: PropTypes.string,
|
|
350
350
|
hideTooltip: PropTypes.bool,
|
|
351
|
-
id: PropTypes.string,
|
|
351
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
352
352
|
label: PropTypes.string,
|
|
353
353
|
labelFontSize: PropTypes.number,
|
|
354
354
|
labelStyle: PropTypes.object,
|
|
355
355
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
356
356
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
357
357
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
358
|
+
reverse: PropTypes.bool,
|
|
358
359
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
359
360
|
slotProps: PropTypes.object,
|
|
360
361
|
slots: PropTypes.object,
|
|
@@ -374,7 +375,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
374
375
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
375
376
|
*/
|
|
376
377
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
377
|
-
axisId: PropTypes.string,
|
|
378
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
378
379
|
classes: PropTypes.object,
|
|
379
380
|
data: PropTypes.array,
|
|
380
381
|
dataKey: PropTypes.string,
|
|
@@ -382,13 +383,14 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
382
383
|
disableTicks: PropTypes.bool,
|
|
383
384
|
fill: PropTypes.string,
|
|
384
385
|
hideTooltip: PropTypes.bool,
|
|
385
|
-
id: PropTypes.string,
|
|
386
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
386
387
|
label: PropTypes.string,
|
|
387
388
|
labelFontSize: PropTypes.number,
|
|
388
389
|
labelStyle: PropTypes.object,
|
|
389
390
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
390
391
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
391
392
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
393
|
+
reverse: PropTypes.bool,
|
|
392
394
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
393
395
|
slotProps: PropTypes.object,
|
|
394
396
|
slots: PropTypes.object,
|
|
@@ -102,6 +102,7 @@ process.env.NODE_ENV !== "production" ? BarElement.propTypes = {
|
|
|
102
102
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
103
103
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
104
104
|
}),
|
|
105
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
105
106
|
/**
|
|
106
107
|
* The props used for each component slot.
|
|
107
108
|
* @default {}
|
|
@@ -9,7 +9,7 @@ import { CartesianContext } from '../context/CartesianContextProvider';
|
|
|
9
9
|
import { BarElement } from './BarElement';
|
|
10
10
|
import { isBandScaleConfig } from '../models/axis';
|
|
11
11
|
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '../constants';
|
|
12
|
-
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
/**
|
|
14
14
|
* Solution of the equations
|
|
15
15
|
* W = barWidth * N + offset * (N-1)
|
|
@@ -19,7 +19,6 @@ import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '../constants';
|
|
|
19
19
|
* @param gapRatio The ratio of the gap between bars over the bar width.
|
|
20
20
|
* @returns The bar width and the offset between bars.
|
|
21
21
|
*/
|
|
22
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
22
|
function getBandSize({
|
|
24
23
|
bandWidth: W,
|
|
25
24
|
numberOfGroups: N,
|
|
@@ -101,20 +100,19 @@ const useCompletedData = () => {
|
|
|
101
100
|
color
|
|
102
101
|
} = series[seriesId];
|
|
103
102
|
return stackedData.map((values, dataIndex) => {
|
|
104
|
-
const
|
|
105
|
-
const
|
|
103
|
+
const valueCoordinates = values.map(v => verticalLayout ? yScale(v) : xScale(v));
|
|
104
|
+
const minValueCoord = Math.min(...valueCoordinates);
|
|
105
|
+
const maxValueCoord = Math.max(...valueCoordinates);
|
|
106
106
|
return {
|
|
107
|
-
bottom,
|
|
108
|
-
top,
|
|
109
107
|
seriesId,
|
|
110
108
|
dataIndex,
|
|
111
109
|
layout: series[seriesId].layout,
|
|
112
|
-
x: verticalLayout ? xScale(xAxis[xAxisKey].data?.[dataIndex]) + barOffset :
|
|
113
|
-
y: verticalLayout ?
|
|
110
|
+
x: verticalLayout ? xScale(xAxis[xAxisKey].data?.[dataIndex]) + barOffset : minValueCoord,
|
|
111
|
+
y: verticalLayout ? minValueCoord : yScale(yAxis[yAxisKey].data?.[dataIndex]) + barOffset,
|
|
114
112
|
xOrigin: xScale(0),
|
|
115
113
|
yOrigin: yScale(0),
|
|
116
|
-
height: verticalLayout ?
|
|
117
|
-
width: verticalLayout ? barWidth :
|
|
114
|
+
height: verticalLayout ? maxValueCoord - minValueCoord : barWidth,
|
|
115
|
+
width: verticalLayout ? barWidth : maxValueCoord - minValueCoord,
|
|
118
116
|
color,
|
|
119
117
|
highlightScope: series[seriesId].highlightScope
|
|
120
118
|
};
|