@mui/x-charts 8.5.0 → 8.5.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 (110) hide show
  1. package/BarChart/BarChart.js +2 -3
  2. package/BarChart/BarLabel/BarLabel.d.ts +1 -1
  3. package/BarChart/seriesConfig/seriesProcessor.js +1 -1
  4. package/CHANGELOG.md +204 -0
  5. package/ChartsAxisHighlight/ChartsAxisHighlightPath.d.ts +1 -1
  6. package/ChartsGrid/ChartsHorizontalGrid.js +1 -1
  7. package/ChartsGrid/ChartsVerticalGrid.js +1 -1
  8. package/ChartsGrid/styledComponents.d.ts +2 -2
  9. package/ChartsReferenceLine/common.d.ts +1 -1
  10. package/ChartsTooltip/ChartsTooltip.js +1 -1
  11. package/ChartsTooltip/ChartsTooltipContainer.js +21 -16
  12. package/ChartsTooltip/ChartsTooltipTable.d.ts +4 -4
  13. package/ChartsTooltip/utils.d.ts +6 -0
  14. package/ChartsTooltip/utils.js +19 -1
  15. package/LineChart/LineChart.js +2 -3
  16. package/PieChart/PieChart.js +4 -11
  17. package/RadarChart/RadarChart.js +2 -3
  18. package/RadarChart/index.d.ts +1 -1
  19. package/ScatterChart/ScatterChart.js +2 -3
  20. package/Toolbar/Toolbar.d.ts +9 -8
  21. package/Toolbar/Toolbar.js +24 -8
  22. package/Toolbar/Toolbar.types.d.ts +1 -1
  23. package/Toolbar/ToolbarButton.js +18 -4
  24. package/esm/BarChart/BarChart.js +2 -3
  25. package/esm/BarChart/BarLabel/BarLabel.d.ts +1 -1
  26. package/esm/BarChart/seriesConfig/seriesProcessor.js +1 -1
  27. package/esm/ChartsAxisHighlight/ChartsAxisHighlightPath.d.ts +1 -1
  28. package/esm/ChartsGrid/ChartsHorizontalGrid.js +1 -1
  29. package/esm/ChartsGrid/ChartsVerticalGrid.js +1 -1
  30. package/esm/ChartsGrid/styledComponents.d.ts +2 -2
  31. package/esm/ChartsReferenceLine/common.d.ts +1 -1
  32. package/esm/ChartsTooltip/ChartsTooltip.js +1 -1
  33. package/esm/ChartsTooltip/ChartsTooltipContainer.js +22 -17
  34. package/esm/ChartsTooltip/ChartsTooltipTable.d.ts +4 -4
  35. package/esm/ChartsTooltip/utils.d.ts +6 -0
  36. package/esm/ChartsTooltip/utils.js +16 -1
  37. package/esm/LineChart/LineChart.js +2 -3
  38. package/esm/PieChart/PieChart.js +4 -11
  39. package/esm/RadarChart/RadarChart.js +2 -3
  40. package/esm/RadarChart/index.d.ts +1 -1
  41. package/esm/ScatterChart/ScatterChart.js +2 -3
  42. package/esm/Toolbar/Toolbar.d.ts +9 -8
  43. package/esm/Toolbar/Toolbar.js +23 -7
  44. package/esm/Toolbar/Toolbar.types.d.ts +1 -1
  45. package/esm/Toolbar/ToolbarButton.js +19 -4
  46. package/esm/index.js +1 -1
  47. package/esm/internals/components/AxisSharedComponents.d.ts +1 -1
  48. package/esm/internals/components/ChartsWrapper/ChartsWrapper.d.ts +5 -0
  49. package/esm/internals/components/ChartsWrapper/ChartsWrapper.js +22 -3
  50. package/esm/internals/constants.d.ts +8 -1
  51. package/esm/internals/constants.js +9 -1
  52. package/esm/internals/defaultValueFormatters.d.ts +6 -0
  53. package/esm/internals/defaultValueFormatters.js +15 -0
  54. package/esm/internals/index.d.ts +7 -0
  55. package/esm/internals/index.js +7 -0
  56. package/esm/internals/invertScale.d.ts +2 -0
  57. package/esm/internals/invertScale.js +8 -0
  58. package/esm/internals/material/index.js +2 -0
  59. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +3 -1
  60. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +2917 -0
  61. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +1 -0
  62. package/esm/internals/plugins/models/seriesConfig/colorProcessor.types.d.ts +5 -0
  63. package/esm/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +3 -2
  64. package/esm/internals/store/useSelector.js +3 -1
  65. package/esm/locales/index.d.ts +3 -1
  66. package/esm/locales/index.js +2 -0
  67. package/esm/locales/ptBR.d.ts +16 -0
  68. package/esm/locales/ptBR.js +9 -0
  69. package/esm/locales/ptPT.d.ts +16 -0
  70. package/esm/locales/ptPT.js +9 -0
  71. package/esm/models/axis.d.ts +3 -1
  72. package/esm/models/index.d.ts +1 -1
  73. package/esm/models/seriesType/bar.d.ts +2 -2
  74. package/esm/models/slots/chartsBaseSlotProps.d.ts +6 -0
  75. package/esm/models/slots/chartsBaseSlots.d.ts +2 -1
  76. package/index.js +1 -1
  77. package/internals/components/AxisSharedComponents.d.ts +1 -1
  78. package/internals/components/ChartsWrapper/ChartsWrapper.d.ts +5 -0
  79. package/internals/components/ChartsWrapper/ChartsWrapper.js +22 -3
  80. package/internals/constants.d.ts +8 -1
  81. package/internals/constants.js +10 -2
  82. package/internals/defaultValueFormatters.d.ts +6 -0
  83. package/internals/defaultValueFormatters.js +21 -0
  84. package/internals/index.d.ts +7 -0
  85. package/internals/index.js +76 -0
  86. package/internals/invertScale.d.ts +2 -0
  87. package/internals/invertScale.js +14 -0
  88. package/internals/material/index.js +2 -0
  89. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +3 -1
  90. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +2917 -0
  91. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +2 -1
  92. package/internals/plugins/models/seriesConfig/colorProcessor.types.d.ts +5 -0
  93. package/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +3 -2
  94. package/internals/store/useSelector.js +4 -1
  95. package/locales/index.d.ts +3 -1
  96. package/locales/index.js +22 -0
  97. package/locales/ptBR.d.ts +16 -0
  98. package/locales/ptBR.js +15 -0
  99. package/locales/ptPT.d.ts +16 -0
  100. package/locales/ptPT.js +15 -0
  101. package/models/axis.d.ts +3 -1
  102. package/models/index.d.ts +1 -1
  103. package/models/seriesType/bar.d.ts +2 -2
  104. package/models/slots/chartsBaseSlotProps.d.ts +6 -0
  105. package/models/slots/chartsBaseSlots.d.ts +2 -1
  106. package/package.json +5 -5
  107. package/Toolbar/internals/ChartsToolbar.d.ts +0 -6
  108. package/Toolbar/internals/ChartsToolbar.js +0 -14
  109. package/esm/Toolbar/internals/ChartsToolbar.d.ts +0 -6
  110. package/esm/Toolbar/internals/ChartsToolbar.js +0 -8
@@ -88,6 +88,7 @@ export const selectorChartYAxis = createSelector([selectorChartRawYAxis, selecto
88
88
  zoomOptions,
89
89
  getFilters
90
90
  }));
91
+ export const selectorChartAxis = createSelector([selectorChartXAxis, selectorChartYAxis, (_, axisId) => axisId], (xAxes, yAxes, axisId) => xAxes?.axis[axisId] ?? yAxes?.axis[axisId]);
91
92
  export const selectorChartRawAxis = createSelector([selectorChartRawXAxis, selectorChartRawYAxis, (state, axisId) => axisId], (xAxes, yAxes, axisId) => {
92
93
  const axis = xAxes?.find(a => a.id === axisId) ?? yAxes?.find(a => a.id === axisId) ?? null;
93
94
  if (!axis) {
@@ -10,5 +10,10 @@ export type ColorGetter<TSeriesType extends ChartSeriesType> = TSeriesType exten
10
10
  /**
11
11
  * Transforms charts config to a color getter.
12
12
  * If dataIndex is not defined, it falls back to the series color.
13
+ * @param {DefaultizedSeriesType<TSeriesType>} series - The series configuration.
14
+ * @param {ComputedXAxis | undefined} xAxis - The computed x-axis configuration.
15
+ * @param {ComputedYAxis | undefined} yAxis - The computed y-axis configuration.
16
+ * @param {ZAxisDefaultized | undefined} zAxis - The defaulted z-axis configuration.
17
+ * @returns {ColorGetter<TSeriesType>} A function that takes a data index and returns a color string.
13
18
  */
14
19
  export type ColorProcessor<TSeriesType extends ChartSeriesType> = (series: DefaultizedSeriesType<TSeriesType>, xAxis?: ComputedXAxis, yAxis?: ComputedYAxis, zAxis?: ZAxisDefaultized) => ColorGetter<TSeriesType>;
@@ -62,9 +62,10 @@ export type TooltipGetter<TSeriesType extends ChartSeriesType> = (params: {
62
62
  identifier: ChartItemIdentifier<TSeriesType> | null;
63
63
  }) => (TSeriesType extends 'radar' ? ItemTooltipWithMultipleValues<TSeriesType> : ItemTooltip<TSeriesType>) | null;
64
64
  /**
65
- * Return an array of the axes that should trigger the tooltip.
66
- *
67
65
  * If `axisId` is set to undefined, the default axis will be used.
66
+ *
67
+ * @param {Record<SeriesId, ChartSeriesDefaultized<TSeriesType>>} series A map of series ID to their series configuration.
68
+ * @returns {{ direction: Directions; axisId: AxisId | undefined }[]} an array of the axes that should trigger the tooltip.
68
69
  */
69
70
  export type AxisTooltipGetter<TSeriesType extends ChartSeriesType, Directions extends 'x' | 'y' | 'rotation' | 'radius' = 'x' | 'y'> = (series: Record<SeriesId, ChartSeriesDefaultized<TSeriesType>>) => {
70
71
  direction: Directions;
@@ -1,4 +1,6 @@
1
- import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector';
1
+ /* We need to import the shim because React 17 does not support the `useSyncExternalStore` API.
2
+ * More info: https://github.com/mui/mui-x/issues/18303#issuecomment-2958392341 */
3
+ import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector';
2
4
  const defaultCompare = Object.is;
3
5
  export const useSelector = (store, selector, args = undefined, equals = defaultCompare) => {
4
6
  const selectorWithArgs = state => selector(state, args);
@@ -1,3 +1,5 @@
1
1
  export type { ChartsLocaleText } from "./utils/chartsLocaleTextApi.js";
2
2
  export * from "./enUS.js";
3
- export * from "./frFR.js";
3
+ export * from "./frFR.js";
4
+ export * from "./ptBR.js";
5
+ export * from "./ptPT.js";
@@ -1,3 +1,5 @@
1
1
  export * from "./enUS.js";
2
2
  export * from "./frFR.js";
3
+ export * from "./ptBR.js";
4
+ export * from "./ptPT.js";
3
5
  export {};
@@ -0,0 +1,16 @@
1
+ import { ChartsLocaleText } from "./utils/chartsLocaleTextApi.js";
2
+ export declare const ptBRLocaleText: Partial<ChartsLocaleText>;
3
+ export declare const ptBR: {
4
+ components: {
5
+ MuiChartsLocalizationProvider: {
6
+ defaultProps: {
7
+ localeText: {
8
+ loading?: string | undefined;
9
+ noData?: string | undefined;
10
+ zoomIn?: string | undefined;
11
+ zoomOut?: string | undefined;
12
+ };
13
+ };
14
+ };
15
+ };
16
+ };
@@ -0,0 +1,9 @@
1
+ import { getChartsLocalization } from "./utils/getChartsLocalization.js";
2
+ export const ptBRLocaleText = {
3
+ // Overlay
4
+ loading: 'Carregando dados…',
5
+ noData: 'Sem dados para exibir',
6
+ zoomIn: 'Aumentar zoom',
7
+ zoomOut: 'Diminuir zoom'
8
+ };
9
+ export const ptBR = getChartsLocalization(ptBRLocaleText);
@@ -0,0 +1,16 @@
1
+ import { ChartsLocaleText } from "./utils/chartsLocaleTextApi.js";
2
+ export declare const ptPTLocaleText: Partial<ChartsLocaleText>;
3
+ export declare const ptPT: {
4
+ components: {
5
+ MuiChartsLocalizationProvider: {
6
+ defaultProps: {
7
+ localeText: {
8
+ loading?: string | undefined;
9
+ noData?: string | undefined;
10
+ zoomIn?: string | undefined;
11
+ zoomOut?: string | undefined;
12
+ };
13
+ };
14
+ };
15
+ };
16
+ };
@@ -0,0 +1,9 @@
1
+ import { getChartsLocalization } from "./utils/getChartsLocalization.js";
2
+ export const ptPTLocaleText = {
3
+ // Overlay
4
+ loading: 'Carregando dados…',
5
+ noData: 'Sem dados para mostrar',
6
+ zoomIn: 'Aumentar zoom',
7
+ zoomOut: 'Diminuir zoom'
8
+ };
9
+ export const ptPT = getChartsLocalization(ptPTLocaleText);
@@ -270,6 +270,7 @@ export type AxisValueFormatterContext<S extends ScaleName = ScaleName> = {
270
270
  * - `'tick'` The value is displayed on the axis ticks.
271
271
  * - `'tooltip'` The value is displayed in the tooltip when hovering the chart.
272
272
  * - `'legend'` The value is displayed in the legend when using color legend.
273
+ * - `'zoom-slider-tooltip'` The value is displayed in the zoom slider tooltip.
273
274
  */
274
275
  location: 'legend';
275
276
  } | {
@@ -278,8 +279,9 @@ export type AxisValueFormatterContext<S extends ScaleName = ScaleName> = {
278
279
  * - `'tick'` The value is displayed on the axis ticks.
279
280
  * - `'tooltip'` The value is displayed in the tooltip when hovering the chart.
280
281
  * - `'legend'` The value is displayed in the legend when using color legend.
282
+ * - `'zoom-slider-tooltip'` The value is displayed in the zoom slider tooltip.
281
283
  */
282
- location: 'tick' | 'tooltip';
284
+ location: 'tick' | 'tooltip' | 'zoom-slider-tooltip';
283
285
  /**
284
286
  * The d3-scale instance associated to the axis.
285
287
  */
@@ -1,7 +1,7 @@
1
1
  export * from "./seriesType/index.js";
2
2
  export * from "./stacking.js";
3
3
  export * from "./slots/index.js";
4
- export type { AxisConfig, ChartsYAxisProps, ChartsXAxisProps, ScaleName, ContinuousScaleName, ChartsAxisData, XAxis, YAxis, RadiusAxis, RotationAxis } from "./axis.js";
4
+ export type { AxisConfig, ChartsYAxisProps, ChartsXAxisProps, ScaleName, ContinuousScaleName, ChartsAxisData, XAxis, YAxis, RadiusAxis, RotationAxis, AxisValueFormatterContext } from "./axis.js";
5
5
  export type { PropsFromSlot } from '@mui/x-internals/slots';
6
6
  export type { Position } from "./position.js";
7
7
  export type { CurveType } from "./curve.js";
@@ -1,6 +1,6 @@
1
1
  import { DefaultizedProps } from '@mui/x-internals/types';
2
2
  import type { StackOffsetType } from "../stacking.js";
3
- import { CartesianSeriesType, CommonSeriesType, CommonDefaultizedProps, StackableSeriesType } from "./common.js";
3
+ import { CartesianSeriesType, CommonSeriesType, CommonDefaultizedProps, StackableSeriesType, SeriesId } from "./common.js";
4
4
  export interface BarSeriesType extends CommonSeriesType<number | null>, CartesianSeriesType, StackableSeriesType {
5
5
  type: 'bar';
6
6
  /**
@@ -32,7 +32,7 @@ export interface BarSeriesType extends CommonSeriesType<number | null>, Cartesia
32
32
  */
33
33
  export type BarItemIdentifier = {
34
34
  type: 'bar';
35
- seriesId: DefaultizedBarSeriesType['id'];
35
+ seriesId: SeriesId;
36
36
  dataIndex: number;
37
37
  };
38
38
  export interface DefaultizedBarSeriesType extends DefaultizedProps<BarSeriesType, CommonDefaultizedProps | 'color' | 'layout'> {}
@@ -8,7 +8,13 @@ export type ChartBaseCommonProps<T = HTMLElement> = React.DOMAttributes<T> & {
8
8
  export type ChartBaseIconProps = ChartBaseCommonProps<SVGSVGElement> & {
9
9
  titleAccess?: string;
10
10
  };
11
+ export type ChartBaseButtonProps = ChartBaseCommonProps & {
12
+ ref?: React.Ref<HTMLButtonElement>;
13
+ disabled?: boolean;
14
+ tabIndex?: number;
15
+ };
11
16
  export type ChartBaseIconButtonProps = ChartBaseCommonProps & {
12
17
  ref?: React.Ref<HTMLButtonElement>;
13
18
  disabled?: boolean;
19
+ tabIndex?: number;
14
20
  };
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
- import { ChartBaseIconButtonProps } from "./chartsBaseSlotProps.js";
2
+ import { ChartBaseButtonProps, ChartBaseIconButtonProps } from "./chartsBaseSlotProps.js";
3
3
  export interface ChartsBaseSlots {
4
+ baseButton: React.ComponentType<ChartBaseButtonProps>;
4
5
  baseIconButton: React.ComponentType<ChartBaseIconButtonProps>;
5
6
  }
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v8.5.0
2
+ * @mui/x-charts v8.5.2
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1 +1 @@
1
- export declare const AxisRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, Pick<import("react").SVGProps<SVGGElement>, keyof import("react").SVGProps<SVGGElement>>, {}>;
1
+ export declare const AxisRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").SVGProps<SVGGElement>, keyof import("react").SVGProps<SVGGElement>>, {}>;
@@ -5,6 +5,11 @@ import { Position } from "../../../models/index.js";
5
5
  export interface ChartsWrapperProps {
6
6
  legendPosition?: Position;
7
7
  legendDirection?: Direction;
8
+ /**
9
+ * If `true`, the chart wrapper set `height: 100%`.
10
+ * @default `false` if the `height` prop is set. And `true` otherwise.
11
+ */
12
+ extendVertically?: boolean;
8
13
  children: React.ReactNode;
9
14
  sx?: SxProps<Theme>;
10
15
  }
@@ -7,7 +7,11 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.ChartsWrapper = ChartsWrapper;
8
8
  var React = _interopRequireWildcard(require("react"));
9
9
  var _styles = require("@mui/material/styles");
10
+ var _createStyled = require("@mui/system/createStyled");
10
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");
11
15
  var _jsxRuntime = require("react/jsx-runtime");
12
16
  const getDirection = (direction, position) => {
13
17
  if (direction === 'vertical') {
@@ -42,7 +46,8 @@ const getAlign = (direction, position) => {
42
46
  };
43
47
  const Root = (0, _styles.styled)('div', {
44
48
  name: 'MuiChartsWrapper',
45
- slot: 'Root'
49
+ slot: 'Root',
50
+ shouldForwardProp: prop => (0, _createStyled.shouldForwardProp)(prop) && prop !== 'extendVertically'
46
51
  })(({
47
52
  ownerState
48
53
  }) => ({
@@ -50,7 +55,15 @@ const Root = (0, _styles.styled)('div', {
50
55
  flexDirection: getDirection(ownerState.legendDirection, ownerState.legendPosition),
51
56
  flex: 1,
52
57
  justifyContent: 'center',
53
- alignItems: getAlign(ownerState.legendDirection, ownerState.legendPosition)
58
+ alignItems: getAlign(ownerState.legendDirection, ownerState.legendPosition),
59
+ variants: [{
60
+ props: {
61
+ extendVertically: true
62
+ },
63
+ style: {
64
+ height: '100%'
65
+ }
66
+ }]
54
67
  }));
55
68
 
56
69
  /**
@@ -62,13 +75,19 @@ const Root = (0, _styles.styled)('div', {
62
75
  function ChartsWrapper(props) {
63
76
  const {
64
77
  children,
65
- sx
78
+ sx,
79
+ extendVertically
66
80
  } = props;
67
81
  const chartRootRef = (0, _useChartRootRef.useChartRootRef)();
82
+ const store = (0, _useStore.useStore)();
83
+ const {
84
+ height: propsHeight
85
+ } = (0, _useSelector.useSelector)(store, _useChartDimensions.selectorChartPropsSize);
68
86
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Root, {
69
87
  ref: chartRootRef,
70
88
  ownerState: props,
71
89
  sx: sx,
90
+ extendVertically: extendVertically ?? propsHeight === undefined,
72
91
  children: children
73
92
  });
74
93
  }
@@ -3,4 +3,11 @@ import type { ZoomSliderShowTooltip } from "./plugins/featurePlugins/useChartCar
3
3
  export declare const ZOOM_SLIDER_MARGIN = 4;
4
4
  /** Size reserved for the zoom slider. The actual size of the slider might be smaller. */
5
5
  export declare const DEFAULT_ZOOM_SLIDER_SIZE: number;
6
- export declare const DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP: ZoomSliderShowTooltip;
6
+ export declare const DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP: ZoomSliderShowTooltip;
7
+ /** Default margin for pie charts. */
8
+ export declare const DEFAULT_PIE_CHART_MARGIN: {
9
+ top: number;
10
+ bottom: number;
11
+ left: number;
12
+ right: number;
13
+ };
@@ -3,10 +3,18 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.ZOOM_SLIDER_MARGIN = exports.DEFAULT_ZOOM_SLIDER_SIZE = exports.DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP = void 0;
6
+ exports.ZOOM_SLIDER_MARGIN = exports.DEFAULT_ZOOM_SLIDER_SIZE = exports.DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP = exports.DEFAULT_PIE_CHART_MARGIN = void 0;
7
7
  /** Margin in the opposite direction of the axis, i.e., horizontal if the axis is vertical and vice versa. */
8
8
  const ZOOM_SLIDER_MARGIN = exports.ZOOM_SLIDER_MARGIN = 4;
9
9
 
10
10
  /** Size reserved for the zoom slider. The actual size of the slider might be smaller. */
11
11
  const DEFAULT_ZOOM_SLIDER_SIZE = exports.DEFAULT_ZOOM_SLIDER_SIZE = 20 + 2 * ZOOM_SLIDER_MARGIN;
12
- const DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP = exports.DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP = 'hover';
12
+ const DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP = exports.DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP = 'hover';
13
+
14
+ /** Default margin for pie charts. */
15
+ const DEFAULT_PIE_CHART_MARGIN = exports.DEFAULT_PIE_CHART_MARGIN = {
16
+ top: 5,
17
+ bottom: 5,
18
+ left: 5,
19
+ right: 5
20
+ };
@@ -0,0 +1,6 @@
1
+ import { AxisValueFormatterContext, ContinuousScaleName, D3ContinuousScale } from "../models/axis.js";
2
+ /**
3
+ * Creates a default formatter function for continuous scales (e.g., linear, sqrt, log).
4
+ * @returns A formatter function for continuous values.
5
+ */
6
+ export declare function createScalarFormatter(tickNumber: number, zoomScale: D3ContinuousScale): <S extends ContinuousScaleName = ContinuousScaleName>(value: any, context: AxisValueFormatterContext<S>) => string;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createScalarFormatter = createScalarFormatter;
7
+ /**
8
+ * Creates a default formatter function for continuous scales (e.g., linear, sqrt, log).
9
+ * @returns A formatter function for continuous values.
10
+ */
11
+ function createScalarFormatter(tickNumber, zoomScale) {
12
+ return function defaultScalarValueFormatter(value, context) {
13
+ if (context.location === 'tick') {
14
+ return context.scale.tickFormat(tickNumber)(value);
15
+ }
16
+ if (context.location === 'zoom-slider-tooltip') {
17
+ return zoomScale.tickFormat(2)(value);
18
+ }
19
+ return `${value}`;
20
+ };
21
+ }
@@ -21,6 +21,8 @@ export * from "./plugins/featurePlugins/useChartInteraction/index.js";
21
21
  export * from "./plugins/featurePlugins/useChartHighlight/index.js";
22
22
  export * from "./plugins/featurePlugins/useChartVoronoi/index.js";
23
23
  export * from "./plugins/utils/selectors.js";
24
+ export { getAxisTriggerTooltip as getCartesianAxisTriggerTooltip } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.js";
25
+ export { getAxisIndex as getCartesianAxisIndex } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js";
24
26
  export * from "./store/useCharts.js";
25
27
  export * from "./store/useStore.js";
26
28
  export * from "./store/useSelector.js";
@@ -28,6 +30,7 @@ export * from "../BarChart/BarChart.plugins.js";
28
30
  export * from "../LineChart/LineChart.plugins.js";
29
31
  export * from "../ScatterChart/ScatterChart.plugins.js";
30
32
  export * from "../RadarChart/RadarChart.plugins.js";
33
+ export * from "../PieChart/PieChart.plugins.js";
31
34
  export * from "./defaultizeValueFormatter.js";
32
35
  export * from "./configInit.js";
33
36
  export * from "./getLabel.js";
@@ -39,7 +42,11 @@ export * from "./getCurve.js";
39
42
  export * from "./consumeSlots.js";
40
43
  export * from "./consumeThemeProps.js";
41
44
  export * from "./defaultizeMargin.js";
45
+ export * from "./colorScale.js";
46
+ export * from "./ticks.js";
42
47
  export * from "./dateHelpers.js";
48
+ export * from "./invertScale.js";
49
+ export * from "./isBandScale.js";
43
50
  export { getAxisExtremum } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.js";
44
51
  export * from "../context/ChartProvider/index.js";
45
52
  export * from "../context/ChartsSlotsContext.js";
@@ -11,6 +11,8 @@ var _exportNames = {
11
11
  useLineChartProps: true,
12
12
  useBarChartProps: true,
13
13
  useRadarChartProps: true,
14
+ getCartesianAxisTriggerTooltip: true,
15
+ getCartesianAxisIndex: true,
14
16
  getAxisExtremum: true
15
17
  };
16
18
  Object.defineProperty(exports, "getAxisExtremum", {
@@ -19,6 +21,18 @@ Object.defineProperty(exports, "getAxisExtremum", {
19
21
  return _getAxisExtremum.getAxisExtremum;
20
22
  }
21
23
  });
24
+ Object.defineProperty(exports, "getCartesianAxisIndex", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _getAxisValue.getAxisIndex;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "getCartesianAxisTriggerTooltip", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _getAxisTriggerTooltip.getAxisTriggerTooltip;
34
+ }
35
+ });
22
36
  Object.defineProperty(exports, "useBarChartProps", {
23
37
  enumerable: true,
24
38
  get: function () {
@@ -260,6 +274,8 @@ Object.keys(_selectors).forEach(function (key) {
260
274
  }
261
275
  });
262
276
  });
277
+ var _getAxisTriggerTooltip = require("./plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip");
278
+ var _getAxisValue = require("./plugins/featurePlugins/useChartCartesianAxis/getAxisValue");
263
279
  var _useCharts = require("./store/useCharts");
264
280
  Object.keys(_useCharts).forEach(function (key) {
265
281
  if (key === "default" || key === "__esModule") return;
@@ -344,6 +360,18 @@ Object.keys(_RadarChart).forEach(function (key) {
344
360
  }
345
361
  });
346
362
  });
363
+ var _PieChart = require("../PieChart/PieChart.plugins");
364
+ Object.keys(_PieChart).forEach(function (key) {
365
+ if (key === "default" || key === "__esModule") return;
366
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
367
+ if (key in exports && exports[key] === _PieChart[key]) return;
368
+ Object.defineProperty(exports, key, {
369
+ enumerable: true,
370
+ get: function () {
371
+ return _PieChart[key];
372
+ }
373
+ });
374
+ });
347
375
  var _defaultizeValueFormatter = require("./defaultizeValueFormatter");
348
376
  Object.keys(_defaultizeValueFormatter).forEach(function (key) {
349
377
  if (key === "default" || key === "__esModule") return;
@@ -476,6 +504,30 @@ Object.keys(_defaultizeMargin).forEach(function (key) {
476
504
  }
477
505
  });
478
506
  });
507
+ var _colorScale = require("./colorScale");
508
+ Object.keys(_colorScale).forEach(function (key) {
509
+ if (key === "default" || key === "__esModule") return;
510
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
511
+ if (key in exports && exports[key] === _colorScale[key]) return;
512
+ Object.defineProperty(exports, key, {
513
+ enumerable: true,
514
+ get: function () {
515
+ return _colorScale[key];
516
+ }
517
+ });
518
+ });
519
+ var _ticks = require("./ticks");
520
+ Object.keys(_ticks).forEach(function (key) {
521
+ if (key === "default" || key === "__esModule") return;
522
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
523
+ if (key in exports && exports[key] === _ticks[key]) return;
524
+ Object.defineProperty(exports, key, {
525
+ enumerable: true,
526
+ get: function () {
527
+ return _ticks[key];
528
+ }
529
+ });
530
+ });
479
531
  var _dateHelpers = require("./dateHelpers");
480
532
  Object.keys(_dateHelpers).forEach(function (key) {
481
533
  if (key === "default" || key === "__esModule") return;
@@ -488,6 +540,30 @@ Object.keys(_dateHelpers).forEach(function (key) {
488
540
  }
489
541
  });
490
542
  });
543
+ var _invertScale = require("./invertScale");
544
+ Object.keys(_invertScale).forEach(function (key) {
545
+ if (key === "default" || key === "__esModule") return;
546
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
547
+ if (key in exports && exports[key] === _invertScale[key]) return;
548
+ Object.defineProperty(exports, key, {
549
+ enumerable: true,
550
+ get: function () {
551
+ return _invertScale[key];
552
+ }
553
+ });
554
+ });
555
+ var _isBandScale = require("./isBandScale");
556
+ Object.keys(_isBandScale).forEach(function (key) {
557
+ if (key === "default" || key === "__esModule") return;
558
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
559
+ if (key in exports && exports[key] === _isBandScale[key]) return;
560
+ Object.defineProperty(exports, key, {
561
+ enumerable: true,
562
+ get: function () {
563
+ return _isBandScale[key];
564
+ }
565
+ });
566
+ });
491
567
  var _getAxisExtremum = require("./plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum");
492
568
  var _ChartProvider = require("../context/ChartProvider");
493
569
  Object.keys(_ChartProvider).forEach(function (key) {
@@ -0,0 +1,2 @@
1
+ import { D3Scale } from "../models/axis.js";
2
+ export declare function invertScale<T>(scale: D3Scale, data: readonly T[], value: number): number | Date | T;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.invertScale = invertScale;
7
+ var _isBandScale = require("./isBandScale");
8
+ function invertScale(scale, data, value) {
9
+ if ((0, _isBandScale.isBandScale)(scale)) {
10
+ const dataIndex = scale.bandwidth() === 0 ? Math.floor((value - Math.min(...scale.range()) + scale.step() / 2) / scale.step()) : Math.floor((value - Math.min(...scale.range())) / scale.step());
11
+ return data[dataIndex];
12
+ }
13
+ return scale.invert(value);
14
+ }
@@ -7,7 +7,9 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.defaultSlotsMaterial = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
10
+ var _Button = _interopRequireDefault(require("@mui/material/Button"));
10
11
  const baseSlots = {
12
+ baseButton: _Button.default,
11
13
  baseIconButton: _IconButton.default
12
14
  };
13
15
  const iconSlots = {};
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.computeAxisValue = computeAxisValue;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _d3Scale = require("@mui/x-charts-vendor/d3-scale");
10
+ var _defaultValueFormatters = require("../../../defaultValueFormatters");
10
11
  var _axis = require("../../../../models/axis");
11
12
  var _colorScale = require("../../../colorScale");
12
13
  var _ticks = require("../../../ticks");
@@ -130,7 +131,8 @@ function computeAxisValue({
130
131
  scaleType: scaleType,
131
132
  scale: finalScale.domain(domain),
132
133
  tickNumber,
133
- colorScale: axis.colorMap && (0, _colorScale.getColorScale)(axis.colorMap)
134
+ colorScale: axis.colorMap && (0, _colorScale.getColorScale)(axis.colorMap),
135
+ valueFormatter: axis.valueFormatter ?? (0, _defaultValueFormatters.createScalarFormatter)(tickNumber, (0, _getScale.getScale)(scaleType, range.map(v => scale.invert(v)), range))
134
136
  });
135
137
  });
136
138
  return {