@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
|
@@ -184,7 +184,7 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
184
184
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
185
185
|
*/
|
|
186
186
|
xAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
187
|
-
axisId: _propTypes.default.string,
|
|
187
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
188
188
|
classes: _propTypes.default.object,
|
|
189
189
|
data: _propTypes.default.array,
|
|
190
190
|
dataKey: _propTypes.default.string,
|
|
@@ -192,13 +192,14 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
192
192
|
disableTicks: _propTypes.default.bool,
|
|
193
193
|
fill: _propTypes.default.string,
|
|
194
194
|
hideTooltip: _propTypes.default.bool,
|
|
195
|
-
id: _propTypes.default.string,
|
|
195
|
+
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
196
196
|
label: _propTypes.default.string,
|
|
197
197
|
labelFontSize: _propTypes.default.number,
|
|
198
198
|
labelStyle: _propTypes.default.object,
|
|
199
199
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
200
200
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
201
201
|
position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
|
|
202
|
+
reverse: _propTypes.default.bool,
|
|
202
203
|
scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
203
204
|
slotProps: _propTypes.default.object,
|
|
204
205
|
slots: _propTypes.default.object,
|
|
@@ -218,7 +219,7 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
218
219
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
219
220
|
*/
|
|
220
221
|
yAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
221
|
-
axisId: _propTypes.default.string,
|
|
222
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
222
223
|
classes: _propTypes.default.object,
|
|
223
224
|
data: _propTypes.default.array,
|
|
224
225
|
dataKey: _propTypes.default.string,
|
|
@@ -226,13 +227,14 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
226
227
|
disableTicks: _propTypes.default.bool,
|
|
227
228
|
fill: _propTypes.default.string,
|
|
228
229
|
hideTooltip: _propTypes.default.bool,
|
|
229
|
-
id: _propTypes.default.string,
|
|
230
|
+
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
230
231
|
label: _propTypes.default.string,
|
|
231
232
|
labelFontSize: _propTypes.default.number,
|
|
232
233
|
labelStyle: _propTypes.default.object,
|
|
233
234
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
234
235
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
235
236
|
position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
|
|
237
|
+
reverse: _propTypes.default.bool,
|
|
236
238
|
scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
237
239
|
slotProps: _propTypes.default.object,
|
|
238
240
|
slots: _propTypes.default.object,
|
|
@@ -104,7 +104,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
104
104
|
* @default xAxisIds[0] The id of the first provided axis
|
|
105
105
|
*/
|
|
106
106
|
bottomAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
107
|
-
axisId: _propTypes.default.string,
|
|
107
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
108
108
|
classes: _propTypes.default.object,
|
|
109
109
|
disableLine: _propTypes.default.bool,
|
|
110
110
|
disableTicks: _propTypes.default.bool,
|
|
@@ -159,7 +159,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
159
159
|
* @default yAxisIds[0] The id of the first provided axis
|
|
160
160
|
*/
|
|
161
161
|
leftAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
162
|
-
axisId: _propTypes.default.string,
|
|
162
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
163
163
|
classes: _propTypes.default.object,
|
|
164
164
|
disableLine: _propTypes.default.bool,
|
|
165
165
|
disableTicks: _propTypes.default.bool,
|
|
@@ -218,7 +218,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
218
218
|
* @default null
|
|
219
219
|
*/
|
|
220
220
|
rightAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
221
|
-
axisId: _propTypes.default.string,
|
|
221
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
222
222
|
classes: _propTypes.default.object,
|
|
223
223
|
disableLine: _propTypes.default.bool,
|
|
224
224
|
disableTicks: _propTypes.default.bool,
|
|
@@ -266,7 +266,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
266
266
|
* @default null
|
|
267
267
|
*/
|
|
268
268
|
topAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
269
|
-
axisId: _propTypes.default.string,
|
|
269
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
270
270
|
classes: _propTypes.default.object,
|
|
271
271
|
disableLine: _propTypes.default.bool,
|
|
272
272
|
disableTicks: _propTypes.default.bool,
|
|
@@ -309,7 +309,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
309
309
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
310
310
|
*/
|
|
311
311
|
xAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
312
|
-
axisId: _propTypes.default.string,
|
|
312
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
313
313
|
classes: _propTypes.default.object,
|
|
314
314
|
data: _propTypes.default.array,
|
|
315
315
|
dataKey: _propTypes.default.string,
|
|
@@ -317,13 +317,14 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
317
317
|
disableTicks: _propTypes.default.bool,
|
|
318
318
|
fill: _propTypes.default.string,
|
|
319
319
|
hideTooltip: _propTypes.default.bool,
|
|
320
|
-
id: _propTypes.default.string,
|
|
320
|
+
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
321
321
|
label: _propTypes.default.string,
|
|
322
322
|
labelFontSize: _propTypes.default.number,
|
|
323
323
|
labelStyle: _propTypes.default.object,
|
|
324
324
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
325
325
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
326
326
|
position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
|
|
327
|
+
reverse: _propTypes.default.bool,
|
|
327
328
|
scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
328
329
|
slotProps: _propTypes.default.object,
|
|
329
330
|
slots: _propTypes.default.object,
|
|
@@ -343,7 +344,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
343
344
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
344
345
|
*/
|
|
345
346
|
yAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
346
|
-
axisId: _propTypes.default.string,
|
|
347
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
347
348
|
classes: _propTypes.default.object,
|
|
348
349
|
data: _propTypes.default.array,
|
|
349
350
|
dataKey: _propTypes.default.string,
|
|
@@ -351,13 +352,14 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
351
352
|
disableTicks: _propTypes.default.bool,
|
|
352
353
|
fill: _propTypes.default.string,
|
|
353
354
|
hideTooltip: _propTypes.default.bool,
|
|
354
|
-
id: _propTypes.default.string,
|
|
355
|
+
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
355
356
|
label: _propTypes.default.string,
|
|
356
357
|
labelFontSize: _propTypes.default.number,
|
|
357
358
|
labelStyle: _propTypes.default.object,
|
|
358
359
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
359
360
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
360
361
|
position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
|
|
362
|
+
reverse: _propTypes.default.bool,
|
|
361
363
|
scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
362
364
|
slotProps: _propTypes.default.object,
|
|
363
365
|
slots: _propTypes.default.object,
|
|
@@ -36,7 +36,7 @@ export interface SparkLineChartProps extends Omit<ResponsiveChartContainerProps,
|
|
|
36
36
|
* Formatter used by the tooltip.
|
|
37
37
|
* @param {number} value The value to format.
|
|
38
38
|
* @returns {string} the formatted value.
|
|
39
|
-
* @default (
|
|
39
|
+
* @default (value: number | null) => (value === null ? '' : value.toString())
|
|
40
40
|
*/
|
|
41
41
|
valueFormatter?: (value: number | null) => string;
|
|
42
42
|
/**
|
|
@@ -50,7 +50,7 @@ const SparkLineChart = exports.SparkLineChart = /*#__PURE__*/React.forwardRef(fu
|
|
|
50
50
|
slotProps,
|
|
51
51
|
data,
|
|
52
52
|
plotType = 'line',
|
|
53
|
-
valueFormatter =
|
|
53
|
+
valueFormatter = value => value === null ? '' : value.toString(),
|
|
54
54
|
area,
|
|
55
55
|
curve = 'linear'
|
|
56
56
|
} = props;
|
|
@@ -215,7 +215,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
215
215
|
* Formatter used by the tooltip.
|
|
216
216
|
* @param {number} value The value to format.
|
|
217
217
|
* @returns {string} the formatted value.
|
|
218
|
-
* @default (
|
|
218
|
+
* @default (value: number | null) => (value === null ? '' : value.toString())
|
|
219
219
|
*/
|
|
220
220
|
valueFormatter: _propTypes.default.func,
|
|
221
221
|
viewBox: _propTypes.default.shape({
|
|
@@ -234,7 +234,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
234
234
|
* Notice it is a single configuration object, not an array of configuration.
|
|
235
235
|
*/
|
|
236
236
|
xAxis: _propTypes.default.shape({
|
|
237
|
-
axisId: _propTypes.default.string,
|
|
237
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
238
238
|
classes: _propTypes.default.object,
|
|
239
239
|
data: _propTypes.default.array,
|
|
240
240
|
dataKey: _propTypes.default.string,
|
|
@@ -242,13 +242,14 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
242
242
|
disableTicks: _propTypes.default.bool,
|
|
243
243
|
fill: _propTypes.default.string,
|
|
244
244
|
hideTooltip: _propTypes.default.bool,
|
|
245
|
-
id: _propTypes.default.string,
|
|
245
|
+
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
246
246
|
label: _propTypes.default.string,
|
|
247
247
|
labelFontSize: _propTypes.default.number,
|
|
248
248
|
labelStyle: _propTypes.default.object,
|
|
249
249
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
250
250
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
251
251
|
position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
|
|
252
|
+
reverse: _propTypes.default.bool,
|
|
252
253
|
scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
253
254
|
slotProps: _propTypes.default.object,
|
|
254
255
|
slots: _propTypes.default.object,
|
|
@@ -117,7 +117,7 @@ function CartesianContextProvider(props) {
|
|
|
117
117
|
allXAxis.forEach((axis, axisIndex) => {
|
|
118
118
|
const isDefaultAxis = axisIndex === 0;
|
|
119
119
|
const [minData, maxData] = getAxisExtremum(axis, xExtremumGetters, isDefaultAxis);
|
|
120
|
-
const range = [drawingArea.left, drawingArea.left + drawingArea.width];
|
|
120
|
+
const range = axis.reverse ? [drawingArea.left + drawingArea.width, drawingArea.left] : [drawingArea.left, drawingArea.left + drawingArea.width];
|
|
121
121
|
if ((0, _axis.isBandScaleConfig)(axis)) {
|
|
122
122
|
const categoryGapRatio = axis.categoryGapRatio ?? DEFAULT_CATEGORY_GAP_RATIO;
|
|
123
123
|
const barGapRatio = axis.barGapRatio ?? DEFAULT_BAR_GAP_RATIO;
|
|
@@ -166,7 +166,7 @@ function CartesianContextProvider(props) {
|
|
|
166
166
|
allYAxis.forEach((axis, axisIndex) => {
|
|
167
167
|
const isDefaultAxis = axisIndex === 0;
|
|
168
168
|
const [minData, maxData] = getAxisExtremum(axis, yExtremumGetters, isDefaultAxis);
|
|
169
|
-
const range = [drawingArea.top + drawingArea.height, drawingArea.top];
|
|
169
|
+
const range = axis.reverse ? [drawingArea.top, drawingArea.top + drawingArea.height] : [drawingArea.top + drawingArea.height, drawingArea.top];
|
|
170
170
|
if ((0, _axis.isBandScaleConfig)(axis)) {
|
|
171
171
|
const categoryGapRatio = axis.categoryGapRatio ?? DEFAULT_CATEGORY_GAP_RATIO;
|
|
172
172
|
completedYAxis[axis.id] = (0, _extends2.default)({
|
|
@@ -235,7 +235,7 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
235
235
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
236
236
|
*/
|
|
237
237
|
xAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
238
|
-
axisId: _propTypes.default.string,
|
|
238
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
239
239
|
classes: _propTypes.default.object,
|
|
240
240
|
data: _propTypes.default.array,
|
|
241
241
|
dataKey: _propTypes.default.string,
|
|
@@ -243,13 +243,14 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
243
243
|
disableTicks: _propTypes.default.bool,
|
|
244
244
|
fill: _propTypes.default.string,
|
|
245
245
|
hideTooltip: _propTypes.default.bool,
|
|
246
|
-
id: _propTypes.default.string,
|
|
246
|
+
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
247
247
|
label: _propTypes.default.string,
|
|
248
248
|
labelFontSize: _propTypes.default.number,
|
|
249
249
|
labelStyle: _propTypes.default.object,
|
|
250
250
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
251
251
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
252
252
|
position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
|
|
253
|
+
reverse: _propTypes.default.bool,
|
|
253
254
|
scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
254
255
|
slotProps: _propTypes.default.object,
|
|
255
256
|
slots: _propTypes.default.object,
|
|
@@ -269,7 +270,7 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
269
270
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
270
271
|
*/
|
|
271
272
|
yAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
272
|
-
axisId: _propTypes.default.string,
|
|
273
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
273
274
|
classes: _propTypes.default.object,
|
|
274
275
|
data: _propTypes.default.array,
|
|
275
276
|
dataKey: _propTypes.default.string,
|
|
@@ -277,13 +278,14 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
277
278
|
disableTicks: _propTypes.default.bool,
|
|
278
279
|
fill: _propTypes.default.string,
|
|
279
280
|
hideTooltip: _propTypes.default.bool,
|
|
280
|
-
id: _propTypes.default.string,
|
|
281
|
+
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
281
282
|
label: _propTypes.default.string,
|
|
282
283
|
labelFontSize: _propTypes.default.number,
|
|
283
284
|
labelStyle: _propTypes.default.object,
|
|
284
285
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
285
286
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
286
287
|
position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
|
|
288
|
+
reverse: _propTypes.default.bool,
|
|
287
289
|
scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
288
290
|
slotProps: _propTypes.default.object,
|
|
289
291
|
slots: _propTypes.default.object,
|
package/esm/BarChart/BarChart.js
CHANGED
|
@@ -137,7 +137,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
137
137
|
* @default xAxisIds[0] The id of the first provided axis
|
|
138
138
|
*/
|
|
139
139
|
bottomAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
140
|
-
axisId: PropTypes.string,
|
|
140
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
141
141
|
classes: PropTypes.object,
|
|
142
142
|
disableLine: PropTypes.bool,
|
|
143
143
|
disableTicks: PropTypes.bool,
|
|
@@ -188,7 +188,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
188
188
|
* @default yAxisIds[0] The id of the first provided axis
|
|
189
189
|
*/
|
|
190
190
|
leftAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
191
|
-
axisId: PropTypes.string,
|
|
191
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
192
192
|
classes: PropTypes.object,
|
|
193
193
|
disableLine: PropTypes.bool,
|
|
194
194
|
disableTicks: PropTypes.bool,
|
|
@@ -254,7 +254,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
254
254
|
* @default null
|
|
255
255
|
*/
|
|
256
256
|
rightAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
257
|
-
axisId: PropTypes.string,
|
|
257
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
258
258
|
classes: PropTypes.object,
|
|
259
259
|
disableLine: PropTypes.bool,
|
|
260
260
|
disableTicks: PropTypes.bool,
|
|
@@ -307,7 +307,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
307
307
|
* @default null
|
|
308
308
|
*/
|
|
309
309
|
topAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
310
|
-
axisId: PropTypes.string,
|
|
310
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
311
311
|
classes: PropTypes.object,
|
|
312
312
|
disableLine: PropTypes.bool,
|
|
313
313
|
disableTicks: PropTypes.bool,
|
|
@@ -344,7 +344,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
344
344
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
345
345
|
*/
|
|
346
346
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
347
|
-
axisId: PropTypes.string,
|
|
347
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
348
348
|
classes: PropTypes.object,
|
|
349
349
|
data: PropTypes.array,
|
|
350
350
|
dataKey: PropTypes.string,
|
|
@@ -352,13 +352,14 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
352
352
|
disableTicks: PropTypes.bool,
|
|
353
353
|
fill: PropTypes.string,
|
|
354
354
|
hideTooltip: PropTypes.bool,
|
|
355
|
-
id: PropTypes.string,
|
|
355
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
356
356
|
label: PropTypes.string,
|
|
357
357
|
labelFontSize: PropTypes.number,
|
|
358
358
|
labelStyle: PropTypes.object,
|
|
359
359
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
360
360
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
361
361
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
362
|
+
reverse: PropTypes.bool,
|
|
362
363
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
363
364
|
slotProps: PropTypes.object,
|
|
364
365
|
slots: PropTypes.object,
|
|
@@ -378,7 +379,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
378
379
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
379
380
|
*/
|
|
380
381
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
381
|
-
axisId: PropTypes.string,
|
|
382
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
382
383
|
classes: PropTypes.object,
|
|
383
384
|
data: PropTypes.array,
|
|
384
385
|
dataKey: PropTypes.string,
|
|
@@ -386,13 +387,14 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
386
387
|
disableTicks: PropTypes.bool,
|
|
387
388
|
fill: PropTypes.string,
|
|
388
389
|
hideTooltip: PropTypes.bool,
|
|
389
|
-
id: PropTypes.string,
|
|
390
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
390
391
|
label: PropTypes.string,
|
|
391
392
|
labelFontSize: PropTypes.number,
|
|
392
393
|
labelStyle: PropTypes.object,
|
|
393
394
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
394
395
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
395
396
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
397
|
+
reverse: PropTypes.bool,
|
|
396
398
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
397
399
|
slotProps: PropTypes.object,
|
|
398
400
|
slots: PropTypes.object,
|
|
@@ -106,6 +106,7 @@ process.env.NODE_ENV !== "production" ? BarElement.propTypes = {
|
|
|
106
106
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
107
107
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
108
108
|
}),
|
|
109
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
109
110
|
/**
|
|
110
111
|
* The props used for each component slot.
|
|
111
112
|
* @default {}
|
package/esm/BarChart/BarPlot.js
CHANGED
|
@@ -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,
|
|
@@ -104,20 +103,19 @@ const useAggregatedData = () => {
|
|
|
104
103
|
} = series[seriesId];
|
|
105
104
|
return stackedData.map((values, dataIndex) => {
|
|
106
105
|
var _xAxis$xAxisKey$data, _yAxis$yAxisKey$data;
|
|
107
|
-
const
|
|
108
|
-
const
|
|
106
|
+
const valueCoordinates = values.map(v => verticalLayout ? yScale(v) : xScale(v));
|
|
107
|
+
const minValueCoord = Math.min(...valueCoordinates);
|
|
108
|
+
const maxValueCoord = Math.max(...valueCoordinates);
|
|
109
109
|
return {
|
|
110
|
-
bottom,
|
|
111
|
-
top,
|
|
112
110
|
seriesId,
|
|
113
111
|
dataIndex,
|
|
114
112
|
layout: series[seriesId].layout,
|
|
115
|
-
x: verticalLayout ? xScale((_xAxis$xAxisKey$data = xAxis[xAxisKey].data) == null ? void 0 : _xAxis$xAxisKey$data[dataIndex]) + barOffset :
|
|
116
|
-
y: verticalLayout ?
|
|
113
|
+
x: verticalLayout ? xScale((_xAxis$xAxisKey$data = xAxis[xAxisKey].data) == null ? void 0 : _xAxis$xAxisKey$data[dataIndex]) + barOffset : minValueCoord,
|
|
114
|
+
y: verticalLayout ? minValueCoord : yScale((_yAxis$yAxisKey$data = yAxis[yAxisKey].data) == null ? void 0 : _yAxis$yAxisKey$data[dataIndex]) + barOffset,
|
|
117
115
|
xOrigin: xScale(0),
|
|
118
116
|
yOrigin: yScale(0),
|
|
119
|
-
height: verticalLayout ?
|
|
120
|
-
width: verticalLayout ? barWidth :
|
|
117
|
+
height: verticalLayout ? maxValueCoord - minValueCoord : barWidth,
|
|
118
|
+
width: verticalLayout ? barWidth : maxValueCoord - minValueCoord,
|
|
121
119
|
color,
|
|
122
120
|
highlightScope: series[seriesId].highlightScope
|
|
123
121
|
};
|
|
@@ -122,7 +122,7 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
122
122
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
123
123
|
*/
|
|
124
124
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
125
|
-
axisId: PropTypes.string,
|
|
125
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
126
126
|
classes: PropTypes.object,
|
|
127
127
|
data: PropTypes.array,
|
|
128
128
|
dataKey: PropTypes.string,
|
|
@@ -130,13 +130,14 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
130
130
|
disableTicks: PropTypes.bool,
|
|
131
131
|
fill: PropTypes.string,
|
|
132
132
|
hideTooltip: PropTypes.bool,
|
|
133
|
-
id: PropTypes.string,
|
|
133
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
134
134
|
label: PropTypes.string,
|
|
135
135
|
labelFontSize: PropTypes.number,
|
|
136
136
|
labelStyle: PropTypes.object,
|
|
137
137
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
138
138
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
139
139
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
140
|
+
reverse: PropTypes.bool,
|
|
140
141
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
141
142
|
slotProps: PropTypes.object,
|
|
142
143
|
slots: PropTypes.object,
|
|
@@ -156,7 +157,7 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
156
157
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
157
158
|
*/
|
|
158
159
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
159
|
-
axisId: PropTypes.string,
|
|
160
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
160
161
|
classes: PropTypes.object,
|
|
161
162
|
data: PropTypes.array,
|
|
162
163
|
dataKey: PropTypes.string,
|
|
@@ -164,13 +165,14 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
164
165
|
disableTicks: PropTypes.bool,
|
|
165
166
|
fill: PropTypes.string,
|
|
166
167
|
hideTooltip: PropTypes.bool,
|
|
167
|
-
id: PropTypes.string,
|
|
168
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
168
169
|
label: PropTypes.string,
|
|
169
170
|
labelFontSize: PropTypes.number,
|
|
170
171
|
labelStyle: PropTypes.object,
|
|
171
172
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
172
173
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
173
174
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
175
|
+
reverse: PropTypes.bool,
|
|
174
176
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
175
177
|
slotProps: PropTypes.object,
|
|
176
178
|
slots: PropTypes.object,
|
|
@@ -101,7 +101,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
101
101
|
* @default xAxisIds[0] The id of the first provided axis
|
|
102
102
|
*/
|
|
103
103
|
bottomAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
104
|
-
axisId: PropTypes.string,
|
|
104
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
105
105
|
classes: PropTypes.object,
|
|
106
106
|
disableLine: PropTypes.bool,
|
|
107
107
|
disableTicks: PropTypes.bool,
|
|
@@ -128,7 +128,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
128
128
|
* @default yAxisIds[0] The id of the first provided axis
|
|
129
129
|
*/
|
|
130
130
|
leftAxis: 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,
|
|
@@ -155,7 +155,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
155
155
|
* @default null
|
|
156
156
|
*/
|
|
157
157
|
rightAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
158
|
-
axisId: PropTypes.string,
|
|
158
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
159
159
|
classes: PropTypes.object,
|
|
160
160
|
disableLine: PropTypes.bool,
|
|
161
161
|
disableTicks: PropTypes.bool,
|
|
@@ -192,7 +192,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
192
192
|
* @default null
|
|
193
193
|
*/
|
|
194
194
|
topAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
195
|
-
axisId: PropTypes.string,
|
|
195
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
196
196
|
classes: PropTypes.object,
|
|
197
197
|
disableLine: PropTypes.bool,
|
|
198
198
|
disableTicks: PropTypes.bool,
|