@mui/x-charts 7.0.0-beta.1 → 7.0.0-beta.3
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.d.ts +21 -5
- package/BarChart/BarChart.js +37 -13
- 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 +223 -1
- package/ChartContainer/ChartContainer.js +6 -4
- package/ChartsAxis/ChartsAxis.js +4 -4
- package/ChartsGrid/ChartsGrid.d.ts +30 -0
- package/ChartsGrid/ChartsGrid.js +128 -0
- package/ChartsGrid/chartsGridClasses.d.ts +13 -0
- package/ChartsGrid/chartsGridClasses.js +14 -0
- package/ChartsGrid/index.d.ts +2 -0
- package/ChartsGrid/index.js +27 -0
- package/ChartsGrid/package.json +6 -0
- 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/ChartsSurface.js +6 -4
- 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 +15 -11
- package/ChartsYAxis/ChartsYAxis.js +3 -3
- package/Gauge/Gauge.d.ts +13 -0
- package/Gauge/Gauge.js +156 -0
- package/Gauge/GaugeContainer.d.ts +19 -0
- package/Gauge/GaugeContainer.js +216 -0
- package/Gauge/GaugeProvider.d.ts +117 -0
- package/Gauge/GaugeProvider.js +96 -0
- package/Gauge/GaugeReferenceArc.d.ts +2 -0
- package/Gauge/GaugeReferenceArc.js +44 -0
- package/Gauge/GaugeValueArc.d.ts +2 -0
- package/Gauge/GaugeValueArc.js +51 -0
- package/Gauge/GaugeValueText.d.ts +15 -0
- package/Gauge/GaugeValueText.js +77 -0
- package/Gauge/gaugeClasses.d.ts +14 -0
- package/Gauge/gaugeClasses.js +15 -0
- package/Gauge/index.d.ts +7 -0
- package/Gauge/index.js +87 -0
- package/Gauge/package.json +6 -0
- package/Gauge/utils.d.ts +19 -0
- package/Gauge/utils.js +75 -0
- 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.d.ts +24 -5
- package/LineChart/LineChart.js +41 -13
- 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 +7 -6
- package/PieChart/PieArc.js +10 -9
- package/PieChart/PieArcLabel.d.ts +3 -2
- package/PieChart/PieArcLabel.js +1 -0
- package/PieChart/PieArcLabelPlot.js +14 -14
- package/PieChart/PieArcPlot.js +1 -1
- package/PieChart/PieChart.d.ts +22 -0
- package/PieChart/PieChart.js +32 -8
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +8 -70
- package/ResponsiveChartContainer/useChartContainerDimensions.d.ts +2 -0
- package/ResponsiveChartContainer/useChartContainerDimensions.js +76 -0
- package/ScatterChart/ScatterChart.d.ts +18 -0
- package/ScatterChart/ScatterChart.js +35 -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 +37 -13
- 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/ChartsGrid/ChartsGrid.js +121 -0
- package/esm/ChartsGrid/chartsGridClasses.js +6 -0
- package/esm/ChartsGrid/index.js +2 -0
- 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/ChartsSurface.js +6 -4
- 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 +14 -10
- package/esm/ChartsYAxis/ChartsYAxis.js +2 -2
- package/esm/Gauge/Gauge.js +149 -0
- package/esm/Gauge/GaugeContainer.js +211 -0
- package/esm/Gauge/GaugeProvider.js +85 -0
- package/esm/Gauge/GaugeReferenceArc.js +35 -0
- package/esm/Gauge/GaugeValueArc.js +42 -0
- package/esm/Gauge/GaugeValueText.js +69 -0
- package/esm/Gauge/gaugeClasses.js +7 -0
- package/esm/Gauge/index.js +7 -0
- package/esm/Gauge/utils.js +68 -0
- 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 +41 -13
- 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 +10 -9
- package/esm/PieChart/PieArcLabel.js +1 -0
- package/esm/PieChart/PieArcLabelPlot.js +14 -14
- package/esm/PieChart/PieArcPlot.js +1 -1
- package/esm/PieChart/PieChart.js +32 -8
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +8 -70
- package/esm/ResponsiveChartContainer/useChartContainerDimensions.js +66 -0
- package/esm/ScatterChart/ScatterChart.js +35 -8
- package/esm/SparkLineChart/SparkLineChart.js +5 -4
- package/esm/context/CartesianContextProvider.js +8 -6
- package/esm/hooks/useTicks.js +2 -3
- package/esm/index.js +2 -0
- package/hooks/useTicks.d.ts +1 -2
- package/hooks/useTicks.js +2 -3
- package/index.d.ts +2 -0
- package/index.js +23 -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 +37 -13
- 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/ChartsGrid/ChartsGrid.js +119 -0
- package/legacy/ChartsGrid/chartsGridClasses.js +6 -0
- package/legacy/ChartsGrid/index.js +2 -0
- 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/ChartsSurface.js +5 -3
- 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 +13 -9
- package/legacy/ChartsYAxis/ChartsYAxis.js +2 -2
- package/legacy/Gauge/Gauge.js +146 -0
- package/legacy/Gauge/GaugeContainer.js +215 -0
- package/legacy/Gauge/GaugeProvider.js +87 -0
- package/legacy/Gauge/GaugeReferenceArc.js +37 -0
- package/legacy/Gauge/GaugeValueArc.js +44 -0
- package/legacy/Gauge/GaugeValueText.js +66 -0
- package/legacy/Gauge/gaugeClasses.js +7 -0
- package/legacy/Gauge/index.js +7 -0
- package/legacy/Gauge/utils.js +84 -0
- 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 +41 -13
- 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 +11 -10
- package/legacy/PieChart/PieArcLabel.js +1 -0
- package/legacy/PieChart/PieArcLabelPlot.js +15 -15
- package/legacy/PieChart/PieArcPlot.js +1 -1
- package/legacy/PieChart/PieChart.js +32 -8
- package/legacy/ResponsiveChartContainer/ResponsiveChartContainer.js +13 -81
- package/legacy/ResponsiveChartContainer/useChartContainerDimensions.js +73 -0
- package/legacy/ScatterChart/ScatterChart.js +35 -8
- package/legacy/SparkLineChart/SparkLineChart.js +6 -5
- package/legacy/context/CartesianContextProvider.js +8 -6
- package/legacy/hooks/useTicks.js +2 -3
- package/legacy/index.js +3 -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 +37 -13
- 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/ChartsGrid/ChartsGrid.js +121 -0
- package/modern/ChartsGrid/chartsGridClasses.js +6 -0
- package/modern/ChartsGrid/index.js +2 -0
- 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/ChartsSurface.js +6 -4
- 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 +14 -10
- package/modern/ChartsYAxis/ChartsYAxis.js +2 -2
- package/modern/Gauge/Gauge.js +149 -0
- package/modern/Gauge/GaugeContainer.js +208 -0
- package/modern/Gauge/GaugeProvider.js +85 -0
- package/modern/Gauge/GaugeReferenceArc.js +35 -0
- package/modern/Gauge/GaugeValueArc.js +42 -0
- package/modern/Gauge/GaugeValueText.js +69 -0
- package/modern/Gauge/gaugeClasses.js +7 -0
- package/modern/Gauge/index.js +7 -0
- package/modern/Gauge/utils.js +68 -0
- 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 +41 -13
- 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 +10 -9
- package/modern/PieChart/PieArcLabel.js +1 -0
- package/modern/PieChart/PieArcLabelPlot.js +14 -14
- package/modern/PieChart/PieArcPlot.js +1 -1
- package/modern/PieChart/PieChart.js +32 -8
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +8 -70
- package/modern/ResponsiveChartContainer/useChartContainerDimensions.js +66 -0
- package/modern/ScatterChart/ScatterChart.js +35 -8
- package/modern/SparkLineChart/SparkLineChart.js +5 -4
- package/modern/context/CartesianContextProvider.js +8 -6
- package/modern/hooks/useTicks.js +2 -3
- package/modern/index.js +3 -1
- package/package.json +4 -4
|
@@ -15,6 +15,7 @@ var _ChartsTooltip = require("../ChartsTooltip");
|
|
|
15
15
|
var _ChartsLegend = require("../ChartsLegend");
|
|
16
16
|
var _ChartsAxisHighlight = require("../ChartsAxisHighlight");
|
|
17
17
|
var _ChartsVoronoiHandler = require("../ChartsVoronoiHandler/ChartsVoronoiHandler");
|
|
18
|
+
var _ChartsGrid = require("../ChartsGrid");
|
|
18
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
20
21
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -43,6 +44,7 @@ const ScatterChart = exports.ScatterChart = /*#__PURE__*/React.forwardRef(functi
|
|
|
43
44
|
margin,
|
|
44
45
|
colors,
|
|
45
46
|
sx,
|
|
47
|
+
grid,
|
|
46
48
|
topAxis,
|
|
47
49
|
leftAxis,
|
|
48
50
|
rightAxis,
|
|
@@ -74,6 +76,9 @@ const ScatterChart = exports.ScatterChart = /*#__PURE__*/React.forwardRef(functi
|
|
|
74
76
|
bottomAxis: bottomAxis,
|
|
75
77
|
slots: slots,
|
|
76
78
|
slotProps: slotProps
|
|
79
|
+
}), grid && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, {
|
|
80
|
+
vertical: grid.vertical,
|
|
81
|
+
horizontal: grid.horizontal
|
|
77
82
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScatterPlot.ScatterPlot, {
|
|
78
83
|
slots: slots,
|
|
79
84
|
slotProps: slotProps,
|
|
@@ -94,6 +99,11 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
94
99
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
95
100
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
96
101
|
// ----------------------------------------------------------------------
|
|
102
|
+
/**
|
|
103
|
+
* The configuration of axes highlight.
|
|
104
|
+
* @see See {@link https://mui.com/x/react-charts/tooltip/#highlights highlight docs} for more details.
|
|
105
|
+
* @default { x: 'none', y: 'none' }
|
|
106
|
+
*/
|
|
97
107
|
axisHighlight: _propTypes.default.shape({
|
|
98
108
|
x: _propTypes.default.oneOf(['band', 'line', 'none']),
|
|
99
109
|
y: _propTypes.default.oneOf(['band', 'line', 'none'])
|
|
@@ -104,7 +114,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
104
114
|
* @default xAxisIds[0] The id of the first provided axis
|
|
105
115
|
*/
|
|
106
116
|
bottomAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
107
|
-
axisId: _propTypes.default.string,
|
|
117
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
108
118
|
classes: _propTypes.default.object,
|
|
109
119
|
disableLine: _propTypes.default.bool,
|
|
110
120
|
disableTicks: _propTypes.default.bool,
|
|
@@ -148,6 +158,13 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
148
158
|
* @default false
|
|
149
159
|
*/
|
|
150
160
|
disableVoronoi: _propTypes.default.bool,
|
|
161
|
+
/**
|
|
162
|
+
* Option to display a cartesian grid in the background.
|
|
163
|
+
*/
|
|
164
|
+
grid: _propTypes.default.shape({
|
|
165
|
+
horizontal: _propTypes.default.bool,
|
|
166
|
+
vertical: _propTypes.default.bool
|
|
167
|
+
}),
|
|
151
168
|
/**
|
|
152
169
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
153
170
|
* @default undefined
|
|
@@ -159,7 +176,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
159
176
|
* @default yAxisIds[0] The id of the first provided axis
|
|
160
177
|
*/
|
|
161
178
|
leftAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
162
|
-
axisId: _propTypes.default.string,
|
|
179
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
163
180
|
classes: _propTypes.default.object,
|
|
164
181
|
disableLine: _propTypes.default.bool,
|
|
165
182
|
disableTicks: _propTypes.default.bool,
|
|
@@ -218,7 +235,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
218
235
|
* @default null
|
|
219
236
|
*/
|
|
220
237
|
rightAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
221
|
-
axisId: _propTypes.default.string,
|
|
238
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
222
239
|
classes: _propTypes.default.object,
|
|
223
240
|
disableLine: _propTypes.default.bool,
|
|
224
241
|
disableTicks: _propTypes.default.bool,
|
|
@@ -239,6 +256,9 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
239
256
|
tickNumber: _propTypes.default.number,
|
|
240
257
|
tickSize: _propTypes.default.number
|
|
241
258
|
}), _propTypes.default.string]),
|
|
259
|
+
/**
|
|
260
|
+
* The series to display in the scatter chart.
|
|
261
|
+
*/
|
|
242
262
|
series: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
|
243
263
|
/**
|
|
244
264
|
* The props used for each component slot.
|
|
@@ -252,6 +272,11 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
252
272
|
slots: _propTypes.default.object,
|
|
253
273
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
254
274
|
title: _propTypes.default.string,
|
|
275
|
+
/**
|
|
276
|
+
* The configuration of the tooltip.
|
|
277
|
+
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
278
|
+
* @default { trigger: 'item' }
|
|
279
|
+
*/
|
|
255
280
|
tooltip: _propTypes.default.shape({
|
|
256
281
|
axisContent: _propTypes.default.elementType,
|
|
257
282
|
classes: _propTypes.default.object,
|
|
@@ -266,7 +291,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
266
291
|
* @default null
|
|
267
292
|
*/
|
|
268
293
|
topAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
269
|
-
axisId: _propTypes.default.string,
|
|
294
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
270
295
|
classes: _propTypes.default.object,
|
|
271
296
|
disableLine: _propTypes.default.bool,
|
|
272
297
|
disableTicks: _propTypes.default.bool,
|
|
@@ -309,7 +334,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
309
334
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
310
335
|
*/
|
|
311
336
|
xAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
312
|
-
axisId: _propTypes.default.string,
|
|
337
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
313
338
|
classes: _propTypes.default.object,
|
|
314
339
|
data: _propTypes.default.array,
|
|
315
340
|
dataKey: _propTypes.default.string,
|
|
@@ -317,13 +342,14 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
317
342
|
disableTicks: _propTypes.default.bool,
|
|
318
343
|
fill: _propTypes.default.string,
|
|
319
344
|
hideTooltip: _propTypes.default.bool,
|
|
320
|
-
id: _propTypes.default.string,
|
|
345
|
+
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
321
346
|
label: _propTypes.default.string,
|
|
322
347
|
labelFontSize: _propTypes.default.number,
|
|
323
348
|
labelStyle: _propTypes.default.object,
|
|
324
349
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
325
350
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
326
351
|
position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
|
|
352
|
+
reverse: _propTypes.default.bool,
|
|
327
353
|
scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
328
354
|
slotProps: _propTypes.default.object,
|
|
329
355
|
slots: _propTypes.default.object,
|
|
@@ -343,7 +369,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
343
369
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
344
370
|
*/
|
|
345
371
|
yAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
346
|
-
axisId: _propTypes.default.string,
|
|
372
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
347
373
|
classes: _propTypes.default.object,
|
|
348
374
|
data: _propTypes.default.array,
|
|
349
375
|
dataKey: _propTypes.default.string,
|
|
@@ -351,13 +377,14 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
351
377
|
disableTicks: _propTypes.default.bool,
|
|
352
378
|
fill: _propTypes.default.string,
|
|
353
379
|
hideTooltip: _propTypes.default.bool,
|
|
354
|
-
id: _propTypes.default.string,
|
|
380
|
+
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
355
381
|
label: _propTypes.default.string,
|
|
356
382
|
labelFontSize: _propTypes.default.number,
|
|
357
383
|
labelStyle: _propTypes.default.object,
|
|
358
384
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
359
385
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
360
386
|
position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
|
|
387
|
+
reverse: _propTypes.default.bool,
|
|
361
388
|
scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
362
389
|
slotProps: _propTypes.default.object,
|
|
363
390
|
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
|
@@ -10,6 +10,7 @@ import { ChartsTooltip } from '../ChartsTooltip';
|
|
|
10
10
|
import { ChartsLegend } from '../ChartsLegend';
|
|
11
11
|
import { ChartsAxisHighlight } from '../ChartsAxisHighlight';
|
|
12
12
|
import { ChartsClipPath } from '../ChartsClipPath';
|
|
13
|
+
import { ChartsGrid } from '../ChartsGrid';
|
|
13
14
|
import { ChartsOnAxisClickHandler } from '../ChartsOnAxisClickHandler';
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -39,6 +40,7 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
|
|
|
39
40
|
tooltip,
|
|
40
41
|
axisHighlight,
|
|
41
42
|
legend,
|
|
43
|
+
grid,
|
|
42
44
|
topAxis,
|
|
43
45
|
leftAxis,
|
|
44
46
|
rightAxis,
|
|
@@ -89,6 +91,9 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
|
|
|
89
91
|
disableAxisListener: (tooltip == null ? void 0 : tooltip.trigger) !== 'axis' && (axisHighlight == null ? void 0 : axisHighlight.x) === 'none' && (axisHighlight == null ? void 0 : axisHighlight.y) === 'none' && !onAxisClick,
|
|
90
92
|
children: [onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, {
|
|
91
93
|
onAxisClick: onAxisClick
|
|
94
|
+
}), grid && /*#__PURE__*/_jsx(ChartsGrid, {
|
|
95
|
+
vertical: grid.vertical,
|
|
96
|
+
horizontal: grid.horizontal
|
|
92
97
|
}), /*#__PURE__*/_jsx("g", {
|
|
93
98
|
clipPath: `url(#${clipPathId})`,
|
|
94
99
|
children: /*#__PURE__*/_jsx(BarPlot, {
|
|
@@ -121,11 +126,10 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
121
126
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
122
127
|
// ----------------------------------------------------------------------
|
|
123
128
|
/**
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
* - 'band': display a band at the current mouse position. Only available with band scale.
|
|
129
|
+
* The configuration of axes highlight.
|
|
130
|
+
* Default is set to 'band' in the bar direction.
|
|
131
|
+
* Depends on `layout` prop.
|
|
132
|
+
* @see See {@link https://mui.com/x/react-charts/tooltip/#highlights highlight docs} for more details.
|
|
129
133
|
*/
|
|
130
134
|
axisHighlight: PropTypes.shape({
|
|
131
135
|
x: PropTypes.oneOf(['band', 'line', 'none']),
|
|
@@ -137,7 +141,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
137
141
|
* @default xAxisIds[0] The id of the first provided axis
|
|
138
142
|
*/
|
|
139
143
|
bottomAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
140
|
-
axisId: PropTypes.string,
|
|
144
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
141
145
|
classes: PropTypes.object,
|
|
142
146
|
disableLine: PropTypes.bool,
|
|
143
147
|
disableTicks: PropTypes.bool,
|
|
@@ -176,11 +180,22 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
176
180
|
* @default false
|
|
177
181
|
*/
|
|
178
182
|
disableAxisListener: PropTypes.bool,
|
|
183
|
+
/**
|
|
184
|
+
* Option to display a cartesian grid in the background.
|
|
185
|
+
*/
|
|
186
|
+
grid: PropTypes.shape({
|
|
187
|
+
horizontal: PropTypes.bool,
|
|
188
|
+
vertical: PropTypes.bool
|
|
189
|
+
}),
|
|
179
190
|
/**
|
|
180
191
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
181
192
|
* @default undefined
|
|
182
193
|
*/
|
|
183
194
|
height: PropTypes.number,
|
|
195
|
+
/**
|
|
196
|
+
* The direction of the bar elements.
|
|
197
|
+
* @default 'vertical'
|
|
198
|
+
*/
|
|
184
199
|
layout: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
185
200
|
/**
|
|
186
201
|
* Indicate which axis to display the left of the charts.
|
|
@@ -188,7 +203,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
188
203
|
* @default yAxisIds[0] The id of the first provided axis
|
|
189
204
|
*/
|
|
190
205
|
leftAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
191
|
-
axisId: PropTypes.string,
|
|
206
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
192
207
|
classes: PropTypes.object,
|
|
193
208
|
disableLine: PropTypes.bool,
|
|
194
209
|
disableTicks: PropTypes.bool,
|
|
@@ -254,7 +269,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
254
269
|
* @default null
|
|
255
270
|
*/
|
|
256
271
|
rightAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
257
|
-
axisId: PropTypes.string,
|
|
272
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
258
273
|
classes: PropTypes.object,
|
|
259
274
|
disableLine: PropTypes.bool,
|
|
260
275
|
disableTicks: PropTypes.bool,
|
|
@@ -275,6 +290,9 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
275
290
|
tickNumber: PropTypes.number,
|
|
276
291
|
tickSize: PropTypes.number
|
|
277
292
|
}), PropTypes.string]),
|
|
293
|
+
/**
|
|
294
|
+
* The series to display in the bar chart.
|
|
295
|
+
*/
|
|
278
296
|
series: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
279
297
|
/**
|
|
280
298
|
* If `true`, animations are skipped.
|
|
@@ -293,6 +311,10 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
293
311
|
slots: PropTypes.object,
|
|
294
312
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
295
313
|
title: PropTypes.string,
|
|
314
|
+
/**
|
|
315
|
+
* The configuration of the tooltip.
|
|
316
|
+
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
317
|
+
*/
|
|
296
318
|
tooltip: PropTypes.shape({
|
|
297
319
|
axisContent: PropTypes.elementType,
|
|
298
320
|
classes: PropTypes.object,
|
|
@@ -307,7 +329,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
307
329
|
* @default null
|
|
308
330
|
*/
|
|
309
331
|
topAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
310
|
-
axisId: PropTypes.string,
|
|
332
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
311
333
|
classes: PropTypes.object,
|
|
312
334
|
disableLine: PropTypes.bool,
|
|
313
335
|
disableTicks: PropTypes.bool,
|
|
@@ -344,7 +366,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
344
366
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
345
367
|
*/
|
|
346
368
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
347
|
-
axisId: PropTypes.string,
|
|
369
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
348
370
|
classes: PropTypes.object,
|
|
349
371
|
data: PropTypes.array,
|
|
350
372
|
dataKey: PropTypes.string,
|
|
@@ -352,13 +374,14 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
352
374
|
disableTicks: PropTypes.bool,
|
|
353
375
|
fill: PropTypes.string,
|
|
354
376
|
hideTooltip: PropTypes.bool,
|
|
355
|
-
id: PropTypes.string,
|
|
377
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
356
378
|
label: PropTypes.string,
|
|
357
379
|
labelFontSize: PropTypes.number,
|
|
358
380
|
labelStyle: PropTypes.object,
|
|
359
381
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
360
382
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
361
383
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
384
|
+
reverse: PropTypes.bool,
|
|
362
385
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
363
386
|
slotProps: PropTypes.object,
|
|
364
387
|
slots: PropTypes.object,
|
|
@@ -378,7 +401,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
378
401
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
379
402
|
*/
|
|
380
403
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
381
|
-
axisId: PropTypes.string,
|
|
404
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
382
405
|
classes: PropTypes.object,
|
|
383
406
|
data: PropTypes.array,
|
|
384
407
|
dataKey: PropTypes.string,
|
|
@@ -386,13 +409,14 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
386
409
|
disableTicks: PropTypes.bool,
|
|
387
410
|
fill: PropTypes.string,
|
|
388
411
|
hideTooltip: PropTypes.bool,
|
|
389
|
-
id: PropTypes.string,
|
|
412
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
390
413
|
label: PropTypes.string,
|
|
391
414
|
labelFontSize: PropTypes.number,
|
|
392
415
|
labelStyle: PropTypes.object,
|
|
393
416
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
394
417
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
395
418
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
419
|
+
reverse: PropTypes.bool,
|
|
396
420
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
397
421
|
slotProps: PropTypes.object,
|
|
398
422
|
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,
|