@mui/x-charts 8.9.2 → 8.10.1

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 (120) hide show
  1. package/BarChart/BarChart.js +20 -0
  2. package/CHANGELOG.md +217 -6
  3. package/ChartContainer/ChartContainer.js +30 -0
  4. package/ChartsAxisHighlight/ChartsAxisHighlight.js +2 -2
  5. package/ChartsAxisHighlight/ChartsXAxisHighlight.js +1 -3
  6. package/ChartsAxisHighlight/ChartsYAxisHighlight.js +1 -3
  7. package/ChartsLabel/labelGradientClasses.d.ts +1 -1
  8. package/ChartsLabel/labelMarkClasses.d.ts +1 -1
  9. package/ChartsReferenceLine/ChartsXReferenceLine.d.ts +1 -1
  10. package/ChartsReferenceLine/ChartsYReferenceLine.d.ts +1 -1
  11. package/ChartsTooltip/ChartsTooltip.d.ts +2 -1
  12. package/ChartsTooltip/ChartsTooltip.js +3 -3
  13. package/ChartsTooltip/ChartsTooltipContainer.d.ts +5 -5
  14. package/ChartsTooltip/ChartsTooltipContainer.js +11 -5
  15. package/ChartsTooltip/ChartsTooltipTable.d.ts +1 -1
  16. package/ChartsTooltip/ChartsTooltipTable.js +1 -0
  17. package/ChartsTooltip/chartsTooltipClasses.d.ts +1 -1
  18. package/ChartsXAxis/ChartsGroupedXAxis.d.ts +7 -0
  19. package/ChartsXAxis/ChartsGroupedXAxis.js +143 -0
  20. package/ChartsXAxis/ChartsSingleXAxis.d.ts +7 -0
  21. package/ChartsXAxis/ChartsSingleXAxis.js +144 -0
  22. package/ChartsXAxis/ChartsXAxis.d.ts +1 -1
  23. package/ChartsXAxis/ChartsXAxis.js +8 -210
  24. package/ChartsXAxis/getVisibleLabels.d.ts +2 -2
  25. package/ChartsXAxis/useAxisProps.d.ts +4526 -0
  26. package/ChartsXAxis/useAxisProps.js +105 -0
  27. package/ChartsXAxis/utilities.d.ts +11 -0
  28. package/ChartsXAxis/utilities.js +43 -0
  29. package/ChartsYAxis/ChartsGroupedYAxis.d.ts +7 -0
  30. package/ChartsYAxis/ChartsGroupedYAxis.js +144 -0
  31. package/ChartsYAxis/ChartsSingleYAxis.d.ts +7 -0
  32. package/ChartsYAxis/ChartsSingleYAxis.js +133 -0
  33. package/ChartsYAxis/ChartsYAxis.d.ts +1 -1
  34. package/ChartsYAxis/ChartsYAxis.js +12 -211
  35. package/ChartsYAxis/useAxisProps.d.ts +4452 -0
  36. package/ChartsYAxis/useAxisProps.js +115 -0
  37. package/ChartsYAxis/utilities.d.ts +10 -0
  38. package/ChartsYAxis/utilities.js +42 -0
  39. package/LineChart/LineChart.js +20 -0
  40. package/RadarChart/index.d.ts +9 -2
  41. package/RadarChart/index.js +13 -14
  42. package/ScatterChart/ScatterChart.d.ts +8 -1
  43. package/ScatterChart/ScatterChart.js +20 -0
  44. package/SparkLineChart/SparkLineChart.d.ts +15 -5
  45. package/SparkLineChart/SparkLineChart.js +77 -34
  46. package/esm/BarChart/BarChart.js +20 -0
  47. package/esm/ChartContainer/ChartContainer.js +30 -0
  48. package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +2 -2
  49. package/esm/ChartsAxisHighlight/ChartsXAxisHighlight.js +1 -3
  50. package/esm/ChartsAxisHighlight/ChartsYAxisHighlight.js +1 -3
  51. package/esm/ChartsLabel/labelGradientClasses.d.ts +1 -1
  52. package/esm/ChartsLabel/labelMarkClasses.d.ts +1 -1
  53. package/esm/ChartsReferenceLine/ChartsXReferenceLine.d.ts +1 -1
  54. package/esm/ChartsReferenceLine/ChartsYReferenceLine.d.ts +1 -1
  55. package/esm/ChartsTooltip/ChartsTooltip.d.ts +2 -1
  56. package/esm/ChartsTooltip/ChartsTooltip.js +3 -3
  57. package/esm/ChartsTooltip/ChartsTooltipContainer.d.ts +5 -5
  58. package/esm/ChartsTooltip/ChartsTooltipContainer.js +11 -5
  59. package/esm/ChartsTooltip/ChartsTooltipTable.d.ts +1 -1
  60. package/esm/ChartsTooltip/ChartsTooltipTable.js +1 -0
  61. package/esm/ChartsTooltip/chartsTooltipClasses.d.ts +1 -1
  62. package/esm/ChartsXAxis/ChartsGroupedXAxis.d.ts +7 -0
  63. package/esm/ChartsXAxis/ChartsGroupedXAxis.js +137 -0
  64. package/esm/ChartsXAxis/ChartsSingleXAxis.d.ts +7 -0
  65. package/esm/ChartsXAxis/ChartsSingleXAxis.js +140 -0
  66. package/esm/ChartsXAxis/ChartsXAxis.d.ts +1 -1
  67. package/esm/ChartsXAxis/ChartsXAxis.js +7 -207
  68. package/esm/ChartsXAxis/getVisibleLabels.d.ts +2 -2
  69. package/esm/ChartsXAxis/useAxisProps.d.ts +4526 -0
  70. package/esm/ChartsXAxis/useAxisProps.js +98 -0
  71. package/esm/ChartsXAxis/utilities.d.ts +11 -0
  72. package/esm/ChartsXAxis/utilities.js +35 -0
  73. package/esm/ChartsYAxis/ChartsGroupedYAxis.d.ts +7 -0
  74. package/esm/ChartsYAxis/ChartsGroupedYAxis.js +138 -0
  75. package/esm/ChartsYAxis/ChartsSingleYAxis.d.ts +7 -0
  76. package/esm/ChartsYAxis/ChartsSingleYAxis.js +129 -0
  77. package/esm/ChartsYAxis/ChartsYAxis.d.ts +1 -1
  78. package/esm/ChartsYAxis/ChartsYAxis.js +10 -207
  79. package/esm/ChartsYAxis/useAxisProps.d.ts +4452 -0
  80. package/esm/ChartsYAxis/useAxisProps.js +108 -0
  81. package/esm/ChartsYAxis/utilities.d.ts +10 -0
  82. package/esm/ChartsYAxis/utilities.js +34 -0
  83. package/esm/LineChart/LineChart.js +20 -0
  84. package/esm/RadarChart/index.d.ts +9 -2
  85. package/esm/RadarChart/index.js +12 -2
  86. package/esm/ScatterChart/ScatterChart.d.ts +8 -1
  87. package/esm/ScatterChart/ScatterChart.js +20 -0
  88. package/esm/SparkLineChart/SparkLineChart.d.ts +15 -5
  89. package/esm/SparkLineChart/SparkLineChart.js +77 -34
  90. package/esm/hooks/useTicksGrouped.d.ts +28 -0
  91. package/esm/hooks/useTicksGrouped.js +98 -0
  92. package/esm/index.js +1 -1
  93. package/esm/internals/animation/Transition.js +2 -5
  94. package/esm/internals/configInit.js +2 -2
  95. package/esm/internals/getScale.d.ts +1 -1
  96. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +3 -1
  97. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +32 -23
  98. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.d.ts +1 -1
  99. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.d.ts +1 -1
  100. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +3 -4
  101. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +2 -2
  102. package/esm/internals/plugins/utils/ChartStore.js +16 -18
  103. package/esm/models/axis.d.ts +46 -2
  104. package/esm/tests/web-components.js +2 -4
  105. package/hooks/useTicksGrouped.d.ts +28 -0
  106. package/hooks/useTicksGrouped.js +104 -0
  107. package/index.js +1 -1
  108. package/internals/animation/Transition.js +2 -5
  109. package/internals/configInit.js +2 -2
  110. package/internals/getScale.d.ts +1 -1
  111. package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +3 -1
  112. package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +34 -23
  113. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.d.ts +1 -1
  114. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.d.ts +1 -1
  115. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +3 -4
  116. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +2 -2
  117. package/internals/plugins/utils/ChartStore.js +16 -18
  118. package/models/axis.d.ts +46 -2
  119. package/package.json +16 -18
  120. package/tests/web-components.js +2 -4
@@ -234,6 +234,11 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
234
234
  domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
235
235
  endAngle: PropTypes.number,
236
236
  fill: PropTypes.string,
237
+ groups: PropTypes.arrayOf(PropTypes.shape({
238
+ getValue: PropTypes.func.isRequired,
239
+ tickLabelStyle: PropTypes.object,
240
+ tickSize: PropTypes.number
241
+ })),
237
242
  height: PropTypes.number,
238
243
  hideTooltip: PropTypes.bool,
239
244
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
@@ -286,6 +291,11 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
286
291
  domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
287
292
  endAngle: PropTypes.number,
288
293
  fill: PropTypes.string,
294
+ groups: PropTypes.arrayOf(PropTypes.shape({
295
+ getValue: PropTypes.func.isRequired,
296
+ tickLabelStyle: PropTypes.object,
297
+ tickSize: PropTypes.number
298
+ })),
289
299
  height: PropTypes.number,
290
300
  hideTooltip: PropTypes.bool,
291
301
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
@@ -707,6 +717,11 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
707
717
  disableTicks: PropTypes.bool,
708
718
  domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
709
719
  fill: PropTypes.string,
720
+ groups: PropTypes.arrayOf(PropTypes.shape({
721
+ getValue: PropTypes.func.isRequired,
722
+ tickLabelStyle: PropTypes.object,
723
+ tickSize: PropTypes.number
724
+ })),
710
725
  height: PropTypes.number,
711
726
  hideTooltip: PropTypes.bool,
712
727
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
@@ -758,6 +773,11 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
758
773
  disableTicks: PropTypes.bool,
759
774
  domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
760
775
  fill: PropTypes.string,
776
+ groups: PropTypes.arrayOf(PropTypes.shape({
777
+ getValue: PropTypes.func.isRequired,
778
+ tickLabelStyle: PropTypes.object,
779
+ tickSize: PropTypes.number
780
+ })),
761
781
  height: PropTypes.number,
762
782
  hideTooltip: PropTypes.bool,
763
783
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
@@ -1140,6 +1160,11 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
1140
1160
  disableTicks: PropTypes.bool,
1141
1161
  domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
1142
1162
  fill: PropTypes.string,
1163
+ groups: PropTypes.arrayOf(PropTypes.shape({
1164
+ getValue: PropTypes.func.isRequired,
1165
+ tickLabelStyle: PropTypes.object,
1166
+ tickSize: PropTypes.number
1167
+ })),
1143
1168
  hideTooltip: PropTypes.bool,
1144
1169
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
1145
1170
  ignoreTooltip: PropTypes.bool,
@@ -1190,6 +1215,11 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
1190
1215
  disableTicks: PropTypes.bool,
1191
1216
  domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
1192
1217
  fill: PropTypes.string,
1218
+ groups: PropTypes.arrayOf(PropTypes.shape({
1219
+ getValue: PropTypes.func.isRequired,
1220
+ tickLabelStyle: PropTypes.object,
1221
+ tickSize: PropTypes.number
1222
+ })),
1193
1223
  hideTooltip: PropTypes.bool,
1194
1224
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
1195
1225
  ignoreTooltip: PropTypes.bool,
@@ -30,10 +30,10 @@ function ChartsAxisHighlight(props) {
30
30
  } = props;
31
31
  const classes = useUtilityClasses();
32
32
  return /*#__PURE__*/_jsxs(React.Fragment, {
33
- children: [xAxisHighlight && /*#__PURE__*/_jsx(ChartsXHighlight, {
33
+ children: [xAxisHighlight && xAxisHighlight !== 'none' && /*#__PURE__*/_jsx(ChartsXHighlight, {
34
34
  type: xAxisHighlight,
35
35
  classes: classes
36
- }), yAxisHighlight && /*#__PURE__*/_jsx(ChartsYHighlight, {
36
+ }), yAxisHighlight && yAxisHighlight !== 'none' && /*#__PURE__*/_jsx(ChartsYHighlight, {
37
37
  type: yAxisHighlight,
38
38
  classes: classes
39
39
  })]
@@ -43,9 +43,7 @@ export default function ChartsXHighlight(props) {
43
43
  }
44
44
  }
45
45
  return /*#__PURE__*/_jsxs(React.Fragment, {
46
- children: [isBandScaleX && xScale(value) !== undefined && /*#__PURE__*/_jsx(ChartsAxisHighlightPath
47
- // @ts-expect-error, xScale value is checked in the statement above
48
- , {
46
+ children: [isBandScaleX && xScale(value) !== undefined && /*#__PURE__*/_jsx(ChartsAxisHighlightPath, {
49
47
  d: `M ${xScale(value) - (xScale.step() - xScale.bandwidth()) / 2} ${top} l ${xScale.step()} 0 l 0 ${height} l ${-xScale.step()} 0 Z`,
50
48
  className: classes.root,
51
49
  ownerState: {
@@ -44,9 +44,7 @@ export default function ChartsYHighlight(props) {
44
44
  }
45
45
  return /*#__PURE__*/_jsxs(React.Fragment, {
46
46
  children: [isBandScaleY && yScale(value) !== undefined && /*#__PURE__*/_jsx(ChartsAxisHighlightPath, {
47
- d: `M ${left} ${
48
- // @ts-expect-error, yScale value is checked in the statement above
49
- yScale(value) - (yScale.step() - yScale.bandwidth()) / 2} l 0 ${yScale.step()} l ${width} 0 l 0 ${-yScale.step()} Z`,
47
+ d: `M ${left} ${yScale(value) - (yScale.step() - yScale.bandwidth()) / 2} l 0 ${yScale.step()} l ${width} 0 l 0 ${-yScale.step()} Z`,
50
48
  className: classes.root,
51
49
  ownerState: {
52
50
  axisHighlight: 'band'
@@ -13,4 +13,4 @@ export interface ChartsLabelGradientClasses {
13
13
  }
14
14
  export declare function getLabelGradientUtilityClass(slot: string): string;
15
15
  export declare const labelGradientClasses: ChartsLabelGradientClasses;
16
- export declare const useUtilityClasses: (props: ChartsLabelGradientProps) => Record<"root" | "mask" | "fill", string>;
16
+ export declare const useUtilityClasses: (props: ChartsLabelGradientProps) => Record<"root" | "fill" | "mask", string>;
@@ -15,4 +15,4 @@ export interface ChartsLabelMarkClasses {
15
15
  }
16
16
  export declare function getLabelMarkUtilityClass(slot: string): string;
17
17
  export declare const labelMarkClasses: ChartsLabelMarkClasses;
18
- export declare const useUtilityClasses: (props: ChartsLabelMarkProps) => Record<"root" | "mask" | "fill", string>;
18
+ export declare const useUtilityClasses: (props: ChartsLabelMarkProps) => Record<"root" | "fill" | "mask", string>;
@@ -8,7 +8,7 @@ export type ChartsXReferenceLineProps<TValue extends string | number | Date = st
8
8
  */
9
9
  x: TValue;
10
10
  };
11
- export declare function getXReferenceLineClasses(classes?: Partial<ChartsReferenceLineClasses>): Record<"root" | "line" | "label", string>;
11
+ export declare function getXReferenceLineClasses(classes?: Partial<ChartsReferenceLineClasses>): Record<"line" | "root" | "label", string>;
12
12
  declare function ChartsXReferenceLine(props: ChartsXReferenceLineProps): React.JSX.Element | null;
13
13
  declare namespace ChartsXReferenceLine {
14
14
  var propTypes: any;
@@ -8,7 +8,7 @@ export type ChartsYReferenceLineProps<TValue extends string | number | Date = st
8
8
  */
9
9
  y: TValue;
10
10
  };
11
- export declare function getYReferenceLineClasses(classes?: Partial<ChartsReferenceLineClasses>): Record<"root" | "line" | "label", string>;
11
+ export declare function getYReferenceLineClasses(classes?: Partial<ChartsReferenceLineClasses>): Record<"line" | "root" | "label", string>;
12
12
  declare function ChartsYReferenceLine(props: ChartsYReferenceLineProps): React.JSX.Element | null;
13
13
  declare namespace ChartsYReferenceLine {
14
14
  var propTypes: any;
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { ChartsTooltipContainerProps } from "./ChartsTooltipContainer.js";
3
- export interface ChartsTooltipProps extends Omit<ChartsTooltipContainerProps, 'children'> {}
3
+ import { TriggerOptions } from "./utils.js";
4
+ export interface ChartsTooltipProps<T extends TriggerOptions = TriggerOptions> extends Omit<ChartsTooltipContainerProps<T>, 'children'> {}
4
5
  /**
5
6
  * Demos:
6
7
  *
@@ -189,9 +189,9 @@ process.env.NODE_ENV !== "production" ? ChartsTooltip.propTypes = {
189
189
  transition: PropTypes.bool,
190
190
  /**
191
191
  * Select the kind of tooltip to display
192
- * - 'item': Shows data about the item below the mouse.
193
- * - 'axis': Shows values associated with the hovered x value
194
- * - 'none': Does not display tooltip
192
+ * - 'item': Shows data about the item below the mouse;
193
+ * - 'axis': Shows values associated with the hovered x value;
194
+ * - 'none': Does not display tooltip.
195
195
  * @default 'axis'
196
196
  */
197
197
  trigger: PropTypes.oneOf(['axis', 'item', 'none'])
@@ -2,15 +2,15 @@ import * as React from 'react';
2
2
  import { PopperProps } from '@mui/material/Popper';
3
3
  import { TriggerOptions } from "./utils.js";
4
4
  import { ChartsTooltipClasses } from "./chartsTooltipClasses.js";
5
- export interface ChartsTooltipContainerProps extends Partial<PopperProps> {
5
+ export interface ChartsTooltipContainerProps<T extends TriggerOptions = TriggerOptions> extends Partial<PopperProps> {
6
6
  /**
7
7
  * Select the kind of tooltip to display
8
- * - 'item': Shows data about the item below the mouse.
9
- * - 'axis': Shows values associated with the hovered x value
10
- * - 'none': Does not display tooltip
8
+ * - 'item': Shows data about the item below the mouse;
9
+ * - 'axis': Shows values associated with the hovered x value;
10
+ * - 'none': Does not display tooltip.
11
11
  * @default 'axis'
12
12
  */
13
- trigger?: TriggerOptions;
13
+ trigger?: T;
14
14
  /**
15
15
  * Override or extend the styles applied to the component.
16
16
  */
@@ -117,8 +117,14 @@ function ChartsTooltipContainer(inProps) {
117
117
  options: {
118
118
  fallbackPlacements: ['top-end', 'top-start', 'bottom-end', 'bottom']
119
119
  }
120
- }] : []) // Keep default behavior
121
- ], [isMouse, isTouch]);
120
+ }] : []),
121
+ // Keep default behavior
122
+ {
123
+ name: 'preventOverflow',
124
+ options: {
125
+ altAxis: true
126
+ }
127
+ }], [isMouse, isTouch]);
122
128
  if (trigger === 'none') {
123
129
  return null;
124
130
  }
@@ -295,9 +301,9 @@ process.env.NODE_ENV !== "production" ? ChartsTooltipContainer.propTypes = {
295
301
  transition: PropTypes.bool,
296
302
  /**
297
303
  * Select the kind of tooltip to display
298
- * - 'item': Shows data about the item below the mouse.
299
- * - 'axis': Shows values associated with the hovered x value
300
- * - 'none': Does not display tooltip
304
+ * - 'item': Shows data about the item below the mouse;
305
+ * - 'axis': Shows values associated with the hovered x value;
306
+ * - 'none': Does not display tooltip.
301
307
  * @default 'axis'
302
308
  */
303
309
  trigger: PropTypes.oneOf(['axis', 'item', 'none'])
@@ -13,6 +13,6 @@ export declare const ChartsTooltipRow: import("@emotion/styled").StyledComponent
13
13
  /**
14
14
  * @ignore - internal component.
15
15
  */
16
- export declare const ChartsTooltipCell: import("@emotion/styled").StyledComponent<Pick<import("@mui/material/Typography").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "p" | "style" | "typography" | "zIndex" | "classes" | "border" | "boxShadow" | "fontWeight" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "className" | "children" | "sx" | "align" | "variant" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping">, "p" | "slot" | "style" | "title" | "ref" | "typography" | "zIndex" | "classes" | "border" | "boxShadow" | "fontWeight" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "color" | "columnGap" | "content" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "translate" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "hidden" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onToggle" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture" | "sx" | "align" | "variant" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
16
+ export declare const ChartsTooltipCell: import("@emotion/styled").StyledComponent<Pick<import("@mui/material/Typography").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "p" | "style" | "typography" | "zIndex" | "classes" | "color" | "className" | "sx" | "border" | "boxShadow" | "fontWeight" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "children" | "align" | "variant" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping">, "p" | "slot" | "style" | "title" | "ref" | "typography" | "zIndex" | "classes" | "color" | "className" | "sx" | "border" | "boxShadow" | "fontWeight" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "content" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "translate" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "hidden" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onToggle" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture" | "align" | "variant" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
17
17
  component?: React.ElementType;
18
18
  }, {}, {}>;
@@ -78,6 +78,7 @@ export const ChartsTooltipCell = styled(Typography, {
78
78
  paddingRight: theme.spacing(1)
79
79
  },
80
80
  [`&.${chartsTooltipClasses.labelCell}`]: {
81
+ whiteSpace: 'nowrap',
81
82
  fontWeight: theme.typography.fontWeightRegular
82
83
  },
83
84
  [`&.${chartsTooltipClasses.valueCell}, &.${chartsTooltipClasses.axisValueCell}`]: {
@@ -23,4 +23,4 @@ export interface ChartsTooltipClasses {
23
23
  export type ChartsTooltipClassKey = keyof Omit<ChartsTooltipClasses, 'markContainer' | 'labelCell' | 'valueCell'>;
24
24
  export declare function getChartsTooltipUtilityClass(slot: string): string;
25
25
  export declare const chartsTooltipClasses: ChartsTooltipClasses;
26
- export declare const useUtilityClasses: (classes?: Partial<ChartsTooltipClasses>) => Record<"root" | "mark" | "table" | "cell" | "row" | "markContainer" | "labelCell" | "valueCell" | "paper" | "axisValueCell", string>;
26
+ export declare const useUtilityClasses: (classes?: Partial<ChartsTooltipClasses>) => Record<"root" | "mark" | "table" | "cell" | "row" | "paper" | "markContainer" | "labelCell" | "valueCell" | "axisValueCell", string>;
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import { ChartsXAxisProps } from "../models/axis.js";
3
+ /**
4
+ * @ignore - internal component.
5
+ */
6
+ declare function ChartsGroupedXAxis(inProps: ChartsXAxisProps): React.JSX.Element | null;
7
+ export { ChartsGroupedXAxis };
@@ -0,0 +1,137 @@
1
+ 'use client';
2
+
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import * as React from 'react';
5
+ import { useDrawingArea } from "../hooks/useDrawingArea.js";
6
+ import { isBandScale } from "../internals/isBandScale.js";
7
+ import { useChartContext } from "../context/ChartProvider/useChartContext.js";
8
+ import { TICK_LABEL_GAP, XAxisRoot } from "./utilities.js";
9
+ import { useTicksGrouped } from "../hooks/useTicksGrouped.js";
10
+ import { useAxisProps } from "./useAxisProps.js";
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ const DEFAULT_GROUPING_CONFIG = {
13
+ tickSize: 6
14
+ };
15
+ const getGroupingConfig = (groups, groupIndex, tickSize) => {
16
+ const config = groups[groupIndex] ?? {};
17
+ const defaultTickSize = tickSize ?? DEFAULT_GROUPING_CONFIG.tickSize;
18
+ const calculatedTickSize = defaultTickSize * groupIndex * 2 + defaultTickSize;
19
+ return _extends({}, DEFAULT_GROUPING_CONFIG, config, {
20
+ tickSize: config.tickSize ?? calculatedTickSize
21
+ });
22
+ };
23
+
24
+ /**
25
+ * @ignore - internal component.
26
+ */
27
+ function ChartsGroupedXAxis(inProps) {
28
+ const {
29
+ xScale,
30
+ defaultizedProps,
31
+ tickNumber,
32
+ positionSign,
33
+ skipAxisRendering,
34
+ classes,
35
+ Line,
36
+ Tick,
37
+ TickLabel,
38
+ Label,
39
+ axisTickLabelProps,
40
+ axisLabelProps
41
+ } = useAxisProps(inProps);
42
+ if (!isBandScale(xScale)) {
43
+ throw new Error('MUI X Charts: ChartsGroupedXAxis only supports the `band` and `point` scale types.');
44
+ }
45
+ const {
46
+ position,
47
+ disableLine,
48
+ disableTicks,
49
+ label,
50
+ tickSize,
51
+ valueFormatter,
52
+ slotProps,
53
+ tickInterval,
54
+ tickPlacement,
55
+ tickLabelPlacement,
56
+ sx,
57
+ offset,
58
+ height: axisHeight
59
+ } = defaultizedProps;
60
+ const groups = defaultizedProps.groups;
61
+ const drawingArea = useDrawingArea();
62
+ const {
63
+ left,
64
+ top,
65
+ width,
66
+ height
67
+ } = drawingArea;
68
+ const {
69
+ instance
70
+ } = useChartContext();
71
+ const labelRefPoint = {
72
+ x: left + width / 2,
73
+ y: positionSign * axisHeight
74
+ };
75
+ const xTicks = useTicksGrouped({
76
+ scale: xScale,
77
+ tickNumber,
78
+ valueFormatter,
79
+ tickInterval,
80
+ tickPlacement,
81
+ tickLabelPlacement,
82
+ direction: 'x',
83
+ groups
84
+ });
85
+
86
+ // Skip axis rendering if no data is available
87
+ // - The domain is an empty array for band/point scales.
88
+ // - The domains contains Infinity for continuous scales.
89
+ // - The position is set to 'none'.
90
+ if (skipAxisRendering) {
91
+ return null;
92
+ }
93
+ return /*#__PURE__*/_jsxs(XAxisRoot, {
94
+ transform: `translate(0, ${position === 'bottom' ? top + height + offset : top - offset})`,
95
+ className: classes.root,
96
+ sx: sx,
97
+ children: [!disableLine && /*#__PURE__*/_jsx(Line, _extends({
98
+ x1: left,
99
+ x2: left + width,
100
+ className: classes.line
101
+ }, slotProps?.axisLine)), xTicks.map((item, index) => {
102
+ const {
103
+ offset: tickOffset,
104
+ labelOffset
105
+ } = item;
106
+ const xTickLabel = labelOffset ?? 0;
107
+ const showTick = instance.isXInside(tickOffset);
108
+ const tickLabel = item.formattedValue;
109
+ const ignoreTick = item.ignoreTick ?? false;
110
+ const groupIndex = item.groupIndex ?? 0;
111
+ const groupConfig = getGroupingConfig(groups, groupIndex, tickSize);
112
+ const tickYSize = positionSign * groupConfig.tickSize;
113
+ const labelPositionY = positionSign * (groupConfig.tickSize + TICK_LABEL_GAP);
114
+ return /*#__PURE__*/_jsxs("g", {
115
+ transform: `translate(${tickOffset}, 0)`,
116
+ className: classes.tickContainer,
117
+ "data-group-index": groupIndex,
118
+ children: [!disableTicks && !ignoreTick && showTick && /*#__PURE__*/_jsx(Tick, _extends({
119
+ y2: tickYSize,
120
+ className: classes.tick
121
+ }, slotProps?.axisTick)), tickLabel !== undefined && /*#__PURE__*/_jsx(TickLabel, _extends({
122
+ x: xTickLabel,
123
+ y: labelPositionY
124
+ }, axisTickLabelProps, {
125
+ style: _extends({}, axisTickLabelProps.style, groupConfig.tickLabelStyle),
126
+ text: tickLabel
127
+ }))]
128
+ }, index);
129
+ }), label && /*#__PURE__*/_jsx("g", {
130
+ className: classes.label,
131
+ children: /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, axisLabelProps, {
132
+ text: label
133
+ }))
134
+ })]
135
+ });
136
+ }
137
+ export { ChartsGroupedXAxis };
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import { ChartsXAxisProps } from "../models/axis.js";
3
+ /**
4
+ * @ignore - internal component.
5
+ */
6
+ declare function ChartsSingleXAxis(inProps: ChartsXAxisProps): React.JSX.Element | null;
7
+ export { ChartsSingleXAxis };
@@ -0,0 +1,140 @@
1
+ 'use client';
2
+
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import * as React from 'react';
5
+ import { useIsHydrated } from "../hooks/useIsHydrated.js";
6
+ import { getStringSize } from "../internals/domUtils.js";
7
+ import { useTicks } from "../hooks/useTicks.js";
8
+ import { useMounted } from "../hooks/useMounted.js";
9
+ import { useDrawingArea } from "../hooks/useDrawingArea.js";
10
+ import { useChartContext } from "../context/ChartProvider/useChartContext.js";
11
+ import { shortenLabels } from "./shortenLabels.js";
12
+ import { getVisibleLabels } from "./getVisibleLabels.js";
13
+ import { AXIS_LABEL_TICK_LABEL_GAP, TICK_LABEL_GAP, XAxisRoot } from "./utilities.js";
14
+ import { useAxisProps } from "./useAxisProps.js";
15
+
16
+ /**
17
+ * @ignore - internal component.
18
+ */
19
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
+ function ChartsSingleXAxis(inProps) {
21
+ const {
22
+ xScale,
23
+ defaultizedProps,
24
+ tickNumber,
25
+ positionSign,
26
+ skipAxisRendering,
27
+ classes,
28
+ Line,
29
+ Tick,
30
+ TickLabel,
31
+ Label,
32
+ axisTickLabelProps,
33
+ axisLabelProps,
34
+ reverse,
35
+ isRtl
36
+ } = useAxisProps(inProps);
37
+ const isMounted = useMounted();
38
+ const {
39
+ position,
40
+ disableLine,
41
+ disableTicks,
42
+ label,
43
+ tickSize: tickSizeProp,
44
+ valueFormatter,
45
+ slotProps,
46
+ tickInterval,
47
+ tickLabelInterval,
48
+ tickPlacement,
49
+ tickLabelPlacement,
50
+ tickLabelMinGap,
51
+ sx,
52
+ offset,
53
+ height: axisHeight
54
+ } = defaultizedProps;
55
+ const drawingArea = useDrawingArea();
56
+ const {
57
+ left,
58
+ top,
59
+ width,
60
+ height
61
+ } = drawingArea;
62
+ const {
63
+ instance
64
+ } = useChartContext();
65
+ const isHydrated = useIsHydrated();
66
+ const tickSize = disableTicks ? 4 : tickSizeProp;
67
+ const xTicks = useTicks({
68
+ scale: xScale,
69
+ tickNumber,
70
+ valueFormatter,
71
+ tickInterval,
72
+ tickPlacement,
73
+ tickLabelPlacement,
74
+ direction: 'x'
75
+ });
76
+ const visibleLabels = getVisibleLabels(xTicks, {
77
+ tickLabelStyle: axisTickLabelProps.style,
78
+ tickLabelInterval,
79
+ tickLabelMinGap,
80
+ reverse,
81
+ isMounted,
82
+ isXInside: instance.isXInside
83
+ });
84
+
85
+ // Skip axis rendering if no data is available
86
+ // - The domain is an empty array for band/point scales.
87
+ // - The domains contains Infinity for continuous scales.
88
+ // - The position is set to 'none'.
89
+ if (skipAxisRendering) {
90
+ return null;
91
+ }
92
+ const labelHeight = label ? getStringSize(label, axisLabelProps.style).height : 0;
93
+ const labelRefPoint = {
94
+ x: left + width / 2,
95
+ y: positionSign * axisHeight
96
+ };
97
+
98
+ /* If there's an axis title, the tick labels have less space to render */
99
+ const tickLabelsMaxHeight = Math.max(0, axisHeight - (label ? labelHeight + AXIS_LABEL_TICK_LABEL_GAP : 0) - tickSize - TICK_LABEL_GAP);
100
+ const tickLabels = isHydrated ? shortenLabels(visibleLabels, drawingArea, tickLabelsMaxHeight, isRtl, axisTickLabelProps.style) : new Map(Array.from(visibleLabels).map(item => [item, item.formattedValue]));
101
+ return /*#__PURE__*/_jsxs(XAxisRoot, {
102
+ transform: `translate(0, ${position === 'bottom' ? top + height + offset : top - offset})`,
103
+ className: classes.root,
104
+ sx: sx,
105
+ children: [!disableLine && /*#__PURE__*/_jsx(Line, _extends({
106
+ x1: left,
107
+ x2: left + width,
108
+ className: classes.line
109
+ }, slotProps?.axisLine)), xTicks.map((item, index) => {
110
+ const {
111
+ offset: tickOffset,
112
+ labelOffset
113
+ } = item;
114
+ const xTickLabel = labelOffset ?? 0;
115
+ const yTickLabel = positionSign * (tickSize + TICK_LABEL_GAP);
116
+ const showTick = instance.isXInside(tickOffset);
117
+ const tickLabel = tickLabels.get(item);
118
+ const showTickLabel = visibleLabels.has(item);
119
+ return /*#__PURE__*/_jsxs("g", {
120
+ transform: `translate(${tickOffset}, 0)`,
121
+ className: classes.tickContainer,
122
+ children: [!disableTicks && showTick && /*#__PURE__*/_jsx(Tick, _extends({
123
+ y2: positionSign * tickSize,
124
+ className: classes.tick
125
+ }, slotProps?.axisTick)), tickLabel !== undefined && showTickLabel && /*#__PURE__*/_jsx(TickLabel, _extends({
126
+ x: xTickLabel,
127
+ y: yTickLabel
128
+ }, axisTickLabelProps, {
129
+ text: tickLabel
130
+ }))]
131
+ }, index);
132
+ }), label && /*#__PURE__*/_jsx("g", {
133
+ className: classes.label,
134
+ children: /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, axisLabelProps, {
135
+ text: label
136
+ }))
137
+ })]
138
+ });
139
+ }
140
+ export { ChartsSingleXAxis };
@@ -9,7 +9,7 @@ import { ChartsXAxisProps } from "../models/axis.js";
9
9
  *
10
10
  * - [ChartsXAxis API](https://mui.com/x/api/charts/charts-x-axis/)
11
11
  */
12
- declare function ChartsXAxis(inProps: ChartsXAxisProps): React.JSX.Element | null;
12
+ declare function ChartsXAxis(inProps: ChartsXAxisProps): React.JSX.Element;
13
13
  declare namespace ChartsXAxis {
14
14
  var propTypes: any;
15
15
  }