@mui/x-charts 6.18.0 → 6.18.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 (118) hide show
  1. package/BarChart/BarChart.d.ts +7 -0
  2. package/BarChart/BarChart.js +41 -4
  3. package/CHANGELOG.md +63 -5
  4. package/ChartsAxis/ChartsAxis.js +5 -5
  5. package/ChartsAxis/axisClasses.d.ts +2 -2
  6. package/ChartsLegend/ChartsLegend.d.ts +1 -0
  7. package/ChartsLegend/ChartsLegend.js +1 -1
  8. package/ChartsLegend/chartsLegendClasses.d.ts +1 -1
  9. package/ChartsLegend/chartsLegendClasses.js +2 -2
  10. package/ChartsReferenceLine/ChartsReferenceLine.d.ts +10 -0
  11. package/ChartsReferenceLine/ChartsReferenceLine.js +78 -0
  12. package/ChartsReferenceLine/ChartsXReferenceLine.d.ts +13 -0
  13. package/ChartsReferenceLine/ChartsXReferenceLine.js +112 -0
  14. package/ChartsReferenceLine/ChartsYReferenceLine.d.ts +13 -0
  15. package/ChartsReferenceLine/ChartsYReferenceLine.js +112 -0
  16. package/ChartsReferenceLine/chartsReferenceLineClasses.d.ts +15 -0
  17. package/ChartsReferenceLine/chartsReferenceLineClasses.js +14 -0
  18. package/ChartsReferenceLine/common.d.ts +41 -0
  19. package/ChartsReferenceLine/common.js +27 -0
  20. package/ChartsReferenceLine/index.d.ts +2 -0
  21. package/ChartsReferenceLine/index.js +27 -0
  22. package/ChartsReferenceLine/package.json +6 -0
  23. package/ChartsSurface.d.ts +11 -0
  24. package/ChartsXAxis/ChartsXAxis.js +9 -5
  25. package/ChartsYAxis/ChartsYAxis.js +9 -5
  26. package/LineChart/LineChart.d.ts +7 -0
  27. package/LineChart/LineChart.js +41 -4
  28. package/LineChart/LineHighlightPlot.js +1 -1
  29. package/LineChart/MarkPlot.js +2 -1
  30. package/PieChart/PieChart.js +34 -4
  31. package/ResponsiveChartContainer/index.d.ts +13 -3
  32. package/ScatterChart/ScatterChart.js +34 -4
  33. package/SparkLineChart/SparkLineChart.js +22 -0
  34. package/context/CartesianContextProvider.d.ts +21 -1
  35. package/context/CartesianContextProvider.js +11 -0
  36. package/context/DrawingProvider.d.ts +18 -0
  37. package/context/DrawingProvider.js +6 -0
  38. package/context/HighlightProvider.d.ts +17 -0
  39. package/context/InteractionProvider.d.ts +6 -0
  40. package/context/SeriesContextProvider.d.ts +5 -0
  41. package/esm/BarChart/BarChart.js +41 -4
  42. package/esm/ChartsAxis/ChartsAxis.js +6 -5
  43. package/esm/ChartsLegend/ChartsLegend.js +2 -2
  44. package/esm/ChartsLegend/chartsLegendClasses.js +1 -1
  45. package/esm/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
  46. package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +105 -0
  47. package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +105 -0
  48. package/esm/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
  49. package/esm/ChartsReferenceLine/common.js +20 -0
  50. package/esm/ChartsReferenceLine/index.js +2 -0
  51. package/esm/ChartsXAxis/ChartsXAxis.js +10 -6
  52. package/esm/ChartsYAxis/ChartsYAxis.js +10 -6
  53. package/esm/LineChart/LineChart.js +41 -4
  54. package/esm/LineChart/LineHighlightPlot.js +1 -1
  55. package/esm/LineChart/MarkPlot.js +2 -1
  56. package/esm/PieChart/PieChart.js +34 -4
  57. package/esm/ScatterChart/ScatterChart.js +34 -4
  58. package/esm/SparkLineChart/SparkLineChart.js +22 -0
  59. package/esm/context/CartesianContextProvider.js +11 -0
  60. package/esm/context/DrawingProvider.js +6 -0
  61. package/esm/index.js +1 -0
  62. package/esm/internals/geometry.js +2 -2
  63. package/hooks/useScale.d.ts +2 -2
  64. package/index.d.ts +1 -0
  65. package/index.js +12 -1
  66. package/internals/components/ChartsText.d.ts +1 -1
  67. package/internals/geometry.d.ts +2 -2
  68. package/internals/geometry.js +2 -2
  69. package/internals/isBandScale.d.ts +3 -1
  70. package/internals/utils.d.ts +5 -0
  71. package/legacy/BarChart/BarChart.js +41 -4
  72. package/legacy/ChartsAxis/ChartsAxis.js +6 -5
  73. package/legacy/ChartsLegend/ChartsLegend.js +2 -2
  74. package/legacy/ChartsLegend/chartsLegendClasses.js +1 -1
  75. package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
  76. package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +105 -0
  77. package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +105 -0
  78. package/legacy/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
  79. package/legacy/ChartsReferenceLine/common.js +20 -0
  80. package/legacy/ChartsReferenceLine/index.js +2 -0
  81. package/legacy/ChartsXAxis/ChartsXAxis.js +15 -12
  82. package/legacy/ChartsYAxis/ChartsYAxis.js +15 -12
  83. package/legacy/LineChart/LineChart.js +41 -4
  84. package/legacy/LineChart/LineHighlightPlot.js +1 -1
  85. package/legacy/LineChart/MarkPlot.js +2 -1
  86. package/legacy/PieChart/PieChart.js +34 -4
  87. package/legacy/ScatterChart/ScatterChart.js +34 -4
  88. package/legacy/SparkLineChart/SparkLineChart.js +22 -0
  89. package/legacy/context/CartesianContextProvider.js +11 -0
  90. package/legacy/context/DrawingProvider.js +6 -0
  91. package/legacy/index.js +2 -1
  92. package/legacy/internals/geometry.js +2 -2
  93. package/models/axis.d.ts +33 -13
  94. package/models/layout.d.ts +6 -0
  95. package/models/seriesType/common.d.ts +16 -0
  96. package/modern/BarChart/BarChart.js +41 -4
  97. package/modern/ChartsAxis/ChartsAxis.js +5 -5
  98. package/modern/ChartsLegend/ChartsLegend.js +2 -2
  99. package/modern/ChartsLegend/chartsLegendClasses.js +1 -1
  100. package/modern/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
  101. package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +104 -0
  102. package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +104 -0
  103. package/modern/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
  104. package/modern/ChartsReferenceLine/common.js +20 -0
  105. package/modern/ChartsReferenceLine/index.js +2 -0
  106. package/modern/ChartsXAxis/ChartsXAxis.js +9 -5
  107. package/modern/ChartsYAxis/ChartsYAxis.js +9 -5
  108. package/modern/LineChart/LineChart.js +41 -4
  109. package/modern/LineChart/LineHighlightPlot.js +1 -1
  110. package/modern/LineChart/MarkPlot.js +2 -1
  111. package/modern/PieChart/PieChart.js +34 -4
  112. package/modern/ScatterChart/ScatterChart.js +34 -4
  113. package/modern/SparkLineChart/SparkLineChart.js +22 -0
  114. package/modern/context/CartesianContextProvider.js +11 -0
  115. package/modern/context/DrawingProvider.js +6 -0
  116. package/modern/index.js +2 -1
  117. package/modern/internals/geometry.js +2 -2
  118. package/package.json +1 -1
@@ -0,0 +1,15 @@
1
+ export interface ChartsReferenceLineClasses {
2
+ /** Styles applied to the root element. */
3
+ root: string;
4
+ /** Styles applied to the root element if the reference line is vertical. */
5
+ vertical: string;
6
+ /** Styles applied to the root element if the reference line is horizontal. */
7
+ horizontal: string;
8
+ /** Styles applied to the reference line. */
9
+ line: string;
10
+ /** Styles applied to the reference label. */
11
+ label: string;
12
+ }
13
+ export type ChartsReferenceLineClassKey = keyof ChartsReferenceLineClasses;
14
+ export declare function getReferenceLineUtilityClass(slot: string): string;
15
+ export declare const referenceLineClasses: ChartsReferenceLineClasses;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.getReferenceLineUtilityClass = getReferenceLineUtilityClass;
8
+ exports.referenceLineClasses = void 0;
9
+ var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
10
+ var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
11
+ function getReferenceLineUtilityClass(slot) {
12
+ return (0, _generateUtilityClass.default)('MuiChartsReferenceLine', slot);
13
+ }
14
+ const referenceLineClasses = exports.referenceLineClasses = (0, _generateUtilityClasses.default)('MuiChartsReferenceLine', ['root', 'vertical', 'horizontal', 'line', 'label']);
@@ -0,0 +1,41 @@
1
+ /// <reference types="react" />
2
+ import { ChartsReferenceLineClasses } from './chartsReferenceLineClasses';
3
+ import { ChartsTextStyle } from '../internals/components/ChartsText';
4
+ export type CommonChartsReferenceLineProps = {
5
+ /**
6
+ * The alignment if the label is in the chart drawing area.
7
+ * @default 'middle'
8
+ */
9
+ labelAlign?: 'start' | 'middle' | 'end';
10
+ /**
11
+ * The label to display along the reference line.
12
+ */
13
+ label?: string;
14
+ /**
15
+ * Additional space arround the label in px.
16
+ * Can be a number or an object `{ x, y }` to distinguish space with the reference line and space with axes.
17
+ * @default 5
18
+ */
19
+ spacing?: number | {
20
+ x?: number;
21
+ y?: number;
22
+ };
23
+ /**
24
+ * The id of the axis used for the reference value.
25
+ * @default The `id` of the first defined axis.
26
+ */
27
+ axisId?: string;
28
+ /**
29
+ * The style applied to the label.
30
+ */
31
+ labelStyle?: ChartsTextStyle;
32
+ /**
33
+ * The style applied to the line.
34
+ */
35
+ lineStyle?: React.CSSProperties;
36
+ /**
37
+ * Override or extend the styles applied to the component.
38
+ */
39
+ classes?: Partial<ChartsReferenceLineClasses>;
40
+ };
41
+ export declare const ReferenceLineRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").SVGProps<SVGGElement>, {}>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.ReferenceLineRoot = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _styles = require("@mui/material/styles");
10
+ var _chartsReferenceLineClasses = require("./chartsReferenceLineClasses");
11
+ const ReferenceLineRoot = exports.ReferenceLineRoot = (0, _styles.styled)('g')(({
12
+ theme
13
+ }) => ({
14
+ [`& .${_chartsReferenceLineClasses.referenceLineClasses.line}`]: {
15
+ fill: 'none',
16
+ stroke: (theme.vars || theme).palette.text.primary,
17
+ shapeRendering: 'crispEdges',
18
+ strokeWidth: 1,
19
+ pointerEvents: 'none'
20
+ },
21
+ [`& .${_chartsReferenceLineClasses.referenceLineClasses.label}`]: (0, _extends2.default)({
22
+ fill: (theme.vars || theme).palette.text.primary,
23
+ stroke: 'none',
24
+ pointerEvents: 'none',
25
+ fontSize: 12
26
+ }, theme.typography.body1)
27
+ }));
@@ -0,0 +1,2 @@
1
+ export * from './ChartsReferenceLine';
2
+ export * from './chartsReferenceLineClasses';
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _ChartsReferenceLine = require("./ChartsReferenceLine");
7
+ Object.keys(_ChartsReferenceLine).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _ChartsReferenceLine[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _ChartsReferenceLine[key];
14
+ }
15
+ });
16
+ });
17
+ var _chartsReferenceLineClasses = require("./chartsReferenceLineClasses");
18
+ Object.keys(_chartsReferenceLineClasses).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _chartsReferenceLineClasses[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _chartsReferenceLineClasses[key];
25
+ }
26
+ });
27
+ });
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "../esm/ChartsReferenceLine/index.js",
4
+ "main": "./index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -7,7 +7,13 @@ type ViewBox = {
7
7
  height?: number;
8
8
  };
9
9
  export interface ChartsSurfaceProps {
10
+ /**
11
+ * The width of the chart in px.
12
+ */
10
13
  width: number;
14
+ /**
15
+ * The height of the chart in px.
16
+ */
11
17
  height: number;
12
18
  viewBox?: ViewBox;
13
19
  className?: string;
@@ -15,6 +21,11 @@ export interface ChartsSurfaceProps {
15
21
  desc?: string;
16
22
  sx?: SxProps<Theme>;
17
23
  children?: React.ReactNode;
24
+ /**
25
+ * If `true`, the charts will not listen to the mouse move event.
26
+ * It might break interactive features, but will improve performance.
27
+ * @default false
28
+ */
18
29
  disableAxisListener?: boolean;
19
30
  }
20
31
  export declare const ChartsSurface: React.ForwardRefExoticComponent<ChartsSurfaceProps & React.RefAttributes<SVGSVGElement>>;
@@ -114,17 +114,20 @@ function ChartsXAxis(inProps) {
114
114
  props: (0, _extends2.default)({}, defaultProps, inProps),
115
115
  name: 'MuiChartsXAxis'
116
116
  });
117
+ const {
118
+ xAxisIds
119
+ } = React.useContext(_CartesianContextProvider.CartesianContext);
117
120
  const _React$useContext = React.useContext(_CartesianContextProvider.CartesianContext),
118
- _props$axisId = props.axisId,
121
+ _ref = props.axisId ?? xAxisIds[0],
119
122
  {
120
123
  xAxis: {
121
- [_props$axisId]: {
124
+ [_ref]: {
122
125
  scale: xScale,
123
126
  tickNumber
124
127
  }
125
128
  }
126
129
  } = _React$useContext,
127
- settings = (0, _objectWithoutPropertiesLoose2.default)(_React$useContext.xAxis[_props$axisId], _excluded);
130
+ settings = (0, _objectWithoutPropertiesLoose2.default)(_React$useContext.xAxis[_ref], _excluded);
128
131
  const isMounted = (0, _useMounted.useMounted)();
129
132
  const defaultizedProps = (0, _extends2.default)({}, defaultProps, settings, props);
130
133
  const {
@@ -242,9 +245,10 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
242
245
  // | To update them edit the TypeScript types and run "yarn proptypes" |
243
246
  // ----------------------------------------------------------------------
244
247
  /**
245
- * Id of the axis to render.
248
+ * The id of the axis to render.
249
+ * If undefined, it will be the first defined axis.
246
250
  */
247
- axisId: _propTypes.default.string.isRequired,
251
+ axisId: _propTypes.default.string,
248
252
  /**
249
253
  * Override or extend the styles applied to the component.
250
254
  */
@@ -60,17 +60,20 @@ function ChartsYAxis(inProps) {
60
60
  props: (0, _extends2.default)({}, defaultProps, inProps),
61
61
  name: 'MuiChartsYAxis'
62
62
  });
63
+ const {
64
+ yAxisIds
65
+ } = React.useContext(_CartesianContextProvider.CartesianContext);
63
66
  const _React$useContext = React.useContext(_CartesianContextProvider.CartesianContext),
64
- _props$axisId = props.axisId,
67
+ _ref = props.axisId ?? yAxisIds[0],
65
68
  {
66
69
  yAxis: {
67
- [_props$axisId]: {
70
+ [_ref]: {
68
71
  scale: yScale,
69
72
  tickNumber
70
73
  }
71
74
  }
72
75
  } = _React$useContext,
73
- settings = (0, _objectWithoutPropertiesLoose2.default)(_React$useContext.yAxis[_props$axisId], _excluded);
76
+ settings = (0, _objectWithoutPropertiesLoose2.default)(_React$useContext.yAxis[_ref], _excluded);
74
77
  const defaultizedProps = (0, _extends2.default)({}, defaultProps, settings, props);
75
78
  const {
76
79
  position,
@@ -175,9 +178,10 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
175
178
  // | To update them edit the TypeScript types and run "yarn proptypes" |
176
179
  // ----------------------------------------------------------------------
177
180
  /**
178
- * Id of the axis to render.
181
+ * The id of the axis to render.
182
+ * If undefined, it will be the first defined axis.
179
183
  */
180
- axisId: _propTypes.default.string.isRequired,
184
+ axisId: _propTypes.default.string,
181
185
  /**
182
186
  * Override or extend the styles applied to the component.
183
187
  */
@@ -18,6 +18,13 @@ export interface LineChartSlotComponentProps extends ChartsAxisSlotComponentProp
18
18
  export interface LineChartProps extends Omit<ResponsiveChartContainerProps, 'series'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'> {
19
19
  series: MakeOptional<LineSeriesType, 'type'>[];
20
20
  tooltip?: ChartsTooltipProps;
21
+ /**
22
+ * Object `{ x, y }` that defines how the charts highlight the mouse position along the x- and y-axes.
23
+ * The two properties accept the following values:
24
+ * - 'none': display nothing.
25
+ * - 'line': display a line at the current mouse position.
26
+ * - 'band': display a band at the current mouse position. Only available with band scale.
27
+ */
21
28
  axisHighlight?: ChartsAxisHighlightProps;
22
29
  /**
23
30
  * @deprecated Consider using `slotProps.legend` instead.
@@ -119,6 +119,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
119
119
  // | These PropTypes are generated from the TypeScript type definitions |
120
120
  // | To update them edit the TypeScript types and run "yarn proptypes" |
121
121
  // ----------------------------------------------------------------------
122
+ /**
123
+ * Object `{ x, y }` that defines how the charts highlight the mouse position along the x- and y-axes.
124
+ * The two properties accept the following values:
125
+ * - 'none': display nothing.
126
+ * - 'line': display a line at the current mouse position.
127
+ * - 'band': display a band at the current mouse position. Only available with band scale.
128
+ */
122
129
  axisHighlight: _propTypes.default.shape({
123
130
  x: _propTypes.default.oneOf(['band', 'line', 'none']),
124
131
  y: _propTypes.default.oneOf(['band', 'line', 'none'])
@@ -129,7 +136,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
129
136
  * @default xAxisIds[0] The id of the first provided axis
130
137
  */
131
138
  bottomAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
132
- axisId: _propTypes.default.string.isRequired,
139
+ axisId: _propTypes.default.string,
133
140
  classes: _propTypes.default.object,
134
141
  disableLine: _propTypes.default.bool,
135
142
  disableTicks: _propTypes.default.bool,
@@ -156,13 +163,25 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
156
163
  * Color palette used to colorize multiple series.
157
164
  */
158
165
  colors: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.func]),
166
+ /**
167
+ * An array of objects that can be used to populate series and axes data using their `dataKey` property.
168
+ */
159
169
  dataset: _propTypes.default.arrayOf(_propTypes.default.object),
160
170
  desc: _propTypes.default.string,
171
+ /**
172
+ * If `true`, the charts will not listen to the mouse move event.
173
+ * It might break interactive features, but will improve performance.
174
+ * @default false
175
+ */
161
176
  disableAxisListener: _propTypes.default.bool,
162
177
  /**
163
178
  * If `true`, render the line highlight item.
164
179
  */
165
180
  disableLineItemHighlight: _propTypes.default.bool,
181
+ /**
182
+ * The height of the chart in px. If not defined, it takes the height of the parent element.
183
+ * @default undefined
184
+ */
166
185
  height: _propTypes.default.number,
167
186
  /**
168
187
  * Indicate which axis to display the left of the charts.
@@ -170,7 +189,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
170
189
  * @default yAxisIds[0] The id of the first provided axis
171
190
  */
172
191
  leftAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
173
- axisId: _propTypes.default.string.isRequired,
192
+ axisId: _propTypes.default.string,
174
193
  classes: _propTypes.default.object,
175
194
  disableLine: _propTypes.default.bool,
176
195
  disableTicks: _propTypes.default.bool,
@@ -205,6 +224,12 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
205
224
  slotProps: _propTypes.default.object,
206
225
  slots: _propTypes.default.object
207
226
  }),
227
+ /**
228
+ * The margin between the SVG and the drawing area.
229
+ * It's used for leaving some space for extra information such as the x- and y-axis or legend.
230
+ * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
231
+ * @default object Depends on the charts type.
232
+ */
208
233
  margin: _propTypes.default.shape({
209
234
  bottom: _propTypes.default.number,
210
235
  left: _propTypes.default.number,
@@ -217,7 +242,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
217
242
  * @default null
218
243
  */
219
244
  rightAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
220
- axisId: _propTypes.default.string.isRequired,
245
+ axisId: _propTypes.default.string,
221
246
  classes: _propTypes.default.object,
222
247
  disableLine: _propTypes.default.bool,
223
248
  disableTicks: _propTypes.default.bool,
@@ -287,7 +312,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
287
312
  * @default null
288
313
  */
289
314
  topAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
290
- axisId: _propTypes.default.string.isRequired,
315
+ axisId: _propTypes.default.string,
291
316
  classes: _propTypes.default.object,
292
317
  disableLine: _propTypes.default.bool,
293
318
  disableTicks: _propTypes.default.bool,
@@ -314,7 +339,15 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
314
339
  x: _propTypes.default.number,
315
340
  y: _propTypes.default.number
316
341
  }),
342
+ /**
343
+ * The width of the chart in px. If not defined, it takes the width of the parent element.
344
+ * @default undefined
345
+ */
317
346
  width: _propTypes.default.number,
347
+ /**
348
+ * The configuration of the x-axes.
349
+ * If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
350
+ */
318
351
  xAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
319
352
  axisId: _propTypes.default.string,
320
353
  classes: _propTypes.default.object,
@@ -345,6 +378,10 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
345
378
  tickSize: _propTypes.default.number,
346
379
  valueFormatter: _propTypes.default.func
347
380
  })),
381
+ /**
382
+ * The configuration of the y-axes.
383
+ * If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
384
+ */
348
385
  yAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
349
386
  axisId: _propTypes.default.string,
350
387
  classes: _propTypes.default.object,
@@ -81,7 +81,7 @@ function LineHighlightPlot(props) {
81
81
  throw new Error(`Axis of id "${xAxisKey}" should have data property to be able to display a line plot.`);
82
82
  }
83
83
  const x = xScale(xData[highlightedIndex]);
84
- const y = yScale(stackedData[highlightedIndex][1]);
84
+ const y = yScale(stackedData[highlightedIndex][1]); // This should not be undefined since y should not be a band scale
85
85
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Element, (0, _extends2.default)({
86
86
  id: seriesId,
87
87
  color: series[seriesId].color,
@@ -134,7 +134,8 @@ function MarkPlot(props) {
134
134
  shape: "circle",
135
135
  color: series[seriesId].color,
136
136
  x: x,
137
- y: y,
137
+ y: y // Don't knwo why TS don't get from the filter that y can't be null
138
+ ,
138
139
  highlightScope: series[seriesId].highlightScope
139
140
  }, slotProps?.mark), `${seriesId}-${index}`);
140
141
  });
@@ -119,7 +119,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
119
119
  * @default xAxisIds[0] The id of the first provided axis
120
120
  */
121
121
  bottomAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
122
- axisId: _propTypes.default.string.isRequired,
122
+ axisId: _propTypes.default.string,
123
123
  classes: _propTypes.default.object,
124
124
  disableLine: _propTypes.default.bool,
125
125
  disableTicks: _propTypes.default.bool,
@@ -146,9 +146,21 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
146
146
  * Color palette used to colorize multiple series.
147
147
  */
148
148
  colors: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.func]),
149
+ /**
150
+ * An array of objects that can be used to populate series and axes data using their `dataKey` property.
151
+ */
149
152
  dataset: _propTypes.default.arrayOf(_propTypes.default.object),
150
153
  desc: _propTypes.default.string,
154
+ /**
155
+ * If `true`, the charts will not listen to the mouse move event.
156
+ * It might break interactive features, but will improve performance.
157
+ * @default false
158
+ */
151
159
  disableAxisListener: _propTypes.default.bool,
160
+ /**
161
+ * The height of the chart in px. If not defined, it takes the height of the parent element.
162
+ * @default undefined
163
+ */
152
164
  height: _propTypes.default.number,
153
165
  /**
154
166
  * Indicate which axis to display the left of the charts.
@@ -156,7 +168,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
156
168
  * @default yAxisIds[0] The id of the first provided axis
157
169
  */
158
170
  leftAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
159
- axisId: _propTypes.default.string.isRequired,
171
+ axisId: _propTypes.default.string,
160
172
  classes: _propTypes.default.object,
161
173
  disableLine: _propTypes.default.bool,
162
174
  disableTicks: _propTypes.default.bool,
@@ -191,6 +203,12 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
191
203
  slotProps: _propTypes.default.object,
192
204
  slots: _propTypes.default.object
193
205
  }),
206
+ /**
207
+ * The margin between the SVG and the drawing area.
208
+ * It's used for leaving some space for extra information such as the x- and y-axis or legend.
209
+ * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
210
+ * @default object Depends on the charts type.
211
+ */
194
212
  margin: _propTypes.default.shape({
195
213
  bottom: _propTypes.default.number,
196
214
  left: _propTypes.default.number,
@@ -204,7 +222,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
204
222
  * @default null
205
223
  */
206
224
  rightAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
207
- axisId: _propTypes.default.string.isRequired,
225
+ axisId: _propTypes.default.string,
208
226
  classes: _propTypes.default.object,
209
227
  disableLine: _propTypes.default.bool,
210
228
  disableTicks: _propTypes.default.bool,
@@ -295,7 +313,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
295
313
  * @default null
296
314
  */
297
315
  topAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
298
- axisId: _propTypes.default.string.isRequired,
316
+ axisId: _propTypes.default.string,
299
317
  classes: _propTypes.default.object,
300
318
  disableLine: _propTypes.default.bool,
301
319
  disableTicks: _propTypes.default.bool,
@@ -322,7 +340,15 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
322
340
  x: _propTypes.default.number,
323
341
  y: _propTypes.default.number
324
342
  }),
343
+ /**
344
+ * The width of the chart in px. If not defined, it takes the width of the parent element.
345
+ * @default undefined
346
+ */
325
347
  width: _propTypes.default.number,
348
+ /**
349
+ * The configuration of the x-axes.
350
+ * If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
351
+ */
326
352
  xAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
327
353
  axisId: _propTypes.default.string,
328
354
  classes: _propTypes.default.object,
@@ -353,6 +379,10 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
353
379
  tickSize: _propTypes.default.number,
354
380
  valueFormatter: _propTypes.default.func
355
381
  })),
382
+ /**
383
+ * The configuration of the y-axes.
384
+ * If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
385
+ */
356
386
  yAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
357
387
  axisId: _propTypes.default.string,
358
388
  classes: _propTypes.default.object,
@@ -1,5 +1,15 @@
1
1
  import * as React from 'react';
2
2
  import { ChartContainerProps } from '../ChartContainer';
3
- import { MakeOptional } from '../models/helpers';
4
- export type ResponsiveChartContainerProps = MakeOptional<ChartContainerProps, 'width' | 'height'>;
5
- export declare const ResponsiveChartContainer: React.ForwardRefExoticComponent<Omit<ChartContainerProps, "height" | "width"> & Partial<Pick<ChartContainerProps, "height" | "width">> & React.RefAttributes<unknown>>;
3
+ export interface ResponsiveChartContainerProps extends Omit<ChartContainerProps, 'width' | 'height'> {
4
+ /**
5
+ * The width of the chart in px. If not defined, it takes the width of the parent element.
6
+ * @default undefined
7
+ */
8
+ width?: number;
9
+ /**
10
+ * The height of the chart in px. If not defined, it takes the height of the parent element.
11
+ * @default undefined
12
+ */
13
+ height?: number;
14
+ }
15
+ export declare const ResponsiveChartContainer: React.ForwardRefExoticComponent<ResponsiveChartContainerProps & React.RefAttributes<unknown>>;
@@ -96,7 +96,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
96
96
  * @default xAxisIds[0] The id of the first provided axis
97
97
  */
98
98
  bottomAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
99
- axisId: _propTypes.default.string.isRequired,
99
+ axisId: _propTypes.default.string,
100
100
  classes: _propTypes.default.object,
101
101
  disableLine: _propTypes.default.bool,
102
102
  disableTicks: _propTypes.default.bool,
@@ -123,9 +123,21 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
123
123
  * Color palette used to colorize multiple series.
124
124
  */
125
125
  colors: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.func]),
126
+ /**
127
+ * An array of objects that can be used to populate series and axes data using their `dataKey` property.
128
+ */
126
129
  dataset: _propTypes.default.arrayOf(_propTypes.default.object),
127
130
  desc: _propTypes.default.string,
131
+ /**
132
+ * If `true`, the charts will not listen to the mouse move event.
133
+ * It might break interactive features, but will improve performance.
134
+ * @default false
135
+ */
128
136
  disableAxisListener: _propTypes.default.bool,
137
+ /**
138
+ * The height of the chart in px. If not defined, it takes the height of the parent element.
139
+ * @default undefined
140
+ */
129
141
  height: _propTypes.default.number,
130
142
  /**
131
143
  * Indicate which axis to display the left of the charts.
@@ -133,7 +145,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
133
145
  * @default yAxisIds[0] The id of the first provided axis
134
146
  */
135
147
  leftAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
136
- axisId: _propTypes.default.string.isRequired,
148
+ axisId: _propTypes.default.string,
137
149
  classes: _propTypes.default.object,
138
150
  disableLine: _propTypes.default.bool,
139
151
  disableTicks: _propTypes.default.bool,
@@ -168,6 +180,12 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
168
180
  slotProps: _propTypes.default.object,
169
181
  slots: _propTypes.default.object
170
182
  }),
183
+ /**
184
+ * The margin between the SVG and the drawing area.
185
+ * It's used for leaving some space for extra information such as the x- and y-axis or legend.
186
+ * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
187
+ * @default object Depends on the charts type.
188
+ */
171
189
  margin: _propTypes.default.shape({
172
190
  bottom: _propTypes.default.number,
173
191
  left: _propTypes.default.number,
@@ -180,7 +198,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
180
198
  * @default null
181
199
  */
182
200
  rightAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
183
- axisId: _propTypes.default.string.isRequired,
201
+ axisId: _propTypes.default.string,
184
202
  classes: _propTypes.default.object,
185
203
  disableLine: _propTypes.default.bool,
186
204
  disableTicks: _propTypes.default.bool,
@@ -246,7 +264,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
246
264
  * @default null
247
265
  */
248
266
  topAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
249
- axisId: _propTypes.default.string.isRequired,
267
+ axisId: _propTypes.default.string,
250
268
  classes: _propTypes.default.object,
251
269
  disableLine: _propTypes.default.bool,
252
270
  disableTicks: _propTypes.default.bool,
@@ -273,7 +291,15 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
273
291
  x: _propTypes.default.number,
274
292
  y: _propTypes.default.number
275
293
  }),
294
+ /**
295
+ * The width of the chart in px. If not defined, it takes the width of the parent element.
296
+ * @default undefined
297
+ */
276
298
  width: _propTypes.default.number,
299
+ /**
300
+ * The configuration of the x-axes.
301
+ * If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
302
+ */
277
303
  xAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
278
304
  axisId: _propTypes.default.string,
279
305
  classes: _propTypes.default.object,
@@ -304,6 +330,10 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
304
330
  tickSize: _propTypes.default.number,
305
331
  valueFormatter: _propTypes.default.func
306
332
  })),
333
+ /**
334
+ * The configuration of the y-axes.
335
+ * If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
336
+ */
307
337
  yAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
308
338
  axisId: _propTypes.default.string,
309
339
  classes: _propTypes.default.object,
@@ -137,10 +137,28 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
137
137
  * Data to plot.
138
138
  */
139
139
  data: _propTypes.default.arrayOf(_propTypes.default.number).isRequired,
140
+ /**
141
+ * An array of objects that can be used to populate series and axes data using their `dataKey` property.
142
+ */
140
143
  dataset: _propTypes.default.arrayOf(_propTypes.default.object),
141
144
  desc: _propTypes.default.string,
145
+ /**
146
+ * If `true`, the charts will not listen to the mouse move event.
147
+ * It might break interactive features, but will improve performance.
148
+ * @default false
149
+ */
142
150
  disableAxisListener: _propTypes.default.bool,
151
+ /**
152
+ * The height of the chart in px. If not defined, it takes the height of the parent element.
153
+ * @default undefined
154
+ */
143
155
  height: _propTypes.default.number,
156
+ /**
157
+ * The margin between the SVG and the drawing area.
158
+ * It's used for leaving some space for extra information such as the x- and y-axis or legend.
159
+ * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
160
+ * @default object Depends on the charts type.
161
+ */
144
162
  margin: _propTypes.default.shape({
145
163
  bottom: _propTypes.default.number,
146
164
  left: _propTypes.default.number,
@@ -196,6 +214,10 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
196
214
  x: _propTypes.default.number,
197
215
  y: _propTypes.default.number
198
216
  }),
217
+ /**
218
+ * The width of the chart in px. If not defined, it takes the width of the parent element.
219
+ * @default undefined
220
+ */
199
221
  width: _propTypes.default.number,
200
222
  /**
201
223
  * The xAxis configuration.