@mui/x-charts 7.22.1 → 8.0.0-alpha.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.d.ts +7 -7
- package/BarChart/BarChart.js +9 -29
- package/BarChart/BarElement.d.ts +1 -1
- package/BarChart/BarLabel/BarLabelItem.d.ts +1 -1
- package/BarChart/BarPlot.js +12 -4
- package/BarChart/extremums.js +3 -3
- package/BarChart/useBarChartProps.d.ts +2 -2
- package/BarChart/useBarChartProps.js +3 -4
- package/CHANGELOG.md +143 -92
- package/ChartContainer/ChartContainer.d.ts +16 -33
- package/ChartContainer/ChartContainer.js +24 -41
- package/{ResponsiveChartContainer → ChartContainer}/ResizableContainer.d.ts +2 -2
- package/{ResponsiveChartContainer → ChartContainer}/useChartContainerDimensions.d.ts +1 -1
- package/{ResponsiveChartContainer → ChartContainer}/useChartContainerDimensions.js +6 -4
- package/ChartContainer/useChartContainerProps.d.ts +11 -86
- package/ChartContainer/useChartContainerProps.js +42 -58
- package/ChartsLegend/ChartsLegend.js +0 -3
- package/ChartsLegend/DefaultChartsLegend.d.ts +0 -5
- package/ChartsLegend/DefaultChartsLegend.js +1 -12
- package/ChartsLegend/LegendPerItem.d.ts +1 -1
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/ChartsOverlay/ChartsOverlay.d.ts +1 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +3 -3
- package/ChartsTooltip/ChartsItemTooltipContent.js +3 -3
- package/ChartsTooltip/ChartsTooltip.js +45 -6
- package/ChartsTooltip/useAxisTooltip.js +3 -3
- package/ChartsTooltip/useItemTooltip.js +3 -3
- package/ChartsTooltip/utils.d.ts +5 -13
- package/ChartsTooltip/utils.js +45 -42
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -5
- package/Gauge/GaugeContainer.js +1 -1
- package/LineChart/AreaElement.d.ts +1 -1
- package/LineChart/AreaPlot.js +2 -6
- package/LineChart/LineChart.d.ts +7 -7
- package/LineChart/LineChart.js +9 -29
- package/LineChart/LineElement.d.ts +1 -1
- package/LineChart/LineHighlightPlot.d.ts +1 -1
- package/LineChart/LineHighlightPlot.js +2 -6
- package/LineChart/LinePlot.js +2 -6
- package/LineChart/MarkPlot.js +2 -6
- package/LineChart/extremums.js +10 -6
- package/LineChart/useLineChartProps.d.ts +2 -2
- package/LineChart/useLineChartProps.js +3 -4
- package/PieChart/PieArc.d.ts +0 -5
- package/PieChart/PieArc.js +1 -10
- package/PieChart/PieArcPlot.js +0 -5
- package/PieChart/PieChart.d.ts +9 -32
- package/PieChart/PieChart.js +19 -102
- package/README.md +2 -2
- package/ScatterChart/ScatterChart.d.ts +7 -7
- package/ScatterChart/ScatterChart.js +9 -29
- package/ScatterChart/ScatterPlot.js +3 -6
- package/ScatterChart/extremums.js +6 -6
- package/ScatterChart/useScatterChartProps.d.ts +2 -2
- package/ScatterChart/useScatterChartProps.js +3 -4
- package/SparkLineChart/SparkLineChart.d.ts +4 -4
- package/SparkLineChart/SparkLineChart.js +4 -2
- package/context/CartesianProvider/defaultizeAxis.d.ts +5 -1
- package/context/ChartDataProvider/ChartDataProvider.d.ts +41 -0
- package/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +48 -27
- package/context/ChartDataProvider/index.d.ts +1 -0
- package/context/ChartDataProvider/index.js +1 -0
- package/context/ChartDataProvider/useChartDataProviderProps.d.ts +97 -0
- package/context/ChartDataProvider/useChartDataProviderProps.js +86 -0
- package/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.d.ts +16 -12
- package/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
- package/context/HighlightedProvider/HighlightedContext.d.ts +0 -8
- package/context/HighlightedProvider/HighlightedProvider.js +1 -16
- package/context/PluginProvider/ExtremumGetter.types.d.ts +2 -2
- package/context/ZAxisContextProvider.d.ts +1 -1
- package/index.d.ts +1 -2
- package/index.js +2 -3
- package/internals/computeAxisValue.js +13 -5
- package/internals/defaultizeColor.d.ts +1 -8
- package/internals/getSymbol.js +19 -3
- package/internals/index.d.ts +5 -5
- package/internals/index.js +5 -5
- package/internals/useStringInterpolator.js +1 -0
- package/models/axis.d.ts +10 -0
- package/models/seriesType/bar.d.ts +1 -1
- package/models/seriesType/common.d.ts +2 -12
- package/models/seriesType/config.d.ts +1 -1
- package/models/seriesType/line.d.ts +1 -1
- package/models/seriesType/pie.d.ts +1 -1
- package/models/seriesType/scatter.d.ts +1 -6
- package/modern/BarChart/BarChart.js +9 -29
- package/modern/BarChart/BarPlot.js +12 -4
- package/modern/BarChart/extremums.js +3 -3
- package/modern/BarChart/useBarChartProps.js +3 -4
- package/modern/ChartContainer/ChartContainer.js +24 -41
- package/modern/{ResponsiveChartContainer → ChartContainer}/useChartContainerDimensions.js +6 -4
- package/modern/ChartContainer/useChartContainerProps.js +42 -58
- package/modern/ChartsLegend/ChartsLegend.js +0 -3
- package/modern/ChartsLegend/DefaultChartsLegend.js +1 -12
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +3 -3
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +3 -3
- package/modern/ChartsTooltip/ChartsTooltip.js +45 -6
- package/modern/ChartsTooltip/useAxisTooltip.js +3 -3
- package/modern/ChartsTooltip/useItemTooltip.js +3 -3
- package/modern/ChartsTooltip/utils.js +45 -42
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -5
- package/modern/Gauge/GaugeContainer.js +1 -1
- package/modern/LineChart/AreaPlot.js +2 -6
- package/modern/LineChart/LineChart.js +9 -29
- package/modern/LineChart/LineHighlightPlot.js +2 -6
- package/modern/LineChart/LinePlot.js +2 -6
- package/modern/LineChart/MarkPlot.js +2 -6
- package/modern/LineChart/extremums.js +10 -6
- package/modern/LineChart/useLineChartProps.js +3 -4
- package/modern/PieChart/PieArc.js +1 -10
- package/modern/PieChart/PieArcPlot.js +0 -5
- package/modern/PieChart/PieChart.js +19 -102
- package/modern/ScatterChart/ScatterChart.js +9 -29
- package/modern/ScatterChart/ScatterPlot.js +3 -6
- package/modern/ScatterChart/extremums.js +6 -6
- package/modern/ScatterChart/useScatterChartProps.js +3 -4
- package/modern/SparkLineChart/SparkLineChart.js +4 -2
- package/modern/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +48 -27
- package/modern/context/ChartDataProvider/index.js +1 -0
- package/modern/context/ChartDataProvider/useChartDataProviderProps.js +86 -0
- package/modern/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
- package/modern/context/HighlightedProvider/HighlightedProvider.js +1 -16
- package/modern/index.js +2 -3
- package/modern/internals/computeAxisValue.js +13 -5
- package/modern/internals/getSymbol.js +19 -3
- package/modern/internals/index.js +5 -5
- package/modern/internals/useStringInterpolator.js +1 -0
- package/node/BarChart/BarChart.js +9 -29
- package/node/BarChart/BarPlot.js +11 -3
- package/node/BarChart/extremums.js +3 -3
- package/node/BarChart/useBarChartProps.js +3 -4
- package/node/ChartContainer/ChartContainer.js +23 -40
- package/node/{ResponsiveChartContainer → ChartContainer}/useChartContainerDimensions.js +6 -4
- package/node/ChartContainer/useChartContainerProps.js +42 -59
- package/node/ChartsLegend/ChartsLegend.js +0 -3
- package/node/ChartsLegend/DefaultChartsLegend.js +1 -12
- package/node/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/node/ChartsTooltip/ChartsAxisTooltipContent.js +3 -3
- package/node/ChartsTooltip/ChartsItemTooltipContent.js +3 -3
- package/node/ChartsTooltip/ChartsTooltip.js +44 -5
- package/node/ChartsTooltip/useAxisTooltip.js +3 -3
- package/node/ChartsTooltip/useItemTooltip.js +3 -3
- package/node/ChartsTooltip/utils.js +46 -44
- package/node/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -5
- package/node/Gauge/GaugeContainer.js +1 -1
- package/node/LineChart/AreaPlot.js +2 -6
- package/node/LineChart/LineChart.js +9 -29
- package/node/LineChart/LineHighlightPlot.js +2 -6
- package/node/LineChart/LinePlot.js +2 -6
- package/node/LineChart/MarkPlot.js +2 -6
- package/node/LineChart/extremums.js +10 -6
- package/node/LineChart/useLineChartProps.js +3 -4
- package/node/PieChart/PieArc.js +1 -10
- package/node/PieChart/PieArcPlot.js +0 -5
- package/node/PieChart/PieChart.js +19 -102
- package/node/ScatterChart/ScatterChart.js +9 -29
- package/node/ScatterChart/ScatterPlot.js +3 -6
- package/node/ScatterChart/extremums.js +6 -6
- package/node/ScatterChart/useScatterChartProps.js +3 -4
- package/node/SparkLineChart/SparkLineChart.js +4 -2
- package/node/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +47 -26
- package/node/context/ChartDataProvider/index.js +16 -0
- package/node/context/ChartDataProvider/useChartDataProviderProps.js +94 -0
- package/node/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
- package/node/context/HighlightedProvider/HighlightedProvider.js +1 -16
- package/node/index.js +5 -16
- package/node/internals/computeAxisValue.js +13 -5
- package/node/internals/getSymbol.js +19 -3
- package/node/internals/index.js +37 -29
- package/node/internals/useStringInterpolator.js +2 -0
- package/package.json +4 -4
- package/ResponsiveChartContainer/ResponsiveChartContainer.d.ts +0 -24
- package/ResponsiveChartContainer/index.d.ts +0 -1
- package/ResponsiveChartContainer/index.js +0 -1
- package/ResponsiveChartContainer/package.json +0 -6
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.d.ts +0 -19
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -70
- package/internals/SlotComponentPropsFromProps.d.ts +0 -1
- package/internals/SlotComponentPropsFromProps.js +0 -1
- package/models/helpers.d.ts +0 -3
- package/models/helpers.js +0 -1
- package/modern/ResponsiveChartContainer/index.js +0 -1
- package/modern/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -70
- package/modern/internals/SlotComponentPropsFromProps.js +0 -1
- package/modern/models/helpers.js +0 -1
- package/node/ResponsiveChartContainer/index.js +0 -16
- package/node/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -77
- package/node/internals/SlotComponentPropsFromProps.js +0 -5
- package/node/models/helpers.js +0 -5
- /package/{ResponsiveChartContainer → ChartContainer}/ResizableContainer.js +0 -0
- /package/modern/{ResponsiveChartContainer → ChartContainer}/ResizableContainer.js +0 -0
- /package/node/{ResponsiveChartContainer → ChartContainer}/ResizableContainer.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MakeOptional } from '
|
|
1
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
2
2
|
import { AxisConfig, ScaleName } from '../../models';
|
|
3
3
|
import { ChartsAxisProps } from '../../models/axis';
|
|
4
4
|
export declare const defaultizeAxis: (inAxis: MakeOptional<AxisConfig<ScaleName, any, ChartsAxisProps>, "id">[] | undefined, axisName: "x" | "y") => {
|
|
@@ -32,5 +32,9 @@ export declare const defaultizeAxis: (inAxis: MakeOptional<AxisConfig<ScaleName,
|
|
|
32
32
|
scaleType?: "linear" | "time" | "log" | "band" | "point" | "pow" | "sqrt" | "utc" | undefined;
|
|
33
33
|
colorMap?: import("../../models/colorMapping").ContinuousColorConfig<number | Date> | import("../../models/colorMapping").PiecewiseColorConfig<number | Date> | import("../../models/colorMapping").OrdinalColorConfig<string | number | Date> | undefined;
|
|
34
34
|
hideTooltip?: boolean | undefined;
|
|
35
|
+
domainLimit?: ("nice" | "strict" | ((min: number, max: number) => {
|
|
36
|
+
min: number;
|
|
37
|
+
max: number;
|
|
38
|
+
})) | undefined;
|
|
35
39
|
id: import("../../internals").AxisId;
|
|
36
40
|
}[];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
3
|
+
import { DrawingProviderProps } from '../DrawingProvider';
|
|
4
|
+
import { SeriesProviderProps } from '../SeriesProvider';
|
|
5
|
+
import { ChartsSurfaceProps } from '../../ChartsSurface';
|
|
6
|
+
import { CartesianProviderProps } from '../CartesianProvider';
|
|
7
|
+
import { HighlightedProviderProps, ZAxisContextProviderProps } from '..';
|
|
8
|
+
import { PluginProviderProps } from '../PluginProvider';
|
|
9
|
+
import { AxisConfig, ChartsXAxisProps, ChartsYAxisProps, ScaleName } from '../../models/axis';
|
|
10
|
+
import { AnimationProviderProps } from '../AnimationProvider';
|
|
11
|
+
export type ChartDataProviderProps = Omit<ChartsSurfaceProps & Omit<SeriesProviderProps, 'seriesFormatters'> & Omit<DrawingProviderProps, 'svgRef'> & Pick<CartesianProviderProps, 'dataset'> & ZAxisContextProviderProps & HighlightedProviderProps & PluginProviderProps & AnimationProviderProps, 'children'> & {
|
|
12
|
+
/**
|
|
13
|
+
* The configuration of the x-axes.
|
|
14
|
+
* If not provided, a default axis config is used.
|
|
15
|
+
* An array of [[AxisConfig]] objects.
|
|
16
|
+
*/
|
|
17
|
+
xAxis?: MakeOptional<AxisConfig<ScaleName, any, ChartsXAxisProps>, 'id'>[];
|
|
18
|
+
/**
|
|
19
|
+
* The configuration of the y-axes.
|
|
20
|
+
* If not provided, a default axis config is used.
|
|
21
|
+
* An array of [[AxisConfig]] objects.
|
|
22
|
+
*/
|
|
23
|
+
yAxis?: MakeOptional<AxisConfig<ScaleName, any, ChartsYAxisProps>, 'id'>[];
|
|
24
|
+
children?: React.ReactNode;
|
|
25
|
+
};
|
|
26
|
+
declare const ChartDataProvider: React.ForwardRefExoticComponent<Omit<ChartsSurfaceProps & Omit<SeriesProviderProps, "seriesFormatters"> & Omit<DrawingProviderProps, "svgRef"> & Pick<CartesianProviderProps, "dataset"> & ZAxisContextProviderProps & HighlightedProviderProps & PluginProviderProps & AnimationProviderProps, "children"> & {
|
|
27
|
+
/**
|
|
28
|
+
* The configuration of the x-axes.
|
|
29
|
+
* If not provided, a default axis config is used.
|
|
30
|
+
* An array of [[AxisConfig]] objects.
|
|
31
|
+
*/
|
|
32
|
+
xAxis?: MakeOptional<AxisConfig<ScaleName, any, ChartsXAxisProps>, "id">[];
|
|
33
|
+
/**
|
|
34
|
+
* The configuration of the y-axes.
|
|
35
|
+
* If not provided, a default axis config is used.
|
|
36
|
+
* An array of [[AxisConfig]] objects.
|
|
37
|
+
*/
|
|
38
|
+
yAxis?: MakeOptional<AxisConfig<ScaleName, any, ChartsYAxisProps>, "id">[];
|
|
39
|
+
children?: React.ReactNode;
|
|
40
|
+
} & React.RefAttributes<SVGSVGElement>>;
|
|
41
|
+
export { ChartDataProvider };
|
|
@@ -3,21 +3,50 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
6
|
+
import { DrawingProvider } from "../DrawingProvider.js";
|
|
7
|
+
import { SeriesProvider } from "../SeriesProvider/index.js";
|
|
8
|
+
import { InteractionProvider } from "../InteractionProvider.js";
|
|
9
|
+
import { ChartsSurface } from "../../ChartsSurface/index.js";
|
|
10
|
+
import { CartesianProvider } from "../CartesianProvider/index.js";
|
|
11
|
+
import { ChartsAxesGradients } from "../../internals/components/ChartsAxesGradients/index.js";
|
|
12
|
+
import { HighlightedProvider, ZAxisContextProvider } from "../index.js";
|
|
13
|
+
import { PluginProvider } from "../PluginProvider/index.js";
|
|
14
|
+
import { useChartDataProviderProps } from "./useChartDataProviderProps.js";
|
|
15
|
+
import { AnimationProvider } from "../AnimationProvider/index.js";
|
|
16
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
+
const ChartDataProvider = /*#__PURE__*/React.forwardRef(function ChartDataProvider(props, ref) {
|
|
11
18
|
const {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
children,
|
|
20
|
+
drawingProviderProps,
|
|
21
|
+
seriesProviderProps,
|
|
22
|
+
cartesianProviderProps,
|
|
23
|
+
zAxisContextProps,
|
|
24
|
+
highlightedProviderProps,
|
|
25
|
+
chartsSurfaceProps,
|
|
26
|
+
pluginProviderProps,
|
|
27
|
+
animationProviderProps
|
|
28
|
+
} = useChartDataProviderProps(props, ref);
|
|
29
|
+
return /*#__PURE__*/_jsx(DrawingProvider, _extends({}, drawingProviderProps, {
|
|
30
|
+
children: /*#__PURE__*/_jsx(PluginProvider, _extends({}, pluginProviderProps, {
|
|
31
|
+
children: /*#__PURE__*/_jsx(SeriesProvider, _extends({}, seriesProviderProps, {
|
|
32
|
+
children: /*#__PURE__*/_jsx(CartesianProvider, _extends({}, cartesianProviderProps, {
|
|
33
|
+
children: /*#__PURE__*/_jsx(ZAxisContextProvider, _extends({}, zAxisContextProps, {
|
|
34
|
+
children: /*#__PURE__*/_jsx(InteractionProvider, {
|
|
35
|
+
children: /*#__PURE__*/_jsx(HighlightedProvider, _extends({}, highlightedProviderProps, {
|
|
36
|
+
children: /*#__PURE__*/_jsx(AnimationProvider, _extends({}, animationProviderProps, {
|
|
37
|
+
children: /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
38
|
+
children: [/*#__PURE__*/_jsx(ChartsAxesGradients, {}), children]
|
|
39
|
+
}))
|
|
40
|
+
}))
|
|
41
|
+
}))
|
|
42
|
+
})
|
|
43
|
+
}))
|
|
44
|
+
}))
|
|
45
|
+
}))
|
|
46
|
+
}))
|
|
18
47
|
}));
|
|
19
48
|
});
|
|
20
|
-
process.env.NODE_ENV !== "production" ?
|
|
49
|
+
process.env.NODE_ENV !== "production" ? ChartDataProvider.propTypes = {
|
|
21
50
|
// ----------------------------- Warning --------------------------------
|
|
22
51
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
23
52
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
@@ -41,9 +70,9 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
41
70
|
*/
|
|
42
71
|
disableAxisListener: PropTypes.bool,
|
|
43
72
|
/**
|
|
44
|
-
* The height of the chart in px.
|
|
73
|
+
* The height of the chart in px.
|
|
45
74
|
*/
|
|
46
|
-
height: PropTypes.number,
|
|
75
|
+
height: PropTypes.number.isRequired,
|
|
47
76
|
/**
|
|
48
77
|
* The item currently highlighted. Turns highlighting into a controlled prop.
|
|
49
78
|
*/
|
|
@@ -74,16 +103,6 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
74
103
|
* If not provided, the container supports line, bar, scatter and pie charts.
|
|
75
104
|
*/
|
|
76
105
|
plugins: PropTypes.arrayOf(PropTypes.object),
|
|
77
|
-
/**
|
|
78
|
-
* The chart will try to wait for the parent container to resolve its size
|
|
79
|
-
* before it renders for the first time.
|
|
80
|
-
*
|
|
81
|
-
* This can be useful in some scenarios where the chart appear to grow after
|
|
82
|
-
* the first render, like when used inside a grid.
|
|
83
|
-
*
|
|
84
|
-
* @default false
|
|
85
|
-
*/
|
|
86
|
-
resolveSizeBeforeRender: PropTypes.bool,
|
|
87
106
|
/**
|
|
88
107
|
* The array of series to display.
|
|
89
108
|
* Each type of series has its own specificity.
|
|
@@ -104,9 +123,9 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
104
123
|
y: PropTypes.number
|
|
105
124
|
}),
|
|
106
125
|
/**
|
|
107
|
-
* The width of the chart in px.
|
|
126
|
+
* The width of the chart in px.
|
|
108
127
|
*/
|
|
109
|
-
width: PropTypes.number,
|
|
128
|
+
width: PropTypes.number.isRequired,
|
|
110
129
|
/**
|
|
111
130
|
* The configuration of the x-axes.
|
|
112
131
|
* If not provided, a default axis config is used.
|
|
@@ -133,6 +152,7 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
133
152
|
dataKey: PropTypes.string,
|
|
134
153
|
disableLine: PropTypes.bool,
|
|
135
154
|
disableTicks: PropTypes.bool,
|
|
155
|
+
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
136
156
|
fill: PropTypes.string,
|
|
137
157
|
hideTooltip: PropTypes.bool,
|
|
138
158
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -186,6 +206,7 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
186
206
|
dataKey: PropTypes.string,
|
|
187
207
|
disableLine: PropTypes.bool,
|
|
188
208
|
disableTicks: PropTypes.bool,
|
|
209
|
+
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
189
210
|
fill: PropTypes.string,
|
|
190
211
|
hideTooltip: PropTypes.bool,
|
|
191
212
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -239,4 +260,4 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
239
260
|
min: PropTypes.number
|
|
240
261
|
}))
|
|
241
262
|
} : void 0;
|
|
242
|
-
export {
|
|
263
|
+
export { ChartDataProvider };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ChartDataProvider';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ChartDataProvider.js";
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { DrawingProviderProps } from '../DrawingProvider';
|
|
3
|
+
import type { CartesianProviderProps } from '../CartesianProvider';
|
|
4
|
+
import type { SeriesProviderProps } from '../SeriesProvider';
|
|
5
|
+
import type { ZAxisContextProviderProps } from '../ZAxisContextProvider';
|
|
6
|
+
import type { ChartDataProviderProps } from './ChartDataProvider';
|
|
7
|
+
import { HighlightedProviderProps } from '..';
|
|
8
|
+
import { ChartsSurfaceProps } from '../../ChartsSurface';
|
|
9
|
+
import { PluginProviderProps } from '../PluginProvider';
|
|
10
|
+
import { AnimationProviderProps } from '../AnimationProvider';
|
|
11
|
+
export declare const useChartDataProviderProps: (props: ChartDataProviderProps, ref: React.Ref<SVGSVGElement>) => {
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
drawingProviderProps: Omit<DrawingProviderProps, "children">;
|
|
14
|
+
seriesProviderProps: Omit<SeriesProviderProps, "children">;
|
|
15
|
+
cartesianProviderProps: Omit<CartesianProviderProps, "children">;
|
|
16
|
+
zAxisContextProps: Omit<ZAxisContextProviderProps, "children">;
|
|
17
|
+
highlightedProviderProps: Omit<HighlightedProviderProps, "children">;
|
|
18
|
+
chartsSurfaceProps: ChartsSurfaceProps & {
|
|
19
|
+
ref: any;
|
|
20
|
+
};
|
|
21
|
+
pluginProviderProps: Omit<PluginProviderProps, "children">;
|
|
22
|
+
animationProviderProps: Omit<AnimationProviderProps, "children">;
|
|
23
|
+
xAxis: {
|
|
24
|
+
reverse?: boolean | undefined;
|
|
25
|
+
fill?: string | undefined;
|
|
26
|
+
stroke?: string | undefined;
|
|
27
|
+
data?: any[] | undefined;
|
|
28
|
+
label?: string | undefined;
|
|
29
|
+
max?: (number | Date) | undefined;
|
|
30
|
+
min?: (number | Date) | undefined;
|
|
31
|
+
valueFormatter?: ((value: any, context: import("../../internals").AxisValueFormatterContext) => string) | undefined;
|
|
32
|
+
dataKey?: string | undefined;
|
|
33
|
+
sx?: import("@mui/system").SxProps | undefined;
|
|
34
|
+
classes?: Partial<import("../..").ChartsAxisClasses> | undefined;
|
|
35
|
+
tickMaxStep?: number | undefined;
|
|
36
|
+
tickMinStep?: number | undefined;
|
|
37
|
+
tickNumber?: number | undefined;
|
|
38
|
+
disableLine?: boolean | undefined;
|
|
39
|
+
disableTicks?: boolean | undefined;
|
|
40
|
+
tickFontSize?: number | undefined;
|
|
41
|
+
tickLabelStyle?: import("../..").ChartsTextProps["style"];
|
|
42
|
+
labelStyle?: import("../..").ChartsTextProps["style"];
|
|
43
|
+
tickLabelInterval?: ("auto" | ((value: any, index: number) => boolean)) | undefined;
|
|
44
|
+
labelFontSize?: number | undefined;
|
|
45
|
+
tickSize?: number | undefined;
|
|
46
|
+
slots?: Partial<import("../../internals").ChartsAxisSlots> | undefined;
|
|
47
|
+
slotProps?: Partial<import("../../internals").ChartsAxisSlotProps> | undefined;
|
|
48
|
+
tickInterval?: ("auto" | ((value: any, index: number) => boolean) | any[]) | undefined;
|
|
49
|
+
tickPlacement?: ("start" | "end" | "middle" | "extremities") | undefined;
|
|
50
|
+
tickLabelPlacement?: ("middle" | "tick") | undefined;
|
|
51
|
+
scaleType?: "linear" | "time" | "log" | "band" | "point" | "pow" | "sqrt" | "utc" | undefined;
|
|
52
|
+
colorMap?: import("../../models/colorMapping").ContinuousColorConfig<number | Date> | import("../../models/colorMapping").PiecewiseColorConfig<number | Date> | import("../../models/colorMapping").OrdinalColorConfig<string | number | Date> | undefined;
|
|
53
|
+
hideTooltip?: boolean | undefined;
|
|
54
|
+
domainLimit?: ("nice" | "strict" | ((min: number, max: number) => {
|
|
55
|
+
min: number;
|
|
56
|
+
max: number;
|
|
57
|
+
})) | undefined;
|
|
58
|
+
id: import("../../internals").AxisId;
|
|
59
|
+
}[];
|
|
60
|
+
yAxis: {
|
|
61
|
+
reverse?: boolean | undefined;
|
|
62
|
+
fill?: string | undefined;
|
|
63
|
+
stroke?: string | undefined;
|
|
64
|
+
data?: any[] | undefined;
|
|
65
|
+
label?: string | undefined;
|
|
66
|
+
max?: (number | Date) | undefined;
|
|
67
|
+
min?: (number | Date) | undefined;
|
|
68
|
+
valueFormatter?: ((value: any, context: import("../../internals").AxisValueFormatterContext) => string) | undefined;
|
|
69
|
+
dataKey?: string | undefined;
|
|
70
|
+
sx?: import("@mui/system").SxProps | undefined;
|
|
71
|
+
classes?: Partial<import("../..").ChartsAxisClasses> | undefined;
|
|
72
|
+
tickMaxStep?: number | undefined;
|
|
73
|
+
tickMinStep?: number | undefined;
|
|
74
|
+
tickNumber?: number | undefined;
|
|
75
|
+
disableLine?: boolean | undefined;
|
|
76
|
+
disableTicks?: boolean | undefined;
|
|
77
|
+
tickFontSize?: number | undefined;
|
|
78
|
+
tickLabelStyle?: import("../..").ChartsTextProps["style"];
|
|
79
|
+
labelStyle?: import("../..").ChartsTextProps["style"];
|
|
80
|
+
tickLabelInterval?: ("auto" | ((value: any, index: number) => boolean)) | undefined;
|
|
81
|
+
labelFontSize?: number | undefined;
|
|
82
|
+
tickSize?: number | undefined;
|
|
83
|
+
slots?: Partial<import("../../internals").ChartsAxisSlots> | undefined;
|
|
84
|
+
slotProps?: Partial<import("../../internals").ChartsAxisSlotProps> | undefined;
|
|
85
|
+
tickInterval?: ("auto" | ((value: any, index: number) => boolean) | any[]) | undefined;
|
|
86
|
+
tickPlacement?: ("start" | "end" | "middle" | "extremities") | undefined;
|
|
87
|
+
tickLabelPlacement?: ("middle" | "tick") | undefined;
|
|
88
|
+
scaleType?: "linear" | "time" | "log" | "band" | "point" | "pow" | "sqrt" | "utc" | undefined;
|
|
89
|
+
colorMap?: import("../../models/colorMapping").ContinuousColorConfig<number | Date> | import("../../models/colorMapping").PiecewiseColorConfig<number | Date> | import("../../models/colorMapping").OrdinalColorConfig<string | number | Date> | undefined;
|
|
90
|
+
hideTooltip?: boolean | undefined;
|
|
91
|
+
domainLimit?: ("nice" | "strict" | ((min: number, max: number) => {
|
|
92
|
+
min: number;
|
|
93
|
+
max: number;
|
|
94
|
+
})) | undefined;
|
|
95
|
+
id: import("../../internals").AxisId;
|
|
96
|
+
}[];
|
|
97
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
+
const _excluded = ["width", "height", "series", "margin", "xAxis", "yAxis", "zAxis", "colors", "dataset", "sx", "title", "desc", "disableAxisListener", "highlightedItem", "onHighlightChange", "plugins", "children", "skipAnimation"];
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import useForkRef from '@mui/utils/useForkRef';
|
|
8
|
+
import { useDefaultizeAxis } from "./useDefaultizeAxis.js";
|
|
9
|
+
export const useChartDataProviderProps = (props, ref) => {
|
|
10
|
+
const {
|
|
11
|
+
width,
|
|
12
|
+
height,
|
|
13
|
+
series,
|
|
14
|
+
margin,
|
|
15
|
+
xAxis,
|
|
16
|
+
yAxis,
|
|
17
|
+
zAxis,
|
|
18
|
+
colors,
|
|
19
|
+
dataset,
|
|
20
|
+
sx,
|
|
21
|
+
title,
|
|
22
|
+
desc,
|
|
23
|
+
disableAxisListener,
|
|
24
|
+
highlightedItem,
|
|
25
|
+
onHighlightChange,
|
|
26
|
+
plugins,
|
|
27
|
+
children,
|
|
28
|
+
skipAnimation
|
|
29
|
+
} = props,
|
|
30
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
31
|
+
const svgRef = React.useRef(null);
|
|
32
|
+
const chartSurfaceRef = useForkRef(ref, svgRef);
|
|
33
|
+
const [defaultizedXAxis, defaultizedYAxis] = useDefaultizeAxis(xAxis, yAxis, dataset);
|
|
34
|
+
const drawingProviderProps = {
|
|
35
|
+
width,
|
|
36
|
+
height,
|
|
37
|
+
margin,
|
|
38
|
+
svgRef
|
|
39
|
+
};
|
|
40
|
+
const animationProviderProps = {
|
|
41
|
+
skipAnimation
|
|
42
|
+
};
|
|
43
|
+
const pluginProviderProps = {
|
|
44
|
+
plugins
|
|
45
|
+
};
|
|
46
|
+
const seriesProviderProps = {
|
|
47
|
+
series,
|
|
48
|
+
colors,
|
|
49
|
+
dataset
|
|
50
|
+
};
|
|
51
|
+
const cartesianProviderProps = {
|
|
52
|
+
xAxis: defaultizedXAxis,
|
|
53
|
+
yAxis: defaultizedYAxis,
|
|
54
|
+
dataset
|
|
55
|
+
};
|
|
56
|
+
const zAxisContextProps = {
|
|
57
|
+
zAxis,
|
|
58
|
+
dataset
|
|
59
|
+
};
|
|
60
|
+
const highlightedProviderProps = {
|
|
61
|
+
highlightedItem,
|
|
62
|
+
onHighlightChange
|
|
63
|
+
};
|
|
64
|
+
const chartsSurfaceProps = _extends({}, other, {
|
|
65
|
+
width,
|
|
66
|
+
height,
|
|
67
|
+
ref: chartSurfaceRef,
|
|
68
|
+
sx,
|
|
69
|
+
title,
|
|
70
|
+
desc,
|
|
71
|
+
disableAxisListener
|
|
72
|
+
});
|
|
73
|
+
return {
|
|
74
|
+
children,
|
|
75
|
+
drawingProviderProps,
|
|
76
|
+
seriesProviderProps,
|
|
77
|
+
cartesianProviderProps,
|
|
78
|
+
zAxisContextProps,
|
|
79
|
+
highlightedProviderProps,
|
|
80
|
+
chartsSurfaceProps,
|
|
81
|
+
pluginProviderProps,
|
|
82
|
+
animationProviderProps,
|
|
83
|
+
xAxis: defaultizedXAxis,
|
|
84
|
+
yAxis: defaultizedYAxis
|
|
85
|
+
};
|
|
86
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MakeOptional } from '
|
|
2
|
-
import { AxisConfig, ScaleName } from '
|
|
3
|
-
import { ChartsAxisProps } from '
|
|
4
|
-
import { DatasetType } from '
|
|
1
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
2
|
+
import { AxisConfig, ScaleName } from '../../models';
|
|
3
|
+
import { ChartsAxisProps } from '../../models/axis';
|
|
4
|
+
import { DatasetType } from '../../models/seriesType/config';
|
|
5
5
|
export declare const useDefaultizeAxis: (inXAxis: MakeOptional<AxisConfig<ScaleName, any, ChartsAxisProps>, "id">[] | undefined, inYAxis: MakeOptional<AxisConfig<ScaleName, any, ChartsAxisProps>, "id">[] | undefined, dataset: DatasetType | undefined) => {
|
|
6
6
|
reverse?: boolean | undefined;
|
|
7
7
|
fill?: string | undefined;
|
|
@@ -10,28 +10,32 @@ export declare const useDefaultizeAxis: (inXAxis: MakeOptional<AxisConfig<ScaleN
|
|
|
10
10
|
label?: string | undefined;
|
|
11
11
|
max?: (number | Date) | undefined;
|
|
12
12
|
min?: (number | Date) | undefined;
|
|
13
|
-
valueFormatter?: ((value: any, context: import("
|
|
13
|
+
valueFormatter?: ((value: any, context: import("../../internals").AxisValueFormatterContext) => string) | undefined;
|
|
14
14
|
dataKey?: string | undefined;
|
|
15
15
|
sx?: import("@mui/system").SxProps | undefined;
|
|
16
|
-
classes?: Partial<import("
|
|
16
|
+
classes?: Partial<import("../..").ChartsAxisClasses> | undefined;
|
|
17
17
|
tickMaxStep?: number | undefined;
|
|
18
18
|
tickMinStep?: number | undefined;
|
|
19
19
|
tickNumber?: number | undefined;
|
|
20
20
|
disableLine?: boolean | undefined;
|
|
21
21
|
disableTicks?: boolean | undefined;
|
|
22
22
|
tickFontSize?: number | undefined;
|
|
23
|
-
tickLabelStyle?: import("
|
|
24
|
-
labelStyle?: import("
|
|
23
|
+
tickLabelStyle?: import("../..").ChartsTextProps["style"];
|
|
24
|
+
labelStyle?: import("../..").ChartsTextProps["style"];
|
|
25
25
|
tickLabelInterval?: ("auto" | ((value: any, index: number) => boolean)) | undefined;
|
|
26
26
|
labelFontSize?: number | undefined;
|
|
27
27
|
tickSize?: number | undefined;
|
|
28
|
-
slots?: Partial<import("
|
|
29
|
-
slotProps?: Partial<import("
|
|
28
|
+
slots?: Partial<import("../../internals").ChartsAxisSlots> | undefined;
|
|
29
|
+
slotProps?: Partial<import("../../internals").ChartsAxisSlotProps> | undefined;
|
|
30
30
|
tickInterval?: ("auto" | ((value: any, index: number) => boolean) | any[]) | undefined;
|
|
31
31
|
tickPlacement?: ("start" | "end" | "middle" | "extremities") | undefined;
|
|
32
32
|
tickLabelPlacement?: ("middle" | "tick") | undefined;
|
|
33
33
|
scaleType?: "linear" | "time" | "log" | "band" | "point" | "pow" | "sqrt" | "utc" | undefined;
|
|
34
|
-
colorMap?: import("
|
|
34
|
+
colorMap?: import("../../models/colorMapping").ContinuousColorConfig<number | Date> | import("../../models/colorMapping").PiecewiseColorConfig<number | Date> | import("../../models/colorMapping").OrdinalColorConfig<string | number | Date> | undefined;
|
|
35
35
|
hideTooltip?: boolean | undefined;
|
|
36
|
-
|
|
36
|
+
domainLimit?: ("nice" | "strict" | ((min: number, max: number) => {
|
|
37
|
+
min: number;
|
|
38
|
+
max: number;
|
|
39
|
+
})) | undefined;
|
|
40
|
+
id: import("../../internals").AxisId;
|
|
37
41
|
}[][];
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from "
|
|
5
|
+
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from "../../constants/index.js";
|
|
6
6
|
const defaultizeAxis = (inAxis, dataset, axisName) => {
|
|
7
7
|
const DEFAULT_AXIS_KEY = axisName === 'x' ? DEFAULT_X_AXIS_KEY : DEFAULT_Y_AXIS_KEY;
|
|
8
8
|
return [...(inAxis?.map((axis, index) => _extends({
|
|
@@ -30,10 +30,6 @@ export type HighlightItemData = {
|
|
|
30
30
|
export type HighlightOptions = 'none' | 'item' | 'series';
|
|
31
31
|
export type FadeOptions = 'none' | 'series' | 'global';
|
|
32
32
|
export type HighlightScope = {
|
|
33
|
-
/**
|
|
34
|
-
* @deprecated Use `highlight` instead.
|
|
35
|
-
*/
|
|
36
|
-
highlighted?: HighlightOptions;
|
|
37
33
|
/**
|
|
38
34
|
* The scope of highlighted elements.
|
|
39
35
|
* - 'none': no highlight.
|
|
@@ -42,10 +38,6 @@ export type HighlightScope = {
|
|
|
42
38
|
* @default 'none'
|
|
43
39
|
*/
|
|
44
40
|
highlight?: HighlightOptions;
|
|
45
|
-
/**
|
|
46
|
-
* @deprecated Use `fade` instead.
|
|
47
|
-
*/
|
|
48
|
-
faded?: FadeOptions;
|
|
49
41
|
/**
|
|
50
42
|
* The scope of faded elements.
|
|
51
43
|
* - 'none': no fading.
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["highlighted", "faded"];
|
|
6
3
|
import * as React from 'react';
|
|
7
4
|
import PropTypes from 'prop-types';
|
|
8
5
|
import useControlled from '@mui/utils/useControlled';
|
|
@@ -11,18 +8,6 @@ import { createIsFaded } from "./createIsFaded.js";
|
|
|
11
8
|
import { createIsHighlighted } from "./createIsHighlighted.js";
|
|
12
9
|
import { useSeries } from "../../hooks/useSeries.js";
|
|
13
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
const mergeDeprecatedOptions = options => {
|
|
15
|
-
const _ref = options ?? {},
|
|
16
|
-
{
|
|
17
|
-
highlighted,
|
|
18
|
-
faded
|
|
19
|
-
} = _ref,
|
|
20
|
-
other = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
21
|
-
return _extends({
|
|
22
|
-
highlight: highlighted,
|
|
23
|
-
fade: faded
|
|
24
|
-
}, other);
|
|
25
|
-
};
|
|
26
11
|
function HighlightedProvider({
|
|
27
12
|
children,
|
|
28
13
|
highlightedItem: highlightedItemProps,
|
|
@@ -41,7 +26,7 @@ function HighlightedProvider({
|
|
|
41
26
|
const seriesData = series[seriesType];
|
|
42
27
|
Object.keys(seriesData?.series ?? {}).forEach(seriesId => {
|
|
43
28
|
const seriesItem = seriesData?.series[seriesId];
|
|
44
|
-
map.set(seriesId,
|
|
29
|
+
map.set(seriesId, seriesItem?.highlightScope);
|
|
45
30
|
});
|
|
46
31
|
});
|
|
47
32
|
return map;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { CartesianChartSeriesType,
|
|
1
|
+
import type { CartesianChartSeriesType, ChartSeriesDefaultized, ChartSeriesType } from '../../models/seriesType/config';
|
|
2
2
|
import type { AxisConfig, AxisId } from '../../models/axis';
|
|
3
3
|
import type { SeriesId } from '../../models/seriesType/common';
|
|
4
4
|
export type ExtremumGettersConfig<T extends ChartSeriesType = CartesianChartSeriesType> = {
|
|
5
5
|
[K in T]?: ExtremumGetter<K>;
|
|
6
6
|
};
|
|
7
7
|
type ExtremumGetterParams<T extends ChartSeriesType> = {
|
|
8
|
-
series: Record<SeriesId,
|
|
8
|
+
series: Record<SeriesId, ChartSeriesDefaultized<T>>;
|
|
9
9
|
axis: AxisConfig;
|
|
10
10
|
axisIndex: number;
|
|
11
11
|
isDefaultAxis: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
2
3
|
import { DatasetType } from '../models/seriesType/config';
|
|
3
|
-
import { MakeOptional } from '../models/helpers';
|
|
4
4
|
import { ZAxisConfig, ZAxisDefaultized } from '../models/z-axis';
|
|
5
5
|
export type ZAxisContextProviderProps = {
|
|
6
6
|
/**
|
package/index.d.ts
CHANGED
|
@@ -21,6 +21,5 @@ export * from './PieChart';
|
|
|
21
21
|
export * from './ScatterChart';
|
|
22
22
|
export * from './SparkLineChart';
|
|
23
23
|
export * from './Gauge';
|
|
24
|
-
export * from './ChartContainer';
|
|
25
24
|
export * from './ChartsSurface';
|
|
26
|
-
export * from './
|
|
25
|
+
export * from './ChartContainer';
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts
|
|
2
|
+
* @mui/x-charts v8.0.0-alpha.0
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -28,6 +28,5 @@ export * from "./PieChart/index.js";
|
|
|
28
28
|
export * from "./ScatterChart/index.js";
|
|
29
29
|
export * from "./SparkLineChart/index.js";
|
|
30
30
|
export * from "./Gauge/index.js";
|
|
31
|
-
export * from "./ChartContainer/index.js";
|
|
32
31
|
export * from "./ChartsSurface/index.js";
|
|
33
|
-
export * from "./
|
|
32
|
+
export * from "./ChartContainer/index.js";
|
|
@@ -98,22 +98,30 @@ export function computeAxisValue({
|
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
const scaleType = axis.scaleType ?? 'linear';
|
|
101
|
+
const domainLimit = axis.domainLimit ?? 'nice';
|
|
101
102
|
const axisExtremums = [axis.min ?? minData, axis.max ?? maxData];
|
|
103
|
+
if (typeof domainLimit === 'function') {
|
|
104
|
+
const {
|
|
105
|
+
min,
|
|
106
|
+
max
|
|
107
|
+
} = domainLimit(minData, maxData);
|
|
108
|
+
axisExtremums[0] = min;
|
|
109
|
+
axisExtremums[1] = max;
|
|
110
|
+
}
|
|
102
111
|
const rawTickNumber = getTickNumber(_extends({}, axis, {
|
|
103
112
|
range,
|
|
104
113
|
domain: axisExtremums
|
|
105
114
|
}));
|
|
106
115
|
const tickNumber = rawTickNumber / ((zoomRange[1] - zoomRange[0]) / 100);
|
|
107
116
|
const zoomedRange = zoomScaleRange(range, zoomRange);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
const [minDomain, maxDomain] = scale.domain();
|
|
117
|
+
const scale = getScale(scaleType, axisExtremums, zoomedRange);
|
|
118
|
+
const finalScale = domainLimit === 'nice' ? scale.nice(rawTickNumber) : scale;
|
|
119
|
+
const [minDomain, maxDomain] = finalScale.domain();
|
|
112
120
|
const domain = [axis.min ?? minDomain, axis.max ?? maxDomain];
|
|
113
121
|
completeAxis[axis.id] = _extends({}, axis, {
|
|
114
122
|
data,
|
|
115
123
|
scaleType: scaleType,
|
|
116
|
-
scale:
|
|
124
|
+
scale: finalScale.domain(domain),
|
|
117
125
|
tickNumber,
|
|
118
126
|
colorScale: axis.colorMap && getColorScale(axis.colorMap)
|
|
119
127
|
});
|
|
@@ -41,7 +41,7 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
|
|
|
41
41
|
};
|
|
42
42
|
id?: import(".").SeriesId;
|
|
43
43
|
color?: string;
|
|
44
|
-
valueFormatter?: import(".").SeriesValueFormatter<import("
|
|
44
|
+
valueFormatter?: import(".").SeriesValueFormatter<import("@mui/x-internals/types").MakeOptional<import("..").PieValueType, "id">> | undefined;
|
|
45
45
|
highlightScope?: Partial<import("..").HighlightScope>;
|
|
46
46
|
} | {
|
|
47
47
|
type: "bar";
|
|
@@ -54,8 +54,6 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
|
|
|
54
54
|
color: string;
|
|
55
55
|
valueFormatter?: import(".").SeriesValueFormatter<number | null> | undefined;
|
|
56
56
|
highlightScope?: Partial<import("..").HighlightScope>;
|
|
57
|
-
xAxisKey?: string;
|
|
58
|
-
yAxisKey?: string;
|
|
59
57
|
xAxisId?: string;
|
|
60
58
|
yAxisId?: string;
|
|
61
59
|
stack?: string;
|
|
@@ -66,7 +64,6 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
|
|
|
66
64
|
markerSize?: number;
|
|
67
65
|
label?: string | ((location: "tooltip" | "legend") => string);
|
|
68
66
|
disableHover?: boolean;
|
|
69
|
-
zAxisKey?: string;
|
|
70
67
|
zAxisId?: string;
|
|
71
68
|
datasetKeys?: {
|
|
72
69
|
x: string;
|
|
@@ -78,8 +75,6 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
|
|
|
78
75
|
color: string;
|
|
79
76
|
valueFormatter?: import(".").SeriesValueFormatter<import("..").ScatterValueType> | undefined;
|
|
80
77
|
highlightScope?: Partial<import("..").HighlightScope>;
|
|
81
|
-
xAxisKey?: string;
|
|
82
|
-
yAxisKey?: string;
|
|
83
78
|
xAxisId?: string;
|
|
84
79
|
yAxisId?: string;
|
|
85
80
|
} | {
|
|
@@ -99,8 +94,6 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
|
|
|
99
94
|
color: string;
|
|
100
95
|
valueFormatter?: import(".").SeriesValueFormatter<number | null> | undefined;
|
|
101
96
|
highlightScope?: Partial<import("..").HighlightScope>;
|
|
102
|
-
xAxisKey?: string;
|
|
103
|
-
yAxisKey?: string;
|
|
104
97
|
xAxisId?: string;
|
|
105
98
|
yAxisId?: string;
|
|
106
99
|
stackOrder?: import("..").StackOrderType;
|
package/internals/getSymbol.js
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
|
-
// Returns the index of a defined shape
|
|
2
1
|
export function getSymbol(shape) {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
// prettier-ignore
|
|
3
|
+
switch (shape) {
|
|
4
|
+
case 'circle':
|
|
5
|
+
return 0;
|
|
6
|
+
case 'cross':
|
|
7
|
+
return 1;
|
|
8
|
+
case 'diamond':
|
|
9
|
+
return 2;
|
|
10
|
+
case 'square':
|
|
11
|
+
return 3;
|
|
12
|
+
case 'star':
|
|
13
|
+
return 4;
|
|
14
|
+
case 'triangle':
|
|
15
|
+
return 5;
|
|
16
|
+
case 'wye':
|
|
17
|
+
return 6;
|
|
18
|
+
default:
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
5
21
|
}
|