@mui/x-charts 7.7.0 → 7.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/BarChart.js +21 -104
- package/BarChart/BarElement.d.ts +225 -228
- package/BarChart/BarLabel/BarLabel.d.ts +225 -228
- package/BarChart/BarLabel/BarLabelPlot.d.ts +0 -3
- package/BarChart/BarLabel/BarLabelPlot.js +1 -24
- package/BarChart/BarLabel/getBarLabel.d.ts +1 -1
- 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 +34 -0
- package/BarChart/useBarChartProps.js +143 -0
- package/CHANGELOG.md +181 -0
- package/ChartContainer/ChartContainer.d.ts +2 -2
- package/ChartContainer/ChartContainer.js +6 -10
- 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 +21 -6
- package/ChartsGrid/ChartsGrid.js +2 -2
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/ChartsReferenceLine/common.d.ts +0 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +2 -2
- package/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/ChartsTooltip/ChartsTooltipTable.d.ts +0 -1
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +4 -4
- package/ChartsXAxis/ChartsXAxis.js +2 -2
- package/ChartsYAxis/ChartsYAxis.js +5 -3
- package/Gauge/GaugeProvider.d.ts +1 -1
- package/LineChart/AnimatedArea.d.ts +225 -228
- package/LineChart/AnimatedLine.d.ts +225 -228
- package/LineChart/AreaPlot.js +2 -2
- package/LineChart/LineChart.js +24 -106
- package/LineChart/LineHighlightPlot.js +2 -2
- package/LineChart/LinePlot.js +2 -2
- package/LineChart/MarkPlot.js +2 -2
- package/LineChart/useLineChartProps.d.ts +40 -0
- package/LineChart/useLineChartProps.js +152 -0
- package/PieChart/PieArc.d.ts +0 -1
- package/PieChart/PieArcLabel.d.ts +0 -1
- package/PieChart/dataTransform/transition.d.ts +0 -1
- package/ResponsiveChartContainer/ResizableContainer.d.ts +1 -2
- package/ScatterChart/ScatterChart.js +20 -75
- package/ScatterChart/ScatterPlot.js +2 -2
- package/ScatterChart/useScatterChartProps.d.ts +31 -0
- package/ScatterChart/useScatterChartProps.js +116 -0
- 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 +104 -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 +2 -2
- 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 +135 -0
- package/esm/ChartContainer/ChartContainer.js +5 -9
- package/esm/ChartContainer/useChartContainerHooks.js +24 -0
- package/esm/ChartsAxis/ChartsAxis.js +2 -2
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +21 -6
- package/esm/ChartsGrid/ChartsGrid.js +2 -2
- package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +2 -2
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -3
- package/esm/ChartsXAxis/ChartsXAxis.js +2 -2
- package/esm/ChartsYAxis/ChartsYAxis.js +5 -3
- package/esm/LineChart/AreaPlot.js +2 -2
- package/esm/LineChart/LineChart.js +24 -106
- 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/ScatterChart/ScatterChart.js +20 -75
- package/esm/ScatterChart/ScatterPlot.js +2 -2
- package/esm/ScatterChart/useScatterChartProps.js +108 -0
- package/esm/context/CartesianProvider/CartesianContext.js +13 -0
- package/esm/context/CartesianProvider/CartesianProvider.js +37 -0
- package/esm/context/CartesianProvider/computeValue.js +97 -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/hooks/useAxisEvents.js +7 -10
- package/esm/hooks/useColorScale.js +3 -3
- package/esm/hooks/useScale.js +4 -5
- package/esm/hooks/useTicks.js +2 -1
- package/esm/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +2 -2
- package/esm/internals/getSVGPoint.js +11 -0
- package/esm/internals/index.js +8 -2
- package/esm/internals/utils.js +0 -12
- package/hooks/useAxisEvents.js +8 -11
- package/hooks/useChartDimensions.d.ts +1 -1
- package/hooks/useColor.d.ts +1 -1
- package/hooks/useColorScale.js +3 -3
- package/hooks/useDrawingArea.d.ts +2 -8
- package/hooks/useScale.js +4 -7
- package/hooks/useTicks.js +2 -1
- package/index.js +1 -1
- package/internals/components/AxisSharedComponents.d.ts +0 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.d.ts +2 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +2 -2
- package/internals/defaultizeColor.d.ts +68 -68
- package/internals/getSVGPoint.d.ts +6 -0
- package/internals/getSVGPoint.js +17 -0
- package/internals/getWordsByLines.d.ts +0 -1
- package/internals/index.d.ts +9 -1
- package/internals/index.js +69 -5
- package/internals/useAnimatedPath.d.ts +0 -1
- package/internals/utils.d.ts +0 -6
- package/internals/utils.js +0 -13
- 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 +135 -0
- package/modern/ChartContainer/ChartContainer.js +5 -9
- package/modern/ChartContainer/useChartContainerHooks.js +24 -0
- package/modern/ChartsAxis/ChartsAxis.js +2 -2
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +21 -6
- package/modern/ChartsGrid/ChartsGrid.js +2 -2
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +2 -2
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -3
- package/modern/ChartsXAxis/ChartsXAxis.js +2 -2
- package/modern/ChartsYAxis/ChartsYAxis.js +5 -3
- package/modern/LineChart/AreaPlot.js +2 -2
- package/modern/LineChart/LineChart.js +24 -106
- 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/ScatterChart/ScatterChart.js +20 -75
- package/modern/ScatterChart/ScatterPlot.js +2 -2
- package/modern/ScatterChart/useScatterChartProps.js +108 -0
- package/modern/context/CartesianProvider/CartesianContext.js +13 -0
- package/modern/context/CartesianProvider/CartesianProvider.js +37 -0
- package/modern/context/CartesianProvider/computeValue.js +97 -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/hooks/useAxisEvents.js +7 -10
- package/modern/hooks/useColorScale.js +3 -3
- package/modern/hooks/useScale.js +4 -5
- package/modern/hooks/useTicks.js +2 -1
- package/modern/index.js +1 -1
- package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +2 -2
- package/modern/internals/getSVGPoint.js +11 -0
- package/modern/internals/index.js +8 -2
- package/modern/internals/utils.js +0 -12
- package/package.json +3 -3
- package/context/CartesianContextProvider.d.ts +0 -61
- package/context/CartesianContextProvider.js +0 -220
- package/esm/context/CartesianContextProvider.js +0 -211
- package/modern/context/CartesianContextProvider.js +0 -211
package/ChartsGrid/ChartsGrid.js
CHANGED
|
@@ -11,7 +11,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
13
13
|
var _styles = require("@mui/material/styles");
|
|
14
|
-
var
|
|
14
|
+
var _CartesianProvider = require("../context/CartesianProvider");
|
|
15
15
|
var _useTicks = require("../hooks/useTicks");
|
|
16
16
|
var _chartsGridClasses = require("./chartsGridClasses");
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -72,7 +72,7 @@ function ChartsGrid(props) {
|
|
|
72
72
|
xAxisIds,
|
|
73
73
|
yAxis,
|
|
74
74
|
yAxisIds
|
|
75
|
-
} =
|
|
75
|
+
} = (0, _CartesianProvider.useCartesianContext)();
|
|
76
76
|
const classes = useUtilityClasses(themeProps);
|
|
77
77
|
const horizontalAxisId = yAxisIds[0];
|
|
78
78
|
const verticalAxisId = xAxisIds[0];
|
|
@@ -8,9 +8,9 @@ exports.ChartsOnAxisClickHandler = ChartsOnAxisClickHandler;
|
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
10
|
var _InteractionProvider = require("../context/InteractionProvider");
|
|
11
|
-
var _CartesianContextProvider = require("../context/CartesianContextProvider");
|
|
12
11
|
var _useSeries = require("../hooks/useSeries");
|
|
13
12
|
var _hooks = require("../hooks");
|
|
13
|
+
var _CartesianProvider = require("../context/CartesianProvider");
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
15
|
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); }
|
|
16
16
|
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; }
|
|
@@ -28,7 +28,7 @@ function ChartsOnAxisClickHandler(props) {
|
|
|
28
28
|
xAxis,
|
|
29
29
|
yAxisIds,
|
|
30
30
|
yAxis
|
|
31
|
-
} =
|
|
31
|
+
} = (0, _CartesianProvider.useCartesianContext)();
|
|
32
32
|
React.useEffect(() => {
|
|
33
33
|
const element = svgRef.current;
|
|
34
34
|
if (element === null || !onAxisClick) {
|
|
@@ -9,7 +9,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
var _utils = require("@mui/base/utils");
|
|
12
|
-
var
|
|
12
|
+
var _CartesianProvider = require("../context/CartesianProvider");
|
|
13
13
|
var _DefaultChartsAxisTooltipContent = require("./DefaultChartsAxisTooltipContent");
|
|
14
14
|
var _ZAxisContextProvider = require("../context/ZAxisContextProvider");
|
|
15
15
|
var _useColor = require("../hooks/useColor");
|
|
@@ -34,7 +34,7 @@ function ChartsAxisTooltipContent(props) {
|
|
|
34
34
|
xAxis,
|
|
35
35
|
yAxisIds,
|
|
36
36
|
yAxis
|
|
37
|
-
} =
|
|
37
|
+
} = (0, _CartesianProvider.useCartesianContext)();
|
|
38
38
|
const {
|
|
39
39
|
zAxisIds,
|
|
40
40
|
zAxis
|
|
@@ -10,7 +10,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
var _utils = require("@mui/base/utils");
|
|
12
12
|
var _DefaultChartsItemTooltipContent = require("./DefaultChartsItemTooltipContent");
|
|
13
|
-
var
|
|
13
|
+
var _CartesianProvider = require("../context/CartesianProvider");
|
|
14
14
|
var _ZAxisContextProvider = require("../context/ZAxisContextProvider");
|
|
15
15
|
var _useColor = require("../hooks/useColor");
|
|
16
16
|
var _useSeries = require("../hooks/useSeries");
|
|
@@ -31,7 +31,7 @@ function ChartsItemTooltipContent(props) {
|
|
|
31
31
|
yAxis,
|
|
32
32
|
xAxisIds,
|
|
33
33
|
yAxisIds
|
|
34
|
-
} =
|
|
34
|
+
} = (0, _CartesianProvider.useCartesianContext)();
|
|
35
35
|
const {
|
|
36
36
|
zAxis,
|
|
37
37
|
zAxisIds
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export declare const ChartsTooltipPaper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("react").ClassAttributes<HTMLDivElement> | keyof import("react").HTMLAttributes<HTMLDivElement>>, {}>;
|
|
3
2
|
export declare const ChartsTooltipTable: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, keyof import("react").ClassAttributes<HTMLTableElement> | keyof import("react").TableHTMLAttributes<HTMLTableElement>>, {}>;
|
|
4
3
|
export declare const ChartsTooltipRow: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, keyof import("react").ClassAttributes<HTMLTableRowElement> | keyof import("react").HTMLAttributes<HTMLTableRowElement>>, {}>;
|
|
@@ -10,9 +10,9 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
10
10
|
var _d3Delaunay = require("d3-delaunay");
|
|
11
11
|
var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
|
|
12
12
|
var _InteractionProvider = require("../context/InteractionProvider");
|
|
13
|
-
var
|
|
13
|
+
var _CartesianProvider = require("../context/CartesianProvider");
|
|
14
14
|
var _useScale = require("../hooks/useScale");
|
|
15
|
-
var
|
|
15
|
+
var _getSVGPoint = require("../internals/getSVGPoint");
|
|
16
16
|
var _hooks = require("../hooks");
|
|
17
17
|
var _context = require("../context");
|
|
18
18
|
var _useSeries = require("../hooks/useSeries");
|
|
@@ -36,7 +36,7 @@ function ChartsVoronoiHandler(props) {
|
|
|
36
36
|
yAxis,
|
|
37
37
|
xAxisIds,
|
|
38
38
|
yAxisIds
|
|
39
|
-
} =
|
|
39
|
+
} = (0, _CartesianProvider.useCartesianContext)();
|
|
40
40
|
const {
|
|
41
41
|
dispatch
|
|
42
42
|
} = React.useContext(_InteractionProvider.InteractionContext);
|
|
@@ -105,7 +105,7 @@ function ChartsVoronoiHandler(props) {
|
|
|
105
105
|
// TODO: A perf optimisation of voronoi could be to use the last point as the initial point for the next search.
|
|
106
106
|
function getClosestPoint(event) {
|
|
107
107
|
// Get mouse coordinate in global SVG space
|
|
108
|
-
const svgPoint = (0,
|
|
108
|
+
const svgPoint = (0, _getSVGPoint.getSVGPoint)(svgRef.current, event);
|
|
109
109
|
const outsideX = svgPoint.x < left || svgPoint.x > left + width;
|
|
110
110
|
const outsideY = svgPoint.y < top || svgPoint.y > top + height;
|
|
111
111
|
if (outsideX || outsideY) {
|
|
@@ -12,7 +12,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
12
12
|
var _utils = require("@mui/base/utils");
|
|
13
13
|
var _utils2 = require("@mui/utils");
|
|
14
14
|
var _styles = require("@mui/material/styles");
|
|
15
|
-
var
|
|
15
|
+
var _CartesianProvider = require("../context/CartesianProvider");
|
|
16
16
|
var _useTicks = require("../hooks/useTicks");
|
|
17
17
|
var _axisClasses = require("../ChartsAxis/axisClasses");
|
|
18
18
|
var _AxisSharedComponents = require("../internals/components/AxisSharedComponents");
|
|
@@ -116,7 +116,7 @@ function ChartsXAxis(inProps) {
|
|
|
116
116
|
const {
|
|
117
117
|
xAxisIds,
|
|
118
118
|
xAxis
|
|
119
|
-
} =
|
|
119
|
+
} = (0, _CartesianProvider.useCartesianContext)();
|
|
120
120
|
const _xAxis = xAxis[inProps.axisId ?? xAxisIds[0]],
|
|
121
121
|
{
|
|
122
122
|
scale: xScale,
|
|
@@ -12,7 +12,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
12
12
|
var _utils = require("@mui/base/utils");
|
|
13
13
|
var _utils2 = require("@mui/utils");
|
|
14
14
|
var _styles = require("@mui/material/styles");
|
|
15
|
-
var
|
|
15
|
+
var _CartesianProvider = require("../context/CartesianProvider");
|
|
16
16
|
var _useTicks = require("../hooks/useTicks");
|
|
17
17
|
var _useDrawingArea = require("../hooks/useDrawingArea");
|
|
18
18
|
var _AxisSharedComponents = require("../internals/components/AxisSharedComponents");
|
|
@@ -59,7 +59,7 @@ function ChartsYAxis(inProps) {
|
|
|
59
59
|
const {
|
|
60
60
|
yAxisIds,
|
|
61
61
|
yAxis
|
|
62
|
-
} =
|
|
62
|
+
} = (0, _CartesianProvider.useCartesianContext)();
|
|
63
63
|
const _yAxis = yAxis[inProps.axisId ?? yAxisIds[0]],
|
|
64
64
|
{
|
|
65
65
|
scale: yScale,
|
|
@@ -90,6 +90,7 @@ function ChartsYAxis(inProps) {
|
|
|
90
90
|
tickLabelInterval
|
|
91
91
|
} = defaultizedProps;
|
|
92
92
|
const theme = (0, _styles.useTheme)();
|
|
93
|
+
const isRTL = theme.direction === 'rtl';
|
|
93
94
|
const classes = useUtilityClasses((0, _extends2.default)({}, defaultizedProps, {
|
|
94
95
|
theme
|
|
95
96
|
}));
|
|
@@ -117,13 +118,14 @@ function ChartsYAxis(inProps) {
|
|
|
117
118
|
const Tick = slots?.axisTick ?? 'line';
|
|
118
119
|
const TickLabel = slots?.axisTickLabel ?? _ChartsText.ChartsText;
|
|
119
120
|
const Label = slots?.axisLabel ?? _ChartsText.ChartsText;
|
|
121
|
+
const revertAnchor = !isRTL && position === 'right' || isRTL && position !== 'right';
|
|
120
122
|
const axisTickLabelProps = (0, _utils.useSlotProps)({
|
|
121
123
|
elementType: TickLabel,
|
|
122
124
|
externalSlotProps: slotProps?.axisTickLabel,
|
|
123
125
|
additionalProps: {
|
|
124
126
|
style: (0, _extends2.default)({
|
|
125
127
|
fontSize: tickFontSize,
|
|
126
|
-
textAnchor:
|
|
128
|
+
textAnchor: revertAnchor ? 'start' : 'end',
|
|
127
129
|
dominantBaseline: 'central'
|
|
128
130
|
}, tickLabelStyle)
|
|
129
131
|
},
|
package/Gauge/GaugeProvider.d.ts
CHANGED