@mui/x-charts 6.19.1 → 6.19.4
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 +12 -9
- package/BarChart/BarElement.d.ts +43 -23
- package/BarChart/BarElement.js +1 -0
- package/BarChart/BarPlot.js +9 -10
- package/CHANGELOG.md +140 -0
- package/ChartsAxis/ChartsAxis.js +4 -4
- package/ChartsLegend/ChartsLegend.d.ts +5 -2
- package/ChartsLegend/ChartsLegend.js +36 -1
- package/ChartsReferenceLine/ChartsReferenceLine.js +8 -4
- package/ChartsReferenceLine/common.d.ts +2 -1
- package/ChartsSurface.d.ts +2 -2
- package/ChartsSurface.js +33 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +6 -58
- package/ChartsTooltip/ChartsItemTooltipContent.js +18 -4
- package/ChartsTooltip/ChartsTooltipTable.d.ts +1 -1
- package/ChartsTooltip/ChartsTooltipTable.js +2 -0
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +4 -56
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +17 -3
- 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.d.ts +1 -0
- package/LineChart/LineChart.js +13 -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.d.ts +5 -0
- package/PieChart/PieArcLabelPlot.js +3 -1
- package/PieChart/PieArcPlot.d.ts +5 -0
- package/PieChart/PieArcPlot.js +2 -1
- package/PieChart/PieChart.d.ts +14 -2
- package/PieChart/PieChart.js +14 -11
- package/ScatterChart/Scatter.js +1 -1
- package/ScatterChart/ScatterChart.js +12 -9
- package/SparkLineChart/SparkLineChart.d.ts +15 -1
- package/SparkLineChart/SparkLineChart.js +11 -3
- package/context/CartesianContextProvider.d.ts +1 -1
- package/context/CartesianContextProvider.js +15 -12
- package/context/DrawingProvider.d.ts +1 -1
- package/context/DrawingProvider.js +8 -7
- package/context/HighlightProvider.d.ts +2 -2
- package/context/HighlightProvider.js +4 -3
- package/context/InteractionProvider.d.ts +4 -4
- package/context/InteractionProvider.js +4 -3
- package/context/SeriesContextProvider.d.ts +3 -1
- package/context/SeriesContextProvider.js +7 -6
- package/esm/BarChart/BarChart.js +12 -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 +38 -2
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +8 -4
- package/esm/ChartsSurface.js +35 -2
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +6 -58
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +18 -4
- package/esm/ChartsTooltip/ChartsTooltipTable.js +2 -0
- package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +4 -56
- package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +17 -3
- 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 +13 -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 +3 -1
- package/esm/PieChart/PieArcPlot.js +2 -1
- package/esm/PieChart/PieChart.js +14 -11
- package/esm/ScatterChart/Scatter.js +1 -1
- package/esm/ScatterChart/ScatterChart.js +12 -9
- package/esm/SparkLineChart/SparkLineChart.js +11 -3
- package/esm/context/CartesianContextProvider.js +15 -12
- package/esm/context/DrawingProvider.js +8 -7
- package/esm/context/HighlightProvider.js +6 -4
- package/esm/context/InteractionProvider.js +6 -4
- package/esm/context/SeriesContextProvider.js +9 -7
- package/esm/hooks/useDrawingArea.js +7 -3
- package/esm/index.js +2 -0
- package/hooks/useDrawingArea.d.ts +2 -0
- package/hooks/useDrawingArea.js +7 -3
- package/index.d.ts +2 -0
- package/index.js +23 -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 +12 -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 +38 -2
- package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +6 -4
- package/legacy/ChartsReferenceLine/common.js +3 -4
- package/legacy/ChartsSurface.js +35 -2
- package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +6 -58
- package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +18 -4
- package/legacy/ChartsTooltip/ChartsTooltipTable.js +8 -7
- package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +4 -56
- package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +17 -3
- 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 +13 -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 +3 -1
- package/legacy/PieChart/PieArcPlot.js +2 -1
- package/legacy/PieChart/PieChart.js +14 -11
- package/legacy/ScatterChart/Scatter.js +1 -1
- package/legacy/ScatterChart/ScatterChart.js +12 -9
- package/legacy/SparkLineChart/SparkLineChart.js +11 -3
- package/legacy/context/CartesianContextProvider.js +23 -21
- package/legacy/context/DrawingProvider.js +6 -6
- package/legacy/context/HighlightProvider.js +4 -3
- package/legacy/context/InteractionProvider.js +4 -3
- package/legacy/context/SeriesContextProvider.js +8 -7
- package/legacy/hooks/useDrawingArea.js +7 -3
- package/legacy/index.js +3 -1
- package/legacy/internals/components/AxisSharedComponents.js +5 -6
- 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 +8 -3
- package/models/seriesType/scatter.d.ts +5 -2
- package/modern/BarChart/BarChart.js +12 -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 +38 -2
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +8 -4
- package/modern/ChartsSurface.js +35 -2
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +6 -58
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +18 -4
- package/modern/ChartsTooltip/ChartsTooltipTable.js +2 -0
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +4 -56
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +17 -3
- 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 +13 -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 +3 -1
- package/modern/PieChart/PieArcPlot.js +2 -1
- package/modern/PieChart/PieChart.js +14 -11
- package/modern/ScatterChart/Scatter.js +1 -1
- package/modern/ScatterChart/ScatterChart.js +12 -9
- package/modern/SparkLineChart/SparkLineChart.js +11 -3
- package/modern/context/CartesianContextProvider.js +15 -12
- package/modern/context/DrawingProvider.js +8 -7
- package/modern/context/HighlightProvider.js +6 -4
- package/modern/context/InteractionProvider.js +6 -4
- package/modern/context/SeriesContextProvider.js +9 -7
- package/modern/hooks/useDrawingArea.js +7 -3
- package/modern/index.js +3 -1
- package/package.json +1 -1
|
@@ -40,11 +40,11 @@ export var CartesianContext = /*#__PURE__*/React.createContext({
|
|
|
40
40
|
*
|
|
41
41
|
* - [CartesianContextProvider API](https://mui.com/x/api/charts/cartesian-context-provider/)
|
|
42
42
|
*/
|
|
43
|
-
function CartesianContextProvider(
|
|
44
|
-
var inXAxis =
|
|
45
|
-
inYAxis =
|
|
46
|
-
dataset =
|
|
47
|
-
children =
|
|
43
|
+
function CartesianContextProvider(props) {
|
|
44
|
+
var inXAxis = props.xAxis,
|
|
45
|
+
inYAxis = props.yAxis,
|
|
46
|
+
dataset = props.dataset,
|
|
47
|
+
children = props.children;
|
|
48
48
|
var formattedSeries = React.useContext(SeriesContext);
|
|
49
49
|
var drawingArea = React.useContext(DrawingContext);
|
|
50
50
|
var xAxis = React.useMemo(function () {
|
|
@@ -82,9 +82,9 @@ function CartesianContextProvider(_ref) {
|
|
|
82
82
|
var value = React.useMemo(function () {
|
|
83
83
|
var _xAxis$map, _yAxis$map;
|
|
84
84
|
var axisExtremumCallback = function axisExtremumCallback(acc, chartType, axis, getters, isDefaultAxis) {
|
|
85
|
-
var
|
|
85
|
+
var _ref, _formattedSeries$char;
|
|
86
86
|
var getter = getters[chartType];
|
|
87
|
-
var series = (
|
|
87
|
+
var series = (_ref = (_formattedSeries$char = formattedSeries[chartType]) == null ? void 0 : _formattedSeries$char.series) != null ? _ref : {};
|
|
88
88
|
var _getter = getter({
|
|
89
89
|
series: series,
|
|
90
90
|
axis: axis,
|
|
@@ -114,8 +114,8 @@ function CartesianContextProvider(_ref) {
|
|
|
114
114
|
return _extends({
|
|
115
115
|
id: "deaultized-x-axis-".concat(index)
|
|
116
116
|
}, axis);
|
|
117
|
-
})) != null ? _xAxis$map : []), _toConsumableArray(xAxis === undefined || xAxis.findIndex(function (
|
|
118
|
-
var id =
|
|
117
|
+
})) != null ? _xAxis$map : []), _toConsumableArray(xAxis === undefined || xAxis.findIndex(function (_ref2) {
|
|
118
|
+
var id = _ref2.id;
|
|
119
119
|
return id === DEFAULT_X_AXIS_KEY;
|
|
120
120
|
}) === -1 ? [{
|
|
121
121
|
id: DEFAULT_X_AXIS_KEY,
|
|
@@ -129,7 +129,7 @@ function CartesianContextProvider(_ref) {
|
|
|
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;
|
|
@@ -171,8 +171,8 @@ function CartesianContextProvider(_ref) {
|
|
|
171
171
|
return _extends({
|
|
172
172
|
id: "deaultized-y-axis-".concat(index)
|
|
173
173
|
}, axis);
|
|
174
|
-
})) != null ? _yAxis$map : []), _toConsumableArray(yAxis === undefined || yAxis.findIndex(function (
|
|
175
|
-
var id =
|
|
174
|
+
})) != null ? _yAxis$map : []), _toConsumableArray(yAxis === undefined || yAxis.findIndex(function (_ref3) {
|
|
175
|
+
var id = _ref3.id;
|
|
176
176
|
return id === DEFAULT_Y_AXIS_KEY;
|
|
177
177
|
}) === -1 ? [{
|
|
178
178
|
id: DEFAULT_Y_AXIS_KEY,
|
|
@@ -186,7 +186,7 @@ function CartesianContextProvider(_ref) {
|
|
|
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;
|
|
@@ -226,12 +226,12 @@ function CartesianContextProvider(_ref) {
|
|
|
226
226
|
return {
|
|
227
227
|
xAxis: completedXAxis,
|
|
228
228
|
yAxis: completedYAxis,
|
|
229
|
-
xAxisIds: allXAxis.map(function (
|
|
230
|
-
var id =
|
|
229
|
+
xAxisIds: allXAxis.map(function (_ref4) {
|
|
230
|
+
var id = _ref4.id;
|
|
231
231
|
return id;
|
|
232
232
|
}),
|
|
233
|
-
yAxisIds: allYAxis.map(function (
|
|
234
|
-
var id =
|
|
233
|
+
yAxisIds: allYAxis.map(function (_ref5) {
|
|
234
|
+
var id = _ref5.id;
|
|
235
235
|
return id;
|
|
236
236
|
})
|
|
237
237
|
};
|
|
@@ -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,
|
|
@@ -23,12 +23,12 @@ export var SVGContext = /*#__PURE__*/React.createContext({
|
|
|
23
23
|
*
|
|
24
24
|
* - [DrawingProvider API](https://mui.com/x/api/charts/drawing-provider/)
|
|
25
25
|
*/
|
|
26
|
-
function DrawingProvider(
|
|
27
|
-
var width =
|
|
28
|
-
height =
|
|
29
|
-
margin =
|
|
30
|
-
svgRef =
|
|
31
|
-
children =
|
|
26
|
+
function DrawingProvider(props) {
|
|
27
|
+
var width = props.width,
|
|
28
|
+
height = props.height,
|
|
29
|
+
margin = props.margin,
|
|
30
|
+
svgRef = props.svgRef,
|
|
31
|
+
children = props.children;
|
|
32
32
|
var drawingArea = useChartDimensions(width, height, margin);
|
|
33
33
|
return /*#__PURE__*/_jsx(SVGContext.Provider, {
|
|
34
34
|
value: svgRef,
|
|
@@ -34,8 +34,8 @@ var dataReducer = function dataReducer(prevState, action) {
|
|
|
34
34
|
return prevState;
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
|
|
38
|
-
var children =
|
|
37
|
+
function HighlightProvider(props) {
|
|
38
|
+
var children = props.children;
|
|
39
39
|
var _React$useReducer = React.useReducer(dataReducer, {
|
|
40
40
|
item: null,
|
|
41
41
|
scope: defaultScope
|
|
@@ -52,4 +52,5 @@ export function HighlightProvider(_ref) {
|
|
|
52
52
|
value: value,
|
|
53
53
|
children: children
|
|
54
54
|
});
|
|
55
|
-
}
|
|
55
|
+
}
|
|
56
|
+
export { HighlightProvider };
|
|
@@ -36,8 +36,8 @@ var dataReducer = function dataReducer(prevState, action) {
|
|
|
36
36
|
return prevState;
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
|
|
40
|
-
var children =
|
|
39
|
+
function InteractionProvider(props) {
|
|
40
|
+
var children = props.children;
|
|
41
41
|
var _React$useReducer = React.useReducer(dataReducer, {
|
|
42
42
|
item: null,
|
|
43
43
|
axis: {
|
|
@@ -57,4 +57,5 @@ export function InteractionProvider(_ref) {
|
|
|
57
57
|
value: value,
|
|
58
58
|
children: children
|
|
59
59
|
});
|
|
60
|
-
}
|
|
60
|
+
}
|
|
61
|
+
export { InteractionProvider };
|
|
@@ -56,12 +56,12 @@ var formatSeries = function formatSeries(series, colors, dataset) {
|
|
|
56
56
|
});
|
|
57
57
|
return formattedSeries;
|
|
58
58
|
};
|
|
59
|
-
|
|
60
|
-
var series =
|
|
61
|
-
dataset =
|
|
62
|
-
|
|
63
|
-
colors =
|
|
64
|
-
children =
|
|
59
|
+
function SeriesContextProvider(props) {
|
|
60
|
+
var series = props.series,
|
|
61
|
+
dataset = props.dataset,
|
|
62
|
+
_props$colors = props.colors,
|
|
63
|
+
colors = _props$colors === void 0 ? blueberryTwilightPalette : _props$colors,
|
|
64
|
+
children = props.children;
|
|
65
65
|
var theme = useTheme();
|
|
66
66
|
var formattedSeries = React.useMemo(function () {
|
|
67
67
|
return formatSeries(series, typeof colors === 'function' ? colors(theme.palette.mode) : colors, dataset);
|
|
@@ -70,4 +70,5 @@ export function SeriesContextProvider(_ref) {
|
|
|
70
70
|
value: formattedSeries,
|
|
71
71
|
children: children
|
|
72
72
|
});
|
|
73
|
-
}
|
|
73
|
+
}
|
|
74
|
+
export { SeriesContextProvider };
|
|
@@ -5,13 +5,17 @@ export function useDrawingArea() {
|
|
|
5
5
|
left = _React$useContext.left,
|
|
6
6
|
top = _React$useContext.top,
|
|
7
7
|
width = _React$useContext.width,
|
|
8
|
-
height = _React$useContext.height
|
|
8
|
+
height = _React$useContext.height,
|
|
9
|
+
bottom = _React$useContext.bottom,
|
|
10
|
+
right = _React$useContext.right;
|
|
9
11
|
return React.useMemo(function () {
|
|
10
12
|
return {
|
|
11
13
|
left: left,
|
|
12
14
|
top: top,
|
|
13
15
|
width: width,
|
|
14
|
-
height: height
|
|
16
|
+
height: height,
|
|
17
|
+
bottom: bottom,
|
|
18
|
+
right: right
|
|
15
19
|
};
|
|
16
|
-
}, [height, left, top, width]);
|
|
20
|
+
}, [height, left, top, width, bottom, right]);
|
|
17
21
|
}
|
package/legacy/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts v6.19.
|
|
2
|
+
* @mui/x-charts v6.19.4
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -24,4 +24,6 @@ export * from './PieChart';
|
|
|
24
24
|
export * from './ScatterChart';
|
|
25
25
|
export * from './SparkLineChart';
|
|
26
26
|
export * from './ChartContainer';
|
|
27
|
+
export * from './ChartsSurface';
|
|
28
|
+
export * from './ChartsLegend';
|
|
27
29
|
export * from './ResponsiveChartContainer';
|
|
@@ -9,18 +9,17 @@ export var AxisRoot = styled('g', {
|
|
|
9
9
|
return styles.root;
|
|
10
10
|
}
|
|
11
11
|
})(function (_ref) {
|
|
12
|
-
var _ref2;
|
|
13
12
|
var theme = _ref.theme;
|
|
14
|
-
return
|
|
13
|
+
return _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "& .".concat(axisClasses.tickLabel), _extends({}, theme.typography.caption, {
|
|
15
14
|
fill: (theme.vars || theme).palette.text.primary
|
|
16
|
-
})),
|
|
15
|
+
})), "& .".concat(axisClasses.label), _extends({}, theme.typography.body1, {
|
|
17
16
|
fill: (theme.vars || theme).palette.text.primary
|
|
18
|
-
})),
|
|
17
|
+
})), "& .".concat(axisClasses.line), {
|
|
19
18
|
stroke: (theme.vars || theme).palette.text.primary,
|
|
20
19
|
shapeRendering: 'crispEdges',
|
|
21
20
|
strokeWidth: 1
|
|
22
|
-
}),
|
|
21
|
+
}), "& .".concat(axisClasses.tick), {
|
|
23
22
|
stroke: (theme.vars || theme).palette.text.primary,
|
|
24
23
|
shapeRendering: 'crispEdges'
|
|
25
|
-
})
|
|
24
|
+
});
|
|
26
25
|
});
|
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;
|
|
@@ -63,6 +67,7 @@ export interface PieSeriesType<Tdata = PieValueType> extends CommonSeriesType<Td
|
|
|
63
67
|
arcLabel?: 'formattedValue' | 'label' | 'value' | ((item: DefaultizedPieValueType) => string);
|
|
64
68
|
/**
|
|
65
69
|
* The minimal angle required to display the arc label.
|
|
70
|
+
* @default 0
|
|
66
71
|
*/
|
|
67
72
|
arcLabelMinAngle?: number;
|
|
68
73
|
/**
|
|
@@ -118,7 +123,7 @@ export interface PieSeriesType<Tdata = PieValueType> extends CommonSeriesType<Td
|
|
|
118
123
|
*/
|
|
119
124
|
export type PieItemIdentifier = {
|
|
120
125
|
type: 'pie';
|
|
121
|
-
seriesId:
|
|
126
|
+
seriesId: SeriesId;
|
|
122
127
|
dataIndex: number;
|
|
123
128
|
};
|
|
124
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,
|
|
@@ -153,6 +153,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
153
153
|
className: PropTypes.string,
|
|
154
154
|
/**
|
|
155
155
|
* Color palette used to colorize multiple series.
|
|
156
|
+
* @default blueberryTwilightPalette
|
|
156
157
|
*/
|
|
157
158
|
colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
|
|
158
159
|
/**
|
|
@@ -178,7 +179,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
178
179
|
* @default yAxisIds[0] The id of the first provided axis
|
|
179
180
|
*/
|
|
180
181
|
leftAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
181
|
-
axisId: PropTypes.string,
|
|
182
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
182
183
|
classes: PropTypes.object,
|
|
183
184
|
disableLine: PropTypes.bool,
|
|
184
185
|
disableTicks: PropTypes.bool,
|
|
@@ -231,7 +232,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
231
232
|
* @default null
|
|
232
233
|
*/
|
|
233
234
|
rightAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
234
|
-
axisId: PropTypes.string,
|
|
235
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
235
236
|
classes: PropTypes.object,
|
|
236
237
|
disableLine: PropTypes.bool,
|
|
237
238
|
disableTicks: PropTypes.bool,
|
|
@@ -260,7 +261,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
260
261
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
261
262
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
262
263
|
}),
|
|
263
|
-
id: PropTypes.string,
|
|
264
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
264
265
|
label: PropTypes.string,
|
|
265
266
|
layout: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
266
267
|
stack: PropTypes.string,
|
|
@@ -302,7 +303,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
302
303
|
* @default null
|
|
303
304
|
*/
|
|
304
305
|
topAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
305
|
-
axisId: PropTypes.string,
|
|
306
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
306
307
|
classes: PropTypes.object,
|
|
307
308
|
disableLine: PropTypes.bool,
|
|
308
309
|
disableTicks: PropTypes.bool,
|
|
@@ -339,7 +340,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
339
340
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
340
341
|
*/
|
|
341
342
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
342
|
-
axisId: PropTypes.string,
|
|
343
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
343
344
|
classes: PropTypes.object,
|
|
344
345
|
data: PropTypes.array,
|
|
345
346
|
dataKey: PropTypes.string,
|
|
@@ -347,13 +348,14 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
347
348
|
disableTicks: PropTypes.bool,
|
|
348
349
|
fill: PropTypes.string,
|
|
349
350
|
hideTooltip: PropTypes.bool,
|
|
350
|
-
id: PropTypes.string,
|
|
351
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
351
352
|
label: PropTypes.string,
|
|
352
353
|
labelFontSize: PropTypes.number,
|
|
353
354
|
labelStyle: PropTypes.object,
|
|
354
355
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
355
356
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
356
357
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
358
|
+
reverse: PropTypes.bool,
|
|
357
359
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
358
360
|
slotProps: PropTypes.object,
|
|
359
361
|
slots: PropTypes.object,
|
|
@@ -373,7 +375,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
373
375
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
374
376
|
*/
|
|
375
377
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
376
|
-
axisId: PropTypes.string,
|
|
378
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
377
379
|
classes: PropTypes.object,
|
|
378
380
|
data: PropTypes.array,
|
|
379
381
|
dataKey: PropTypes.string,
|
|
@@ -381,13 +383,14 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
381
383
|
disableTicks: PropTypes.bool,
|
|
382
384
|
fill: PropTypes.string,
|
|
383
385
|
hideTooltip: PropTypes.bool,
|
|
384
|
-
id: PropTypes.string,
|
|
386
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
385
387
|
label: PropTypes.string,
|
|
386
388
|
labelFontSize: PropTypes.number,
|
|
387
389
|
labelStyle: PropTypes.object,
|
|
388
390
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
389
391
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
390
392
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
393
|
+
reverse: PropTypes.bool,
|
|
391
394
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
392
395
|
slotProps: PropTypes.object,
|
|
393
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
|
};
|
|
@@ -100,7 +100,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
100
100
|
* @default xAxisIds[0] The id of the first provided axis
|
|
101
101
|
*/
|
|
102
102
|
bottomAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
103
|
-
axisId: PropTypes.string,
|
|
103
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
104
104
|
classes: PropTypes.object,
|
|
105
105
|
disableLine: PropTypes.bool,
|
|
106
106
|
disableTicks: PropTypes.bool,
|
|
@@ -127,7 +127,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
127
127
|
* @default yAxisIds[0] The id of the first provided axis
|
|
128
128
|
*/
|
|
129
129
|
leftAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
130
|
-
axisId: PropTypes.string,
|
|
130
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
131
131
|
classes: PropTypes.object,
|
|
132
132
|
disableLine: PropTypes.bool,
|
|
133
133
|
disableTicks: PropTypes.bool,
|
|
@@ -154,7 +154,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
154
154
|
* @default null
|
|
155
155
|
*/
|
|
156
156
|
rightAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
157
|
-
axisId: PropTypes.string,
|
|
157
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
158
158
|
classes: PropTypes.object,
|
|
159
159
|
disableLine: PropTypes.bool,
|
|
160
160
|
disableTicks: PropTypes.bool,
|
|
@@ -191,7 +191,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
191
191
|
* @default null
|
|
192
192
|
*/
|
|
193
193
|
topAxis: 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,
|