@mui/x-charts 6.0.0-alpha.15 → 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 +13 -2
- package/BarChart/BarChart.js +45 -3
- 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 +65 -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 +2 -1
- package/ChartsLegend/ChartsLegend.js +12 -8
- package/ChartsSurface.js +2 -2
- 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 +123 -35
- package/ChartsYAxis/ChartsYAxis.js +38 -16
- 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 +10 -0
- package/LineChart/LineChart.js +36 -2
- 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 +10 -0
- package/PieChart/PieChart.js +37 -2
- 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 +10 -0
- package/ScatterChart/ScatterChart.js +36 -2
- 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/context/CartesianContextProvider.js +10 -2
- package/context/DrawingProvider.js +2 -2
- package/context/HighlightProvider.js +2 -2
- package/context/InteractionProvider.js +2 -2
- package/context/SeriesContextProvider.js +2 -2
- package/esm/BarChart/BarChart.js +43 -1
- 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 +10 -6
- package/esm/ChartsXAxis/ChartsXAxis.js +122 -34
- package/esm/ChartsYAxis/ChartsYAxis.js +36 -14
- package/esm/LineChart/AreaElement.js +10 -0
- package/esm/LineChart/AreaPlot.js +11 -0
- package/esm/LineChart/LineChart.js +34 -0
- 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 +35 -0
- 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 +34 -0
- package/esm/ScatterChart/ScatterPlot.js +10 -0
- package/esm/SparkLineChart/SparkLineChart.js +14 -0
- package/esm/context/CartesianContextProvider.js +8 -0
- package/esm/hooks/useMounted.js +16 -0
- package/esm/hooks/useReducedMotion.js +27 -0
- package/esm/hooks/useTicks.js +12 -6
- package/esm/internals/components/ChartsText.js +17 -13
- package/esm/internals/geometry.js +36 -0
- package/hooks/useAxisEvents.js +2 -2
- package/hooks/useChartDimensions.js +2 -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 +18 -9
- package/hooks/useTicks.js +14 -8
- package/index.js +1 -1
- package/internals/components/ChartsText.d.ts +11 -8
- package/internals/components/ChartsText.js +19 -15
- package/internals/defaultizeColor.d.ts +1 -1
- package/internals/domUtils.d.ts +0 -1
- package/internals/geometry.d.ts +9 -0
- package/internals/geometry.js +42 -0
- package/legacy/BarChart/BarChart.js +43 -1
- 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 +14 -7
- package/legacy/ChartsXAxis/ChartsXAxis.js +126 -36
- package/legacy/ChartsYAxis/ChartsYAxis.js +36 -14
- package/legacy/LineChart/AreaElement.js +10 -0
- package/legacy/LineChart/AreaPlot.js +11 -0
- package/legacy/LineChart/LineChart.js +34 -0
- 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 +35 -0
- 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 +34 -0
- package/legacy/ScatterChart/ScatterPlot.js +10 -0
- package/legacy/SparkLineChart/SparkLineChart.js +14 -0
- package/legacy/context/CartesianContextProvider.js +8 -0
- package/legacy/hooks/useMounted.js +21 -0
- package/legacy/hooks/useReducedMotion.js +27 -0
- package/legacy/hooks/useTicks.js +13 -6
- package/legacy/index.js +1 -1
- package/legacy/internals/components/ChartsText.js +15 -15
- package/legacy/internals/geometry.js +37 -0
- package/models/axis.d.ts +19 -2
- package/models/seriesType/line.d.ts +2 -2
- package/modern/BarChart/BarChart.js +43 -1
- 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 +10 -6
- package/modern/ChartsXAxis/ChartsXAxis.js +122 -34
- package/modern/ChartsYAxis/ChartsYAxis.js +36 -14
- package/modern/LineChart/AreaElement.js +10 -0
- package/modern/LineChart/AreaPlot.js +11 -0
- package/modern/LineChart/LineChart.js +34 -0
- 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 +35 -0
- 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 +34 -0
- package/modern/ScatterChart/ScatterPlot.js +10 -0
- package/modern/SparkLineChart/SparkLineChart.js +14 -0
- package/modern/context/CartesianContextProvider.js +8 -0
- package/modern/hooks/useMounted.js +16 -0
- package/modern/hooks/useReducedMotion.js +27 -0
- package/modern/hooks/useTicks.js +12 -6
- package/modern/index.js +1 -1
- package/modern/internals/components/ChartsText.js +17 -13
- package/modern/internals/geometry.js +36 -0
- package/package.json +5 -3
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,11 +153,15 @@ 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,
|
|
@@ -182,11 +201,15 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
182
201
|
fill: PropTypes.string,
|
|
183
202
|
label: PropTypes.string,
|
|
184
203
|
labelFontSize: PropTypes.number,
|
|
204
|
+
labelStyle: PropTypes.object,
|
|
185
205
|
position: PropTypes.oneOf(['left', 'right']),
|
|
186
206
|
slotProps: PropTypes.object,
|
|
187
207
|
slots: PropTypes.object,
|
|
188
208
|
stroke: PropTypes.string,
|
|
189
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,
|
|
190
213
|
tickMaxStep: PropTypes.number,
|
|
191
214
|
tickMinStep: PropTypes.number,
|
|
192
215
|
tickNumber: PropTypes.number,
|
|
@@ -260,11 +283,15 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
260
283
|
fill: PropTypes.string,
|
|
261
284
|
label: PropTypes.string,
|
|
262
285
|
labelFontSize: PropTypes.number,
|
|
286
|
+
labelStyle: PropTypes.object,
|
|
263
287
|
position: PropTypes.oneOf(['bottom', 'top']),
|
|
264
288
|
slotProps: PropTypes.object,
|
|
265
289
|
slots: PropTypes.object,
|
|
266
290
|
stroke: PropTypes.string,
|
|
267
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,
|
|
268
295
|
tickMaxStep: PropTypes.number,
|
|
269
296
|
tickMinStep: PropTypes.number,
|
|
270
297
|
tickNumber: PropTypes.number,
|
|
@@ -289,6 +316,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
289
316
|
id: PropTypes.string,
|
|
290
317
|
label: PropTypes.string,
|
|
291
318
|
labelFontSize: PropTypes.number,
|
|
319
|
+
labelStyle: PropTypes.object,
|
|
292
320
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
293
321
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
294
322
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
@@ -297,6 +325,9 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
297
325
|
slots: PropTypes.object,
|
|
298
326
|
stroke: PropTypes.string,
|
|
299
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,
|
|
300
331
|
tickMaxStep: PropTypes.number,
|
|
301
332
|
tickMinStep: PropTypes.number,
|
|
302
333
|
tickNumber: PropTypes.number,
|
|
@@ -315,6 +346,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
315
346
|
id: PropTypes.string,
|
|
316
347
|
label: PropTypes.string,
|
|
317
348
|
labelFontSize: PropTypes.number,
|
|
349
|
+
labelStyle: PropTypes.object,
|
|
318
350
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
319
351
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
320
352
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
@@ -323,6 +355,9 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
323
355
|
slots: PropTypes.object,
|
|
324
356
|
stroke: PropTypes.string,
|
|
325
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,
|
|
326
361
|
tickMaxStep: PropTypes.number,
|
|
327
362
|
tickMinStep: PropTypes.number,
|
|
328
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,11 +132,15 @@ 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,
|
|
@@ -161,11 +179,15 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
161
179
|
fill: PropTypes.string,
|
|
162
180
|
label: PropTypes.string,
|
|
163
181
|
labelFontSize: PropTypes.number,
|
|
182
|
+
labelStyle: PropTypes.object,
|
|
164
183
|
position: PropTypes.oneOf(['left', 'right']),
|
|
165
184
|
slotProps: PropTypes.object,
|
|
166
185
|
slots: PropTypes.object,
|
|
167
186
|
stroke: PropTypes.string,
|
|
168
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,
|
|
169
191
|
tickMaxStep: PropTypes.number,
|
|
170
192
|
tickMinStep: PropTypes.number,
|
|
171
193
|
tickNumber: PropTypes.number,
|
|
@@ -223,11 +245,15 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
223
245
|
fill: PropTypes.string,
|
|
224
246
|
label: PropTypes.string,
|
|
225
247
|
labelFontSize: PropTypes.number,
|
|
248
|
+
labelStyle: PropTypes.object,
|
|
226
249
|
position: PropTypes.oneOf(['bottom', 'top']),
|
|
227
250
|
slotProps: PropTypes.object,
|
|
228
251
|
slots: PropTypes.object,
|
|
229
252
|
stroke: PropTypes.string,
|
|
230
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,
|
|
231
257
|
tickMaxStep: PropTypes.number,
|
|
232
258
|
tickMinStep: PropTypes.number,
|
|
233
259
|
tickNumber: PropTypes.number,
|
|
@@ -252,6 +278,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
252
278
|
id: PropTypes.string,
|
|
253
279
|
label: PropTypes.string,
|
|
254
280
|
labelFontSize: PropTypes.number,
|
|
281
|
+
labelStyle: PropTypes.object,
|
|
255
282
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
256
283
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
257
284
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
@@ -260,6 +287,9 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
260
287
|
slots: PropTypes.object,
|
|
261
288
|
stroke: PropTypes.string,
|
|
262
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,
|
|
263
293
|
tickMaxStep: PropTypes.number,
|
|
264
294
|
tickMinStep: PropTypes.number,
|
|
265
295
|
tickNumber: PropTypes.number,
|
|
@@ -278,6 +308,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
278
308
|
id: PropTypes.string,
|
|
279
309
|
label: PropTypes.string,
|
|
280
310
|
labelFontSize: PropTypes.number,
|
|
311
|
+
labelStyle: PropTypes.object,
|
|
281
312
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
282
313
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
283
314
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
@@ -286,6 +317,9 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
286
317
|
slots: PropTypes.object,
|
|
287
318
|
stroke: PropTypes.string,
|
|
288
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,
|
|
289
323
|
tickMaxStep: PropTypes.number,
|
|
290
324
|
tickMinStep: PropTypes.number,
|
|
291
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,
|
|
@@ -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,
|
|
@@ -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
|
+
};
|
package/esm/hooks/useTicks.js
CHANGED
|
@@ -17,7 +17,8 @@ function useTicks(options) {
|
|
|
17
17
|
const {
|
|
18
18
|
scale,
|
|
19
19
|
tickNumber,
|
|
20
|
-
valueFormatter
|
|
20
|
+
valueFormatter,
|
|
21
|
+
tickInterval
|
|
21
22
|
} = options;
|
|
22
23
|
return React.useMemo(() => {
|
|
23
24
|
// band scale
|
|
@@ -28,7 +29,8 @@ function useTicks(options) {
|
|
|
28
29
|
return [...domain.map(value => {
|
|
29
30
|
var _valueFormatter;
|
|
30
31
|
return {
|
|
31
|
-
|
|
32
|
+
value,
|
|
33
|
+
formattedValue: (_valueFormatter = valueFormatter == null ? void 0 : valueFormatter(value)) != null ? _valueFormatter : `${value}`,
|
|
32
34
|
offset: scale(value) - (scale.step() - scale.bandwidth()) / 2,
|
|
33
35
|
labelOffset: scale.step() / 2
|
|
34
36
|
};
|
|
@@ -40,23 +42,27 @@ function useTicks(options) {
|
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
// scale type = 'point'
|
|
43
|
-
|
|
45
|
+
const filteredDomain = typeof tickInterval === 'function' && domain.filter(tickInterval) || typeof tickInterval === 'object' && tickInterval || domain;
|
|
46
|
+
return filteredDomain.map(value => {
|
|
44
47
|
var _valueFormatter2;
|
|
45
48
|
return {
|
|
46
|
-
|
|
49
|
+
value,
|
|
50
|
+
formattedValue: (_valueFormatter2 = valueFormatter == null ? void 0 : valueFormatter(value)) != null ? _valueFormatter2 : `${value}`,
|
|
47
51
|
offset: scale(value),
|
|
48
52
|
labelOffset: 0
|
|
49
53
|
};
|
|
50
54
|
});
|
|
51
55
|
}
|
|
52
|
-
|
|
56
|
+
const ticks = typeof tickInterval === 'object' ? tickInterval : scale.ticks(tickNumber);
|
|
57
|
+
return ticks.map(value => {
|
|
53
58
|
var _valueFormatter3;
|
|
54
59
|
return {
|
|
60
|
+
value,
|
|
55
61
|
formattedValue: (_valueFormatter3 = valueFormatter == null ? void 0 : valueFormatter(value)) != null ? _valueFormatter3 : scale.tickFormat(tickNumber)(value),
|
|
56
62
|
offset: scale(value),
|
|
57
63
|
labelOffset: 0
|
|
58
64
|
};
|
|
59
65
|
});
|
|
60
|
-
}, [tickNumber, scale, valueFormatter]);
|
|
66
|
+
}, [tickNumber, scale, valueFormatter, tickInterval]);
|
|
61
67
|
}
|
|
62
68
|
export default useTicks;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["x", "y", "
|
|
3
|
+
const _excluded = ["x", "y", "style", "text", "ownerState"],
|
|
4
|
+
_excluded2 = ["angle", "textAnchor", "dominantBaseline"];
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import { getStringSize } from '../domUtils';
|
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -20,12 +21,17 @@ export function ChartsText(props) {
|
|
|
20
21
|
const {
|
|
21
22
|
x,
|
|
22
23
|
y,
|
|
23
|
-
|
|
24
|
-
dominantBaseline = 'central',
|
|
25
|
-
style,
|
|
24
|
+
style: styleProps,
|
|
26
25
|
text
|
|
27
26
|
} = props,
|
|
28
27
|
textProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
28
|
+
const _ref = styleProps != null ? styleProps : {},
|
|
29
|
+
{
|
|
30
|
+
angle,
|
|
31
|
+
textAnchor,
|
|
32
|
+
dominantBaseline
|
|
33
|
+
} = _ref,
|
|
34
|
+
style = _objectWithoutPropertiesLoose(_ref, _excluded2);
|
|
29
35
|
const wordsByLines = React.useMemo(() => getWordsByLines({
|
|
30
36
|
style,
|
|
31
37
|
needsComputation: text.includes('\n'),
|
|
@@ -43,19 +49,17 @@ export function ChartsText(props) {
|
|
|
43
49
|
startDy = (wordsByLines.length - 1) * -wordsByLines[0].height;
|
|
44
50
|
break;
|
|
45
51
|
}
|
|
46
|
-
|
|
47
|
-
// const transforms = [];
|
|
52
|
+
const transforms = [];
|
|
48
53
|
// if (scaleToFit) {
|
|
49
54
|
// const lineWidth = wordsByLines[0].width;
|
|
50
55
|
// transforms.push(`scale(${(isNumber(width as number) ? (width as number) / lineWidth : 1) / lineWidth})`);
|
|
51
56
|
// }
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
if (angle) {
|
|
58
|
+
transforms.push(`rotate(${angle}, ${x}, ${y})`);
|
|
59
|
+
}
|
|
60
|
+
if (transforms.length) {
|
|
61
|
+
textProps.transform = transforms.join(' ');
|
|
62
|
+
}
|
|
59
63
|
return /*#__PURE__*/_jsx("text", _extends({}, textProps, {
|
|
60
64
|
x: x,
|
|
61
65
|
y: y,
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const ANGLE_APPROX = 5; // Angle (in deg) for which we approximate the rectangle as perfectly horizontal/vertical
|
|
2
|
+
|
|
3
|
+
let warnedOnce = false;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Return the minimal translation along the x-axis to avoid overflow of a rectangle of a given width, height, and rotation.
|
|
7
|
+
* This assumes that all rectangles have the same height and angle between -90 and 90.
|
|
8
|
+
* Otherwise it would be problematic because you need the height/width of the next rectangle to do the correct computation.
|
|
9
|
+
* @param width the side along the x axis.
|
|
10
|
+
* @param height the side along the y axis.
|
|
11
|
+
* @param angle the rotation in degrees.
|
|
12
|
+
*/
|
|
13
|
+
export function getMinXTranslation(width, height, angle = 0) {
|
|
14
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
15
|
+
if (!warnedOnce && angle > 90 && angle < -90) {
|
|
16
|
+
warnedOnce = true;
|
|
17
|
+
console.warn([`MUI X: It seems you applied an angle larger than 90° or smaller than -90° to an axis text.`, `This could cause some text overlapping.`, `If you encounter a use case where it's needed, please open an issue.`].join('\n'));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const standardAngle = Math.min(Math.abs(angle) % 180, Math.abs(Math.abs(angle) % 180 - 180) % 180); // Map from R to [0, 90]
|
|
21
|
+
|
|
22
|
+
if (standardAngle < ANGLE_APPROX) {
|
|
23
|
+
// It's nearly horizontal
|
|
24
|
+
return width;
|
|
25
|
+
}
|
|
26
|
+
if (standardAngle > 90 - ANGLE_APPROX) {
|
|
27
|
+
// It's nearly vertical
|
|
28
|
+
return height;
|
|
29
|
+
}
|
|
30
|
+
const radAngle = standardAngle * Math.PI / 180;
|
|
31
|
+
const angleSwich = Math.atan2(height, width);
|
|
32
|
+
if (radAngle < angleSwich) {
|
|
33
|
+
return width / Math.cos(radAngle);
|
|
34
|
+
}
|
|
35
|
+
return height / Math.sin(radAngle);
|
|
36
|
+
}
|
package/hooks/useAxisEvents.js
CHANGED
|
@@ -9,8 +9,8 @@ var _InteractionProvider = require("../context/InteractionProvider");
|
|
|
9
9
|
var _CartesianContextProvider = require("../context/CartesianContextProvider");
|
|
10
10
|
var _DrawingProvider = require("../context/DrawingProvider");
|
|
11
11
|
var _isBandScale = require("../internals/isBandScale");
|
|
12
|
-
function _getRequireWildcardCache(
|
|
13
|
-
function _interopRequireWildcard(
|
|
12
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
14
|
const useAxisEvents = disableAxisListener => {
|
|
15
15
|
const svgRef = React.useContext(_DrawingProvider.SVGContext);
|
|
16
16
|
const {
|
|
@@ -8,8 +8,8 @@ exports.default = void 0;
|
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _constants = require("../constants");
|
|
11
|
-
function _getRequireWildcardCache(
|
|
12
|
-
function _interopRequireWildcard(
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
13
|
const useChartDimensions = (width, height, margin) => {
|
|
14
14
|
const defaultizedMargin = (0, _extends2.default)({}, _constants.DEFAULT_MARGINS, margin);
|
|
15
15
|
const drawingArea = React.useMemo(() => ({
|
package/hooks/useDrawingArea.js
CHANGED
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useDrawingArea = useDrawingArea;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _DrawingProvider = require("../context/DrawingProvider");
|
|
9
|
-
function _getRequireWildcardCache(
|
|
10
|
-
function _interopRequireWildcard(
|
|
9
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
11
|
function useDrawingArea() {
|
|
12
12
|
const {
|
|
13
13
|
left,
|
|
@@ -7,8 +7,8 @@ exports.useInteractionItemProps = exports.getIsHighlighted = exports.getIsFaded
|
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _InteractionProvider = require("../context/InteractionProvider");
|
|
9
9
|
var _HighlightProvider = require("../context/HighlightProvider");
|
|
10
|
-
function _getRequireWildcardCache(
|
|
11
|
-
function _interopRequireWildcard(
|
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
12
|
const useInteractionItemProps = scope => {
|
|
13
13
|
const {
|
|
14
14
|
dispatch: dispatchInteraction
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useMounted(defer?: boolean): boolean;
|