@mui/x-charts 9.0.2 → 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 +2 -1
- package/BarChart/BarChart.mjs +2 -1
- package/BarChart/BarPlot.js +2 -1
- package/BarChart/BarPlot.mjs +2 -1
- package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.mts +8 -8
- package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +8 -8
- package/CHANGELOG.md +136 -0
- package/ChartsRadialGrid/ChartsRadialGrid.js +2 -0
- package/ChartsRadialGrid/ChartsRadialGrid.mjs +2 -0
- package/ChartsRadialGrid/ChartsRadiusGrid.d.mts +1 -0
- package/ChartsRadialGrid/ChartsRadiusGrid.d.ts +1 -0
- package/ChartsRadialGrid/ChartsRadiusGrid.js +1 -2
- package/ChartsRadialGrid/ChartsRadiusGrid.mjs +1 -2
- 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 +245 -164
- package/ChartsXAxis/useAxisTicksProps.d.ts +245 -164
- package/ChartsYAxis/useAxisTicksProps.d.mts +245 -164
- package/ChartsYAxis/useAxisTicksProps.d.ts +245 -164
- 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 +2 -2
- package/LineChart/seriesConfig/seriesProcessor.mjs +2 -2
- package/RadarChart/RadarSeriesPlot/useRadarSeriesData.d.mts +2 -2
- package/RadarChart/RadarSeriesPlot/useRadarSeriesData.d.ts +2 -2
- package/hooks/useAxis.d.mts +2 -2
- package/hooks/useAxis.d.ts +2 -2
- package/index.d.mts +2 -0
- package/index.d.ts +2 -0
- package/index.js +22 -2
- package/index.mjs +3 -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/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/useChartPolarAxis/computeAxisValue.d.mts +3 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.d.ts +3 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +23 -13
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.mjs +23 -13
- package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.mts +2 -2
- package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.ts +2 -2
- package/models/axis.d.mts +2 -0
- package/models/axis.d.ts +2 -0
- package/models/seriesType/bar.d.mts +12 -7
- package/models/seriesType/bar.d.ts +12 -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 +13 -8
- package/models/seriesType/line.d.ts +13 -8
- package/package.json +161 -133
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.evaluateCurveY = evaluateCurveY;
|
|
7
7
|
var _getCurve = require("../../internals/getCurve");
|
|
8
|
+
var _cubiqSolver = require("../../internals/cubiqSolver");
|
|
8
9
|
/**
|
|
9
10
|
* A straight line segment.
|
|
10
11
|
*/
|
|
@@ -63,8 +64,15 @@ function cubicBezier(t, p0, p1, p2, p3) {
|
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
67
|
+
* Get polynomials coefficient of a cubic Bezier curve.
|
|
68
|
+
* P(t) = rep[0] * t**3 + rep[1] * t**2 + rep[2] * t + rep[3]
|
|
69
|
+
*/
|
|
70
|
+
function cubicBezierCoeffs(p0, p1, p2, p3) {
|
|
71
|
+
return [-p0 + 3 * p1 - 3 * p2 + p3, 3 * p0 - 6 * p1 + 3 * p2, -3 * p0 + 3 * p1, p0];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Find parameter t such that the segment's x(t) ≈ targetX
|
|
68
76
|
*/
|
|
69
77
|
function findTForX(segment, targetX) {
|
|
70
78
|
if (!isBezierSegment(segment)) {
|
|
@@ -72,23 +80,14 @@ function findTForX(segment, targetX) {
|
|
|
72
80
|
const dx = segment.x1 - segment.x0;
|
|
73
81
|
return dx === 0 ? 0 : (targetX - segment.x0) / dx;
|
|
74
82
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const x = cubicBezier(mid, segment.x0, segment.cpx1, segment.cpx2, segment.x1);
|
|
82
|
-
if (x < targetX) {
|
|
83
|
-
lo = mid;
|
|
84
|
-
} else {
|
|
85
|
-
hi = mid;
|
|
86
|
-
}
|
|
87
|
-
if (Math.abs(x - targetX) < 1) {
|
|
88
|
-
return (lo + hi) / 2;
|
|
89
|
-
}
|
|
83
|
+
const xBezierCoeffs = cubicBezierCoeffs(segment.x0, segment.cpx1, segment.cpx2, segment.x1);
|
|
84
|
+
const polyToSolve = [...xBezierCoeffs];
|
|
85
|
+
polyToSolve[3] -= targetX;
|
|
86
|
+
const roots = (0, _cubiqSolver.cubicRoots)(polyToSolve);
|
|
87
|
+
if (roots.length > 0) {
|
|
88
|
+
return roots[0];
|
|
90
89
|
}
|
|
91
|
-
return
|
|
90
|
+
return -1;
|
|
92
91
|
}
|
|
93
92
|
|
|
94
93
|
/** Evaluate the segment's y at parameter t. */
|
|
@@ -123,9 +122,15 @@ function evaluateCurveY(points, targetX, curveType) {
|
|
|
123
122
|
|
|
124
123
|
// Find the segment containing targetX.
|
|
125
124
|
for (const segment of capture.segments) {
|
|
125
|
+
if (targetX < segment.x0 + 0.5 && targetX > segment.x0 - 0.5) {
|
|
126
|
+
return segment.y0;
|
|
127
|
+
}
|
|
128
|
+
if (targetX < segment.x1 + 0.5 && targetX > segment.x1 - 0.5) {
|
|
129
|
+
return segment.y1;
|
|
130
|
+
}
|
|
126
131
|
const xMin = Math.min(segment.x0, segment.x1);
|
|
127
132
|
const xMax = Math.max(segment.x0, segment.x1);
|
|
128
|
-
if (targetX >= xMin
|
|
133
|
+
if (targetX >= xMin && targetX <= xMax) {
|
|
129
134
|
const t = findTForX(segment, targetX);
|
|
130
135
|
return evaluateSegmentY(segment, t);
|
|
131
136
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getCurveFactory } from "../../internals/getCurve.mjs";
|
|
2
|
+
import { cubicRoots } from "../../internals/cubiqSolver.mjs";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* A straight line segment.
|
|
@@ -58,8 +59,15 @@ function cubicBezier(t, p0, p1, p2, p3) {
|
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
62
|
+
* Get polynomials coefficient of a cubic Bezier curve.
|
|
63
|
+
* P(t) = rep[0] * t**3 + rep[1] * t**2 + rep[2] * t + rep[3]
|
|
64
|
+
*/
|
|
65
|
+
function cubicBezierCoeffs(p0, p1, p2, p3) {
|
|
66
|
+
return [-p0 + 3 * p1 - 3 * p2 + p3, 3 * p0 - 6 * p1 + 3 * p2, -3 * p0 + 3 * p1, p0];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Find parameter t such that the segment's x(t) ≈ targetX
|
|
63
71
|
*/
|
|
64
72
|
function findTForX(segment, targetX) {
|
|
65
73
|
if (!isBezierSegment(segment)) {
|
|
@@ -67,23 +75,14 @@ function findTForX(segment, targetX) {
|
|
|
67
75
|
const dx = segment.x1 - segment.x0;
|
|
68
76
|
return dx === 0 ? 0 : (targetX - segment.x0) / dx;
|
|
69
77
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const x = cubicBezier(mid, segment.x0, segment.cpx1, segment.cpx2, segment.x1);
|
|
77
|
-
if (x < targetX) {
|
|
78
|
-
lo = mid;
|
|
79
|
-
} else {
|
|
80
|
-
hi = mid;
|
|
81
|
-
}
|
|
82
|
-
if (Math.abs(x - targetX) < 1) {
|
|
83
|
-
return (lo + hi) / 2;
|
|
84
|
-
}
|
|
78
|
+
const xBezierCoeffs = cubicBezierCoeffs(segment.x0, segment.cpx1, segment.cpx2, segment.x1);
|
|
79
|
+
const polyToSolve = [...xBezierCoeffs];
|
|
80
|
+
polyToSolve[3] -= targetX;
|
|
81
|
+
const roots = cubicRoots(polyToSolve);
|
|
82
|
+
if (roots.length > 0) {
|
|
83
|
+
return roots[0];
|
|
85
84
|
}
|
|
86
|
-
return
|
|
85
|
+
return -1;
|
|
87
86
|
}
|
|
88
87
|
|
|
89
88
|
/** Evaluate the segment's y at parameter t. */
|
|
@@ -118,9 +117,15 @@ export function evaluateCurveY(points, targetX, curveType) {
|
|
|
118
117
|
|
|
119
118
|
// Find the segment containing targetX.
|
|
120
119
|
for (const segment of capture.segments) {
|
|
120
|
+
if (targetX < segment.x0 + 0.5 && targetX > segment.x0 - 0.5) {
|
|
121
|
+
return segment.y0;
|
|
122
|
+
}
|
|
123
|
+
if (targetX < segment.x1 + 0.5 && targetX > segment.x1 - 0.5) {
|
|
124
|
+
return segment.y1;
|
|
125
|
+
}
|
|
121
126
|
const xMin = Math.min(segment.x0, segment.x1);
|
|
122
127
|
const xMax = Math.max(segment.x0, segment.x1);
|
|
123
|
-
if (targetX >= xMin
|
|
128
|
+
if (targetX >= xMin && targetX <= xMax) {
|
|
124
129
|
const t = findTForX(segment, targetX);
|
|
125
130
|
return evaluateSegmentY(segment, t);
|
|
126
131
|
}
|
|
@@ -28,8 +28,15 @@ function getBracketIndices(xAxis, pointX) {
|
|
|
28
28
|
if (index === -1) {
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const axisPointValue = (0, _getValueToPositionMapper.getValueToPositionMapper)(xAxis.scale)(axisData[index]);
|
|
32
|
+
if (axisPointValue <= pointX) {
|
|
33
|
+
return index === axisData.length - 1 ? null : {
|
|
34
|
+
left: index,
|
|
35
|
+
right: index + 1
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return index === 0 ? null : {
|
|
39
|
+
left: index - 1,
|
|
33
40
|
right: index
|
|
34
41
|
};
|
|
35
42
|
}
|
|
@@ -53,7 +60,11 @@ function getBracketIndices(xAxis, pointX) {
|
|
|
53
60
|
return null;
|
|
54
61
|
}
|
|
55
62
|
if (leftIndex === axisData.length - 1) {
|
|
56
|
-
|
|
63
|
+
if (getAsNumber(axisData[leftIndex]) < xAsNumber) {
|
|
64
|
+
// Pointer is strictly past the last data point — out of range.
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
// Pointer is exactly on the last data point.
|
|
57
68
|
return {
|
|
58
69
|
left: leftIndex,
|
|
59
70
|
right: leftIndex
|
|
@@ -23,8 +23,15 @@ function getBracketIndices(xAxis, pointX) {
|
|
|
23
23
|
if (index === -1) {
|
|
24
24
|
return null;
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
const axisPointValue = getValueToPositionMapper(xAxis.scale)(axisData[index]);
|
|
27
|
+
if (axisPointValue <= pointX) {
|
|
28
|
+
return index === axisData.length - 1 ? null : {
|
|
29
|
+
left: index,
|
|
30
|
+
right: index + 1
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return index === 0 ? null : {
|
|
34
|
+
left: index - 1,
|
|
28
35
|
right: index
|
|
29
36
|
};
|
|
30
37
|
}
|
|
@@ -48,7 +55,11 @@ function getBracketIndices(xAxis, pointX) {
|
|
|
48
55
|
return null;
|
|
49
56
|
}
|
|
50
57
|
if (leftIndex === axisData.length - 1) {
|
|
51
|
-
|
|
58
|
+
if (getAsNumber(axisData[leftIndex]) < xAsNumber) {
|
|
59
|
+
// Pointer is strictly past the last data point — out of range.
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
// Pointer is exactly on the last data point.
|
|
52
63
|
return {
|
|
53
64
|
left: leftIndex,
|
|
54
65
|
right: leftIndex
|
|
@@ -6,10 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
const getSeriesWithDefaultValues = (seriesData, seriesIndex, colors) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
});
|
|
14
|
-
};
|
|
9
|
+
const getSeriesWithDefaultValues = (seriesData, seriesIndex, colors) => (0, _extends2.default)({}, seriesData, {
|
|
10
|
+
id: seriesData.id ?? `auto-generated-id-${seriesIndex}`,
|
|
11
|
+
color: seriesData.color ?? colors[seriesIndex % colors.length]
|
|
12
|
+
});
|
|
15
13
|
var _default = exports.default = getSeriesWithDefaultValues;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
const getSeriesWithDefaultValues = (seriesData, seriesIndex, colors) => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
});
|
|
7
|
-
};
|
|
2
|
+
const getSeriesWithDefaultValues = (seriesData, seriesIndex, colors) => _extends({}, seriesData, {
|
|
3
|
+
id: seriesData.id ?? `auto-generated-id-${seriesIndex}`,
|
|
4
|
+
color: seriesData.color ?? colors[seriesIndex % colors.length]
|
|
5
|
+
});
|
|
8
6
|
export default getSeriesWithDefaultValues;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
1
|
+
import { type DatasetType } from "../../models/seriesType/config.mjs";
|
|
2
|
+
import type { SeriesProcessorParams, SeriesProcessorResult } from "../../internals/plugins/corePlugins/useChartSeriesConfig/index.mjs";
|
|
3
|
+
import type { IsItemVisibleFunction } from "../../internals/plugins/featurePlugins/useChartVisibilityManager/index.mjs";
|
|
4
|
+
declare function seriesProcessor(params: SeriesProcessorParams<'line'>, dataset?: Readonly<DatasetType>, isItemVisible?: IsItemVisibleFunction): SeriesProcessorResult<'line'>;
|
|
3
5
|
export default seriesProcessor;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
1
|
+
import { type DatasetType } from "../../models/seriesType/config.js";
|
|
2
|
+
import type { SeriesProcessorParams, SeriesProcessorResult } from "../../internals/plugins/corePlugins/useChartSeriesConfig/index.js";
|
|
3
|
+
import type { IsItemVisibleFunction } from "../../internals/plugins/featurePlugins/useChartVisibilityManager/index.js";
|
|
4
|
+
declare function seriesProcessor(params: SeriesProcessorParams<'line'>, dataset?: Readonly<DatasetType>, isItemVisible?: IsItemVisibleFunction): SeriesProcessorResult<'line'>;
|
|
3
5
|
export default seriesProcessor;
|
|
@@ -12,7 +12,7 @@ var _warning = require("@mui/x-internals/warning");
|
|
|
12
12
|
var _stacking = require("../../internals/stacking");
|
|
13
13
|
const defaultShapes = ['circle', 'square', 'diamond', 'cross', 'star', 'triangle', 'wye'];
|
|
14
14
|
const lineValueFormatter = v => v == null ? '' : v.toLocaleString();
|
|
15
|
-
|
|
15
|
+
function seriesProcessor(params, dataset, isItemVisible) {
|
|
16
16
|
const {
|
|
17
17
|
seriesOrder,
|
|
18
18
|
series
|
|
@@ -138,5 +138,5 @@ Line plots only support numeric and null values.`);
|
|
|
138
138
|
stackingGroups,
|
|
139
139
|
series: completedSeries
|
|
140
140
|
};
|
|
141
|
-
}
|
|
141
|
+
}
|
|
142
142
|
var _default = exports.default = seriesProcessor;
|
|
@@ -5,7 +5,7 @@ import { warnOnce } from '@mui/x-internals/warning';
|
|
|
5
5
|
import { getStackingGroups } from "../../internals/stacking/index.mjs";
|
|
6
6
|
const defaultShapes = ['circle', 'square', 'diamond', 'cross', 'star', 'triangle', 'wye'];
|
|
7
7
|
const lineValueFormatter = v => v == null ? '' : v.toLocaleString();
|
|
8
|
-
|
|
8
|
+
function seriesProcessor(params, dataset, isItemVisible) {
|
|
9
9
|
const {
|
|
10
10
|
seriesOrder,
|
|
11
11
|
series
|
|
@@ -131,5 +131,5 @@ Line plots only support numeric and null values.`);
|
|
|
131
131
|
stackingGroups,
|
|
132
132
|
series: completedSeries
|
|
133
133
|
};
|
|
134
|
-
}
|
|
134
|
+
}
|
|
135
135
|
export default seriesProcessor;
|
|
@@ -19,14 +19,14 @@ export declare function useRadarSeriesData(querySeriesId?: SeriesId): {
|
|
|
19
19
|
}[];
|
|
20
20
|
hidden: boolean;
|
|
21
21
|
type: "radar";
|
|
22
|
-
label?: string | ((location: "tooltip" | "legend") => string) | undefined;
|
|
23
22
|
highlightScope?: import("../../internals/index.mjs").CommonHighlightScope | undefined;
|
|
24
23
|
labelMarkType?: import("../../internals/index.mjs").ChartsLabelMarkType | undefined;
|
|
25
24
|
colorGetter?: ((data: import("../../internals/index.mjs").ColorCallbackValue<number>) => string) | undefined;
|
|
25
|
+
label?: string | ((location: "tooltip" | "legend") => string) | undefined;
|
|
26
26
|
hideMark?: boolean | undefined;
|
|
27
27
|
fillArea?: boolean | undefined;
|
|
28
|
-
data: number[];
|
|
29
28
|
id: SeriesId;
|
|
30
29
|
valueFormatter: import("../../internals/index.mjs").SeriesValueFormatter<number>;
|
|
31
30
|
color: string;
|
|
31
|
+
data: number[];
|
|
32
32
|
}[];
|
|
@@ -19,14 +19,14 @@ export declare function useRadarSeriesData(querySeriesId?: SeriesId): {
|
|
|
19
19
|
}[];
|
|
20
20
|
hidden: boolean;
|
|
21
21
|
type: "radar";
|
|
22
|
-
label?: string | ((location: "tooltip" | "legend") => string) | undefined;
|
|
23
22
|
highlightScope?: import("../../internals/index.js").CommonHighlightScope | undefined;
|
|
24
23
|
labelMarkType?: import("../../internals/index.js").ChartsLabelMarkType | undefined;
|
|
25
24
|
colorGetter?: ((data: import("../../internals/index.js").ColorCallbackValue<number>) => string) | undefined;
|
|
25
|
+
label?: string | ((location: "tooltip" | "legend") => string) | undefined;
|
|
26
26
|
hideMark?: boolean | undefined;
|
|
27
27
|
fillArea?: boolean | undefined;
|
|
28
|
-
data: number[];
|
|
29
28
|
id: SeriesId;
|
|
30
29
|
valueFormatter: import("../../internals/index.js").SeriesValueFormatter<number>;
|
|
31
30
|
color: string;
|
|
31
|
+
data: number[];
|
|
32
32
|
}[];
|
package/hooks/useAxis.d.mts
CHANGED
|
@@ -87,7 +87,7 @@ export declare function useYAxis<T extends keyof AxisScaleConfig>(axisId?: AxisI
|
|
|
87
87
|
* @see `useRotationAxis` for accessing a single rotation axis
|
|
88
88
|
*/
|
|
89
89
|
export declare function useRotationAxes(): {
|
|
90
|
-
rotationAxis: import("../internals/
|
|
90
|
+
rotationAxis: import("../internals/index.mjs").ComputedAxisConfig<ChartsRotationAxisProps>;
|
|
91
91
|
rotationAxisIds: string[];
|
|
92
92
|
};
|
|
93
93
|
/**
|
|
@@ -106,7 +106,7 @@ export declare function useRotationAxes(): {
|
|
|
106
106
|
* @see `useRadiusAxis` for accessing a single radius axis
|
|
107
107
|
*/
|
|
108
108
|
export declare function useRadiusAxes(): {
|
|
109
|
-
radiusAxis: import("../internals/
|
|
109
|
+
radiusAxis: import("../internals/index.mjs").ComputedAxisConfig<ChartsRadiusAxisProps>;
|
|
110
110
|
radiusAxisIds: string[];
|
|
111
111
|
};
|
|
112
112
|
/**
|
package/hooks/useAxis.d.ts
CHANGED
|
@@ -87,7 +87,7 @@ export declare function useYAxis<T extends keyof AxisScaleConfig>(axisId?: AxisI
|
|
|
87
87
|
* @see `useRotationAxis` for accessing a single rotation axis
|
|
88
88
|
*/
|
|
89
89
|
export declare function useRotationAxes(): {
|
|
90
|
-
rotationAxis: import("../internals/
|
|
90
|
+
rotationAxis: import("../internals/index.js").ComputedAxisConfig<ChartsRotationAxisProps>;
|
|
91
91
|
rotationAxisIds: string[];
|
|
92
92
|
};
|
|
93
93
|
/**
|
|
@@ -106,7 +106,7 @@ export declare function useRotationAxes(): {
|
|
|
106
106
|
* @see `useRadiusAxis` for accessing a single radius axis
|
|
107
107
|
*/
|
|
108
108
|
export declare function useRadiusAxes(): {
|
|
109
|
-
radiusAxis: import("../internals/
|
|
109
|
+
radiusAxis: import("../internals/index.js").ComputedAxisConfig<ChartsRadiusAxisProps>;
|
|
110
110
|
radiusAxisIds: string[];
|
|
111
111
|
};
|
|
112
112
|
/**
|
package/index.d.mts
CHANGED
|
@@ -29,6 +29,8 @@ export type { ChartsContainerProps, ChartsContainerSlots, ChartsContainerSlotPro
|
|
|
29
29
|
export * from "./ChartsDataProvider/index.mjs";
|
|
30
30
|
export * from "./ChartsRadialDataProvider/index.mjs";
|
|
31
31
|
export * from "./ChartsRadialGrid/index.mjs";
|
|
32
|
+
export * from "./ChartsRadiusAxis/index.mjs";
|
|
33
|
+
export { type ChartsRotationAxisProps, Unstable_ChartsRotationAxis } from "./ChartsRotationAxis/index.mjs";
|
|
32
34
|
export * from "./Toolbar/index.mjs";
|
|
33
35
|
export * from "./ChartsWrapper/index.mjs";
|
|
34
36
|
export * from "./ChartsBrushOverlay/index.mjs";
|
package/index.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ export type { ChartsContainerProps, ChartsContainerSlots, ChartsContainerSlotPro
|
|
|
29
29
|
export * from "./ChartsDataProvider/index.js";
|
|
30
30
|
export * from "./ChartsRadialDataProvider/index.js";
|
|
31
31
|
export * from "./ChartsRadialGrid/index.js";
|
|
32
|
+
export * from "./ChartsRadiusAxis/index.js";
|
|
33
|
+
export { type ChartsRotationAxisProps, Unstable_ChartsRotationAxis } from "./ChartsRotationAxis/index.js";
|
|
32
34
|
export * from "./Toolbar/index.js";
|
|
33
35
|
export * from "./ChartsWrapper/index.js";
|
|
34
36
|
export * from "./ChartsBrushOverlay/index.js";
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts v9.0.
|
|
2
|
+
* @mui/x-charts v9.0.3
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -11,7 +11,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
11
11
|
value: true
|
|
12
12
|
});
|
|
13
13
|
var _exportNames = {
|
|
14
|
-
ChartsContainer: true
|
|
14
|
+
ChartsContainer: true,
|
|
15
|
+
Unstable_ChartsRotationAxis: true
|
|
15
16
|
};
|
|
16
17
|
Object.defineProperty(exports, "ChartsContainer", {
|
|
17
18
|
enumerable: true,
|
|
@@ -19,6 +20,12 @@ Object.defineProperty(exports, "ChartsContainer", {
|
|
|
19
20
|
return _ChartsContainer.ChartsContainer;
|
|
20
21
|
}
|
|
21
22
|
});
|
|
23
|
+
Object.defineProperty(exports, "Unstable_ChartsRotationAxis", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () {
|
|
26
|
+
return _ChartsRotationAxis.Unstable_ChartsRotationAxis;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
22
29
|
var _constants = require("./constants");
|
|
23
30
|
Object.keys(_constants).forEach(function (key) {
|
|
24
31
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -368,6 +375,19 @@ Object.keys(_ChartsRadialGrid).forEach(function (key) {
|
|
|
368
375
|
}
|
|
369
376
|
});
|
|
370
377
|
});
|
|
378
|
+
var _ChartsRadiusAxis = require("./ChartsRadiusAxis");
|
|
379
|
+
Object.keys(_ChartsRadiusAxis).forEach(function (key) {
|
|
380
|
+
if (key === "default" || key === "__esModule") return;
|
|
381
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
382
|
+
if (key in exports && exports[key] === _ChartsRadiusAxis[key]) return;
|
|
383
|
+
Object.defineProperty(exports, key, {
|
|
384
|
+
enumerable: true,
|
|
385
|
+
get: function () {
|
|
386
|
+
return _ChartsRadiusAxis[key];
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
});
|
|
390
|
+
var _ChartsRotationAxis = require("./ChartsRotationAxis");
|
|
371
391
|
var _Toolbar = require("./Toolbar");
|
|
372
392
|
Object.keys(_Toolbar).forEach(function (key) {
|
|
373
393
|
if (key === "default" || key === "__esModule") return;
|
package/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts v9.0.
|
|
2
|
+
* @mui/x-charts v9.0.3
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -35,6 +35,8 @@ export { ChartsContainer } from "./ChartsContainer/index.mjs";
|
|
|
35
35
|
export * from "./ChartsDataProvider/index.mjs";
|
|
36
36
|
export * from "./ChartsRadialDataProvider/index.mjs";
|
|
37
37
|
export * from "./ChartsRadialGrid/index.mjs";
|
|
38
|
+
export * from "./ChartsRadiusAxis/index.mjs";
|
|
39
|
+
export { Unstable_ChartsRotationAxis } from "./ChartsRotationAxis/index.mjs";
|
|
38
40
|
export * from "./Toolbar/index.mjs";
|
|
39
41
|
export * from "./ChartsWrapper/index.mjs";
|
|
40
42
|
export * from "./ChartsBrushOverlay/index.mjs";
|
|
@@ -0,0 +1,5 @@
|
|
|
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 declare function cubicRoots(P: [number, number, number, number]): number[];
|
|
@@ -0,0 +1,5 @@
|
|
|
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 declare function cubicRoots(P: [number, number, number, number]): number[];
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.cubicRoots = cubicRoots;
|
|
7
|
+
/**
|
|
8
|
+
* Cubic equation solver. Only returns real root between 0 and 1, which is the only case we care about for curve evaluation.
|
|
9
|
+
* From https://www.particleincell.com/2013/cubic-line-intersection/
|
|
10
|
+
*/
|
|
11
|
+
function cubicRoots(P) {
|
|
12
|
+
const a = P[0];
|
|
13
|
+
const b = P[1];
|
|
14
|
+
const c = P[2];
|
|
15
|
+
const d = P[3];
|
|
16
|
+
if (a === 0) {
|
|
17
|
+
if (b === 0) {
|
|
18
|
+
if (c === 0) {
|
|
19
|
+
return []; // constant case
|
|
20
|
+
}
|
|
21
|
+
return [-d / c].filter(r => r >= 0 && r <= 1); // linear case
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// quadratic case
|
|
25
|
+
const discriminant = c * c - 4 * b * d;
|
|
26
|
+
if (discriminant < 0) {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
const sqrtDisc = Math.sqrt(discriminant);
|
|
30
|
+
return [(-c + sqrtDisc) / (2 * b), (-c - sqrtDisc) / (2 * b)].filter(r => r >= 0 && r <= 1);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// cubic case
|
|
34
|
+
|
|
35
|
+
const A = b / a;
|
|
36
|
+
const B = c / a;
|
|
37
|
+
const C = d / a;
|
|
38
|
+
const Q = (3 * B - Math.pow(A, 2)) / 9;
|
|
39
|
+
const R = (9 * A * B - 27 * C - 2 * Math.pow(A, 3)) / 54;
|
|
40
|
+
const D = Math.pow(Q, 3) + Math.pow(R, 2); // polynomial discriminant
|
|
41
|
+
|
|
42
|
+
const result = [];
|
|
43
|
+
if (D >= 0)
|
|
44
|
+
// complex or duplicate roots
|
|
45
|
+
{
|
|
46
|
+
const S = Math.sign(R + Math.sqrt(D)) * Math.pow(Math.abs(R + Math.sqrt(D)), 1 / 3);
|
|
47
|
+
const T = Math.sign(R - Math.sqrt(D)) * Math.pow(Math.abs(R - Math.sqrt(D)), 1 / 3);
|
|
48
|
+
result.push(-A / 3 + (S + T)); // real root
|
|
49
|
+
|
|
50
|
+
if (S - T !== 0) {
|
|
51
|
+
return result.filter(r => r >= 0 && r <= 1);
|
|
52
|
+
}
|
|
53
|
+
result.push(-A / 3 - (S + T) / 2); // real part of complex root
|
|
54
|
+
result.push(-A / 3 - (S + T) / 2); // real part of complex root
|
|
55
|
+
return result.filter(r => r >= 0 && r <= 1);
|
|
56
|
+
}
|
|
57
|
+
const th = Math.acos(R / Math.sqrt(-Math.pow(Q, 3)));
|
|
58
|
+
result.push(2 * Math.sqrt(-Q) * Math.cos(th / 3) - A / 3);
|
|
59
|
+
result.push(2 * Math.sqrt(-Q) * Math.cos((th + 2 * Math.PI) / 3) - A / 3);
|
|
60
|
+
result.push(2 * Math.sqrt(-Q) * Math.cos((th + 4 * Math.PI) / 3) - A / 3);
|
|
61
|
+
return result.filter(r => r >= 0 && r <= 1);
|
|
62
|
+
}
|
|
@@ -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";
|