@mui/x-charts-pro 9.0.0-alpha.2 → 9.0.0-alpha.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.
Files changed (102) hide show
  1. package/BarChartPro/BarChartPro.js +5 -2
  2. package/BarChartPro/BarChartPro.mjs +5 -2
  3. package/CHANGELOG.md +123 -1
  4. package/ChartContainerPro/ChartContainerPro.d.mts +2 -2
  5. package/ChartContainerPro/ChartContainerPro.d.ts +2 -2
  6. package/ChartContainerPro/useChartContainerProProps.d.mts +2 -2
  7. package/ChartContainerPro/useChartContainerProProps.d.ts +2 -2
  8. package/ChartDataProviderPro/ChartDataProviderPro.d.mts +1 -1
  9. package/ChartDataProviderPro/ChartDataProviderPro.d.ts +1 -1
  10. package/ChartDataProviderPro/useChartDataProviderProProps.d.mts +1 -1
  11. package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +1 -1
  12. package/ChartsContainerPro/ChartsContainerPro.d.mts +2 -2
  13. package/ChartsContainerPro/ChartsContainerPro.d.ts +2 -2
  14. package/ChartsContainerPro/useChartsContainerProProps.d.mts +3 -3
  15. package/ChartsContainerPro/useChartsContainerProProps.d.ts +3 -3
  16. package/ChartsDataProviderPro/ChartsDataProviderPro.d.mts +2 -2
  17. package/ChartsDataProviderPro/ChartsDataProviderPro.d.ts +2 -2
  18. package/ChartsDataProviderPro/ChartsDataProviderPro.js +8 -5
  19. package/ChartsDataProviderPro/ChartsDataProviderPro.mjs +8 -5
  20. package/ChartsDataProviderPro/useChartsDataProviderProProps.d.mts +1 -1
  21. package/ChartsDataProviderPro/useChartsDataProviderProProps.d.ts +1 -1
  22. package/FunnelChart/FunnelChart.js +5 -2
  23. package/FunnelChart/FunnelChart.mjs +5 -2
  24. package/FunnelChart/FunnelSection.js +3 -4
  25. package/FunnelChart/FunnelSection.mjs +4 -5
  26. package/FunnelChart/funnelAxisPlugin/computeAxisValue.d.mts +3 -3
  27. package/FunnelChart/funnelAxisPlugin/computeAxisValue.d.ts +3 -3
  28. package/Heatmap/Heatmap.js +5 -4
  29. package/Heatmap/Heatmap.mjs +5 -4
  30. package/Heatmap/HeatmapItem.js +0 -1
  31. package/Heatmap/HeatmapItem.mjs +0 -1
  32. package/Heatmap/HeatmapSVGPlot.js +4 -4
  33. package/Heatmap/HeatmapSVGPlot.mjs +5 -5
  34. package/Heatmap/HeatmapTooltip/HeatmapTooltipContent.js +16 -13
  35. package/Heatmap/HeatmapTooltip/HeatmapTooltipContent.mjs +16 -13
  36. package/Heatmap/internals/HeatmapCell.js +1 -1
  37. package/Heatmap/internals/HeatmapCell.mjs +1 -1
  38. package/Heatmap/seriesConfig/getColor.js +5 -3
  39. package/Heatmap/seriesConfig/getColor.mjs +5 -3
  40. package/Heatmap/seriesConfig/getItemAtPosition.d.mts +2 -2
  41. package/Heatmap/seriesConfig/getItemAtPosition.d.ts +2 -2
  42. package/Heatmap/seriesConfig/getItemAtPosition.js +3 -11
  43. package/Heatmap/seriesConfig/getItemAtPosition.mjs +3 -11
  44. package/Heatmap/seriesConfig/identifierCleaner.d.mts +3 -0
  45. package/Heatmap/seriesConfig/identifierCleaner.d.ts +3 -0
  46. package/Heatmap/seriesConfig/identifierCleaner.js +15 -0
  47. package/Heatmap/seriesConfig/identifierCleaner.mjs +9 -0
  48. package/Heatmap/seriesConfig/identifierSerializer.d.mts +3 -0
  49. package/Heatmap/seriesConfig/identifierSerializer.d.ts +3 -0
  50. package/Heatmap/seriesConfig/identifierSerializer.js +11 -0
  51. package/Heatmap/seriesConfig/identifierSerializer.mjs +5 -0
  52. package/Heatmap/seriesConfig/index.js +4 -2
  53. package/Heatmap/seriesConfig/index.mjs +5 -3
  54. package/Heatmap/seriesConfig/keyboardFocusHandler.js +6 -19
  55. package/Heatmap/seriesConfig/keyboardFocusHandler.mjs +6 -19
  56. package/Heatmap/seriesConfig/seriesProcessor.js +8 -3
  57. package/Heatmap/seriesConfig/seriesProcessor.mjs +8 -3
  58. package/Heatmap/seriesConfig/tooltip.js +7 -6
  59. package/Heatmap/seriesConfig/tooltip.mjs +7 -6
  60. package/Heatmap/seriesConfig/tooltipPosition.js +3 -4
  61. package/Heatmap/seriesConfig/tooltipPosition.mjs +3 -4
  62. package/Heatmap/useHeatmapProps.js +2 -2
  63. package/Heatmap/useHeatmapProps.mjs +2 -2
  64. package/LineChartPro/LineChartPro.js +5 -2
  65. package/LineChartPro/LineChartPro.mjs +5 -2
  66. package/PieChartPro/PieChartPro.js +5 -2
  67. package/PieChartPro/PieChartPro.mjs +5 -2
  68. package/RadarChartPro/RadarChartPro.js +5 -2
  69. package/RadarChartPro/RadarChartPro.mjs +5 -2
  70. package/SankeyChart/SankeyChart.js +5 -2
  71. package/SankeyChart/SankeyChart.mjs +5 -2
  72. package/SankeyChart/SankeyLinkElement.js +4 -3
  73. package/SankeyChart/SankeyLinkElement.mjs +5 -4
  74. package/SankeyChart/SankeyNodeElement.js +4 -3
  75. package/SankeyChart/SankeyNodeElement.mjs +5 -4
  76. package/SankeyChart/sankeyHighlightHooks.d.mts +2 -2
  77. package/SankeyChart/sankeyHighlightHooks.d.ts +2 -2
  78. package/SankeyChart/sankeyHighlightHooks.js +2 -10
  79. package/SankeyChart/sankeyHighlightHooks.mjs +3 -11
  80. package/ScatterChartPro/ScatterChartPro.js +5 -2
  81. package/ScatterChartPro/ScatterChartPro.mjs +5 -2
  82. package/index.js +1 -1
  83. package/index.mjs +1 -1
  84. package/internals/ChartsWatermark.d.mts +2 -2
  85. package/internals/ChartsWatermark.d.ts +2 -2
  86. package/internals/ChartsWatermark.js +5 -8
  87. package/internals/ChartsWatermark.mjs +3 -6
  88. package/internals/plugins/allPlugins.d.mts +4 -4
  89. package/internals/plugins/allPlugins.d.ts +4 -4
  90. package/internals/plugins/useChartProExport/exportImage.js +1 -1
  91. package/internals/plugins/useChartProExport/exportImage.mjs +1 -1
  92. package/models/seriesType/heatmap.d.mts +36 -9
  93. package/models/seriesType/heatmap.d.ts +36 -9
  94. package/models/seriesType/heatmap.js +28 -1
  95. package/models/seriesType/heatmap.mjs +25 -1
  96. package/package.json +128 -128
  97. package/plugins/selectors/useChartHeatmapPosition.selectors.d.mts +2 -2
  98. package/plugins/selectors/useChartHeatmapPosition.selectors.d.ts +2 -2
  99. package/plugins/selectors/useChartHeatmapPosition.selectors.js +4 -4
  100. package/plugins/selectors/useChartHeatmapPosition.selectors.mjs +4 -4
  101. package/typeOverloads/modules.d.mts +2 -2
  102. package/typeOverloads/modules.d.ts +2 -2
@@ -102,7 +102,10 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
102
102
  * @default false
103
103
  */
104
104
  disableAxisListener: PropTypes.bool,
105
- enableKeyboardNavigation: PropTypes.bool,
105
+ /**
106
+ * If `true`, disables keyboard navigation for the chart.
107
+ */
108
+ disableKeyboardNavigation: PropTypes.bool,
106
109
  /**
107
110
  * The height of the chart in px. If not defined, it takes the height of the parent element.
108
111
  */
@@ -193,7 +196,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
193
196
  /**
194
197
  * The callback fired when the tooltip item changes.
195
198
  *
196
- * @param {SeriesItemIdentifier<TSeries> | null} tooltipItem The newly highlighted item.
199
+ * @param {SeriesItemIdentifier<SeriesType> | null} tooltipItem The newly highlighted item.
197
200
  */
198
201
  onTooltipItemChange: PropTypes.func,
199
202
  /**
@@ -243,13 +246,11 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
243
246
  * Used when the tooltip is controlled.
244
247
  */
245
248
  tooltipItem: PropTypes.oneOfType([PropTypes.shape({
246
- dataIndex: PropTypes.number,
247
249
  seriesId: PropTypes.string.isRequired,
248
250
  type: PropTypes.oneOf(['heatmap']).isRequired,
249
251
  xIndex: PropTypes.number.isRequired,
250
252
  yIndex: PropTypes.number.isRequired
251
253
  }), PropTypes.shape({
252
- dataIndex: PropTypes.number,
253
254
  seriesId: PropTypes.string.isRequired,
254
255
  xIndex: PropTypes.number.isRequired,
255
256
  yIndex: PropTypes.number.isRequired
@@ -56,7 +56,6 @@ function HeatmapItem(props) {
56
56
  const interactionProps = (0, _internals.useInteractionItemProps)({
57
57
  type: 'heatmap',
58
58
  seriesId,
59
- dataIndex,
60
59
  xIndex,
61
60
  yIndex
62
61
  }, skipInteractionItemProps);
@@ -48,7 +48,6 @@ function HeatmapItem(props) {
48
48
  const interactionProps = useInteractionItemProps({
49
49
  type: 'heatmap',
50
50
  seriesId,
51
- dataIndex,
52
51
  xIndex,
53
52
  yIndex
54
53
  }, skipInteractionItemProps);
@@ -22,8 +22,7 @@ function HeatmapSVGPlot(props) {
22
22
  const yScale = (0, _hooks.useYScale)();
23
23
  const colorScale = (0, _hooks.useZColorScale)();
24
24
  const series = (0, _hooks2.useHeatmapSeriesContext)();
25
- const isHighlighted = store.use(_internals.selectorChartsIsHighlightedCallback);
26
- const isFaded = store.use(_internals.selectorChartsIsFadedCallback);
25
+ const getHighlightState = store.use(_internals.selectorChartsHighlightStateCallback);
27
26
  const xDomain = xScale.domain();
28
27
  const yDomain = yScale.domain();
29
28
  if (!series || series.seriesOrder.length === 0) {
@@ -45,6 +44,7 @@ function HeatmapSVGPlot(props) {
45
44
  xIndex,
46
45
  yIndex
47
46
  };
47
+ const highlightState = getHighlightState(item);
48
48
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(MemoHeatmapItem, {
49
49
  width: xScale.bandwidth(),
50
50
  height: yScale.bandwidth(),
@@ -58,8 +58,8 @@ function HeatmapSVGPlot(props) {
58
58
  value: value,
59
59
  slots: props.slots,
60
60
  slotProps: props.slotProps,
61
- isHighlighted: isHighlighted(item),
62
- isFaded: isFaded(item),
61
+ isHighlighted: highlightState === 'highlighted',
62
+ isFaded: highlightState === 'faded',
63
63
  borderRadius: props.borderRadius
64
64
  }, `${xIndex}_${yIndex}`);
65
65
  })
@@ -2,7 +2,7 @@
2
2
 
3
3
  import * as React from 'react';
4
4
  import { useXScale, useYScale, useZColorScale } from '@mui/x-charts/hooks';
5
- import { selectorChartsIsFadedCallback, selectorChartsIsHighlightedCallback, useStore, useRegisterPointerInteractions } from '@mui/x-charts/internals';
5
+ import { selectorChartsHighlightStateCallback, useStore, useRegisterPointerInteractions } from '@mui/x-charts/internals';
6
6
  import { useHeatmapSeriesContext } from "../hooks/index.mjs";
7
7
  import { HeatmapItem } from "./HeatmapItem.mjs";
8
8
  import { selectorHeatmapItemAtPosition } from "../plugins/selectors/useChartHeatmapPosition.selectors.mjs";
@@ -16,8 +16,7 @@ export function HeatmapSVGPlot(props) {
16
16
  const yScale = useYScale();
17
17
  const colorScale = useZColorScale();
18
18
  const series = useHeatmapSeriesContext();
19
- const isHighlighted = store.use(selectorChartsIsHighlightedCallback);
20
- const isFaded = store.use(selectorChartsIsFadedCallback);
19
+ const getHighlightState = store.use(selectorChartsHighlightStateCallback);
21
20
  const xDomain = xScale.domain();
22
21
  const yDomain = yScale.domain();
23
22
  if (!series || series.seriesOrder.length === 0) {
@@ -39,6 +38,7 @@ export function HeatmapSVGPlot(props) {
39
38
  xIndex,
40
39
  yIndex
41
40
  };
41
+ const highlightState = getHighlightState(item);
42
42
  return /*#__PURE__*/_jsx(MemoHeatmapItem, {
43
43
  width: xScale.bandwidth(),
44
44
  height: yScale.bandwidth(),
@@ -52,8 +52,8 @@ export function HeatmapSVGPlot(props) {
52
52
  value: value,
53
53
  slots: props.slots,
54
54
  slotProps: props.slotProps,
55
- isHighlighted: isHighlighted(item),
56
- isFaded: isFaded(item),
55
+ isHighlighted: highlightState === 'highlighted',
56
+ isFaded: highlightState === 'faded',
57
57
  borderRadius: props.borderRadius
58
58
  }, `${xIndex}_${yIndex}`);
59
59
  })
@@ -21,21 +21,23 @@ function HeatmapTooltipContent(props) {
21
21
  const yAxis = (0, _hooks.useYAxis)();
22
22
  const heatmapSeries = (0, _useHeatmapSeries.useHeatmapSeriesContext)();
23
23
  const tooltipData = (0, _ChartsTooltip.useItemTooltip)();
24
- const dataIndex = tooltipData?.identifier.dataIndex;
25
- if (!tooltipData || dataIndex === undefined || !heatmapSeries || heatmapSeries.seriesOrder.length === 0) {
24
+ if (!tooltipData || !heatmapSeries || heatmapSeries.seriesOrder.length === 0) {
26
25
  return null;
27
26
  }
28
- const {
29
- series,
30
- seriesOrder
31
- } = heatmapSeries;
32
- const seriesId = seriesOrder[0];
33
27
  const {
34
28
  color,
35
- value,
36
- markType
29
+ markType,
30
+ identifier
37
31
  } = tooltipData;
38
- const [xIndex, yIndex] = value;
32
+ const thisSeries = heatmapSeries.series[heatmapSeries.seriesOrder[0]];
33
+ const value = thisSeries.heatmapData.getValue(identifier.xIndex, identifier.yIndex) ?? null;
34
+ if (value === null) {
35
+ return null;
36
+ }
37
+ const {
38
+ xIndex,
39
+ yIndex
40
+ } = identifier;
39
41
  const formattedX = xAxis.valueFormatter?.(xAxis.data[xIndex], {
40
42
  location: 'tooltip',
41
43
  scale: xAxis.scale
@@ -44,10 +46,11 @@ function HeatmapTooltipContent(props) {
44
46
  location: 'tooltip',
45
47
  scale: yAxis.scale
46
48
  }) ?? yAxis.data[yIndex].toLocaleString();
47
- const formattedValue = series[seriesId].valueFormatter(value, {
48
- dataIndex
49
+ const formattedValue = thisSeries.valueFormatter(value, {
50
+ xIndex,
51
+ yIndex
49
52
  });
50
- const seriesLabel = (0, _internals.getLabel)(series[seriesId].label, 'tooltip');
53
+ const seriesLabel = (0, _internals.getLabel)(thisSeries.label, 'tooltip');
51
54
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltipPaper, {
52
55
  className: classes.paper,
53
56
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsTooltip.ChartsTooltipTable, {
@@ -15,21 +15,23 @@ export function HeatmapTooltipContent(props) {
15
15
  const yAxis = useYAxis();
16
16
  const heatmapSeries = useHeatmapSeriesContext();
17
17
  const tooltipData = useItemTooltip();
18
- const dataIndex = tooltipData?.identifier.dataIndex;
19
- if (!tooltipData || dataIndex === undefined || !heatmapSeries || heatmapSeries.seriesOrder.length === 0) {
18
+ if (!tooltipData || !heatmapSeries || heatmapSeries.seriesOrder.length === 0) {
20
19
  return null;
21
20
  }
22
- const {
23
- series,
24
- seriesOrder
25
- } = heatmapSeries;
26
- const seriesId = seriesOrder[0];
27
21
  const {
28
22
  color,
29
- value,
30
- markType
23
+ markType,
24
+ identifier
31
25
  } = tooltipData;
32
- const [xIndex, yIndex] = value;
26
+ const thisSeries = heatmapSeries.series[heatmapSeries.seriesOrder[0]];
27
+ const value = thisSeries.heatmapData.getValue(identifier.xIndex, identifier.yIndex) ?? null;
28
+ if (value === null) {
29
+ return null;
30
+ }
31
+ const {
32
+ xIndex,
33
+ yIndex
34
+ } = identifier;
33
35
  const formattedX = xAxis.valueFormatter?.(xAxis.data[xIndex], {
34
36
  location: 'tooltip',
35
37
  scale: xAxis.scale
@@ -38,10 +40,11 @@ export function HeatmapTooltipContent(props) {
38
40
  location: 'tooltip',
39
41
  scale: yAxis.scale
40
42
  }) ?? yAxis.data[yIndex].toLocaleString();
41
- const formattedValue = series[seriesId].valueFormatter(value, {
42
- dataIndex
43
+ const formattedValue = thisSeries.valueFormatter(value, {
44
+ xIndex,
45
+ yIndex
43
46
  });
44
- const seriesLabel = getLabel(series[seriesId].label, 'tooltip');
47
+ const seriesLabel = getLabel(thisSeries.label, 'tooltip');
45
48
  return /*#__PURE__*/_jsx(ChartsTooltipPaper, {
46
49
  className: classes.paper,
47
50
  children: /*#__PURE__*/_jsxs(ChartsTooltipTable, {
@@ -8,7 +8,7 @@ var _styles = require("@mui/material/styles");
8
8
  const HeatmapCell = exports.HeatmapCell = (0, _styles.styled)('rect', {
9
9
  name: 'MuiHeatmap',
10
10
  slot: 'Cell',
11
- overridesResolver: (_, styles) => styles.arc // FIXME: Inconsistent naming with slot
11
+ overridesResolver: (_, styles) => styles.cell
12
12
  })(({
13
13
  ownerState
14
14
  }) => ({
@@ -2,7 +2,7 @@ import { styled } from '@mui/material/styles';
2
2
  export const HeatmapCell = styled('rect', {
3
3
  name: 'MuiHeatmap',
4
4
  slot: 'Cell',
5
- overridesResolver: (_, styles) => styles.arc // FIXME: Inconsistent naming with slot
5
+ overridesResolver: (_, styles) => styles.cell
6
6
  })(({
7
7
  ownerState
8
8
  }) => ({
@@ -7,9 +7,11 @@ exports.default = void 0;
7
7
  const getColor = (series, xAxis, yAxis, zAxis) => {
8
8
  const zColorScale = zAxis?.colorScale;
9
9
  if (zColorScale) {
10
- return dataIndex => {
11
- const value = series.data[dataIndex];
12
- const color = zColorScale(value[2]);
10
+ return value => {
11
+ if (value === null) {
12
+ return '';
13
+ }
14
+ const color = zColorScale(value);
13
15
  if (color === null) {
14
16
  return '';
15
17
  }
@@ -1,9 +1,11 @@
1
1
  const getColor = (series, xAxis, yAxis, zAxis) => {
2
2
  const zColorScale = zAxis?.colorScale;
3
3
  if (zColorScale) {
4
- return dataIndex => {
5
- const value = series.data[dataIndex];
6
- const color = zColorScale(value[2]);
4
+ return value => {
5
+ if (value === null) {
6
+ return '';
7
+ }
8
+ const color = zColorScale(value);
7
9
  if (color === null) {
8
10
  return '';
9
11
  }
@@ -1,6 +1,6 @@
1
1
  import type { ChartState, UseChartCartesianAxisSignature } from '@mui/x-charts/internals';
2
- import type { SeriesItemIdentifierWithType } from '@mui/x-charts/models';
2
+ import type { SeriesItemIdentifierWithData } from '@mui/x-charts/models';
3
3
  export default function getItemAtPosition(state: ChartState<[UseChartCartesianAxisSignature]>, point: {
4
4
  x: number;
5
5
  y: number;
6
- }): SeriesItemIdentifierWithType<'heatmap'> | undefined;
6
+ }): SeriesItemIdentifierWithData<'heatmap'> | undefined;
@@ -1,6 +1,6 @@
1
1
  import type { ChartState, UseChartCartesianAxisSignature } from '@mui/x-charts/internals';
2
- import type { SeriesItemIdentifierWithType } from '@mui/x-charts/models';
2
+ import type { SeriesItemIdentifierWithData } from '@mui/x-charts/models';
3
3
  export default function getItemAtPosition(state: ChartState<[UseChartCartesianAxisSignature]>, point: {
4
4
  x: number;
5
5
  y: number;
6
- }): SeriesItemIdentifierWithType<'heatmap'> | undefined;
6
+ }): SeriesItemIdentifierWithData<'heatmap'> | undefined;
@@ -26,20 +26,12 @@ function getItemAtPosition(state, point) {
26
26
  if (xIndex === -1 || yIndex === -1) {
27
27
  return undefined;
28
28
  }
29
- const dataIndex = series ? series.series[series.seriesOrder[0]].data.findIndex(d => d[0] === xIndex && d[1] === yIndex) : -1;
30
- if (dataIndex === -1) {
31
- return {
32
- type: 'heatmap',
33
- seriesId,
34
- xIndex,
35
- yIndex
36
- };
37
- }
29
+ const value = series?.series[series.seriesOrder[0]].heatmapData.getValue(xIndex, yIndex) ?? null;
38
30
  return {
39
31
  type: 'heatmap',
40
32
  seriesId,
41
- dataIndex,
42
33
  xIndex,
43
- yIndex
34
+ yIndex,
35
+ value
44
36
  };
45
37
  }
@@ -20,20 +20,12 @@ export default function getItemAtPosition(state, point) {
20
20
  if (xIndex === -1 || yIndex === -1) {
21
21
  return undefined;
22
22
  }
23
- const dataIndex = series ? series.series[series.seriesOrder[0]].data.findIndex(d => d[0] === xIndex && d[1] === yIndex) : -1;
24
- if (dataIndex === -1) {
25
- return {
26
- type: 'heatmap',
27
- seriesId,
28
- xIndex,
29
- yIndex
30
- };
31
- }
23
+ const value = series?.series[series.seriesOrder[0]].heatmapData.getValue(xIndex, yIndex) ?? null;
32
24
  return {
33
25
  type: 'heatmap',
34
26
  seriesId,
35
- dataIndex,
36
27
  xIndex,
37
- yIndex
28
+ yIndex,
29
+ value
38
30
  };
39
31
  }
@@ -0,0 +1,3 @@
1
+ import type { IdentifierCleaner } from '@mui/x-charts/internals';
2
+ declare const identifierCleaner: IdentifierCleaner<'heatmap'>;
3
+ export default identifierCleaner;
@@ -0,0 +1,3 @@
1
+ import type { IdentifierCleaner } from '@mui/x-charts/internals';
2
+ declare const identifierCleaner: IdentifierCleaner<'heatmap'>;
3
+ export default identifierCleaner;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ const identifierCleaner = identifier => {
8
+ return {
9
+ type: identifier.type,
10
+ seriesId: identifier.seriesId,
11
+ xIndex: identifier.xIndex,
12
+ yIndex: identifier.yIndex
13
+ };
14
+ };
15
+ var _default = exports.default = identifierCleaner;
@@ -0,0 +1,9 @@
1
+ const identifierCleaner = identifier => {
2
+ return {
3
+ type: identifier.type,
4
+ seriesId: identifier.seriesId,
5
+ xIndex: identifier.xIndex,
6
+ yIndex: identifier.yIndex
7
+ };
8
+ };
9
+ export default identifierCleaner;
@@ -0,0 +1,3 @@
1
+ import { type IdentifierSerializer } from '@mui/x-charts/internals';
2
+ declare const identifierSerializer: IdentifierSerializer<'heatmap'>;
3
+ export default identifierSerializer;
@@ -0,0 +1,3 @@
1
+ import { type IdentifierSerializer } from '@mui/x-charts/internals';
2
+ declare const identifierSerializer: IdentifierSerializer<'heatmap'>;
3
+ export default identifierSerializer;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _internals = require("@mui/x-charts/internals");
8
+ const identifierSerializer = identifier => {
9
+ return `${(0, _internals.typeSerializer)(identifier.type)}${(0, _internals.seriesIdSerializer)(identifier.seriesId)}X(${identifier.xIndex})Y(${identifier.yIndex})`;
10
+ };
11
+ var _default = exports.default = identifierSerializer;
@@ -0,0 +1,5 @@
1
+ import { typeSerializer, seriesIdSerializer } from '@mui/x-charts/internals';
2
+ const identifierSerializer = identifier => {
3
+ return `${typeSerializer(identifier.type)}${seriesIdSerializer(identifier.seriesId)}X(${identifier.xIndex})Y(${identifier.yIndex})`;
4
+ };
5
+ export default identifierSerializer;
@@ -15,6 +15,8 @@ var _tooltipPosition = _interopRequireDefault(require("./tooltipPosition"));
15
15
  var _getItemAtPosition = _interopRequireDefault(require("./getItemAtPosition"));
16
16
  var _keyboardFocusHandler = _interopRequireDefault(require("./keyboardFocusHandler"));
17
17
  var _highlight = require("./highlight");
18
+ var _identifierSerializer = _interopRequireDefault(require("./identifierSerializer"));
19
+ var _identifierCleaner = _interopRequireDefault(require("./identifierCleaner"));
18
20
  _internals.cartesianSeriesTypes.addType('heatmap');
19
21
  const heatmapSeriesConfig = exports.heatmapSeriesConfig = {
20
22
  seriesProcessor: _seriesProcessor.default,
@@ -25,8 +27,8 @@ const heatmapSeriesConfig = exports.heatmapSeriesConfig = {
25
27
  xExtremumGetter: _extremums.getBaseExtremum,
26
28
  yExtremumGetter: _extremums.getBaseExtremum,
27
29
  getSeriesWithDefaultValues: _getSeriesWithDefaultValues.default,
28
- identifierSerializer: _internals.identifierSerializerSeriesIdDataIndex,
29
- identifierCleaner: _internals.identifierCleanerSeriesIdDataIndex,
30
+ identifierSerializer: _identifierSerializer.default,
31
+ identifierCleaner: _identifierCleaner.default,
30
32
  getItemAtPosition: _getItemAtPosition.default,
31
33
  keyboardFocusHandler: _keyboardFocusHandler.default,
32
34
  isHighlightedCreator: _highlight.createIsHighlighted,
@@ -1,4 +1,4 @@
1
- import { cartesianSeriesTypes, identifierSerializerSeriesIdDataIndex, identifierCleanerSeriesIdDataIndex } from '@mui/x-charts/internals';
1
+ import { cartesianSeriesTypes } from '@mui/x-charts/internals';
2
2
  import { getBaseExtremum } from "./extremums.mjs";
3
3
  import seriesProcessor from "./seriesProcessor.mjs";
4
4
  import getColor from "./getColor.mjs";
@@ -8,6 +8,8 @@ import tooltipItemPositionGetter from "./tooltipPosition.mjs";
8
8
  import getItemAtPosition from "./getItemAtPosition.mjs";
9
9
  import keyboardFocusHandler from "./keyboardFocusHandler.mjs";
10
10
  import { createIsFaded, createIsHighlighted } from "./highlight.mjs";
11
+ import identifierSerializer from "./identifierSerializer.mjs";
12
+ import identifierCleaner from "./identifierCleaner.mjs";
11
13
  cartesianSeriesTypes.addType('heatmap');
12
14
  export const heatmapSeriesConfig = {
13
15
  seriesProcessor,
@@ -18,8 +20,8 @@ export const heatmapSeriesConfig = {
18
20
  xExtremumGetter: getBaseExtremum,
19
21
  yExtremumGetter: getBaseExtremum,
20
22
  getSeriesWithDefaultValues,
21
- identifierSerializer: identifierSerializerSeriesIdDataIndex,
22
- identifierCleaner: identifierCleanerSeriesIdDataIndex,
23
+ identifierSerializer,
24
+ identifierCleaner,
23
25
  getItemAtPosition,
24
26
  keyboardFocusHandler,
25
27
  isHighlightedCreator: createIsHighlighted,
@@ -13,30 +13,17 @@ function getFirstCell(state) {
13
13
  if (!seriesId || !series || !data || data.length === 0) {
14
14
  return null;
15
15
  }
16
- const dataIndex = data.findIndex(value => value[0] === 0 && value[1] === 0);
17
- if (dataIndex === -1) {
18
- return {
19
- type: 'heatmap',
20
- seriesId,
21
- xIndex: 0,
22
- yIndex: 0
23
- };
24
- }
25
16
  return {
26
17
  type: 'heatmap',
27
18
  seriesId,
28
- dataIndex,
29
19
  xIndex: 0,
30
20
  yIndex: 0
31
21
  };
32
22
  }
33
- const updateCoordinates = (newXIndex, newYIndex, currentItem, state) => {
34
- const seriesData = state.series.defaultizedSeries.heatmap?.series[currentItem.seriesId]?.data;
35
- const dataIndex = seriesData?.findIndex(value => value[0] === newXIndex && value[1] === newYIndex);
23
+ const updateCoordinates = (newXIndex, newYIndex, currentItem) => {
36
24
  return (0, _extends2.default)({}, currentItem, {
37
25
  xIndex: newXIndex,
38
- yIndex: newYIndex,
39
- dataIndex: dataIndex === -1 || dataIndex === undefined ? undefined : dataIndex
26
+ yIndex: newYIndex
40
27
  });
41
28
  };
42
29
  const keyboardFocusHandler = event => {
@@ -50,7 +37,7 @@ const keyboardFocusHandler = event => {
50
37
  if (currentItem.xIndex + 1 === (maxLength ?? 0)) {
51
38
  return currentItem;
52
39
  }
53
- return updateCoordinates(currentItem.xIndex + 1, currentItem.yIndex, currentItem, state);
40
+ return updateCoordinates(currentItem.xIndex + 1, currentItem.yIndex, currentItem);
54
41
  };
55
42
  case 'ArrowLeft':
56
43
  return (currentItem, state) => {
@@ -60,7 +47,7 @@ const keyboardFocusHandler = event => {
60
47
  if (currentItem.xIndex - 1 < 0) {
61
48
  return currentItem;
62
49
  }
63
- return updateCoordinates(currentItem.xIndex - 1, currentItem.yIndex, currentItem, state);
50
+ return updateCoordinates(currentItem.xIndex - 1, currentItem.yIndex, currentItem);
64
51
  };
65
52
  case 'ArrowDown':
66
53
  return (currentItem, state) => {
@@ -71,7 +58,7 @@ const keyboardFocusHandler = event => {
71
58
  if (currentItem.yIndex + 1 === (maxLength ?? 0)) {
72
59
  return currentItem;
73
60
  }
74
- return updateCoordinates(currentItem.xIndex, currentItem.yIndex + 1, currentItem, state);
61
+ return updateCoordinates(currentItem.xIndex, currentItem.yIndex + 1, currentItem);
75
62
  };
76
63
  case 'ArrowUp':
77
64
  return (currentItem, state) => {
@@ -81,7 +68,7 @@ const keyboardFocusHandler = event => {
81
68
  if (currentItem.yIndex - 1 < 0) {
82
69
  return currentItem;
83
70
  }
84
- return updateCoordinates(currentItem.xIndex, currentItem.yIndex - 1, currentItem, state);
71
+ return updateCoordinates(currentItem.xIndex, currentItem.yIndex - 1, currentItem);
85
72
  };
86
73
  default:
87
74
  return null;
@@ -6,30 +6,17 @@ function getFirstCell(state) {
6
6
  if (!seriesId || !series || !data || data.length === 0) {
7
7
  return null;
8
8
  }
9
- const dataIndex = data.findIndex(value => value[0] === 0 && value[1] === 0);
10
- if (dataIndex === -1) {
11
- return {
12
- type: 'heatmap',
13
- seriesId,
14
- xIndex: 0,
15
- yIndex: 0
16
- };
17
- }
18
9
  return {
19
10
  type: 'heatmap',
20
11
  seriesId,
21
- dataIndex,
22
12
  xIndex: 0,
23
13
  yIndex: 0
24
14
  };
25
15
  }
26
- const updateCoordinates = (newXIndex, newYIndex, currentItem, state) => {
27
- const seriesData = state.series.defaultizedSeries.heatmap?.series[currentItem.seriesId]?.data;
28
- const dataIndex = seriesData?.findIndex(value => value[0] === newXIndex && value[1] === newYIndex);
16
+ const updateCoordinates = (newXIndex, newYIndex, currentItem) => {
29
17
  return _extends({}, currentItem, {
30
18
  xIndex: newXIndex,
31
- yIndex: newYIndex,
32
- dataIndex: dataIndex === -1 || dataIndex === undefined ? undefined : dataIndex
19
+ yIndex: newYIndex
33
20
  });
34
21
  };
35
22
  const keyboardFocusHandler = event => {
@@ -43,7 +30,7 @@ const keyboardFocusHandler = event => {
43
30
  if (currentItem.xIndex + 1 === (maxLength ?? 0)) {
44
31
  return currentItem;
45
32
  }
46
- return updateCoordinates(currentItem.xIndex + 1, currentItem.yIndex, currentItem, state);
33
+ return updateCoordinates(currentItem.xIndex + 1, currentItem.yIndex, currentItem);
47
34
  };
48
35
  case 'ArrowLeft':
49
36
  return (currentItem, state) => {
@@ -53,7 +40,7 @@ const keyboardFocusHandler = event => {
53
40
  if (currentItem.xIndex - 1 < 0) {
54
41
  return currentItem;
55
42
  }
56
- return updateCoordinates(currentItem.xIndex - 1, currentItem.yIndex, currentItem, state);
43
+ return updateCoordinates(currentItem.xIndex - 1, currentItem.yIndex, currentItem);
57
44
  };
58
45
  case 'ArrowDown':
59
46
  return (currentItem, state) => {
@@ -64,7 +51,7 @@ const keyboardFocusHandler = event => {
64
51
  if (currentItem.yIndex + 1 === (maxLength ?? 0)) {
65
52
  return currentItem;
66
53
  }
67
- return updateCoordinates(currentItem.xIndex, currentItem.yIndex + 1, currentItem, state);
54
+ return updateCoordinates(currentItem.xIndex, currentItem.yIndex + 1, currentItem);
68
55
  };
69
56
  case 'ArrowUp':
70
57
  return (currentItem, state) => {
@@ -74,7 +61,7 @@ const keyboardFocusHandler = event => {
74
61
  if (currentItem.yIndex - 1 < 0) {
75
62
  return currentItem;
76
63
  }
77
- return updateCoordinates(currentItem.xIndex, currentItem.yIndex - 1, currentItem, state);
64
+ return updateCoordinates(currentItem.xIndex, currentItem.yIndex - 1, currentItem);
78
65
  };
79
66
  default:
80
67
  return null;
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _heatmap = require("../../models/seriesType/heatmap");
9
10
  const seriesProcessor = params => {
10
11
  const {
11
12
  series,
@@ -13,12 +14,16 @@ const seriesProcessor = params => {
13
14
  } = params;
14
15
  const defaultizedSeries = {};
15
16
  Object.keys(series).forEach(seriesId => {
17
+ const data = series[seriesId].data ?? [];
18
+ const heatmapData = new _heatmap.HeatmapData(data);
16
19
  defaultizedSeries[seriesId] = (0, _extends2.default)({
17
20
  // Defaultize the data and the value formatter.
18
- valueFormatter: v => v[2].toString(),
19
- data: [],
21
+ valueFormatter: v => v?.toString() ?? null,
22
+ data,
20
23
  labelMarkType: 'square'
21
- }, series[seriesId]);
24
+ }, series[seriesId], {
25
+ heatmapData
26
+ });
22
27
  });
23
28
  return {
24
29
  series: defaultizedSeries,
@@ -1,4 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import { HeatmapData } from "../../models/seriesType/heatmap.mjs";
2
3
  const seriesProcessor = params => {
3
4
  const {
4
5
  series,
@@ -6,12 +7,16 @@ const seriesProcessor = params => {
6
7
  } = params;
7
8
  const defaultizedSeries = {};
8
9
  Object.keys(series).forEach(seriesId => {
10
+ const data = series[seriesId].data ?? [];
11
+ const heatmapData = new HeatmapData(data);
9
12
  defaultizedSeries[seriesId] = _extends({
10
13
  // Defaultize the data and the value formatter.
11
- valueFormatter: v => v[2].toString(),
12
- data: [],
14
+ valueFormatter: v => v?.toString() ?? null,
15
+ data,
13
16
  labelMarkType: 'square'
14
- }, series[seriesId]);
17
+ }, series[seriesId], {
18
+ heatmapData
19
+ });
15
20
  });
16
21
  return {
17
22
  series: defaultizedSeries,