@mui/x-charts 9.0.1 → 9.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/BarChart.js +29 -10
- package/BarChart/BarChart.mjs +29 -10
- package/BarChart/BarElement.js +1 -5
- package/BarChart/BarElement.mjs +1 -5
- package/BarChart/BarPlot.js +2 -1
- package/BarChart/BarPlot.mjs +2 -1
- package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.mts +8 -7
- package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +8 -7
- package/BarChart/seriesConfig/bar/seriesProcessor.js +37 -13
- package/BarChart/seriesConfig/bar/seriesProcessor.mjs +37 -13
- package/CHANGELOG.md +257 -0
- package/ChartsContainer/ChartsContainer.js +59 -30
- package/ChartsContainer/ChartsContainer.mjs +59 -30
- package/ChartsDataProvider/useChartsDataProviderProps.js +1 -6
- package/ChartsDataProvider/useChartsDataProviderProps.mjs +1 -6
- package/ChartsGrid/styledComponents.js +2 -2
- package/ChartsGrid/styledComponents.mjs +2 -2
- package/ChartsRadialDataProvider/ChartsRadialDataProvider.d.mts +38 -0
- package/ChartsRadialDataProvider/ChartsRadialDataProvider.d.ts +38 -0
- package/ChartsRadialDataProvider/ChartsRadialDataProvider.js +115 -0
- package/ChartsRadialDataProvider/ChartsRadialDataProvider.mjs +109 -0
- package/ChartsRadialDataProvider/ChartsRadialDataProvider.plugins.d.mts +9 -0
- package/ChartsRadialDataProvider/ChartsRadialDataProvider.plugins.d.ts +9 -0
- package/ChartsRadialDataProvider/ChartsRadialDataProvider.plugins.js +13 -0
- package/ChartsRadialDataProvider/ChartsRadialDataProvider.plugins.mjs +7 -0
- package/ChartsRadialDataProvider/index.d.mts +2 -0
- package/ChartsRadialDataProvider/index.d.ts +2 -0
- package/ChartsRadialDataProvider/index.js +27 -0
- package/ChartsRadialDataProvider/index.mjs +2 -0
- package/ChartsRadialDataProvider/useChartsRadialDataProviderProps.d.mts +13 -0
- package/ChartsRadialDataProvider/useChartsRadialDataProviderProps.d.ts +13 -0
- package/ChartsRadialDataProvider/useChartsRadialDataProviderProps.js +46 -0
- package/ChartsRadialDataProvider/useChartsRadialDataProviderProps.mjs +39 -0
- package/ChartsRadialGrid/ChartsRadialGrid.d.mts +33 -0
- package/ChartsRadialGrid/ChartsRadialGrid.d.ts +33 -0
- package/ChartsRadialGrid/ChartsRadialGrid.js +101 -0
- package/ChartsRadialGrid/ChartsRadialGrid.mjs +96 -0
- package/ChartsRadialGrid/ChartsRadiusGrid.d.mts +14 -0
- package/ChartsRadialGrid/ChartsRadiusGrid.d.ts +14 -0
- package/ChartsRadialGrid/ChartsRadiusGrid.js +72 -0
- package/ChartsRadialGrid/ChartsRadiusGrid.mjs +65 -0
- package/ChartsRadialGrid/ChartsRotationGrid.d.mts +13 -0
- package/ChartsRadialGrid/ChartsRotationGrid.d.ts +13 -0
- package/ChartsRadialGrid/ChartsRotationGrid.js +65 -0
- package/ChartsRadialGrid/ChartsRotationGrid.mjs +58 -0
- package/ChartsRadialGrid/chartsRadialGridClasses.d.mts +13 -0
- package/ChartsRadialGrid/chartsRadialGridClasses.d.ts +13 -0
- package/ChartsRadialGrid/chartsRadialGridClasses.js +14 -0
- package/ChartsRadialGrid/chartsRadialGridClasses.mjs +6 -0
- package/ChartsRadialGrid/index.d.mts +3 -0
- package/ChartsRadialGrid/index.d.ts +3 -0
- package/ChartsRadialGrid/index.js +19 -0
- package/ChartsRadialGrid/index.mjs +2 -0
- package/ChartsRadialGrid/styledComponents.d.mts +4 -0
- package/ChartsRadialGrid/styledComponents.d.ts +4 -0
- package/ChartsRadialGrid/styledComponents.js +50 -0
- package/ChartsRadialGrid/styledComponents.mjs +44 -0
- package/ChartsRadiusAxis/ChartsRadiusAxis.d.mts +48 -0
- package/ChartsRadiusAxis/ChartsRadiusAxis.d.ts +48 -0
- package/ChartsRadiusAxis/ChartsRadiusAxis.js +147 -0
- package/ChartsRadiusAxis/ChartsRadiusAxis.mjs +141 -0
- package/ChartsRadiusAxis/chartsRadiusAxisClasses.d.mts +6 -0
- package/ChartsRadiusAxis/chartsRadiusAxisClasses.d.ts +6 -0
- package/ChartsRadiusAxis/chartsRadiusAxisClasses.js +30 -0
- package/ChartsRadiusAxis/chartsRadiusAxisClasses.mjs +17 -0
- package/ChartsRadiusAxis/createGetLabelTextAnchors.d.mts +10 -0
- package/ChartsRadiusAxis/createGetLabelTextAnchors.d.ts +10 -0
- package/ChartsRadiusAxis/createGetLabelTextAnchors.js +46 -0
- package/ChartsRadiusAxis/createGetLabelTextAnchors.mjs +39 -0
- package/ChartsRadiusAxis/getLabelTransform.d.mts +11 -0
- package/ChartsRadiusAxis/getLabelTransform.d.ts +11 -0
- package/ChartsRadiusAxis/getLabelTransform.js +37 -0
- package/ChartsRadiusAxis/getLabelTransform.mjs +31 -0
- package/ChartsRadiusAxis/index.d.mts +3 -0
- package/ChartsRadiusAxis/index.d.ts +3 -0
- package/ChartsRadiusAxis/index.js +19 -0
- package/ChartsRadiusAxis/index.mjs +2 -0
- package/ChartsRadiusAxis/sharedRadialAxisClasses.d.mts +21 -0
- package/ChartsRadiusAxis/sharedRadialAxisClasses.d.ts +21 -0
- package/ChartsRadiusAxis/sharedRadialAxisClasses.js +14 -0
- package/ChartsRadiusAxis/sharedRadialAxisClasses.mjs +6 -0
- package/ChartsRotationAxis/ChartsRotationAxis.d.mts +48 -0
- package/ChartsRotationAxis/ChartsRotationAxis.d.ts +48 -0
- package/ChartsRotationAxis/ChartsRotationAxis.js +141 -0
- package/ChartsRotationAxis/ChartsRotationAxis.mjs +135 -0
- package/ChartsRotationAxis/chartsRotationAxisClasses.d.mts +5 -0
- package/ChartsRotationAxis/chartsRotationAxisClasses.d.ts +5 -0
- package/ChartsRotationAxis/chartsRotationAxisClasses.js +29 -0
- package/ChartsRotationAxis/chartsRotationAxisClasses.mjs +16 -0
- package/ChartsRotationAxis/getLabelTransform.d.mts +11 -0
- package/ChartsRotationAxis/getLabelTransform.d.ts +11 -0
- package/ChartsRotationAxis/getLabelTransform.js +37 -0
- package/ChartsRotationAxis/getLabelTransform.mjs +31 -0
- package/ChartsRotationAxis/index.d.mts +2 -0
- package/ChartsRotationAxis/index.d.ts +2 -0
- package/ChartsRotationAxis/index.js +19 -0
- package/ChartsRotationAxis/index.mjs +2 -0
- package/ChartsTooltip/useAxesTooltip.js +7 -4
- package/ChartsTooltip/useAxesTooltip.mjs +8 -5
- package/ChartsTooltip/useItemTooltip.d.mts +1 -1
- package/ChartsTooltip/useItemTooltip.d.ts +1 -1
- package/ChartsTooltip/useItemTooltip.js +17 -2
- package/ChartsTooltip/useItemTooltip.mjs +18 -3
- package/ChartsXAxis/useAxisTicksProps.d.mts +652 -490
- package/ChartsXAxis/useAxisTicksProps.d.ts +652 -490
- package/ChartsYAxis/useAxisTicksProps.d.mts +652 -490
- package/ChartsYAxis/useAxisTicksProps.d.ts +652 -490
- package/LineChart/LineChart.js +27 -9
- package/LineChart/LineChart.mjs +27 -9
- package/LineChart/seriesConfig/curveEvaluation.js +24 -19
- package/LineChart/seriesConfig/curveEvaluation.mjs +24 -19
- package/LineChart/seriesConfig/getItemAtPosition.js +14 -3
- package/LineChart/seriesConfig/getItemAtPosition.mjs +14 -3
- package/LineChart/seriesConfig/getSeriesWithDefaultValues.js +4 -6
- package/LineChart/seriesConfig/getSeriesWithDefaultValues.mjs +4 -6
- package/LineChart/seriesConfig/seriesProcessor.d.mts +4 -2
- package/LineChart/seriesConfig/seriesProcessor.d.ts +4 -2
- package/LineChart/seriesConfig/seriesProcessor.js +39 -15
- package/LineChart/seriesConfig/seriesProcessor.mjs +39 -15
- package/RadarChart/RadarSeriesPlot/useRadarSeriesData.d.mts +2 -2
- package/RadarChart/RadarSeriesPlot/useRadarSeriesData.d.ts +2 -2
- package/ScatterChart/Scatter.d.mts +11 -0
- package/ScatterChart/Scatter.d.ts +11 -0
- package/ScatterChart/Scatter.js +11 -0
- package/ScatterChart/Scatter.mjs +14 -0
- package/ScatterChart/ScatterChart.js +29 -10
- package/ScatterChart/ScatterChart.mjs +29 -10
- package/ScatterChart/seriesConfig/seriesProcessor.js +9 -4
- package/ScatterChart/seriesConfig/seriesProcessor.mjs +9 -4
- package/SparkLineChart/SparkLineChart.js +27 -9
- package/SparkLineChart/SparkLineChart.mjs +27 -9
- package/hooks/useAxis.d.mts +2 -2
- package/hooks/useAxis.d.ts +2 -2
- package/hooks/useTicks.d.mts +1 -1
- package/hooks/useTicks.d.ts +1 -1
- package/hooks/useTicks.js +21 -3
- package/hooks/useTicks.mjs +21 -3
- package/index.d.mts +4 -0
- package/index.d.ts +4 -0
- package/index.js +46 -2
- package/index.mjs +5 -1
- package/internals/cubiqSolver.d.mts +5 -0
- package/internals/cubiqSolver.d.ts +5 -0
- package/internals/cubiqSolver.js +62 -0
- package/internals/cubiqSolver.mjs +56 -0
- package/internals/index.d.mts +5 -1
- package/internals/index.d.ts +5 -1
- package/internals/index.js +47 -2
- package/internals/index.mjs +5 -1
- package/internals/isPolar.d.mts +3 -2
- package/internals/isPolar.d.ts +3 -2
- package/internals/isPolar.js +4 -0
- package/internals/isPolar.mjs +3 -0
- package/internals/material/index.js +6 -1
- package/internals/material/index.mjs +6 -1
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/colorProcessor.types.d.mts +8 -9
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/colorProcessor.types.d.ts +8 -9
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +8 -12
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.mjs +8 -12
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.mts +1 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +1 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.d.mts +3 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.d.ts +3 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +29 -16
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.mjs +30 -17
- package/internals/plugins/featurePlugins/useChartPolarAxis/defaultizeAxis.js +3 -3
- package/internals/plugins/featurePlugins/useChartPolarAxis/defaultizeAxis.mjs +3 -3
- package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.mts +2 -2
- package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.ts +2 -2
- package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.js +3 -3
- package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.mjs +3 -3
- package/models/axis.d.mts +13 -2
- package/models/axis.d.ts +13 -2
- package/models/seriesType/bar.d.mts +21 -7
- package/models/seriesType/bar.d.ts +21 -7
- package/models/seriesType/common.d.mts +10 -0
- package/models/seriesType/common.d.ts +10 -0
- package/models/seriesType/composition.d.mts +3 -1
- package/models/seriesType/composition.d.ts +3 -1
- package/models/seriesType/composition.js +6 -2
- package/models/seriesType/composition.mjs +5 -1
- package/models/seriesType/index.d.mts +3 -3
- package/models/seriesType/index.d.ts +3 -3
- package/models/seriesType/index.js +0 -22
- package/models/seriesType/index.mjs +0 -2
- package/models/seriesType/line.d.mts +22 -8
- package/models/seriesType/line.d.ts +22 -8
- package/models/seriesType/scatter.d.mts +9 -0
- package/models/seriesType/scatter.d.ts +9 -0
- package/models/slots/chartsBaseSlotProps.d.mts +17 -0
- package/models/slots/chartsBaseSlotProps.d.ts +17 -0
- package/models/slots/chartsBaseSlots.d.mts +7 -1
- package/models/slots/chartsBaseSlots.d.ts +7 -1
- package/models/z-axis.d.mts +9 -0
- package/models/z-axis.d.ts +9 -0
- package/package.json +182 -126
- package/themeAugmentation/components.d.mts +4 -0
- package/themeAugmentation/components.d.ts +4 -0
- package/themeAugmentation/overrides.d.mts +2 -0
- package/themeAugmentation/overrides.d.ts +2 -0
- package/themeAugmentation/props.d.mts +2 -0
- package/themeAugmentation/props.d.ts +2 -0
- package/utils/epsilon.d.mts +1 -0
- package/utils/epsilon.d.ts +1 -0
- package/utils/epsilon.js +7 -0
- package/utils/epsilon.mjs +1 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cubic equation solver. Only returns real root between 0 and 1, which is the only case we care about for curve evaluation.
|
|
3
|
+
* From https://www.particleincell.com/2013/cubic-line-intersection/
|
|
4
|
+
*/
|
|
5
|
+
export function cubicRoots(P) {
|
|
6
|
+
const a = P[0];
|
|
7
|
+
const b = P[1];
|
|
8
|
+
const c = P[2];
|
|
9
|
+
const d = P[3];
|
|
10
|
+
if (a === 0) {
|
|
11
|
+
if (b === 0) {
|
|
12
|
+
if (c === 0) {
|
|
13
|
+
return []; // constant case
|
|
14
|
+
}
|
|
15
|
+
return [-d / c].filter(r => r >= 0 && r <= 1); // linear case
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// quadratic case
|
|
19
|
+
const discriminant = c * c - 4 * b * d;
|
|
20
|
+
if (discriminant < 0) {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
const sqrtDisc = Math.sqrt(discriminant);
|
|
24
|
+
return [(-c + sqrtDisc) / (2 * b), (-c - sqrtDisc) / (2 * b)].filter(r => r >= 0 && r <= 1);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// cubic case
|
|
28
|
+
|
|
29
|
+
const A = b / a;
|
|
30
|
+
const B = c / a;
|
|
31
|
+
const C = d / a;
|
|
32
|
+
const Q = (3 * B - Math.pow(A, 2)) / 9;
|
|
33
|
+
const R = (9 * A * B - 27 * C - 2 * Math.pow(A, 3)) / 54;
|
|
34
|
+
const D = Math.pow(Q, 3) + Math.pow(R, 2); // polynomial discriminant
|
|
35
|
+
|
|
36
|
+
const result = [];
|
|
37
|
+
if (D >= 0)
|
|
38
|
+
// complex or duplicate roots
|
|
39
|
+
{
|
|
40
|
+
const S = Math.sign(R + Math.sqrt(D)) * Math.pow(Math.abs(R + Math.sqrt(D)), 1 / 3);
|
|
41
|
+
const T = Math.sign(R - Math.sqrt(D)) * Math.pow(Math.abs(R - Math.sqrt(D)), 1 / 3);
|
|
42
|
+
result.push(-A / 3 + (S + T)); // real root
|
|
43
|
+
|
|
44
|
+
if (S - T !== 0) {
|
|
45
|
+
return result.filter(r => r >= 0 && r <= 1);
|
|
46
|
+
}
|
|
47
|
+
result.push(-A / 3 - (S + T) / 2); // real part of complex root
|
|
48
|
+
result.push(-A / 3 - (S + T) / 2); // real part of complex root
|
|
49
|
+
return result.filter(r => r >= 0 && r <= 1);
|
|
50
|
+
}
|
|
51
|
+
const th = Math.acos(R / Math.sqrt(-Math.pow(Q, 3)));
|
|
52
|
+
result.push(2 * Math.sqrt(-Q) * Math.cos(th / 3) - A / 3);
|
|
53
|
+
result.push(2 * Math.sqrt(-Q) * Math.cos((th + 2 * Math.PI) / 3) - A / 3);
|
|
54
|
+
result.push(2 * Math.sqrt(-Q) * Math.cos((th + 4 * Math.PI) / 3) - A / 3);
|
|
55
|
+
return result.filter(r => r >= 0 && r <= 1);
|
|
56
|
+
}
|
package/internals/index.d.mts
CHANGED
|
@@ -17,6 +17,7 @@ export { processBarDataForPlot } from "../BarChart/useBarPlotData.mjs";
|
|
|
17
17
|
export { useRadarChartProps } from "../RadarChart/useRadarChartProps.mjs";
|
|
18
18
|
export * from "../ChartsContainer/useChartsContainerProps.mjs";
|
|
19
19
|
export * from "../ChartsDataProvider/useChartsDataProviderProps.mjs";
|
|
20
|
+
export * from "../ChartsRadialDataProvider/useChartsRadialDataProviderProps.mjs";
|
|
20
21
|
export * from "./seriesSelectorOfType.mjs";
|
|
21
22
|
export { useSkipAnimation } from "../hooks/useSkipAnimation.mjs";
|
|
22
23
|
export { useRegisterPointerInteractions } from "./plugins/featurePlugins/shared/useRegisterPointerInteractions.mjs";
|
|
@@ -75,6 +76,8 @@ export * from "../context/ChartsProvider/index.mjs";
|
|
|
75
76
|
export * from "../context/ChartsSlotsContext.mjs";
|
|
76
77
|
export * from "../models/seriesType/config.mjs";
|
|
77
78
|
export * from "../models/seriesType/common.mjs";
|
|
79
|
+
export * from "../models/seriesType/line.mjs";
|
|
80
|
+
export * from "../models/seriesType/bar.mjs";
|
|
78
81
|
export * from "../models/z-axis.mjs";
|
|
79
82
|
export * from "../models/axis.mjs";
|
|
80
83
|
export * from "../models/seriesType/composition.mjs";
|
|
@@ -84,4 +87,5 @@ export * from "./createSvgIcon.mjs";
|
|
|
84
87
|
export * from "./constants.mjs";
|
|
85
88
|
export * from "./scales/index.mjs";
|
|
86
89
|
export * from "./identifierSerializer.mjs";
|
|
87
|
-
export * from "./identifierCleaner.mjs";
|
|
90
|
+
export * from "./identifierCleaner.mjs";
|
|
91
|
+
export { default as getLineItemAtPosition } from "../LineChart/seriesConfig/getItemAtPosition.mjs";
|
package/internals/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export { processBarDataForPlot } from "../BarChart/useBarPlotData.js";
|
|
|
17
17
|
export { useRadarChartProps } from "../RadarChart/useRadarChartProps.js";
|
|
18
18
|
export * from "../ChartsContainer/useChartsContainerProps.js";
|
|
19
19
|
export * from "../ChartsDataProvider/useChartsDataProviderProps.js";
|
|
20
|
+
export * from "../ChartsRadialDataProvider/useChartsRadialDataProviderProps.js";
|
|
20
21
|
export * from "./seriesSelectorOfType.js";
|
|
21
22
|
export { useSkipAnimation } from "../hooks/useSkipAnimation.js";
|
|
22
23
|
export { useRegisterPointerInteractions } from "./plugins/featurePlugins/shared/useRegisterPointerInteractions.js";
|
|
@@ -75,6 +76,8 @@ export * from "../context/ChartsProvider/index.js";
|
|
|
75
76
|
export * from "../context/ChartsSlotsContext.js";
|
|
76
77
|
export * from "../models/seriesType/config.js";
|
|
77
78
|
export * from "../models/seriesType/common.js";
|
|
79
|
+
export * from "../models/seriesType/line.js";
|
|
80
|
+
export * from "../models/seriesType/bar.js";
|
|
78
81
|
export * from "../models/z-axis.js";
|
|
79
82
|
export * from "../models/axis.js";
|
|
80
83
|
export * from "../models/seriesType/composition.js";
|
|
@@ -84,4 +87,5 @@ export * from "./createSvgIcon.js";
|
|
|
84
87
|
export * from "./constants.js";
|
|
85
88
|
export * from "./scales/index.js";
|
|
86
89
|
export * from "./identifierSerializer.js";
|
|
87
|
-
export * from "./identifierCleaner.js";
|
|
90
|
+
export * from "./identifierCleaner.js";
|
|
91
|
+
export { default as getLineItemAtPosition } from "../LineChart/seriesConfig/getItemAtPosition.js";
|
package/internals/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -25,7 +26,8 @@ var _exportNames = {
|
|
|
25
26
|
getBandSize: true,
|
|
26
27
|
useChartsTooltipUtilityClasses: true,
|
|
27
28
|
getChartsTooltipUtilityClass: true,
|
|
28
|
-
getAxisExtrema: true
|
|
29
|
+
getAxisExtrema: true,
|
|
30
|
+
getLineItemAtPosition: true
|
|
29
31
|
};
|
|
30
32
|
Object.defineProperty(exports, "checkBarChartScaleErrors", {
|
|
31
33
|
enumerable: true,
|
|
@@ -69,6 +71,12 @@ Object.defineProperty(exports, "getChartsTooltipUtilityClass", {
|
|
|
69
71
|
return _chartsTooltipClasses.getChartsTooltipUtilityClass;
|
|
70
72
|
}
|
|
71
73
|
});
|
|
74
|
+
Object.defineProperty(exports, "getLineItemAtPosition", {
|
|
75
|
+
enumerable: true,
|
|
76
|
+
get: function () {
|
|
77
|
+
return _getItemAtPosition.default;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
72
80
|
Object.defineProperty(exports, "getSeriesColorFn", {
|
|
73
81
|
enumerable: true,
|
|
74
82
|
get: function () {
|
|
@@ -266,6 +274,18 @@ Object.keys(_useChartsDataProviderProps).forEach(function (key) {
|
|
|
266
274
|
}
|
|
267
275
|
});
|
|
268
276
|
});
|
|
277
|
+
var _useChartsRadialDataProviderProps = require("../ChartsRadialDataProvider/useChartsRadialDataProviderProps");
|
|
278
|
+
Object.keys(_useChartsRadialDataProviderProps).forEach(function (key) {
|
|
279
|
+
if (key === "default" || key === "__esModule") return;
|
|
280
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
281
|
+
if (key in exports && exports[key] === _useChartsRadialDataProviderProps[key]) return;
|
|
282
|
+
Object.defineProperty(exports, key, {
|
|
283
|
+
enumerable: true,
|
|
284
|
+
get: function () {
|
|
285
|
+
return _useChartsRadialDataProviderProps[key];
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
});
|
|
269
289
|
var _seriesSelectorOfType = require("./seriesSelectorOfType");
|
|
270
290
|
Object.keys(_seriesSelectorOfType).forEach(function (key) {
|
|
271
291
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -852,6 +872,30 @@ Object.keys(_common).forEach(function (key) {
|
|
|
852
872
|
}
|
|
853
873
|
});
|
|
854
874
|
});
|
|
875
|
+
var _line = require("../models/seriesType/line");
|
|
876
|
+
Object.keys(_line).forEach(function (key) {
|
|
877
|
+
if (key === "default" || key === "__esModule") return;
|
|
878
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
879
|
+
if (key in exports && exports[key] === _line[key]) return;
|
|
880
|
+
Object.defineProperty(exports, key, {
|
|
881
|
+
enumerable: true,
|
|
882
|
+
get: function () {
|
|
883
|
+
return _line[key];
|
|
884
|
+
}
|
|
885
|
+
});
|
|
886
|
+
});
|
|
887
|
+
var _bar = require("../models/seriesType/bar");
|
|
888
|
+
Object.keys(_bar).forEach(function (key) {
|
|
889
|
+
if (key === "default" || key === "__esModule") return;
|
|
890
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
891
|
+
if (key in exports && exports[key] === _bar[key]) return;
|
|
892
|
+
Object.defineProperty(exports, key, {
|
|
893
|
+
enumerable: true,
|
|
894
|
+
get: function () {
|
|
895
|
+
return _bar[key];
|
|
896
|
+
}
|
|
897
|
+
});
|
|
898
|
+
});
|
|
855
899
|
var _zAxis = require("../models/z-axis");
|
|
856
900
|
Object.keys(_zAxis).forEach(function (key) {
|
|
857
901
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -971,4 +1015,5 @@ Object.keys(_identifierCleaner).forEach(function (key) {
|
|
|
971
1015
|
return _identifierCleaner[key];
|
|
972
1016
|
}
|
|
973
1017
|
});
|
|
974
|
-
});
|
|
1018
|
+
});
|
|
1019
|
+
var _getItemAtPosition = _interopRequireDefault(require("../LineChart/seriesConfig/getItemAtPosition"));
|
package/internals/index.mjs
CHANGED
|
@@ -20,6 +20,7 @@ export { processBarDataForPlot } from "../BarChart/useBarPlotData.mjs";
|
|
|
20
20
|
export { useRadarChartProps } from "../RadarChart/useRadarChartProps.mjs";
|
|
21
21
|
export * from "../ChartsContainer/useChartsContainerProps.mjs";
|
|
22
22
|
export * from "../ChartsDataProvider/useChartsDataProviderProps.mjs";
|
|
23
|
+
export * from "../ChartsRadialDataProvider/useChartsRadialDataProviderProps.mjs";
|
|
23
24
|
export * from "./seriesSelectorOfType.mjs";
|
|
24
25
|
export { useSkipAnimation } from "../hooks/useSkipAnimation.mjs";
|
|
25
26
|
export { useRegisterPointerInteractions } from "./plugins/featurePlugins/shared/useRegisterPointerInteractions.mjs";
|
|
@@ -88,6 +89,8 @@ export * from "../context/ChartsSlotsContext.mjs";
|
|
|
88
89
|
// series configuration
|
|
89
90
|
export * from "../models/seriesType/config.mjs";
|
|
90
91
|
export * from "../models/seriesType/common.mjs";
|
|
92
|
+
export * from "../models/seriesType/line.mjs";
|
|
93
|
+
export * from "../models/seriesType/bar.mjs";
|
|
91
94
|
export * from "../models/z-axis.mjs";
|
|
92
95
|
export * from "../models/axis.mjs";
|
|
93
96
|
export * from "../models/seriesType/composition.mjs";
|
|
@@ -97,4 +100,5 @@ export * from "./createSvgIcon.mjs";
|
|
|
97
100
|
export * from "./constants.mjs";
|
|
98
101
|
export * from "./scales/index.mjs";
|
|
99
102
|
export * from "./identifierSerializer.mjs";
|
|
100
|
-
export * from "./identifierCleaner.mjs";
|
|
103
|
+
export * from "./identifierCleaner.mjs";
|
|
104
|
+
export { default as getLineItemAtPosition } from "../LineChart/seriesConfig/getItemAtPosition.mjs";
|
package/internals/isPolar.d.mts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { type PolarChartSeriesType } from "../models/seriesType/config.mjs";
|
|
2
|
-
export declare function isPolarSeriesType(seriesType: string): seriesType is PolarChartSeriesType;
|
|
1
|
+
import { type ChartSeriesType, type ChartSeriesDefaultized, type PolarChartSeriesType } from "../models/seriesType/config.mjs";
|
|
2
|
+
export declare function isPolarSeriesType(seriesType: string): seriesType is PolarChartSeriesType;
|
|
3
|
+
export declare function isPolarSeries(series: ChartSeriesDefaultized<ChartSeriesType>): series is ChartSeriesDefaultized<PolarChartSeriesType>;
|
package/internals/isPolar.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { type PolarChartSeriesType } from "../models/seriesType/config.js";
|
|
2
|
-
export declare function isPolarSeriesType(seriesType: string): seriesType is PolarChartSeriesType;
|
|
1
|
+
import { type ChartSeriesType, type ChartSeriesDefaultized, type PolarChartSeriesType } from "../models/seriesType/config.js";
|
|
2
|
+
export declare function isPolarSeriesType(seriesType: string): seriesType is PolarChartSeriesType;
|
|
3
|
+
export declare function isPolarSeries(series: ChartSeriesDefaultized<ChartSeriesType>): series is ChartSeriesDefaultized<PolarChartSeriesType>;
|
package/internals/isPolar.js
CHANGED
|
@@ -3,8 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.isPolarSeries = isPolarSeries;
|
|
6
7
|
exports.isPolarSeriesType = isPolarSeriesType;
|
|
7
8
|
var _configInit = require("./configInit");
|
|
8
9
|
function isPolarSeriesType(seriesType) {
|
|
9
10
|
return _configInit.polarSeriesTypes.getTypes().has(seriesType);
|
|
11
|
+
}
|
|
12
|
+
function isPolarSeries(series) {
|
|
13
|
+
return isPolarSeriesType(series.type);
|
|
10
14
|
}
|
package/internals/isPolar.mjs
CHANGED
|
@@ -8,9 +8,14 @@ exports.defaultSlotsMaterial = void 0;
|
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
10
10
|
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
|
11
|
+
var _ToggleButton = _interopRequireDefault(require("@mui/material/ToggleButton"));
|
|
12
|
+
var _ToggleButtonGroup = _interopRequireDefault(require("@mui/material/ToggleButtonGroup"));
|
|
11
13
|
const baseSlots = {
|
|
12
14
|
baseButton: _Button.default,
|
|
13
|
-
baseIconButton: _IconButton.default
|
|
15
|
+
baseIconButton: _IconButton.default,
|
|
16
|
+
// MUI Toggle button has an `href` prop that is not compatible with our API.
|
|
17
|
+
baseToggleButton: _ToggleButton.default,
|
|
18
|
+
baseToggleButtonGroup: _ToggleButtonGroup.default
|
|
14
19
|
};
|
|
15
20
|
const iconSlots = {};
|
|
16
21
|
const defaultSlotsMaterial = exports.defaultSlotsMaterial = (0, _extends2.default)({}, baseSlots, iconSlots);
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import IconButton from '@mui/material/IconButton';
|
|
3
3
|
import Button from '@mui/material/Button';
|
|
4
|
+
import ToggleButton from '@mui/material/ToggleButton';
|
|
5
|
+
import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';
|
|
4
6
|
const baseSlots = {
|
|
5
7
|
baseButton: Button,
|
|
6
|
-
baseIconButton: IconButton
|
|
8
|
+
baseIconButton: IconButton,
|
|
9
|
+
// MUI Toggle button has an `href` prop that is not compatible with our API.
|
|
10
|
+
baseToggleButton: ToggleButton,
|
|
11
|
+
baseToggleButtonGroup: ToggleButtonGroup
|
|
7
12
|
};
|
|
8
13
|
const iconSlots = {};
|
|
9
14
|
export const defaultSlotsMaterial = _extends({}, baseSlots, iconSlots);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComputedXAxis, ComputedYAxis } from "../../../../../models/axis.mjs";
|
|
1
|
+
import type { ChartsRadiusAxisProps, ChartsRotationAxisProps, ComputedAxis, ComputedXAxis, ComputedYAxis, ScaleName } from "../../../../../models/axis.mjs";
|
|
2
2
|
import type { DefaultizedSeriesType } from "../../../../../models/seriesType/index.mjs";
|
|
3
3
|
import type { ZAxisDefaultized } from "../../../../../models/z-axis.mjs";
|
|
4
4
|
import type { ChartSeriesType } from "../../../../../models/seriesType/config.mjs";
|
|
@@ -7,13 +7,12 @@ import type { ChartSeriesType } from "../../../../../models/seriesType/config.mj
|
|
|
7
7
|
* If dataIndex is not defined, it falls back to the series color when defined.
|
|
8
8
|
*/
|
|
9
9
|
export type ColorGetter<SeriesType extends ChartSeriesType> = SeriesType extends 'pie' | 'funnel' ? (dataIndex: number) => string : SeriesType extends 'heatmap' ? (value: number | null) => string : (dataIndex?: number) => string;
|
|
10
|
+
export type ColorProcessor<SeriesType extends ChartSeriesType> = (series: DefaultizedSeriesType<SeriesType>,
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
-
* If dataIndex is not defined, it falls back to the series color.
|
|
13
|
-
* @param {DefaultizedSeriesType<SeriesType>} series - The series configuration.
|
|
14
|
-
* @param {ComputedXAxis | undefined} xAxis - The computed x-axis configuration.
|
|
15
|
-
* @param {ComputedYAxis | undefined} yAxis - The computed y-axis configuration.
|
|
16
|
-
* @param {ZAxisDefaultized | undefined} zAxis - The defaulted z-axis configuration.
|
|
17
|
-
* @returns {ColorGetter<SeriesType>} A function that takes a data index and returns a color string.
|
|
12
|
+
* Either the x-axis or rotation-axis, depending on the coordinate system.
|
|
18
13
|
*/
|
|
19
|
-
|
|
14
|
+
mainAxis?: ComputedXAxis | ComputedAxis<ScaleName, any, ChartsRotationAxisProps>,
|
|
15
|
+
/**
|
|
16
|
+
* Either the y-axis or radius-axis, depending on the coordinate system.
|
|
17
|
+
*/
|
|
18
|
+
secondaryAxis?: ComputedYAxis | ComputedAxis<ScaleName, any, ChartsRadiusAxisProps>, zAxis?: ZAxisDefaultized) => ColorGetter<SeriesType>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComputedXAxis, ComputedYAxis } from "../../../../../models/axis.js";
|
|
1
|
+
import type { ChartsRadiusAxisProps, ChartsRotationAxisProps, ComputedAxis, ComputedXAxis, ComputedYAxis, ScaleName } from "../../../../../models/axis.js";
|
|
2
2
|
import type { DefaultizedSeriesType } from "../../../../../models/seriesType/index.js";
|
|
3
3
|
import type { ZAxisDefaultized } from "../../../../../models/z-axis.js";
|
|
4
4
|
import type { ChartSeriesType } from "../../../../../models/seriesType/config.js";
|
|
@@ -7,13 +7,12 @@ import type { ChartSeriesType } from "../../../../../models/seriesType/config.js
|
|
|
7
7
|
* If dataIndex is not defined, it falls back to the series color when defined.
|
|
8
8
|
*/
|
|
9
9
|
export type ColorGetter<SeriesType extends ChartSeriesType> = SeriesType extends 'pie' | 'funnel' ? (dataIndex: number) => string : SeriesType extends 'heatmap' ? (value: number | null) => string : (dataIndex?: number) => string;
|
|
10
|
+
export type ColorProcessor<SeriesType extends ChartSeriesType> = (series: DefaultizedSeriesType<SeriesType>,
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
-
* If dataIndex is not defined, it falls back to the series color.
|
|
13
|
-
* @param {DefaultizedSeriesType<SeriesType>} series - The series configuration.
|
|
14
|
-
* @param {ComputedXAxis | undefined} xAxis - The computed x-axis configuration.
|
|
15
|
-
* @param {ComputedYAxis | undefined} yAxis - The computed y-axis configuration.
|
|
16
|
-
* @param {ZAxisDefaultized | undefined} zAxis - The defaulted z-axis configuration.
|
|
17
|
-
* @returns {ColorGetter<SeriesType>} A function that takes a data index and returns a color string.
|
|
12
|
+
* Either the x-axis or rotation-axis, depending on the coordinate system.
|
|
18
13
|
*/
|
|
19
|
-
|
|
14
|
+
mainAxis?: ComputedXAxis | ComputedAxis<ScaleName, any, ChartsRotationAxisProps>,
|
|
15
|
+
/**
|
|
16
|
+
* Either the y-axis or radius-axis, depending on the coordinate system.
|
|
17
|
+
*/
|
|
18
|
+
secondaryAxis?: ComputedYAxis | ComputedAxis<ScaleName, any, ChartsRadiusAxisProps>, zAxis?: ZAxisDefaultized) => ColorGetter<SeriesType>;
|
|
@@ -49,17 +49,15 @@ function defaultizeXAxis(inAxes, dataset, axesGap) {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
// If
|
|
53
|
-
if (dataKey === undefined
|
|
52
|
+
// If data is already provided or no dataset extraction is needed
|
|
53
|
+
if (axisConfig.data !== undefined || dataKey === undefined && !axisConfig.valueGetter) {
|
|
54
54
|
return sharedConfig;
|
|
55
55
|
}
|
|
56
56
|
if (dataset === undefined) {
|
|
57
|
-
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X Charts: The x-axis uses `dataKey` but no `dataset` is provided. ' + 'When using dataKey, a dataset must be provided to retrieve the axis data. ' + 'Either provide a dataset prop or use the data property directly on the x-axis.' : (0, _formatErrorMessage2.default)(37));
|
|
57
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X Charts: The x-axis uses `dataKey` or `valueGetter` but no `dataset` is provided. ' + 'When using dataKey or valueGetter, a dataset must be provided to retrieve the axis data. ' + 'Either provide a dataset prop or use the data property directly on the x-axis.' : (0, _formatErrorMessage2.default)(37));
|
|
58
58
|
}
|
|
59
|
-
|
|
60
|
-
// If `dataKey` is provided
|
|
61
59
|
return (0, _extends2.default)({}, sharedConfig, {
|
|
62
|
-
data: dataset.map(d => d[dataKey])
|
|
60
|
+
data: axisConfig.valueGetter ? dataset.map(d => axisConfig.valueGetter(d)) : dataset.map(d => d[dataKey])
|
|
63
61
|
});
|
|
64
62
|
});
|
|
65
63
|
return parsedAxes;
|
|
@@ -103,17 +101,15 @@ function defaultizeYAxis(inAxes, dataset, axesGap) {
|
|
|
103
101
|
}
|
|
104
102
|
}
|
|
105
103
|
|
|
106
|
-
// If
|
|
107
|
-
if (dataKey === undefined
|
|
104
|
+
// If data is already provided or no dataset extraction is needed
|
|
105
|
+
if (axisConfig.data !== undefined || dataKey === undefined && !axisConfig.valueGetter) {
|
|
108
106
|
return sharedConfig;
|
|
109
107
|
}
|
|
110
108
|
if (dataset === undefined) {
|
|
111
|
-
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X Charts: The y-axis uses `dataKey` but no `dataset` is provided. ' + 'When using dataKey, a dataset must be provided to retrieve the axis data. ' + 'Either provide a dataset prop or use the data property directly on the y-axis.' : (0, _formatErrorMessage2.default)(38));
|
|
109
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X Charts: The y-axis uses `dataKey` or `valueGetter` but no `dataset` is provided. ' + 'When using dataKey or valueGetter, a dataset must be provided to retrieve the axis data. ' + 'Either provide a dataset prop or use the data property directly on the y-axis.' : (0, _formatErrorMessage2.default)(38));
|
|
112
110
|
}
|
|
113
|
-
|
|
114
|
-
// If `dataKey` is provided
|
|
115
111
|
return (0, _extends2.default)({}, sharedConfig, {
|
|
116
|
-
data: dataset.map(d => d[dataKey])
|
|
112
|
+
data: axisConfig.valueGetter ? dataset.map(d => axisConfig.valueGetter(d)) : dataset.map(d => d[dataKey])
|
|
117
113
|
});
|
|
118
114
|
});
|
|
119
115
|
return parsedAxes;
|
|
@@ -41,17 +41,15 @@ export function defaultizeXAxis(inAxes, dataset, axesGap) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
// If
|
|
45
|
-
if (dataKey === undefined
|
|
44
|
+
// If data is already provided or no dataset extraction is needed
|
|
45
|
+
if (axisConfig.data !== undefined || dataKey === undefined && !axisConfig.valueGetter) {
|
|
46
46
|
return sharedConfig;
|
|
47
47
|
}
|
|
48
48
|
if (dataset === undefined) {
|
|
49
|
-
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X Charts: The x-axis uses `dataKey` but no `dataset` is provided. ' + 'When using dataKey, a dataset must be provided to retrieve the axis data. ' + 'Either provide a dataset prop or use the data property directly on the x-axis.' : _formatErrorMessage(37));
|
|
49
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X Charts: The x-axis uses `dataKey` or `valueGetter` but no `dataset` is provided. ' + 'When using dataKey or valueGetter, a dataset must be provided to retrieve the axis data. ' + 'Either provide a dataset prop or use the data property directly on the x-axis.' : _formatErrorMessage(37));
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
// If `dataKey` is provided
|
|
53
51
|
return _extends({}, sharedConfig, {
|
|
54
|
-
data: dataset.map(d => d[dataKey])
|
|
52
|
+
data: axisConfig.valueGetter ? dataset.map(d => axisConfig.valueGetter(d)) : dataset.map(d => d[dataKey])
|
|
55
53
|
});
|
|
56
54
|
});
|
|
57
55
|
return parsedAxes;
|
|
@@ -95,17 +93,15 @@ export function defaultizeYAxis(inAxes, dataset, axesGap) {
|
|
|
95
93
|
}
|
|
96
94
|
}
|
|
97
95
|
|
|
98
|
-
// If
|
|
99
|
-
if (dataKey === undefined
|
|
96
|
+
// If data is already provided or no dataset extraction is needed
|
|
97
|
+
if (axisConfig.data !== undefined || dataKey === undefined && !axisConfig.valueGetter) {
|
|
100
98
|
return sharedConfig;
|
|
101
99
|
}
|
|
102
100
|
if (dataset === undefined) {
|
|
103
|
-
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X Charts: The y-axis uses `dataKey` but no `dataset` is provided. ' + 'When using dataKey, a dataset must be provided to retrieve the axis data. ' + 'Either provide a dataset prop or use the data property directly on the y-axis.' : _formatErrorMessage(38));
|
|
101
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X Charts: The y-axis uses `dataKey` or `valueGetter` but no `dataset` is provided. ' + 'When using dataKey or valueGetter, a dataset must be provided to retrieve the axis data. ' + 'Either provide a dataset prop or use the data property directly on the y-axis.' : _formatErrorMessage(38));
|
|
104
102
|
}
|
|
105
|
-
|
|
106
|
-
// If `dataKey` is provided
|
|
107
103
|
return _extends({}, sharedConfig, {
|
|
108
|
-
data: dataset.map(d => d[dataKey])
|
|
104
|
+
data: axisConfig.valueGetter ? dataset.map(d => axisConfig.valueGetter(d)) : dataset.map(d => d[dataKey])
|
|
109
105
|
});
|
|
110
106
|
});
|
|
111
107
|
return parsedAxes;
|
|
@@ -83,6 +83,7 @@ export declare const selectorChartRawAxis: (args_0: import("../../corePlugins/us
|
|
|
83
83
|
id: AxisId;
|
|
84
84
|
data?: readonly any[] | undefined;
|
|
85
85
|
dataKey?: string;
|
|
86
|
+
valueGetter?: ((item: import("../../../index.mjs").DatasetElementType<unknown>) => any) | undefined;
|
|
86
87
|
valueFormatter?: (<TScaleName extends keyof import("../../../index.mjs").AxisScaleConfig>(value: any, context: import("../../../index.mjs").AxisValueFormatterContext<TScaleName>) => string) | undefined;
|
|
87
88
|
hideTooltip?: boolean;
|
|
88
89
|
reverse?: boolean;
|
|
@@ -83,6 +83,7 @@ export declare const selectorChartRawAxis: (args_0: import("../../corePlugins/us
|
|
|
83
83
|
id: AxisId;
|
|
84
84
|
data?: readonly any[] | undefined;
|
|
85
85
|
dataKey?: string;
|
|
86
|
+
valueGetter?: ((item: import("../../../index.js").DatasetElementType<unknown>) => any) | undefined;
|
|
86
87
|
valueFormatter?: (<TScaleName extends keyof import("../../../index.js").AxisScaleConfig>(value: any, context: import("../../../index.js").AxisValueFormatterContext<TScaleName>) => string) | undefined;
|
|
87
88
|
hideTooltip?: boolean;
|
|
88
89
|
reverse?: boolean;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AxisConfig, ScaleName } from "../../../../models/index.mjs";
|
|
2
2
|
import { type ChartsAxisProps, type ChartsRotationAxisProps, type ChartsRadiusAxisProps, type PolarAxisDefaultized, type AxisId } from "../../../../models/axis.mjs";
|
|
3
3
|
import { type ChartSeriesType } from "../../../../models/seriesType/config.mjs";
|
|
4
4
|
import type { ChartDrawingArea } from "../../../../hooks/index.mjs";
|
|
5
5
|
import { type ChartSeriesConfig } from "../../corePlugins/useChartSeriesConfig/index.mjs";
|
|
6
6
|
import { type ProcessedSeries } from "../../corePlugins/useChartSeries/useChartSeries.types.mjs";
|
|
7
|
+
import { type ComputedAxisConfig } from "../useChartCartesianAxis/index.mjs";
|
|
7
8
|
export type DefaultizedAxisConfig<AxisProps extends ChartsRotationAxisProps | ChartsRadiusAxisProps> = {
|
|
8
9
|
[axisId: AxisId]: PolarAxisDefaultized<ScaleName, any, AxisProps>;
|
|
9
10
|
};
|
|
10
11
|
export type ComputeResult<T extends ChartsAxisProps> = {
|
|
11
|
-
axis:
|
|
12
|
+
axis: ComputedAxisConfig<T>;
|
|
12
13
|
axisIds: string[];
|
|
13
14
|
};
|
|
14
15
|
type ComputeCommonParams<SeriesType extends ChartSeriesType = ChartSeriesType> = {
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AxisConfig, ScaleName } from "../../../../models/index.js";
|
|
2
2
|
import { type ChartsAxisProps, type ChartsRotationAxisProps, type ChartsRadiusAxisProps, type PolarAxisDefaultized, type AxisId } from "../../../../models/axis.js";
|
|
3
3
|
import { type ChartSeriesType } from "../../../../models/seriesType/config.js";
|
|
4
4
|
import type { ChartDrawingArea } from "../../../../hooks/index.js";
|
|
5
5
|
import { type ChartSeriesConfig } from "../../corePlugins/useChartSeriesConfig/index.js";
|
|
6
6
|
import { type ProcessedSeries } from "../../corePlugins/useChartSeries/useChartSeries.types.js";
|
|
7
|
+
import { type ComputedAxisConfig } from "../useChartCartesianAxis/index.js";
|
|
7
8
|
export type DefaultizedAxisConfig<AxisProps extends ChartsRotationAxisProps | ChartsRadiusAxisProps> = {
|
|
8
9
|
[axisId: AxisId]: PolarAxisDefaultized<ScaleName, any, AxisProps>;
|
|
9
10
|
};
|
|
10
11
|
export type ComputeResult<T extends ChartsAxisProps> = {
|
|
11
|
-
axis:
|
|
12
|
+
axis: ComputedAxisConfig<T>;
|
|
12
13
|
axisIds: string[];
|
|
13
14
|
};
|
|
14
15
|
type ComputeCommonParams<SeriesType extends ChartSeriesType = ChartSeriesType> = {
|
|
@@ -15,20 +15,26 @@ var _getAxisExtremum = require("./getAxisExtremum");
|
|
|
15
15
|
var _angleConversion = require("../../../angleConversion");
|
|
16
16
|
var _getAxisTriggerTooltip = require("./getAxisTriggerTooltip");
|
|
17
17
|
var _scales = require("../../../scales");
|
|
18
|
+
var _epsilon = require("../../../../utils/epsilon");
|
|
18
19
|
function getRange(drawingArea, axisDirection, axis) {
|
|
19
20
|
if (axisDirection === 'rotation') {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
return angles;
|
|
21
|
+
const angles = [(0, _angleConversion.deg2rad)(axis.startAngle, 0), (0, _angleConversion.deg2rad)(axis.endAngle, 2 * Math.PI)];
|
|
22
|
+
const diff = angles[1] - angles[0];
|
|
23
|
+
const isFullCircle = diff >= Math.PI * 2 - _epsilon.EPSILON;
|
|
24
|
+
if (axis.scaleType === 'point' && isFullCircle) {
|
|
25
|
+
// For point scale, remove a slice to avoid overlapping first and last points.
|
|
26
|
+
angles[1] -= diff / axis.data.length;
|
|
28
27
|
}
|
|
29
|
-
return
|
|
28
|
+
return {
|
|
29
|
+
range: angles,
|
|
30
|
+
isFullCircle
|
|
31
|
+
};
|
|
30
32
|
}
|
|
31
|
-
|
|
33
|
+
const availableRadius = Math.min(drawingArea.height, drawingArea.width) / 2;
|
|
34
|
+
return {
|
|
35
|
+
range: [axis.minRadius ?? 0, axis.maxRadius ?? availableRadius],
|
|
36
|
+
isFullCircle: false
|
|
37
|
+
};
|
|
32
38
|
}
|
|
33
39
|
const DEFAULT_CATEGORY_GAP_RATIO = 0.2;
|
|
34
40
|
const DEFAULT_BAR_GAP_RATIO = 0.1;
|
|
@@ -49,7 +55,10 @@ function computeAxisValue({
|
|
|
49
55
|
const completeAxis = {};
|
|
50
56
|
allAxis.forEach((eachAxis, axisIndex) => {
|
|
51
57
|
const axis = eachAxis;
|
|
52
|
-
const
|
|
58
|
+
const {
|
|
59
|
+
range,
|
|
60
|
+
isFullCircle
|
|
61
|
+
} = getRange(drawingArea, axisDirection, axis);
|
|
53
62
|
const [minData, maxData] = (0, _getAxisExtremum.getAxisExtremum)(axis, axisDirection, seriesConfig, axisIndex, formattedSeries);
|
|
54
63
|
const triggerTooltip = !axis.ignoreTooltip && axisIdsTriggeringTooltip.has(axis.id);
|
|
55
64
|
const data = axis.data ?? [];
|
|
@@ -67,7 +76,8 @@ function computeAxisValue({
|
|
|
67
76
|
tickNumber: axis.data.length,
|
|
68
77
|
colorScale: axis.colorMap && (axis.colorMap.type === 'ordinal' ? (0, _colorScale.getOrdinalColorScale)((0, _extends2.default)({
|
|
69
78
|
values: axis.data
|
|
70
|
-
}, axis.colorMap)) : (0, _colorScale.getColorScale)(axis.colorMap))
|
|
79
|
+
}, axis.colorMap)) : (0, _colorScale.getColorScale)(axis.colorMap)),
|
|
80
|
+
isFullCircle
|
|
71
81
|
});
|
|
72
82
|
if ((0, _dateHelpers.isDateData)(axis.data)) {
|
|
73
83
|
const dateFormatter = (0, _dateHelpers.createDateFormatter)(axis.data, range, axis.tickNumber);
|
|
@@ -84,7 +94,8 @@ function computeAxisValue({
|
|
|
84
94
|
tickNumber: axis.data.length,
|
|
85
95
|
colorScale: axis.colorMap && (axis.colorMap.type === 'ordinal' ? (0, _colorScale.getOrdinalColorScale)((0, _extends2.default)({
|
|
86
96
|
values: axis.data
|
|
87
|
-
}, axis.colorMap)) : (0, _colorScale.getColorScale)(axis.colorMap))
|
|
97
|
+
}, axis.colorMap)) : (0, _colorScale.getColorScale)(axis.colorMap)),
|
|
98
|
+
isFullCircle
|
|
88
99
|
});
|
|
89
100
|
if ((0, _dateHelpers.isDateData)(axis.data)) {
|
|
90
101
|
const dateFormatter = (0, _dateHelpers.createDateFormatter)(axis.data, range, axis.tickNumber);
|
|
@@ -106,10 +117,12 @@ function computeAxisValue({
|
|
|
106
117
|
axisExtremums[0] = min;
|
|
107
118
|
axisExtremums[1] = max;
|
|
108
119
|
}
|
|
109
|
-
|
|
110
|
-
|
|
120
|
+
|
|
121
|
+
// Use degrees to display more ticks by default
|
|
122
|
+
const ratio = axisDirection === 'rotation' ? 180 / 3 : 1;
|
|
123
|
+
const tickNumber = axis.tickNumber ?? (0, _ticks.getTickNumber)(axis, axisExtremums, (0, _ticks.getDefaultTickNumber)(ratio * Math.abs(range[1] - range[0])));
|
|
111
124
|
const scale = (0, _getScale.getScale)(scaleType, axisExtremums, range);
|
|
112
|
-
const finalScale = domainLimit === 'nice' ? scale.nice(
|
|
125
|
+
const finalScale = domainLimit === 'nice' ? scale.nice(tickNumber) : scale;
|
|
113
126
|
const [minDomain, maxDomain] = finalScale.domain();
|
|
114
127
|
const domain = [axis.min ?? minDomain, axis.max ?? maxDomain];
|
|
115
128
|
completeAxis[axis.id] = (0, _extends2.default)({
|