@mui/x-charts 7.5.0 → 7.6.0
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 +30 -3
- package/BarChart/BarElement.d.ts +0 -3
- package/BarChart/BarElement.js +8 -19
- package/BarChart/BarLabel/BarLabel.d.ts +1342 -0
- package/BarChart/BarLabel/BarLabel.js +60 -0
- package/BarChart/BarLabel/BarLabel.types.d.ts +39 -0
- package/BarChart/BarLabel/BarLabel.types.js +5 -0
- package/BarChart/BarLabel/BarLabelItem.d.ts +53 -0
- package/BarChart/BarLabel/BarLabelItem.js +127 -0
- package/BarChart/BarLabel/BarLabelPlot.d.ts +16 -0
- package/BarChart/BarLabel/BarLabelPlot.js +106 -0
- package/BarChart/BarLabel/barLabelClasses.d.ts +13 -0
- package/BarChart/BarLabel/barLabelClasses.js +29 -0
- package/BarChart/BarLabel/getBarLabel.d.ts +10 -0
- package/BarChart/BarLabel/getBarLabel.js +31 -0
- package/BarChart/BarLabel/index.d.ts +6 -0
- package/BarChart/BarLabel/index.js +25 -0
- package/BarChart/BarPlot.d.ts +15 -4
- package/BarChart/BarPlot.js +22 -34
- package/BarChart/checkScaleErrors.d.ts +11 -0
- package/BarChart/checkScaleErrors.js +33 -0
- package/BarChart/index.d.ts +1 -0
- package/BarChart/index.js +11 -0
- package/BarChart/types.d.ts +0 -2
- package/CHANGELOG.md +148 -5418
- package/ChartContainer/ChartContainer.d.ts +3 -2
- package/ChartContainer/ChartContainer.js +20 -3
- package/ChartsAxis/ChartsAxis.js +1 -1
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/ChartsClipPath/ChartsClipPath.js +1 -1
- package/ChartsGrid/ChartsGrid.js +1 -1
- package/ChartsLegend/ChartsLegend.js +1 -1
- package/ChartsLegend/DefaultChartsLegend.js +1 -1
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
- package/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
- package/ChartsSurface.js +1 -1
- package/ChartsText/ChartsText.js +1 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
- package/ChartsTooltip/ChartsItemTooltipContent.js +1 -1
- package/ChartsTooltip/ChartsTooltip.js +1 -1
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +1 -1
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +14 -2
- package/ChartsXAxis/ChartsXAxis.js +1 -1
- package/ChartsYAxis/ChartsYAxis.js +1 -1
- package/Gauge/Gauge.js +1 -1
- package/Gauge/GaugeContainer.js +1 -1
- package/Gauge/GaugeValueText.js +1 -1
- package/LineChart/AnimatedArea.js +1 -1
- package/LineChart/AnimatedLine.js +1 -1
- package/LineChart/AreaElement.d.ts +0 -2
- package/LineChart/AreaElement.js +8 -18
- package/LineChart/AreaPlot.js +1 -3
- package/LineChart/LineChart.js +19 -2
- package/LineChart/LineElement.d.ts +0 -2
- package/LineChart/LineElement.js +8 -18
- package/LineChart/LineHighlightElement.js +1 -1
- package/LineChart/LineHighlightPlot.js +1 -1
- package/LineChart/LinePlot.js +1 -3
- package/LineChart/MarkElement.d.ts +0 -2
- package/LineChart/MarkElement.js +11 -33
- package/LineChart/MarkPlot.js +1 -2
- package/PieChart/PieArc.d.ts +4 -1
- package/PieChart/PieArc.js +8 -4
- package/PieChart/PieArcLabel.js +1 -1
- package/PieChart/PieArcLabelPlot.d.ts +1 -1
- package/PieChart/PieArcLabelPlot.js +2 -8
- package/PieChart/PieArcPlot.d.ts +1 -1
- package/PieChart/PieArcPlot.js +6 -8
- package/PieChart/PieChart.js +19 -2
- package/PieChart/PiePlot.js +3 -7
- package/PieChart/dataTransform/useTransformData.d.ts +1 -1
- package/PieChart/dataTransform/useTransformData.js +10 -25
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +14 -1
- package/ScatterChart/Scatter.js +15 -11
- package/ScatterChart/ScatterChart.js +19 -2
- package/ScatterChart/ScatterPlot.js +1 -1
- package/SparkLineChart/SparkLineChart.d.ts +1 -1
- package/SparkLineChart/SparkLineChart.js +14 -1
- package/context/HighlightedProvider/HighlightedContext.d.ts +65 -0
- package/context/HighlightedProvider/HighlightedContext.js +36 -0
- package/context/HighlightedProvider/HighlightedProvider.d.ts +20 -0
- package/context/HighlightedProvider/HighlightedProvider.js +97 -0
- package/context/HighlightedProvider/createIsFaded.d.ts +2 -0
- package/context/HighlightedProvider/createIsFaded.js +19 -0
- package/context/HighlightedProvider/createIsHighlighted.d.ts +2 -0
- package/context/HighlightedProvider/createIsHighlighted.js +19 -0
- package/context/HighlightedProvider/index.d.ts +4 -0
- package/context/HighlightedProvider/index.js +49 -0
- package/context/HighlightedProvider/useHighlighted.d.ts +9 -0
- package/context/HighlightedProvider/useHighlighted.js +24 -0
- package/context/HighlightedProvider/useItemHighlighted.d.ts +21 -0
- package/context/HighlightedProvider/useItemHighlighted.js +37 -0
- package/context/ZAxisContextProvider.js +1 -1
- package/context/index.d.ts +1 -1
- package/context/index.js +15 -0
- package/esm/BarChart/BarChart.js +30 -3
- package/esm/BarChart/BarElement.js +9 -20
- package/esm/BarChart/BarLabel/BarLabel.js +51 -0
- package/esm/BarChart/BarLabel/BarLabel.types.js +1 -0
- package/esm/BarChart/BarLabel/BarLabelItem.js +119 -0
- package/esm/BarChart/BarLabel/BarLabelPlot.js +98 -0
- package/esm/BarChart/BarLabel/barLabelClasses.js +19 -0
- package/esm/BarChart/BarLabel/getBarLabel.js +24 -0
- package/esm/BarChart/BarLabel/index.js +2 -0
- package/esm/BarChart/BarPlot.js +22 -34
- package/esm/BarChart/checkScaleErrors.js +27 -0
- package/esm/BarChart/index.js +2 -1
- package/esm/ChartContainer/ChartContainer.js +20 -3
- package/esm/ChartsAxis/ChartsAxis.js +1 -1
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/esm/ChartsClipPath/ChartsClipPath.js +1 -1
- package/esm/ChartsGrid/ChartsGrid.js +1 -1
- package/esm/ChartsLegend/ChartsLegend.js +1 -1
- package/esm/ChartsLegend/DefaultChartsLegend.js +1 -1
- package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
- package/esm/ChartsSurface.js +1 -1
- package/esm/ChartsText/ChartsText.js +1 -1
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +1 -1
- package/esm/ChartsTooltip/ChartsTooltip.js +1 -1
- package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +1 -1
- package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +14 -2
- package/esm/ChartsXAxis/ChartsXAxis.js +1 -1
- package/esm/ChartsYAxis/ChartsYAxis.js +1 -1
- package/esm/Gauge/Gauge.js +1 -1
- package/esm/Gauge/GaugeContainer.js +1 -1
- package/esm/Gauge/GaugeValueText.js +1 -1
- package/esm/LineChart/AnimatedArea.js +1 -1
- package/esm/LineChart/AnimatedLine.js +1 -1
- package/esm/LineChart/AreaElement.js +9 -19
- package/esm/LineChart/AreaPlot.js +1 -3
- package/esm/LineChart/LineChart.js +19 -2
- package/esm/LineChart/LineElement.js +9 -19
- package/esm/LineChart/LineHighlightElement.js +1 -1
- package/esm/LineChart/LineHighlightPlot.js +1 -1
- package/esm/LineChart/LinePlot.js +1 -3
- package/esm/LineChart/MarkElement.js +12 -34
- package/esm/LineChart/MarkPlot.js +1 -2
- package/esm/PieChart/PieArc.js +8 -4
- package/esm/PieChart/PieArcLabel.js +1 -1
- package/esm/PieChart/PieArcLabelPlot.js +2 -8
- package/esm/PieChart/PieArcPlot.js +6 -8
- package/esm/PieChart/PieChart.js +19 -2
- package/esm/PieChart/PiePlot.js +3 -7
- package/esm/PieChart/dataTransform/useTransformData.js +10 -25
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +14 -1
- package/esm/ScatterChart/Scatter.js +16 -12
- package/esm/ScatterChart/ScatterChart.js +19 -2
- package/esm/ScatterChart/ScatterPlot.js +1 -1
- package/esm/SparkLineChart/SparkLineChart.js +14 -1
- package/esm/context/HighlightedProvider/HighlightedContext.js +29 -0
- package/esm/context/HighlightedProvider/HighlightedProvider.js +89 -0
- package/esm/context/HighlightedProvider/createIsFaded.js +12 -0
- package/esm/context/HighlightedProvider/createIsHighlighted.js +12 -0
- package/esm/context/HighlightedProvider/index.js +4 -0
- package/esm/context/HighlightedProvider/useHighlighted.js +17 -0
- package/esm/context/HighlightedProvider/useItemHighlighted.js +29 -0
- package/esm/context/ZAxisContextProvider.js +1 -1
- package/esm/context/index.js +1 -0
- package/esm/hooks/useInteractionItemProps.js +9 -41
- package/hooks/useInteractionItemProps.d.ts +1 -4
- package/hooks/useInteractionItemProps.js +11 -45
- package/index.js +1 -1
- package/internals/colorScale.d.ts +1 -1
- package/internals/defaultizeColor.d.ts +13 -13
- package/models/seriesType/common.d.ts +4 -1
- package/modern/BarChart/BarChart.js +30 -3
- package/modern/BarChart/BarElement.js +9 -20
- package/modern/BarChart/BarLabel/BarLabel.js +51 -0
- package/modern/BarChart/BarLabel/BarLabel.types.js +1 -0
- package/modern/BarChart/BarLabel/BarLabelItem.js +119 -0
- package/modern/BarChart/BarLabel/BarLabelPlot.js +98 -0
- package/modern/BarChart/BarLabel/barLabelClasses.js +19 -0
- package/modern/BarChart/BarLabel/getBarLabel.js +24 -0
- package/modern/BarChart/BarLabel/index.js +2 -0
- package/modern/BarChart/BarPlot.js +22 -34
- package/modern/BarChart/checkScaleErrors.js +27 -0
- package/modern/BarChart/index.js +2 -1
- package/modern/ChartContainer/ChartContainer.js +20 -3
- package/modern/ChartsAxis/ChartsAxis.js +1 -1
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/modern/ChartsClipPath/ChartsClipPath.js +1 -1
- package/modern/ChartsGrid/ChartsGrid.js +1 -1
- package/modern/ChartsLegend/ChartsLegend.js +1 -1
- package/modern/ChartsLegend/DefaultChartsLegend.js +1 -1
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
- package/modern/ChartsSurface.js +1 -1
- package/modern/ChartsText/ChartsText.js +1 -1
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +1 -1
- package/modern/ChartsTooltip/ChartsTooltip.js +1 -1
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +1 -1
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +14 -2
- package/modern/ChartsXAxis/ChartsXAxis.js +1 -1
- package/modern/ChartsYAxis/ChartsYAxis.js +1 -1
- package/modern/Gauge/Gauge.js +1 -1
- package/modern/Gauge/GaugeContainer.js +1 -1
- package/modern/Gauge/GaugeValueText.js +1 -1
- package/modern/LineChart/AnimatedArea.js +1 -1
- package/modern/LineChart/AnimatedLine.js +1 -1
- package/modern/LineChart/AreaElement.js +9 -19
- package/modern/LineChart/AreaPlot.js +1 -3
- package/modern/LineChart/LineChart.js +19 -2
- package/modern/LineChart/LineElement.js +9 -19
- package/modern/LineChart/LineHighlightElement.js +1 -1
- package/modern/LineChart/LineHighlightPlot.js +1 -1
- package/modern/LineChart/LinePlot.js +1 -3
- package/modern/LineChart/MarkElement.js +12 -34
- package/modern/LineChart/MarkPlot.js +1 -2
- package/modern/PieChart/PieArc.js +8 -4
- package/modern/PieChart/PieArcLabel.js +1 -1
- package/modern/PieChart/PieArcLabelPlot.js +2 -8
- package/modern/PieChart/PieArcPlot.js +6 -8
- package/modern/PieChart/PieChart.js +19 -2
- package/modern/PieChart/PiePlot.js +3 -7
- package/modern/PieChart/dataTransform/useTransformData.js +10 -25
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +14 -1
- package/modern/ScatterChart/Scatter.js +16 -12
- package/modern/ScatterChart/ScatterChart.js +19 -2
- package/modern/ScatterChart/ScatterPlot.js +1 -1
- package/modern/SparkLineChart/SparkLineChart.js +14 -1
- package/modern/context/HighlightedProvider/HighlightedContext.js +29 -0
- package/modern/context/HighlightedProvider/HighlightedProvider.js +89 -0
- package/modern/context/HighlightedProvider/createIsFaded.js +12 -0
- package/modern/context/HighlightedProvider/createIsHighlighted.js +12 -0
- package/modern/context/HighlightedProvider/index.js +4 -0
- package/modern/context/HighlightedProvider/useHighlighted.js +17 -0
- package/modern/context/HighlightedProvider/useItemHighlighted.js +29 -0
- package/modern/context/ZAxisContextProvider.js +1 -1
- package/modern/context/index.js +1 -0
- package/modern/hooks/useInteractionItemProps.js +9 -41
- package/modern/index.js +1 -1
- package/package.json +3 -3
- package/themeAugmentation/components.d.ts +4 -0
- package/themeAugmentation/overrides.d.ts +3 -0
- package/themeAugmentation/props.d.ts +2 -0
- package/context/HighlightProvider.d.ts +0 -45
- package/context/HighlightProvider.js +0 -60
- package/esm/context/HighlightProvider.js +0 -51
- package/modern/context/HighlightProvider.js +0 -51
package/BarChart/BarPlot.js
CHANGED
|
@@ -13,13 +13,13 @@ var _web = require("@react-spring/web");
|
|
|
13
13
|
var _SeriesContextProvider = require("../context/SeriesContextProvider");
|
|
14
14
|
var _CartesianContextProvider = require("../context/CartesianContextProvider");
|
|
15
15
|
var _BarElement = require("./BarElement");
|
|
16
|
-
var _axis = require("../models/axis");
|
|
17
|
-
var _constants = require("../constants");
|
|
18
16
|
var _getColor = _interopRequireDefault(require("./getColor"));
|
|
19
17
|
var _hooks = require("../hooks");
|
|
20
18
|
var _BarClipPath = require("./BarClipPath");
|
|
19
|
+
var _BarLabelPlot = require("./BarLabel/BarLabelPlot");
|
|
20
|
+
var _checkScaleErrors = require("./checkScaleErrors");
|
|
21
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
-
const _excluded = ["skipAnimation", "onItemClick", "borderRadius"];
|
|
22
|
+
const _excluded = ["skipAnimation", "onItemClick", "borderRadius", "barLabel"];
|
|
23
23
|
/**
|
|
24
24
|
* Solution of the equations
|
|
25
25
|
* W = barWidth * N + offset * (N-1)
|
|
@@ -79,30 +79,8 @@ const useAggregatedData = () => {
|
|
|
79
79
|
const xAxisConfig = xAxis[xAxisKey];
|
|
80
80
|
const yAxisConfig = yAxis[yAxisKey];
|
|
81
81
|
const verticalLayout = series[seriesId].layout === 'vertical';
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (!(0, _axis.isBandScaleConfig)(xAxisConfig)) {
|
|
85
|
-
throw new Error(`MUI X Charts: ${xAxisKey === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should be of type "band" to display the bar series of id "${seriesId}".`);
|
|
86
|
-
}
|
|
87
|
-
if (xAxis[xAxisKey].data === undefined) {
|
|
88
|
-
throw new Error(`MUI X Charts: ${xAxisKey === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should have data property.`);
|
|
89
|
-
}
|
|
90
|
-
baseScaleConfig = xAxisConfig;
|
|
91
|
-
if ((0, _axis.isBandScaleConfig)(yAxisConfig) || (0, _axis.isPointScaleConfig)(yAxisConfig)) {
|
|
92
|
-
throw new Error(`MUI X Charts: ${yAxisKey === _constants.DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : `The y-axis with id "${yAxisKey}"`} should be a continuous type to display the bar series of id "${seriesId}".`);
|
|
93
|
-
}
|
|
94
|
-
} else {
|
|
95
|
-
if (!(0, _axis.isBandScaleConfig)(yAxisConfig)) {
|
|
96
|
-
throw new Error(`MUI X Charts: ${yAxisKey === _constants.DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : `The y-axis with id "${yAxisKey}"`} should be of type "band" to display the bar series of id "${seriesId}".`);
|
|
97
|
-
}
|
|
98
|
-
if (yAxis[yAxisKey].data === undefined) {
|
|
99
|
-
throw new Error(`MUI X Charts: ${yAxisKey === _constants.DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : `The y-axis with id "${yAxisKey}"`} should have data property.`);
|
|
100
|
-
}
|
|
101
|
-
baseScaleConfig = yAxisConfig;
|
|
102
|
-
if ((0, _axis.isBandScaleConfig)(xAxisConfig) || (0, _axis.isPointScaleConfig)(xAxisConfig)) {
|
|
103
|
-
throw new Error(`MUI X Charts: ${xAxisKey === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should be a continuous type to display the bar series of id "${seriesId}".`);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
82
|
+
(0, _checkScaleErrors.checkScaleErrors)(verticalLayout, seriesId, xAxisKey, xAxis, yAxisKey, yAxis);
|
|
83
|
+
const baseScaleConfig = verticalLayout ? xAxisConfig : yAxisConfig;
|
|
106
84
|
const xScale = xAxisConfig.scale;
|
|
107
85
|
const yScale = yAxisConfig.scale;
|
|
108
86
|
const colorGetter = (0, _getColor.default)(series[seriesId], xAxis[xAxisKey], yAxis[yAxisKey]);
|
|
@@ -135,7 +113,6 @@ const useAggregatedData = () => {
|
|
|
135
113
|
height: verticalLayout ? maxValueCoord - minValueCoord : barWidth,
|
|
136
114
|
width: verticalLayout ? barWidth : maxValueCoord - minValueCoord,
|
|
137
115
|
color: colorGetter(dataIndex),
|
|
138
|
-
highlightScope: series[seriesId].highlightScope,
|
|
139
116
|
value: series[seriesId].data[dataIndex],
|
|
140
117
|
maskId: `${chartId}_${stackId || seriesId}_${groupIndex}_${dataIndex}`
|
|
141
118
|
};
|
|
@@ -219,7 +196,8 @@ function BarPlot(props) {
|
|
|
219
196
|
const {
|
|
220
197
|
skipAnimation,
|
|
221
198
|
onItemClick,
|
|
222
|
-
borderRadius
|
|
199
|
+
borderRadius,
|
|
200
|
+
barLabel
|
|
223
201
|
} = props,
|
|
224
202
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
225
203
|
const transition = (0, _web.useTransition)(completedData, {
|
|
@@ -257,14 +235,12 @@ function BarPlot(props) {
|
|
|
257
235
|
seriesId,
|
|
258
236
|
dataIndex,
|
|
259
237
|
color,
|
|
260
|
-
highlightScope,
|
|
261
238
|
maskId
|
|
262
239
|
}) => {
|
|
263
240
|
const barElement = /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarElement.BarElement, (0, _extends2.default)({
|
|
264
241
|
id: seriesId,
|
|
265
242
|
dataIndex: dataIndex,
|
|
266
|
-
color: color
|
|
267
|
-
highlightScope: highlightScope
|
|
243
|
+
color: color
|
|
268
244
|
}, other, {
|
|
269
245
|
onClick: onItemClick && (event => {
|
|
270
246
|
onItemClick(event, {
|
|
@@ -282,14 +258,26 @@ function BarPlot(props) {
|
|
|
282
258
|
clipPath: `url(#${maskId})`,
|
|
283
259
|
children: barElement
|
|
284
260
|
});
|
|
285
|
-
})
|
|
261
|
+
}), barLabel && /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarLabelPlot.BarLabelPlot, (0, _extends2.default)({
|
|
262
|
+
bars: completedData,
|
|
263
|
+
skipAnimation: skipAnimation,
|
|
264
|
+
barLabel: barLabel
|
|
265
|
+
}, other))]
|
|
286
266
|
});
|
|
287
267
|
}
|
|
288
268
|
process.env.NODE_ENV !== "production" ? BarPlot.propTypes = {
|
|
289
269
|
// ----------------------------- Warning --------------------------------
|
|
290
270
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
291
|
-
// | To update them edit the TypeScript types and run "
|
|
271
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
292
272
|
// ----------------------------------------------------------------------
|
|
273
|
+
/**
|
|
274
|
+
* If provided, the function will be used to format the label of the bar.
|
|
275
|
+
* It can be set to 'value' to display the current value.
|
|
276
|
+
* @param {BarItem} item The item to format.
|
|
277
|
+
* @param {BarLabelContext} context data about the bar.
|
|
278
|
+
* @returns {string} The formatted label.
|
|
279
|
+
*/
|
|
280
|
+
barLabel: _propTypes.default.oneOfType([_propTypes.default.oneOf(['value']), _propTypes.default.func]),
|
|
293
281
|
/**
|
|
294
282
|
* Defines the border radius of the bar element.
|
|
295
283
|
*/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AxisDefaultized } from '../models/axis';
|
|
2
|
+
import { SeriesId } from '../models/seriesType/common';
|
|
3
|
+
export declare function checkScaleErrors(verticalLayout: boolean, seriesId: SeriesId, xAxisKey: string, xAxis: {
|
|
4
|
+
DEFAULT_X_AXIS_KEY: AxisDefaultized;
|
|
5
|
+
} & {
|
|
6
|
+
[axisKey: string]: AxisDefaultized;
|
|
7
|
+
}, yAxisKey: string, yAxis: {
|
|
8
|
+
DEFAULT_X_AXIS_KEY: AxisDefaultized;
|
|
9
|
+
} & {
|
|
10
|
+
[axisKey: string]: AxisDefaultized;
|
|
11
|
+
}): void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.checkScaleErrors = checkScaleErrors;
|
|
7
|
+
var _constants = require("../constants");
|
|
8
|
+
var _axis = require("../models/axis");
|
|
9
|
+
const getAxisMessage = (axisDirection, axisKey) => {
|
|
10
|
+
const axisName = `${axisDirection}-axis`;
|
|
11
|
+
const axisKeyName = `${axisDirection}Axis`;
|
|
12
|
+
const axisDefaultKey = axisDirection === 'x' ? _constants.DEFAULT_X_AXIS_KEY : _constants.DEFAULT_Y_AXIS_KEY;
|
|
13
|
+
return axisKey === axisDefaultKey ? `The first \`${axisKeyName}\`` : `The ${axisName} with id "${axisKey}"`;
|
|
14
|
+
};
|
|
15
|
+
function checkScaleErrors(verticalLayout, seriesId, xAxisKey, xAxis, yAxisKey, yAxis) {
|
|
16
|
+
const xAxisConfig = xAxis[xAxisKey];
|
|
17
|
+
const yAxisConfig = yAxis[yAxisKey];
|
|
18
|
+
const discreteAxisConfig = verticalLayout ? xAxisConfig : yAxisConfig;
|
|
19
|
+
const continuousAxisConfig = verticalLayout ? yAxisConfig : xAxisConfig;
|
|
20
|
+
const discreteAxisKey = verticalLayout ? xAxisKey : yAxisKey;
|
|
21
|
+
const continuousAxisKey = verticalLayout ? yAxisKey : xAxisKey;
|
|
22
|
+
const discreteAxisDirection = verticalLayout ? 'x' : 'y';
|
|
23
|
+
const continuousAxisDirection = verticalLayout ? 'y' : 'x';
|
|
24
|
+
if (!(0, _axis.isBandScaleConfig)(discreteAxisConfig)) {
|
|
25
|
+
throw new Error(`MUI X Charts: ${getAxisMessage(discreteAxisDirection, discreteAxisKey)} should be of type "band" to display the bar series of id "${seriesId}".`);
|
|
26
|
+
}
|
|
27
|
+
if (discreteAxisConfig.data === undefined) {
|
|
28
|
+
throw new Error(`MUI X Charts: ${getAxisMessage(discreteAxisDirection, discreteAxisKey)} should have data property.`);
|
|
29
|
+
}
|
|
30
|
+
if ((0, _axis.isBandScaleConfig)(continuousAxisConfig) || (0, _axis.isPointScaleConfig)(continuousAxisConfig)) {
|
|
31
|
+
throw new Error(`MUI X Charts: ${getAxisMessage(continuousAxisDirection, continuousAxisKey)} should be a continuous type to display the bar series of id "${seriesId}".`);
|
|
32
|
+
}
|
|
33
|
+
}
|
package/BarChart/index.d.ts
CHANGED
package/BarChart/index.js
CHANGED
|
@@ -35,4 +35,15 @@ Object.keys(_BarElement).forEach(function (key) {
|
|
|
35
35
|
return _BarElement[key];
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
+
});
|
|
39
|
+
var _BarLabel = require("./BarLabel");
|
|
40
|
+
Object.keys(_BarLabel).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _BarLabel[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _BarLabel[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
38
49
|
});
|
package/BarChart/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { HighlightScope } from '../context';
|
|
2
1
|
import type { BarSeriesType } from '../models';
|
|
3
2
|
import type { SeriesId } from '../models/seriesType/common';
|
|
4
3
|
export type AnimationData = {
|
|
@@ -15,7 +14,6 @@ export interface CompletedBarData extends AnimationData {
|
|
|
15
14
|
dataIndex: number;
|
|
16
15
|
color: string;
|
|
17
16
|
value: number | null;
|
|
18
|
-
highlightScope?: Partial<HighlightScope>;
|
|
19
17
|
maskId: string;
|
|
20
18
|
}
|
|
21
19
|
export interface MaskData extends AnimationData {
|