@mui/x-charts 7.6.2 → 7.7.1
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 +1 -1
- package/BarChart/BarChart.js +21 -104
- package/BarChart/BarLabel/BarLabelPlot.d.ts +0 -3
- package/BarChart/BarLabel/BarLabelPlot.js +1 -24
- package/BarChart/BarPlot.js +2 -2
- package/BarChart/checkScaleErrors.d.ts +5 -9
- package/BarChart/types.d.ts +2 -2
- package/BarChart/useBarChartProps.d.ts +102 -0
- package/BarChart/useBarChartProps.js +143 -0
- package/CHANGELOG.md +163 -0
- package/ChartContainer/ChartContainer.d.ts +4 -4
- package/ChartContainer/ChartContainer.js +64 -31
- package/ChartContainer/useChartContainerHooks.d.ts +11 -0
- package/ChartContainer/useChartContainerHooks.js +34 -0
- package/ChartContainer/usePluginsMerge.d.ts +1 -2
- package/ChartsAxis/ChartsAxis.js +2 -2
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +2 -2
- package/ChartsGrid/ChartsGrid.js +2 -2
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/ChartsOverlay/index.d.ts +1 -0
- package/ChartsReferenceLine/ChartsXReferenceLine.js +3 -5
- package/ChartsReferenceLine/ChartsYReferenceLine.js +3 -5
- package/ChartsText/ChartsText.js +1 -3
- package/ChartsTooltip/ChartsAxisTooltipContent.js +8 -14
- package/ChartsTooltip/ChartsItemTooltipContent.js +8 -18
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +3 -3
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -2
- package/ChartsXAxis/ChartsXAxis.js +2 -2
- package/ChartsYAxis/ChartsYAxis.js +2 -2
- package/LineChart/AreaPlot.js +2 -2
- package/LineChart/LineChart.d.ts +2 -2
- package/LineChart/LineChart.js +25 -107
- package/LineChart/LineHighlightPlot.js +2 -2
- package/LineChart/LinePlot.js +2 -2
- package/LineChart/MarkPlot.js +2 -2
- package/LineChart/useLineChartProps.d.ts +117 -0
- package/LineChart/useLineChartProps.js +152 -0
- package/PieChart/PieChart.d.ts +2 -2
- package/PieChart/PieChart.js +1 -1
- package/ResponsiveChartContainer/ResizableContainer.d.ts +10 -0
- package/ResponsiveChartContainer/ResizableContainer.js +32 -0
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +25 -22
- package/ScatterChart/ScatterChart.d.ts +1 -1
- package/ScatterChart/ScatterChart.js +21 -76
- package/ScatterChart/ScatterPlot.js +2 -2
- package/ScatterChart/useScatterChartProps.d.ts +86 -0
- package/ScatterChart/useScatterChartProps.js +116 -0
- package/SparkLineChart/SparkLineChart.d.ts +8 -3
- package/SparkLineChart/SparkLineChart.js +57 -1
- package/context/CartesianProvider/CartesianContext.d.ts +25 -0
- package/context/CartesianProvider/CartesianContext.js +21 -0
- package/context/CartesianProvider/CartesianProvider.d.ts +34 -0
- package/context/CartesianProvider/CartesianProvider.js +44 -0
- package/context/CartesianProvider/computeValue.d.ts +19 -0
- package/context/CartesianProvider/computeValue.js +89 -0
- package/context/CartesianProvider/getAxisExtremum.d.ts +4 -0
- package/context/CartesianProvider/getAxisExtremum.js +28 -0
- package/context/CartesianProvider/index.d.ts +9 -0
- package/context/CartesianProvider/index.js +51 -0
- package/context/CartesianProvider/normalizeAxis.d.ts +5 -0
- package/context/CartesianProvider/normalizeAxis.js +23 -0
- package/context/CartesianProvider/useCartesianContext.d.ts +2 -0
- package/context/CartesianProvider/useCartesianContext.js +17 -0
- package/context/ColorProvider.d.ts +12 -0
- package/context/ColorProvider.js +25 -0
- package/esm/BarChart/BarChart.js +21 -104
- package/esm/BarChart/BarLabel/BarLabelPlot.js +0 -23
- package/esm/BarChart/BarPlot.js +2 -2
- package/esm/BarChart/useBarChartProps.js +136 -0
- package/esm/ChartContainer/ChartContainer.js +65 -32
- package/esm/ChartContainer/useChartContainerHooks.js +24 -0
- package/esm/ChartsAxis/ChartsAxis.js +2 -2
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +2 -2
- package/esm/ChartsGrid/ChartsGrid.js +2 -2
- package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +3 -5
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +3 -5
- package/esm/ChartsText/ChartsText.js +1 -3
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +8 -14
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +8 -18
- package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +3 -3
- package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -2
- package/esm/ChartsXAxis/ChartsXAxis.js +2 -2
- package/esm/ChartsYAxis/ChartsYAxis.js +2 -2
- package/esm/LineChart/AreaPlot.js +2 -2
- package/esm/LineChart/LineChart.js +25 -107
- package/esm/LineChart/LineHighlightPlot.js +2 -2
- package/esm/LineChart/LinePlot.js +2 -2
- package/esm/LineChart/MarkPlot.js +2 -2
- package/esm/LineChart/useLineChartProps.js +144 -0
- package/esm/PieChart/PieChart.js +1 -1
- package/esm/ResponsiveChartContainer/ResizableContainer.js +26 -0
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +24 -21
- package/esm/ScatterChart/ScatterChart.js +21 -76
- package/esm/ScatterChart/ScatterPlot.js +2 -2
- package/esm/ScatterChart/useScatterChartProps.js +108 -0
- package/esm/SparkLineChart/SparkLineChart.js +57 -1
- package/esm/context/CartesianProvider/CartesianContext.js +13 -0
- package/esm/context/CartesianProvider/CartesianProvider.js +37 -0
- package/esm/context/CartesianProvider/computeValue.js +82 -0
- package/esm/context/CartesianProvider/getAxisExtremum.js +21 -0
- package/esm/context/CartesianProvider/index.js +10 -0
- package/esm/context/CartesianProvider/normalizeAxis.js +15 -0
- package/esm/context/CartesianProvider/useCartesianContext.js +8 -0
- package/esm/context/ColorProvider.js +16 -0
- package/esm/hooks/index.js +1 -0
- package/esm/hooks/useAxisEvents.js +2 -2
- package/esm/hooks/useColor.js +9 -0
- package/esm/hooks/useColorScale.js +27 -0
- package/esm/hooks/useReducedMotion.js +7 -0
- package/esm/hooks/useScale.js +3 -4
- package/esm/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +2 -2
- package/esm/internals/index.js +31 -1
- package/esm/internals/warning.js +13 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +12 -0
- package/hooks/useAxisEvents.js +2 -2
- package/hooks/useColor.d.ts +4 -0
- package/hooks/useColor.js +17 -0
- package/hooks/useColorScale.d.ts +4 -0
- package/hooks/useColorScale.js +37 -0
- package/hooks/useDrawingArea.d.ts +2 -8
- package/hooks/useReducedMotion.js +7 -0
- package/hooks/useScale.js +3 -6
- package/index.js +1 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.d.ts +2 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +2 -2
- package/internals/defaultizeColor.d.ts +8 -8
- package/internals/index.d.ts +22 -0
- package/internals/index.js +231 -0
- package/internals/warning.d.ts +1 -0
- package/internals/warning.js +19 -0
- package/models/axis.d.ts +1 -2
- package/models/plugin.d.ts +4 -1
- package/modern/BarChart/BarChart.js +21 -104
- package/modern/BarChart/BarLabel/BarLabelPlot.js +0 -23
- package/modern/BarChart/BarPlot.js +2 -2
- package/modern/BarChart/useBarChartProps.js +136 -0
- package/modern/ChartContainer/ChartContainer.js +65 -32
- package/modern/ChartContainer/useChartContainerHooks.js +24 -0
- package/modern/ChartsAxis/ChartsAxis.js +2 -2
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +2 -2
- package/modern/ChartsGrid/ChartsGrid.js +2 -2
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +3 -5
- package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +3 -5
- package/modern/ChartsText/ChartsText.js +1 -3
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +8 -14
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +8 -18
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +3 -3
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -2
- package/modern/ChartsXAxis/ChartsXAxis.js +2 -2
- package/modern/ChartsYAxis/ChartsYAxis.js +2 -2
- package/modern/LineChart/AreaPlot.js +2 -2
- package/modern/LineChart/LineChart.js +25 -107
- package/modern/LineChart/LineHighlightPlot.js +2 -2
- package/modern/LineChart/LinePlot.js +2 -2
- package/modern/LineChart/MarkPlot.js +2 -2
- package/modern/LineChart/useLineChartProps.js +144 -0
- package/modern/PieChart/PieChart.js +1 -1
- package/modern/ResponsiveChartContainer/ResizableContainer.js +26 -0
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +24 -21
- package/modern/ScatterChart/ScatterChart.js +21 -76
- package/modern/ScatterChart/ScatterPlot.js +2 -2
- package/modern/ScatterChart/useScatterChartProps.js +108 -0
- package/modern/SparkLineChart/SparkLineChart.js +57 -1
- package/modern/context/CartesianProvider/CartesianContext.js +13 -0
- package/modern/context/CartesianProvider/CartesianProvider.js +37 -0
- package/modern/context/CartesianProvider/computeValue.js +82 -0
- package/modern/context/CartesianProvider/getAxisExtremum.js +21 -0
- package/modern/context/CartesianProvider/index.js +10 -0
- package/modern/context/CartesianProvider/normalizeAxis.js +15 -0
- package/modern/context/CartesianProvider/useCartesianContext.js +8 -0
- package/modern/context/ColorProvider.js +16 -0
- package/modern/hooks/index.js +1 -0
- package/modern/hooks/useAxisEvents.js +2 -2
- package/modern/hooks/useColor.js +9 -0
- package/modern/hooks/useColorScale.js +27 -0
- package/modern/hooks/useReducedMotion.js +7 -0
- package/modern/hooks/useScale.js +3 -4
- package/modern/index.js +1 -1
- package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +2 -2
- package/modern/internals/index.js +31 -1
- package/modern/internals/warning.js +13 -0
- package/package.json +4 -4
- package/themeAugmentation/components.d.ts +12 -12
- package/context/CartesianContextProvider.d.ts +0 -53
- package/context/CartesianContextProvider.js +0 -233
- package/esm/context/CartesianContextProvider.js +0 -224
- package/esm/internals/colorGetter.js +0 -22
- package/internals/colorGetter.d.ts +0 -7
- package/internals/colorGetter.js +0 -29
- package/modern/context/CartesianContextProvider.js +0 -224
- package/modern/internals/colorGetter.js +0 -22
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.computeValue = computeValue;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _d3Scale = require("d3-scale");
|
|
10
|
+
var _constants = require("../../constants");
|
|
11
|
+
var _axis = require("../../models/axis");
|
|
12
|
+
var _colorScale = require("../../internals/colorScale");
|
|
13
|
+
var _useTicks = require("../../hooks/useTicks");
|
|
14
|
+
var _getScale = require("../../internals/getScale");
|
|
15
|
+
var _getAxisExtremum = require("./getAxisExtremum");
|
|
16
|
+
const getRange = (drawingArea, axisName, isReverse) => {
|
|
17
|
+
const range = axisName === 'x' ? [drawingArea.left, drawingArea.left + drawingArea.width] : [drawingArea.top + drawingArea.height, drawingArea.top];
|
|
18
|
+
return isReverse ? range.reverse() : range;
|
|
19
|
+
};
|
|
20
|
+
const DEFAULT_CATEGORY_GAP_RATIO = 0.2;
|
|
21
|
+
const DEFAULT_BAR_GAP_RATIO = 0.1;
|
|
22
|
+
function computeValue(drawingArea, formattedSeries, inAxis, extremumGetters, axisName) {
|
|
23
|
+
const DEFAULT_AXIS_KEY = axisName === 'x' ? _constants.DEFAULT_X_AXIS_KEY : _constants.DEFAULT_Y_AXIS_KEY;
|
|
24
|
+
const allAxis = [...(inAxis?.map((axis, index) => (0, _extends2.default)({
|
|
25
|
+
id: `defaultized-${axisName}-axis-${index}`
|
|
26
|
+
}, axis)) ?? []), ...(inAxis === undefined || inAxis.findIndex(({
|
|
27
|
+
id
|
|
28
|
+
}) => id === DEFAULT_AXIS_KEY) === -1 ? [{
|
|
29
|
+
id: DEFAULT_AXIS_KEY,
|
|
30
|
+
scaleType: 'linear'
|
|
31
|
+
}] : [])];
|
|
32
|
+
const completeAxis = {};
|
|
33
|
+
allAxis.forEach((axis, axisIndex) => {
|
|
34
|
+
const isDefaultAxis = axisIndex === 0;
|
|
35
|
+
const [minData, maxData] = (0, _getAxisExtremum.getAxisExtremum)(axis, extremumGetters, isDefaultAxis, formattedSeries);
|
|
36
|
+
const range = getRange(drawingArea, axisName, axis.reverse);
|
|
37
|
+
if ((0, _axis.isBandScaleConfig)(axis)) {
|
|
38
|
+
const categoryGapRatio = axis.categoryGapRatio ?? DEFAULT_CATEGORY_GAP_RATIO;
|
|
39
|
+
const barGapRatio = axis.barGapRatio ?? DEFAULT_BAR_GAP_RATIO;
|
|
40
|
+
// Reverse range because ordinal scales are presented from top to bottom on y-axis
|
|
41
|
+
const scaleRange = axisName === 'x' ? range : [range[1], range[0]];
|
|
42
|
+
completeAxis[axis.id] = (0, _extends2.default)({
|
|
43
|
+
categoryGapRatio,
|
|
44
|
+
barGapRatio
|
|
45
|
+
}, axis, {
|
|
46
|
+
scale: (0, _d3Scale.scaleBand)(axis.data, scaleRange).paddingInner(categoryGapRatio).paddingOuter(categoryGapRatio / 2),
|
|
47
|
+
tickNumber: axis.data.length,
|
|
48
|
+
colorScale: axis.colorMap && (axis.colorMap.type === 'ordinal' ? (0, _colorScale.getOrdinalColorScale)((0, _extends2.default)({
|
|
49
|
+
values: axis.data
|
|
50
|
+
}, axis.colorMap)) : (0, _colorScale.getColorScale)(axis.colorMap))
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if ((0, _axis.isPointScaleConfig)(axis)) {
|
|
54
|
+
const scaleRange = axisName === 'x' ? range : [...range].reverse();
|
|
55
|
+
completeAxis[axis.id] = (0, _extends2.default)({}, axis, {
|
|
56
|
+
scale: (0, _d3Scale.scalePoint)(axis.data, scaleRange),
|
|
57
|
+
tickNumber: axis.data.length,
|
|
58
|
+
colorScale: axis.colorMap && (axis.colorMap.type === 'ordinal' ? (0, _colorScale.getOrdinalColorScale)((0, _extends2.default)({
|
|
59
|
+
values: axis.data
|
|
60
|
+
}, axis.colorMap)) : (0, _colorScale.getColorScale)(axis.colorMap))
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (axis.scaleType === 'band' || axis.scaleType === 'point') {
|
|
64
|
+
// Could be merged with the two previous "if conditions" but then TS does not get that `axis.scaleType` can't be `band` or `point`.
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const scaleType = axis.scaleType ?? 'linear';
|
|
68
|
+
const extremums = [axis.min ?? minData, axis.max ?? maxData];
|
|
69
|
+
const tickNumber = (0, _useTicks.getTickNumber)((0, _extends2.default)({}, axis, {
|
|
70
|
+
range,
|
|
71
|
+
domain: extremums
|
|
72
|
+
}));
|
|
73
|
+
const scale = (0, _getScale.getScale)(scaleType, extremums, range).nice(tickNumber);
|
|
74
|
+
const [minDomain, maxDomain] = scale.domain();
|
|
75
|
+
const domain = [axis.min ?? minDomain, axis.max ?? maxDomain];
|
|
76
|
+
completeAxis[axis.id] = (0, _extends2.default)({}, axis, {
|
|
77
|
+
scaleType: scaleType,
|
|
78
|
+
scale: scale.domain(domain),
|
|
79
|
+
tickNumber,
|
|
80
|
+
colorScale: axis.colorMap && (0, _colorScale.getColorScale)(axis.colorMap)
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
return {
|
|
84
|
+
axis: completeAxis,
|
|
85
|
+
axisIds: allAxis.map(({
|
|
86
|
+
id
|
|
87
|
+
}) => id)
|
|
88
|
+
};
|
|
89
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AxisConfig, ExtremumGettersConfig } from '../../models';
|
|
2
|
+
import { ExtremumGetterResult } from '../../models/seriesType/config';
|
|
3
|
+
import { FormattedSeries } from '../SeriesContextProvider';
|
|
4
|
+
export declare const getAxisExtremum: (axis: AxisConfig, getters: ExtremumGettersConfig, isDefaultAxis: boolean, formattedSeries: FormattedSeries) => ExtremumGetterResult;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getAxisExtremum = void 0;
|
|
7
|
+
const axisExtremumCallback = (acc, chartType, axis, getters, isDefaultAxis, formattedSeries) => {
|
|
8
|
+
const getter = getters[chartType];
|
|
9
|
+
const series = formattedSeries[chartType]?.series ?? {};
|
|
10
|
+
const [minChartTypeData, maxChartTypeData] = getter?.({
|
|
11
|
+
series,
|
|
12
|
+
axis,
|
|
13
|
+
isDefaultAxis
|
|
14
|
+
}) ?? [null, null];
|
|
15
|
+
const [minData, maxData] = acc;
|
|
16
|
+
if (minData === null || maxData === null) {
|
|
17
|
+
return [minChartTypeData, maxChartTypeData];
|
|
18
|
+
}
|
|
19
|
+
if (minChartTypeData === null || maxChartTypeData === null) {
|
|
20
|
+
return [minData, maxData];
|
|
21
|
+
}
|
|
22
|
+
return [Math.min(minChartTypeData, minData), Math.max(maxChartTypeData, maxData)];
|
|
23
|
+
};
|
|
24
|
+
const getAxisExtremum = (axis, getters, isDefaultAxis, formattedSeries) => {
|
|
25
|
+
const charTypes = Object.keys(getters);
|
|
26
|
+
return charTypes.reduce((acc, charType) => axisExtremumCallback(acc, charType, axis, getters, isDefaultAxis, formattedSeries), [null, null]);
|
|
27
|
+
};
|
|
28
|
+
exports.getAxisExtremum = getAxisExtremum;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { computeValue } from './computeValue';
|
|
2
|
+
export * from './CartesianProvider';
|
|
3
|
+
export * from './CartesianContext';
|
|
4
|
+
export * from './useCartesianContext';
|
|
5
|
+
declare const cartesianProviderUtils: {
|
|
6
|
+
computeValue: typeof computeValue;
|
|
7
|
+
normalizeAxis: <T extends import("../../internals").ChartsAxisProps, R extends import("../../internals").MakeOptional<import("../..").AxisConfig<import("../..").ScaleName, any, T>, "id">>(axis: R[] | undefined, dataset: import("../../internals").DatasetType | undefined, axisName: "x" | "y") => R[] | undefined;
|
|
8
|
+
};
|
|
9
|
+
export { cartesianProviderUtils };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
cartesianProviderUtils: true
|
|
8
|
+
};
|
|
9
|
+
exports.cartesianProviderUtils = void 0;
|
|
10
|
+
var _computeValue = require("./computeValue");
|
|
11
|
+
var _normalizeAxis = require("./normalizeAxis");
|
|
12
|
+
var _CartesianProvider = require("./CartesianProvider");
|
|
13
|
+
Object.keys(_CartesianProvider).forEach(function (key) {
|
|
14
|
+
if (key === "default" || key === "__esModule") return;
|
|
15
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
16
|
+
if (key in exports && exports[key] === _CartesianProvider[key]) return;
|
|
17
|
+
Object.defineProperty(exports, key, {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () {
|
|
20
|
+
return _CartesianProvider[key];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
var _CartesianContext = require("./CartesianContext");
|
|
25
|
+
Object.keys(_CartesianContext).forEach(function (key) {
|
|
26
|
+
if (key === "default" || key === "__esModule") return;
|
|
27
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
28
|
+
if (key in exports && exports[key] === _CartesianContext[key]) return;
|
|
29
|
+
Object.defineProperty(exports, key, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () {
|
|
32
|
+
return _CartesianContext[key];
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
var _useCartesianContext = require("./useCartesianContext");
|
|
37
|
+
Object.keys(_useCartesianContext).forEach(function (key) {
|
|
38
|
+
if (key === "default" || key === "__esModule") return;
|
|
39
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
40
|
+
if (key in exports && exports[key] === _useCartesianContext[key]) return;
|
|
41
|
+
Object.defineProperty(exports, key, {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () {
|
|
44
|
+
return _useCartesianContext[key];
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
const cartesianProviderUtils = exports.cartesianProviderUtils = {
|
|
49
|
+
computeValue: _computeValue.computeValue,
|
|
50
|
+
normalizeAxis: _normalizeAxis.normalizeAxis
|
|
51
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AxisConfig, ScaleName } from '../../models';
|
|
2
|
+
import { ChartsAxisProps } from '../../models/axis';
|
|
3
|
+
import { MakeOptional } from '../../models/helpers';
|
|
4
|
+
import { DatasetType } from '../../models/seriesType/config';
|
|
5
|
+
export declare const normalizeAxis: <T extends ChartsAxisProps, R extends MakeOptional<AxisConfig<ScaleName, any, T>, "id">>(axis: R[] | undefined, dataset: DatasetType | undefined, axisName: 'x' | 'y') => R[] | undefined;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.normalizeAxis = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
const normalizeAxis = (axis, dataset, axisName) => {
|
|
10
|
+
return axis?.map(axisConfig => {
|
|
11
|
+
const dataKey = axisConfig.dataKey;
|
|
12
|
+
if (dataKey === undefined || axisConfig.data !== undefined) {
|
|
13
|
+
return axisConfig;
|
|
14
|
+
}
|
|
15
|
+
if (dataset === undefined) {
|
|
16
|
+
throw Error(`MUI X Charts: ${axisName}-axis uses \`dataKey\` but no \`dataset\` is provided.`);
|
|
17
|
+
}
|
|
18
|
+
return (0, _extends2.default)({}, axisConfig, {
|
|
19
|
+
data: dataset.map(d => d[dataKey])
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
exports.normalizeAxis = normalizeAxis;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useCartesianContext = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _CartesianContext = require("./CartesianContext");
|
|
9
|
+
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); }
|
|
10
|
+
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 && {}.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; }
|
|
11
|
+
const useCartesianContext = () => {
|
|
12
|
+
const {
|
|
13
|
+
data
|
|
14
|
+
} = React.useContext(_CartesianContext.CartesianContext);
|
|
15
|
+
return data;
|
|
16
|
+
};
|
|
17
|
+
exports.useCartesianContext = useCartesianContext;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ColorProcessorsConfig } from '../models';
|
|
3
|
+
import { ChartSeriesType } from '../models/seriesType/config';
|
|
4
|
+
export interface ColorProviderProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* A mapping defining for each series type how to get item colors.
|
|
8
|
+
*/
|
|
9
|
+
colorProcessors: ColorProcessorsConfig<ChartSeriesType>;
|
|
10
|
+
}
|
|
11
|
+
export declare const ColorContext: React.Context<ColorProcessorsConfig<keyof import("../models/seriesType/config").ChartsSeriesConfig>>;
|
|
12
|
+
export declare function ColorProvider(props: ColorProviderProps): React.JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ColorContext = void 0;
|
|
7
|
+
exports.ColorProvider = ColorProvider;
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
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); }
|
|
11
|
+
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 && {}.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; }
|
|
12
|
+
const ColorContext = exports.ColorContext = /*#__PURE__*/React.createContext({});
|
|
13
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
14
|
+
ColorContext.displayName = 'ColorContext';
|
|
15
|
+
}
|
|
16
|
+
function ColorProvider(props) {
|
|
17
|
+
const {
|
|
18
|
+
colorProcessors,
|
|
19
|
+
children
|
|
20
|
+
} = props;
|
|
21
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ColorContext.Provider, {
|
|
22
|
+
value: colorProcessors,
|
|
23
|
+
children: children
|
|
24
|
+
});
|
|
25
|
+
}
|
package/esm/BarChart/BarChart.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import useId from '@mui/utils/useId';
|
|
4
3
|
import PropTypes from 'prop-types';
|
|
5
4
|
import { BarPlot } from './BarPlot';
|
|
6
5
|
import { ResponsiveChartContainer } from '../ResponsiveChartContainer';
|
|
7
6
|
import { ChartsAxis } from '../ChartsAxis';
|
|
8
|
-
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '../constants';
|
|
9
7
|
import { ChartsTooltip } from '../ChartsTooltip';
|
|
10
8
|
import { ChartsLegend } from '../ChartsLegend';
|
|
11
9
|
import { ChartsAxisHighlight } from '../ChartsAxisHighlight';
|
|
@@ -13,6 +11,7 @@ import { ChartsClipPath } from '../ChartsClipPath';
|
|
|
13
11
|
import { ChartsGrid } from '../ChartsGrid';
|
|
14
12
|
import { ChartsOnAxisClickHandler } from '../ChartsOnAxisClickHandler';
|
|
15
13
|
import { ChartsOverlay } from '../ChartsOverlay/ChartsOverlay';
|
|
14
|
+
import { useBarChartProps } from './useBarChartProps';
|
|
16
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
16
|
/**
|
|
18
17
|
* Demos:
|
|
@@ -27,108 +26,26 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
27
26
|
*/
|
|
28
27
|
const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
|
|
29
28
|
const {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
onItemClick,
|
|
51
|
-
onAxisClick,
|
|
52
|
-
children,
|
|
53
|
-
slots,
|
|
54
|
-
slotProps,
|
|
55
|
-
loading,
|
|
56
|
-
barLabel,
|
|
57
|
-
highlightedItem,
|
|
58
|
-
onHighlightChange
|
|
59
|
-
} = props;
|
|
60
|
-
const id = useId();
|
|
61
|
-
const clipPathId = `${id}-clip-path`;
|
|
62
|
-
const hasHorizontalSeries = layout === 'horizontal' || layout === undefined && series.some(item => item.layout === 'horizontal');
|
|
63
|
-
const defaultAxisConfig = {
|
|
64
|
-
scaleType: 'band',
|
|
65
|
-
data: Array.from({
|
|
66
|
-
length: Math.max(...series.map(s => (s.data ?? dataset ?? []).length))
|
|
67
|
-
}, (_, index) => index)
|
|
68
|
-
};
|
|
69
|
-
const defaultizedAxisHighlight = _extends({}, hasHorizontalSeries ? {
|
|
70
|
-
y: 'band'
|
|
71
|
-
} : {
|
|
72
|
-
x: 'band'
|
|
73
|
-
}, axisHighlight);
|
|
74
|
-
return /*#__PURE__*/_jsxs(ResponsiveChartContainer, {
|
|
75
|
-
ref: ref,
|
|
76
|
-
series: series.map(s => _extends({
|
|
77
|
-
type: 'bar'
|
|
78
|
-
}, s, {
|
|
79
|
-
layout: hasHorizontalSeries ? 'horizontal' : 'vertical'
|
|
80
|
-
})),
|
|
81
|
-
width: width,
|
|
82
|
-
height: height,
|
|
83
|
-
margin: margin,
|
|
84
|
-
xAxis: xAxis ?? (hasHorizontalSeries ? undefined : [_extends({
|
|
85
|
-
id: DEFAULT_X_AXIS_KEY
|
|
86
|
-
}, defaultAxisConfig)]),
|
|
87
|
-
yAxis: yAxis ?? (hasHorizontalSeries ? [_extends({
|
|
88
|
-
id: DEFAULT_Y_AXIS_KEY
|
|
89
|
-
}, defaultAxisConfig)] : undefined),
|
|
90
|
-
colors: colors,
|
|
91
|
-
dataset: dataset,
|
|
92
|
-
sx: sx,
|
|
93
|
-
disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
|
|
94
|
-
highlightedItem: highlightedItem,
|
|
95
|
-
onHighlightChange: onHighlightChange,
|
|
96
|
-
children: [onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, {
|
|
97
|
-
onAxisClick: onAxisClick
|
|
98
|
-
}), grid && /*#__PURE__*/_jsx(ChartsGrid, {
|
|
99
|
-
vertical: grid.vertical,
|
|
100
|
-
horizontal: grid.horizontal
|
|
101
|
-
}), /*#__PURE__*/_jsxs("g", {
|
|
102
|
-
clipPath: `url(#${clipPathId})`,
|
|
103
|
-
children: [/*#__PURE__*/_jsx(BarPlot, {
|
|
104
|
-
slots: slots,
|
|
105
|
-
slotProps: slotProps,
|
|
106
|
-
skipAnimation: skipAnimation,
|
|
107
|
-
onItemClick: onItemClick,
|
|
108
|
-
borderRadius: borderRadius,
|
|
109
|
-
barLabel: barLabel
|
|
110
|
-
}), /*#__PURE__*/_jsx(ChartsOverlay, {
|
|
111
|
-
loading: loading,
|
|
112
|
-
slots: slots,
|
|
113
|
-
slotProps: slotProps
|
|
114
|
-
})]
|
|
115
|
-
}), /*#__PURE__*/_jsx(ChartsAxis, {
|
|
116
|
-
topAxis: topAxis,
|
|
117
|
-
leftAxis: leftAxis,
|
|
118
|
-
rightAxis: rightAxis,
|
|
119
|
-
bottomAxis: bottomAxis,
|
|
120
|
-
slots: slots,
|
|
121
|
-
slotProps: slotProps
|
|
122
|
-
}), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend, {
|
|
123
|
-
slots: slots,
|
|
124
|
-
slotProps: slotProps
|
|
125
|
-
})), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, defaultizedAxisHighlight)), !loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip, {
|
|
126
|
-
slots: slots,
|
|
127
|
-
slotProps: slotProps
|
|
128
|
-
})), /*#__PURE__*/_jsx(ChartsClipPath, {
|
|
129
|
-
id: clipPathId
|
|
130
|
-
}), children]
|
|
131
|
-
});
|
|
29
|
+
chartContainerProps,
|
|
30
|
+
barPlotProps,
|
|
31
|
+
axisClickHandlerProps,
|
|
32
|
+
gridProps,
|
|
33
|
+
clipPathProps,
|
|
34
|
+
clipPathGroupProps,
|
|
35
|
+
overlayProps,
|
|
36
|
+
chartsAxisProps,
|
|
37
|
+
axisHighlightProps,
|
|
38
|
+
legendProps,
|
|
39
|
+
tooltipProps,
|
|
40
|
+
children
|
|
41
|
+
} = useBarChartProps(props);
|
|
42
|
+
return /*#__PURE__*/_jsxs(ResponsiveChartContainer, _extends({
|
|
43
|
+
ref: ref
|
|
44
|
+
}, chartContainerProps, {
|
|
45
|
+
children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), props.grid && /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
|
|
46
|
+
children: [/*#__PURE__*/_jsx(BarPlot, _extends({}, barPlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps))]
|
|
47
|
+
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), !props.loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltipProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
|
|
48
|
+
}));
|
|
132
49
|
});
|
|
133
50
|
process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
134
51
|
// ----------------------------- Warning --------------------------------
|
|
@@ -2,7 +2,6 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
const _excluded = ["bars", "skipAnimation"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
5
|
import { useTransition } from '@react-spring/web';
|
|
7
6
|
import { BarLabelItem } from './BarLabelItem';
|
|
8
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -73,26 +72,4 @@ function BarLabelPlot(props) {
|
|
|
73
72
|
})))
|
|
74
73
|
});
|
|
75
74
|
}
|
|
76
|
-
process.env.NODE_ENV !== "production" ? BarLabelPlot.propTypes = {
|
|
77
|
-
// ----------------------------- Warning --------------------------------
|
|
78
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
79
|
-
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
80
|
-
// ----------------------------------------------------------------------
|
|
81
|
-
barLabel: PropTypes.oneOfType([PropTypes.oneOf(['value']), PropTypes.func]),
|
|
82
|
-
bars: PropTypes.arrayOf(PropTypes.shape({
|
|
83
|
-
color: PropTypes.string.isRequired,
|
|
84
|
-
dataIndex: PropTypes.number.isRequired,
|
|
85
|
-
height: PropTypes.number.isRequired,
|
|
86
|
-
layout: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
87
|
-
maskId: PropTypes.string.isRequired,
|
|
88
|
-
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
89
|
-
value: PropTypes.number,
|
|
90
|
-
width: PropTypes.number.isRequired,
|
|
91
|
-
x: PropTypes.number.isRequired,
|
|
92
|
-
xOrigin: PropTypes.number.isRequired,
|
|
93
|
-
y: PropTypes.number.isRequired,
|
|
94
|
-
yOrigin: PropTypes.number.isRequired
|
|
95
|
-
})).isRequired,
|
|
96
|
-
skipAnimation: PropTypes.bool
|
|
97
|
-
} : void 0;
|
|
98
75
|
export { BarLabelPlot };
|
package/esm/BarChart/BarPlot.js
CHANGED
|
@@ -4,7 +4,7 @@ const _excluded = ["skipAnimation", "onItemClick", "borderRadius", "barLabel"];
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useTransition } from '@react-spring/web';
|
|
7
|
-
import {
|
|
7
|
+
import { useCartesianContext } from '../context/CartesianProvider';
|
|
8
8
|
import { BarElement } from './BarElement';
|
|
9
9
|
import getColor from './getColor';
|
|
10
10
|
import { useChartId } from '../hooks';
|
|
@@ -47,7 +47,7 @@ const useAggregatedData = () => {
|
|
|
47
47
|
stackingGroups: [],
|
|
48
48
|
seriesOrder: []
|
|
49
49
|
};
|
|
50
|
-
const axisData =
|
|
50
|
+
const axisData = useCartesianContext();
|
|
51
51
|
const chartId = useChartId();
|
|
52
52
|
const {
|
|
53
53
|
series,
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import useId from '@mui/utils/useId';
|
|
3
|
+
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '../constants';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A helper function that extracts BarChartProps from the input props
|
|
7
|
+
* and returns an object with props for the children components of BarChart.
|
|
8
|
+
*
|
|
9
|
+
* @param props The input props for BarChart
|
|
10
|
+
* @returns An object with props for the children components of BarChart
|
|
11
|
+
*/
|
|
12
|
+
export const useBarChartProps = props => {
|
|
13
|
+
const {
|
|
14
|
+
xAxis,
|
|
15
|
+
yAxis,
|
|
16
|
+
series,
|
|
17
|
+
width,
|
|
18
|
+
height,
|
|
19
|
+
margin,
|
|
20
|
+
colors,
|
|
21
|
+
dataset,
|
|
22
|
+
sx,
|
|
23
|
+
tooltip,
|
|
24
|
+
onAxisClick,
|
|
25
|
+
axisHighlight,
|
|
26
|
+
legend,
|
|
27
|
+
grid,
|
|
28
|
+
topAxis,
|
|
29
|
+
leftAxis,
|
|
30
|
+
rightAxis,
|
|
31
|
+
bottomAxis,
|
|
32
|
+
children,
|
|
33
|
+
slots,
|
|
34
|
+
slotProps,
|
|
35
|
+
skipAnimation,
|
|
36
|
+
loading,
|
|
37
|
+
layout,
|
|
38
|
+
onItemClick,
|
|
39
|
+
highlightedItem,
|
|
40
|
+
onHighlightChange,
|
|
41
|
+
borderRadius,
|
|
42
|
+
barLabel
|
|
43
|
+
} = props;
|
|
44
|
+
const id = useId();
|
|
45
|
+
const clipPathId = `${id}-clip-path`;
|
|
46
|
+
const hasHorizontalSeries = layout === 'horizontal' || layout === undefined && series.some(item => item.layout === 'horizontal');
|
|
47
|
+
const defaultAxisConfig = {
|
|
48
|
+
scaleType: 'band',
|
|
49
|
+
data: Array.from({
|
|
50
|
+
length: Math.max(...series.map(s => (s.data ?? dataset ?? []).length))
|
|
51
|
+
}, (_, index) => index)
|
|
52
|
+
};
|
|
53
|
+
const chartContainerProps = {
|
|
54
|
+
series: series.map(s => _extends({
|
|
55
|
+
type: 'bar'
|
|
56
|
+
}, s, {
|
|
57
|
+
layout: hasHorizontalSeries ? 'horizontal' : 'vertical'
|
|
58
|
+
})),
|
|
59
|
+
width,
|
|
60
|
+
height,
|
|
61
|
+
margin,
|
|
62
|
+
colors,
|
|
63
|
+
dataset,
|
|
64
|
+
xAxis: xAxis ?? (hasHorizontalSeries ? undefined : [_extends({
|
|
65
|
+
id: DEFAULT_X_AXIS_KEY
|
|
66
|
+
}, defaultAxisConfig)]),
|
|
67
|
+
yAxis: yAxis ?? (hasHorizontalSeries ? [_extends({
|
|
68
|
+
id: DEFAULT_Y_AXIS_KEY
|
|
69
|
+
}, defaultAxisConfig)] : undefined),
|
|
70
|
+
sx,
|
|
71
|
+
highlightedItem,
|
|
72
|
+
onHighlightChange,
|
|
73
|
+
disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick
|
|
74
|
+
};
|
|
75
|
+
const barPlotProps = {
|
|
76
|
+
onItemClick,
|
|
77
|
+
slots,
|
|
78
|
+
slotProps,
|
|
79
|
+
skipAnimation,
|
|
80
|
+
borderRadius,
|
|
81
|
+
barLabel
|
|
82
|
+
};
|
|
83
|
+
const axisClickHandlerProps = {
|
|
84
|
+
onAxisClick
|
|
85
|
+
};
|
|
86
|
+
const gridProps = {
|
|
87
|
+
vertical: grid?.vertical,
|
|
88
|
+
horizontal: grid?.horizontal
|
|
89
|
+
};
|
|
90
|
+
const clipPathGroupProps = {
|
|
91
|
+
clipPath: `url(#${clipPathId})`
|
|
92
|
+
};
|
|
93
|
+
const clipPathProps = {
|
|
94
|
+
id: clipPathId
|
|
95
|
+
};
|
|
96
|
+
const overlayProps = {
|
|
97
|
+
slots,
|
|
98
|
+
slotProps,
|
|
99
|
+
loading
|
|
100
|
+
};
|
|
101
|
+
const chartsAxisProps = {
|
|
102
|
+
topAxis,
|
|
103
|
+
leftAxis,
|
|
104
|
+
rightAxis,
|
|
105
|
+
bottomAxis,
|
|
106
|
+
slots,
|
|
107
|
+
slotProps
|
|
108
|
+
};
|
|
109
|
+
const axisHighlightProps = _extends({}, hasHorizontalSeries ? {
|
|
110
|
+
y: 'band'
|
|
111
|
+
} : {
|
|
112
|
+
x: 'band'
|
|
113
|
+
}, axisHighlight);
|
|
114
|
+
const legendProps = _extends({}, legend, {
|
|
115
|
+
slots,
|
|
116
|
+
slotProps
|
|
117
|
+
});
|
|
118
|
+
const tooltipProps = _extends({}, tooltip, {
|
|
119
|
+
slots,
|
|
120
|
+
slotProps
|
|
121
|
+
});
|
|
122
|
+
return {
|
|
123
|
+
chartContainerProps,
|
|
124
|
+
barPlotProps,
|
|
125
|
+
axisClickHandlerProps,
|
|
126
|
+
gridProps,
|
|
127
|
+
clipPathProps,
|
|
128
|
+
clipPathGroupProps,
|
|
129
|
+
overlayProps,
|
|
130
|
+
chartsAxisProps,
|
|
131
|
+
axisHighlightProps,
|
|
132
|
+
legendProps,
|
|
133
|
+
tooltipProps,
|
|
134
|
+
children
|
|
135
|
+
};
|
|
136
|
+
};
|