@mui/x-charts 8.12.0 → 8.13.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 (52) hide show
  1. package/CHANGELOG.md +145 -0
  2. package/ChartsSurface/ChartsSurface.js +4 -3
  3. package/PieChart/PieArc.d.ts +3 -0
  4. package/PieChart/PieArc.js +13 -12
  5. package/PieChart/PieArcPlot.js +27 -3
  6. package/esm/ChartsSurface/ChartsSurface.js +4 -3
  7. package/esm/PieChart/PieArc.d.ts +3 -0
  8. package/esm/PieChart/PieArc.js +14 -13
  9. package/esm/PieChart/PieArcPlot.js +29 -5
  10. package/esm/index.js +1 -1
  11. package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +60 -32
  12. package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +19 -5
  13. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.d.ts +5 -2
  14. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +8 -10
  15. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +7 -5
  16. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +10 -0
  17. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +13 -4
  18. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +2 -2
  19. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +30 -7
  20. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +6 -4
  21. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +6 -1
  22. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +2 -1
  23. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +6 -0
  24. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +115 -155
  25. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +14 -2
  26. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +27 -1
  27. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +2 -0
  28. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +2 -5
  29. package/esm/internals/ticks.d.ts +3 -5
  30. package/esm/internals/ticks.js +6 -5
  31. package/index.js +1 -1
  32. package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +59 -31
  33. package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +19 -5
  34. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.d.ts +5 -2
  35. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +8 -11
  36. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +6 -4
  37. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +10 -0
  38. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +14 -5
  39. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +2 -2
  40. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +30 -7
  41. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +6 -4
  42. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +6 -1
  43. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +3 -2
  44. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +6 -0
  45. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +115 -155
  46. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +14 -2
  47. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +28 -2
  48. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +2 -0
  49. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +1 -4
  50. package/internals/ticks.d.ts +3 -5
  51. package/internals/ticks.js +7 -5
  52. package/package.json +4 -4
@@ -1,6 +1,5 @@
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
  });
@@ -9,7 +8,6 @@ exports.getActualAxisExtrema = getActualAxisExtrema;
9
8
  exports.getDomainLimit = getDomainLimit;
10
9
  exports.getXAxesScales = getXAxesScales;
11
10
  exports.getYAxesScales = getYAxesScales;
12
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
11
  var _d3Scale = require("@mui/x-charts-vendor/d3-scale");
14
12
  var _axis = require("../../../../models/axis");
15
13
  var _zoom = require("./zoom");
@@ -28,13 +26,14 @@ function getXAxesScales({
28
26
  axis: axes = [],
29
27
  seriesConfig,
30
28
  zoomMap,
31
- preferStrictDomainInLineCharts
29
+ preferStrictDomainInLineCharts,
30
+ defaultTickNumber
32
31
  }) {
33
32
  const scales = {};
34
33
  axes.forEach((eachAxis, axisIndex) => {
35
34
  const axis = eachAxis;
36
35
  const zoom = zoomMap?.get(axis.id);
37
- scales[axis.id] = getAxisScale(axis, 'x', zoom, drawingArea, seriesConfig, axisIndex, formattedSeries, preferStrictDomainInLineCharts);
36
+ scales[axis.id] = getAxisScale(axis, 'x', zoom, drawingArea, seriesConfig, axisIndex, formattedSeries, preferStrictDomainInLineCharts, defaultTickNumber);
38
37
  });
39
38
  return scales;
40
39
  }
@@ -44,13 +43,14 @@ function getYAxesScales({
44
43
  axis: axes = [],
45
44
  seriesConfig,
46
45
  zoomMap,
47
- preferStrictDomainInLineCharts
46
+ preferStrictDomainInLineCharts,
47
+ defaultTickNumber
48
48
  }) {
49
49
  const scales = {};
50
50
  axes.forEach((eachAxis, axisIndex) => {
51
51
  const axis = eachAxis;
52
52
  const zoom = zoomMap?.get(axis.id);
53
- scales[axis.id] = getAxisScale(axis, 'y', zoom, drawingArea, seriesConfig, axisIndex, formattedSeries, preferStrictDomainInLineCharts);
53
+ scales[axis.id] = getAxisScale(axis, 'y', zoom, drawingArea, seriesConfig, axisIndex, formattedSeries, preferStrictDomainInLineCharts, defaultTickNumber);
54
54
  });
55
55
  return scales;
56
56
  }
@@ -58,7 +58,7 @@ function getAxisScale(axis, axisDirection, zoom, drawingArea, seriesConfig, axis
58
58
  /**
59
59
  * @deprecated To remove in v9. This is an experimental feature to avoid breaking change.
60
60
  */
61
- preferStrictDomainInLineCharts) {
61
+ preferStrictDomainInLineCharts, defaultTickNumber) {
62
62
  const zoomRange = zoom ? [zoom.start, zoom.end] : [0, 100];
63
63
  const range = getRange(drawingArea, axisDirection, axis);
64
64
  if ((0, _axis.isBandScaleConfig)(axis)) {
@@ -89,10 +89,7 @@ preferStrictDomainInLineCharts) {
89
89
  axisExtrema[0] = min;
90
90
  axisExtrema[1] = max;
91
91
  }
92
- const rawTickNumber = (0, _ticks.getTickNumber)((0, _extends2.default)({}, axis, {
93
- range,
94
- domain: axisExtrema
95
- }));
92
+ const rawTickNumber = (0, _ticks.getTickNumber)(axis, axisExtrema, defaultTickNumber);
96
93
  const zoomedRange = (0, _zoom.zoomScaleRange)(range, zoomRange);
97
94
  const scale = (0, _getScale.getScale)(scaleType, axisExtrema, zoomedRange);
98
95
  if ((0, _axis.isSymlogScaleConfig)(axis) && axis.constant != null) {
@@ -30,7 +30,7 @@ function createPreviewDrawingArea(axisDirection, mainChartDrawingArea) {
30
30
  bottom: mainChartDrawingArea.height
31
31
  };
32
32
  }
33
- const selectorChartPreviewXScales = exports.selectorChartPreviewXScales = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, _useChartCartesianAxisRendering.selectorChartZoomOptionsLookup, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts, (_, axisId) => axisId], function selectorChartPreviewXScales(xAxes, chartDrawingArea, formattedSeries, seriesConfig, zoomOptions, preferStrictDomainInLineCharts, axisId) {
33
+ const selectorChartPreviewXScales = exports.selectorChartPreviewXScales = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, _useChartCartesianAxisRendering.selectorChartZoomOptionsLookup, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts, _useChartCartesianAxisRendering.selectorDefaultXAxisTickNumber, (_, axisId) => axisId], function selectorChartPreviewXScales(xAxes, chartDrawingArea, formattedSeries, seriesConfig, zoomOptions, preferStrictDomainInLineCharts, defaultTickNumber, axisId) {
34
34
  const hasAxis = xAxes?.some(axis => axis.id === axisId);
35
35
  const drawingArea = createPreviewDrawingArea(hasAxis ? 'x' : 'y', chartDrawingArea);
36
36
  const options = zoomOptions[axisId];
@@ -45,7 +45,8 @@ const selectorChartPreviewXScales = exports.selectorChartPreviewXScales = (0, _s
45
45
  axis: xAxes,
46
46
  seriesConfig,
47
47
  zoomMap,
48
- preferStrictDomainInLineCharts
48
+ preferStrictDomainInLineCharts,
49
+ defaultTickNumber
49
50
  });
50
51
  });
51
52
  const selectorChartPreviewComputedXAxis = exports.selectorChartPreviewComputedXAxis = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, _useChartCartesianAxisRendering.selectorChartZoomOptionsLookup, _useChartCartesianAxisRendering.selectorChartZoomAxisFilters, _useChartDimensions.selectorChartDrawingArea, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts, selectorChartPreviewXScales, (_, axisId) => axisId], (xAxes, formattedSeries, seriesConfig, zoomOptions, getFilters, chartDrawingArea, preferStrictDomainInLineCharts, scales, axisId) => {
@@ -76,7 +77,7 @@ const selectorChartPreviewComputedXAxis = exports.selectorChartPreviewComputedXA
76
77
  }
77
78
  return computedAxes.axis;
78
79
  });
79
- const selectorChartPreviewYScales = exports.selectorChartPreviewYScales = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, _useChartCartesianAxisRendering.selectorChartZoomOptionsLookup, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts, (_, axisId) => axisId], function selectorChartPreviewYScales(yAxes, chartDrawingArea, formattedSeries, seriesConfig, zoomOptions, preferStrictDomainInLineCharts, axisId) {
80
+ const selectorChartPreviewYScales = exports.selectorChartPreviewYScales = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, _useChartCartesianAxisRendering.selectorChartZoomOptionsLookup, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts, _useChartCartesianAxisRendering.selectorDefaultYAxisTickNumber, (_, axisId) => axisId], function selectorChartPreviewYScales(yAxes, chartDrawingArea, formattedSeries, seriesConfig, zoomOptions, preferStrictDomainInLineCharts, defaultTickNumber, axisId) {
80
81
  const hasAxis = yAxes?.some(axis => axis.id === axisId);
81
82
  const drawingArea = createPreviewDrawingArea(hasAxis ? 'y' : 'x', chartDrawingArea);
82
83
  const options = zoomOptions[axisId];
@@ -91,7 +92,8 @@ const selectorChartPreviewYScales = exports.selectorChartPreviewYScales = (0, _s
91
92
  axis: yAxes,
92
93
  seriesConfig,
93
94
  zoomMap,
94
- preferStrictDomainInLineCharts
95
+ preferStrictDomainInLineCharts,
96
+ defaultTickNumber
95
97
  });
96
98
  });
97
99
  const selectorChartPreviewComputedYAxis = exports.selectorChartPreviewComputedYAxis = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, _useChartCartesianAxisRendering.selectorChartZoomOptionsLookup, _useChartCartesianAxisRendering.selectorChartZoomAxisFilters, _useChartDimensions.selectorChartDrawingArea, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts, selectorChartPreviewYScales, (_, axisId) => axisId], (yAxes, formattedSeries, seriesConfig, zoomOptions, getFilters, chartDrawingArea, preferStrictDomainInLineCharts, scales, axisId) => {
@@ -23,6 +23,16 @@ export declare const selectorChartZoomOptionsLookup: import("reselect").Selector
23
23
  [x: number]: import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions;
24
24
  }, []>;
25
25
  export declare const selectorChartAxisZoomOptionsLookup: import("reselect").Selector<any, import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions, [axisId: AxisId]>;
26
+ export declare const selectorDefaultXAxisTickNumber: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<{}> & {
27
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
28
+ } & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
29
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
30
+ }, number, []>;
31
+ export declare const selectorDefaultYAxisTickNumber: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<{}> & {
32
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
33
+ } & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
34
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
35
+ }, number, []>;
26
36
  export declare const selectorChartXScales: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
27
37
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
28
38
  } & Partial<{}> & {
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.selectorChartZoomOptionsLookup = exports.selectorChartZoomMap = exports.selectorChartZoomIsInteracting = exports.selectorChartZoomAxisFilters = exports.selectorChartYScales = exports.selectorChartYAxis = exports.selectorChartXScales = exports.selectorChartXAxis = exports.selectorChartRawAxis = exports.selectorChartAxisZoomOptionsLookup = exports.selectorChartAxis = exports.createZoomMap = void 0;
7
+ exports.selectorDefaultYAxisTickNumber = exports.selectorDefaultXAxisTickNumber = exports.selectorChartZoomOptionsLookup = exports.selectorChartZoomMap = exports.selectorChartZoomIsInteracting = exports.selectorChartZoomAxisFilters = exports.selectorChartYScales = exports.selectorChartYAxis = exports.selectorChartXScales = exports.selectorChartXAxis = exports.selectorChartRawAxis = exports.selectorChartAxisZoomOptionsLookup = exports.selectorChartAxis = exports.createZoomMap = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _useChartDimensions = require("../../corePlugins/useChartDimensions");
10
10
  var _useChartSeries = require("../../corePlugins/useChartSeries");
@@ -15,6 +15,7 @@ var _createZoomLookup = require("./createZoomLookup");
15
15
  var _useChartCartesianAxisLayout = require("./useChartCartesianAxisLayout.selectors");
16
16
  var _useChartExperimentalFeature = require("../../corePlugins/useChartExperimentalFeature");
17
17
  var _getAxisScale = require("./getAxisScale");
18
+ var _ticks = require("../../../ticks");
18
19
  const createZoomMap = zoom => {
19
20
  const zoomItemMap = new Map();
20
21
  zoom.forEach(zoomItem => {
@@ -35,24 +36,32 @@ const selectorChartZoomOptionsLookup = exports.selectorChartZoomOptionsLookup =
35
36
  const selectorChartAxisZoomOptionsLookup = exports.selectorChartAxisZoomOptionsLookup = (0, _selectors.createSelector)([selectorChartZoomOptionsLookup, (_, axisId) => axisId], (axisLookup, axisId) => axisLookup[axisId]);
36
37
  const selectorChartXFilter = (0, _selectors.createSelector)([selectorChartZoomMap, selectorChartZoomOptionsLookup], (zoomMap, zoomOptions) => zoomMap && zoomOptions && (0, _createAxisFilterMapper.createAxisFilterMapper)(zoomMap, zoomOptions, 'x'));
37
38
  const selectorChartYFilter = (0, _selectors.createSelector)([selectorChartZoomMap, selectorChartZoomOptionsLookup], (zoomMap, zoomOptions) => zoomMap && zoomOptions && (0, _createAxisFilterMapper.createAxisFilterMapper)(zoomMap, zoomOptions, 'y'));
38
- const selectorChartXScales = exports.selectorChartXScales = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, selectorChartZoomMap, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts], function selectorChartXScales(axis, drawingArea, formattedSeries, seriesConfig, zoomMap, preferStrictDomainInLineCharts) {
39
+ const selectorDefaultXAxisTickNumber = exports.selectorDefaultXAxisTickNumber = (0, _selectors.createSelector)([_useChartDimensions.selectorChartDrawingArea], function selectorDefaultXAxisTickNumber(drawingArea) {
40
+ return (0, _ticks.getDefaultTickNumber)(drawingArea.width);
41
+ });
42
+ const selectorDefaultYAxisTickNumber = exports.selectorDefaultYAxisTickNumber = (0, _selectors.createSelector)([_useChartDimensions.selectorChartDrawingArea], function selectorDefaultYAxisTickNumber(drawingArea) {
43
+ return (0, _ticks.getDefaultTickNumber)(drawingArea.height);
44
+ });
45
+ const selectorChartXScales = exports.selectorChartXScales = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, selectorChartZoomMap, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts, selectorDefaultXAxisTickNumber], function selectorChartXScales(axis, drawingArea, formattedSeries, seriesConfig, zoomMap, preferStrictDomainInLineCharts, defaultTickNumber) {
39
46
  return (0, _getAxisScale.getXAxesScales)({
40
47
  drawingArea,
41
48
  formattedSeries,
42
49
  axis,
43
50
  seriesConfig,
44
51
  zoomMap,
45
- preferStrictDomainInLineCharts
52
+ preferStrictDomainInLineCharts,
53
+ defaultTickNumber
46
54
  });
47
55
  });
48
- const selectorChartYScales = exports.selectorChartYScales = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, selectorChartZoomMap, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts], function selectorChartYScales(axis, drawingArea, formattedSeries, seriesConfig, zoomMap, preferStrictDomainInLineCharts) {
56
+ const selectorChartYScales = exports.selectorChartYScales = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, selectorChartZoomMap, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts, selectorDefaultYAxisTickNumber], function selectorChartYScales(axis, drawingArea, formattedSeries, seriesConfig, zoomMap, preferStrictDomainInLineCharts, defaultTickNumber) {
49
57
  return (0, _getAxisScale.getYAxesScales)({
50
58
  drawingArea,
51
59
  formattedSeries,
52
60
  axis,
53
61
  seriesConfig,
54
62
  zoomMap,
55
- preferStrictDomainInLineCharts
63
+ preferStrictDomainInLineCharts,
64
+ defaultTickNumber
56
65
  });
57
66
  });
58
67
  const selectorChartZoomAxisFilters = exports.selectorChartZoomAxisFilters = (0, _selectors.createSelector)([selectorChartXFilter, selectorChartYFilter, _useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartCartesianAxisLayout.selectorChartRawYAxis, selectorChartXScales, selectorChartYScales], (xMapper, yMapper, xAxis, yAxis, xScales, yScales) => {
@@ -13,7 +13,7 @@ export declare const selectorChartsHighlightXAxisValue: import("reselect").Selec
13
13
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
14
14
  } & {
15
15
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
16
- } & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & Partial<{}>, {
16
+ } & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & Partial<{}> & Partial<import("../useChartKeyboardNavigation/useChartKeyboardNavigation.types.js").UseChartKeyboardNavigationState>, {
17
17
  value: any;
18
18
  axisId: import("../../../index.js").AxisId;
19
19
  dataIndex: number;
@@ -26,7 +26,7 @@ export declare const selectorChartsHighlightYAxisValue: import("reselect").Selec
26
26
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
27
27
  } & {
28
28
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
29
- } & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & Partial<{}>, {
29
+ } & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & Partial<{}> & Partial<import("../useChartKeyboardNavigation/useChartKeyboardNavigation.types.js").UseChartKeyboardNavigationState>, {
30
30
  value: any;
31
31
  axisId: import("../../../index.js").AxisId;
32
32
  dataIndex: number;
@@ -9,6 +9,8 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
9
9
  var _selectors = require("../../utils/selectors");
10
10
  var _useChartCartesianAxisRendering = require("./useChartCartesianAxisRendering.selectors");
11
11
  var _useChartCartesianInteraction = require("./useChartCartesianInteraction.selectors");
12
+ var _useChartKeyboardNavigation = require("../useChartKeyboardNavigation/useChartKeyboardNavigation.selectors");
13
+ var _useChartInteraction = require("../useChartInteraction/useChartInteraction.selectors");
12
14
  const selectorChartControlledCartesianAxisHighlight = state => state.controlledCartesianAxisHighlight;
13
15
  const selectAxisHighlight = (computedIndex, axis, axisItems) => {
14
16
  if (axisItems !== undefined) {
@@ -21,22 +23,43 @@ const selectAxisHighlight = (computedIndex, axis, axisItems) => {
21
23
  };
22
24
  const selectorChartsHighlightXAxisIndex = exports.selectorChartsHighlightXAxisIndex = (0, _selectors.createSelector)([_useChartCartesianInteraction.selectorChartsInteractionXAxisIndex, _useChartCartesianAxisRendering.selectorChartXAxis, selectorChartControlledCartesianAxisHighlight], selectAxisHighlight);
23
25
  const selectorChartsHighlightYAxisIndex = exports.selectorChartsHighlightYAxisIndex = (0, _selectors.createSelector)([_useChartCartesianInteraction.selectorChartsInteractionYAxisIndex, _useChartCartesianAxisRendering.selectorChartYAxis, selectorChartControlledCartesianAxisHighlight], selectAxisHighlight);
24
- const selectAxisHighlightWithValue = (computedIndex, computedValue, axis, axisItems) => {
25
- if (axisItems !== undefined) {
26
- return axisItems.map(item => (0, _extends2.default)({}, item, {
26
+ const selectAxisHighlightWithValue = (computedIndex, computedValue, axis, controlledAxisItems, keyboardAxisItem, lastInteractionUpdate) => {
27
+ if (controlledAxisItems !== undefined) {
28
+ return controlledAxisItems.map(item => (0, _extends2.default)({}, item, {
27
29
  value: axis.axis[item.axisId]?.data?.[item.dataIndex]
28
30
  })).filter(({
29
31
  value
30
32
  }) => value !== undefined);
31
33
  }
32
- return computedValue === null ? [] : [{
34
+ const pointerHighlight = computedValue !== null && {
33
35
  axisId: axis.axisIds[0],
34
36
  dataIndex: computedIndex,
35
37
  value: computedValue
36
- }];
38
+ };
39
+ const keyboardValue = keyboardAxisItem && axis.axis[keyboardAxisItem.axisId]?.data?.[keyboardAxisItem.dataIndex];
40
+ const keyboardHighlight = keyboardAxisItem && keyboardValue != null && (0, _extends2.default)({}, keyboardAxisItem, {
41
+ value: keyboardValue
42
+ });
43
+ if (lastInteractionUpdate === 'pointer') {
44
+ if (pointerHighlight) {
45
+ return [pointerHighlight];
46
+ }
47
+ if (keyboardHighlight) {
48
+ return [keyboardHighlight];
49
+ }
50
+ }
51
+ if (lastInteractionUpdate === 'keyboard') {
52
+ if (keyboardHighlight) {
53
+ return [keyboardHighlight];
54
+ }
55
+ if (pointerHighlight) {
56
+ return [pointerHighlight];
57
+ }
58
+ }
59
+ return [];
37
60
  };
38
- const selectorChartsHighlightXAxisValue = exports.selectorChartsHighlightXAxisValue = (0, _selectors.createSelector)([_useChartCartesianInteraction.selectorChartsInteractionXAxisIndex, _useChartCartesianInteraction.selectorChartsInteractionXAxisValue, _useChartCartesianAxisRendering.selectorChartXAxis, selectorChartControlledCartesianAxisHighlight], selectAxisHighlightWithValue);
39
- const selectorChartsHighlightYAxisValue = exports.selectorChartsHighlightYAxisValue = (0, _selectors.createSelector)([_useChartCartesianInteraction.selectorChartsInteractionYAxisIndex, _useChartCartesianInteraction.selectorChartsInteractionYAxisValue, _useChartCartesianAxisRendering.selectorChartYAxis, selectorChartControlledCartesianAxisHighlight], selectAxisHighlightWithValue);
61
+ const selectorChartsHighlightXAxisValue = exports.selectorChartsHighlightXAxisValue = (0, _selectors.createSelector)([_useChartCartesianInteraction.selectorChartsInteractionXAxisIndex, _useChartCartesianInteraction.selectorChartsInteractionXAxisValue, _useChartCartesianAxisRendering.selectorChartXAxis, selectorChartControlledCartesianAxisHighlight, _useChartKeyboardNavigation.selectorChartsKeyboardXAxisIndex, _useChartInteraction.selectorChartsLastInteraction], selectAxisHighlightWithValue);
62
+ const selectorChartsHighlightYAxisValue = exports.selectorChartsHighlightYAxisValue = (0, _selectors.createSelector)([_useChartCartesianInteraction.selectorChartsInteractionYAxisIndex, _useChartCartesianInteraction.selectorChartsInteractionYAxisValue, _useChartCartesianAxisRendering.selectorChartYAxis, selectorChartControlledCartesianAxisHighlight, _useChartKeyboardNavigation.selectorChartsKeyboardYAxisIndex, _useChartInteraction.selectorChartsLastInteraction], selectAxisHighlightWithValue);
40
63
 
41
64
  /**
42
65
  * Get the scale of the axis with highlight if controlled. The default axis otherwise.
@@ -14,10 +14,10 @@ const useChartInteraction = ({
14
14
  const cleanInteraction = (0, _useEventCallback.default)(function cleanInteraction() {
15
15
  store.update(prev => {
16
16
  return (0, _extends2.default)({}, prev, {
17
- interaction: {
17
+ interaction: (0, _extends2.default)({}, prev.interaction, {
18
18
  pointer: null,
19
19
  item: null
20
- }
20
+ })
21
21
  });
22
22
  });
23
23
  });
@@ -58,7 +58,8 @@ const useChartInteraction = ({
58
58
  const setPointerCoordinate = (0, _useEventCallback.default)(function setPointerCoordinate(coordinate) {
59
59
  store.update(prev => (0, _extends2.default)({}, prev, {
60
60
  interaction: (0, _extends2.default)({}, prev.interaction, {
61
- pointer: coordinate
61
+ pointer: coordinate,
62
+ lastUpdate: coordinate !== null ? 'pointer' : prev.interaction.lastUpdate
62
63
  })
63
64
  }));
64
65
  });
@@ -75,7 +76,8 @@ exports.useChartInteraction = useChartInteraction;
75
76
  useChartInteraction.getInitialState = () => ({
76
77
  interaction: {
77
78
  item: null,
78
- pointer: null
79
+ pointer: null,
80
+ lastUpdate: 'pointer'
79
81
  }
80
82
  });
81
83
  useChartInteraction.params = {};
@@ -27,4 +27,9 @@ export declare const selectorChartsInteractionItemIsDefined: import("reselect").
27
27
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
28
28
  } & {
29
29
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
30
- }, boolean, any[]>;
30
+ }, boolean, any[]>;
31
+ export declare const selectorChartsLastInteraction: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartInteraction.types.js").UseChartInteractionState> & {
32
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
33
+ } & {
34
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
35
+ }, import("./useChartInteraction.types.js").InteractionUpdateSource | undefined, any[]>;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.selectorChartsInteractionPointerY = exports.selectorChartsInteractionPointerX = exports.selectorChartsInteractionPointer = exports.selectorChartsInteractionItemIsDefined = exports.selectorChartsInteractionItem = exports.selectorChartsInteractionIsInitialized = void 0;
6
+ exports.selectorChartsLastInteraction = exports.selectorChartsInteractionPointerY = exports.selectorChartsInteractionPointerX = exports.selectorChartsInteractionPointer = exports.selectorChartsInteractionItemIsDefined = exports.selectorChartsInteractionItem = exports.selectorChartsInteractionIsInitialized = void 0;
7
7
  var _selectors = require("../../utils/selectors");
8
8
  const selectInteraction = state => state.interaction;
9
9
  const selectorChartsInteractionIsInitialized = exports.selectorChartsInteractionIsInitialized = (0, _selectors.createSelector)([selectInteraction], interaction => interaction !== undefined);
@@ -11,4 +11,5 @@ const selectorChartsInteractionItem = exports.selectorChartsInteractionItem = (0
11
11
  const selectorChartsInteractionPointer = exports.selectorChartsInteractionPointer = (0, _selectors.createSelector)([selectInteraction], interaction => interaction?.pointer ?? null);
12
12
  const selectorChartsInteractionPointerX = exports.selectorChartsInteractionPointerX = (0, _selectors.createSelector)([selectorChartsInteractionPointer], pointer => pointer && pointer.x);
13
13
  const selectorChartsInteractionPointerY = exports.selectorChartsInteractionPointerY = (0, _selectors.createSelector)([selectorChartsInteractionPointer], pointer => pointer && pointer.y);
14
- const selectorChartsInteractionItemIsDefined = exports.selectorChartsInteractionItemIsDefined = (0, _selectors.createSelector)([selectorChartsInteractionItem], item => item !== null);
14
+ const selectorChartsInteractionItemIsDefined = exports.selectorChartsInteractionItemIsDefined = (0, _selectors.createSelector)([selectorChartsInteractionItem], item => item !== null);
15
+ const selectorChartsLastInteraction = exports.selectorChartsLastInteraction = (0, _selectors.createSelector)([selectInteraction], interaction => interaction?.lastUpdate);
@@ -4,6 +4,7 @@ export type Coordinate = {
4
4
  x: number;
5
5
  y: number;
6
6
  };
7
+ export type InteractionUpdateSource = 'pointer' | 'keyboard';
7
8
  export interface UseChartInteractionInstance {
8
9
  /**
9
10
  * Remove all interaction.
@@ -35,6 +36,11 @@ export interface UseChartInteractionState {
35
36
  * The x/y SVG coordinate of the "main" pointer
36
37
  */
37
38
  pointer: Coordinate | null;
39
+ /**
40
+ * The last interaction highlight update.
41
+ * Used to decide if highlight should be based on pointer position or keyboard navigation.
42
+ */
43
+ lastUpdate: InteractionUpdateSource;
38
44
  };
39
45
  }
40
46
  export type UseChartInteractionSignature = ChartPluginSignature<{