@mui/x-charts 6.0.0-alpha.4 → 6.0.0-alpha.5

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.
@@ -87,7 +87,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
87
87
  }),
88
88
  /**
89
89
  * Indicate which axis to display the bottom of the charts.
90
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`
90
+ * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
91
91
  * @default xAxisIds[0] The id of the first provided axis
92
92
  */
93
93
  bottomAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
@@ -114,7 +114,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
114
114
  height: _propTypes.default.number,
115
115
  /**
116
116
  * Indicate which axis to display the left of the charts.
117
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`
117
+ * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
118
118
  * @default yAxisIds[0] The id of the first provided axis
119
119
  */
120
120
  leftAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
@@ -154,7 +154,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
154
154
  }),
155
155
  /**
156
156
  * Indicate which axis to display the right of the charts.
157
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`
157
+ * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
158
158
  * @default null
159
159
  */
160
160
  rightAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
@@ -197,7 +197,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
197
197
  }),
198
198
  /**
199
199
  * Indicate which axis to display the top of the charts.
200
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`
200
+ * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
201
201
  * @default null
202
202
  */
203
203
  topAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
package/CHANGELOG.md CHANGED
@@ -3,6 +3,70 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 6.10.2
7
+
8
+ _Jul 27, 2023_
9
+
10
+ We'd like to offer a big thanks to the 13 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🚀 Improve scatter charts performance
13
+ - 📚 Redesigned component API documentation and side navigation
14
+ - 🐞 Bugfixes
15
+
16
+ ### Data Grid
17
+
18
+ #### `@mui/x-data-grid@v6.10.2`
19
+
20
+ - [DataGrid] Fix quick filter & aggregation error (#9729) @romgrk
21
+ - [DataGrid] Fix row click propagation causing error in nested grid (#9741) @cherniavskii
22
+ - [DataGrid] Keep focused cell in the DOM (#7357) @yaredtsy
23
+ - [l10n] Improve Finnish (fi-FI) locale (#9746) @sambbaahh
24
+
25
+ #### `@mui/x-data-grid-pro@v6.10.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link)
26
+
27
+ Same changes as in `@mui/x-data-grid@v6.10.2`.
28
+
29
+ #### `@mui/x-data-grid-premium@v6.10.2` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link)
30
+
31
+ Same changes as in `@mui/x-data-grid-pro@v6.10.2`, plus:
32
+
33
+ - [DataGridPremium] Allow to customize grouping cell offset (#9417) @cherniavskii
34
+
35
+ ### Date Pickers
36
+
37
+ #### `@mui/x-date-pickers@v6.10.2`
38
+
39
+ - [pickers] Remove the `endOfDate` from `DigitalClock` timeOptions (#9800) @noraleonte
40
+
41
+ #### `@mui/x-date-pickers-pro@v6.10.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link)
42
+
43
+ Same changes as in `@mui/x-date-pickers@v6.10.2`.
44
+
45
+ ### Charts / `@mui/x-charts@v6.0.0-alpha.5`
46
+
47
+ - [charts] Improve JSDoc for axis-related props (#9779) @flaviendelangle
48
+ - [charts] Improve performances of Scatter component (#9527) @flaviendelangle
49
+
50
+ ### Docs
51
+
52
+ - [docs] Add `pnpm` in more places @oliviertassinari
53
+ - [docs] Add `pnpm` installation instructions for MUI X (#9707) @richbustos
54
+ - [docs] Align pickers "uncontrolled vs controlled" sections (#9772) @LukasTy
55
+ - [docs] Apply style guide to the data grid Layout page (#9673) @richbustos
56
+ - [docs] Differentiate between packages in `slotProps` docs (#9668) @cherniavskii
57
+ - [docs] Fix charts width in axis pages (#9801) @alexfauquette
58
+ - [docs] Fix wrong prop name in the Editing page (#9753) @m4theushw
59
+ - [docs] New component API page and side nav design (#9187) @alexfauquette
60
+ - [docs] Update overview page with up to date information about the plans (#9512) @joserodolfofreitas
61
+
62
+ ### Core
63
+
64
+ - [core] Use PR charts version in preview (#9787) @alexfauquette
65
+ - [license] Allow overriding the license on specific parts of the page (#9717) @Janpot
66
+ - [license] Throw in dev mode after 30 days (#9701) @oliviertassinari
67
+ - [license] Only throw in dev mode (#9803) @oliviertassinari
68
+ - [test] Fail the CI when new unexpected files are created (#9728) @oliviertassinari
69
+
6
70
  ## 6.10.1
7
71
 
8
72
  _Jul 20, 2023_
@@ -3,25 +3,25 @@ import { ChartsXAxisProps, ChartsYAxisProps } from '../models/axis';
3
3
  export interface ChartsAxisProps {
4
4
  /**
5
5
  * Indicate which axis to display the top of the charts.
6
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`
6
+ * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
7
7
  * @default null
8
8
  */
9
9
  topAxis?: null | string | ChartsXAxisProps;
10
10
  /**
11
11
  * Indicate which axis to display the bottom of the charts.
12
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`
12
+ * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
13
13
  * @default xAxisIds[0] The id of the first provided axis
14
14
  */
15
15
  bottomAxis?: null | string | ChartsXAxisProps;
16
16
  /**
17
17
  * Indicate which axis to display the left of the charts.
18
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`
18
+ * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
19
19
  * @default yAxisIds[0] The id of the first provided axis
20
20
  */
21
21
  leftAxis?: null | string | ChartsYAxisProps;
22
22
  /**
23
23
  * Indicate which axis to display the right of the charts.
24
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`
24
+ * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
25
25
  * @default null
26
26
  */
27
27
  rightAxis?: null | string | ChartsYAxisProps;
@@ -79,7 +79,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
79
79
  // ----------------------------------------------------------------------
80
80
  /**
81
81
  * Indicate which axis to display the bottom of the charts.
82
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`
82
+ * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
83
83
  * @default xAxisIds[0] The id of the first provided axis
84
84
  */
85
85
  bottomAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
@@ -97,7 +97,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
97
97
  }), _propTypes.default.string]),
98
98
  /**
99
99
  * Indicate which axis to display the left of the charts.
100
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`
100
+ * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
101
101
  * @default yAxisIds[0] The id of the first provided axis
102
102
  */
103
103
  leftAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
@@ -115,7 +115,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
115
115
  }), _propTypes.default.string]),
116
116
  /**
117
117
  * Indicate which axis to display the right of the charts.
118
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`
118
+ * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
119
119
  * @default null
120
120
  */
121
121
  rightAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
@@ -133,7 +133,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
133
133
  }), _propTypes.default.string]),
134
134
  /**
135
135
  * Indicate which axis to display the top of the charts.
136
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`
136
+ * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
137
137
  * @default null
138
138
  */
139
139
  topAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
@@ -89,7 +89,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
89
89
  }),
90
90
  /**
91
91
  * Indicate which axis to display the bottom of the charts.
92
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`
92
+ * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
93
93
  * @default xAxisIds[0] The id of the first provided axis
94
94
  */
95
95
  bottomAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
@@ -116,7 +116,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
116
116
  height: _propTypes.default.number,
117
117
  /**
118
118
  * Indicate which axis to display the left of the charts.
119
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`
119
+ * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
120
120
  * @default yAxisIds[0] The id of the first provided axis
121
121
  */
122
122
  leftAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
@@ -156,7 +156,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
156
156
  }),
157
157
  /**
158
158
  * Indicate which axis to display the right of the charts.
159
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`
159
+ * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
160
160
  * @default null
161
161
  */
162
162
  rightAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
@@ -201,7 +201,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
201
201
  }),
202
202
  /**
203
203
  * Indicate which axis to display the top of the charts.
204
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`
204
+ * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
205
205
  * @default null
206
206
  */
207
207
  topAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
@@ -90,7 +90,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
90
90
  }),
91
91
  /**
92
92
  * Indicate which axis to display the bottom of the charts.
93
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`
93
+ * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
94
94
  * @default xAxisIds[0] The id of the first provided axis
95
95
  */
96
96
  bottomAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
@@ -117,7 +117,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
117
117
  height: _propTypes.default.number,
118
118
  /**
119
119
  * Indicate which axis to display the left of the charts.
120
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`
120
+ * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
121
121
  * @default yAxisIds[0] The id of the first provided axis
122
122
  */
123
123
  leftAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
@@ -157,7 +157,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
157
157
  }),
158
158
  /**
159
159
  * Indicate which axis to display the right of the charts.
160
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`
160
+ * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
161
161
  * @default null
162
162
  */
163
163
  rightAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
@@ -222,7 +222,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
222
222
  }),
223
223
  /**
224
224
  * Indicate which axis to display the top of the charts.
225
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`
225
+ * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
226
226
  * @default null
227
227
  */
228
228
  topAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
@@ -25,62 +25,48 @@ function Scatter(props) {
25
25
  const {
26
26
  item
27
27
  } = React.useContext(_InteractionProvider.InteractionContext);
28
- const getXPosition = (0, _useScale.getValueToPositionMapper)(xScale);
29
- const getYPosition = (0, _useScale.getValueToPositionMapper)(yScale);
30
28
  const getInteractionItemProps = (0, _useInteractionItemProps.useInteractionItemProps)(series.highlightScope);
31
- const xRange = xScale.range();
32
- const yRange = yScale.range();
33
- const isInRange = ({
34
- x,
35
- y
36
- }) => {
37
- if (x < Math.min(...xRange) || x > Math.max(...xRange)) {
38
- return false;
39
- }
40
- if (y < Math.min(...yRange) || y > Math.max(...yRange)) {
41
- return false;
42
- }
43
- return true;
44
- };
45
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
46
- children: series.data.map(({
47
- x,
48
- y,
49
- id
50
- }, index) => ({
51
- x: getXPosition(x),
52
- y: getYPosition(y),
53
- id,
54
- dataIndex: index
55
- })).filter(isInRange).map(({
56
- x,
57
- y,
58
- id,
59
- dataIndex
60
- }) => {
61
- const isHighlighted = (0, _useInteractionItemProps.getIsHighlighted)(item, {
62
- type: 'scatter',
63
- seriesId: series.id,
64
- dataIndex
65
- }, series.highlightScope);
66
- const isFaded = !isHighlighted && (0, _useInteractionItemProps.getIsFaded)(item, {
29
+ const cleanData = React.useMemo(() => {
30
+ const getXPosition = (0, _useScale.getValueToPositionMapper)(xScale);
31
+ const getYPosition = (0, _useScale.getValueToPositionMapper)(yScale);
32
+ const xRange = xScale.range();
33
+ const yRange = yScale.range();
34
+ const minXRange = Math.min(...xRange);
35
+ const maxXRange = Math.max(...xRange);
36
+ const minYRange = Math.min(...yRange);
37
+ const maxYRange = Math.max(...yRange);
38
+ const temp = [];
39
+ for (let i = 0; i < series.data.length; i += 1) {
40
+ const scatterPoint = series.data[i];
41
+ const x = getXPosition(scatterPoint.x);
42
+ const y = getYPosition(scatterPoint.y);
43
+ const isInRange = x >= minXRange && x <= maxXRange && y >= minYRange && y <= maxYRange;
44
+ const pointCtx = {
67
45
  type: 'scatter',
68
46
  seriesId: series.id,
69
- dataIndex
70
- }, series.highlightScope);
71
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("circle", (0, _extends2.default)({
72
- cx: 0,
73
- cy: 0,
74
- r: markerSize,
75
- transform: `translate(${x}, ${y})`,
76
- fill: color,
77
- opacity: isFaded && 0.3 || 1
78
- }, getInteractionItemProps({
79
- type: 'scatter',
80
- seriesId: series.id,
81
- dataIndex
82
- })), id);
83
- })
47
+ dataIndex: i
48
+ };
49
+ if (isInRange) {
50
+ temp.push({
51
+ x,
52
+ y,
53
+ isFaded: !(0, _useInteractionItemProps.getIsHighlighted)(item, pointCtx, series.highlightScope) && (0, _useInteractionItemProps.getIsFaded)(item, pointCtx, series.highlightScope),
54
+ interactionProps: getInteractionItemProps(pointCtx),
55
+ id: scatterPoint.id
56
+ });
57
+ }
58
+ }
59
+ return temp;
60
+ }, [yScale, xScale, getInteractionItemProps, item, series.data, series.highlightScope, series.id]);
61
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
62
+ children: cleanData.map(dataPoint => /*#__PURE__*/(0, _jsxRuntime.jsx)("circle", (0, _extends2.default)({
63
+ cx: 0,
64
+ cy: 0,
65
+ r: markerSize,
66
+ transform: `translate(${dataPoint.x}, ${dataPoint.y})`,
67
+ fill: color,
68
+ opacity: dataPoint.isFaded && 0.3 || 1
69
+ }, dataPoint.interactionProps), dataPoint.id))
84
70
  });
85
71
  }
86
72
  process.env.NODE_ENV !== "production" ? Scatter.propTypes = {
@@ -73,7 +73,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
73
73
  }),
74
74
  /**
75
75
  * Indicate which axis to display the bottom of the charts.
76
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`
76
+ * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
77
77
  * @default xAxisIds[0] The id of the first provided axis
78
78
  */
79
79
  bottomAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
@@ -100,7 +100,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
100
100
  height: _propTypes.default.number,
101
101
  /**
102
102
  * Indicate which axis to display the left of the charts.
103
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`
103
+ * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
104
104
  * @default yAxisIds[0] The id of the first provided axis
105
105
  */
106
106
  leftAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
@@ -140,7 +140,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
140
140
  }),
141
141
  /**
142
142
  * Indicate which axis to display the right of the charts.
143
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`
143
+ * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
144
144
  * @default null
145
145
  */
146
146
  rightAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
@@ -185,7 +185,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
185
185
  }),
186
186
  /**
187
187
  * Indicate which axis to display the top of the charts.
188
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`
188
+ * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
189
189
  * @default null
190
190
  */
191
191
  topAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
@@ -5,7 +5,7 @@ export interface DrawingProviderProps extends LayoutConfig {
5
5
  svgRef: React.RefObject<SVGSVGElement>;
6
6
  }
7
7
  /**
8
- * Defines the area in which it is possible to draw the charts
8
+ * Defines the area in which it is possible to draw the charts.
9
9
  */
10
10
  export type DrawingArea = {
11
11
  left: number;
@@ -14,7 +14,7 @@ var _jsxRuntime = require("react/jsx-runtime");
14
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
15
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
16
  /**
17
- * Defines the area in which it is possible to draw the charts
17
+ * Defines the area in which it is possible to draw the charts.
18
18
  */
19
19
 
20
20
  const DrawingContext = /*#__PURE__*/React.createContext({
@@ -78,7 +78,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
78
78
  }),
79
79
  /**
80
80
  * Indicate which axis to display the bottom of the charts.
81
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`
81
+ * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
82
82
  * @default xAxisIds[0] The id of the first provided axis
83
83
  */
84
84
  bottomAxis: PropTypes.oneOfType([PropTypes.shape({
@@ -105,7 +105,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
105
105
  height: PropTypes.number,
106
106
  /**
107
107
  * Indicate which axis to display the left of the charts.
108
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`
108
+ * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
109
109
  * @default yAxisIds[0] The id of the first provided axis
110
110
  */
111
111
  leftAxis: PropTypes.oneOfType([PropTypes.shape({
@@ -145,7 +145,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
145
145
  }),
146
146
  /**
147
147
  * Indicate which axis to display the right of the charts.
148
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`
148
+ * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
149
149
  * @default null
150
150
  */
151
151
  rightAxis: PropTypes.oneOfType([PropTypes.shape({
@@ -188,7 +188,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
188
188
  }),
189
189
  /**
190
190
  * Indicate which axis to display the top of the charts.
191
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`
191
+ * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
192
192
  * @default null
193
193
  */
194
194
  topAxis: PropTypes.oneOfType([PropTypes.shape({
@@ -71,7 +71,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
71
71
  // ----------------------------------------------------------------------
72
72
  /**
73
73
  * Indicate which axis to display the bottom of the charts.
74
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`
74
+ * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
75
75
  * @default xAxisIds[0] The id of the first provided axis
76
76
  */
77
77
  bottomAxis: PropTypes.oneOfType([PropTypes.shape({
@@ -89,7 +89,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
89
89
  }), PropTypes.string]),
90
90
  /**
91
91
  * Indicate which axis to display the left of the charts.
92
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`
92
+ * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
93
93
  * @default yAxisIds[0] The id of the first provided axis
94
94
  */
95
95
  leftAxis: PropTypes.oneOfType([PropTypes.shape({
@@ -107,7 +107,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
107
107
  }), PropTypes.string]),
108
108
  /**
109
109
  * Indicate which axis to display the right of the charts.
110
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`
110
+ * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
111
111
  * @default null
112
112
  */
113
113
  rightAxis: PropTypes.oneOfType([PropTypes.shape({
@@ -125,7 +125,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
125
125
  }), PropTypes.string]),
126
126
  /**
127
127
  * Indicate which axis to display the top of the charts.
128
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`
128
+ * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
129
129
  * @default null
130
130
  */
131
131
  topAxis: PropTypes.oneOfType([PropTypes.shape({
@@ -80,7 +80,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
80
80
  }),
81
81
  /**
82
82
  * Indicate which axis to display the bottom of the charts.
83
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`
83
+ * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
84
84
  * @default xAxisIds[0] The id of the first provided axis
85
85
  */
86
86
  bottomAxis: PropTypes.oneOfType([PropTypes.shape({
@@ -107,7 +107,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
107
107
  height: PropTypes.number,
108
108
  /**
109
109
  * Indicate which axis to display the left of the charts.
110
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`
110
+ * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
111
111
  * @default yAxisIds[0] The id of the first provided axis
112
112
  */
113
113
  leftAxis: PropTypes.oneOfType([PropTypes.shape({
@@ -147,7 +147,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
147
147
  }),
148
148
  /**
149
149
  * Indicate which axis to display the right of the charts.
150
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`
150
+ * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
151
151
  * @default null
152
152
  */
153
153
  rightAxis: PropTypes.oneOfType([PropTypes.shape({
@@ -192,7 +192,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
192
192
  }),
193
193
  /**
194
194
  * Indicate which axis to display the top of the charts.
195
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`
195
+ * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
196
196
  * @default null
197
197
  */
198
198
  topAxis: PropTypes.oneOfType([PropTypes.shape({
@@ -82,7 +82,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
82
82
  }),
83
83
  /**
84
84
  * Indicate which axis to display the bottom of the charts.
85
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`
85
+ * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
86
86
  * @default xAxisIds[0] The id of the first provided axis
87
87
  */
88
88
  bottomAxis: PropTypes.oneOfType([PropTypes.shape({
@@ -109,7 +109,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
109
109
  height: PropTypes.number,
110
110
  /**
111
111
  * Indicate which axis to display the left of the charts.
112
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`
112
+ * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
113
113
  * @default yAxisIds[0] The id of the first provided axis
114
114
  */
115
115
  leftAxis: PropTypes.oneOfType([PropTypes.shape({
@@ -149,7 +149,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
149
149
  }),
150
150
  /**
151
151
  * Indicate which axis to display the right of the charts.
152
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`
152
+ * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
153
153
  * @default null
154
154
  */
155
155
  rightAxis: PropTypes.oneOfType([PropTypes.shape({
@@ -214,7 +214,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
214
214
  }),
215
215
  /**
216
216
  * Indicate which axis to display the top of the charts.
217
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`
217
+ * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
218
218
  * @default null
219
219
  */
220
220
  topAxis: PropTypes.oneOfType([PropTypes.shape({
@@ -16,62 +16,48 @@ function Scatter(props) {
16
16
  const {
17
17
  item
18
18
  } = React.useContext(InteractionContext);
19
- const getXPosition = getValueToPositionMapper(xScale);
20
- const getYPosition = getValueToPositionMapper(yScale);
21
19
  const getInteractionItemProps = useInteractionItemProps(series.highlightScope);
22
- const xRange = xScale.range();
23
- const yRange = yScale.range();
24
- const isInRange = ({
25
- x,
26
- y
27
- }) => {
28
- if (x < Math.min(...xRange) || x > Math.max(...xRange)) {
29
- return false;
30
- }
31
- if (y < Math.min(...yRange) || y > Math.max(...yRange)) {
32
- return false;
33
- }
34
- return true;
35
- };
36
- return /*#__PURE__*/_jsx("g", {
37
- children: series.data.map(({
38
- x,
39
- y,
40
- id
41
- }, index) => ({
42
- x: getXPosition(x),
43
- y: getYPosition(y),
44
- id,
45
- dataIndex: index
46
- })).filter(isInRange).map(({
47
- x,
48
- y,
49
- id,
50
- dataIndex
51
- }) => {
52
- const isHighlighted = getIsHighlighted(item, {
53
- type: 'scatter',
54
- seriesId: series.id,
55
- dataIndex
56
- }, series.highlightScope);
57
- const isFaded = !isHighlighted && getIsFaded(item, {
20
+ const cleanData = React.useMemo(() => {
21
+ const getXPosition = getValueToPositionMapper(xScale);
22
+ const getYPosition = getValueToPositionMapper(yScale);
23
+ const xRange = xScale.range();
24
+ const yRange = yScale.range();
25
+ const minXRange = Math.min(...xRange);
26
+ const maxXRange = Math.max(...xRange);
27
+ const minYRange = Math.min(...yRange);
28
+ const maxYRange = Math.max(...yRange);
29
+ const temp = [];
30
+ for (let i = 0; i < series.data.length; i += 1) {
31
+ const scatterPoint = series.data[i];
32
+ const x = getXPosition(scatterPoint.x);
33
+ const y = getYPosition(scatterPoint.y);
34
+ const isInRange = x >= minXRange && x <= maxXRange && y >= minYRange && y <= maxYRange;
35
+ const pointCtx = {
58
36
  type: 'scatter',
59
37
  seriesId: series.id,
60
- dataIndex
61
- }, series.highlightScope);
62
- return /*#__PURE__*/_jsx("circle", _extends({
63
- cx: 0,
64
- cy: 0,
65
- r: markerSize,
66
- transform: `translate(${x}, ${y})`,
67
- fill: color,
68
- opacity: isFaded && 0.3 || 1
69
- }, getInteractionItemProps({
70
- type: 'scatter',
71
- seriesId: series.id,
72
- dataIndex
73
- })), id);
74
- })
38
+ dataIndex: i
39
+ };
40
+ if (isInRange) {
41
+ temp.push({
42
+ x,
43
+ y,
44
+ isFaded: !getIsHighlighted(item, pointCtx, series.highlightScope) && getIsFaded(item, pointCtx, series.highlightScope),
45
+ interactionProps: getInteractionItemProps(pointCtx),
46
+ id: scatterPoint.id
47
+ });
48
+ }
49
+ }
50
+ return temp;
51
+ }, [yScale, xScale, getInteractionItemProps, item, series.data, series.highlightScope, series.id]);
52
+ return /*#__PURE__*/_jsx("g", {
53
+ children: cleanData.map(dataPoint => /*#__PURE__*/_jsx("circle", _extends({
54
+ cx: 0,
55
+ cy: 0,
56
+ r: markerSize,
57
+ transform: `translate(${dataPoint.x}, ${dataPoint.y})`,
58
+ fill: color,
59
+ opacity: dataPoint.isFaded && 0.3 || 1
60
+ }, dataPoint.interactionProps), dataPoint.id))
75
61
  });
76
62
  }
77
63
  process.env.NODE_ENV !== "production" ? Scatter.propTypes = {