@mui/x-charts 6.0.0-alpha.3 → 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.
Files changed (43) hide show
  1. package/BarChart/BarChart.js +4 -4
  2. package/CHANGELOG.md +136 -3
  3. package/ChartsAxis/ChartsAxis.d.ts +4 -4
  4. package/ChartsAxis/ChartsAxis.js +4 -4
  5. package/LineChart/LineChart.js +4 -4
  6. package/LineChart/extremums.js +2 -2
  7. package/PieChart/PieChart.js +4 -4
  8. package/ResponsiveChartContainer/index.js +2 -2
  9. package/ScatterChart/Scatter.js +39 -53
  10. package/ScatterChart/ScatterChart.js +4 -4
  11. package/context/DrawingProvider.d.ts +1 -1
  12. package/context/DrawingProvider.js +1 -1
  13. package/esm/BarChart/BarChart.js +4 -4
  14. package/esm/ChartsAxis/ChartsAxis.js +4 -4
  15. package/esm/LineChart/LineChart.js +4 -4
  16. package/esm/LineChart/extremums.js +2 -2
  17. package/esm/PieChart/PieChart.js +4 -4
  18. package/esm/ResponsiveChartContainer/index.js +2 -2
  19. package/esm/ScatterChart/Scatter.js +39 -53
  20. package/esm/ScatterChart/ScatterChart.js +4 -4
  21. package/esm/context/DrawingProvider.js +1 -1
  22. package/index.js +1 -1
  23. package/legacy/BarChart/BarChart.js +4 -4
  24. package/legacy/ChartsAxis/ChartsAxis.js +4 -4
  25. package/legacy/LineChart/LineChart.js +4 -4
  26. package/legacy/LineChart/extremums.js +3 -3
  27. package/legacy/PieChart/PieChart.js +4 -4
  28. package/legacy/ResponsiveChartContainer/index.js +2 -2
  29. package/legacy/ScatterChart/Scatter.js +35 -46
  30. package/legacy/ScatterChart/ScatterChart.js +4 -4
  31. package/legacy/context/DrawingProvider.js +1 -1
  32. package/legacy/index.js +1 -1
  33. package/modern/BarChart/BarChart.js +4 -4
  34. package/modern/ChartsAxis/ChartsAxis.js +4 -4
  35. package/modern/LineChart/LineChart.js +4 -4
  36. package/modern/LineChart/extremums.js +2 -2
  37. package/modern/PieChart/PieChart.js +4 -4
  38. package/modern/ResponsiveChartContainer/index.js +2 -2
  39. package/modern/ScatterChart/Scatter.js +39 -53
  40. package/modern/ScatterChart/ScatterChart.js +4 -4
  41. package/modern/context/DrawingProvider.js +1 -1
  42. package/modern/index.js +1 -1
  43. package/package.json +22 -5
@@ -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,139 @@
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
+
70
+ ## 6.10.1
71
+
72
+ _Jul 20, 2023_
73
+
74
+ We'd like to offer a big thanks to the 11 contributors who made this release possible. Here are some highlights ✨:
75
+
76
+ - 🎁 Fix CSV export for values containing double quotes
77
+ - 🚀 Improve tree data performance
78
+ - 🐞 Bugfixes
79
+ - 📚 Documentation improvements
80
+
81
+ ### Data Grid
82
+
83
+ #### `@mui/x-data-grid@v6.10.1`
84
+
85
+ - [DataGrid] Filtering performance: compile filter applier with `eval` (#9635) @romgrk
86
+ - [DataGrid] Fix CSV export for values containing double quotes (#9667) @cherniavskii
87
+ - [DataGrid] Fix column type change not working correctly (#9594) @cherniavskii
88
+ - [DataGrid] Fix quick filter `undefined` row error (#9708) @romgrk
89
+ - [DataGrid] Prevent `viewportOuterSize.height` going negative (#9664) @gitstart
90
+ - [DataGrid] Update focused cell on page change via keyboard (#9203) @m4theushw
91
+ - [DataGrid] Wait for remote stylesheets to load before print (#9665) @cherniavskii
92
+
93
+ #### `@mui/x-data-grid-pro@v6.10.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link)
94
+
95
+ Same changes as in `@mui/x-data-grid@v6.10.1`, plus:
96
+
97
+ - [DataGridPro] Improve tree data performance (#9682) @cherniavskii
98
+ - [DataGridPro] Prevent affecting cells from child DataGrid when resizing a column (#9670) @m4theushw
99
+
100
+ #### `@mui/x-data-grid-premium@v6.10.1` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link)
101
+
102
+ Same changes as in `@mui/x-data-grid-pro@v6.10.1`.
103
+
104
+ ### Date Pickers
105
+
106
+ #### `@mui/x-date-pickers@v6.10.1`
107
+
108
+ - [fields] Fix `format` and `value` update order (#9715) @LukasTy
109
+ - [pickers] Remove `require` usage in comment (#9675) @LukasTy
110
+
111
+ #### `@mui/x-date-pickers-pro@v6.10.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link)
112
+
113
+ Same changes as in `@mui/x-date-pickers@v6.10.1`.
114
+
115
+ ### Charts / `@mui/x-charts@v6.0.0-alpha.4`
116
+
117
+ - [charts] Fix blinking in responsive charts and extremums computation for line charts (#9734) @alexfauquette
118
+ - [charts] Use ESM with imports (#9645) @alexfauquette
119
+
120
+ ### Docs
121
+
122
+ - [docs] Add additional note for license key installation on Next.js (#9575) @joserodolfofreitas
123
+ - [docs] Add paragraph about managing focus of custom edit components (#9658) @m4theushw
124
+ - [docs] Add unsorted icon slot to the custom sort icons demo (#9169) @d4rekanguok
125
+ - [docs] Disable ad for onboarding pages (#9700) @oliviertassinari
126
+ - [docs] Disabling ads without toolbar has no effect @oliviertassinari
127
+ - [docs] Fix Date Pickers usage to Title Case (#9680) @richbustos
128
+ - [docs] Fix sorting in `CustomSortIcons` demo (#9656) @MBilalShafi
129
+ - [docs] Improve the UI for pickers introduction (#9644) @alexfauquette
130
+ - [docs] Improve the demo design @oliviertassinari
131
+ - [docs] Localization progress, polish (#9672) @oliviertassinari
132
+ - [docs] Normalize the WIP items (#9671) @oliviertassinari
133
+
134
+ ### Core
135
+
136
+ - [core] Add `validate` command (#9714) @romgrk
137
+ - [CHANGELOG] Update generator to new format @oliviertassinari
138
+
6
139
  ## 6.10.0
7
140
 
8
141
  _Jul 13, 2023_
@@ -26,11 +159,11 @@ We'd like to offer a big thanks to the 10 contributors who made this release pos
26
159
  - [DataGrid] Make `rowExpansionChange` event public (#9611) @MBilalShafi
27
160
  - [l10n] Improve Polish (pl-PL) locale (#9625) @ch1llysense
28
161
 
29
- #### `@mui/x-data-grid-pro@6.10.0`
162
+ #### `@mui/x-data-grid-pro@6.10.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link)
30
163
 
31
164
  Same changes as in `@mui/x-data-grid@6.10.0`.
32
165
 
33
- #### `@mui/x-data-grid-premium@6.10.0`
166
+ #### `@mui/x-data-grid-premium@6.10.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link)
34
167
 
35
168
  Same changes as in `@mui/x-data-grid-pro@6.10.0`.
36
169
 
@@ -41,7 +174,7 @@ Same changes as in `@mui/x-data-grid-pro@6.10.0`.
41
174
  - [pickers] Fix date calendar issues (#9652) @LukasTy
42
175
  - [l10n] Improve Norwegian (nb-NO) locale (#9608) @JosteinBrevik
43
176
 
44
- #### `@mui/x-date-pickers-pro@6.10.0`
177
+ #### `@mui/x-date-pickers-pro@6.10.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link)
45
178
 
46
179
  Same changes as in `@mui/x-date-pickers@6.10.0`.
47
180
 
@@ -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({
@@ -24,8 +24,8 @@ const getExtremumY = params => {
24
24
  const getValues = isArea ? d => d : d => [d[1], d[1]]; // Id area should go from bottom to top, without area should only consider the top
25
25
 
26
26
  const [seriesMin, seriesMax] = series[seriesId].stackedData.reduce((seriesAcc, stackedValue) => {
27
- const [min, max] = getValues(stackedValue);
28
- return [Math.min(min, seriesAcc[0]), Math.max(max, seriesAcc[1])];
27
+ const [base, value] = getValues(stackedValue);
28
+ return [Math.min(base, value, seriesAcc[0]), Math.max(base, value, seriesAcc[1])];
29
29
  }, getValues(series[seriesId].stackedData[0]));
30
30
  if (acc[0] === null || acc[1] === null) {
31
31
  return [seriesMin, seriesMax];
@@ -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({
@@ -30,8 +30,8 @@ const useChartDimensions = (inWidth, inHeight) => {
30
30
  }
31
31
  const win = (0, _ownerWindow.default)(mainEl);
32
32
  const computedStyle = win.getComputedStyle(mainEl);
33
- const newHeight = parseFloat(computedStyle.height) || 0;
34
- const newWidth = parseFloat(computedStyle.width) || 0;
33
+ const newHeight = Math.floor(parseFloat(computedStyle.height)) || 0;
34
+ const newWidth = Math.floor(parseFloat(computedStyle.width)) || 0;
35
35
  setWidth(newWidth);
36
36
  setHeight(newHeight);
37
37
  }, []);
@@ -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({
@@ -18,8 +18,8 @@ export const getExtremumY = params => {
18
18
  const getValues = isArea ? d => d : d => [d[1], d[1]]; // Id area should go from bottom to top, without area should only consider the top
19
19
 
20
20
  const [seriesMin, seriesMax] = series[seriesId].stackedData.reduce((seriesAcc, stackedValue) => {
21
- const [min, max] = getValues(stackedValue);
22
- return [Math.min(min, seriesAcc[0]), Math.max(max, seriesAcc[1])];
21
+ const [base, value] = getValues(stackedValue);
22
+ return [Math.min(base, value, seriesAcc[0]), Math.max(base, value, seriesAcc[1])];
23
23
  }, getValues(series[seriesId].stackedData[0]));
24
24
  if (acc[0] === null || acc[1] === null) {
25
25
  return [seriesMin, seriesMax];