@mui/x-charts-premium 9.2.0 → 9.3.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.
Files changed (54) hide show
  1. package/BarChartPremium/BarChartPremium.js +30 -30
  2. package/BarChartPremium/BarChartPremium.mjs +30 -30
  3. package/CHANGELOG.md +118 -0
  4. package/CandlestickChart/CandlestickChart.js +25 -25
  5. package/CandlestickChart/CandlestickChart.mjs +25 -25
  6. package/ChartsDataProviderPremium/ChartsDataProviderPremium.js +2 -2
  7. package/ChartsDataProviderPremium/ChartsDataProviderPremium.mjs +2 -2
  8. package/ChartsRadialDataProviderPremium/ChartsRadialDataProviderPremium.js +2 -2
  9. package/ChartsRadialDataProviderPremium/ChartsRadialDataProviderPremium.mjs +2 -2
  10. package/HeatmapPremium/HeatmapPremium.js +20 -20
  11. package/HeatmapPremium/HeatmapPremium.mjs +20 -20
  12. package/RadialBarChart/RadialBarChart.js +10 -10
  13. package/RadialBarChart/RadialBarChart.mjs +10 -10
  14. package/RadialBarChart/seriesConfig/getColor.js +7 -51
  15. package/RadialBarChart/seriesConfig/getColor.mjs +8 -52
  16. package/RadialBarChart/seriesConfig/tooltip.js +3 -26
  17. package/RadialBarChart/seriesConfig/tooltip.mjs +4 -27
  18. package/RadialLineChart/RadialArea.d.mts +2 -11
  19. package/RadialLineChart/RadialArea.d.ts +2 -11
  20. package/RadialLineChart/RadialArea.js +4 -3
  21. package/RadialLineChart/RadialArea.mjs +4 -3
  22. package/RadialLineChart/RadialAreaPlot.js +3 -1
  23. package/RadialLineChart/RadialAreaPlot.mjs +3 -1
  24. package/RadialLineChart/RadialLine.d.mts +4 -3
  25. package/RadialLineChart/RadialLine.d.ts +4 -3
  26. package/RadialLineChart/RadialLine.js +4 -3
  27. package/RadialLineChart/RadialLine.mjs +4 -3
  28. package/RadialLineChart/RadialLineChart.d.mts +7 -5
  29. package/RadialLineChart/RadialLineChart.d.ts +7 -5
  30. package/RadialLineChart/RadialLineChart.js +11 -11
  31. package/RadialLineChart/RadialLineChart.mjs +11 -11
  32. package/RadialLineChart/RadialLinePlot.js +3 -1
  33. package/RadialLineChart/RadialLinePlot.mjs +3 -1
  34. package/RadialLineChart/seriesConfig/getColor.js +6 -53
  35. package/RadialLineChart/seriesConfig/getColor.mjs +7 -54
  36. package/RadialLineChart/seriesConfig/seriesProcessor.d.mts +2 -2
  37. package/RadialLineChart/seriesConfig/seriesProcessor.d.ts +2 -2
  38. package/RadialLineChart/seriesConfig/seriesProcessor.js +1 -138
  39. package/RadialLineChart/seriesConfig/seriesProcessor.mjs +2 -138
  40. package/RadialLineChart/seriesConfig/tooltip.js +3 -24
  41. package/RadialLineChart/seriesConfig/tooltip.mjs +4 -25
  42. package/RadialLineChart/useRadialLinePlotData.d.mts +1 -0
  43. package/RadialLineChart/useRadialLinePlotData.d.ts +1 -0
  44. package/RadialLineChart/useRadialLinePlotData.js +3 -1
  45. package/RadialLineChart/useRadialLinePlotData.mjs +3 -1
  46. package/ScatterChartPremium/ScatterChartPremium.js +30 -30
  47. package/ScatterChartPremium/ScatterChartPremium.mjs +30 -30
  48. package/index.js +1 -1
  49. package/index.mjs +1 -1
  50. package/models/seriesType/radialBar.d.mts +1 -1
  51. package/models/seriesType/radialBar.d.ts +1 -1
  52. package/models/seriesType/radialLine.d.mts +4 -0
  53. package/models/seriesType/radialLine.d.ts +4 -0
  54. package/package.json +5 -5
@@ -13,14 +13,15 @@ var _d3Shape = require("@mui/x-charts-vendor/d3-shape");
13
13
  var _internals = require("@mui/x-charts/internals");
14
14
  var _hooks = require("../hooks");
15
15
  var _jsxRuntime = require("react/jsx-runtime");
16
- const _excluded = ["seriesId", "color", "hidden", "points", "curve"];
16
+ const _excluded = ["seriesId", "color", "hidden", "points", "curve", "closePath"];
17
17
  function RadialLine(props) {
18
18
  const {
19
19
  seriesId,
20
20
  color,
21
21
  hidden,
22
22
  points,
23
- curve
23
+ curve,
24
+ closePath
24
25
  } = props,
25
26
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
26
27
  const identifier = React.useMemo(() => ({
@@ -30,7 +31,7 @@ function RadialLine(props) {
30
31
  const highlightState = (0, _hooks.useItemHighlightState)(identifier);
31
32
  const isHighlighted = highlightState === 'highlighted';
32
33
  const isFaded = highlightState === 'faded';
33
- const d = (0, _d3Shape.lineRadial)().angle(p => p.angle).radius(p => p.radius).curve((0, _internals.getCurveFactory)(curve))(points) || '';
34
+ const d = (0, _d3Shape.lineRadial)().angle(p => p.angle).radius(p => p.radius).curve((0, _internals.getCurveFactory)(curve))(closePath ? [...points, points[0]] : points) || '';
34
35
  const fadedOpacity = isFaded ? 0.3 : 1;
35
36
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("path", (0, _extends2.default)({
36
37
  "data-series": seriesId,
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["seriesId", "color", "hidden", "points", "curve"];
3
+ const _excluded = ["seriesId", "color", "hidden", "points", "curve", "closePath"];
4
4
  import * as React from 'react';
5
5
  import { lineRadial as d3LineRadial } from '@mui/x-charts-vendor/d3-shape';
6
6
  import { getCurveFactory } from '@mui/x-charts/internals';
@@ -12,7 +12,8 @@ function RadialLine(props) {
12
12
  color,
13
13
  hidden,
14
14
  points,
15
- curve
15
+ curve,
16
+ closePath
16
17
  } = props,
17
18
  other = _objectWithoutPropertiesLoose(props, _excluded);
18
19
  const identifier = React.useMemo(() => ({
@@ -22,7 +23,7 @@ function RadialLine(props) {
22
23
  const highlightState = useItemHighlightState(identifier);
23
24
  const isHighlighted = highlightState === 'highlighted';
24
25
  const isFaded = highlightState === 'faded';
25
- const d = d3LineRadial().angle(p => p.angle).radius(p => p.radius).curve(getCurveFactory(curve))(points) || '';
26
+ const d = d3LineRadial().angle(p => p.angle).radius(p => p.radius).curve(getCurveFactory(curve))(closePath ? [...points, points[0]] : points) || '';
26
27
  const fadedOpacity = isFaded ? 0.3 : 1;
27
28
  return /*#__PURE__*/_jsx("path", _extends({
28
29
  "data-series": seriesId,
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import type { MakeOptional } from '@mui/x-internals/types';
2
3
  import { type ChartsSlots, type ChartsSlotProps } from '@mui/x-charts/internals';
3
4
  import { type ChartsRadialGridProps } from '@mui/x-charts/ChartsRadialGrid';
4
5
  import { type ChartsRadialAxisHighlightProps } from '@mui/x-charts/ChartsRadialAxisHighlight';
@@ -6,18 +7,19 @@ import { type ChartsLegendSlots, type ChartsLegendSlotProps } from "../ChartsLeg
6
7
  import { type ChartsTooltipSlots, type ChartsTooltipSlotProps } from "../ChartsTooltip/index.mjs";
7
8
  import { type RadialLineChartPluginSignatures } from "./RadialLineChart.plugins.mjs";
8
9
  import { type ChartsOverlayProps, type ChartsOverlaySlots, type ChartsOverlaySlotProps } from "../ChartsOverlay/index.mjs";
9
- import type { LinePlotSlots, LinePlotSlotProps, LineSeries } from "../LineChart/index.mjs";
10
10
  import { type ChartsToolbarSlots, type ChartsToolbarSlotProps } from "../Toolbar/index.mjs";
11
11
  import { type RadialLineHighlightPlotSlots, type RadialLineHighlightPlotSlotProps } from "./RadialLineHighlightPlot.mjs";
12
12
  import { type ChartsRadialDataProviderPremiumProps } from "../ChartsRadialDataProviderPremium/index.mjs";
13
- export interface RadialLineChartSlots extends LinePlotSlots, RadialLineHighlightPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
14
- export interface RadialLineChartSlotProps extends LinePlotSlotProps, RadialLineHighlightPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
13
+ import type { RadialLineSeriesType } from "../models/seriesType/radialLine.mjs";
14
+ export interface RadialLineChartSlots extends RadialLineHighlightPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
15
+ export interface RadialLineChartSlotProps extends RadialLineHighlightPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
16
+ export type RadialLineSeries = MakeOptional<RadialLineSeriesType, 'type'>;
15
17
  export interface RadialLineChartProps extends Omit<ChartsRadialDataProviderPremiumProps<'radialLine', RadialLineChartPluginSignatures>, 'series' | 'plugins' | 'zAxis' | 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
16
18
  /**
17
19
  * The series to display in the line chart.
18
- * An array of [[LineSeries]] objects.
20
+ * An array of [[RadialLineSeries]] objects.
19
21
  */
20
- series: Readonly<LineSeries[]>;
22
+ series: Readonly<RadialLineSeries[]>;
21
23
  /**
22
24
  * Option to display a radial grid in the background.
23
25
  */
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import type { MakeOptional } from '@mui/x-internals/types';
2
3
  import { type ChartsSlots, type ChartsSlotProps } from '@mui/x-charts/internals';
3
4
  import { type ChartsRadialGridProps } from '@mui/x-charts/ChartsRadialGrid';
4
5
  import { type ChartsRadialAxisHighlightProps } from '@mui/x-charts/ChartsRadialAxisHighlight';
@@ -6,18 +7,19 @@ import { type ChartsLegendSlots, type ChartsLegendSlotProps } from "../ChartsLeg
6
7
  import { type ChartsTooltipSlots, type ChartsTooltipSlotProps } from "../ChartsTooltip/index.js";
7
8
  import { type RadialLineChartPluginSignatures } from "./RadialLineChart.plugins.js";
8
9
  import { type ChartsOverlayProps, type ChartsOverlaySlots, type ChartsOverlaySlotProps } from "../ChartsOverlay/index.js";
9
- import type { LinePlotSlots, LinePlotSlotProps, LineSeries } from "../LineChart/index.js";
10
10
  import { type ChartsToolbarSlots, type ChartsToolbarSlotProps } from "../Toolbar/index.js";
11
11
  import { type RadialLineHighlightPlotSlots, type RadialLineHighlightPlotSlotProps } from "./RadialLineHighlightPlot.js";
12
12
  import { type ChartsRadialDataProviderPremiumProps } from "../ChartsRadialDataProviderPremium/index.js";
13
- export interface RadialLineChartSlots extends LinePlotSlots, RadialLineHighlightPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
14
- export interface RadialLineChartSlotProps extends LinePlotSlotProps, RadialLineHighlightPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
13
+ import type { RadialLineSeriesType } from "../models/seriesType/radialLine.js";
14
+ export interface RadialLineChartSlots extends RadialLineHighlightPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
15
+ export interface RadialLineChartSlotProps extends RadialLineHighlightPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
16
+ export type RadialLineSeries = MakeOptional<RadialLineSeriesType, 'type'>;
15
17
  export interface RadialLineChartProps extends Omit<ChartsRadialDataProviderPremiumProps<'radialLine', RadialLineChartPluginSignatures>, 'series' | 'plugins' | 'zAxis' | 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
16
18
  /**
17
19
  * The series to display in the line chart.
18
- * An array of [[LineSeries]] objects.
20
+ * An array of [[RadialLineSeries]] objects.
19
21
  */
20
- series: Readonly<LineSeries[]>;
22
+ series: Readonly<RadialLineSeries[]>;
21
23
  /**
22
24
  * Option to display a radial grid in the background.
23
25
  */
@@ -161,11 +161,11 @@ process.env.NODE_ENV !== "production" ? RadialLineChart.propTypes = {
161
161
  hiddenItems: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.shape({
162
162
  dataIndex: _propTypes.default.number,
163
163
  seriesId: _propTypes.default.string.isRequired,
164
- type: _propTypes.default.oneOf(['radialLine'])
164
+ type: _propTypes.default.oneOf(['radialLine']).isRequired
165
165
  }), _propTypes.default.shape({
166
166
  dataIndex: _propTypes.default.number,
167
167
  seriesId: _propTypes.default.string.isRequired,
168
- type: _propTypes.default.oneOf(['radialLine']).isRequired
168
+ type: _propTypes.default.oneOf(['radialLine'])
169
169
  })]).isRequired),
170
170
  /**
171
171
  * If `true`, the legend is not rendered.
@@ -177,11 +177,11 @@ process.env.NODE_ENV !== "production" ? RadialLineChart.propTypes = {
177
177
  */
178
178
  highlightedItem: _propTypes.default.oneOfType([_propTypes.default.shape({
179
179
  dataIndex: _propTypes.default.number,
180
- seriesId: _propTypes.default.string.isRequired,
181
- type: _propTypes.default.oneOf(['radialLine']).isRequired
180
+ seriesId: _propTypes.default.string.isRequired
182
181
  }), _propTypes.default.shape({
183
182
  dataIndex: _propTypes.default.number,
184
- seriesId: _propTypes.default.string.isRequired
183
+ seriesId: _propTypes.default.string.isRequired,
184
+ type: _propTypes.default.oneOf(['radialLine']).isRequired
185
185
  })]),
186
186
  /**
187
187
  * This prop is used to help implement the accessibility logic.
@@ -212,11 +212,11 @@ process.env.NODE_ENV !== "production" ? RadialLineChart.propTypes = {
212
212
  initialHiddenItems: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.shape({
213
213
  dataIndex: _propTypes.default.number,
214
214
  seriesId: _propTypes.default.string.isRequired,
215
- type: _propTypes.default.oneOf(['radialLine'])
215
+ type: _propTypes.default.oneOf(['radialLine']).isRequired
216
216
  }), _propTypes.default.shape({
217
217
  dataIndex: _propTypes.default.number,
218
218
  seriesId: _propTypes.default.string.isRequired,
219
- type: _propTypes.default.oneOf(['radialLine']).isRequired
219
+ type: _propTypes.default.oneOf(['radialLine'])
220
220
  })]).isRequired),
221
221
  /**
222
222
  * If `true`, a loading overlay is displayed.
@@ -277,7 +277,7 @@ process.env.NODE_ENV !== "production" ? RadialLineChart.propTypes = {
277
277
  rotationAxis: _propTypes.default.arrayOf(_propTypes.default.object),
278
278
  /**
279
279
  * The series to display in the line chart.
280
- * An array of [[LineSeries]] objects.
280
+ * An array of [[RadialLineSeries]] objects.
281
281
  */
282
282
  series: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
283
283
  /**
@@ -307,11 +307,11 @@ process.env.NODE_ENV !== "production" ? RadialLineChart.propTypes = {
307
307
  */
308
308
  tooltipItem: _propTypes.default.oneOfType([_propTypes.default.shape({
309
309
  dataIndex: _propTypes.default.number,
310
- seriesId: _propTypes.default.string.isRequired,
311
- type: _propTypes.default.oneOf(['radialLine']).isRequired
310
+ seriesId: _propTypes.default.string.isRequired
312
311
  }), _propTypes.default.shape({
313
312
  dataIndex: _propTypes.default.number,
314
- seriesId: _propTypes.default.string.isRequired
313
+ seriesId: _propTypes.default.string.isRequired,
314
+ type: _propTypes.default.oneOf(['radialLine']).isRequired
315
315
  })]),
316
316
  /**
317
317
  * The width of the chart in px. If not defined, it takes the width of the parent element.
@@ -153,11 +153,11 @@ process.env.NODE_ENV !== "production" ? RadialLineChart.propTypes = {
153
153
  hiddenItems: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.shape({
154
154
  dataIndex: PropTypes.number,
155
155
  seriesId: PropTypes.string.isRequired,
156
- type: PropTypes.oneOf(['radialLine'])
156
+ type: PropTypes.oneOf(['radialLine']).isRequired
157
157
  }), PropTypes.shape({
158
158
  dataIndex: PropTypes.number,
159
159
  seriesId: PropTypes.string.isRequired,
160
- type: PropTypes.oneOf(['radialLine']).isRequired
160
+ type: PropTypes.oneOf(['radialLine'])
161
161
  })]).isRequired),
162
162
  /**
163
163
  * If `true`, the legend is not rendered.
@@ -169,11 +169,11 @@ process.env.NODE_ENV !== "production" ? RadialLineChart.propTypes = {
169
169
  */
170
170
  highlightedItem: PropTypes.oneOfType([PropTypes.shape({
171
171
  dataIndex: PropTypes.number,
172
- seriesId: PropTypes.string.isRequired,
173
- type: PropTypes.oneOf(['radialLine']).isRequired
172
+ seriesId: PropTypes.string.isRequired
174
173
  }), PropTypes.shape({
175
174
  dataIndex: PropTypes.number,
176
- seriesId: PropTypes.string.isRequired
175
+ seriesId: PropTypes.string.isRequired,
176
+ type: PropTypes.oneOf(['radialLine']).isRequired
177
177
  })]),
178
178
  /**
179
179
  * This prop is used to help implement the accessibility logic.
@@ -204,11 +204,11 @@ process.env.NODE_ENV !== "production" ? RadialLineChart.propTypes = {
204
204
  initialHiddenItems: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.shape({
205
205
  dataIndex: PropTypes.number,
206
206
  seriesId: PropTypes.string.isRequired,
207
- type: PropTypes.oneOf(['radialLine'])
207
+ type: PropTypes.oneOf(['radialLine']).isRequired
208
208
  }), PropTypes.shape({
209
209
  dataIndex: PropTypes.number,
210
210
  seriesId: PropTypes.string.isRequired,
211
- type: PropTypes.oneOf(['radialLine']).isRequired
211
+ type: PropTypes.oneOf(['radialLine'])
212
212
  })]).isRequired),
213
213
  /**
214
214
  * If `true`, a loading overlay is displayed.
@@ -269,7 +269,7 @@ process.env.NODE_ENV !== "production" ? RadialLineChart.propTypes = {
269
269
  rotationAxis: PropTypes.arrayOf(PropTypes.object),
270
270
  /**
271
271
  * The series to display in the line chart.
272
- * An array of [[LineSeries]] objects.
272
+ * An array of [[RadialLineSeries]] objects.
273
273
  */
274
274
  series: PropTypes.arrayOf(PropTypes.object).isRequired,
275
275
  /**
@@ -299,11 +299,11 @@ process.env.NODE_ENV !== "production" ? RadialLineChart.propTypes = {
299
299
  */
300
300
  tooltipItem: PropTypes.oneOfType([PropTypes.shape({
301
301
  dataIndex: PropTypes.number,
302
- seriesId: PropTypes.string.isRequired,
303
- type: PropTypes.oneOf(['radialLine']).isRequired
302
+ seriesId: PropTypes.string.isRequired
304
303
  }), PropTypes.shape({
305
304
  dataIndex: PropTypes.number,
306
- seriesId: PropTypes.string.isRequired
305
+ seriesId: PropTypes.string.isRequired,
306
+ type: PropTypes.oneOf(['radialLine']).isRequired
307
307
  })]),
308
308
  /**
309
309
  * The width of the chart in px. If not defined, it takes the width of the parent element.
@@ -37,13 +37,15 @@ function RadialLinePlot(props) {
37
37
  seriesId,
38
38
  color,
39
39
  hidden,
40
- curve
40
+ curve,
41
+ closePath
41
42
  }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadialLine.RadialLine, {
42
43
  seriesId: seriesId,
43
44
  color: color,
44
45
  hidden: hidden,
45
46
  points: points,
46
47
  curve: curve,
48
+ closePath: closePath,
47
49
  className: classes.line
48
50
  }, seriesId))
49
51
  });
@@ -31,13 +31,15 @@ export function RadialLinePlot(props) {
31
31
  seriesId,
32
32
  color,
33
33
  hidden,
34
- curve
34
+ curve,
35
+ closePath
35
36
  }) => /*#__PURE__*/_jsx(RadialLine, {
36
37
  seriesId: seriesId,
37
38
  color: color,
38
39
  hidden: hidden,
39
40
  points: points,
40
41
  curve: curve,
42
+ closePath: closePath,
41
43
  className: classes.line
42
44
  }, seriesId))
43
45
  });
@@ -5,57 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _internals = require("@mui/x-charts/internals");
8
- const getColor = (series, rotationAxis, radiusAxis) => {
9
- const yColorScale = radiusAxis?.colorScale;
10
- const xColorScale = rotationAxis?.colorScale;
11
- const getSeriesColor = (0, _internals.getSeriesColorFn)(series);
12
- if (yColorScale) {
13
- return dataIndex => {
14
- if (dataIndex === undefined) {
15
- return series.color;
16
- }
17
- const value = series.data[dataIndex];
18
- const color = value === null ? getSeriesColor({
19
- value,
20
- dataIndex
21
- }) : yColorScale(value);
22
- if (color === null) {
23
- return getSeriesColor({
24
- value,
25
- dataIndex
26
- });
27
- }
28
- return color;
29
- };
30
- }
31
- if (xColorScale) {
32
- return dataIndex => {
33
- if (dataIndex === undefined) {
34
- return series.color;
35
- }
36
- const value = rotationAxis.data?.[dataIndex];
37
- const color = value === null ? getSeriesColor({
38
- value,
39
- dataIndex
40
- }) : xColorScale(value);
41
- if (color === null) {
42
- return getSeriesColor({
43
- value,
44
- dataIndex
45
- });
46
- }
47
- return color;
48
- };
49
- }
50
- return dataIndex => {
51
- if (dataIndex === undefined) {
52
- return series.color;
53
- }
54
- const value = series.data[dataIndex];
55
- return getSeriesColor({
56
- value,
57
- dataIndex
58
- });
59
- };
60
- };
8
+ const getColor = (series, rotationAxis, radiusAxis) => (0, _internals.resolveColorProcessor)({
9
+ series,
10
+ valueColorScale: radiusAxis?.colorScale,
11
+ categoryColorScale: rotationAxis?.colorScale,
12
+ categoryValues: rotationAxis?.data
13
+ });
61
14
  var _default = exports.default = getColor;
@@ -1,55 +1,8 @@
1
- import { getSeriesColorFn } from '@mui/x-charts/internals';
2
- const getColor = (series, rotationAxis, radiusAxis) => {
3
- const yColorScale = radiusAxis?.colorScale;
4
- const xColorScale = rotationAxis?.colorScale;
5
- const getSeriesColor = getSeriesColorFn(series);
6
- if (yColorScale) {
7
- return dataIndex => {
8
- if (dataIndex === undefined) {
9
- return series.color;
10
- }
11
- const value = series.data[dataIndex];
12
- const color = value === null ? getSeriesColor({
13
- value,
14
- dataIndex
15
- }) : yColorScale(value);
16
- if (color === null) {
17
- return getSeriesColor({
18
- value,
19
- dataIndex
20
- });
21
- }
22
- return color;
23
- };
24
- }
25
- if (xColorScale) {
26
- return dataIndex => {
27
- if (dataIndex === undefined) {
28
- return series.color;
29
- }
30
- const value = rotationAxis.data?.[dataIndex];
31
- const color = value === null ? getSeriesColor({
32
- value,
33
- dataIndex
34
- }) : xColorScale(value);
35
- if (color === null) {
36
- return getSeriesColor({
37
- value,
38
- dataIndex
39
- });
40
- }
41
- return color;
42
- };
43
- }
44
- return dataIndex => {
45
- if (dataIndex === undefined) {
46
- return series.color;
47
- }
48
- const value = series.data[dataIndex];
49
- return getSeriesColor({
50
- value,
51
- dataIndex
52
- });
53
- };
54
- };
1
+ import { resolveColorProcessor } from '@mui/x-charts/internals';
2
+ const getColor = (series, rotationAxis, radiusAxis) => resolveColorProcessor({
3
+ series,
4
+ valueColorScale: radiusAxis?.colorScale,
5
+ categoryColorScale: rotationAxis?.colorScale,
6
+ categoryValues: rotationAxis?.data
7
+ });
55
8
  export default getColor;
@@ -1,3 +1,3 @@
1
- import type { SeriesProcessorParams, SeriesProcessorResult, IsItemVisibleFunction, DatasetType } from '@mui/x-charts/internals';
2
- declare function seriesProcessor(params: SeriesProcessorParams<'radialLine'>, dataset?: Readonly<DatasetType>, isItemVisible?: IsItemVisibleFunction): SeriesProcessorResult<'radialLine'>;
1
+ import { type SeriesProcessor } from '@mui/x-charts/internals';
2
+ declare const seriesProcessor: SeriesProcessor<'radialLine'>;
3
3
  export default seriesProcessor;
@@ -1,3 +1,3 @@
1
- import type { SeriesProcessorParams, SeriesProcessorResult, IsItemVisibleFunction, DatasetType } from '@mui/x-charts/internals';
2
- declare function seriesProcessor(params: SeriesProcessorParams<'radialLine'>, dataset?: Readonly<DatasetType>, isItemVisible?: IsItemVisibleFunction): SeriesProcessorResult<'radialLine'>;
1
+ import { type SeriesProcessor } from '@mui/x-charts/internals';
2
+ declare const seriesProcessor: SeriesProcessor<'radialLine'>;
3
3
  export default seriesProcessor;
@@ -1,146 +1,9 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.default = void 0;
8
- var _formatErrorMessage2 = _interopRequireDefault(require("@mui/x-internals/formatErrorMessage"));
9
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
- var _d3Shape = require("@mui/x-charts-vendor/d3-shape");
11
- var _warning = require("@mui/x-internals/warning");
12
7
  var _internals = require("@mui/x-charts/internals");
13
- const defaultShapes = ['circle', 'square', 'diamond', 'cross', 'star', 'triangle', 'wye'];
14
- const lineValueFormatter = v => v == null ? '' : v.toLocaleString();
15
- function seriesProcessor(params, dataset, isItemVisible) {
16
- const {
17
- seriesOrder,
18
- series
19
- } = params;
20
- const stackingGroups = (0, _internals.getStackingGroups)((0, _extends2.default)({}, params, {
21
- defaultStrategy: {
22
- stackOffset: 'none'
23
- }
24
- }));
25
- const idToIndex = new Map();
26
- // Create a data set with format adapted to d3
27
- const d3Dataset = dataset ?? [];
28
- seriesOrder.forEach((id, seriesIndex) => {
29
- idToIndex.set(id, seriesIndex);
30
- const data = series[id].data;
31
- if (data !== undefined) {
32
- data.forEach((value, dataIndex) => {
33
- if (d3Dataset.length <= dataIndex) {
34
- d3Dataset.push({
35
- [id]: value
36
- });
37
- } else {
38
- d3Dataset[dataIndex][id] = value;
39
- }
40
- });
41
- } else if (series[id].valueGetter && dataset) {
42
- // When valueGetter is used without dataKey, populate d3Dataset with the series id as key
43
- dataset.forEach((entry, dataIndex) => {
44
- const value = series[id].valueGetter(entry);
45
- if (d3Dataset.length <= dataIndex) {
46
- d3Dataset.push({
47
- [id]: value
48
- });
49
- } else {
50
- d3Dataset[dataIndex][id] = value;
51
- }
52
- });
53
- } else if (dataset === undefined && process.env.NODE_ENV !== 'production') {
54
- // TODO: fix mui/no-guarded-throw
55
- // eslint-disable-next-line mui/no-guarded-throw
56
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI X Charts: Radial line series with id="${id}" has no data. ` + 'The chart cannot render this series without data. ' + 'Provide a data property to the series or use the dataset prop.' : (0, _formatErrorMessage2.default)(258, id));
57
- }
58
- if (process.env.NODE_ENV !== 'production') {
59
- if (!data && dataset) {
60
- const dataKey = series[id].dataKey;
61
- if (!dataKey && !series[id].valueGetter) {
62
- // TODO: fix mui/no-guarded-throw
63
- // eslint-disable-next-line mui/no-guarded-throw
64
- throw new Error(`MUI X Charts: Radial line series with id="${id}" has no data, no dataKey, and no valueGetter. ` + 'When using the dataset prop, each series must have a dataKey or valueGetter to identify which dataset values to use. ' + 'Add a dataKey or valueGetter property to the series configuration.');
65
- }
66
- if (dataKey) {
67
- dataset.forEach((entry, index) => {
68
- const value = entry[dataKey];
69
- if (value != null && typeof value !== 'number') {
70
- (0, _warning.warnOnce)(`MUI X Charts: your dataset key "${dataKey}" is used for plotting radial lines, but the dataset contains the non-null non-numerical element "${value}" at index ${index}.
71
- Radial line plots only support numeric and null values.`);
72
- }
73
- });
74
- }
75
- }
76
- }
77
- });
78
- const completedSeries = {};
79
- stackingGroups.forEach(stackingGroup => {
80
- const {
81
- ids,
82
- stackingOffset,
83
- stackingOrder
84
- } = stackingGroup;
85
- const keys = ids.map(id => {
86
- // Use dataKey if needed and available
87
- const dataKey = series[id].dataKey;
88
- return series[id].data === undefined && dataKey !== undefined ? dataKey : id;
89
- });
90
- const stackedData = (0, _d3Shape.stack)().keys(keys).value((d, key) => d[key] ?? 0) // defaultize null value to 0
91
- .order(stackingOrder).offset(stackingOffset)(d3Dataset);
92
- const idOrder = stackedData.map(s => s.index);
93
- const fixedOrder = () => idOrder;
94
-
95
- // Compute visible stacked data
96
- const visibleStackedData = (0, _d3Shape.stack)().keys(keys).value((d, key) => {
97
- const keyIndex = keys.indexOf(key);
98
- const seriesId = ids[keyIndex];
99
- if (!isItemVisible?.({
100
- type: 'radialLine',
101
- seriesId
102
- })) {
103
- // For hidden series, return 0 so they don't contribute to the stack
104
- return 0;
105
- }
106
- return d[key] ?? 0;
107
- }).order(fixedOrder).offset(stackingOffset)(d3Dataset);
108
- ids.forEach((id, index) => {
109
- const {
110
- dataKey,
111
- valueGetter
112
- } = series[id];
113
- let data;
114
- if (valueGetter) {
115
- data = dataset.map(d => valueGetter(d));
116
- } else if (dataKey) {
117
- data = dataset.map(d => {
118
- const value = d[dataKey];
119
- return typeof value === 'number' ? value : null;
120
- });
121
- } else {
122
- data = series[id].data;
123
- }
124
- const hidden = !isItemVisible?.({
125
- type: 'radialLine',
126
- seriesId: id
127
- });
128
- completedSeries[id] = (0, _extends2.default)({
129
- labelMarkType: 'line+mark'
130
- }, series[id], {
131
- shape: series[id].shape ?? defaultShapes[(idToIndex.get(id) ?? 0) % defaultShapes.length],
132
- data,
133
- valueFormatter: series[id].valueFormatter ?? lineValueFormatter,
134
- hidden,
135
- stackedData: stackedData[index],
136
- visibleStackedData: visibleStackedData[index]
137
- });
138
- });
139
- });
140
- return {
141
- seriesOrder,
142
- stackingGroups,
143
- series: completedSeries
144
- };
145
- }
8
+ const seriesProcessor = (params, dataset, isItemVisible) => (0, _internals.processLineLikeSeries)(params, dataset, isItemVisible, 'radialLine');
146
9
  var _default = exports.default = seriesProcessor;