@mui/x-charts 6.0.0-alpha.14 → 6.0.0-alpha.16
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.
- package/BarChart/BarChart.d.ts +16 -2
- package/BarChart/BarChart.js +49 -11
- package/BarChart/BarElement.d.ts +1318 -3
- package/BarChart/BarElement.js +10 -8
- package/BarChart/BarPlot.d.ts +17 -1
- package/BarChart/BarPlot.js +152 -66
- package/CHANGELOG.md +169 -0
- package/ChartContainer/index.js +5 -2
- package/ChartsAxis/ChartsAxis.js +18 -2
- package/ChartsAxis/axisClasses.d.ts +1 -1
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +2 -2
- package/ChartsClipPath/ChartsClipPath.js +2 -2
- package/ChartsLegend/ChartsLegend.d.ts +44 -24
- package/ChartsLegend/ChartsLegend.js +191 -145
- package/ChartsLegend/utils.d.ts +1 -6
- package/ChartsSurface.js +5 -13
- package/ChartsTooltip/ChartsAxisTooltipContent.js +2 -2
- package/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/ChartsTooltip/ChartsTooltip.js +2 -2
- package/ChartsTooltip/utils.js +2 -2
- package/ChartsXAxis/ChartsXAxis.js +151 -40
- package/ChartsYAxis/ChartsYAxis.js +76 -33
- package/LineChart/AreaElement.d.ts +10 -0
- package/LineChart/AreaElement.js +12 -2
- package/LineChart/AreaPlot.d.ts +11 -0
- package/LineChart/AreaPlot.js +13 -2
- package/LineChart/LineChart.d.ts +13 -0
- package/LineChart/LineChart.js +40 -10
- package/LineChart/LineElement.d.ts +10 -0
- package/LineChart/LineElement.js +12 -2
- package/LineChart/LineHighlightElement.d.ts +10 -0
- package/LineChart/LineHighlightElement.js +12 -2
- package/LineChart/LineHighlightPlot.d.ts +10 -0
- package/LineChart/LineHighlightPlot.js +12 -2
- package/LineChart/LinePlot.d.ts +10 -0
- package/LineChart/LinePlot.js +12 -2
- package/LineChart/MarkElement.d.ts +10 -0
- package/LineChart/MarkElement.js +12 -2
- package/LineChart/MarkPlot.d.ts +10 -0
- package/LineChart/MarkPlot.js +12 -2
- package/PieChart/PieArc.js +2 -2
- package/PieChart/PieArcLabel.js +2 -2
- package/PieChart/PieChart.d.ts +13 -0
- package/PieChart/PieChart.js +41 -10
- package/PieChart/PiePlot.d.ts +10 -0
- package/PieChart/PiePlot.js +12 -2
- package/ResponsiveChartContainer/index.js +4 -4
- package/ScatterChart/Scatter.d.ts +10 -0
- package/ScatterChart/Scatter.js +12 -2
- package/ScatterChart/ScatterChart.d.ts +13 -0
- package/ScatterChart/ScatterChart.js +40 -10
- package/ScatterChart/ScatterPlot.d.ts +10 -0
- package/ScatterChart/ScatterPlot.js +12 -2
- package/SparkLineChart/SparkLineChart.d.ts +9 -0
- package/SparkLineChart/SparkLineChart.js +16 -2
- package/constants.js +1 -1
- package/context/CartesianContextProvider.js +20 -12
- package/context/DrawingProvider.d.ts +2 -0
- package/context/DrawingProvider.js +4 -2
- package/context/HighlightProvider.js +2 -2
- package/context/InteractionProvider.js +2 -2
- package/context/SeriesContextProvider.js +2 -2
- package/esm/BarChart/BarChart.js +47 -9
- package/esm/BarChart/BarElement.js +7 -4
- package/esm/BarChart/BarPlot.js +152 -67
- package/esm/ChartContainer/index.js +3 -0
- package/esm/ChartsAxis/ChartsAxis.js +16 -0
- package/esm/ChartsLegend/ChartsLegend.js +188 -142
- package/esm/ChartsSurface.js +3 -11
- package/esm/ChartsXAxis/ChartsXAxis.js +148 -37
- package/esm/ChartsYAxis/ChartsYAxis.js +73 -30
- package/esm/LineChart/AreaElement.js +10 -0
- package/esm/LineChart/AreaPlot.js +11 -0
- package/esm/LineChart/LineChart.js +38 -8
- package/esm/LineChart/LineElement.js +10 -0
- package/esm/LineChart/LineHighlightElement.js +10 -0
- package/esm/LineChart/LineHighlightPlot.js +10 -0
- package/esm/LineChart/LinePlot.js +10 -0
- package/esm/LineChart/MarkElement.js +10 -0
- package/esm/LineChart/MarkPlot.js +10 -0
- package/esm/PieChart/PieChart.js +39 -8
- package/esm/PieChart/PiePlot.js +10 -0
- package/esm/ResponsiveChartContainer/index.js +2 -2
- package/esm/ScatterChart/Scatter.js +10 -0
- package/esm/ScatterChart/ScatterChart.js +38 -8
- package/esm/ScatterChart/ScatterPlot.js +10 -0
- package/esm/SparkLineChart/SparkLineChart.js +14 -0
- package/esm/constants.js +1 -1
- package/esm/context/CartesianContextProvider.js +19 -11
- package/esm/context/DrawingProvider.js +2 -0
- package/esm/hooks/useChartDimensions.js +2 -0
- package/esm/hooks/useMounted.js +16 -0
- package/esm/hooks/useReducedMotion.js +27 -0
- package/esm/hooks/useTicks.js +15 -9
- package/esm/internals/components/AxisSharedComponents.js +15 -70
- package/esm/internals/components/ChartsText.js +75 -0
- package/esm/internals/domUtils.js +113 -0
- package/esm/internals/geometry.js +36 -0
- package/hooks/useAxisEvents.js +2 -2
- package/hooks/useChartDimensions.d.ts +2 -0
- package/hooks/useChartDimensions.js +4 -2
- package/hooks/useDrawingArea.js +2 -2
- package/hooks/useInteractionItemProps.js +2 -2
- package/hooks/useMounted.d.ts +1 -0
- package/hooks/useMounted.js +25 -0
- package/hooks/useReducedMotion.d.ts +8 -0
- package/hooks/useReducedMotion.js +33 -0
- package/hooks/useScale.d.ts +2 -2
- package/hooks/useScale.js +2 -2
- package/hooks/useTicks.d.ts +19 -11
- package/hooks/useTicks.js +18 -12
- package/index.js +1 -1
- package/internals/components/AxisSharedComponents.d.ts +0 -4
- package/internals/components/AxisSharedComponents.js +16 -71
- package/internals/components/ChartsText.d.ts +35 -0
- package/internals/components/ChartsText.js +85 -0
- package/internals/defaultizeColor.d.ts +1 -1
- package/internals/domUtils.d.ts +13 -0
- package/internals/domUtils.js +122 -0
- package/internals/geometry.d.ts +9 -0
- package/internals/geometry.js +42 -0
- package/legacy/BarChart/BarChart.js +47 -9
- package/legacy/BarChart/BarElement.js +6 -3
- package/legacy/BarChart/BarPlot.js +151 -63
- package/legacy/ChartContainer/index.js +3 -0
- package/legacy/ChartsAxis/ChartsAxis.js +16 -0
- package/legacy/ChartsLegend/ChartsLegend.js +203 -140
- package/legacy/ChartsSurface.js +2 -11
- package/legacy/ChartsXAxis/ChartsXAxis.js +152 -39
- package/legacy/ChartsYAxis/ChartsYAxis.js +73 -30
- package/legacy/LineChart/AreaElement.js +10 -0
- package/legacy/LineChart/AreaPlot.js +11 -0
- package/legacy/LineChart/LineChart.js +38 -8
- package/legacy/LineChart/LineElement.js +10 -0
- package/legacy/LineChart/LineHighlightElement.js +10 -0
- package/legacy/LineChart/LineHighlightPlot.js +10 -0
- package/legacy/LineChart/LinePlot.js +10 -0
- package/legacy/LineChart/MarkElement.js +10 -0
- package/legacy/LineChart/MarkPlot.js +10 -0
- package/legacy/PieChart/PieChart.js +39 -8
- package/legacy/PieChart/PiePlot.js +10 -0
- package/legacy/ResponsiveChartContainer/index.js +2 -2
- package/legacy/ScatterChart/Scatter.js +10 -0
- package/legacy/ScatterChart/ScatterChart.js +38 -8
- package/legacy/ScatterChart/ScatterPlot.js +10 -0
- package/legacy/SparkLineChart/SparkLineChart.js +14 -0
- package/legacy/constants.js +1 -1
- package/legacy/context/CartesianContextProvider.js +19 -11
- package/legacy/context/DrawingProvider.js +2 -0
- package/legacy/hooks/useChartDimensions.js +2 -0
- package/legacy/hooks/useMounted.js +21 -0
- package/legacy/hooks/useReducedMotion.js +27 -0
- package/legacy/hooks/useTicks.js +16 -9
- package/legacy/index.js +1 -1
- package/legacy/internals/components/AxisSharedComponents.js +9 -63
- package/legacy/internals/components/ChartsText.js +77 -0
- package/legacy/internals/domUtils.js +121 -0
- package/legacy/internals/geometry.js +37 -0
- package/models/axis.d.ts +25 -7
- package/models/layout.d.ts +7 -6
- package/models/seriesType/line.d.ts +2 -2
- package/modern/BarChart/BarChart.js +47 -9
- package/modern/BarChart/BarElement.js +7 -4
- package/modern/BarChart/BarPlot.js +149 -65
- package/modern/ChartContainer/index.js +3 -0
- package/modern/ChartsAxis/ChartsAxis.js +16 -0
- package/modern/ChartsLegend/ChartsLegend.js +188 -142
- package/modern/ChartsSurface.js +3 -11
- package/modern/ChartsXAxis/ChartsXAxis.js +148 -37
- package/modern/ChartsYAxis/ChartsYAxis.js +73 -30
- package/modern/LineChart/AreaElement.js +10 -0
- package/modern/LineChart/AreaPlot.js +11 -0
- package/modern/LineChart/LineChart.js +38 -8
- package/modern/LineChart/LineElement.js +10 -0
- package/modern/LineChart/LineHighlightElement.js +10 -0
- package/modern/LineChart/LineHighlightPlot.js +10 -0
- package/modern/LineChart/LinePlot.js +10 -0
- package/modern/LineChart/MarkElement.js +10 -0
- package/modern/LineChart/MarkPlot.js +10 -0
- package/modern/PieChart/PieChart.js +39 -8
- package/modern/PieChart/PiePlot.js +10 -0
- package/modern/ResponsiveChartContainer/index.js +2 -2
- package/modern/ScatterChart/Scatter.js +10 -0
- package/modern/ScatterChart/ScatterChart.js +38 -8
- package/modern/ScatterChart/ScatterPlot.js +10 -0
- package/modern/SparkLineChart/SparkLineChart.js +14 -0
- package/modern/constants.js +1 -1
- package/modern/context/CartesianContextProvider.js +19 -11
- package/modern/context/DrawingProvider.js +2 -0
- package/modern/hooks/useChartDimensions.js +2 -0
- package/modern/hooks/useMounted.js +16 -0
- package/modern/hooks/useReducedMotion.js +27 -0
- package/modern/hooks/useTicks.js +15 -9
- package/modern/index.js +1 -1
- package/modern/internals/components/AxisSharedComponents.js +15 -70
- package/modern/internals/components/ChartsText.js +75 -0
- package/modern/internals/domUtils.js +113 -0
- package/modern/internals/geometry.js +36 -0
- package/package.json +5 -3
|
@@ -10,6 +10,16 @@ import { LineElement } from './LineElement';
|
|
|
10
10
|
import { getValueToPositionMapper } from '../hooks/useScale';
|
|
11
11
|
import getCurveFactory from '../internals/getCurve';
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
/**
|
|
14
|
+
* Demos:
|
|
15
|
+
*
|
|
16
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
17
|
+
* - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
|
|
18
|
+
*
|
|
19
|
+
* API:
|
|
20
|
+
*
|
|
21
|
+
* - [LinePlot API](https://mui.com/x/api/charts/line-plot/)
|
|
22
|
+
*/
|
|
13
23
|
function LinePlot(props) {
|
|
14
24
|
const {
|
|
15
25
|
slots,
|
|
@@ -59,6 +59,16 @@ MarkElementPath.propTypes = {
|
|
|
59
59
|
}).isRequired,
|
|
60
60
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
61
61
|
};
|
|
62
|
+
/**
|
|
63
|
+
* Demos:
|
|
64
|
+
*
|
|
65
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
66
|
+
* - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
|
|
67
|
+
*
|
|
68
|
+
* API:
|
|
69
|
+
*
|
|
70
|
+
* - [MarkElement API](https://mui.com/x/api/charts/mark-element/)
|
|
71
|
+
*/
|
|
62
72
|
function MarkElement(props) {
|
|
63
73
|
var _axis$x;
|
|
64
74
|
const {
|
|
@@ -8,6 +8,16 @@ import { CartesianContext } from '../context/CartesianContextProvider';
|
|
|
8
8
|
import { MarkElement } from './MarkElement';
|
|
9
9
|
import { getValueToPositionMapper } from '../hooks/useScale';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
/**
|
|
12
|
+
* Demos:
|
|
13
|
+
*
|
|
14
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
15
|
+
* - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
|
|
16
|
+
*
|
|
17
|
+
* API:
|
|
18
|
+
*
|
|
19
|
+
* - [MarkPlot API](https://mui.com/x/api/charts/mark-plot/)
|
|
20
|
+
*/
|
|
11
21
|
function MarkPlot(props) {
|
|
12
22
|
var _slots$mark;
|
|
13
23
|
const {
|
package/esm/PieChart/PieChart.js
CHANGED
|
@@ -16,6 +16,17 @@ const defaultMargin = {
|
|
|
16
16
|
left: 5,
|
|
17
17
|
right: 100
|
|
18
18
|
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Demos:
|
|
22
|
+
*
|
|
23
|
+
* - [Pie](https://mui.com/x/react-charts/pie/)
|
|
24
|
+
* - [Pie demonstration](https://mui.com/x/react-charts/pie-demo/)
|
|
25
|
+
*
|
|
26
|
+
* API:
|
|
27
|
+
*
|
|
28
|
+
* - [PieChart API](https://mui.com/x/api/charts/pie-chart/)
|
|
29
|
+
*/
|
|
19
30
|
function PieChart(props) {
|
|
20
31
|
const {
|
|
21
32
|
xAxis,
|
|
@@ -105,11 +116,15 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
105
116
|
fill: PropTypes.string,
|
|
106
117
|
label: PropTypes.string,
|
|
107
118
|
labelFontSize: PropTypes.number,
|
|
119
|
+
labelStyle: PropTypes.object,
|
|
108
120
|
position: PropTypes.oneOf(['bottom', 'top']),
|
|
109
121
|
slotProps: PropTypes.object,
|
|
110
122
|
slots: PropTypes.object,
|
|
111
123
|
stroke: PropTypes.string,
|
|
112
124
|
tickFontSize: PropTypes.number,
|
|
125
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
126
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
127
|
+
tickLabelStyle: PropTypes.object,
|
|
113
128
|
tickMaxStep: PropTypes.number,
|
|
114
129
|
tickMinStep: PropTypes.number,
|
|
115
130
|
tickNumber: PropTypes.number,
|
|
@@ -138,33 +153,33 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
138
153
|
fill: PropTypes.string,
|
|
139
154
|
label: PropTypes.string,
|
|
140
155
|
labelFontSize: PropTypes.number,
|
|
156
|
+
labelStyle: PropTypes.object,
|
|
141
157
|
position: PropTypes.oneOf(['left', 'right']),
|
|
142
158
|
slotProps: PropTypes.object,
|
|
143
159
|
slots: PropTypes.object,
|
|
144
160
|
stroke: PropTypes.string,
|
|
145
161
|
tickFontSize: PropTypes.number,
|
|
162
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
163
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
164
|
+
tickLabelStyle: PropTypes.object,
|
|
146
165
|
tickMaxStep: PropTypes.number,
|
|
147
166
|
tickMinStep: PropTypes.number,
|
|
148
167
|
tickNumber: PropTypes.number,
|
|
149
168
|
tickSize: PropTypes.number
|
|
150
169
|
}), PropTypes.string]),
|
|
170
|
+
/**
|
|
171
|
+
* @deprecated Consider using `slotProps.legend` instead.
|
|
172
|
+
*/
|
|
151
173
|
legend: PropTypes.shape({
|
|
152
174
|
classes: PropTypes.object,
|
|
153
175
|
direction: PropTypes.oneOf(['column', 'row']),
|
|
154
176
|
hidden: PropTypes.bool,
|
|
155
|
-
itemWidth: PropTypes.number,
|
|
156
|
-
markSize: PropTypes.number,
|
|
157
|
-
offset: PropTypes.shape({
|
|
158
|
-
x: PropTypes.number,
|
|
159
|
-
y: PropTypes.number
|
|
160
|
-
}),
|
|
161
177
|
position: PropTypes.shape({
|
|
162
178
|
horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
|
|
163
179
|
vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
164
180
|
}),
|
|
165
181
|
slotProps: PropTypes.object,
|
|
166
|
-
slots: PropTypes.object
|
|
167
|
-
spacing: PropTypes.number
|
|
182
|
+
slots: PropTypes.object
|
|
168
183
|
}),
|
|
169
184
|
margin: PropTypes.shape({
|
|
170
185
|
bottom: PropTypes.number,
|
|
@@ -186,11 +201,15 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
186
201
|
fill: PropTypes.string,
|
|
187
202
|
label: PropTypes.string,
|
|
188
203
|
labelFontSize: PropTypes.number,
|
|
204
|
+
labelStyle: PropTypes.object,
|
|
189
205
|
position: PropTypes.oneOf(['left', 'right']),
|
|
190
206
|
slotProps: PropTypes.object,
|
|
191
207
|
slots: PropTypes.object,
|
|
192
208
|
stroke: PropTypes.string,
|
|
193
209
|
tickFontSize: PropTypes.number,
|
|
210
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
211
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
212
|
+
tickLabelStyle: PropTypes.object,
|
|
194
213
|
tickMaxStep: PropTypes.number,
|
|
195
214
|
tickMinStep: PropTypes.number,
|
|
196
215
|
tickNumber: PropTypes.number,
|
|
@@ -264,11 +283,15 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
264
283
|
fill: PropTypes.string,
|
|
265
284
|
label: PropTypes.string,
|
|
266
285
|
labelFontSize: PropTypes.number,
|
|
286
|
+
labelStyle: PropTypes.object,
|
|
267
287
|
position: PropTypes.oneOf(['bottom', 'top']),
|
|
268
288
|
slotProps: PropTypes.object,
|
|
269
289
|
slots: PropTypes.object,
|
|
270
290
|
stroke: PropTypes.string,
|
|
271
291
|
tickFontSize: PropTypes.number,
|
|
292
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
293
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
294
|
+
tickLabelStyle: PropTypes.object,
|
|
272
295
|
tickMaxStep: PropTypes.number,
|
|
273
296
|
tickMinStep: PropTypes.number,
|
|
274
297
|
tickNumber: PropTypes.number,
|
|
@@ -293,6 +316,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
293
316
|
id: PropTypes.string,
|
|
294
317
|
label: PropTypes.string,
|
|
295
318
|
labelFontSize: PropTypes.number,
|
|
319
|
+
labelStyle: PropTypes.object,
|
|
296
320
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
297
321
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
298
322
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
@@ -301,6 +325,9 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
301
325
|
slots: PropTypes.object,
|
|
302
326
|
stroke: PropTypes.string,
|
|
303
327
|
tickFontSize: PropTypes.number,
|
|
328
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
329
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
330
|
+
tickLabelStyle: PropTypes.object,
|
|
304
331
|
tickMaxStep: PropTypes.number,
|
|
305
332
|
tickMinStep: PropTypes.number,
|
|
306
333
|
tickNumber: PropTypes.number,
|
|
@@ -319,6 +346,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
319
346
|
id: PropTypes.string,
|
|
320
347
|
label: PropTypes.string,
|
|
321
348
|
labelFontSize: PropTypes.number,
|
|
349
|
+
labelStyle: PropTypes.object,
|
|
322
350
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
323
351
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
324
352
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
@@ -327,6 +355,9 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
327
355
|
slots: PropTypes.object,
|
|
328
356
|
stroke: PropTypes.string,
|
|
329
357
|
tickFontSize: PropTypes.number,
|
|
358
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
359
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
360
|
+
tickLabelStyle: PropTypes.object,
|
|
330
361
|
tickMaxStep: PropTypes.number,
|
|
331
362
|
tickMinStep: PropTypes.number,
|
|
332
363
|
tickNumber: PropTypes.number,
|
package/esm/PieChart/PiePlot.js
CHANGED
|
@@ -23,6 +23,16 @@ function getItemLabel(arcLabel, arcLabelMinAngle, item) {
|
|
|
23
23
|
}
|
|
24
24
|
return arcLabel(item);
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Demos:
|
|
28
|
+
*
|
|
29
|
+
* - [Pie](https://mui.com/x/react-charts/pie/)
|
|
30
|
+
* - [Pie demonstration](https://mui.com/x/react-charts/pie-demo/)
|
|
31
|
+
*
|
|
32
|
+
* API:
|
|
33
|
+
*
|
|
34
|
+
* - [PiePlot API](https://mui.com/x/api/charts/pie-plot/)
|
|
35
|
+
*/
|
|
26
36
|
function PiePlot(props) {
|
|
27
37
|
var _slots$pieArc, _slots$pieArcLabel;
|
|
28
38
|
const {
|
|
@@ -106,10 +106,10 @@ export const ResponsiveChartContainer = /*#__PURE__*/React.forwardRef(function R
|
|
|
106
106
|
width: inWidth,
|
|
107
107
|
height: inHeight
|
|
108
108
|
},
|
|
109
|
-
children: /*#__PURE__*/_jsx(ChartContainer, _extends({}, other, {
|
|
109
|
+
children: width && height ? /*#__PURE__*/_jsx(ChartContainer, _extends({}, other, {
|
|
110
110
|
width: width,
|
|
111
111
|
height: height,
|
|
112
112
|
ref: ref
|
|
113
|
-
}))
|
|
113
|
+
})) : null
|
|
114
114
|
});
|
|
115
115
|
});
|
|
@@ -5,6 +5,16 @@ import { getValueToPositionMapper } from '../hooks/useScale';
|
|
|
5
5
|
import { getIsFaded, getIsHighlighted, useInteractionItemProps } from '../hooks/useInteractionItemProps';
|
|
6
6
|
import { InteractionContext } from '../context/InteractionProvider';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
/**
|
|
9
|
+
* Demos:
|
|
10
|
+
*
|
|
11
|
+
* - [Scatter](https://mui.com/x/react-charts/scatter/)
|
|
12
|
+
* - [Scatter demonstration](https://mui.com/x/react-charts/scatter-demo/)
|
|
13
|
+
*
|
|
14
|
+
* API:
|
|
15
|
+
*
|
|
16
|
+
* - [Scatter API](https://mui.com/x/api/charts/scatter/)
|
|
17
|
+
*/
|
|
8
18
|
function Scatter(props) {
|
|
9
19
|
const {
|
|
10
20
|
series,
|
|
@@ -9,6 +9,16 @@ import { ChartsLegend } from '../ChartsLegend';
|
|
|
9
9
|
import { ChartsAxisHighlight } from '../ChartsAxisHighlight';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
/**
|
|
13
|
+
* Demos:
|
|
14
|
+
*
|
|
15
|
+
* - [Scatter](https://mui.com/x/react-charts/scatter/)
|
|
16
|
+
* - [Scatter demonstration](https://mui.com/x/react-charts/scatter-demo/)
|
|
17
|
+
*
|
|
18
|
+
* API:
|
|
19
|
+
*
|
|
20
|
+
* - [ScatterChart API](https://mui.com/x/api/charts/scatter-chart/)
|
|
21
|
+
*/
|
|
12
22
|
const ScatterChart = /*#__PURE__*/React.forwardRef(function ScatterChart(props, ref) {
|
|
13
23
|
const {
|
|
14
24
|
xAxis,
|
|
@@ -85,11 +95,15 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
85
95
|
fill: PropTypes.string,
|
|
86
96
|
label: PropTypes.string,
|
|
87
97
|
labelFontSize: PropTypes.number,
|
|
98
|
+
labelStyle: PropTypes.object,
|
|
88
99
|
position: PropTypes.oneOf(['bottom', 'top']),
|
|
89
100
|
slotProps: PropTypes.object,
|
|
90
101
|
slots: PropTypes.object,
|
|
91
102
|
stroke: PropTypes.string,
|
|
92
103
|
tickFontSize: PropTypes.number,
|
|
104
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
105
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
106
|
+
tickLabelStyle: PropTypes.object,
|
|
93
107
|
tickMaxStep: PropTypes.number,
|
|
94
108
|
tickMinStep: PropTypes.number,
|
|
95
109
|
tickNumber: PropTypes.number,
|
|
@@ -118,33 +132,33 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
118
132
|
fill: PropTypes.string,
|
|
119
133
|
label: PropTypes.string,
|
|
120
134
|
labelFontSize: PropTypes.number,
|
|
135
|
+
labelStyle: PropTypes.object,
|
|
121
136
|
position: PropTypes.oneOf(['left', 'right']),
|
|
122
137
|
slotProps: PropTypes.object,
|
|
123
138
|
slots: PropTypes.object,
|
|
124
139
|
stroke: PropTypes.string,
|
|
125
140
|
tickFontSize: PropTypes.number,
|
|
141
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
142
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
143
|
+
tickLabelStyle: PropTypes.object,
|
|
126
144
|
tickMaxStep: PropTypes.number,
|
|
127
145
|
tickMinStep: PropTypes.number,
|
|
128
146
|
tickNumber: PropTypes.number,
|
|
129
147
|
tickSize: PropTypes.number
|
|
130
148
|
}), PropTypes.string]),
|
|
149
|
+
/**
|
|
150
|
+
* @deprecated Consider using `slotProps.legend` instead.
|
|
151
|
+
*/
|
|
131
152
|
legend: PropTypes.shape({
|
|
132
153
|
classes: PropTypes.object,
|
|
133
154
|
direction: PropTypes.oneOf(['column', 'row']),
|
|
134
155
|
hidden: PropTypes.bool,
|
|
135
|
-
itemWidth: PropTypes.number,
|
|
136
|
-
markSize: PropTypes.number,
|
|
137
|
-
offset: PropTypes.shape({
|
|
138
|
-
x: PropTypes.number,
|
|
139
|
-
y: PropTypes.number
|
|
140
|
-
}),
|
|
141
156
|
position: PropTypes.shape({
|
|
142
157
|
horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
|
|
143
158
|
vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
144
159
|
}),
|
|
145
160
|
slotProps: PropTypes.object,
|
|
146
|
-
slots: PropTypes.object
|
|
147
|
-
spacing: PropTypes.number
|
|
161
|
+
slots: PropTypes.object
|
|
148
162
|
}),
|
|
149
163
|
margin: PropTypes.shape({
|
|
150
164
|
bottom: PropTypes.number,
|
|
@@ -165,11 +179,15 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
165
179
|
fill: PropTypes.string,
|
|
166
180
|
label: PropTypes.string,
|
|
167
181
|
labelFontSize: PropTypes.number,
|
|
182
|
+
labelStyle: PropTypes.object,
|
|
168
183
|
position: PropTypes.oneOf(['left', 'right']),
|
|
169
184
|
slotProps: PropTypes.object,
|
|
170
185
|
slots: PropTypes.object,
|
|
171
186
|
stroke: PropTypes.string,
|
|
172
187
|
tickFontSize: PropTypes.number,
|
|
188
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
189
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
190
|
+
tickLabelStyle: PropTypes.object,
|
|
173
191
|
tickMaxStep: PropTypes.number,
|
|
174
192
|
tickMinStep: PropTypes.number,
|
|
175
193
|
tickNumber: PropTypes.number,
|
|
@@ -227,11 +245,15 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
227
245
|
fill: PropTypes.string,
|
|
228
246
|
label: PropTypes.string,
|
|
229
247
|
labelFontSize: PropTypes.number,
|
|
248
|
+
labelStyle: PropTypes.object,
|
|
230
249
|
position: PropTypes.oneOf(['bottom', 'top']),
|
|
231
250
|
slotProps: PropTypes.object,
|
|
232
251
|
slots: PropTypes.object,
|
|
233
252
|
stroke: PropTypes.string,
|
|
234
253
|
tickFontSize: PropTypes.number,
|
|
254
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
255
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
256
|
+
tickLabelStyle: PropTypes.object,
|
|
235
257
|
tickMaxStep: PropTypes.number,
|
|
236
258
|
tickMinStep: PropTypes.number,
|
|
237
259
|
tickNumber: PropTypes.number,
|
|
@@ -256,6 +278,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
256
278
|
id: PropTypes.string,
|
|
257
279
|
label: PropTypes.string,
|
|
258
280
|
labelFontSize: PropTypes.number,
|
|
281
|
+
labelStyle: PropTypes.object,
|
|
259
282
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
260
283
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
261
284
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
@@ -264,6 +287,9 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
264
287
|
slots: PropTypes.object,
|
|
265
288
|
stroke: PropTypes.string,
|
|
266
289
|
tickFontSize: PropTypes.number,
|
|
290
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
291
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
292
|
+
tickLabelStyle: PropTypes.object,
|
|
267
293
|
tickMaxStep: PropTypes.number,
|
|
268
294
|
tickMinStep: PropTypes.number,
|
|
269
295
|
tickNumber: PropTypes.number,
|
|
@@ -282,6 +308,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
282
308
|
id: PropTypes.string,
|
|
283
309
|
label: PropTypes.string,
|
|
284
310
|
labelFontSize: PropTypes.number,
|
|
311
|
+
labelStyle: PropTypes.object,
|
|
285
312
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
286
313
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
287
314
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
@@ -290,6 +317,9 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
290
317
|
slots: PropTypes.object,
|
|
291
318
|
stroke: PropTypes.string,
|
|
292
319
|
tickFontSize: PropTypes.number,
|
|
320
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
321
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
322
|
+
tickLabelStyle: PropTypes.object,
|
|
293
323
|
tickMaxStep: PropTypes.number,
|
|
294
324
|
tickMinStep: PropTypes.number,
|
|
295
325
|
tickNumber: PropTypes.number,
|
|
@@ -5,6 +5,16 @@ import { Scatter } from './Scatter';
|
|
|
5
5
|
import { SeriesContext } from '../context/SeriesContextProvider';
|
|
6
6
|
import { CartesianContext } from '../context/CartesianContextProvider';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
/**
|
|
9
|
+
* Demos:
|
|
10
|
+
*
|
|
11
|
+
* - [Scatter](https://mui.com/x/react-charts/scatter/)
|
|
12
|
+
* - [Scatter demonstration](https://mui.com/x/react-charts/scatter-demo/)
|
|
13
|
+
*
|
|
14
|
+
* API:
|
|
15
|
+
*
|
|
16
|
+
* - [ScatterPlot API](https://mui.com/x/api/charts/scatter-plot/)
|
|
17
|
+
*/
|
|
8
18
|
function ScatterPlot(props) {
|
|
9
19
|
var _slots$scatter;
|
|
10
20
|
const {
|
|
@@ -15,6 +15,16 @@ const SPARKLINE_DEFAULT_MARGIN = {
|
|
|
15
15
|
left: 5,
|
|
16
16
|
right: 5
|
|
17
17
|
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Demos:
|
|
21
|
+
*
|
|
22
|
+
* - [SparkLine](https://mui.com/x/react-charts/sparkline/)
|
|
23
|
+
*
|
|
24
|
+
* API:
|
|
25
|
+
*
|
|
26
|
+
* - [SparkLineChart API](https://mui.com/x/api/charts/spark-line-chart/)
|
|
27
|
+
*/
|
|
18
28
|
const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(props, ref) {
|
|
19
29
|
const {
|
|
20
30
|
xAxis,
|
|
@@ -195,6 +205,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
195
205
|
id: PropTypes.string,
|
|
196
206
|
label: PropTypes.string,
|
|
197
207
|
labelFontSize: PropTypes.number,
|
|
208
|
+
labelStyle: PropTypes.object,
|
|
198
209
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
199
210
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
200
211
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
@@ -203,6 +214,9 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
203
214
|
slots: PropTypes.object,
|
|
204
215
|
stroke: PropTypes.string,
|
|
205
216
|
tickFontSize: PropTypes.number,
|
|
217
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
218
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
219
|
+
tickLabelStyle: PropTypes.object,
|
|
206
220
|
tickMaxStep: PropTypes.number,
|
|
207
221
|
tickMinStep: PropTypes.number,
|
|
208
222
|
tickNumber: PropTypes.number,
|
package/esm/constants.js
CHANGED
|
@@ -10,7 +10,7 @@ import { getScale } from '../internals/getScale';
|
|
|
10
10
|
import { DrawingContext } from './DrawingProvider';
|
|
11
11
|
import { SeriesContext } from './SeriesContextProvider';
|
|
12
12
|
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '../constants';
|
|
13
|
-
import {
|
|
13
|
+
import { getTickNumber } from '../hooks/useTicks';
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
15
|
const DEFAULT_CATEGORY_GAP_RATIO = 0.2;
|
|
16
16
|
const DEFAULT_BAR_GAP_RATIO = 0.1;
|
|
@@ -113,13 +113,13 @@ function CartesianContextProvider({
|
|
|
113
113
|
barGapRatio
|
|
114
114
|
}, axis, {
|
|
115
115
|
scale: scaleBand(axis.data, range).paddingInner(categoryGapRatio).paddingOuter(categoryGapRatio / 2),
|
|
116
|
-
|
|
116
|
+
tickNumber: axis.data.length
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
119
|
if (isPointScaleConfig(axis)) {
|
|
120
120
|
completedXAxis[axis.id] = _extends({}, axis, {
|
|
121
121
|
scale: scalePoint(axis.data, range),
|
|
122
|
-
|
|
122
|
+
tickNumber: axis.data.length
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
125
|
if (axis.scaleType === 'band' || axis.scaleType === 'point') {
|
|
@@ -128,17 +128,17 @@ function CartesianContextProvider({
|
|
|
128
128
|
}
|
|
129
129
|
const scaleType = (_axis$scaleType = axis.scaleType) != null ? _axis$scaleType : 'linear';
|
|
130
130
|
const extremums = [(_axis$min = axis.min) != null ? _axis$min : minData, (_axis$max = axis.max) != null ? _axis$max : maxData];
|
|
131
|
-
const
|
|
131
|
+
const tickNumber = getTickNumber(_extends({}, axis, {
|
|
132
132
|
range,
|
|
133
133
|
domain: extremums
|
|
134
134
|
}));
|
|
135
|
-
const niceScale = getScale(scaleType, extremums, range).nice(
|
|
135
|
+
const niceScale = getScale(scaleType, extremums, range).nice(tickNumber);
|
|
136
136
|
const niceDomain = niceScale.domain();
|
|
137
137
|
const domain = [(_axis$min2 = axis.min) != null ? _axis$min2 : niceDomain[0], (_axis$max2 = axis.max) != null ? _axis$max2 : niceDomain[1]];
|
|
138
138
|
completedXAxis[axis.id] = _extends({}, axis, {
|
|
139
139
|
scaleType,
|
|
140
140
|
scale: niceScale.domain(domain),
|
|
141
|
-
|
|
141
|
+
tickNumber
|
|
142
142
|
});
|
|
143
143
|
});
|
|
144
144
|
const allYAxis = [...((_yAxis$map = yAxis == null ? void 0 : yAxis.map((axis, index) => _extends({
|
|
@@ -163,13 +163,13 @@ function CartesianContextProvider({
|
|
|
163
163
|
barGapRatio: 0
|
|
164
164
|
}, axis, {
|
|
165
165
|
scale: scaleBand(axis.data, [range[1], range[0]]).paddingInner(categoryGapRatio).paddingOuter(categoryGapRatio / 2),
|
|
166
|
-
|
|
166
|
+
tickNumber: axis.data.length
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
169
|
if (isPointScaleConfig(axis)) {
|
|
170
170
|
completedYAxis[axis.id] = _extends({}, axis, {
|
|
171
171
|
scale: scalePoint(axis.data, [range[1], range[0]]),
|
|
172
|
-
|
|
172
|
+
tickNumber: axis.data.length
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
175
|
if (axis.scaleType === 'band' || axis.scaleType === 'point') {
|
|
@@ -178,17 +178,17 @@ function CartesianContextProvider({
|
|
|
178
178
|
}
|
|
179
179
|
const scaleType = (_axis$scaleType2 = axis.scaleType) != null ? _axis$scaleType2 : 'linear';
|
|
180
180
|
const extremums = [(_axis$min3 = axis.min) != null ? _axis$min3 : minData, (_axis$max3 = axis.max) != null ? _axis$max3 : maxData];
|
|
181
|
-
const
|
|
181
|
+
const tickNumber = getTickNumber(_extends({}, axis, {
|
|
182
182
|
range,
|
|
183
183
|
domain: extremums
|
|
184
184
|
}));
|
|
185
|
-
const niceScale = getScale(scaleType, extremums, range).nice(
|
|
185
|
+
const niceScale = getScale(scaleType, extremums, range).nice(tickNumber);
|
|
186
186
|
const niceDomain = niceScale.domain();
|
|
187
187
|
const domain = [(_axis$min4 = axis.min) != null ? _axis$min4 : niceDomain[0], (_axis$max4 = axis.max) != null ? _axis$max4 : niceDomain[1]];
|
|
188
188
|
completedYAxis[axis.id] = _extends({}, axis, {
|
|
189
189
|
scaleType,
|
|
190
190
|
scale: niceScale.domain(domain),
|
|
191
|
-
|
|
191
|
+
tickNumber
|
|
192
192
|
});
|
|
193
193
|
});
|
|
194
194
|
return {
|
|
@@ -228,6 +228,7 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
228
228
|
id: PropTypes.string,
|
|
229
229
|
label: PropTypes.string,
|
|
230
230
|
labelFontSize: PropTypes.number,
|
|
231
|
+
labelStyle: PropTypes.object,
|
|
231
232
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
232
233
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
233
234
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
@@ -236,6 +237,9 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
236
237
|
slots: PropTypes.object,
|
|
237
238
|
stroke: PropTypes.string,
|
|
238
239
|
tickFontSize: PropTypes.number,
|
|
240
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
241
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
242
|
+
tickLabelStyle: PropTypes.object,
|
|
239
243
|
tickMaxStep: PropTypes.number,
|
|
240
244
|
tickMinStep: PropTypes.number,
|
|
241
245
|
tickNumber: PropTypes.number,
|
|
@@ -254,6 +258,7 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
254
258
|
id: PropTypes.string,
|
|
255
259
|
label: PropTypes.string,
|
|
256
260
|
labelFontSize: PropTypes.number,
|
|
261
|
+
labelStyle: PropTypes.object,
|
|
257
262
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
258
263
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
259
264
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
@@ -262,6 +267,9 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
262
267
|
slots: PropTypes.object,
|
|
263
268
|
stroke: PropTypes.string,
|
|
264
269
|
tickFontSize: PropTypes.number,
|
|
270
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
271
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
272
|
+
tickLabelStyle: PropTypes.object,
|
|
265
273
|
tickMaxStep: PropTypes.number,
|
|
266
274
|
tickMinStep: PropTypes.number,
|
|
267
275
|
tickNumber: PropTypes.number,
|
|
@@ -6,6 +6,8 @@ const useChartDimensions = (width, height, margin) => {
|
|
|
6
6
|
const drawingArea = React.useMemo(() => ({
|
|
7
7
|
left: defaultizedMargin.left,
|
|
8
8
|
top: defaultizedMargin.top,
|
|
9
|
+
right: defaultizedMargin.right,
|
|
10
|
+
bottom: defaultizedMargin.bottom,
|
|
9
11
|
width: Math.max(0, width - defaultizedMargin.left - defaultizedMargin.right),
|
|
10
12
|
height: Math.max(0, height - defaultizedMargin.top - defaultizedMargin.bottom)
|
|
11
13
|
}), [width, height, defaultizedMargin.top, defaultizedMargin.bottom, defaultizedMargin.left, defaultizedMargin.right]);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
3
|
+
export function useMounted(defer = false) {
|
|
4
|
+
const [mountedState, setMountedState] = React.useState(false);
|
|
5
|
+
useEnhancedEffect(() => {
|
|
6
|
+
if (!defer) {
|
|
7
|
+
setMountedState(true);
|
|
8
|
+
}
|
|
9
|
+
}, [defer]);
|
|
10
|
+
React.useEffect(() => {
|
|
11
|
+
if (defer) {
|
|
12
|
+
setMountedState(true);
|
|
13
|
+
}
|
|
14
|
+
}, [defer]);
|
|
15
|
+
return mountedState;
|
|
16
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useIsomorphicLayoutEffect, Globals } from '@react-spring/web';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns `boolean` or `null`, used to automatically
|
|
5
|
+
* set skipAnimations to the value of the user's
|
|
6
|
+
* `prefers-reduced-motion` query.
|
|
7
|
+
*
|
|
8
|
+
* The return value, post-effect, is the value of their prefered setting
|
|
9
|
+
*/
|
|
10
|
+
export const useReducedMotion = () => {
|
|
11
|
+
// Taken from: https://github.com/pmndrs/react-spring/blob/02ec877bbfab0df46da0e4a47d5f68d3e731206a/packages/shared/src/hooks/useReducedMotion.ts#L13
|
|
12
|
+
|
|
13
|
+
useIsomorphicLayoutEffect(() => {
|
|
14
|
+
const mql = window.matchMedia('(prefers-reduced-motion)');
|
|
15
|
+
const handleMediaChange = e => {
|
|
16
|
+
Globals.assign({
|
|
17
|
+
// Modification such the react-spring implementation such that this hook can remove animation but never activate animation.
|
|
18
|
+
skipAnimation: e.matches || undefined
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
handleMediaChange(mql);
|
|
22
|
+
mql.addEventListener('change', handleMediaChange);
|
|
23
|
+
return () => {
|
|
24
|
+
mql.removeEventListener('change', handleMediaChange);
|
|
25
|
+
};
|
|
26
|
+
}, []);
|
|
27
|
+
};
|