@mui/x-charts 7.12.1 → 7.13.0
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.js +2 -0
- package/BarChart/extremums.js +5 -3
- package/CHANGELOG.md +81 -0
- package/ChartContainer/ChartContainer.d.ts +3 -3
- package/ChartContainer/ChartContainer.js +4 -2
- package/ChartContainer/useChartContainerProps.d.ts +4 -2
- package/ChartContainer/useChartContainerProps.js +2 -2
- package/ChartContainer/useDefaultizeAxis.d.ts +1 -0
- package/ChartsTooltip/utils.js +4 -2
- package/ChartsXAxis/ChartsXAxis.js +11 -5
- package/ChartsYAxis/ChartsYAxis.js +11 -5
- package/LineChart/AreaPlot.js +11 -1
- package/LineChart/LineChart.js +2 -0
- package/LineChart/extremums.js +4 -15
- package/PieChart/PieChart.js +2 -0
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -0
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.d.ts +1 -1
- package/ScatterChart/ScatterChart.js +2 -0
- package/ScatterChart/extremums.js +6 -14
- package/SparkLineChart/SparkLineChart.js +2 -0
- package/context/CartesianProvider/CartesianProvider.d.ts +3 -3
- package/context/CartesianProvider/CartesianProvider.js +2 -2
- package/context/CartesianProvider/defaultizeAxis.d.ts +1 -0
- package/context/CartesianProvider/getAxisExtremum.js +3 -10
- package/context/PluginProvider/ExtremumGetter.types.d.ts +1 -1
- package/esm/BarChart/BarChart.js +2 -0
- package/esm/BarChart/extremums.js +5 -3
- package/esm/ChartContainer/ChartContainer.js +5 -3
- package/esm/ChartContainer/useChartContainerProps.js +2 -2
- package/esm/ChartsTooltip/utils.js +4 -2
- package/esm/ChartsXAxis/ChartsXAxis.js +11 -5
- package/esm/ChartsYAxis/ChartsYAxis.js +11 -5
- package/esm/LineChart/AreaPlot.js +11 -1
- package/esm/LineChart/LineChart.js +2 -0
- package/esm/LineChart/extremums.js +4 -15
- package/esm/PieChart/PieChart.js +2 -0
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -0
- package/esm/ScatterChart/ScatterChart.js +2 -0
- package/esm/ScatterChart/extremums.js +6 -14
- package/esm/SparkLineChart/SparkLineChart.js +2 -0
- package/esm/context/CartesianProvider/CartesianProvider.js +2 -2
- package/esm/context/CartesianProvider/getAxisExtremum.js +3 -10
- package/esm/hooks/useTicks.js +5 -2
- package/esm/internals/isInfinity.js +3 -0
- package/hooks/useTicks.js +5 -2
- package/index.js +1 -1
- package/internals/defaultizeColor.d.ts +1 -0
- package/internals/isInfinity.d.ts +1 -0
- package/internals/isInfinity.js +9 -0
- package/models/axis.d.ts +2 -0
- package/models/seriesType/line.d.ts +10 -0
- package/modern/BarChart/BarChart.js +2 -0
- package/modern/BarChart/extremums.js +5 -3
- package/modern/ChartContainer/ChartContainer.js +5 -3
- package/modern/ChartContainer/useChartContainerProps.js +2 -2
- package/modern/ChartsTooltip/utils.js +4 -2
- package/modern/ChartsXAxis/ChartsXAxis.js +11 -5
- package/modern/ChartsYAxis/ChartsYAxis.js +11 -5
- package/modern/LineChart/AreaPlot.js +11 -1
- package/modern/LineChart/LineChart.js +2 -0
- package/modern/LineChart/extremums.js +4 -15
- package/modern/PieChart/PieChart.js +2 -0
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -0
- package/modern/ScatterChart/ScatterChart.js +2 -0
- package/modern/ScatterChart/extremums.js +6 -14
- package/modern/SparkLineChart/SparkLineChart.js +2 -0
- package/modern/context/CartesianProvider/CartesianProvider.js +2 -2
- package/modern/context/CartesianProvider/getAxisExtremum.js +3 -10
- package/modern/hooks/useTicks.js +5 -2
- package/modern/index.js +1 -1
- package/modern/internals/isInfinity.js +3 -0
- package/package.json +2 -2
package/BarChart/BarChart.js
CHANGED
|
@@ -282,6 +282,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
282
282
|
slotProps: _propTypes.default.object,
|
|
283
283
|
slots: _propTypes.default.object,
|
|
284
284
|
stroke: _propTypes.default.string,
|
|
285
|
+
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
285
286
|
tickFontSize: _propTypes.default.number,
|
|
286
287
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
287
288
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
@@ -334,6 +335,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
334
335
|
slotProps: _propTypes.default.object,
|
|
335
336
|
slots: _propTypes.default.object,
|
|
336
337
|
stroke: _propTypes.default.string,
|
|
338
|
+
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
337
339
|
tickFontSize: _propTypes.default.number,
|
|
338
340
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
339
341
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
package/BarChart/extremums.js
CHANGED
|
@@ -22,9 +22,11 @@ const getValueExtremum = params => {
|
|
|
22
22
|
const yAxisId = series[seriesId].yAxisId ?? series[seriesId].yAxisKey;
|
|
23
23
|
return yAxisId === axis.id || isDefaultAxis && yAxisId === undefined;
|
|
24
24
|
}).reduce((acc, seriesId) => {
|
|
25
|
-
const [seriesMin, seriesMax] = series[seriesId].stackedData?.reduce((seriesAcc, values) =>
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const [seriesMin, seriesMax] = series[seriesId].stackedData?.reduce((seriesAcc, values) => {
|
|
26
|
+
return [Math.min(...values, seriesAcc[0]), Math.max(...values, seriesAcc[1])];
|
|
27
|
+
}, [Infinity, -Infinity]) ?? [Infinity, -Infinity];
|
|
28
|
+
return [Math.min(seriesMin, acc[0]), Math.max(seriesMax, acc[1])];
|
|
29
|
+
}, [Infinity, -Infinity]);
|
|
28
30
|
};
|
|
29
31
|
const getExtremumX = params => {
|
|
30
32
|
// Notice that bar should be all horizontal or all vertical.
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,87 @@
|
|
|
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
|
+
## 7.13.0
|
|
7
|
+
|
|
8
|
+
_Aug 16, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 💫 Allow to [edit the label](https://mui.com/x/react-tree-view/rich-tree-view/editing/) of Tree View's items.
|
|
13
|
+
|
|
14
|
+
<img width="344" src="https://github.com/user-attachments/assets/1a6cf765-2dc8-4906-bd93-139086eed148" alt="Item label editing" />
|
|
15
|
+
|
|
16
|
+
- 🔧 Improve rows accessibility on the Data Grid features "Tree Data" and "Row Grouping". Certain "Row Grouping" accessibility updates will only be applied if experimental feature flag is enabled. See the [documentation](https://mui.com/x/react-data-grid/row-grouping/#accessibility-changes-in-v8) for more information.
|
|
17
|
+
- 🌍 Improve Vietnamese (vi-VN) locale on the Data Grid
|
|
18
|
+
- 🐞 Bugfixes
|
|
19
|
+
|
|
20
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
21
|
+
|
|
22
|
+
### Data Grid
|
|
23
|
+
|
|
24
|
+
#### `@mui/x-data-grid@7.13.0`
|
|
25
|
+
|
|
26
|
+
- [DataGrid] Fix CSV export for `null` and `undefined` values (#14166) @k-rajat19
|
|
27
|
+
- [DataGrid] Fix error logged during skeleton loading with nested data grid (#14186) @KenanYusuf
|
|
28
|
+
- [DataGrid] Remove needless check in `useGridStateInitialization` (#14181) @k-rajat19
|
|
29
|
+
- [DataGrid] Add recipe for persisting filters in local storage (#14208) @cherniavskii
|
|
30
|
+
- [l10n] Improve Vietnamese (vi-VN) locale (#14216) @hungnd-casso
|
|
31
|
+
|
|
32
|
+
#### `@mui/x-data-grid-pro@7.13.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
33
|
+
|
|
34
|
+
Same changes as in `@mui/x-data-grid@7.13.0`, plus:
|
|
35
|
+
|
|
36
|
+
- [DataGridPro] Fix Tree Data and Row Grouping rows accessibility (#13623) @arminmeh
|
|
37
|
+
|
|
38
|
+
#### `@mui/x-data-grid-premium@7.13.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
39
|
+
|
|
40
|
+
Same changes as in `@mui/x-data-grid-pro@7.13.0`.
|
|
41
|
+
|
|
42
|
+
### Date and Time Pickers
|
|
43
|
+
|
|
44
|
+
#### `@mui/x-date-pickers@7.13.0`
|
|
45
|
+
|
|
46
|
+
- [pickers] Fix date and time merging to retain milliseconds (#14173) @LukasTy
|
|
47
|
+
|
|
48
|
+
#### `@mui/x-date-pickers-pro@7.13.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
49
|
+
|
|
50
|
+
Same changes as in `@mui/x-date-pickers@7.13.0`.
|
|
51
|
+
|
|
52
|
+
### Charts
|
|
53
|
+
|
|
54
|
+
#### `@mui/x-charts@7.13.0`
|
|
55
|
+
|
|
56
|
+
- [charts] Add `baseline` property to the `LineChart` `series` (#14153) @JCQuintas
|
|
57
|
+
- [charts] Fix issue where tooltip would disappear on mouse click (#14187) @alexfauquette
|
|
58
|
+
- [charts] Rename `CartesianContextProvider` to `CartesianProvider` (#14102) @JCQuintas
|
|
59
|
+
- [charts] Support axis with the same value for all data points (#14191) @alexfauquette
|
|
60
|
+
|
|
61
|
+
#### `@mui/x-date-charts-pro@7.0.0-alpha.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
62
|
+
|
|
63
|
+
Same changes as in `@mui/x-charts@7.13.0`.
|
|
64
|
+
|
|
65
|
+
### Tree View
|
|
66
|
+
|
|
67
|
+
#### `@mui/x-tree-view@7.13.0`
|
|
68
|
+
|
|
69
|
+
- [TreeView] Add label editing feature (#13388) @noraleonte
|
|
70
|
+
- [TreeView] Fix the parameters passed for the `canMoveItemToNewPosition` prop (#14176) @flaviendelangle
|
|
71
|
+
|
|
72
|
+
### Docs
|
|
73
|
+
|
|
74
|
+
- [docs] Extract dataset in the Line chart docs (#14034) @alexfauquette
|
|
75
|
+
- [docs] Remove redundant encoding in the mock data source server (#14185) @MBilalShafi
|
|
76
|
+
- [docs] Use Netflix financial results to document bar charts (#13991) @alexfauquette
|
|
77
|
+
- [docs] Remove relience of abbreviations (#14226) @oliviertassinari
|
|
78
|
+
|
|
79
|
+
### Core
|
|
80
|
+
|
|
81
|
+
- [core] Bump monorepo (#14141) @Janpot
|
|
82
|
+
- [core] Fix ESLint issue (#14207) @LukasTy
|
|
83
|
+
- [core] Fix Netlify build cache issue (#14182) @cherniavskii
|
|
84
|
+
- [code-infra] Refactor Netlify `cache-docs` plugin setup (#14105) @LukasTy
|
|
85
|
+
- [internals] Move utils needed for tree view virtualization to shared package (#14202) @flaviendelangle
|
|
86
|
+
|
|
6
87
|
## 7.12.1
|
|
7
88
|
|
|
8
89
|
_Aug 8, 2024_
|
|
@@ -2,12 +2,12 @@ import * as React from 'react';
|
|
|
2
2
|
import { DrawingProviderProps } from '../context/DrawingProvider';
|
|
3
3
|
import { SeriesProviderProps } from '../context/SeriesProvider';
|
|
4
4
|
import { ChartsSurfaceProps } from '../ChartsSurface';
|
|
5
|
-
import {
|
|
5
|
+
import { CartesianProviderProps } from '../context/CartesianProvider';
|
|
6
6
|
import { HighlightedProviderProps, ZAxisContextProviderProps } from '../context';
|
|
7
7
|
import { PluginProviderProps } from '../context/PluginProvider';
|
|
8
8
|
import { AxisConfig, ChartsXAxisProps, ChartsYAxisProps, ScaleName } from '../models/axis';
|
|
9
9
|
import { MakeOptional } from '../models/helpers';
|
|
10
|
-
export type ChartContainerProps = Omit<ChartsSurfaceProps & Omit<SeriesProviderProps, 'seriesFormatters'> & Omit<DrawingProviderProps, 'svgRef'> & Pick<
|
|
10
|
+
export type ChartContainerProps = Omit<ChartsSurfaceProps & Omit<SeriesProviderProps, 'seriesFormatters'> & Omit<DrawingProviderProps, 'svgRef'> & Pick<CartesianProviderProps, 'dataset'> & ZAxisContextProviderProps & HighlightedProviderProps & PluginProviderProps, 'children'> & {
|
|
11
11
|
/**
|
|
12
12
|
* The configuration of the x-axes.
|
|
13
13
|
* If not provided, a default axis config is used.
|
|
@@ -22,7 +22,7 @@ export type ChartContainerProps = Omit<ChartsSurfaceProps & Omit<SeriesProviderP
|
|
|
22
22
|
yAxis?: MakeOptional<AxisConfig<ScaleName, any, ChartsYAxisProps>, 'id'>[];
|
|
23
23
|
children?: React.ReactNode;
|
|
24
24
|
};
|
|
25
|
-
declare const ChartContainer: React.ForwardRefExoticComponent<Omit<ChartsSurfaceProps & Omit<SeriesProviderProps, "seriesFormatters"> & Omit<DrawingProviderProps, "svgRef"> & Pick<
|
|
25
|
+
declare const ChartContainer: React.ForwardRefExoticComponent<Omit<ChartsSurfaceProps & Omit<SeriesProviderProps, "seriesFormatters"> & Omit<DrawingProviderProps, "svgRef"> & Pick<CartesianProviderProps, "dataset"> & ZAxisContextProviderProps & HighlightedProviderProps & PluginProviderProps, "children"> & {
|
|
26
26
|
/**
|
|
27
27
|
* The configuration of the x-axes.
|
|
28
28
|
* If not provided, a default axis config is used.
|
|
@@ -25,7 +25,7 @@ const ChartContainer = exports.ChartContainer = /*#__PURE__*/React.forwardRef(fu
|
|
|
25
25
|
children,
|
|
26
26
|
drawingProviderProps,
|
|
27
27
|
seriesProviderProps,
|
|
28
|
-
|
|
28
|
+
cartesianProviderProps,
|
|
29
29
|
zAxisContextProps,
|
|
30
30
|
highlightedProviderProps,
|
|
31
31
|
chartsSurfaceProps,
|
|
@@ -34,7 +34,7 @@ const ChartContainer = exports.ChartContainer = /*#__PURE__*/React.forwardRef(fu
|
|
|
34
34
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_DrawingProvider.DrawingProvider, (0, _extends2.default)({}, drawingProviderProps, {
|
|
35
35
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PluginProvider.PluginProvider, (0, _extends2.default)({}, pluginProviderProps, {
|
|
36
36
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SeriesProvider.SeriesProvider, (0, _extends2.default)({}, seriesProviderProps, {
|
|
37
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CartesianProvider.
|
|
37
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CartesianProvider.CartesianProvider, (0, _extends2.default)({}, cartesianProviderProps, {
|
|
38
38
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.ZAxisContextProvider, (0, _extends2.default)({}, zAxisContextProps, {
|
|
39
39
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_InteractionProvider.InteractionProvider, {
|
|
40
40
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.HighlightedProvider, (0, _extends2.default)({}, highlightedProviderProps, {
|
|
@@ -164,6 +164,7 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
164
164
|
slotProps: _propTypes.default.object,
|
|
165
165
|
slots: _propTypes.default.object,
|
|
166
166
|
stroke: _propTypes.default.string,
|
|
167
|
+
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
167
168
|
tickFontSize: _propTypes.default.number,
|
|
168
169
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
169
170
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
@@ -216,6 +217,7 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
216
217
|
slotProps: _propTypes.default.object,
|
|
217
218
|
slots: _propTypes.default.object,
|
|
218
219
|
stroke: _propTypes.default.string,
|
|
220
|
+
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
219
221
|
tickFontSize: _propTypes.default.number,
|
|
220
222
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
221
223
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { DrawingProviderProps } from '../context/DrawingProvider';
|
|
3
|
-
import type {
|
|
3
|
+
import type { CartesianProviderProps } from '../context/CartesianProvider';
|
|
4
4
|
import type { SeriesProviderProps } from '../context/SeriesProvider';
|
|
5
5
|
import type { ZAxisContextProviderProps } from '../context/ZAxisContextProvider';
|
|
6
6
|
import type { ChartContainerProps } from './ChartContainer';
|
|
@@ -11,7 +11,7 @@ export declare const useChartContainerProps: (props: ChartContainerProps, ref: R
|
|
|
11
11
|
children: React.ReactNode;
|
|
12
12
|
drawingProviderProps: Omit<DrawingProviderProps, "children">;
|
|
13
13
|
seriesProviderProps: Omit<SeriesProviderProps, "children">;
|
|
14
|
-
|
|
14
|
+
cartesianProviderProps: Omit<CartesianProviderProps, "children">;
|
|
15
15
|
zAxisContextProps: Omit<ZAxisContextProviderProps, "children">;
|
|
16
16
|
highlightedProviderProps: Omit<HighlightedProviderProps, "children">;
|
|
17
17
|
chartsSurfaceProps: ChartsSurfaceProps & {
|
|
@@ -26,6 +26,7 @@ export declare const useChartContainerProps: (props: ChartContainerProps, ref: R
|
|
|
26
26
|
label?: string | undefined;
|
|
27
27
|
max?: (number | Date) | undefined;
|
|
28
28
|
min?: (number | Date) | undefined;
|
|
29
|
+
sx?: import("@mui/system").SxProps | undefined;
|
|
29
30
|
classes?: Partial<import("..").ChartsAxisClasses> | undefined;
|
|
30
31
|
slots?: Partial<import("../internals").ChartsAxisSlots> | undefined;
|
|
31
32
|
slotProps?: Partial<import("../internals").ChartsAxisSlotProps> | undefined;
|
|
@@ -58,6 +59,7 @@ export declare const useChartContainerProps: (props: ChartContainerProps, ref: R
|
|
|
58
59
|
label?: string | undefined;
|
|
59
60
|
max?: (number | Date) | undefined;
|
|
60
61
|
min?: (number | Date) | undefined;
|
|
62
|
+
sx?: import("@mui/system").SxProps | undefined;
|
|
61
63
|
classes?: Partial<import("..").ChartsAxisClasses> | undefined;
|
|
62
64
|
slots?: Partial<import("../internals").ChartsAxisSlots> | undefined;
|
|
63
65
|
slotProps?: Partial<import("../internals").ChartsAxisSlotProps> | undefined;
|
|
@@ -54,7 +54,7 @@ const useChartContainerProps = (props, ref) => {
|
|
|
54
54
|
colors,
|
|
55
55
|
dataset
|
|
56
56
|
};
|
|
57
|
-
const
|
|
57
|
+
const cartesianProviderProps = {
|
|
58
58
|
xAxis: defaultizedXAxis,
|
|
59
59
|
yAxis: defaultizedYAxis,
|
|
60
60
|
dataset
|
|
@@ -80,7 +80,7 @@ const useChartContainerProps = (props, ref) => {
|
|
|
80
80
|
children,
|
|
81
81
|
drawingProviderProps,
|
|
82
82
|
seriesProviderProps,
|
|
83
|
-
|
|
83
|
+
cartesianProviderProps,
|
|
84
84
|
zAxisContextProps,
|
|
85
85
|
highlightedProviderProps,
|
|
86
86
|
chartsSurfaceProps,
|
|
@@ -9,6 +9,7 @@ export declare const useDefaultizeAxis: (inXAxis: MakeOptional<AxisConfig<ScaleN
|
|
|
9
9
|
label?: string | undefined;
|
|
10
10
|
max?: (number | Date) | undefined;
|
|
11
11
|
min?: (number | Date) | undefined;
|
|
12
|
+
sx?: import("@mui/system").SxProps | undefined;
|
|
12
13
|
classes?: Partial<import("..").ChartsAxisClasses> | undefined;
|
|
13
14
|
slots?: Partial<import("../models/axis").ChartsAxisSlots> | undefined;
|
|
14
15
|
slotProps?: Partial<import("../models/axis").ChartsAxisSlotProps> | undefined;
|
package/ChartsTooltip/utils.js
CHANGED
|
@@ -59,8 +59,10 @@ function useMouseTracker() {
|
|
|
59
59
|
if (element === null) {
|
|
60
60
|
return () => {};
|
|
61
61
|
}
|
|
62
|
-
const handleOut =
|
|
63
|
-
|
|
62
|
+
const handleOut = event => {
|
|
63
|
+
if (event.pointerType !== 'mouse') {
|
|
64
|
+
setMousePosition(null);
|
|
65
|
+
}
|
|
64
66
|
};
|
|
65
67
|
const handleMove = event => {
|
|
66
68
|
setMousePosition({
|
|
@@ -21,6 +21,8 @@ var _geometry = require("../internals/geometry");
|
|
|
21
21
|
var _useMounted = require("../hooks/useMounted");
|
|
22
22
|
var _useDrawingArea = require("../hooks/useDrawingArea");
|
|
23
23
|
var _getWordsByLines = require("../internals/getWordsByLines");
|
|
24
|
+
var _isInfinity = require("../internals/isInfinity");
|
|
25
|
+
var _isBandScale = require("../internals/isBandScale");
|
|
24
26
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
27
|
const _excluded = ["scale", "tickNumber", "reverse"];
|
|
26
28
|
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); }
|
|
@@ -146,7 +148,8 @@ function ChartsXAxis(inProps) {
|
|
|
146
148
|
tickInterval,
|
|
147
149
|
tickLabelInterval,
|
|
148
150
|
tickPlacement,
|
|
149
|
-
tickLabelPlacement
|
|
151
|
+
tickLabelPlacement,
|
|
152
|
+
sx
|
|
150
153
|
} = defaultizedProps;
|
|
151
154
|
const theme = (0, _styles.useTheme)();
|
|
152
155
|
const classes = useUtilityClasses((0, _extends2.default)({}, defaultizedProps, {
|
|
@@ -208,15 +211,17 @@ function ChartsXAxis(inProps) {
|
|
|
208
211
|
ownerState: {}
|
|
209
212
|
});
|
|
210
213
|
const domain = xScale.domain();
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
214
|
+
const ordinalAxis = (0, _isBandScale.isBandScale)(xScale);
|
|
215
|
+
// Skip axis rendering if no data is available
|
|
216
|
+
// - The domain is an empty array for band/point scales.
|
|
217
|
+
// - The domains contains Infinity for continuous scales.
|
|
218
|
+
if (ordinalAxis && domain.length === 0 || !ordinalAxis && domain.some(_isInfinity.isInfinity)) {
|
|
215
219
|
return null;
|
|
216
220
|
}
|
|
217
221
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_AxisSharedComponents.AxisRoot, {
|
|
218
222
|
transform: `translate(0, ${position === 'bottom' ? top + height : top})`,
|
|
219
223
|
className: classes.root,
|
|
224
|
+
sx: sx,
|
|
220
225
|
children: [!disableLine && /*#__PURE__*/(0, _jsxRuntime.jsx)(Line, (0, _extends2.default)({
|
|
221
226
|
x1: left,
|
|
222
227
|
x2: left + width,
|
|
@@ -314,6 +319,7 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
|
|
|
314
319
|
* @default 'currentColor'
|
|
315
320
|
*/
|
|
316
321
|
stroke: _propTypes.default.string,
|
|
322
|
+
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
317
323
|
/**
|
|
318
324
|
* The font size of the axis ticks text.
|
|
319
325
|
* @default 12
|
|
@@ -18,6 +18,8 @@ var _useDrawingArea = require("../hooks/useDrawingArea");
|
|
|
18
18
|
var _AxisSharedComponents = require("../internals/components/AxisSharedComponents");
|
|
19
19
|
var _ChartsText = require("../ChartsText");
|
|
20
20
|
var _axisClasses = require("../ChartsAxis/axisClasses");
|
|
21
|
+
var _isInfinity = require("../internals/isInfinity");
|
|
22
|
+
var _isBandScale = require("../internals/isBandScale");
|
|
21
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
24
|
const _excluded = ["scale", "tickNumber"];
|
|
23
25
|
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); }
|
|
@@ -87,7 +89,8 @@ function ChartsYAxis(inProps) {
|
|
|
87
89
|
tickPlacement,
|
|
88
90
|
tickLabelPlacement,
|
|
89
91
|
tickInterval,
|
|
90
|
-
tickLabelInterval
|
|
92
|
+
tickLabelInterval,
|
|
93
|
+
sx
|
|
91
94
|
} = defaultizedProps;
|
|
92
95
|
const theme = (0, _styles.useTheme)();
|
|
93
96
|
const isRTL = theme.direction === 'rtl';
|
|
@@ -154,15 +157,17 @@ function ChartsYAxis(inProps) {
|
|
|
154
157
|
ownerState: {}
|
|
155
158
|
});
|
|
156
159
|
const domain = yScale.domain();
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
160
|
+
const ordinalAxis = (0, _isBandScale.isBandScale)(yScale);
|
|
161
|
+
// Skip axis rendering if no data is available
|
|
162
|
+
// - The domain is an empty array for band/point scales.
|
|
163
|
+
// - The domains contains Infinity for continuous scales.
|
|
164
|
+
if (ordinalAxis && domain.length === 0 || !ordinalAxis && domain.some(_isInfinity.isInfinity)) {
|
|
161
165
|
return null;
|
|
162
166
|
}
|
|
163
167
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_AxisSharedComponents.AxisRoot, {
|
|
164
168
|
transform: `translate(${position === 'right' ? left + width : left}, 0)`,
|
|
165
169
|
className: classes.root,
|
|
170
|
+
sx: sx,
|
|
166
171
|
children: [!disableLine && /*#__PURE__*/(0, _jsxRuntime.jsx)(Line, (0, _extends2.default)({
|
|
167
172
|
y1: top,
|
|
168
173
|
y2: top + height,
|
|
@@ -262,6 +267,7 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
|
|
|
262
267
|
* @default 'currentColor'
|
|
263
268
|
*/
|
|
264
269
|
stroke: _propTypes.default.string,
|
|
270
|
+
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
265
271
|
/**
|
|
266
272
|
* The font size of the axis ticks text.
|
|
267
273
|
* @default 12
|
package/LineChart/AreaPlot.js
CHANGED
|
@@ -51,7 +51,8 @@ const useAggregatedData = () => {
|
|
|
51
51
|
yAxisKey = defaultYAxisId,
|
|
52
52
|
stackedData,
|
|
53
53
|
data,
|
|
54
|
-
connectNulls
|
|
54
|
+
connectNulls,
|
|
55
|
+
baseline
|
|
55
56
|
} = series[seriesId];
|
|
56
57
|
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
57
58
|
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
@@ -68,6 +69,15 @@ const useAggregatedData = () => {
|
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
const areaPath = (0, _d3Shape.area)().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y0(d => {
|
|
72
|
+
if (typeof baseline === 'number') {
|
|
73
|
+
return yScale(baseline);
|
|
74
|
+
}
|
|
75
|
+
if (baseline === 'max') {
|
|
76
|
+
return yScale.range()[1];
|
|
77
|
+
}
|
|
78
|
+
if (baseline === 'min') {
|
|
79
|
+
return yScale.range()[0];
|
|
80
|
+
}
|
|
71
81
|
const value = d.y && yScale(d.y[0]);
|
|
72
82
|
if (Number.isNaN(value)) {
|
|
73
83
|
return yScale.range()[0];
|
package/LineChart/LineChart.js
CHANGED
|
@@ -283,6 +283,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
283
283
|
slotProps: _propTypes.default.object,
|
|
284
284
|
slots: _propTypes.default.object,
|
|
285
285
|
stroke: _propTypes.default.string,
|
|
286
|
+
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
286
287
|
tickFontSize: _propTypes.default.number,
|
|
287
288
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
288
289
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
@@ -335,6 +336,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
335
336
|
slotProps: _propTypes.default.object,
|
|
336
337
|
slots: _propTypes.default.object,
|
|
337
338
|
stroke: _propTypes.default.string,
|
|
339
|
+
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
338
340
|
tickFontSize: _propTypes.default.number,
|
|
339
341
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
340
342
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
package/LineChart/extremums.js
CHANGED
|
@@ -14,16 +14,10 @@ const getExtremumX = params => {
|
|
|
14
14
|
};
|
|
15
15
|
exports.getExtremumX = getExtremumX;
|
|
16
16
|
function getSeriesExtremums(getValues, stackedData) {
|
|
17
|
-
if (stackedData.length === 0) {
|
|
18
|
-
return [null, null];
|
|
19
|
-
}
|
|
20
17
|
return stackedData.reduce((seriesAcc, stackedValue) => {
|
|
21
18
|
const [base, value] = getValues(stackedValue);
|
|
22
|
-
if (seriesAcc[0] === null) {
|
|
23
|
-
return [Math.min(base, value), Math.max(base, value)];
|
|
24
|
-
}
|
|
25
19
|
return [Math.min(base, value, seriesAcc[0]), Math.max(base, value, seriesAcc[1])];
|
|
26
|
-
},
|
|
20
|
+
}, [Infinity, -Infinity]);
|
|
27
21
|
}
|
|
28
22
|
const getExtremumY = params => {
|
|
29
23
|
const {
|
|
@@ -40,17 +34,12 @@ const getExtremumY = params => {
|
|
|
40
34
|
stackedData
|
|
41
35
|
} = series[seriesId];
|
|
42
36
|
const isArea = area !== undefined;
|
|
43
|
-
const getValues = isArea && axis.scaleType !== 'log' ? d => d : d => [d[1], d[1]]; // Since this series is not used to display an area, we do not consider the base (the d[0]).
|
|
44
37
|
|
|
38
|
+
// Since this series is not used to display an area, we do not consider the base (the d[0]).
|
|
39
|
+
const getValues = isArea && axis.scaleType !== 'log' && typeof series[seriesId].baseline !== 'string' ? d => d : d => [d[1], d[1]];
|
|
45
40
|
const seriesExtremums = getSeriesExtremums(getValues, stackedData);
|
|
46
|
-
if (acc[0] === null) {
|
|
47
|
-
return seriesExtremums;
|
|
48
|
-
}
|
|
49
|
-
if (seriesExtremums[0] === null) {
|
|
50
|
-
return acc;
|
|
51
|
-
}
|
|
52
41
|
const [seriesMin, seriesMax] = seriesExtremums;
|
|
53
42
|
return [Math.min(seriesMin, acc[0]), Math.max(seriesMax, acc[1])];
|
|
54
|
-
}, [
|
|
43
|
+
}, [Infinity, -Infinity]);
|
|
55
44
|
};
|
|
56
45
|
exports.getExtremumY = getExtremumY;
|
package/PieChart/PieChart.js
CHANGED
|
@@ -327,6 +327,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
327
327
|
slotProps: _propTypes.default.object,
|
|
328
328
|
slots: _propTypes.default.object,
|
|
329
329
|
stroke: _propTypes.default.string,
|
|
330
|
+
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
330
331
|
tickFontSize: _propTypes.default.number,
|
|
331
332
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
332
333
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
@@ -379,6 +380,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
379
380
|
slotProps: _propTypes.default.object,
|
|
380
381
|
slots: _propTypes.default.object,
|
|
381
382
|
stroke: _propTypes.default.string,
|
|
383
|
+
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
382
384
|
tickFontSize: _propTypes.default.number,
|
|
383
385
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
384
386
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
@@ -139,6 +139,7 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
139
139
|
slotProps: _propTypes.default.object,
|
|
140
140
|
slots: _propTypes.default.object,
|
|
141
141
|
stroke: _propTypes.default.string,
|
|
142
|
+
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
142
143
|
tickFontSize: _propTypes.default.number,
|
|
143
144
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
144
145
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
@@ -191,6 +192,7 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
191
192
|
slotProps: _propTypes.default.object,
|
|
192
193
|
slots: _propTypes.default.object,
|
|
193
194
|
stroke: _propTypes.default.string,
|
|
195
|
+
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
194
196
|
tickFontSize: _propTypes.default.number,
|
|
195
197
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
196
198
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ResponsiveChartContainerProps } from './ResponsiveChartContainer';
|
|
2
2
|
export declare const useResponsiveChartContainerProps: (props: ResponsiveChartContainerProps, ref: React.ForwardedRef<unknown>) => {
|
|
3
3
|
hasIntrinsicSize: number;
|
|
4
|
-
chartContainerProps: Omit<import("..").ChartsSurfaceProps & Omit<import("../internals").SeriesProviderProps, "seriesFormatters"> & Omit<import("../internals").DrawingProviderProps, "svgRef"> & Pick<import("../internals").
|
|
4
|
+
chartContainerProps: Omit<import("..").ChartsSurfaceProps & Omit<import("../internals").SeriesProviderProps, "seriesFormatters"> & Omit<import("../internals").DrawingProviderProps, "svgRef"> & Pick<import("../internals").CartesianProviderProps, "dataset"> & import("..").ZAxisContextProviderProps & import("..").HighlightedProviderProps & import("../internals").PluginProviderProps, "children"> & {
|
|
5
5
|
xAxis?: import("../internals").MakeOptional<import("..").AxisConfig<import("..").ScaleName, any, import("..").ChartsXAxisProps>, "id">[];
|
|
6
6
|
yAxis?: import("../internals").MakeOptional<import("..").AxisConfig<import("..").ScaleName, any, import("..").ChartsYAxisProps>, "id">[];
|
|
7
7
|
children?: import("react").ReactNode;
|
|
@@ -264,6 +264,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
264
264
|
slotProps: _propTypes.default.object,
|
|
265
265
|
slots: _propTypes.default.object,
|
|
266
266
|
stroke: _propTypes.default.string,
|
|
267
|
+
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
267
268
|
tickFontSize: _propTypes.default.number,
|
|
268
269
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
269
270
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
@@ -316,6 +317,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
316
317
|
slotProps: _propTypes.default.object,
|
|
317
318
|
slots: _propTypes.default.object,
|
|
318
319
|
stroke: _propTypes.default.string,
|
|
320
|
+
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
319
321
|
tickFontSize: _propTypes.default.number,
|
|
320
322
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
321
323
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
@@ -5,12 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getExtremumY = exports.getExtremumX = void 0;
|
|
7
7
|
const mergeMinMax = (acc, val) => {
|
|
8
|
-
if (acc[0] === null || acc[1] === null) {
|
|
9
|
-
return val;
|
|
10
|
-
}
|
|
11
|
-
if (val[0] === null || val[1] === null) {
|
|
12
|
-
return acc;
|
|
13
|
-
}
|
|
14
8
|
return [Math.min(acc[0], val[0]), Math.max(acc[1], val[1])];
|
|
15
9
|
};
|
|
16
10
|
const getExtremumX = params => {
|
|
@@ -26,11 +20,10 @@ const getExtremumX = params => {
|
|
|
26
20
|
const seriesMinMax = series[seriesId].data.reduce((accSeries, {
|
|
27
21
|
x
|
|
28
22
|
}) => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}, [null, null]);
|
|
23
|
+
return mergeMinMax(accSeries, [x, x]);
|
|
24
|
+
}, [Infinity, -Infinity]);
|
|
32
25
|
return mergeMinMax(acc, seriesMinMax);
|
|
33
|
-
}, [
|
|
26
|
+
}, [Infinity, -Infinity]);
|
|
34
27
|
};
|
|
35
28
|
exports.getExtremumX = getExtremumX;
|
|
36
29
|
const getExtremumY = params => {
|
|
@@ -46,10 +39,9 @@ const getExtremumY = params => {
|
|
|
46
39
|
const seriesMinMax = series[seriesId].data.reduce((accSeries, {
|
|
47
40
|
y
|
|
48
41
|
}) => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}, [null, null]);
|
|
42
|
+
return mergeMinMax(accSeries, [y, y]);
|
|
43
|
+
}, [Infinity, -Infinity]);
|
|
52
44
|
return mergeMinMax(acc, seriesMinMax);
|
|
53
|
-
}, [
|
|
45
|
+
}, [Infinity, -Infinity]);
|
|
54
46
|
};
|
|
55
47
|
exports.getExtremumY = getExtremumY;
|
|
@@ -288,6 +288,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
288
288
|
slotProps: _propTypes.default.object,
|
|
289
289
|
slots: _propTypes.default.object,
|
|
290
290
|
stroke: _propTypes.default.string,
|
|
291
|
+
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
291
292
|
tickFontSize: _propTypes.default.number,
|
|
292
293
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
293
294
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
@@ -339,6 +340,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
339
340
|
slotProps: _propTypes.default.object,
|
|
340
341
|
slots: _propTypes.default.object,
|
|
341
342
|
stroke: _propTypes.default.string,
|
|
343
|
+
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
342
344
|
tickFontSize: _propTypes.default.number,
|
|
343
345
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
344
346
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { AxisConfig, ChartsXAxisProps, ChartsYAxisProps, ScaleName } from '../../models/axis';
|
|
3
3
|
import { DatasetType } from '../../models/seriesType/config';
|
|
4
|
-
export type
|
|
4
|
+
export type CartesianProviderProps = {
|
|
5
5
|
/**
|
|
6
6
|
* The configuration of the x-axes.
|
|
7
7
|
* If not provided, a default axis config is used.
|
|
@@ -20,5 +20,5 @@ export type CartesianContextProviderProps = {
|
|
|
20
20
|
dataset?: DatasetType;
|
|
21
21
|
children: React.ReactNode;
|
|
22
22
|
};
|
|
23
|
-
declare function
|
|
24
|
-
export {
|
|
23
|
+
declare function CartesianProvider(props: CartesianProviderProps): React.JSX.Element;
|
|
24
|
+
export { CartesianProvider };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.CartesianProvider = CartesianProvider;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _useDrawingArea = require("../../hooks/useDrawingArea");
|
|
9
9
|
var _useSeries = require("../../hooks/useSeries");
|
|
@@ -14,7 +14,7 @@ var _PluginProvider = require("../PluginProvider");
|
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
15
|
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); }
|
|
16
16
|
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 && {}.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; }
|
|
17
|
-
function
|
|
17
|
+
function CartesianProvider(props) {
|
|
18
18
|
const {
|
|
19
19
|
xAxis,
|
|
20
20
|
yAxis,
|
|
@@ -9,6 +9,7 @@ export declare const defaultizeAxis: (inAxis: MakeOptional<AxisConfig<ScaleName,
|
|
|
9
9
|
label?: string | undefined;
|
|
10
10
|
max?: (number | Date) | undefined;
|
|
11
11
|
min?: (number | Date) | undefined;
|
|
12
|
+
sx?: import("@mui/system").SxProps | undefined;
|
|
12
13
|
classes?: Partial<import("../..").ChartsAxisClasses> | undefined;
|
|
13
14
|
slots?: Partial<import("../../models/axis").ChartsAxisSlots> | undefined;
|
|
14
15
|
slotProps?: Partial<import("../../models/axis").ChartsAxisSlotProps> | undefined;
|
|
@@ -11,18 +11,11 @@ const axisExtremumCallback = (acc, chartType, axis, getters, isDefaultAxis, form
|
|
|
11
11
|
series,
|
|
12
12
|
axis,
|
|
13
13
|
isDefaultAxis
|
|
14
|
-
}) ?? [
|
|
15
|
-
|
|
16
|
-
if (minData === null || maxData === null) {
|
|
17
|
-
return [minChartTypeData, maxChartTypeData];
|
|
18
|
-
}
|
|
19
|
-
if (minChartTypeData === null || maxChartTypeData === null) {
|
|
20
|
-
return [minData, maxData];
|
|
21
|
-
}
|
|
22
|
-
return [Math.min(minChartTypeData, minData), Math.max(maxChartTypeData, maxData)];
|
|
14
|
+
}) ?? [Infinity, -Infinity];
|
|
15
|
+
return [Math.min(minChartTypeData, acc[0]), Math.max(maxChartTypeData, acc[1])];
|
|
23
16
|
};
|
|
24
17
|
const getAxisExtremum = (axis, getters, isDefaultAxis, formattedSeries) => {
|
|
25
18
|
const charTypes = Object.keys(getters);
|
|
26
|
-
return charTypes.reduce((acc, charType) => axisExtremumCallback(acc, charType, axis, getters, isDefaultAxis, formattedSeries), [
|
|
19
|
+
return charTypes.reduce((acc, charType) => axisExtremumCallback(acc, charType, axis, getters, isDefaultAxis, formattedSeries), [Infinity, -Infinity]);
|
|
27
20
|
};
|
|
28
21
|
exports.getAxisExtremum = getAxisExtremum;
|