@mui/x-charts 8.0.0-alpha.8 → 8.0.0-alpha.9

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.
Files changed (116) hide show
  1. package/BarChart/BarChart.js +1 -1
  2. package/BarChart/plugin.js +2 -0
  3. package/CHANGELOG.md +436 -3
  4. package/ChartContainer/ChartContainer.d.ts +2 -2
  5. package/ChartContainer/ChartContainer.js +2 -2
  6. package/ChartContainer/useChartContainerProps.d.ts +1 -1
  7. package/{context/ChartDataProvider → ChartDataProvider}/ChartDataProvider.d.ts +7 -7
  8. package/{context/ChartDataProvider → ChartDataProvider}/ChartDataProvider.js +4 -4
  9. package/ChartDataProvider/package.json +6 -0
  10. package/ChartDataProvider/useChartDataProviderProps.d.ts +13 -0
  11. package/ChartsSurface/ChartsSurface.d.ts +1 -1
  12. package/ChartsSurface/ChartsSurface.js +1 -1
  13. package/ChartsTooltip/utils.js +2 -0
  14. package/Gauge/GaugeProvider.js +2 -0
  15. package/LineChart/AreaPlot.js +43 -10
  16. package/LineChart/CircleMarkElement.d.ts +0 -4
  17. package/LineChart/CircleMarkElement.js +2 -7
  18. package/LineChart/LineChart.d.ts +0 -4
  19. package/LineChart/LineChart.js +1 -5
  20. package/LineChart/LineHighlightElement.d.ts +5 -1
  21. package/LineChart/LineHighlightElement.js +29 -9
  22. package/LineChart/LineHighlightPlot.js +4 -2
  23. package/LineChart/LinePlot.js +43 -9
  24. package/LineChart/MarkPlot.d.ts +0 -6
  25. package/LineChart/MarkPlot.js +6 -12
  26. package/LineChart/plugin.js +2 -0
  27. package/LineChart/useLineChartProps.js +3 -5
  28. package/PieChart/PieChart.js +1 -1
  29. package/PieChart/plugin.js +3 -1
  30. package/ScatterChart/ScatterChart.js +1 -1
  31. package/ScatterChart/plugin.js +2 -0
  32. package/context/AnimationProvider/AnimationProvider.js +1 -1
  33. package/context/InteractionSelectors.d.ts +11 -11
  34. package/context/index.d.ts +0 -2
  35. package/context/index.js +1 -2
  36. package/hooks/useLegend.js +8 -13
  37. package/index.d.ts +1 -0
  38. package/index.js +3 -2
  39. package/internals/defaultizeColor.d.ts +2 -0
  40. package/internals/index.d.ts +1 -2
  41. package/internals/index.js +1 -2
  42. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +5 -5
  43. package/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +1 -1
  44. package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +2 -2
  45. package/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.ts +1 -0
  46. package/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +1 -0
  47. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.selectors.d.ts +90 -126
  48. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.selectors.js +3 -1
  49. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +0 -1
  50. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +11 -11
  51. package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.selectors.d.ts +1 -1
  52. package/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +2 -1
  53. package/models/seriesType/line.d.ts +11 -0
  54. package/modern/BarChart/BarChart.js +1 -1
  55. package/modern/BarChart/plugin.js +2 -0
  56. package/modern/ChartContainer/ChartContainer.js +2 -2
  57. package/modern/{context/ChartDataProvider → ChartDataProvider}/ChartDataProvider.js +4 -4
  58. package/modern/ChartsSurface/ChartsSurface.js +1 -1
  59. package/modern/ChartsTooltip/utils.js +2 -0
  60. package/modern/Gauge/GaugeProvider.js +2 -0
  61. package/modern/LineChart/AreaPlot.js +43 -10
  62. package/modern/LineChart/CircleMarkElement.js +2 -7
  63. package/modern/LineChart/LineChart.js +1 -5
  64. package/modern/LineChart/LineHighlightElement.js +29 -9
  65. package/modern/LineChart/LineHighlightPlot.js +4 -2
  66. package/modern/LineChart/LinePlot.js +43 -9
  67. package/modern/LineChart/MarkPlot.js +6 -12
  68. package/modern/LineChart/plugin.js +2 -0
  69. package/modern/LineChart/useLineChartProps.js +3 -5
  70. package/modern/PieChart/PieChart.js +1 -1
  71. package/modern/PieChart/plugin.js +3 -1
  72. package/modern/ScatterChart/ScatterChart.js +1 -1
  73. package/modern/ScatterChart/plugin.js +2 -0
  74. package/modern/context/AnimationProvider/AnimationProvider.js +1 -1
  75. package/modern/context/index.js +1 -2
  76. package/modern/hooks/useLegend.js +8 -13
  77. package/modern/index.js +3 -2
  78. package/modern/internals/index.js +1 -2
  79. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +1 -0
  80. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.selectors.js +3 -1
  81. package/node/BarChart/BarChart.js +2 -2
  82. package/node/BarChart/plugin.js +2 -0
  83. package/node/ChartContainer/ChartContainer.js +2 -2
  84. package/node/{context/ChartDataProvider → ChartDataProvider}/ChartDataProvider.js +4 -4
  85. package/node/ChartsSurface/ChartsSurface.js +1 -1
  86. package/node/ChartsTooltip/utils.js +1 -0
  87. package/node/Gauge/GaugeProvider.js +2 -2
  88. package/node/LineChart/AreaPlot.js +43 -10
  89. package/node/LineChart/CircleMarkElement.js +2 -7
  90. package/node/LineChart/LineChart.js +2 -6
  91. package/node/LineChart/LineHighlightElement.js +29 -9
  92. package/node/LineChart/LineHighlightPlot.js +4 -2
  93. package/node/LineChart/LinePlot.js +43 -9
  94. package/node/LineChart/MarkPlot.js +6 -12
  95. package/node/LineChart/plugin.js +2 -0
  96. package/node/LineChart/useLineChartProps.js +3 -5
  97. package/node/PieChart/PieChart.js +2 -2
  98. package/node/PieChart/plugin.js +3 -1
  99. package/node/ScatterChart/ScatterChart.js +2 -2
  100. package/node/ScatterChart/plugin.js +2 -0
  101. package/node/context/AnimationProvider/AnimationProvider.js +1 -1
  102. package/node/context/index.js +1 -12
  103. package/node/hooks/useLegend.js +8 -14
  104. package/node/index.js +12 -1
  105. package/node/internals/index.js +1 -13
  106. package/node/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +12 -0
  107. package/node/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.selectors.js +3 -1
  108. package/package.json +3 -3
  109. package/context/ChartDataProvider/useChartDataProviderProps.d.ts +0 -13
  110. /package/{context/ChartDataProvider → ChartDataProvider}/index.d.ts +0 -0
  111. /package/{context/ChartDataProvider → ChartDataProvider}/index.js +0 -0
  112. /package/{context/ChartDataProvider → ChartDataProvider}/useChartDataProviderProps.js +0 -0
  113. /package/modern/{context/ChartDataProvider → ChartDataProvider}/index.js +0 -0
  114. /package/modern/{context/ChartDataProvider → ChartDataProvider}/useChartDataProviderProps.js +0 -0
  115. /package/node/{context/ChartDataProvider → ChartDataProvider}/index.js +0 -0
  116. /package/node/{context/ChartDataProvider → ChartDataProvider}/useChartDataProviderProps.js +0 -0
@@ -1,9 +1,11 @@
1
1
  import { getExtremumX, getExtremumY } from "./extremums.js";
2
2
  import formatter from "./formatter.js";
3
3
  import getColor from "./getColor.js";
4
+ import legendGetter from "./legend.js";
4
5
  export const plugin = {
5
6
  colorProcessor: getColor,
6
7
  seriesProcessor: formatter,
8
+ legendGetter,
7
9
  xExtremumGetter: getExtremumX,
8
10
  yExtremumGetter: getExtremumY
9
11
  };
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "onAxisClick", "onAreaClick", "onLineClick", "onMarkClick", "axisHighlight", "disableLineItemHighlight", "hideLegend", "grid", "topAxis", "leftAxis", "rightAxis", "bottomAxis", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "className", "experimentalMarkRendering"];
5
+ const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "onAxisClick", "onAreaClick", "onLineClick", "onMarkClick", "axisHighlight", "disableLineItemHighlight", "hideLegend", "grid", "topAxis", "leftAxis", "rightAxis", "bottomAxis", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "className"];
6
6
  import useId from '@mui/utils/useId';
7
7
  import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
8
8
  import { calculateMargins } from "../internals/calculateMargins.js";
@@ -44,8 +44,7 @@ export const useLineChartProps = props => {
44
44
  loading,
45
45
  highlightedItem,
46
46
  onHighlightChange,
47
- className,
48
- experimentalMarkRendering
47
+ className
49
48
  } = props,
50
49
  other = _objectWithoutPropertiesLoose(props, _excluded);
51
50
  const id = useId();
@@ -106,8 +105,7 @@ export const useLineChartProps = props => {
106
105
  slots,
107
106
  slotProps,
108
107
  onItemClick: onMarkClick,
109
- skipAnimation,
110
- experimentalRendering: experimentalMarkRendering
108
+ skipAnimation
111
109
  };
112
110
  const overlayProps = {
113
111
  slots,
@@ -11,7 +11,7 @@ import { ChartsLegend } from "../ChartsLegend/index.js";
11
11
  import { PiePlot } from "./PiePlot.js";
12
12
  import { ChartsOverlay } from "../ChartsOverlay/index.js";
13
13
  import { ChartsSurface } from "../ChartsSurface/index.js";
14
- import { ChartDataProvider } from "../context/index.js";
14
+ import { ChartDataProvider } from "../ChartDataProvider/index.js";
15
15
  import { useChartContainerProps } from "../ChartContainer/useChartContainerProps.js";
16
16
  import { ChartsWrapper } from "../internals/components/ChartsWrapper/index.js";
17
17
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -1,6 +1,8 @@
1
1
  import formatter from "./formatter.js";
2
2
  import getColor from "./getColor.js";
3
+ import legendGetter from "./legend.js";
3
4
  export const plugin = {
4
5
  colorProcessor: getColor,
5
- seriesProcessor: formatter
6
+ seriesProcessor: formatter,
7
+ legendGetter
6
8
  };
@@ -14,7 +14,7 @@ import { ChartsVoronoiHandler } from "../ChartsVoronoiHandler/ChartsVoronoiHandl
14
14
  import { ChartsGrid } from "../ChartsGrid/index.js";
15
15
  import { useScatterChartProps } from "./useScatterChartProps.js";
16
16
  import { useChartContainerProps } from "../ChartContainer/useChartContainerProps.js";
17
- import { ChartDataProvider } from "../context/index.js";
17
+ import { ChartDataProvider } from "../ChartDataProvider/index.js";
18
18
  import { ChartsSurface } from "../ChartsSurface/index.js";
19
19
  import { ChartsWrapper } from "../internals/components/ChartsWrapper/index.js";
20
20
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -1,9 +1,11 @@
1
1
  import { getExtremumX, getExtremumY } from "./extremums.js";
2
2
  import formatter from "./formatter.js";
3
3
  import getColor from "./getColor.js";
4
+ import legendGetter from "./legend.js";
4
5
  export const plugin = {
5
6
  seriesProcessor: formatter,
6
7
  colorProcessor: getColor,
8
+ legendGetter,
7
9
  xExtremumGetter: getExtremumX,
8
10
  yExtremumGetter: getExtremumY
9
11
  };
@@ -17,7 +17,7 @@ function AnimationProvider(props) {
17
17
 
18
18
  // We use the value of `isAnimationDisabledEnvironment` as the initial value of `skipAnimation` to avoid
19
19
  // re-rendering the component on environments where matchMedia is not supported, hence skipAnimation will always be true.
20
- const [skipAnimation, setSkipAnimation] = React.useState(isAnimationDisabledEnvironment || undefined);
20
+ const [skipAnimation, setSkipAnimation] = React.useState(process.env.NODE_ENV === 'test' ? isAnimationDisabledEnvironment || undefined : undefined);
21
21
  useIsomorphicLayoutEffect(() => {
22
22
  if (isAnimationDisabledEnvironment) {
23
23
  return undefined;
@@ -1,2 +1 @@
1
- export * from "./HighlightedProvider/index.js";
2
- export { ChartDataProvider } from "./ChartDataProvider/index.js";
1
+ export * from "./HighlightedProvider/index.js";
@@ -1,19 +1,12 @@
1
1
  'use client';
2
2
 
3
- import getBarLegend from "../BarChart/legend.js";
4
- import getScatterLegend from "../ScatterChart/legend.js";
5
- import getLineLegend from "../LineChart/legend.js";
6
- import getPieLegend from "../PieChart/legend.js";
3
+ import { selectorChartSeriesConfig } from "../internals/plugins/corePlugins/useChartSeries/index.js";
7
4
  import { useSeries } from "./useSeries.js";
8
- const legendGetter = {
9
- bar: getBarLegend,
10
- scatter: getScatterLegend,
11
- line: getLineLegend,
12
- pie: getPieLegend
13
- };
14
- function getSeriesToDisplay(series) {
5
+ import { useStore } from "../internals/store/useStore.js";
6
+ import { useSelector } from "../internals/store/useSelector.js";
7
+ function getSeriesToDisplay(series, seriesConfig) {
15
8
  return Object.keys(series).flatMap(seriesType => {
16
- const getter = legendGetter[seriesType];
9
+ const getter = seriesConfig[seriesType].legendGetter;
17
10
  return getter === undefined ? [] : getter(series[seriesType]);
18
11
  });
19
12
  }
@@ -29,7 +22,9 @@ function getSeriesToDisplay(series) {
29
22
  */
30
23
  export function useLegend() {
31
24
  const series = useSeries();
25
+ const store = useStore();
26
+ const seriesConfig = useSelector(store, selectorChartSeriesConfig);
32
27
  return {
33
- items: getSeriesToDisplay(series)
28
+ items: getSeriesToDisplay(series, seriesConfig)
34
29
  };
35
30
  }
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v8.0.0-alpha.8
2
+ * @mui/x-charts v8.0.0-alpha.9
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -30,4 +30,5 @@ export * from "./ScatterChart/index.js";
30
30
  export * from "./SparkLineChart/index.js";
31
31
  export * from "./Gauge/index.js";
32
32
  export * from "./ChartsSurface/index.js";
33
- export * from "./ChartContainer/index.js";
33
+ export * from "./ChartContainer/index.js";
34
+ export * from "./ChartDataProvider/index.js";
@@ -11,7 +11,7 @@ export { useScatterChartProps } from "../ScatterChart/useScatterChartProps.js";
11
11
  export { useLineChartProps } from "../LineChart/useLineChartProps.js";
12
12
  export { useBarChartProps } from "../BarChart/useBarChartProps.js";
13
13
  export * from "../ChartContainer/useChartContainerProps.js";
14
- export * from "../context/ChartDataProvider/useChartDataProviderProps.js";
14
+ export * from "../ChartDataProvider/useChartDataProviderProps.js";
15
15
 
16
16
  // plugins
17
17
  export * from "./plugins/corePlugins/useChartId/index.js";
@@ -38,7 +38,6 @@ export * from "./getScale.js";
38
38
 
39
39
  export * from "../context/AnimationProvider/index.js";
40
40
  export { getAxisExtremum } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.js";
41
- export * from "../context/ChartDataProvider/index.js";
42
41
  export * from "../context/ChartProvider/index.js";
43
42
 
44
43
  // series configuration
@@ -1,4 +1,5 @@
1
1
  export { useChartCartesianAxis } from "./useChartCartesianAxis.js";
2
+ export * from "./useChartCartesianAxis.selectors.js";
2
3
  export { defaultizeAxis } from "./defaultizeAxis.js";
3
4
  export * from "./computeAxisValue.js";
4
5
  export * from "./zoom.types.js";
@@ -21,7 +21,7 @@ export const selectorChartRawYAxis = createSelector(selectorChartCartesianAxisSt
21
21
  */
22
22
 
23
23
  const selectorChartZoomMap = createSelector(selectorChartZoomState, zoom => zoom?.zoomData && createZoomMap(zoom?.zoomData));
24
- const selectorChartZoomOptionsLookup = createSelector(selectorChartZoomState, zoom => zoom?.optionsLookup);
24
+ const selectorChartZoomOptionsLookup = createSelector(selectorChartZoomState, () => undefined);
25
25
  const selectorChartXFilter = createSelector([selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartSeriesConfig, selectorChartSeriesProcessed], (zoomMap, zoomOptions, seriesConfig, formattedSeries) => zoomMap && zoomOptions && createAxisFilterMapper({
26
26
  zoomMap,
27
27
  zoomOptions,
@@ -42,6 +42,7 @@ const selectorChartZoomAxisFilters = createSelector([selectorChartXFilter, selec
42
42
  return undefined;
43
43
  }
44
44
  const xFilters = xAxis.reduce((acc, axis, index) => {
45
+ // @ts-expect-error The type is defined in the pro package
45
46
  const filter = xMapper(axis, index);
46
47
  if (filter !== null) {
47
48
  acc[axis.id] = filter;
@@ -49,6 +50,7 @@ const selectorChartZoomAxisFilters = createSelector([selectorChartXFilter, selec
49
50
  return acc;
50
51
  }, {});
51
52
  const yFilters = yAxis.reduce((acc, axis, index) => {
53
+ // @ts-expect-error The type is defined in the pro package
52
54
  const filter = yMapper(axis, index);
53
55
  if (filter !== null) {
54
56
  acc[axis.id] = filter;
@@ -21,7 +21,7 @@ var _ChartsGrid = require("../ChartsGrid");
21
21
  var _ChartsOnAxisClickHandler = require("../ChartsOnAxisClickHandler");
22
22
  var _ChartsOverlay = require("../ChartsOverlay/ChartsOverlay");
23
23
  var _useBarChartProps = require("./useBarChartProps");
24
- var _context = require("../context");
24
+ var _ChartDataProvider = require("../ChartDataProvider");
25
25
  var _ChartsSurface = require("../ChartsSurface");
26
26
  var _useChartContainerProps = require("../ChartContainer/useChartContainerProps");
27
27
  var _ChartsWrapper = require("../internals/components/ChartsWrapper");
@@ -61,7 +61,7 @@ const BarChart = exports.BarChart = /*#__PURE__*/React.forwardRef(function BarCh
61
61
  chartsSurfaceProps
62
62
  } = (0, _useChartContainerProps.useChartContainerProps)(chartContainerProps, ref);
63
63
  const Tooltip = props.slots?.tooltip ?? _ChartsTooltip.ChartsTooltip;
64
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.ChartDataProvider, (0, _extends2.default)({}, chartDataProviderProps, {
64
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProvider.ChartDataProvider, (0, _extends2.default)({}, chartDataProviderProps, {
65
65
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsWrapper.ChartsWrapper, (0, _extends2.default)({}, chartsWrapperProps, {
66
66
  children: [!props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
67
67
  children: [props.onAxisClick && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOnAxisClickHandler.ChartsOnAxisClickHandler, (0, _extends2.default)({}, axisClickHandlerProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", (0, _extends2.default)({}, clipPathGroupProps, {
@@ -7,10 +7,12 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.plugin = void 0;
8
8
  var _extremums = require("./extremums");
9
9
  var _formatter = _interopRequireDefault(require("./formatter"));
10
+ var _legend = _interopRequireDefault(require("./legend"));
10
11
  var _getColor = _interopRequireDefault(require("./getColor"));
11
12
  const plugin = exports.plugin = {
12
13
  seriesProcessor: _formatter.default,
13
14
  colorProcessor: _getColor.default,
15
+ legendGetter: _legend.default,
14
16
  xExtremumGetter: _extremums.getExtremumX,
15
17
  yExtremumGetter: _extremums.getExtremumY
16
18
  };
@@ -10,7 +10,7 @@ exports.ChartContainer = void 0;
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
  var React = _interopRequireWildcard(require("react"));
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
- var _ChartDataProvider = require("../context/ChartDataProvider");
13
+ var _ChartDataProvider = require("../ChartDataProvider");
14
14
  var _useChartContainerProps = require("./useChartContainerProps");
15
15
  var _ChartsSurface = require("../ChartsSurface");
16
16
  var _jsxRuntime = require("react/jsx-runtime");
@@ -21,7 +21,7 @@ var _jsxRuntime = require("react/jsx-runtime");
21
21
  *
22
22
  * Demos:
23
23
  *
24
- * - [Composition](http://localhost:3001/x/react-charts/composition/)
24
+ * - [Composition](https://mui.com/x/api/charts/composition/)
25
25
  *
26
26
  * API:
27
27
  *
@@ -11,9 +11,9 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
11
11
  var React = _interopRequireWildcard(require("react"));
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
  var _useChartDataProviderProps = require("./useChartDataProviderProps");
14
- var _AnimationProvider = require("../AnimationProvider");
15
- var _HighlightedProvider = require("../HighlightedProvider");
16
- var _ChartProvider = require("../ChartProvider");
14
+ var _AnimationProvider = require("../context/AnimationProvider");
15
+ var _HighlightedProvider = require("../context/HighlightedProvider");
16
+ var _ChartProvider = require("../context/ChartProvider");
17
17
  var _jsxRuntime = require("react/jsx-runtime");
18
18
  /**
19
19
  * Orchestrates the data providers for the chart components and hooks.
@@ -22,7 +22,7 @@ var _jsxRuntime = require("react/jsx-runtime");
22
22
  *
23
23
  * Demos:
24
24
  *
25
- * - [Composition](http://localhost:3001/x/react-charts/composition/)
25
+ * - [Composition](https://mui.com/x/api/charts/composition/)
26
26
  *
27
27
  * API:
28
28
  *
@@ -48,7 +48,7 @@ const ChartsSurfaceStyles = (0, _styles.styled)('svg', {
48
48
  *
49
49
  * Demos:
50
50
  *
51
- * - [Composition](http://localhost:3001/x/react-charts/composition/)
51
+ * - [Composition](https://mui.com/x/api/charts/composition/)
52
52
  *
53
53
  * API:
54
54
  *
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ 'use client';
2
3
 
3
4
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
5
  Object.defineProperty(exports, "__esModule", {
@@ -1,4 +1,6 @@
1
1
  "use strict";
2
+ // @ignore - do not document.
3
+ 'use client';
2
4
 
3
5
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
6
  Object.defineProperty(exports, "__esModule", {
@@ -12,8 +14,6 @@ var _getPercentageValue = require("../internals/getPercentageValue");
12
14
  var _utils = require("./utils");
13
15
  var _useDrawingArea = require("../hooks/useDrawingArea");
14
16
  var _jsxRuntime = require("react/jsx-runtime");
15
- // @ignore - do not document.
16
-
17
17
  const GaugeContext = exports.GaugeContext = /*#__PURE__*/React.createContext({
18
18
  value: null,
19
19
  valueMin: 0,
@@ -16,6 +16,7 @@ var _d3Shape = require("@mui/x-charts-vendor/d3-shape");
16
16
  var _AreaElement = require("./AreaElement");
17
17
  var _useScale = require("../hooks/useScale");
18
18
  var _getCurve = _interopRequireDefault(require("../internals/getCurve"));
19
+ var _isBandScale = require("../internals/isBandScale");
19
20
  var _constants = require("../constants");
20
21
  var _useSeries = require("../hooks/useSeries");
21
22
  var _AnimationProvider = require("../context/AnimationProvider");
@@ -66,9 +67,12 @@ const useAggregatedData = () => {
66
67
  stackedData,
67
68
  data,
68
69
  connectNulls,
69
- baseline
70
+ baseline,
71
+ curve,
72
+ strictStepCurve
70
73
  } = series[seriesId];
71
- const xScale = (0, _useScale.getValueToPositionMapper)(xAxis[xAxisId].scale);
74
+ const xScale = xAxis[xAxisId].scale;
75
+ const xPosition = (0, _useScale.getValueToPositionMapper)(xScale);
72
76
  const yScale = yAxis[yAxisId].scale;
73
77
  const xData = xAxis[xAxisId].data;
74
78
  const gradientId = yAxis[yAxisId].colorScale && getGradientId(yAxisId) || xAxis[xAxisId].colorScale && getGradientId(xAxisId) || undefined;
@@ -80,7 +84,42 @@ const useAggregatedData = () => {
80
84
  throw new Error(`MUI X: The data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items).`);
81
85
  }
82
86
  }
83
- const areaPath = (0, _d3Shape.area)().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y0(d => {
87
+ const shouldExpand = curve?.includes('step') && !strictStepCurve && (0, _isBandScale.isBandScale)(xScale);
88
+ const formattedData = xData?.flatMap((x, index) => {
89
+ const nullData = data[index] == null;
90
+ if (shouldExpand) {
91
+ const rep = [{
92
+ x,
93
+ y: stackedData[index],
94
+ nullData,
95
+ isExtension: false
96
+ }];
97
+ if (!nullData && (index === 0 || data[index - 1] == null)) {
98
+ rep.unshift({
99
+ x: (xScale(x) ?? 0) - (xScale.step() - xScale.bandwidth()) / 2,
100
+ y: stackedData[index],
101
+ nullData,
102
+ isExtension: true
103
+ });
104
+ }
105
+ if (!nullData && (index === data.length - 1 || data[index + 1] == null)) {
106
+ rep.push({
107
+ x: (xScale(x) ?? 0) + (xScale.step() + xScale.bandwidth()) / 2,
108
+ y: stackedData[index],
109
+ nullData,
110
+ isExtension: true
111
+ });
112
+ }
113
+ return rep;
114
+ }
115
+ return {
116
+ x,
117
+ y: stackedData[index],
118
+ nullData
119
+ };
120
+ }) ?? [];
121
+ const d3Data = connectNulls ? formattedData.filter(d => !d.nullData) : formattedData;
122
+ const areaPath = (0, _d3Shape.area)().x(d => d.isExtension ? d.x : xPosition(d.x)).defined(d => connectNulls || !d.nullData || !!d.isExtension).y0(d => {
84
123
  if (typeof baseline === 'number') {
85
124
  return yScale(baseline);
86
125
  }
@@ -96,13 +135,7 @@ const useAggregatedData = () => {
96
135
  }
97
136
  return value;
98
137
  }).y1(d => d.y && yScale(d.y[1]));
99
- const curve = (0, _getCurve.default)(series[seriesId].curve);
100
- const formattedData = xData?.map((x, index) => ({
101
- x,
102
- y: stackedData[index]
103
- })) ?? [];
104
- const d3Data = connectNulls ? formattedData.filter((_, i) => data[i] != null) : formattedData;
105
- const d = areaPath.curve(curve)(d3Data) || '';
138
+ const d = areaPath.curve((0, _getCurve.default)(curve))(d3Data) || '';
106
139
  return (0, _extends2.default)({}, series[seriesId], {
107
140
  gradientId,
108
141
  d,
@@ -12,7 +12,6 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
12
12
  var React = _interopRequireWildcard(require("react"));
13
13
  var _propTypes = _interopRequireDefault(require("prop-types"));
14
14
  var _styles = require("@mui/material/styles");
15
- var _warning = require("@mui/x-internals/warning");
16
15
  var _web = require("@react-spring/web");
17
16
  var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
18
17
  var _context = require("../context");
@@ -21,7 +20,7 @@ var _useSelector = require("../internals/store/useSelector");
21
20
  var _useChartInteraction = require("../internals/plugins/featurePlugins/useChartInteraction");
22
21
  var _useStore = require("../internals/store/useStore");
23
22
  var _jsxRuntime = require("react/jsx-runtime");
24
- const _excluded = ["x", "y", "id", "classes", "color", "dataIndex", "onClick", "skipAnimation", "shape"];
23
+ const _excluded = ["x", "y", "id", "classes", "color", "dataIndex", "onClick", "skipAnimation"];
25
24
  /**
26
25
  * The line mark element that only render circle for performance improvement.
27
26
  *
@@ -43,13 +42,9 @@ function CircleMarkElement(props) {
43
42
  color,
44
43
  dataIndex,
45
44
  onClick,
46
- skipAnimation,
47
- shape
45
+ skipAnimation
48
46
  } = props,
49
47
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
50
- if (shape !== 'circle') {
51
- (0, _warning.warnOnce)([`MUI X: The mark element of your line chart have shape "${shape}" which is not supported when using \`experimentalRendering=true\`.`, 'Only "circle" are supported with `experimentalRendering`.'].join('\n'), 'error');
52
- }
53
48
  const theme = (0, _styles.useTheme)();
54
49
  const getInteractionItemProps = (0, _useInteractionItemProps.useInteractionItemProps)();
55
50
  const {
@@ -25,7 +25,7 @@ var _ChartsOnAxisClickHandler = require("../ChartsOnAxisClickHandler");
25
25
  var _ChartsOverlay = require("../ChartsOverlay");
26
26
  var _useLineChartProps = require("./useLineChartProps");
27
27
  var _useChartContainerProps = require("../ChartContainer/useChartContainerProps");
28
- var _context = require("../context");
28
+ var _ChartDataProvider = require("../ChartDataProvider");
29
29
  var _ChartsSurface = require("../ChartsSurface");
30
30
  var _ChartsWrapper = require("../internals/components/ChartsWrapper");
31
31
  var _jsxRuntime = require("react/jsx-runtime");
@@ -66,7 +66,7 @@ const LineChart = exports.LineChart = /*#__PURE__*/React.forwardRef(function Lin
66
66
  chartsSurfaceProps
67
67
  } = (0, _useChartContainerProps.useChartContainerProps)(chartContainerProps, ref);
68
68
  const Tooltip = props.slots?.tooltip ?? _ChartsTooltip.ChartsTooltip;
69
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.ChartDataProvider, (0, _extends2.default)({}, chartDataProviderProps, {
69
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProvider.ChartDataProvider, (0, _extends2.default)({}, chartDataProviderProps, {
70
70
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsWrapper.ChartsWrapper, (0, _extends2.default)({}, chartsWrapperProps, {
71
71
  children: [!props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
72
72
  children: [props.onAxisClick && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOnAxisClickHandler.ChartsOnAxisClickHandler, (0, _extends2.default)({}, axisClickHandlerProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", (0, _extends2.default)({}, clipPathGroupProps, {
@@ -124,10 +124,6 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
124
124
  * If `true`, render the line highlight item.
125
125
  */
126
126
  disableLineItemHighlight: _propTypes.default.bool,
127
- /**
128
- * If `true` marks will render `<circle />` instead of `<path />` and drop theme override for faster rendering.
129
- */
130
- experimentalMarkRendering: _propTypes.default.bool,
131
127
  /**
132
128
  * Option to display a cartesian grid in the background.
133
129
  */
@@ -13,12 +13,14 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
13
13
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
14
14
  var React = _interopRequireWildcard(require("react"));
15
15
  var _propTypes = _interopRequireDefault(require("prop-types"));
16
+ var _d3Shape = require("@mui/x-charts-vendor/d3-shape");
16
17
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
17
18
  var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
18
19
  var _styles = require("@mui/material/styles");
19
20
  var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
21
+ var _getSymbol = require("../internals/getSymbol");
20
22
  var _jsxRuntime = require("react/jsx-runtime");
21
- const _excluded = ["x", "y", "id", "classes", "color"];
23
+ const _excluded = ["x", "y", "id", "classes", "color", "shape"];
22
24
  function getHighlightElementUtilityClass(slot) {
23
25
  return (0, _generateUtilityClass.default)('MuiHighlightElement', slot);
24
26
  }
@@ -33,7 +35,18 @@ const useUtilityClasses = ownerState => {
33
35
  };
34
36
  return (0, _composeClasses.default)(slots, getHighlightElementUtilityClass, classes);
35
37
  };
36
- const HighlightElement = (0, _styles.styled)('circle', {
38
+ const HighlightPathElement = (0, _styles.styled)('path', {
39
+ name: 'MuiHighlightElement',
40
+ slot: 'Root',
41
+ overridesResolver: (_, styles) => styles.root
42
+ })(({
43
+ ownerState
44
+ }) => ({
45
+ transform: `translate(${ownerState.x}px, ${ownerState.y}px)`,
46
+ transformOrigin: `${ownerState.x}px ${ownerState.y}px`,
47
+ fill: ownerState.color
48
+ }));
49
+ const HighlightCircleElement = (0, _styles.styled)('circle', {
37
50
  name: 'MuiHighlightElement',
38
51
  slot: 'Root',
39
52
  overridesResolver: (_, styles) => styles.root
@@ -60,7 +73,8 @@ function LineHighlightElement(props) {
60
73
  y,
61
74
  id,
62
75
  classes: innerClasses,
63
- color
76
+ color,
77
+ shape
64
78
  } = props,
65
79
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
66
80
  const ownerState = {
@@ -71,14 +85,19 @@ function LineHighlightElement(props) {
71
85
  y
72
86
  };
73
87
  const classes = useUtilityClasses(ownerState);
74
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(HighlightElement, (0, _extends2.default)({
75
- pointerEvents: "none",
76
- ownerState: ownerState,
77
- className: classes.root,
88
+ const Element = shape === 'circle' ? HighlightCircleElement : HighlightPathElement;
89
+ const additionalProps = shape === 'circle' ? {
78
90
  cx: 0,
79
91
  cy: 0,
80
92
  r: other.r === undefined ? 5 : other.r
81
- }, other));
93
+ } : {
94
+ d: (0, _d3Shape.symbol)(_d3Shape.symbolsFill[(0, _getSymbol.getSymbol)(shape)])()
95
+ };
96
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Element, (0, _extends2.default)({
97
+ pointerEvents: "none",
98
+ ownerState: ownerState,
99
+ className: classes.root
100
+ }, additionalProps, other));
82
101
  }
83
102
  process.env.NODE_ENV !== "production" ? LineHighlightElement.propTypes = {
84
103
  // ----------------------------- Warning --------------------------------
@@ -86,5 +105,6 @@ process.env.NODE_ENV !== "production" ? LineHighlightElement.propTypes = {
86
105
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
87
106
  // ----------------------------------------------------------------------
88
107
  classes: _propTypes.default.object,
89
- id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired
108
+ id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
109
+ shape: _propTypes.default.oneOf(['circle', 'cross', 'diamond', 'square', 'star', 'triangle', 'wye']).isRequired
90
110
  } : void 0;
@@ -77,7 +77,8 @@ function LineHighlightPlot(props) {
77
77
  yAxisId = defaultYAxisId,
78
78
  stackedData,
79
79
  data,
80
- disableHighlight
80
+ disableHighlight,
81
+ shape = 'circle'
81
82
  } = series[seriesId];
82
83
  if (disableHighlight || data[highlightedIndex] == null) {
83
84
  return null;
@@ -102,7 +103,8 @@ function LineHighlightPlot(props) {
102
103
  id: seriesId,
103
104
  color: colorGetter(highlightedIndex),
104
105
  x: x,
105
- y: y
106
+ y: y,
107
+ shape: shape
106
108
  }, slotProps?.lineHighlight), `${seriesId}`);
107
109
  });
108
110
  })
@@ -16,6 +16,7 @@ var _d3Shape = require("@mui/x-charts-vendor/d3-shape");
16
16
  var _LineElement = require("./LineElement");
17
17
  var _useScale = require("../hooks/useScale");
18
18
  var _getCurve = _interopRequireDefault(require("../internals/getCurve"));
19
+ var _isBandScale = require("../internals/isBandScale");
19
20
  var _constants = require("../constants");
20
21
  var _useSeries = require("../hooks/useSeries");
21
22
  var _AnimationProvider = require("../context/AnimationProvider");
@@ -64,9 +65,12 @@ const useAggregatedData = () => {
64
65
  yAxisId = defaultYAxisId,
65
66
  stackedData,
66
67
  data,
67
- connectNulls
68
+ connectNulls,
69
+ curve,
70
+ strictStepCurve
68
71
  } = series[seriesId];
69
- const xScale = (0, _useScale.getValueToPositionMapper)(xAxis[xAxisId].scale);
72
+ const xScale = xAxis[xAxisId].scale;
73
+ const xPosition = (0, _useScale.getValueToPositionMapper)(xScale);
70
74
  const yScale = yAxis[yAxisId].scale;
71
75
  const xData = xAxis[xAxisId].data;
72
76
  const gradientId = yAxis[yAxisId].colorScale && getGradientId(yAxisId) || xAxis[xAxisId].colorScale && getGradientId(xAxisId) || undefined;
@@ -78,13 +82,43 @@ const useAggregatedData = () => {
78
82
  throw new Error(`MUI X: The data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items).`);
79
83
  }
80
84
  }
81
- const linePath = (0, _d3Shape.line)().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y(d => yScale(d.y[1]));
82
- const formattedData = xData?.map((x, index) => ({
83
- x,
84
- y: stackedData[index]
85
- })) ?? [];
86
- const d3Data = connectNulls ? formattedData.filter((_, i) => data[i] != null) : formattedData;
87
- const d = linePath.curve((0, _getCurve.default)(series[seriesId].curve))(d3Data) || '';
85
+ const shouldExpand = curve?.includes('step') && !strictStepCurve && (0, _isBandScale.isBandScale)(xScale);
86
+ const formattedData = xData?.flatMap((x, index) => {
87
+ const nullData = data[index] == null;
88
+ if (shouldExpand) {
89
+ const rep = [{
90
+ x,
91
+ y: stackedData[index],
92
+ nullData,
93
+ isExtension: false
94
+ }];
95
+ if (!nullData && (index === 0 || data[index - 1] == null)) {
96
+ rep.unshift({
97
+ x: (xScale(x) ?? 0) - (xScale.step() - xScale.bandwidth()) / 2,
98
+ y: stackedData[index],
99
+ nullData,
100
+ isExtension: true
101
+ });
102
+ }
103
+ if (!nullData && (index === data.length - 1 || data[index + 1] == null)) {
104
+ rep.push({
105
+ x: (xScale(x) ?? 0) + (xScale.step() + xScale.bandwidth()) / 2,
106
+ y: stackedData[index],
107
+ nullData,
108
+ isExtension: true
109
+ });
110
+ }
111
+ return rep;
112
+ }
113
+ return {
114
+ x,
115
+ y: stackedData[index],
116
+ nullData
117
+ };
118
+ }) ?? [];
119
+ const d3Data = connectNulls ? formattedData.filter(d => !d.nullData) : formattedData;
120
+ const linePath = (0, _d3Shape.line)().x(d => d.isExtension ? d.x : xPosition(d.x)).defined(d => connectNulls || !d.nullData || !!d.isExtension).y(d => yScale(d.y[1]));
121
+ const d = linePath.curve((0, _getCurve.default)(curve))(d3Data) || '';
88
122
  return (0, _extends2.default)({}, series[seriesId], {
89
123
  gradientId,
90
124
  d,