@mui/x-charts 9.0.3 → 9.1.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 (191) hide show
  1. package/BarChart/BarChart.d.mts +1 -2
  2. package/BarChart/BarChart.d.ts +1 -2
  3. package/BarChart/BarChart.js +2 -913
  4. package/BarChart/BarChart.mjs +2 -913
  5. package/BarChart/FocusedBar.js +3 -0
  6. package/BarChart/FocusedBar.mjs +3 -0
  7. package/BarChart/seriesConfig/bar/seriesProcessor.js +2 -0
  8. package/BarChart/seriesConfig/bar/seriesProcessor.mjs +2 -0
  9. package/CHANGELOG.md +220 -0
  10. package/ChartsAxisHighlightValue/ChartsAxisHighlightValue.d.mts +55 -0
  11. package/ChartsAxisHighlightValue/ChartsAxisHighlightValue.d.ts +55 -0
  12. package/ChartsAxisHighlightValue/ChartsAxisHighlightValue.js +94 -0
  13. package/ChartsAxisHighlightValue/ChartsAxisHighlightValue.mjs +88 -0
  14. package/ChartsAxisHighlightValue/ChartsAxisHighlightValueItem.d.mts +13 -0
  15. package/ChartsAxisHighlightValue/ChartsAxisHighlightValueItem.d.ts +13 -0
  16. package/ChartsAxisHighlightValue/ChartsAxisHighlightValueItem.js +86 -0
  17. package/ChartsAxisHighlightValue/ChartsAxisHighlightValueItem.mjs +80 -0
  18. package/ChartsAxisHighlightValue/chartsAxisHighlightValueClasses.d.mts +18 -0
  19. package/ChartsAxisHighlightValue/chartsAxisHighlightValueClasses.d.ts +18 -0
  20. package/ChartsAxisHighlightValue/chartsAxisHighlightValueClasses.js +26 -0
  21. package/ChartsAxisHighlightValue/chartsAxisHighlightValueClasses.mjs +16 -0
  22. package/ChartsAxisHighlightValue/index.d.mts +1 -0
  23. package/ChartsAxisHighlightValue/index.d.ts +1 -0
  24. package/ChartsAxisHighlightValue/index.js +16 -0
  25. package/ChartsAxisHighlightValue/index.mjs +1 -0
  26. package/ChartsAxisHighlightValue/useAxisHighlightValue.d.mts +14 -0
  27. package/ChartsAxisHighlightValue/useAxisHighlightValue.d.ts +14 -0
  28. package/ChartsAxisHighlightValue/useAxisHighlightValue.js +130 -0
  29. package/ChartsAxisHighlightValue/useAxisHighlightValue.mjs +124 -0
  30. package/ChartsContainer/ChartsContainer.js +4 -1431
  31. package/ChartsContainer/ChartsContainer.mjs +4 -1431
  32. package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.d.mts +15 -0
  33. package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.d.ts +15 -0
  34. package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.js +56 -0
  35. package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.mjs +50 -0
  36. package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.types.d.mts +6 -0
  37. package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.types.d.ts +6 -0
  38. package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.types.js +5 -0
  39. package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.types.mjs +1 -0
  40. package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlightPath.d.mts +11 -0
  41. package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlightPath.d.ts +11 -0
  42. package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlightPath.js +70 -0
  43. package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlightPath.mjs +64 -0
  44. package/ChartsRadialAxisHighlight/ChartsRadiusAxisHighlight.d.mts +9 -0
  45. package/ChartsRadialAxisHighlight/ChartsRadiusAxisHighlight.d.ts +9 -0
  46. package/ChartsRadialAxisHighlight/ChartsRadiusAxisHighlight.js +87 -0
  47. package/ChartsRadialAxisHighlight/ChartsRadiusAxisHighlight.mjs +81 -0
  48. package/ChartsRadialAxisHighlight/ChartsRotationAxisHighlight.d.mts +9 -0
  49. package/ChartsRadialAxisHighlight/ChartsRotationAxisHighlight.d.ts +9 -0
  50. package/ChartsRadialAxisHighlight/ChartsRotationAxisHighlight.js +98 -0
  51. package/ChartsRadialAxisHighlight/ChartsRotationAxisHighlight.mjs +92 -0
  52. package/ChartsRadialAxisHighlight/chartsRadialAxisHighlightClasses.d.mts +7 -0
  53. package/ChartsRadialAxisHighlight/chartsRadialAxisHighlightClasses.d.ts +7 -0
  54. package/ChartsRadialAxisHighlight/chartsRadialAxisHighlightClasses.js +14 -0
  55. package/ChartsRadialAxisHighlight/chartsRadialAxisHighlightClasses.mjs +6 -0
  56. package/ChartsRadialAxisHighlight/index.d.mts +5 -0
  57. package/ChartsRadialAxisHighlight/index.d.ts +5 -0
  58. package/ChartsRadialAxisHighlight/index.js +47 -0
  59. package/ChartsRadialAxisHighlight/index.mjs +4 -0
  60. package/ChartsRadiusAxis/index.d.mts +3 -2
  61. package/ChartsRadiusAxis/index.d.ts +3 -2
  62. package/ChartsRadiusAxis/index.mjs +3 -1
  63. package/ChartsRotationAxis/index.d.mts +3 -2
  64. package/ChartsRotationAxis/index.d.ts +3 -2
  65. package/ChartsRotationAxis/index.mjs +3 -1
  66. package/ChartsTooltip/useAxesTooltip.js +11 -3
  67. package/ChartsTooltip/useAxesTooltip.mjs +11 -3
  68. package/ChartsXAxis/useAxisTicksProps.d.mts +162 -81
  69. package/ChartsXAxis/useAxisTicksProps.d.ts +162 -81
  70. package/ChartsYAxis/useAxisTicksProps.d.mts +162 -81
  71. package/ChartsYAxis/useAxisTicksProps.d.ts +162 -81
  72. package/LICENSE +2 -0
  73. package/LineChart/FocusedLineMark.js +3 -0
  74. package/LineChart/FocusedLineMark.mjs +3 -0
  75. package/LineChart/LineChart.js +2 -913
  76. package/LineChart/LineChart.mjs +2 -913
  77. package/LineChart/seriesConfig/curveEvaluation.d.mts +19 -1
  78. package/LineChart/seriesConfig/curveEvaluation.d.ts +19 -1
  79. package/LineChart/seriesConfig/curveEvaluation.js +132 -0
  80. package/LineChart/seriesConfig/curveEvaluation.mjs +131 -0
  81. package/LineChart/seriesConfig/getItemAtPosition.js +12 -35
  82. package/LineChart/seriesConfig/getItemAtPosition.mjs +10 -33
  83. package/LineChart/seriesConfig/getSeriesWithDefaultValues.js +2 -1
  84. package/LineChart/seriesConfig/getSeriesWithDefaultValues.mjs +2 -1
  85. package/LineChart/seriesConfig/seriesProcessor.js +4 -0
  86. package/LineChart/seriesConfig/seriesProcessor.mjs +4 -0
  87. package/LineChart/useAreaPlotData.js +4 -0
  88. package/LineChart/useAreaPlotData.mjs +4 -0
  89. package/LineChart/useLinePlotData.js +2 -0
  90. package/LineChart/useLinePlotData.mjs +2 -0
  91. package/LineChart/useMarkPlotData.js +2 -0
  92. package/LineChart/useMarkPlotData.mjs +2 -0
  93. package/PieChart/FocusedPieArc.js +3 -0
  94. package/PieChart/FocusedPieArc.mjs +3 -0
  95. package/RadarChart/FocusedRadarMark.js +3 -0
  96. package/RadarChart/FocusedRadarMark.mjs +3 -0
  97. package/ScatterChart/FocusedScatterMark.js +10 -21
  98. package/ScatterChart/FocusedScatterMark.mjs +10 -21
  99. package/ScatterChart/HighlightedScatterMark.d.mts +11 -0
  100. package/ScatterChart/HighlightedScatterMark.d.ts +11 -0
  101. package/ScatterChart/HighlightedScatterMark.js +68 -0
  102. package/ScatterChart/HighlightedScatterMark.mjs +62 -0
  103. package/ScatterChart/ScatterChart.d.mts +1 -2
  104. package/ScatterChart/ScatterChart.d.ts +1 -2
  105. package/ScatterChart/ScatterChart.js +2 -913
  106. package/ScatterChart/ScatterChart.mjs +2 -913
  107. package/ScatterChart/index.d.mts +1 -0
  108. package/ScatterChart/index.d.ts +1 -0
  109. package/ScatterChart/index.js +12 -0
  110. package/ScatterChart/index.mjs +1 -0
  111. package/ScatterChart/scatterClasses.d.mts +3 -1
  112. package/ScatterChart/scatterClasses.d.ts +3 -1
  113. package/ScatterChart/scatterClasses.js +3 -2
  114. package/ScatterChart/scatterClasses.mjs +3 -2
  115. package/ScatterChart/useScatterChartProps.js +3 -1
  116. package/ScatterChart/useScatterChartProps.mjs +3 -1
  117. package/ScatterChart/useScatterItemPosition.d.mts +16 -0
  118. package/ScatterChart/useScatterItemPosition.d.ts +16 -0
  119. package/ScatterChart/useScatterItemPosition.js +47 -0
  120. package/ScatterChart/useScatterItemPosition.mjs +41 -0
  121. package/SparkLineChart/SparkLineChart.js +2 -913
  122. package/SparkLineChart/SparkLineChart.mjs +2 -913
  123. package/hooks/useAxis.d.mts +3 -3
  124. package/hooks/useAxis.d.ts +3 -3
  125. package/hooks/useAxisSystem.d.mts +1 -1
  126. package/hooks/useAxisSystem.d.ts +1 -1
  127. package/hooks/useAxisSystem.js +1 -1
  128. package/hooks/useAxisSystem.mjs +1 -1
  129. package/index.d.mts +2 -0
  130. package/index.d.ts +2 -0
  131. package/index.js +25 -1
  132. package/index.mjs +3 -1
  133. package/internals/commonNextFocusItem.js +62 -8
  134. package/internals/commonNextFocusItem.mjs +62 -8
  135. package/internals/findClosestIndex.d.mts +5 -0
  136. package/internals/findClosestIndex.d.ts +5 -0
  137. package/internals/findClosestIndex.js +27 -0
  138. package/internals/findClosestIndex.mjs +22 -0
  139. package/internals/getAsNumber.d.mts +1 -0
  140. package/internals/getAsNumber.d.ts +1 -0
  141. package/internals/getAsNumber.js +9 -0
  142. package/internals/getAsNumber.mjs +3 -0
  143. package/internals/index.d.mts +6 -0
  144. package/internals/index.d.ts +6 -0
  145. package/internals/index.js +60 -0
  146. package/internals/index.mjs +6 -0
  147. package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +4 -2
  148. package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.mjs +4 -2
  149. package/internals/plugins/corePlugins/useChartSeriesConfig/types/polarExtremumGetter.types.d.mts +2 -2
  150. package/internals/plugins/corePlugins/useChartSeriesConfig/types/polarExtremumGetter.types.d.ts +2 -2
  151. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +4 -21
  152. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.mjs +4 -21
  153. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.mts +3 -2
  154. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +3 -2
  155. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex.d.mts +30 -0
  156. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex.d.ts +30 -0
  157. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex.js +57 -0
  158. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex.mjs +51 -0
  159. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.js +7 -1
  160. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.mjs +7 -1
  161. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.js +7 -1
  162. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.mjs +7 -1
  163. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.d.mts +4 -7
  164. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.d.ts +4 -7
  165. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +2 -1
  166. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.mjs +2 -1
  167. package/internals/plugins/featurePlugins/useChartPolarAxis/defaultizeAxis.d.mts +3 -2
  168. package/internals/plugins/featurePlugins/useChartPolarAxis/defaultizeAxis.d.ts +3 -2
  169. package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisExtremum.d.mts +2 -2
  170. package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisExtremum.d.ts +2 -2
  171. package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.d.mts +2 -2
  172. package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.d.ts +2 -2
  173. package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.js +27 -6
  174. package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.mjs +27 -5
  175. package/internals/plugins/featurePlugins/useChartPolarAxis/index.d.mts +2 -1
  176. package/internals/plugins/featurePlugins/useChartPolarAxis/index.d.ts +2 -1
  177. package/internals/plugins/featurePlugins/useChartPolarAxis/index.js +12 -0
  178. package/internals/plugins/featurePlugins/useChartPolarAxis/index.mjs +2 -1
  179. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.mts +4 -4
  180. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.ts +4 -4
  181. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.mts +3 -3
  182. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +3 -3
  183. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.mts +1 -1
  184. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +1 -1
  185. package/models/axis.d.mts +28 -28
  186. package/models/axis.d.ts +28 -28
  187. package/models/axis.js +5 -1
  188. package/models/axis.mjs +5 -1
  189. package/models/seriesType/line.d.mts +6 -6
  190. package/models/seriesType/line.d.ts +6 -6
  191. package/package.json +170 -142
@@ -1,5 +1,6 @@
1
1
  import { type MakeOptional } from '@mui/x-internals/types';
2
2
  import { type ScaleName } from "../../../../models/index.mjs";
3
- import { type PolarAxisConfig } from "../../../../models/axis.mjs";
3
+ import type { ChartsRotationAxisProps, PolarAxisConfig, ChartsRadiusAxisProps } from "../../../../models/axis.mjs";
4
4
  import { type DatasetType } from "../../../../models/seriesType/config.mjs";
5
- export declare function defaultizeAxis<TScale extends ScaleName = ScaleName>(inAxis: MakeOptional<PolarAxisConfig<TScale, any>, 'id'>[] | undefined, dataset: Readonly<DatasetType> | undefined, axisName: 'rotation' | 'radius'): PolarAxisConfig<TScale, any>[];
5
+ export declare function defaultizeAxis<TScale extends ScaleName = ScaleName>(inAxis: MakeOptional<PolarAxisConfig<TScale, any>, 'id'>[] | undefined, dataset: Readonly<DatasetType> | undefined, axisName: 'rotation'): PolarAxisConfig<TScale, any, ChartsRotationAxisProps>[];
6
+ export declare function defaultizeAxis<TScale extends ScaleName = ScaleName>(inAxis: MakeOptional<PolarAxisConfig<TScale, any>, 'id'>[] | undefined, dataset: Readonly<DatasetType> | undefined, axisName: 'radius'): PolarAxisConfig<TScale, any, ChartsRadiusAxisProps>[];
@@ -1,5 +1,6 @@
1
1
  import { type MakeOptional } from '@mui/x-internals/types';
2
2
  import { type ScaleName } from "../../../../models/index.js";
3
- import { type PolarAxisConfig } from "../../../../models/axis.js";
3
+ import type { ChartsRotationAxisProps, PolarAxisConfig, ChartsRadiusAxisProps } from "../../../../models/axis.js";
4
4
  import { type DatasetType } from "../../../../models/seriesType/config.js";
5
- export declare function defaultizeAxis<TScale extends ScaleName = ScaleName>(inAxis: MakeOptional<PolarAxisConfig<TScale, any>, 'id'>[] | undefined, dataset: Readonly<DatasetType> | undefined, axisName: 'rotation' | 'radius'): PolarAxisConfig<TScale, any>[];
5
+ export declare function defaultizeAxis<TScale extends ScaleName = ScaleName>(inAxis: MakeOptional<PolarAxisConfig<TScale, any>, 'id'>[] | undefined, dataset: Readonly<DatasetType> | undefined, axisName: 'rotation'): PolarAxisConfig<TScale, any, ChartsRotationAxisProps>[];
6
+ export declare function defaultizeAxis<TScale extends ScaleName = ScaleName>(inAxis: MakeOptional<PolarAxisConfig<TScale, any>, 'id'>[] | undefined, dataset: Readonly<DatasetType> | undefined, axisName: 'radius'): PolarAxisConfig<TScale, any, ChartsRadiusAxisProps>[];
@@ -1,5 +1,5 @@
1
- import { type AxisConfig } from "../../../../models/axis.mjs";
1
+ import type { ChartsRadiusAxisProps, ChartsRotationAxisProps, ScaleName, PolarAxisConfig } from "../../../../models/axis.mjs";
2
2
  import { type PolarChartSeriesType } from "../../../../models/seriesType/config.mjs";
3
3
  import { type ChartSeriesConfig } from "../../corePlugins/useChartSeriesConfig/index.mjs";
4
4
  import { type ProcessedSeries } from "../../corePlugins/useChartSeries/useChartSeries.types.mjs";
5
- export declare const getAxisExtremum: <SeriesType extends PolarChartSeriesType>(axis: AxisConfig, axisDirection: "rotation" | "radius", seriesConfig: ChartSeriesConfig<SeriesType>, axisIndex: number, formattedSeries: ProcessedSeries<SeriesType>) => number[];
5
+ export declare const getAxisExtremum: <SeriesType extends PolarChartSeriesType>(axis: PolarAxisConfig<ScaleName, any, ChartsRotationAxisProps | ChartsRadiusAxisProps>, axisDirection: "rotation" | "radius", seriesConfig: ChartSeriesConfig<SeriesType>, axisIndex: number, formattedSeries: ProcessedSeries<SeriesType>) => number[];
@@ -1,5 +1,5 @@
1
- import { type AxisConfig } from "../../../../models/axis.js";
1
+ import type { ChartsRadiusAxisProps, ChartsRotationAxisProps, ScaleName, PolarAxisConfig } from "../../../../models/axis.js";
2
2
  import { type PolarChartSeriesType } from "../../../../models/seriesType/config.js";
3
3
  import { type ChartSeriesConfig } from "../../corePlugins/useChartSeriesConfig/index.js";
4
4
  import { type ProcessedSeries } from "../../corePlugins/useChartSeries/useChartSeries.types.js";
5
- export declare const getAxisExtremum: <SeriesType extends PolarChartSeriesType>(axis: AxisConfig, axisDirection: "rotation" | "radius", seriesConfig: ChartSeriesConfig<SeriesType>, axisIndex: number, formattedSeries: ProcessedSeries<SeriesType>) => number[];
5
+ export declare const getAxisExtremum: <SeriesType extends PolarChartSeriesType>(axis: PolarAxisConfig<ScaleName, any, ChartsRotationAxisProps | ChartsRadiusAxisProps>, axisDirection: "rotation" | "radius", seriesConfig: ChartSeriesConfig<SeriesType>, axisIndex: number, formattedSeries: ProcessedSeries<SeriesType>) => number[];
@@ -1,6 +1,6 @@
1
- import { type PolarAxisDefaultized } from "../../../../models/axis.mjs";
1
+ import type { ChartsRadiusAxisProps, ChartsRotationAxisProps, ComputedAxis, ScaleName } from "../../../../models/axis.mjs";
2
2
  /**
3
3
  * For a pointer coordinate, this function returns the value and dataIndex associated.
4
4
  * Returns `-1` if the coordinate does not match a value.
5
5
  */
6
- export declare function getAxisIndex(axisConfig: PolarAxisDefaultized, pointerValue: number): number;
6
+ export declare function getAxisIndex(axisConfig: ComputedAxis<ScaleName, any, ChartsRadiusAxisProps> | ComputedAxis<ScaleName, any, ChartsRotationAxisProps>, pointerValue: number): number;
@@ -1,6 +1,6 @@
1
- import { type PolarAxisDefaultized } from "../../../../models/axis.js";
1
+ import type { ChartsRadiusAxisProps, ChartsRotationAxisProps, ComputedAxis, ScaleName } from "../../../../models/axis.js";
2
2
  /**
3
3
  * For a pointer coordinate, this function returns the value and dataIndex associated.
4
4
  * Returns `-1` if the coordinate does not match a value.
5
5
  */
6
- export declare function getAxisIndex(axisConfig: PolarAxisDefaultized, pointerValue: number): number;
6
+ export declare function getAxisIndex(axisConfig: ComputedAxis<ScaleName, any, ChartsRadiusAxisProps> | ComputedAxis<ScaleName, any, ChartsRotationAxisProps>, pointerValue: number): number;
@@ -1,12 +1,12 @@
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.getAxisIndex = getAxisIndex;
8
- var _formatErrorMessage2 = _interopRequireDefault(require("@mui/x-internals/formatErrorMessage"));
9
7
  var _scaleGuards = require("../../../scaleGuards");
8
+ var _getAsNumber = require("../../../getAsNumber");
9
+ var _findClosestIndex = require("../../../findClosestIndex");
10
10
  var _clampAngle = require("../../../clampAngle");
11
11
  /**
12
12
  * For a pointer coordinate, this function returns the value and dataIndex associated.
@@ -16,16 +16,37 @@ function getAxisIndex(axisConfig, pointerValue) {
16
16
  const {
17
17
  scale,
18
18
  data: axisData,
19
- reverse
19
+ reverse,
20
+ isFullCircle
20
21
  } = axisConfig;
22
+ const [startAngle, endAngle] = scale.range();
23
+ const angleGap = (0, _clampAngle.clampAngleRad)(pointerValue - startAngle);
24
+ const maxAngleGap = (0, _clampAngle.clampAngleRad)(endAngle - startAngle);
25
+ if (!isFullCircle && angleGap > maxAngleGap) {
26
+ // If not a full circle we only consider pointer inside the rotation range.
27
+ return -1;
28
+ }
21
29
  if (!(0, _scaleGuards.isOrdinalScale)(scale)) {
22
- throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X Charts: getAxisValue is not implemented for polar continuous axes. ' + 'This function only supports ordinal (band/point) scales.' : (0, _formatErrorMessage2.default)(40));
30
+ if (axisData === undefined) {
31
+ return -1;
32
+ }
33
+ const angle = startAngle + (0, _clampAngle.clampAngleRad)(pointerValue - startAngle);
34
+ const valueAsNumber = (0, _getAsNumber.getAsNumber)(scale.invert(angle));
35
+ return (0, _findClosestIndex.findClosestIndex)(axisData, valueAsNumber);
23
36
  }
24
37
  if (!axisData) {
25
38
  return -1;
26
39
  }
27
- const angleGap = (0, _clampAngle.clampAngleRad)(pointerValue - Math.min(...scale.range()));
28
- const dataIndex = scale.bandwidth() === 0 ? Math.floor((angleGap + scale.step() / 2) / scale.step()) % axisData.length : Math.floor(angleGap / scale.step());
40
+ let dataIndex;
41
+ if (scale.bandwidth() === 0) {
42
+ dataIndex = Math.floor((angleGap + scale.step() / 2) / scale.step());
43
+ if (isFullCircle) {
44
+ // To show dataIndex 0 when we are before the startAngle
45
+ dataIndex = dataIndex % axisData.length;
46
+ }
47
+ } else {
48
+ dataIndex = Math.floor(angleGap / scale.step());
49
+ }
29
50
  if (dataIndex < 0 || dataIndex >= axisData.length) {
30
51
  return -1;
31
52
  }
@@ -1,5 +1,6 @@
1
- import _formatErrorMessage from "@mui/x-internals/formatErrorMessage";
2
1
  import { isOrdinalScale } from "../../../scaleGuards.mjs";
2
+ import { getAsNumber } from "../../../getAsNumber.mjs";
3
+ import { findClosestIndex } from "../../../findClosestIndex.mjs";
3
4
  import { clampAngleRad } from "../../../clampAngle.mjs";
4
5
 
5
6
  /**
@@ -10,16 +11,37 @@ export function getAxisIndex(axisConfig, pointerValue) {
10
11
  const {
11
12
  scale,
12
13
  data: axisData,
13
- reverse
14
+ reverse,
15
+ isFullCircle
14
16
  } = axisConfig;
17
+ const [startAngle, endAngle] = scale.range();
18
+ const angleGap = clampAngleRad(pointerValue - startAngle);
19
+ const maxAngleGap = clampAngleRad(endAngle - startAngle);
20
+ if (!isFullCircle && angleGap > maxAngleGap) {
21
+ // If not a full circle we only consider pointer inside the rotation range.
22
+ return -1;
23
+ }
15
24
  if (!isOrdinalScale(scale)) {
16
- throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X Charts: getAxisValue is not implemented for polar continuous axes. ' + 'This function only supports ordinal (band/point) scales.' : _formatErrorMessage(40));
25
+ if (axisData === undefined) {
26
+ return -1;
27
+ }
28
+ const angle = startAngle + clampAngleRad(pointerValue - startAngle);
29
+ const valueAsNumber = getAsNumber(scale.invert(angle));
30
+ return findClosestIndex(axisData, valueAsNumber);
17
31
  }
18
32
  if (!axisData) {
19
33
  return -1;
20
34
  }
21
- const angleGap = clampAngleRad(pointerValue - Math.min(...scale.range()));
22
- const dataIndex = scale.bandwidth() === 0 ? Math.floor((angleGap + scale.step() / 2) / scale.step()) % axisData.length : Math.floor(angleGap / scale.step());
35
+ let dataIndex;
36
+ if (scale.bandwidth() === 0) {
37
+ dataIndex = Math.floor((angleGap + scale.step() / 2) / scale.step());
38
+ if (isFullCircle) {
39
+ // To show dataIndex 0 when we are before the startAngle
40
+ dataIndex = dataIndex % axisData.length;
41
+ }
42
+ } else {
43
+ dataIndex = Math.floor(angleGap / scale.step());
44
+ }
23
45
  if (dataIndex < 0 || dataIndex >= axisData.length) {
24
46
  return -1;
25
47
  }
@@ -1,3 +1,4 @@
1
1
  export { useChartPolarAxis } from "./useChartPolarAxis.mjs";
2
2
  export type * from "./useChartPolarAxis.types.mjs";
3
- export * from "./useChartPolarAxis.selectors.mjs";
3
+ export * from "./useChartPolarAxis.selectors.mjs";
4
+ export * from "./useChartPolarInteraction.selectors.mjs";
@@ -1,3 +1,4 @@
1
1
  export { useChartPolarAxis } from "./useChartPolarAxis.js";
2
2
  export type * from "./useChartPolarAxis.types.js";
3
- export * from "./useChartPolarAxis.selectors.js";
3
+ export * from "./useChartPolarAxis.selectors.js";
4
+ export * from "./useChartPolarInteraction.selectors.js";
@@ -24,4 +24,16 @@ Object.keys(_useChartPolarAxis2).forEach(function (key) {
24
24
  return _useChartPolarAxis2[key];
25
25
  }
26
26
  });
27
+ });
28
+ var _useChartPolarInteraction = require("./useChartPolarInteraction.selectors");
29
+ Object.keys(_useChartPolarInteraction).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
32
+ if (key in exports && exports[key] === _useChartPolarInteraction[key]) return;
33
+ Object.defineProperty(exports, key, {
34
+ enumerable: true,
35
+ get: function () {
36
+ return _useChartPolarInteraction[key];
37
+ }
38
+ });
27
39
  });
@@ -1,2 +1,3 @@
1
1
  export { useChartPolarAxis } from "./useChartPolarAxis.mjs";
2
- export * from "./useChartPolarAxis.selectors.mjs";
2
+ export * from "./useChartPolarAxis.selectors.mjs";
3
+ export * from "./useChartPolarInteraction.selectors.mjs";
@@ -2,15 +2,15 @@ import { type UseChartPolarAxisSignature } from "./useChartPolarAxis.types.mjs";
2
2
  import { type ChartState } from "../../models/chart.mjs";
3
3
  import type { ChartDrawingArea } from "../../../../hooks/useDrawingArea.mjs";
4
4
  export declare const selectorChartPolarAxisState: (state: ChartState<[], [UseChartPolarAxisSignature]>) => {
5
- rotation: import("../../../index.mjs").AxisConfig<import("../../../index.mjs").ScaleName, any, import("../../../index.mjs").ChartsRotationAxisProps>[];
6
- radius: import("../../../index.mjs").AxisConfig<"linear", any, import("../../../index.mjs").ChartsRadiusAxisProps>[];
5
+ rotation: import("../../../index.mjs").PolarAxisConfig<import("../../../index.mjs").ScaleName, any, import("../../../index.mjs").ChartsRotationAxisProps>[];
6
+ radius: import("../../../index.mjs").PolarAxisConfig<import("../../../index.mjs").ScaleName, any, import("../../../index.mjs").ChartsRadiusAxisProps>[];
7
7
  } | undefined;
8
8
  export declare const selectorChartRawRotationAxis: (args_0: import("../../corePlugins/useChartId/useChartId.types.mjs").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.mjs").UseChartSeriesConfigState<keyof import("../../../index.mjs").ChartsSeriesConfig> & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.mjs").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.mjs").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.mjs").UseChartSeriesState<keyof import("../../../index.mjs").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.mjs").UseChartAnimationState & import("../../../index.mjs").UseChartInteractionListenerState & Partial<import("./useChartPolarAxis.types.mjs").UseChartPolarAxisState> & {
9
9
  cacheKey: import("../../models/index.mjs").ChartStateCacheKey;
10
- }) => import("../../../index.mjs").AxisConfig<keyof import("../../../index.mjs").AxisScaleConfig, any, import("../../../index.mjs").ChartsRotationAxisProps>[] | undefined;
10
+ }) => import("../../../index.mjs").PolarAxisConfig<keyof import("../../../index.mjs").AxisScaleConfig, any, import("../../../index.mjs").ChartsRotationAxisProps>[] | undefined;
11
11
  export declare const selectorChartRawRadiusAxis: (args_0: import("../../corePlugins/useChartId/useChartId.types.mjs").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.mjs").UseChartSeriesConfigState<keyof import("../../../index.mjs").ChartsSeriesConfig> & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.mjs").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.mjs").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.mjs").UseChartSeriesState<keyof import("../../../index.mjs").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.mjs").UseChartAnimationState & import("../../../index.mjs").UseChartInteractionListenerState & Partial<import("./useChartPolarAxis.types.mjs").UseChartPolarAxisState> & {
12
12
  cacheKey: import("../../models/index.mjs").ChartStateCacheKey;
13
- }) => import("../../../index.mjs").AxisConfig<"linear", any, import("../../../index.mjs").ChartsRadiusAxisProps>[] | undefined;
13
+ }) => import("../../../index.mjs").PolarAxisConfig<keyof import("../../../index.mjs").AxisScaleConfig, any, import("../../../index.mjs").ChartsRadiusAxisProps>[] | undefined;
14
14
  /**
15
15
  * The only interesting selectors that merge axis data and zoom if provided.
16
16
  */
@@ -2,15 +2,15 @@ import { type UseChartPolarAxisSignature } from "./useChartPolarAxis.types.js";
2
2
  import { type ChartState } from "../../models/chart.js";
3
3
  import type { ChartDrawingArea } from "../../../../hooks/useDrawingArea.js";
4
4
  export declare const selectorChartPolarAxisState: (state: ChartState<[], [UseChartPolarAxisSignature]>) => {
5
- rotation: import("../../../index.js").AxisConfig<import("../../../index.js").ScaleName, any, import("../../../index.js").ChartsRotationAxisProps>[];
6
- radius: import("../../../index.js").AxisConfig<"linear", any, import("../../../index.js").ChartsRadiusAxisProps>[];
5
+ rotation: import("../../../index.js").PolarAxisConfig<import("../../../index.js").ScaleName, any, import("../../../index.js").ChartsRotationAxisProps>[];
6
+ radius: import("../../../index.js").PolarAxisConfig<import("../../../index.js").ScaleName, any, import("../../../index.js").ChartsRadiusAxisProps>[];
7
7
  } | undefined;
8
8
  export declare const selectorChartRawRotationAxis: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.js").UseChartSeriesConfigState<keyof import("../../../index.js").ChartsSeriesConfig> & 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("./useChartPolarAxis.types.js").UseChartPolarAxisState> & {
9
9
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
10
- }) => import("../../../index.js").AxisConfig<keyof import("../../../index.js").AxisScaleConfig, any, import("../../../index.js").ChartsRotationAxisProps>[] | undefined;
10
+ }) => import("../../../index.js").PolarAxisConfig<keyof import("../../../index.js").AxisScaleConfig, any, import("../../../index.js").ChartsRotationAxisProps>[] | undefined;
11
11
  export declare const selectorChartRawRadiusAxis: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.js").UseChartSeriesConfigState<keyof import("../../../index.js").ChartsSeriesConfig> & 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("./useChartPolarAxis.types.js").UseChartPolarAxisState> & {
12
12
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
13
- }) => import("../../../index.js").AxisConfig<"linear", any, import("../../../index.js").ChartsRadiusAxisProps>[] | undefined;
13
+ }) => import("../../../index.js").PolarAxisConfig<keyof import("../../../index.js").AxisScaleConfig, any, import("../../../index.js").ChartsRadiusAxisProps>[] | undefined;
14
14
  /**
15
15
  * The only interesting selectors that merge axis data and zoom if provided.
16
16
  */
@@ -1,6 +1,6 @@
1
1
  import { type ChartPluginSignature } from "../../models/index.mjs";
2
2
  import { type ChartSeriesType, type DatasetType } from "../../../../models/seriesType/config.mjs";
3
- import { type ScaleName, type AxisConfig, type ChartsRotationAxisProps, type ChartsRadiusAxisProps, type RadiusAxis, type RotationAxis, type ChartsAxisData } from "../../../../models/axis.mjs";
3
+ import { type ScaleName, type PolarAxisConfig, type ChartsRotationAxisProps, type ChartsRadiusAxisProps, type RadiusAxis, type RotationAxis, type ChartsAxisData } from "../../../../models/axis.mjs";
4
4
  import { type UseChartSeriesSignature } from "../../corePlugins/useChartSeries/index.mjs";
5
5
  import { type UseChartInteractionSignature } from "../useChartInteraction/index.mjs";
6
6
  export interface UseChartPolarAxisInstance {
@@ -60,8 +60,8 @@ export interface UseChartPolarAxisParameters {
60
60
  export type UseChartPolarAxisDefaultizedParameters = UseChartPolarAxisParameters & {};
61
61
  export interface UseChartPolarAxisState {
62
62
  polarAxis: {
63
- rotation: AxisConfig<ScaleName, any, ChartsRotationAxisProps>[];
64
- radius: AxisConfig<'linear', any, ChartsRadiusAxisProps>[];
63
+ rotation: PolarAxisConfig<ScaleName, any, ChartsRotationAxisProps>[];
64
+ radius: PolarAxisConfig<ScaleName, any, ChartsRadiusAxisProps>[];
65
65
  };
66
66
  }
67
67
  export type UseChartPolarAxisSignature<SeriesType extends ChartSeriesType = ChartSeriesType> = ChartPluginSignature<{
@@ -1,6 +1,6 @@
1
1
  import { type ChartPluginSignature } from "../../models/index.js";
2
2
  import { type ChartSeriesType, type DatasetType } from "../../../../models/seriesType/config.js";
3
- import { type ScaleName, type AxisConfig, type ChartsRotationAxisProps, type ChartsRadiusAxisProps, type RadiusAxis, type RotationAxis, type ChartsAxisData } from "../../../../models/axis.js";
3
+ import { type ScaleName, type PolarAxisConfig, type ChartsRotationAxisProps, type ChartsRadiusAxisProps, type RadiusAxis, type RotationAxis, type ChartsAxisData } from "../../../../models/axis.js";
4
4
  import { type UseChartSeriesSignature } from "../../corePlugins/useChartSeries/index.js";
5
5
  import { type UseChartInteractionSignature } from "../useChartInteraction/index.js";
6
6
  export interface UseChartPolarAxisInstance {
@@ -60,8 +60,8 @@ export interface UseChartPolarAxisParameters {
60
60
  export type UseChartPolarAxisDefaultizedParameters = UseChartPolarAxisParameters & {};
61
61
  export interface UseChartPolarAxisState {
62
62
  polarAxis: {
63
- rotation: AxisConfig<ScaleName, any, ChartsRotationAxisProps>[];
64
- radius: AxisConfig<'linear', any, ChartsRadiusAxisProps>[];
63
+ rotation: PolarAxisConfig<ScaleName, any, ChartsRotationAxisProps>[];
64
+ radius: PolarAxisConfig<ScaleName, any, ChartsRadiusAxisProps>[];
65
65
  };
66
66
  }
67
67
  export type UseChartPolarAxisSignature<SeriesType extends ChartSeriesType = ChartSeriesType> = ChartPluginSignature<{
@@ -1,4 +1,4 @@
1
- import { type AxisItemIdentifier } from "../../../../models/axis.mjs";
1
+ import type { AxisItemIdentifier } from "../../../../models/axis.mjs";
2
2
  export declare const selectorChartsInteractionRotationAxisIndex: (args_0: import("../../corePlugins/useChartId/useChartId.types.mjs").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.mjs").UseChartSeriesConfigState<keyof import("../../../index.mjs").ChartsSeriesConfig> & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.mjs").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.mjs").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.mjs").UseChartSeriesState<keyof import("../../../index.mjs").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.mjs").UseChartAnimationState & import("../../../index.mjs").UseChartInteractionListenerState & Partial<import("../useChartInteraction/useChartInteraction.types.mjs").UseChartInteractionState> & {
3
3
  cacheKey: import("../../models/index.mjs").ChartStateCacheKey;
4
4
  }) => number | null;
@@ -1,4 +1,4 @@
1
- import { type AxisItemIdentifier } from "../../../../models/axis.js";
1
+ import type { AxisItemIdentifier } from "../../../../models/axis.js";
2
2
  export declare const selectorChartsInteractionRotationAxisIndex: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.js").UseChartSeriesConfigState<keyof import("../../../index.js").ChartsSeriesConfig> & 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/useChartInteraction.types.js").UseChartInteractionState> & {
3
3
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
4
4
  }) => number | null;
package/models/axis.d.mts CHANGED
@@ -139,7 +139,7 @@ export interface ChartsXAxisProps extends ChartsAxisProps {
139
139
  */
140
140
  tickLabelMinGap?: number;
141
141
  }
142
- type AxisSideConfig<AxisProps extends ChartsAxisProps> = AxisProps extends ChartsXAxisProps ? {
142
+ type AxisSideConfig<AxisProps extends ChartsXAxisProps | ChartsYAxisProps> = {
143
143
  /**
144
144
  * Position of the axis.
145
145
  *
@@ -149,36 +149,22 @@ type AxisSideConfig<AxisProps extends ChartsAxisProps> = AxisProps extends Chart
149
149
  *
150
150
  * The first axis in the list will always have a default position.
151
151
  */
152
- position?: 'top' | 'bottom' | 'none';
152
+ position?: (AxisProps extends ChartsXAxisProps ? 'top' | 'bottom' : 'none') | (AxisProps extends ChartsYAxisProps ? 'left' | 'right' : 'none') | 'none';
153
153
  /**
154
154
  * The height of the axis.
155
155
  * Set to `'auto'` to automatically calculate the height based on tick label measurements.
156
156
  * @default 45 if an axis label is provided, 25 otherwise.
157
157
  */
158
- height?: number | 'auto';
159
- } : AxisProps extends ChartsYAxisProps ? {
160
- /**
161
- * Position of the axis.
162
- *
163
- * When set, the space for the axis is reserved, even if the axis is not displayed due to missing data.
164
- *
165
- * Set to 'none' to hide the axis.
166
- *
167
- * The first axis in the list will always have a default position.
168
- */
169
- position?: 'left' | 'right' | 'none';
158
+ height?: AxisProps extends ChartsXAxisProps ? number | 'auto' : never;
170
159
  /**
171
160
  * The width of the axis.
172
161
  * Set to `'auto'` to automatically calculate the width based on tick label measurements.
173
162
  * @default 65 if an axis label is provided, 45 otherwise.
174
163
  */
175
- width?: number | 'auto';
176
- } : {
177
- position?: 'top' | 'bottom' | 'left' | 'right' | 'none';
178
- height?: number | 'auto';
179
- width?: number | 'auto';
164
+ width?: AxisProps extends ChartsYAxisProps ? number | 'auto' : never;
180
165
  };
181
166
  export interface ChartsRotationAxisProps extends ChartsAxisProps {
167
+ axis?: 'rotation';
182
168
  /**
183
169
  * The start angle (in deg).
184
170
  */
@@ -193,6 +179,7 @@ export interface ChartsRotationAxisProps extends ChartsAxisProps {
193
179
  labelGap?: number;
194
180
  }
195
181
  export interface ChartsRadiusAxisProps extends ChartsAxisProps {
182
+ axis?: 'radius';
196
183
  /**
197
184
  * The minimal radius.
198
185
  */
@@ -485,7 +472,10 @@ type CommonAxisConfig<S extends ScaleName = ScaleName, V = any> = {
485
472
  */
486
473
  ignoreTooltip?: boolean;
487
474
  };
488
- export type PolarAxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsAxisProps = ChartsRotationAxisProps | ChartsRadiusAxisProps> = {
475
+ /**
476
+ * Use this type for advanced typing. For basic usage, use `RotationAxis` or `RadiusAxis`.
477
+ */
478
+ export type PolarAxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsRotationAxisProps | ChartsRadiusAxisProps = ChartsRotationAxisProps | ChartsRadiusAxisProps> = {
489
479
  /**
490
480
  * The offset of the axis in pixels. It can be used to move the axis from its default position.
491
481
  * X-axis: A top axis will move up, and a bottom axis will move down.
@@ -493,11 +483,11 @@ export type PolarAxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps
493
483
  * @default 0
494
484
  */
495
485
  offset?: number;
496
- } & CommonAxisConfig<S, V> & MinMaxConfig<S> & Omit<Partial<AxisProps>, 'axisId'> & Partial<Omit<AxisScaleConfig[S], 'scale'>> & AxisConfigExtension;
486
+ } & CommonAxisConfig<S, V> & MinMaxConfig<S> & Omit<Partial<AxisProps>, 'axisId'> & Partial<Omit<AxisScaleConfig[S], 'scale'>> & TickParams & AxisConfigExtension;
497
487
  /**
498
- * Use this type for advanced typing. For basic usage, use `XAxis`, `YAxis`, `RotationAxis` or `RadiusAxis`.
488
+ * Use this type for advanced typing. For basic usage, use `XAxis` or `YAxis`.
499
489
  */
500
- export type AxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsAxisProps = ChartsXAxisProps | ChartsYAxisProps> = {
490
+ export type AxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsXAxisProps | ChartsYAxisProps = ChartsXAxisProps | ChartsYAxisProps> = {
501
491
  /**
502
492
  * The offset of the axis in pixels. It can be used to move the axis from its default position.
503
493
  * X-axis: A top axis will move up, and a bottom axis will move down.
@@ -524,20 +514,30 @@ export type ComputedAxis<S extends ScaleName = ScaleName, V = any, AxisProps ext
524
514
  triggerTooltip?: boolean;
525
515
  /** @ignore - internal. True when a rotation axis covers a full circle. */
526
516
  isFullCircle?: boolean;
527
- } & (AxisProps extends ChartsXAxisProps ? AxisSideConfig<AxisProps> & {
517
+ } & AxisProps & (AxisProps extends ChartsXAxisProps ? AxisSideConfig<AxisProps> & {
528
518
  height: number;
529
- } : AxisProps extends ChartsYAxisProps ? AxisSideConfig<AxisProps> & {
519
+ } : {}) & (AxisProps extends ChartsYAxisProps ? AxisSideConfig<AxisProps> & {
530
520
  width: number;
531
- } : AxisSideConfig<AxisProps>);
521
+ } : {});
532
522
  export type ComputedXAxis<S extends ScaleName = ScaleName, V = any> = ComputedAxis<S, V, ChartsXAxisProps>;
533
523
  export type ComputedYAxis<S extends ScaleName = ScaleName, V = any> = ComputedAxis<S, V, ChartsYAxisProps>;
524
+ export declare function isBandScaleConfig(scaleConfig: PolarAxisConfig<ScaleName>): scaleConfig is PolarAxisConfig<'band'> & {
525
+ scaleType: 'band';
526
+ };
534
527
  export declare function isBandScaleConfig(scaleConfig: AxisConfig<ScaleName>): scaleConfig is AxisConfig<'band'> & {
535
528
  scaleType: 'band';
536
529
  };
530
+ export declare function isPointScaleConfig(scaleConfig: PolarAxisConfig<ScaleName>): scaleConfig is PolarAxisConfig<'point'> & {
531
+ scaleType: 'point';
532
+ };
537
533
  export declare function isPointScaleConfig(scaleConfig: AxisConfig<ScaleName>): scaleConfig is AxisConfig<'point'> & {
538
534
  scaleType: 'point';
539
535
  };
536
+ export declare function isContinuousScaleConfig(scaleConfig: PolarAxisConfig<ScaleName>): scaleConfig is PolarAxisConfig<ContinuousScaleName>;
540
537
  export declare function isContinuousScaleConfig(scaleConfig: AxisConfig<ScaleName>): scaleConfig is AxisConfig<ContinuousScaleName>;
538
+ export declare function isSymlogScaleConfig(scaleConfig: PolarAxisConfig<ScaleName>): scaleConfig is PolarAxisConfig<'symlog'> & {
539
+ scaleType: 'symlog';
540
+ };
541
541
  export declare function isSymlogScaleConfig(scaleConfig: AxisConfig<ScaleName>): scaleConfig is AxisConfig<'symlog'> & {
542
542
  scaleType: 'symlog';
543
543
  };
@@ -575,8 +575,8 @@ export interface AxisItemIdentifier {
575
575
  }
576
576
  export type XAxis<S extends ScaleName = ScaleName, V = any> = S extends ScaleName ? MakeOptional<AxisConfig<S, V, ChartsXAxisProps>, 'id'> : never;
577
577
  export type YAxis<S extends ScaleName = ScaleName, V = any> = S extends ScaleName ? MakeOptional<AxisConfig<S, V, ChartsYAxisProps>, 'id'> : never;
578
- export type RotationAxis<S extends ScaleName = ScaleName, V = any> = S extends ScaleName ? MakeOptional<AxisConfig<S, V, ChartsRotationAxisProps>, 'id'> : never;
579
- export type RadiusAxis<S extends 'linear' = 'linear', V = any> = S extends 'linear' ? MakeOptional<AxisConfig<S, V, ChartsRadiusAxisProps>, 'id'> : never;
578
+ export type RotationAxis<S extends ScaleName = ScaleName, V = any> = S extends ScaleName ? MakeOptional<PolarAxisConfig<S, V, ChartsRotationAxisProps>, 'id'> : never;
579
+ export type RadiusAxis<S extends ScaleName = ScaleName, V = any> = S extends ScaleName ? MakeOptional<PolarAxisConfig<S, V, ChartsRadiusAxisProps>, 'id'> : never;
580
580
  /**
581
581
  * The axis configuration with missing values filled with default values.
582
582
  */
package/models/axis.d.ts CHANGED
@@ -139,7 +139,7 @@ export interface ChartsXAxisProps extends ChartsAxisProps {
139
139
  */
140
140
  tickLabelMinGap?: number;
141
141
  }
142
- type AxisSideConfig<AxisProps extends ChartsAxisProps> = AxisProps extends ChartsXAxisProps ? {
142
+ type AxisSideConfig<AxisProps extends ChartsXAxisProps | ChartsYAxisProps> = {
143
143
  /**
144
144
  * Position of the axis.
145
145
  *
@@ -149,36 +149,22 @@ type AxisSideConfig<AxisProps extends ChartsAxisProps> = AxisProps extends Chart
149
149
  *
150
150
  * The first axis in the list will always have a default position.
151
151
  */
152
- position?: 'top' | 'bottom' | 'none';
152
+ position?: (AxisProps extends ChartsXAxisProps ? 'top' | 'bottom' : 'none') | (AxisProps extends ChartsYAxisProps ? 'left' | 'right' : 'none') | 'none';
153
153
  /**
154
154
  * The height of the axis.
155
155
  * Set to `'auto'` to automatically calculate the height based on tick label measurements.
156
156
  * @default 45 if an axis label is provided, 25 otherwise.
157
157
  */
158
- height?: number | 'auto';
159
- } : AxisProps extends ChartsYAxisProps ? {
160
- /**
161
- * Position of the axis.
162
- *
163
- * When set, the space for the axis is reserved, even if the axis is not displayed due to missing data.
164
- *
165
- * Set to 'none' to hide the axis.
166
- *
167
- * The first axis in the list will always have a default position.
168
- */
169
- position?: 'left' | 'right' | 'none';
158
+ height?: AxisProps extends ChartsXAxisProps ? number | 'auto' : never;
170
159
  /**
171
160
  * The width of the axis.
172
161
  * Set to `'auto'` to automatically calculate the width based on tick label measurements.
173
162
  * @default 65 if an axis label is provided, 45 otherwise.
174
163
  */
175
- width?: number | 'auto';
176
- } : {
177
- position?: 'top' | 'bottom' | 'left' | 'right' | 'none';
178
- height?: number | 'auto';
179
- width?: number | 'auto';
164
+ width?: AxisProps extends ChartsYAxisProps ? number | 'auto' : never;
180
165
  };
181
166
  export interface ChartsRotationAxisProps extends ChartsAxisProps {
167
+ axis?: 'rotation';
182
168
  /**
183
169
  * The start angle (in deg).
184
170
  */
@@ -193,6 +179,7 @@ export interface ChartsRotationAxisProps extends ChartsAxisProps {
193
179
  labelGap?: number;
194
180
  }
195
181
  export interface ChartsRadiusAxisProps extends ChartsAxisProps {
182
+ axis?: 'radius';
196
183
  /**
197
184
  * The minimal radius.
198
185
  */
@@ -485,7 +472,10 @@ type CommonAxisConfig<S extends ScaleName = ScaleName, V = any> = {
485
472
  */
486
473
  ignoreTooltip?: boolean;
487
474
  };
488
- export type PolarAxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsAxisProps = ChartsRotationAxisProps | ChartsRadiusAxisProps> = {
475
+ /**
476
+ * Use this type for advanced typing. For basic usage, use `RotationAxis` or `RadiusAxis`.
477
+ */
478
+ export type PolarAxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsRotationAxisProps | ChartsRadiusAxisProps = ChartsRotationAxisProps | ChartsRadiusAxisProps> = {
489
479
  /**
490
480
  * The offset of the axis in pixels. It can be used to move the axis from its default position.
491
481
  * X-axis: A top axis will move up, and a bottom axis will move down.
@@ -493,11 +483,11 @@ export type PolarAxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps
493
483
  * @default 0
494
484
  */
495
485
  offset?: number;
496
- } & CommonAxisConfig<S, V> & MinMaxConfig<S> & Omit<Partial<AxisProps>, 'axisId'> & Partial<Omit<AxisScaleConfig[S], 'scale'>> & AxisConfigExtension;
486
+ } & CommonAxisConfig<S, V> & MinMaxConfig<S> & Omit<Partial<AxisProps>, 'axisId'> & Partial<Omit<AxisScaleConfig[S], 'scale'>> & TickParams & AxisConfigExtension;
497
487
  /**
498
- * Use this type for advanced typing. For basic usage, use `XAxis`, `YAxis`, `RotationAxis` or `RadiusAxis`.
488
+ * Use this type for advanced typing. For basic usage, use `XAxis` or `YAxis`.
499
489
  */
500
- export type AxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsAxisProps = ChartsXAxisProps | ChartsYAxisProps> = {
490
+ export type AxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsXAxisProps | ChartsYAxisProps = ChartsXAxisProps | ChartsYAxisProps> = {
501
491
  /**
502
492
  * The offset of the axis in pixels. It can be used to move the axis from its default position.
503
493
  * X-axis: A top axis will move up, and a bottom axis will move down.
@@ -524,20 +514,30 @@ export type ComputedAxis<S extends ScaleName = ScaleName, V = any, AxisProps ext
524
514
  triggerTooltip?: boolean;
525
515
  /** @ignore - internal. True when a rotation axis covers a full circle. */
526
516
  isFullCircle?: boolean;
527
- } & (AxisProps extends ChartsXAxisProps ? AxisSideConfig<AxisProps> & {
517
+ } & AxisProps & (AxisProps extends ChartsXAxisProps ? AxisSideConfig<AxisProps> & {
528
518
  height: number;
529
- } : AxisProps extends ChartsYAxisProps ? AxisSideConfig<AxisProps> & {
519
+ } : {}) & (AxisProps extends ChartsYAxisProps ? AxisSideConfig<AxisProps> & {
530
520
  width: number;
531
- } : AxisSideConfig<AxisProps>);
521
+ } : {});
532
522
  export type ComputedXAxis<S extends ScaleName = ScaleName, V = any> = ComputedAxis<S, V, ChartsXAxisProps>;
533
523
  export type ComputedYAxis<S extends ScaleName = ScaleName, V = any> = ComputedAxis<S, V, ChartsYAxisProps>;
524
+ export declare function isBandScaleConfig(scaleConfig: PolarAxisConfig<ScaleName>): scaleConfig is PolarAxisConfig<'band'> & {
525
+ scaleType: 'band';
526
+ };
534
527
  export declare function isBandScaleConfig(scaleConfig: AxisConfig<ScaleName>): scaleConfig is AxisConfig<'band'> & {
535
528
  scaleType: 'band';
536
529
  };
530
+ export declare function isPointScaleConfig(scaleConfig: PolarAxisConfig<ScaleName>): scaleConfig is PolarAxisConfig<'point'> & {
531
+ scaleType: 'point';
532
+ };
537
533
  export declare function isPointScaleConfig(scaleConfig: AxisConfig<ScaleName>): scaleConfig is AxisConfig<'point'> & {
538
534
  scaleType: 'point';
539
535
  };
536
+ export declare function isContinuousScaleConfig(scaleConfig: PolarAxisConfig<ScaleName>): scaleConfig is PolarAxisConfig<ContinuousScaleName>;
540
537
  export declare function isContinuousScaleConfig(scaleConfig: AxisConfig<ScaleName>): scaleConfig is AxisConfig<ContinuousScaleName>;
538
+ export declare function isSymlogScaleConfig(scaleConfig: PolarAxisConfig<ScaleName>): scaleConfig is PolarAxisConfig<'symlog'> & {
539
+ scaleType: 'symlog';
540
+ };
541
541
  export declare function isSymlogScaleConfig(scaleConfig: AxisConfig<ScaleName>): scaleConfig is AxisConfig<'symlog'> & {
542
542
  scaleType: 'symlog';
543
543
  };
@@ -575,8 +575,8 @@ export interface AxisItemIdentifier {
575
575
  }
576
576
  export type XAxis<S extends ScaleName = ScaleName, V = any> = S extends ScaleName ? MakeOptional<AxisConfig<S, V, ChartsXAxisProps>, 'id'> : never;
577
577
  export type YAxis<S extends ScaleName = ScaleName, V = any> = S extends ScaleName ? MakeOptional<AxisConfig<S, V, ChartsYAxisProps>, 'id'> : never;
578
- export type RotationAxis<S extends ScaleName = ScaleName, V = any> = S extends ScaleName ? MakeOptional<AxisConfig<S, V, ChartsRotationAxisProps>, 'id'> : never;
579
- export type RadiusAxis<S extends 'linear' = 'linear', V = any> = S extends 'linear' ? MakeOptional<AxisConfig<S, V, ChartsRadiusAxisProps>, 'id'> : never;
578
+ export type RotationAxis<S extends ScaleName = ScaleName, V = any> = S extends ScaleName ? MakeOptional<PolarAxisConfig<S, V, ChartsRotationAxisProps>, 'id'> : never;
579
+ export type RadiusAxis<S extends ScaleName = ScaleName, V = any> = S extends ScaleName ? MakeOptional<PolarAxisConfig<S, V, ChartsRadiusAxisProps>, 'id'> : never;
580
580
  /**
581
581
  * The axis configuration with missing values filled with default values.
582
582
  */
package/models/axis.js CHANGED
@@ -17,7 +17,11 @@ exports.isSymlogScaleConfig = isSymlogScaleConfig;
17
17
  */
18
18
 
19
19
  /**
20
- * Use this type for advanced typing. For basic usage, use `XAxis`, `YAxis`, `RotationAxis` or `RadiusAxis`.
20
+ * Use this type for advanced typing. For basic usage, use `RotationAxis` or `RadiusAxis`.
21
+ */
22
+
23
+ /**
24
+ * Use this type for advanced typing. For basic usage, use `XAxis` or `YAxis`.
21
25
  */
22
26
 
23
27
  function isBandScaleConfig(scaleConfig) {
package/models/axis.mjs CHANGED
@@ -8,7 +8,11 @@
8
8
  */
9
9
 
10
10
  /**
11
- * Use this type for advanced typing. For basic usage, use `XAxis`, `YAxis`, `RotationAxis` or `RadiusAxis`.
11
+ * Use this type for advanced typing. For basic usage, use `RotationAxis` or `RadiusAxis`.
12
+ */
13
+
14
+ /**
15
+ * Use this type for advanced typing. For basic usage, use `XAxis` or `YAxis`.
12
16
  */
13
17
 
14
18
  export function isBandScaleConfig(scaleConfig) {