@mui/x-charts 8.8.0 → 8.9.2

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 (164) hide show
  1. package/BarChart/BarChart.d.ts +3 -2
  2. package/BarChart/BarChart.js +95 -2
  3. package/BarChart/BarClipPath.d.ts +17 -12
  4. package/BarChart/BarClipPath.js +70 -57
  5. package/BarChart/BarPlot.js +4 -0
  6. package/BarChart/barClasses.d.ts +1 -1
  7. package/BarChart/seriesConfig/extremums.js +2 -3
  8. package/BarChart/seriesConfig/seriesProcessor.js +5 -3
  9. package/BarChart/useBarChartProps.d.ts +1 -1
  10. package/BarChart/useBarPlotData.js +32 -5
  11. package/CHANGELOG.md +225 -24
  12. package/ChartContainer/ChartContainer.js +141 -0
  13. package/ChartsLabel/ChartsLabelMark.d.ts +2 -1
  14. package/ChartsLabel/index.d.ts +1 -0
  15. package/ChartsLabel/index.js +18 -0
  16. package/ChartsLegend/chartsLegendClasses.d.ts +1 -1
  17. package/ChartsLegend/piecewiseColorLegendClasses.d.ts +1 -1
  18. package/{internals/components/ChartsWrapper → ChartsWrapper}/ChartsWrapper.d.ts +13 -4
  19. package/{internals/components/ChartsWrapper → ChartsWrapper}/ChartsWrapper.js +33 -7
  20. package/LineChart/LineChart.d.ts +3 -2
  21. package/LineChart/LineChart.js +95 -2
  22. package/LineChart/seriesConfig/extremums.js +2 -3
  23. package/LineChart/useLineChartProps.d.ts +1 -1
  24. package/PieChart/PieArcLabelPlot.js +3 -0
  25. package/PieChart/PieArcPlot.js +3 -0
  26. package/PieChart/PieChart.d.ts +3 -2
  27. package/PieChart/PieChart.js +2 -2
  28. package/PieChart/pieClasses.d.ts +1 -1
  29. package/RadarChart/RadarAxisHighlight/RadarAxisHighlight.js +3 -5
  30. package/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.d.ts +2 -13
  31. package/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.js +8 -45
  32. package/RadarChart/RadarChart.d.ts +3 -2
  33. package/RadarChart/RadarChart.js +24 -3
  34. package/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +3 -2
  35. package/RadarChart/RadarMetricLabels/useRadarMetricData.js +4 -2
  36. package/RadarChart/RadarSeriesPlot/RadarSeriesArea.js +19 -3
  37. package/RadarChart/RadarSeriesPlot/RadarSeriesMarks.js +20 -4
  38. package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.js +38 -4
  39. package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.types.d.ts +32 -3
  40. package/RadarChart/RadarSeriesPlot/useRadarRotationIndex.d.ts +8 -0
  41. package/RadarChart/RadarSeriesPlot/useRadarRotationIndex.js +38 -0
  42. package/RadarChart/RadarSeriesPlot/useRadarSeriesData.d.ts +2 -2
  43. package/RadarChart/index.d.ts +1 -1
  44. package/RadarChart/useRadarChartProps.d.ts +4 -1
  45. package/RadarChart/useRadarChartProps.js +15 -3
  46. package/ScatterChart/ScatterChart.d.ts +3 -2
  47. package/ScatterChart/ScatterChart.js +95 -2
  48. package/ScatterChart/seriesConfig/extremums.js +50 -23
  49. package/ScatterChart/useScatterChartProps.d.ts +1 -1
  50. package/SparkLineChart/SparkLineChart.js +93 -0
  51. package/esm/BarChart/BarChart.d.ts +3 -2
  52. package/esm/BarChart/BarChart.js +95 -2
  53. package/esm/BarChart/BarClipPath.d.ts +17 -12
  54. package/esm/BarChart/BarClipPath.js +69 -55
  55. package/esm/BarChart/BarPlot.js +4 -0
  56. package/esm/BarChart/barClasses.d.ts +1 -1
  57. package/esm/BarChart/seriesConfig/extremums.js +2 -3
  58. package/esm/BarChart/seriesConfig/seriesProcessor.js +5 -3
  59. package/esm/BarChart/useBarChartProps.d.ts +1 -1
  60. package/esm/BarChart/useBarPlotData.js +32 -5
  61. package/esm/ChartContainer/ChartContainer.js +141 -0
  62. package/esm/ChartsLabel/ChartsLabelMark.d.ts +2 -1
  63. package/esm/ChartsLabel/index.d.ts +1 -0
  64. package/esm/ChartsLabel/index.js +1 -0
  65. package/esm/ChartsLegend/chartsLegendClasses.d.ts +1 -1
  66. package/esm/ChartsLegend/piecewiseColorLegendClasses.d.ts +1 -1
  67. package/esm/{internals/components/ChartsWrapper → ChartsWrapper}/ChartsWrapper.d.ts +13 -4
  68. package/esm/{internals/components/ChartsWrapper → ChartsWrapper}/ChartsWrapper.js +31 -6
  69. package/esm/LineChart/LineChart.d.ts +3 -2
  70. package/esm/LineChart/LineChart.js +95 -2
  71. package/esm/LineChart/seriesConfig/extremums.js +2 -3
  72. package/esm/LineChart/useLineChartProps.d.ts +1 -1
  73. package/esm/PieChart/PieArcLabelPlot.js +3 -0
  74. package/esm/PieChart/PieArcPlot.js +3 -0
  75. package/esm/PieChart/PieChart.d.ts +3 -2
  76. package/esm/PieChart/PieChart.js +2 -2
  77. package/esm/PieChart/pieClasses.d.ts +1 -1
  78. package/esm/RadarChart/RadarAxisHighlight/RadarAxisHighlight.js +3 -5
  79. package/esm/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.d.ts +2 -13
  80. package/esm/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.js +8 -45
  81. package/esm/RadarChart/RadarChart.d.ts +3 -2
  82. package/esm/RadarChart/RadarChart.js +24 -3
  83. package/esm/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +3 -2
  84. package/esm/RadarChart/RadarMetricLabels/useRadarMetricData.js +4 -2
  85. package/esm/RadarChart/RadarSeriesPlot/RadarSeriesArea.js +19 -3
  86. package/esm/RadarChart/RadarSeriesPlot/RadarSeriesMarks.js +20 -4
  87. package/esm/RadarChart/RadarSeriesPlot/RadarSeriesPlot.js +38 -4
  88. package/esm/RadarChart/RadarSeriesPlot/RadarSeriesPlot.types.d.ts +32 -3
  89. package/esm/RadarChart/RadarSeriesPlot/useRadarRotationIndex.d.ts +8 -0
  90. package/esm/RadarChart/RadarSeriesPlot/useRadarRotationIndex.js +32 -0
  91. package/esm/RadarChart/RadarSeriesPlot/useRadarSeriesData.d.ts +2 -2
  92. package/esm/RadarChart/index.d.ts +1 -1
  93. package/esm/RadarChart/useRadarChartProps.d.ts +4 -1
  94. package/esm/RadarChart/useRadarChartProps.js +15 -3
  95. package/esm/ScatterChart/ScatterChart.d.ts +3 -2
  96. package/esm/ScatterChart/ScatterChart.js +95 -2
  97. package/esm/ScatterChart/seriesConfig/extremums.js +50 -23
  98. package/esm/ScatterChart/useScatterChartProps.d.ts +1 -1
  99. package/esm/SparkLineChart/SparkLineChart.js +93 -0
  100. package/esm/hooks/useTicks.d.ts +6 -1
  101. package/esm/hooks/useTicks.js +94 -58
  102. package/esm/index.d.ts +2 -1
  103. package/esm/index.js +6 -2
  104. package/esm/internals/findMinMax.d.ts +1 -0
  105. package/esm/internals/findMinMax.js +13 -0
  106. package/esm/internals/getScale.js +3 -0
  107. package/esm/internals/index.d.ts +1 -1
  108. package/esm/internals/index.js +1 -1
  109. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +4 -1
  110. package/esm/internals/plugins/featurePlugins/useChartHighlight/createIsFaded.d.ts +1 -1
  111. package/esm/internals/plugins/featurePlugins/useChartHighlight/createIsFaded.js +19 -11
  112. package/esm/internals/plugins/featurePlugins/useChartHighlight/createIsHighlighted.d.ts +1 -1
  113. package/esm/internals/plugins/featurePlugins/useChartHighlight/createIsHighlighted.js +19 -11
  114. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +10 -4
  115. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +4 -4
  116. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +44 -1
  117. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +8 -1
  118. package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +17 -12
  119. package/esm/internals/symlogScale.d.ts +2 -0
  120. package/esm/internals/symlogScale.js +94 -0
  121. package/esm/models/axis.d.ts +47 -5
  122. package/esm/models/axis.js +3 -0
  123. package/esm/models/seriesType/bar.d.ts +11 -1
  124. package/esm/models/seriesType/common.d.ts +9 -3
  125. package/esm/models/seriesType/line.d.ts +3 -1
  126. package/esm/models/seriesType/scatter.d.ts +4 -1
  127. package/esm/tests/web-components.js +49 -0
  128. package/hooks/useTicks.d.ts +6 -1
  129. package/hooks/useTicks.js +95 -58
  130. package/index.d.ts +2 -1
  131. package/index.js +13 -1
  132. package/internals/findMinMax.d.ts +1 -0
  133. package/internals/findMinMax.js +19 -0
  134. package/internals/getScale.js +3 -0
  135. package/internals/index.d.ts +1 -1
  136. package/internals/index.js +12 -12
  137. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +3 -0
  138. package/internals/plugins/featurePlugins/useChartHighlight/createIsFaded.d.ts +1 -1
  139. package/internals/plugins/featurePlugins/useChartHighlight/createIsFaded.js +20 -13
  140. package/internals/plugins/featurePlugins/useChartHighlight/createIsHighlighted.d.ts +1 -1
  141. package/internals/plugins/featurePlugins/useChartHighlight/createIsHighlighted.js +20 -13
  142. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +10 -4
  143. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +4 -4
  144. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +44 -1
  145. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +8 -1
  146. package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +17 -12
  147. package/internals/symlogScale.d.ts +2 -0
  148. package/internals/symlogScale.js +100 -0
  149. package/models/axis.d.ts +47 -5
  150. package/models/axis.js +4 -0
  151. package/models/seriesType/bar.d.ts +11 -1
  152. package/models/seriesType/common.d.ts +9 -3
  153. package/models/seriesType/line.d.ts +3 -1
  154. package/models/seriesType/scatter.d.ts +4 -1
  155. package/package.json +6 -7
  156. package/tests/web-components.js +55 -0
  157. package/BarChart/getRadius.d.ts +0 -20
  158. package/BarChart/getRadius.js +0 -37
  159. package/esm/BarChart/getRadius.d.ts +0 -20
  160. package/esm/BarChart/getRadius.js +0 -30
  161. /package/{esm/internals/components/ChartsWrapper → ChartsWrapper}/index.d.ts +0 -0
  162. /package/{internals/components/ChartsWrapper → ChartsWrapper}/index.js +0 -0
  163. /package/{internals/components → esm}/ChartsWrapper/index.d.ts +0 -0
  164. /package/esm/{internals/components/ChartsWrapper → ChartsWrapper}/index.js +0 -0
@@ -1,9 +1,17 @@
1
1
  import * as React from 'react';
2
2
  import { SxProps, Theme } from '@mui/material/styles';
3
- import { Direction } from "../../../ChartsLegend/index.js";
4
- import { Position } from "../../../models/index.js";
3
+ import { Direction } from "../ChartsLegend/index.js";
4
+ import { Position } from "../models/index.js";
5
5
  export interface ChartsWrapperProps {
6
+ /**
7
+ * The position of the legend.
8
+ * @default { horizontal: 'center', vertical: 'bottom' }
9
+ */
6
10
  legendPosition?: Position;
11
+ /**
12
+ * The direction of the legend.
13
+ * @default 'horizontal'
14
+ */
7
15
  legendDirection?: Direction;
8
16
  /**
9
17
  * If `true`, the chart wrapper set `height: 100%`.
@@ -14,10 +22,11 @@ export interface ChartsWrapperProps {
14
22
  sx?: SxProps<Theme>;
15
23
  }
16
24
  /**
17
- * @ignore - internal component.
18
- *
19
25
  * Wrapper for the charts components.
20
26
  * Its main purpose is to position the HTML legend in the correct place.
21
27
  */
22
28
  declare function ChartsWrapper(props: ChartsWrapperProps): React.JSX.Element;
29
+ declare namespace ChartsWrapper {
30
+ var propTypes: any;
31
+ }
23
32
  export { ChartsWrapper };
@@ -1,17 +1,19 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
3
4
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.ChartsWrapper = ChartsWrapper;
8
9
  var React = _interopRequireWildcard(require("react"));
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
11
  var _styles = require("@mui/material/styles");
10
12
  var _createStyled = require("@mui/system/createStyled");
11
- var _useChartRootRef = require("../../../hooks/useChartRootRef");
12
- var _useStore = require("../../store/useStore");
13
- var _useSelector = require("../../store/useSelector");
14
- var _useChartDimensions = require("../../plugins/corePlugins/useChartDimensions");
13
+ var _useChartRootRef = require("../hooks/useChartRootRef");
14
+ var _useStore = require("../internals/store/useStore");
15
+ var _useSelector = require("../internals/store/useSelector");
16
+ var _useChartDimensions = require("../internals/plugins/corePlugins/useChartDimensions");
15
17
  var _jsxRuntime = require("react/jsx-runtime");
16
18
  const getDirection = (direction, position) => {
17
19
  if (direction === 'vertical') {
@@ -67,8 +69,6 @@ const Root = (0, _styles.styled)('div', {
67
69
  }));
68
70
 
69
71
  /**
70
- * @ignore - internal component.
71
- *
72
72
  * Wrapper for the charts components.
73
73
  * Its main purpose is to position the HTML legend in the correct place.
74
74
  */
@@ -90,4 +90,30 @@ function ChartsWrapper(props) {
90
90
  extendVertically: extendVertically ?? propsHeight === undefined,
91
91
  children: children
92
92
  });
93
- }
93
+ }
94
+ process.env.NODE_ENV !== "production" ? ChartsWrapper.propTypes = {
95
+ // ----------------------------- Warning --------------------------------
96
+ // | These PropTypes are generated from the TypeScript type definitions |
97
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
98
+ // ----------------------------------------------------------------------
99
+ children: _propTypes.default.node,
100
+ /**
101
+ * If `true`, the chart wrapper set `height: 100%`.
102
+ * @default `false` if the `height` prop is set. And `true` otherwise.
103
+ */
104
+ extendVertically: _propTypes.default.bool,
105
+ /**
106
+ * The direction of the legend.
107
+ * @default 'horizontal'
108
+ */
109
+ legendDirection: _propTypes.default.oneOf(['horizontal', 'vertical']),
110
+ /**
111
+ * The position of the legend.
112
+ * @default { horizontal: 'center', vertical: 'bottom' }
113
+ */
114
+ legendPosition: _propTypes.default.shape({
115
+ horizontal: _propTypes.default.oneOf(['center', 'end', 'start']),
116
+ vertical: _propTypes.default.oneOf(['bottom', 'middle', 'top'])
117
+ }),
118
+ sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object])
119
+ } : void 0;
@@ -18,12 +18,13 @@ import { LineChartPluginsSignatures } from "./LineChart.plugins.js";
18
18
  import { ChartsToolbarSlots, ChartsToolbarSlotProps } from "../Toolbar/index.js";
19
19
  export interface LineChartSlots extends ChartsAxisSlots, AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
20
20
  export interface LineChartSlotProps extends ChartsAxisSlotProps, AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
21
+ export type LineSeries = MakeOptional<LineSeriesType, 'type'>;
21
22
  export interface LineChartProps extends Omit<ChartContainerProps<'line', LineChartPluginsSignatures>, 'series' | 'plugins' | 'zAxis'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
22
23
  /**
23
24
  * The series to display in the line chart.
24
- * An array of [[LineSeriesType]] objects.
25
+ * An array of [[LineSeries]] objects.
25
26
  */
26
- series: Readonly<MakeOptional<LineSeriesType, 'type'>[]>;
27
+ series: Readonly<LineSeries[]>;
27
28
  /**
28
29
  * Option to display a cartesian grid in the background.
29
30
  */
@@ -26,7 +26,7 @@ var _useLineChartProps = require("./useLineChartProps");
26
26
  var _useChartContainerProps = require("../ChartContainer/useChartContainerProps");
27
27
  var _ChartDataProvider = require("../ChartDataProvider");
28
28
  var _ChartsSurface = require("../ChartsSurface");
29
- var _ChartsWrapper = require("../internals/components/ChartsWrapper");
29
+ var _ChartsWrapper = require("../ChartsWrapper");
30
30
  var _jsxRuntime = require("react/jsx-runtime");
31
31
  /**
32
32
  * Demos:
@@ -216,7 +216,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
216
216
  onMarkClick: _propTypes.default.func,
217
217
  /**
218
218
  * The series to display in the line chart.
219
- * An array of [[LineSeriesType]] objects.
219
+ * An array of [[LineSeries]] objects.
220
220
  */
221
221
  series: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
222
222
  /**
@@ -401,6 +401,53 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
401
401
  tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
402
402
  tickSize: _propTypes.default.number,
403
403
  valueFormatter: _propTypes.default.func
404
+ }), _propTypes.default.shape({
405
+ axis: _propTypes.default.oneOf(['x']),
406
+ classes: _propTypes.default.object,
407
+ colorMap: _propTypes.default.oneOfType([_propTypes.default.shape({
408
+ color: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string.isRequired), _propTypes.default.func]).isRequired,
409
+ max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
410
+ min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
411
+ type: _propTypes.default.oneOf(['continuous']).isRequired
412
+ }), _propTypes.default.shape({
413
+ colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
414
+ thresholds: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]).isRequired).isRequired,
415
+ type: _propTypes.default.oneOf(['piecewise']).isRequired
416
+ })]),
417
+ constant: _propTypes.default.number,
418
+ data: _propTypes.default.array,
419
+ dataKey: _propTypes.default.string,
420
+ disableLine: _propTypes.default.bool,
421
+ disableTicks: _propTypes.default.bool,
422
+ domainLimit: _propTypes.default.oneOfType([_propTypes.default.oneOf(['nice', 'strict']), _propTypes.default.func]),
423
+ fill: _propTypes.default.string,
424
+ height: _propTypes.default.number,
425
+ hideTooltip: _propTypes.default.bool,
426
+ id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
427
+ ignoreTooltip: _propTypes.default.bool,
428
+ label: _propTypes.default.string,
429
+ labelStyle: _propTypes.default.object,
430
+ max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
431
+ min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
432
+ offset: _propTypes.default.number,
433
+ position: _propTypes.default.oneOf(['bottom', 'none', 'top']),
434
+ reverse: _propTypes.default.bool,
435
+ scaleType: _propTypes.default.oneOf(['symlog']),
436
+ slotProps: _propTypes.default.object,
437
+ slots: _propTypes.default.object,
438
+ stroke: _propTypes.default.string,
439
+ sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
440
+ tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
441
+ tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
442
+ tickLabelMinGap: _propTypes.default.number,
443
+ tickLabelPlacement: _propTypes.default.oneOf(['middle', 'tick']),
444
+ tickLabelStyle: _propTypes.default.object,
445
+ tickMaxStep: _propTypes.default.number,
446
+ tickMinStep: _propTypes.default.number,
447
+ tickNumber: _propTypes.default.number,
448
+ tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
449
+ tickSize: _propTypes.default.number,
450
+ valueFormatter: _propTypes.default.func
404
451
  }), _propTypes.default.shape({
405
452
  axis: _propTypes.default.oneOf(['x']),
406
453
  classes: _propTypes.default.object,
@@ -784,6 +831,52 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
784
831
  tickSize: _propTypes.default.number,
785
832
  valueFormatter: _propTypes.default.func,
786
833
  width: _propTypes.default.number
834
+ }), _propTypes.default.shape({
835
+ axis: _propTypes.default.oneOf(['y']),
836
+ classes: _propTypes.default.object,
837
+ colorMap: _propTypes.default.oneOfType([_propTypes.default.shape({
838
+ color: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string.isRequired), _propTypes.default.func]).isRequired,
839
+ max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
840
+ min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
841
+ type: _propTypes.default.oneOf(['continuous']).isRequired
842
+ }), _propTypes.default.shape({
843
+ colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
844
+ thresholds: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]).isRequired).isRequired,
845
+ type: _propTypes.default.oneOf(['piecewise']).isRequired
846
+ })]),
847
+ constant: _propTypes.default.number,
848
+ data: _propTypes.default.array,
849
+ dataKey: _propTypes.default.string,
850
+ disableLine: _propTypes.default.bool,
851
+ disableTicks: _propTypes.default.bool,
852
+ domainLimit: _propTypes.default.oneOfType([_propTypes.default.oneOf(['nice', 'strict']), _propTypes.default.func]),
853
+ fill: _propTypes.default.string,
854
+ hideTooltip: _propTypes.default.bool,
855
+ id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
856
+ ignoreTooltip: _propTypes.default.bool,
857
+ label: _propTypes.default.string,
858
+ labelStyle: _propTypes.default.object,
859
+ max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
860
+ min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
861
+ offset: _propTypes.default.number,
862
+ position: _propTypes.default.oneOf(['left', 'none', 'right']),
863
+ reverse: _propTypes.default.bool,
864
+ scaleType: _propTypes.default.oneOf(['symlog']),
865
+ slotProps: _propTypes.default.object,
866
+ slots: _propTypes.default.object,
867
+ stroke: _propTypes.default.string,
868
+ sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
869
+ tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
870
+ tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
871
+ tickLabelPlacement: _propTypes.default.oneOf(['middle', 'tick']),
872
+ tickLabelStyle: _propTypes.default.object,
873
+ tickMaxStep: _propTypes.default.number,
874
+ tickMinStep: _propTypes.default.number,
875
+ tickNumber: _propTypes.default.number,
876
+ tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
877
+ tickSize: _propTypes.default.number,
878
+ valueFormatter: _propTypes.default.func,
879
+ width: _propTypes.default.number
787
880
  }), _propTypes.default.shape({
788
881
  axis: _propTypes.default.oneOf(['y']),
789
882
  classes: _propTypes.default.object,
@@ -4,13 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getExtremumY = exports.getExtremumX = void 0;
7
+ var _findMinMax = require("../../internals/findMinMax");
7
8
  const getExtremumX = params => {
8
9
  const {
9
10
  axis
10
11
  } = params;
11
- const minX = Math.min(...(axis.data ?? []));
12
- const maxX = Math.max(...(axis.data ?? []));
13
- return [minX, maxX];
12
+ return (0, _findMinMax.findMinMax)(axis.data ?? []);
14
13
  };
15
14
  exports.getExtremumX = getExtremumX;
16
15
  function getSeriesExtremums(getValues, data, stackedData, filter) {
@@ -11,7 +11,7 @@ import type { LineChartProps } from "./LineChart.js";
11
11
  import { LineHighlightPlotProps } from "./LineHighlightPlot.js";
12
12
  import { LinePlotProps } from "./LinePlot.js";
13
13
  import { MarkPlotProps } from "./MarkPlot.js";
14
- import type { ChartsWrapperProps } from "../internals/components/ChartsWrapper/index.js";
14
+ import type { ChartsWrapperProps } from "../ChartsWrapper/index.js";
15
15
  import { LineChartPluginsSignatures } from "./LineChart.plugins.js";
16
16
  /**
17
17
  * A helper function that extracts LineChartProps from the input props
@@ -152,6 +152,9 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
152
152
  outerRadius: _propTypes.default.number,
153
153
  paddingAngle: _propTypes.default.number
154
154
  }),
155
+ /**
156
+ * The id of this series.
157
+ */
155
158
  id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
156
159
  /**
157
160
  * The radius between circle center and the beginning of the arc.
@@ -123,6 +123,9 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
123
123
  outerRadius: _propTypes.default.number,
124
124
  paddingAngle: _propTypes.default.number
125
125
  }),
126
+ /**
127
+ * The id of this series.
128
+ */
126
129
  id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
127
130
  /**
128
131
  * The radius between circle center and the beginning of the arc.
@@ -12,12 +12,13 @@ import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from "
12
12
  import { PieChartPluginSignatures } from "./PieChart.plugins.js";
13
13
  export interface PieChartSlots extends PiePlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
14
14
  export interface PieChartSlotProps extends PiePlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
15
+ export type PieSeries = MakeOptional<PieSeriesType<MakeOptional<PieValueType, 'id'>>, 'type'>;
15
16
  export interface PieChartProps extends Omit<ChartContainerProps<'pie', PieChartPluginSignatures>, 'series' | 'slots' | 'slotProps' | 'experimentalFeatures'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<PiePlotProps, 'skipAnimation'> {
16
17
  /**
17
18
  * The series to display in the pie chart.
18
- * An array of [[PieSeriesType]] objects.
19
+ * An array of [[PieSeries]] objects.
19
20
  */
20
- series: Readonly<MakeOptional<PieSeriesType<MakeOptional<PieValueType, 'id'>>, 'type'>[]>;
21
+ series: Readonly<PieSeries[]>;
21
22
  /**
22
23
  * If `true`, the legend is not rendered.
23
24
  */
@@ -20,7 +20,7 @@ var _ChartsOverlay = require("../ChartsOverlay");
20
20
  var _ChartsSurface = require("../ChartsSurface");
21
21
  var _ChartDataProvider = require("../ChartDataProvider");
22
22
  var _useChartContainerProps = require("../ChartContainer/useChartContainerProps");
23
- var _ChartsWrapper = require("../internals/components/ChartsWrapper");
23
+ var _ChartsWrapper = require("../ChartsWrapper");
24
24
  var _PieChart2 = require("./PieChart.plugins");
25
25
  var _defaultizeMargin = require("../internals/defaultizeMargin");
26
26
  var _jsxRuntime = require("react/jsx-runtime");
@@ -180,7 +180,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
180
180
  onItemClick: _propTypes.default.func,
181
181
  /**
182
182
  * The series to display in the pie chart.
183
- * An array of [[PieSeriesType]] objects.
183
+ * An array of [[PieSeries]] objects.
184
184
  */
185
185
  series: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
186
186
  /**
@@ -9,4 +9,4 @@ export interface PieClasses {
9
9
  export type PieClassKey = keyof PieClasses;
10
10
  export declare function getPieUtilityClass(slot: string): string;
11
11
  export declare const pieClasses: PieClasses;
12
- export declare const useUtilityClasses: (classes?: Partial<PieClasses>) => Record<"root" | "series" | "seriesLabels", string>;
12
+ export declare const useUtilityClasses: (classes?: Partial<PieClasses>) => Record<"series" | "root" | "seriesLabels", string>;
@@ -62,13 +62,11 @@ function RadarAxisHighlight(props) {
62
62
  className: classes.line,
63
63
  pointerEvents: "none",
64
64
  strokeDasharray: "4 4"
65
- }), points.map(({
66
- highlighted
67
- }, seriesIndex) => {
65
+ }), points.map((point, seriesIndex) => {
68
66
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("circle", (0, _extends2.default)({
69
67
  fill: series[seriesIndex].color,
70
- cx: highlighted.x,
71
- cy: highlighted.y,
68
+ cx: point.x,
69
+ cy: point.y,
72
70
  className: classes.dot,
73
71
  pointerEvents: "none"
74
72
  }, series[seriesIndex].hideMark ? highlightMark : highlightMarkShadow), series[seriesIndex].id);
@@ -2,12 +2,6 @@ import { UseChartPolarAxisSignature } from "../../internals/plugins/featurePlugi
2
2
  import { AxisId } from "../../models/axis.js";
3
3
  import { DefaultizedRadarSeriesType } from "../../models/seriesType/radar.js";
4
4
  import { ChartInstance } from "../../internals/plugins/models/index.js";
5
- interface UseRadarAxisHighlightParams {
6
- /**
7
- * If true, coordinates of the previous/next point will be added.
8
- */
9
- includesNeighbors?: boolean;
10
- }
11
5
  interface UseRadarAxisHighlightReturnValue {
12
6
  /**
13
7
  * The radar center.
@@ -40,7 +34,7 @@ interface UseRadarAxisHighlightReturnValue {
40
34
  * The { x, y, value } values for the highlighted points in the same order as the `series` array.
41
35
  * If `includesNeighbors` is set to `true` it also contains the information for `previous` and `next` data point.
42
36
  */
43
- points: Points[];
37
+ points: Point[];
44
38
  /**
45
39
  * Charts instances giving access to `polar2svg` and `svg2polar` helpers.
46
40
  */
@@ -53,10 +47,5 @@ interface Point {
53
47
  angle: number;
54
48
  value: number;
55
49
  }
56
- interface Points {
57
- highlighted: Point;
58
- previous?: Point;
59
- next?: Point;
60
- }
61
- export declare function useRadarAxisHighlight(params?: UseRadarAxisHighlightParams): UseRadarAxisHighlightReturnValue | null;
50
+ export declare function useRadarAxisHighlight(): UseRadarAxisHighlightReturnValue | null;
62
51
  export {};
@@ -12,10 +12,7 @@ var _useStore = require("../../internals/store/useStore");
12
12
  var _useChartContext = require("../../context/ChartProvider/useChartContext");
13
13
  var _useChartPolarAxis = require("../../internals/plugins/featurePlugins/useChartPolarAxis");
14
14
  var _useChartPolarInteraction = require("../../internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors");
15
- function useRadarAxisHighlight(params) {
16
- const {
17
- includesNeighbors = false
18
- } = params ?? {};
15
+ function useRadarAxisHighlight() {
19
16
  const radarSeries = (0, _useRadarSeries.useRadarSeries)();
20
17
  const rotationScale = (0, _useScale.useRotationScale)();
21
18
  const {
@@ -55,48 +52,14 @@ function useRadarAxisHighlight(params) {
55
52
  const value = series.data[highlightedIndex];
56
53
  const r = radiusScale(value);
57
54
  const [x, y] = instance.polar2svg(r, angle);
58
- const retrunedValue = {
59
- highlighted: {
60
- x,
61
- y,
62
- r,
63
- angle,
64
- value
65
- }
55
+ const returnedValue = {
56
+ x,
57
+ y,
58
+ r,
59
+ angle,
60
+ value
66
61
  };
67
- if (!includesNeighbors) {
68
- return retrunedValue;
69
- }
70
- const dataLength = series.data.length;
71
- const prevIndex = (dataLength + highlightedIndex - 1) % dataLength;
72
- const nextIndex = (highlightedIndex + 1) % dataLength;
73
- const prevValue = series.data[prevIndex];
74
- const nextValue = series.data[nextIndex];
75
- if (prevValue != null) {
76
- const prevR = radiusAxis[radiusAxisIds[prevIndex]].scale(prevValue);
77
- const prevAngle = rotationScale(rotationScale.domain()[prevIndex]);
78
- const [px, py] = instance.polar2svg(prevR, prevAngle);
79
- retrunedValue.previous = {
80
- x: px,
81
- y: py,
82
- r: prevR,
83
- angle: prevAngle,
84
- value: prevValue
85
- };
86
- }
87
- if (nextValue != null) {
88
- const nextR = radiusAxis[radiusAxisIds[nextIndex]].scale(nextValue);
89
- const nextAngle = rotationScale(rotationScale.domain()[nextIndex]);
90
- const [nx, ny] = instance.polar2svg(nextR, nextAngle);
91
- retrunedValue.next = {
92
- x: nx,
93
- y: ny,
94
- r: nextR,
95
- angle: nextAngle,
96
- value: nextValue
97
- };
98
- }
99
- return retrunedValue;
62
+ return returnedValue;
100
63
  })
101
64
  };
102
65
  }
@@ -2,16 +2,17 @@ import * as React from 'react';
2
2
  import { ChartsLegendSlotProps, ChartsLegendSlots } from "../ChartsLegend/index.js";
3
3
  import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from "../ChartsOverlay/ChartsOverlay.js";
4
4
  import { ChartsSurfaceProps } from "../ChartsSurface/index.js";
5
- import { ChartsWrapperProps } from "../internals/components/ChartsWrapper/index.js";
5
+ import { ChartsWrapperProps } from "../ChartsWrapper/index.js";
6
6
  import { RadarGridProps } from "./RadarGrid/index.js";
7
7
  import { RadarDataProviderProps } from "./RadarDataProvider/RadarDataProvider.js";
8
+ import { RadarSeriesPlotProps } from "./RadarSeriesPlot/index.js";
8
9
  import { RadarAxisHighlightProps } from "./RadarAxisHighlight/index.js";
9
10
  import { ChartsTooltipSlotProps, ChartsTooltipSlots } from "../ChartsTooltip/index.js";
10
11
  import { ChartsSlotProps, ChartsSlots } from "../internals/material/index.js";
11
12
  import { ChartsToolbarSlotProps, ChartsToolbarSlots } from "../Toolbar/index.js";
12
13
  export interface RadarChartSlots extends ChartsTooltipSlots, ChartsOverlaySlots, ChartsLegendSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
13
14
  export interface RadarChartSlotProps extends ChartsTooltipSlotProps, ChartsOverlaySlotProps, ChartsLegendSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
14
- export interface RadarChartProps extends RadarDataProviderProps, Omit<RadarGridProps, 'classes'>, Omit<Partial<RadarAxisHighlightProps>, 'classes'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<ChartsWrapperProps, 'sx'>, Omit<ChartsSurfaceProps, 'sx'> {
15
+ export interface RadarChartProps extends RadarDataProviderProps, Omit<RadarGridProps, 'classes'>, Omit<Partial<RadarAxisHighlightProps>, 'classes'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<ChartsWrapperProps, 'sx'>, Omit<ChartsSurfaceProps, 'sx'>, Pick<RadarSeriesPlotProps, 'onAreaClick' | 'onMarkClick'> {
15
16
  /**
16
17
  * If `true`, the legend is not rendered.
17
18
  */
@@ -15,7 +15,7 @@ var _ChartsLegend = require("../ChartsLegend");
15
15
  var _ChartsOverlay = require("../ChartsOverlay/ChartsOverlay");
16
16
  var _useRadarChartProps = require("./useRadarChartProps");
17
17
  var _ChartsSurface = require("../ChartsSurface");
18
- var _ChartsWrapper = require("../internals/components/ChartsWrapper");
18
+ var _ChartsWrapper = require("../ChartsWrapper");
19
19
  var _RadarGrid = require("./RadarGrid");
20
20
  var _RadarDataProvider = require("./RadarDataProvider/RadarDataProvider");
21
21
  var _RadarSeriesPlot = require("./RadarSeriesPlot");
@@ -42,6 +42,8 @@ const RadarChart = exports.RadarChart = /*#__PURE__*/React.forwardRef(function R
42
42
  chartsSurfaceProps,
43
43
  radarDataProviderProps,
44
44
  radarGrid,
45
+ radarSeriesAreaProps,
46
+ radarSeriesMarksProps,
45
47
  overlayProps,
46
48
  legendProps,
47
49
  highlight,
@@ -53,7 +55,7 @@ const RadarChart = exports.RadarChart = /*#__PURE__*/React.forwardRef(function R
53
55
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsWrapper.ChartsWrapper, (0, _extends2.default)({}, chartsWrapperProps, {
54
56
  children: [props.showToolbar && Toolbar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Toolbar, (0, _extends2.default)({}, props.slotProps?.toolbar)) : null, !props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
55
57
  ref: ref,
56
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarGrid.RadarGrid, (0, _extends2.default)({}, radarGrid)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarMetricLabels.RadarMetricLabels, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarSeriesPlot.RadarSeriesArea, {}), highlight === 'axis' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarAxisHighlight.RadarAxisHighlight, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarSeriesPlot.RadarSeriesMarks, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), children]
58
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarGrid.RadarGrid, (0, _extends2.default)({}, radarGrid)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarMetricLabels.RadarMetricLabels, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarSeriesPlot.RadarSeriesArea, (0, _extends2.default)({}, radarSeriesAreaProps)), highlight === 'axis' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarAxisHighlight.RadarAxisHighlight, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarSeriesPlot.RadarSeriesMarks, (0, _extends2.default)({}, radarSeriesMarksProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), children]
57
59
  })), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, props.slotProps?.tooltip))]
58
60
  }))
59
61
  }));
@@ -132,12 +134,31 @@ process.env.NODE_ENV !== "production" ? RadarChart.propTypes = {
132
134
  right: _propTypes.default.number,
133
135
  top: _propTypes.default.number
134
136
  })]),
137
+ /**
138
+ * Callback fired when an area is clicked.
139
+ * @param {React.MouseEvent<SVGPathElement, MouseEvent>} event The event source of the callback.
140
+ * @param {RadarItemIdentifier} radarItemIdentifier The radar item identifier.
141
+ */
142
+ onAreaClick: _propTypes.default.func,
143
+ /**
144
+ * The function called for onClick events.
145
+ * The second argument contains information about all line/bar elements at the current mouse position.
146
+ * @param {MouseEvent} event The mouse event recorded on the `<svg/>` element.
147
+ * @param {null | ChartsAxisData} data The data about the clicked axis and items associated with it.
148
+ */
149
+ onAxisClick: _propTypes.default.func,
135
150
  /**
136
151
  * The callback fired when the highlighted item changes.
137
152
  *
138
153
  * @param {HighlightItemData | null} highlightedItem The newly highlighted item.
139
154
  */
140
155
  onHighlightChange: _propTypes.default.func,
156
+ /**
157
+ * Callback fired when a mark is clicked.
158
+ * @param {React.MouseEvent<SVGPathElement, MouseEvent>} event The event source of the callback.
159
+ * @param {RadarItemIdentifier} radarItemIdentifier The radar item identifier.
160
+ */
161
+ onMarkClick: _propTypes.default.func,
141
162
  /**
142
163
  * The configuration of the radar scales.
143
164
  */
@@ -154,7 +175,7 @@ process.env.NODE_ENV !== "production" ? RadarChart.propTypes = {
154
175
  }).isRequired,
155
176
  /**
156
177
  * The series to display in the bar chart.
157
- * An array of [[RadarSeriesType]] objects.
178
+ * An array of [[RadarSeries]] objects.
158
179
  */
159
180
  series: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
160
181
  /**
@@ -5,12 +5,13 @@ import { RadarSeriesType } from "../../models/seriesType/radar.js";
5
5
  import { ChartDataProviderProps } from "../../ChartDataProvider/index.js";
6
6
  import { RadarConfig } from "./radar.types.js";
7
7
  import { ChartAnyPluginSignature } from "../../internals/plugins/models/plugin.js";
8
+ export type RadarSeries = MakeOptional<RadarSeriesType, 'type'>;
8
9
  export type RadarDataProviderProps<TSignatures extends readonly ChartAnyPluginSignature[] = RadarChartPluginsSignatures> = Omit<ChartDataProviderProps<'radar', TSignatures>, 'series' | 'rotationAxis' | 'radiusAxis' | 'dataset' | 'experimentalFeatures'> & {
9
10
  /**
10
11
  * The series to display in the bar chart.
11
- * An array of [[RadarSeriesType]] objects.
12
+ * An array of [[RadarSeries]] objects.
12
13
  */
13
- series: Readonly<MakeOptional<RadarSeriesType, 'type'>>[];
14
+ series: Readonly<RadarSeries>[];
14
15
  /**
15
16
  * The configuration of the radar scales.
16
17
  */
@@ -27,14 +27,16 @@ function useRadarMetricData() {
27
27
  const radiusScale = radiusAxis[metric].scale;
28
28
  const r = radiusScale.range()[1] + labelGap;
29
29
  const angle = angles[dataIndex];
30
+ const defaultTickLabel = metric;
30
31
  return {
31
32
  x: cx + r * Math.sin(angle),
32
33
  y: cy - r * Math.cos(angle),
33
34
  angle: (0, _angleConversion.rad2deg)(angle),
34
35
  label: valueFormatter?.(metric, {
35
36
  location: 'tick',
36
- scale: rotationScale
37
- }) ?? metric
37
+ scale: rotationScale,
38
+ defaultTickLabel
39
+ }) ?? defaultTickLabel
38
40
  };
39
41
  })
40
42
  };
@@ -17,8 +17,9 @@ var _getAreaPath = require("./getAreaPath");
17
17
  var _radarSeriesPlotClasses = require("./radarSeriesPlotClasses");
18
18
  var _useItemHighlightedGetter = require("../../hooks/useItemHighlightedGetter");
19
19
  var _useInteractionItemProps = require("../../hooks/useInteractionItemProps");
20
+ var _useRadarRotationIndex = require("./useRadarRotationIndex");
20
21
  var _jsxRuntime = require("react/jsx-runtime");
21
- const _excluded = ["seriesId"];
22
+ const _excluded = ["seriesId", "onItemClick"];
22
23
  function getPathProps(params) {
23
24
  const {
24
25
  isHighlighted,
@@ -47,10 +48,12 @@ function getPathProps(params) {
47
48
  }
48
49
  function RadarSeriesArea(props) {
49
50
  const {
50
- seriesId
51
+ seriesId,
52
+ onItemClick
51
53
  } = props,
52
54
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
53
55
  const seriesCoordinates = (0, _useRadarSeriesData.useRadarSeriesData)(seriesId);
56
+ const getRotationIndex = (0, _useRadarRotationIndex.useRadarRotationIndex)();
54
57
  const interactionProps = (0, _useInteractionItemProps.useInteractionAllItemProps)(seriesCoordinates);
55
58
  const {
56
59
  isFaded,
@@ -72,7 +75,14 @@ function RadarSeriesArea(props) {
72
75
  isFaded,
73
76
  isHighlighted,
74
77
  classes
75
- }), interactionProps[seriesIndex], other), id);
78
+ }), {
79
+ onClick: event => onItemClick?.(event, {
80
+ type: 'radar',
81
+ seriesId: id,
82
+ dataIndex: getRotationIndex(event)
83
+ }),
84
+ cursor: onItemClick ? 'pointer' : 'unset'
85
+ }, interactionProps[seriesIndex], other), id);
76
86
  })
77
87
  });
78
88
  }
@@ -85,6 +95,12 @@ process.env.NODE_ENV !== "production" ? RadarSeriesArea.propTypes = {
85
95
  * Override or extend the styles applied to the component.
86
96
  */
87
97
  classes: _propTypes.default.object,
98
+ /**
99
+ * Callback fired when an area is clicked.
100
+ * @param {React.MouseEvent<SVGPathElement, MouseEvent>} event The event source of the callback.
101
+ * @param {RadarItemIdentifier} radarItemIdentifier The radar item identifier.
102
+ */
103
+ onItemClick: _propTypes.default.func,
88
104
  /**
89
105
  * The id of the series to display.
90
106
  * If undefined all series are displayed.