@mui/x-charts 8.26.0 → 8.27.4
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/CHANGELOG.md +314 -0
- package/ChartContainer/ChartContainer.d.ts +16 -29
- package/ChartContainer/ChartContainer.js +14 -1691
- package/ChartContainer/useChartContainerProps.d.ts +9 -10
- package/ChartContainer/useChartContainerProps.js +9 -94
- package/ChartDataProvider/ChartDataProvider.d.ts +15 -44
- package/ChartDataProvider/ChartDataProvider.js +16 -130
- package/ChartDataProvider/useChartDataProviderProps.d.ts +7 -10
- package/ChartDataProvider/useChartDataProviderProps.js +5 -38
- package/ChartsAxis/axisClasses.d.ts +2 -0
- package/ChartsContainer/ChartsContainer.d.ts +37 -0
- package/ChartsContainer/ChartsContainer.js +1702 -0
- package/ChartsContainer/index.d.ts +1 -0
- package/ChartsContainer/index.js +16 -0
- package/ChartsContainer/useChartsContainerProps.d.ts +15 -0
- package/ChartsContainer/useChartsContainerProps.js +104 -0
- package/ChartsDataProvider/ChartsDataProvider.d.ts +51 -0
- package/ChartsDataProvider/ChartsDataProvider.js +138 -0
- package/ChartsDataProvider/index.d.ts +1 -0
- package/ChartsDataProvider/index.js +16 -0
- package/ChartsDataProvider/useChartsDataProviderProps.d.ts +13 -0
- package/ChartsDataProvider/useChartsDataProviderProps.js +45 -0
- package/ChartsSurface/ChartsSurface.js +4 -0
- package/ChartsXAxis/ChartsXAxisImpl.js +1 -0
- package/ChartsYAxis/ChartsYAxisImpl.js +1 -0
- package/RadarChart/RadarChart.d.ts +1 -1
- package/RadarChart/useRadarChartProps.js +1 -1
- package/context/ChartProvider/ChartContext.d.ts +2 -3
- package/context/ChartProvider/ChartContext.js +3 -4
- package/context/ChartProvider/ChartProvider.d.ts +5 -8
- package/context/ChartProvider/ChartProvider.js +6 -41
- package/context/ChartProvider/ChartProvider.types.d.ts +14 -41
- package/context/ChartProvider/useChartContext.d.ts +4 -3
- package/context/ChartProvider/useChartContext.js +5 -11
- package/context/ChartsProvider/ChartsContext.d.ts +6 -0
- package/context/ChartsProvider/ChartsContext.js +14 -0
- package/context/ChartsProvider/ChartsProvider.d.ts +8 -0
- package/context/ChartsProvider/ChartsProvider.js +47 -0
- package/context/ChartsProvider/ChartsProvider.types.d.ts +40 -0
- package/context/ChartsProvider/ChartsProvider.types.js +5 -0
- package/context/ChartsProvider/index.d.ts +3 -0
- package/context/ChartsProvider/index.js +38 -0
- package/context/ChartsProvider/useChartsContext.d.ts +3 -0
- package/context/ChartsProvider/useChartsContext.js +18 -0
- package/context/ChartsSlotsContext.d.ts +1 -1
- package/context/ChartsSlotsContext.js +1 -1
- package/esm/ChartContainer/ChartContainer.d.ts +16 -29
- package/esm/ChartContainer/ChartContainer.js +15 -1690
- package/esm/ChartContainer/useChartContainerProps.d.ts +9 -10
- package/esm/ChartContainer/useChartContainerProps.js +10 -93
- package/esm/ChartDataProvider/ChartDataProvider.d.ts +15 -44
- package/esm/ChartDataProvider/ChartDataProvider.js +16 -128
- package/esm/ChartDataProvider/useChartDataProviderProps.d.ts +7 -10
- package/esm/ChartDataProvider/useChartDataProviderProps.js +6 -36
- package/esm/ChartsAxis/axisClasses.d.ts +2 -0
- package/esm/ChartsContainer/ChartsContainer.d.ts +37 -0
- package/esm/ChartsContainer/ChartsContainer.js +1696 -0
- package/esm/ChartsContainer/index.d.ts +1 -0
- package/esm/ChartsContainer/index.js +1 -0
- package/esm/ChartsContainer/useChartsContainerProps.d.ts +15 -0
- package/esm/ChartsContainer/useChartsContainerProps.js +97 -0
- package/esm/ChartsDataProvider/ChartsDataProvider.d.ts +51 -0
- package/esm/ChartsDataProvider/ChartsDataProvider.js +132 -0
- package/esm/ChartsDataProvider/index.d.ts +1 -0
- package/esm/ChartsDataProvider/index.js +1 -0
- package/esm/ChartsDataProvider/useChartsDataProviderProps.d.ts +13 -0
- package/esm/ChartsDataProvider/useChartsDataProviderProps.js +38 -0
- package/esm/ChartsSurface/ChartsSurface.js +4 -0
- package/esm/ChartsXAxis/ChartsXAxisImpl.js +1 -0
- package/esm/ChartsYAxis/ChartsYAxisImpl.js +1 -0
- package/esm/RadarChart/RadarChart.d.ts +1 -1
- package/esm/RadarChart/useRadarChartProps.js +1 -1
- package/esm/context/ChartProvider/ChartContext.d.ts +2 -3
- package/esm/context/ChartProvider/ChartContext.js +4 -3
- package/esm/context/ChartProvider/ChartProvider.d.ts +5 -8
- package/esm/context/ChartProvider/ChartProvider.js +5 -38
- package/esm/context/ChartProvider/ChartProvider.types.d.ts +14 -41
- package/esm/context/ChartProvider/useChartContext.d.ts +4 -3
- package/esm/context/ChartProvider/useChartContext.js +6 -9
- package/esm/context/ChartsProvider/ChartsContext.d.ts +6 -0
- package/esm/context/ChartsProvider/ChartsContext.js +8 -0
- package/esm/context/ChartsProvider/ChartsProvider.d.ts +8 -0
- package/esm/context/ChartsProvider/ChartsProvider.js +41 -0
- package/esm/context/ChartsProvider/ChartsProvider.types.d.ts +40 -0
- package/esm/context/ChartsProvider/ChartsProvider.types.js +1 -0
- package/esm/context/ChartsProvider/index.d.ts +3 -0
- package/esm/context/ChartsProvider/index.js +3 -0
- package/esm/context/ChartsProvider/useChartsContext.d.ts +3 -0
- package/esm/context/ChartsProvider/useChartsContext.js +11 -0
- package/esm/context/ChartsSlotsContext.d.ts +1 -1
- package/esm/context/ChartsSlotsContext.js +1 -1
- package/esm/index.d.ts +4 -1
- package/esm/index.js +3 -1
- package/esm/internals/index.d.ts +4 -0
- package/esm/internals/index.js +4 -0
- package/esm/internals/plugins/featurePlugins/useChartItemClick/index.d.ts +2 -0
- package/esm/internals/plugins/featurePlugins/useChartItemClick/index.js +1 -0
- package/esm/internals/plugins/featurePlugins/useChartItemClick/useChartItemClick.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartItemClick/useChartItemClick.js +48 -0
- package/esm/internals/plugins/featurePlugins/useChartItemClick/useChartItemClick.types.d.ts +22 -0
- package/esm/internals/plugins/featurePlugins/useChartItemClick/useChartItemClick.types.js +1 -0
- package/esm/internals/plugins/models/seriesConfig/getItemAtPosition.types.d.ts +8 -0
- package/esm/internals/plugins/models/seriesConfig/getItemAtPosition.types.js +1 -0
- package/esm/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +10 -1
- package/esm/internals/store/useStore.js +1 -1
- package/esm/themeAugmentation/components.d.ts +4 -0
- package/esm/themeAugmentation/props.d.ts +4 -2
- package/index.d.ts +4 -1
- package/index.js +21 -1
- package/internals/index.d.ts +4 -0
- package/internals/index.js +48 -0
- package/internals/plugins/featurePlugins/useChartItemClick/index.d.ts +2 -0
- package/internals/plugins/featurePlugins/useChartItemClick/index.js +12 -0
- package/internals/plugins/featurePlugins/useChartItemClick/useChartItemClick.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartItemClick/useChartItemClick.js +54 -0
- package/internals/plugins/featurePlugins/useChartItemClick/useChartItemClick.types.d.ts +22 -0
- package/internals/plugins/featurePlugins/useChartItemClick/useChartItemClick.types.js +5 -0
- package/internals/plugins/models/seriesConfig/getItemAtPosition.types.d.ts +8 -0
- package/internals/plugins/models/seriesConfig/getItemAtPosition.types.js +5 -0
- package/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +10 -1
- package/internals/store/useStore.js +1 -1
- package/package.json +3 -3
- package/themeAugmentation/components.d.ts +4 -0
- package/themeAugmentation/props.d.ts +4 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ChartsContainer.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _ChartsContainer = require("./ChartsContainer");
|
|
7
|
+
Object.keys(_ChartsContainer).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _ChartsContainer[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _ChartsContainer[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import { type ChartsSurfaceProps } from "../ChartsSurface/index.js";
|
|
3
|
+
import { type ChartDataProviderProps } from "../ChartDataProvider/index.js";
|
|
4
|
+
import type { ChartsContainerProps } from "./ChartsContainer.js";
|
|
5
|
+
import { type ChartSeriesType } from "../models/seriesType/config.js";
|
|
6
|
+
import { type AllPluginSignatures } from "../internals/plugins/allPlugins.js";
|
|
7
|
+
import { type ChartAnyPluginSignature } from "../internals/plugins/models/plugin.js";
|
|
8
|
+
export type UseChartsContainerPropsReturnValue<TSeries extends ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[]> = {
|
|
9
|
+
chartDataProviderProps: ChartDataProviderProps<TSeries, TSignatures>;
|
|
10
|
+
chartsSurfaceProps: ChartsSurfaceProps & {
|
|
11
|
+
ref: React.Ref<SVGSVGElement>;
|
|
12
|
+
};
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
};
|
|
15
|
+
export declare const useChartsContainerProps: <TSeries extends ChartSeriesType = ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[] = AllPluginSignatures<TSeries>>(props: ChartsContainerProps<TSeries, TSignatures>, ref: React.Ref<SVGSVGElement>) => UseChartsContainerPropsReturnValue<TSeries, TSignatures>;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.useChartsContainerProps = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
|
+
var _allPlugins = require("../internals/plugins/allPlugins");
|
|
12
|
+
const _excluded = ["width", "height", "margin", "children", "series", "colors", "dataset", "desc", "onAxisClick", "highlightedAxis", "onHighlightedAxisChange", "tooltipItem", "onTooltipItemChange", "disableVoronoi", "voronoiMaxRadius", "onItemClick", "disableAxisListener", "highlightedItem", "onHighlightChange", "sx", "title", "xAxis", "yAxis", "zAxis", "rotationAxis", "radiusAxis", "skipAnimation", "seriesConfig", "plugins", "localeText", "slots", "slotProps", "experimentalFeatures", "enableKeyboardNavigation", "brushConfig", "onHiddenItemsChange", "hiddenItems", "initialHiddenItems"];
|
|
13
|
+
const useChartsContainerProps = (props, ref) => {
|
|
14
|
+
const _ref = props,
|
|
15
|
+
{
|
|
16
|
+
width,
|
|
17
|
+
height,
|
|
18
|
+
margin,
|
|
19
|
+
children,
|
|
20
|
+
series,
|
|
21
|
+
colors,
|
|
22
|
+
dataset,
|
|
23
|
+
desc,
|
|
24
|
+
onAxisClick,
|
|
25
|
+
highlightedAxis,
|
|
26
|
+
onHighlightedAxisChange,
|
|
27
|
+
tooltipItem,
|
|
28
|
+
onTooltipItemChange,
|
|
29
|
+
disableVoronoi,
|
|
30
|
+
voronoiMaxRadius,
|
|
31
|
+
onItemClick,
|
|
32
|
+
disableAxisListener,
|
|
33
|
+
highlightedItem,
|
|
34
|
+
onHighlightChange,
|
|
35
|
+
sx,
|
|
36
|
+
title,
|
|
37
|
+
xAxis,
|
|
38
|
+
yAxis,
|
|
39
|
+
zAxis,
|
|
40
|
+
rotationAxis,
|
|
41
|
+
radiusAxis,
|
|
42
|
+
skipAnimation,
|
|
43
|
+
seriesConfig,
|
|
44
|
+
plugins,
|
|
45
|
+
localeText,
|
|
46
|
+
slots,
|
|
47
|
+
slotProps,
|
|
48
|
+
experimentalFeatures,
|
|
49
|
+
enableKeyboardNavigation,
|
|
50
|
+
brushConfig,
|
|
51
|
+
onHiddenItemsChange,
|
|
52
|
+
hiddenItems,
|
|
53
|
+
initialHiddenItems
|
|
54
|
+
} = _ref,
|
|
55
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
56
|
+
const chartsSurfaceProps = (0, _extends2.default)({
|
|
57
|
+
title,
|
|
58
|
+
desc,
|
|
59
|
+
sx,
|
|
60
|
+
ref
|
|
61
|
+
}, other);
|
|
62
|
+
const chartDataProviderProps = {
|
|
63
|
+
margin,
|
|
64
|
+
series,
|
|
65
|
+
colors,
|
|
66
|
+
dataset,
|
|
67
|
+
disableAxisListener,
|
|
68
|
+
highlightedItem,
|
|
69
|
+
onHighlightChange,
|
|
70
|
+
onAxisClick,
|
|
71
|
+
highlightedAxis,
|
|
72
|
+
onHighlightedAxisChange,
|
|
73
|
+
tooltipItem,
|
|
74
|
+
onTooltipItemChange,
|
|
75
|
+
disableVoronoi,
|
|
76
|
+
voronoiMaxRadius,
|
|
77
|
+
onItemClick,
|
|
78
|
+
xAxis,
|
|
79
|
+
yAxis,
|
|
80
|
+
zAxis,
|
|
81
|
+
rotationAxis,
|
|
82
|
+
radiusAxis,
|
|
83
|
+
skipAnimation,
|
|
84
|
+
width,
|
|
85
|
+
height,
|
|
86
|
+
localeText,
|
|
87
|
+
seriesConfig,
|
|
88
|
+
experimentalFeatures,
|
|
89
|
+
enableKeyboardNavigation,
|
|
90
|
+
brushConfig,
|
|
91
|
+
onHiddenItemsChange,
|
|
92
|
+
hiddenItems,
|
|
93
|
+
initialHiddenItems,
|
|
94
|
+
plugins: plugins ?? _allPlugins.DEFAULT_PLUGINS,
|
|
95
|
+
slots,
|
|
96
|
+
slotProps
|
|
97
|
+
};
|
|
98
|
+
return {
|
|
99
|
+
chartDataProviderProps,
|
|
100
|
+
chartsSurfaceProps,
|
|
101
|
+
children
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
exports.useChartsContainerProps = useChartsContainerProps;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ChartsSlotProps, type ChartsSlots } from "../internals/material/index.js";
|
|
3
|
+
import { type ChartsProviderProps } from "../context/ChartsProvider/index.js";
|
|
4
|
+
import { type ChartSeriesType } from "../models/seriesType/config.js";
|
|
5
|
+
import { type ChartAnyPluginSignature } from "../internals/plugins/models/plugin.js";
|
|
6
|
+
import { type AllPluginSignatures } from "../internals/plugins/allPlugins.js";
|
|
7
|
+
import { type ChartsLocalizationProviderProps } from "../ChartsLocalizationProvider/index.js";
|
|
8
|
+
export interface ChartsDataProviderSlots extends ChartsSlots {}
|
|
9
|
+
export interface ChartsDataProviderSlotProps extends ChartsSlotProps {}
|
|
10
|
+
export type ChartsDataProviderProps<TSeries extends ChartSeriesType = ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[] = AllPluginSignatures<TSeries>> = React.PropsWithChildren<ChartsProviderProps<TSeries, TSignatures>['pluginParams'] & Pick<ChartsProviderProps<TSeries, TSignatures>, 'seriesConfig' | 'plugins'>> & ChartsLocalizationProviderProps & {
|
|
11
|
+
/**
|
|
12
|
+
* Slots to customize charts' components.
|
|
13
|
+
*/
|
|
14
|
+
slots?: Partial<ChartsDataProviderSlots>;
|
|
15
|
+
/**
|
|
16
|
+
* The props for the slots.
|
|
17
|
+
*/
|
|
18
|
+
slotProps?: Partial<ChartsDataProviderSlotProps>;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Orchestrates the data providers for the chart components and hooks.
|
|
22
|
+
*
|
|
23
|
+
* Use this component if you have custom HTML components that need to access the chart data.
|
|
24
|
+
*
|
|
25
|
+
* Demos:
|
|
26
|
+
*
|
|
27
|
+
* - [Composition](https://mui.com/x/react-charts/composition/)
|
|
28
|
+
*
|
|
29
|
+
* API:
|
|
30
|
+
*
|
|
31
|
+
* - [ChartsDataProvider API](https://mui.com/x/api/charts/charts-data-provider/)
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```jsx
|
|
35
|
+
* <ChartsDataProvider
|
|
36
|
+
* series={[{ label: "Label", type: "bar", data: [10, 20] }]}
|
|
37
|
+
* xAxis={[{ data: ["A", "B"], scaleType: "band", id: "x-axis" }]}
|
|
38
|
+
* >
|
|
39
|
+
* <ChartsSurface>
|
|
40
|
+
* <BarPlot />
|
|
41
|
+
* <ChartsXAxis axisId="x-axis" />
|
|
42
|
+
* </ChartsSurface>
|
|
43
|
+
* {'Custom Legend Component'}
|
|
44
|
+
* </ChartsDataProvider>
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
declare function ChartsDataProvider<TSeries extends ChartSeriesType = ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[] = AllPluginSignatures<TSeries>>(props: ChartsDataProviderProps<TSeries, TSignatures>): import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
declare namespace ChartsDataProvider {
|
|
49
|
+
var propTypes: any;
|
|
50
|
+
}
|
|
51
|
+
export { ChartsDataProvider };
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.ChartsDataProvider = ChartsDataProvider;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
var _material = require("../internals/material");
|
|
14
|
+
var _ChartsSlotsContext = require("../context/ChartsSlotsContext");
|
|
15
|
+
var _useChartsDataProviderProps = require("./useChartsDataProviderProps");
|
|
16
|
+
var _ChartsProvider = require("../context/ChartsProvider");
|
|
17
|
+
var _ChartsLocalizationProvider = require("../ChartsLocalizationProvider");
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
/**
|
|
20
|
+
* Orchestrates the data providers for the chart components and hooks.
|
|
21
|
+
*
|
|
22
|
+
* Use this component if you have custom HTML components that need to access the chart data.
|
|
23
|
+
*
|
|
24
|
+
* Demos:
|
|
25
|
+
*
|
|
26
|
+
* - [Composition](https://mui.com/x/react-charts/composition/)
|
|
27
|
+
*
|
|
28
|
+
* API:
|
|
29
|
+
*
|
|
30
|
+
* - [ChartsDataProvider API](https://mui.com/x/api/charts/charts-data-provider/)
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```jsx
|
|
34
|
+
* <ChartsDataProvider
|
|
35
|
+
* series={[{ label: "Label", type: "bar", data: [10, 20] }]}
|
|
36
|
+
* xAxis={[{ data: ["A", "B"], scaleType: "band", id: "x-axis" }]}
|
|
37
|
+
* >
|
|
38
|
+
* <ChartsSurface>
|
|
39
|
+
* <BarPlot />
|
|
40
|
+
* <ChartsXAxis axisId="x-axis" />
|
|
41
|
+
* </ChartsSurface>
|
|
42
|
+
* {'Custom Legend Component'}
|
|
43
|
+
* </ChartsDataProvider>
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
function ChartsDataProvider(props) {
|
|
47
|
+
const {
|
|
48
|
+
children,
|
|
49
|
+
localeText,
|
|
50
|
+
chartProviderProps,
|
|
51
|
+
slots,
|
|
52
|
+
slotProps
|
|
53
|
+
} = (0, _useChartsDataProviderProps.useChartsDataProviderProps)(props);
|
|
54
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsProvider.ChartsProvider, (0, _extends2.default)({}, chartProviderProps, {
|
|
55
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLocalizationProvider.ChartsLocalizationProvider, {
|
|
56
|
+
localeText: localeText,
|
|
57
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsSlotsContext.ChartsSlotsProvider, {
|
|
58
|
+
slots: slots,
|
|
59
|
+
slotProps: slotProps,
|
|
60
|
+
defaultSlots: _material.defaultSlotsMaterial,
|
|
61
|
+
children: children
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
process.env.NODE_ENV !== "production" ? ChartsDataProvider.propTypes = {
|
|
67
|
+
// ----------------------------- Warning --------------------------------
|
|
68
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
69
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
70
|
+
// ----------------------------------------------------------------------
|
|
71
|
+
apiRef: _propTypes.default.shape({
|
|
72
|
+
current: _propTypes.default.any
|
|
73
|
+
}),
|
|
74
|
+
/**
|
|
75
|
+
* Color palette used to colorize multiple series.
|
|
76
|
+
* @default rainbowSurgePalette
|
|
77
|
+
*/
|
|
78
|
+
colors: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.func]),
|
|
79
|
+
/**
|
|
80
|
+
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
81
|
+
*/
|
|
82
|
+
dataset: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
83
|
+
/**
|
|
84
|
+
* Options to enable features planned for the next major.
|
|
85
|
+
*/
|
|
86
|
+
experimentalFeatures: _propTypes.default.shape({
|
|
87
|
+
preferStrictDomainInLineCharts: _propTypes.default.bool
|
|
88
|
+
}),
|
|
89
|
+
/**
|
|
90
|
+
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
91
|
+
*/
|
|
92
|
+
height: _propTypes.default.number,
|
|
93
|
+
/**
|
|
94
|
+
* This prop is used to help implement the accessibility logic.
|
|
95
|
+
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
96
|
+
*/
|
|
97
|
+
id: _propTypes.default.string,
|
|
98
|
+
/**
|
|
99
|
+
* Localized text for chart components.
|
|
100
|
+
*/
|
|
101
|
+
localeText: _propTypes.default.object,
|
|
102
|
+
/**
|
|
103
|
+
* The margin between the SVG and the drawing area.
|
|
104
|
+
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
105
|
+
*
|
|
106
|
+
* Accepts a `number` to be used on all sides or an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
107
|
+
*/
|
|
108
|
+
margin: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
|
109
|
+
bottom: _propTypes.default.number,
|
|
110
|
+
left: _propTypes.default.number,
|
|
111
|
+
right: _propTypes.default.number,
|
|
112
|
+
top: _propTypes.default.number
|
|
113
|
+
})]),
|
|
114
|
+
/**
|
|
115
|
+
* The array of series to display.
|
|
116
|
+
* Each type of series has its own specificity.
|
|
117
|
+
* Please refer to the appropriate docs page to learn more about it.
|
|
118
|
+
*/
|
|
119
|
+
series: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
120
|
+
/**
|
|
121
|
+
* If `true`, animations are skipped.
|
|
122
|
+
* If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
|
|
123
|
+
*/
|
|
124
|
+
skipAnimation: _propTypes.default.bool,
|
|
125
|
+
/**
|
|
126
|
+
* The props for the slots.
|
|
127
|
+
*/
|
|
128
|
+
slotProps: _propTypes.default.object,
|
|
129
|
+
/**
|
|
130
|
+
* Slots to customize charts' components.
|
|
131
|
+
*/
|
|
132
|
+
slots: _propTypes.default.object,
|
|
133
|
+
theme: _propTypes.default.oneOf(['dark', 'light']),
|
|
134
|
+
/**
|
|
135
|
+
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
136
|
+
*/
|
|
137
|
+
width: _propTypes.default.number
|
|
138
|
+
} : void 0;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ChartsDataProvider.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _ChartsDataProvider = require("./ChartsDataProvider");
|
|
7
|
+
Object.keys(_ChartsDataProvider).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _ChartsDataProvider[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _ChartsDataProvider[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ChartsDataProviderProps } from "./ChartsDataProvider.js";
|
|
2
|
+
import { type ChartsProviderProps } from "../context/ChartsProvider/index.js";
|
|
3
|
+
import { type ChartAnyPluginSignature } from "../internals/plugins/models/index.js";
|
|
4
|
+
import { type ChartSeriesType } from "../models/seriesType/config.js";
|
|
5
|
+
import { type AllPluginSignatures } from "../internals/plugins/allPlugins.js";
|
|
6
|
+
import { type ChartsLocalizationProviderProps } from "../ChartsLocalizationProvider/index.js";
|
|
7
|
+
export declare const useChartsDataProviderProps: <TSeries extends ChartSeriesType = ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[] = AllPluginSignatures<TSeries>>(inProps: ChartsDataProviderProps<TSeries, TSignatures> & ChartsLocalizationProviderProps) => {
|
|
8
|
+
children: import("react").ReactNode;
|
|
9
|
+
localeText: Partial<import("../locales/index.js").ChartsLocaleText> | undefined;
|
|
10
|
+
chartProviderProps: ChartsProviderProps<TSeries, TSignatures>;
|
|
11
|
+
slots: Partial<import("./ChartsDataProvider.js").ChartsDataProviderSlots> | undefined;
|
|
12
|
+
slotProps: Partial<import("./ChartsDataProvider.js").ChartsDataProviderSlotProps> | undefined;
|
|
13
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.useChartsDataProviderProps = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
|
+
var _styles = require("@mui/material/styles");
|
|
12
|
+
var _allPlugins = require("../internals/plugins/allPlugins");
|
|
13
|
+
const _excluded = ["children", "localeText", "plugins", "slots", "slotProps", "seriesConfig"];
|
|
14
|
+
const useChartsDataProviderProps = inProps => {
|
|
15
|
+
// eslint-disable-next-line material-ui/mui-name-matches-component-name
|
|
16
|
+
const props = (0, _styles.useThemeProps)({
|
|
17
|
+
props: inProps,
|
|
18
|
+
name: 'MuiChartDataProvider'
|
|
19
|
+
});
|
|
20
|
+
const {
|
|
21
|
+
children,
|
|
22
|
+
localeText,
|
|
23
|
+
plugins = _allPlugins.DEFAULT_PLUGINS,
|
|
24
|
+
slots,
|
|
25
|
+
slotProps,
|
|
26
|
+
seriesConfig
|
|
27
|
+
} = props,
|
|
28
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
29
|
+
const theme = (0, _styles.useTheme)();
|
|
30
|
+
const chartProviderProps = {
|
|
31
|
+
plugins: plugins,
|
|
32
|
+
seriesConfig,
|
|
33
|
+
pluginParams: (0, _extends2.default)({
|
|
34
|
+
theme: theme.palette.mode
|
|
35
|
+
}, other)
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
children,
|
|
39
|
+
localeText,
|
|
40
|
+
chartProviderProps,
|
|
41
|
+
slots,
|
|
42
|
+
slotProps
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
exports.useChartsDataProviderProps = useChartsDataProviderProps;
|
|
@@ -102,6 +102,10 @@ const ChartsSurface = exports.ChartsSurface = /*#__PURE__*/React.forwardRef(func
|
|
|
102
102
|
other.onPointerLeave?.(event);
|
|
103
103
|
instance.handlePointerLeave?.(event);
|
|
104
104
|
},
|
|
105
|
+
onClick: event => {
|
|
106
|
+
other.onClick?.(event);
|
|
107
|
+
instance.handleClick?.(event);
|
|
108
|
+
},
|
|
105
109
|
ref: handleRef,
|
|
106
110
|
children: [title && /*#__PURE__*/(0, _jsxRuntime.jsx)("title", {
|
|
107
111
|
children: title
|
|
@@ -108,6 +108,7 @@ function ChartsXAxisImpl(_ref) {
|
|
|
108
108
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(XAxisRoot, {
|
|
109
109
|
transform: `translate(0, ${position === 'bottom' ? top + height + offset : top - offset})`,
|
|
110
110
|
className: classes.root,
|
|
111
|
+
"data-axis-id": defaultizedProps.id,
|
|
111
112
|
sx: sx,
|
|
112
113
|
children: [!disableLine && /*#__PURE__*/(0, _jsxRuntime.jsx)(Line, (0, _extends2.default)({
|
|
113
114
|
x1: left,
|
|
@@ -124,6 +124,7 @@ function ChartsYAxisImpl(_ref) {
|
|
|
124
124
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(YAxisRoot, {
|
|
125
125
|
transform: `translate(${position === 'right' ? left + width + offset : left - offset}, 0)`,
|
|
126
126
|
className: classes.root,
|
|
127
|
+
"data-axis-id": defaultizedProps.id,
|
|
127
128
|
sx: sx,
|
|
128
129
|
children: [!disableLine && /*#__PURE__*/(0, _jsxRuntime.jsx)(Line, (0, _extends2.default)({
|
|
129
130
|
y1: top,
|
|
@@ -12,7 +12,7 @@ import { type ChartsSlotProps, type ChartsSlots } from "../internals/material/in
|
|
|
12
12
|
import { type ChartsToolbarSlotProps, type ChartsToolbarSlots } from "../Toolbar/index.js";
|
|
13
13
|
export interface RadarChartSlots extends ChartsTooltipSlots, ChartsOverlaySlots, ChartsLegendSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
|
|
14
14
|
export interface RadarChartSlotProps extends ChartsTooltipSlotProps, ChartsOverlaySlotProps, ChartsLegendSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
|
|
15
|
-
export interface RadarChartProps extends RadarDataProviderProps, Omit<RadarGridProps, 'classes'>, Omit<Partial<RadarAxisHighlightProps>, 'classes'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<ChartsWrapperProps, 'sx'>, Omit<ChartsSurfaceProps, 'sx'>, Pick<RadarSeriesPlotProps, 'onAreaClick' | 'onMarkClick'> {
|
|
15
|
+
export interface RadarChartProps extends Omit<RadarDataProviderProps, 'plugins'>, Omit<RadarGridProps, 'classes'>, Omit<Partial<RadarAxisHighlightProps>, 'classes'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<ChartsWrapperProps, 'sx'>, Omit<ChartsSurfaceProps, 'sx'>, Pick<RadarSeriesPlotProps, 'onAreaClick' | 'onMarkClick'> {
|
|
16
16
|
/**
|
|
17
17
|
* If `true`, the legend is not rendered.
|
|
18
18
|
*/
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { ChartContextValue } from "./ChartProvider.types.js";
|
|
3
1
|
/**
|
|
2
|
+
* @deprecated Use `ChartsContext` instead. We added S to the charts prefix to align with other components.
|
|
4
3
|
* @ignore - internal component.
|
|
5
4
|
*/
|
|
6
|
-
export declare const ChartContext:
|
|
5
|
+
export declare const ChartContext: import("react").Context<import("../ChartsProvider/index.js").ChartsContextValue<any> | null>;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.ChartContext = void 0;
|
|
9
|
-
var
|
|
8
|
+
var _ChartsContext = require("../ChartsProvider/ChartsContext");
|
|
10
9
|
/**
|
|
10
|
+
* @deprecated Use `ChartsContext` instead. We added S to the charts prefix to align with other components.
|
|
11
11
|
* @ignore - internal component.
|
|
12
12
|
*/
|
|
13
|
-
const ChartContext = exports.ChartContext =
|
|
14
|
-
if (process.env.NODE_ENV !== "production") ChartContext.displayName = "ChartContext";
|
|
13
|
+
const ChartContext = exports.ChartContext = _ChartsContext.ChartsContext;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export declare const defaultSeriesConfig: ChartSeriesConfig<'bar' | 'scatter' | 'line' | 'pie'>;
|
|
7
|
-
declare function ChartProvider<TSeriesType extends ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[]>(props: React.PropsWithChildren<ChartProviderProps<TSeriesType, TSignatures>>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export { ChartProvider };
|
|
1
|
+
import { ChartsProvider } from "../ChartsProvider/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use `ChartsProvider` instead. We added S to the charts prefix to align with other components.
|
|
4
|
+
*/
|
|
5
|
+
export declare const ChartProvider: typeof ChartsProvider;
|
|
@@ -1,47 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports.ChartProvider =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var _useChartTooltip = require("../../internals/plugins/featurePlugins/useChartTooltip");
|
|
15
|
-
var _useChartInteraction = require("../../internals/plugins/featurePlugins/useChartInteraction");
|
|
16
|
-
var _useChartZAxis = require("../../internals/plugins/featurePlugins/useChartZAxis");
|
|
17
|
-
var _useChartHighlight = require("../../internals/plugins/featurePlugins/useChartHighlight/useChartHighlight");
|
|
18
|
-
var _seriesConfig = require("../../BarChart/seriesConfig");
|
|
19
|
-
var _seriesConfig2 = require("../../ScatterChart/seriesConfig");
|
|
20
|
-
var _seriesConfig3 = require("../../LineChart/seriesConfig");
|
|
21
|
-
var _seriesConfig4 = require("../../PieChart/seriesConfig");
|
|
22
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
-
const defaultSeriesConfig = exports.defaultSeriesConfig = {
|
|
24
|
-
bar: _seriesConfig.barSeriesConfig,
|
|
25
|
-
scatter: _seriesConfig2.scatterSeriesConfig,
|
|
26
|
-
line: _seriesConfig3.lineSeriesConfig,
|
|
27
|
-
pie: _seriesConfig4.pieSeriesConfig
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
// For consistency with the v7, the cartesian axes are set by default.
|
|
31
|
-
// To remove them, you can provide a `plugins` props.
|
|
32
|
-
const defaultPlugins = [_useChartZAxis.useChartZAxis, _useChartTooltip.useChartTooltip, _useChartInteraction.useChartInteraction, _useChartCartesianAxis.useChartCartesianAxis, _useChartHighlight.useChartHighlight];
|
|
33
|
-
function ChartProvider(props) {
|
|
34
|
-
const {
|
|
35
|
-
children,
|
|
36
|
-
plugins = defaultPlugins,
|
|
37
|
-
pluginParams = {},
|
|
38
|
-
seriesConfig = defaultSeriesConfig
|
|
39
|
-
} = props;
|
|
40
|
-
const {
|
|
41
|
-
contextValue
|
|
42
|
-
} = (0, _useCharts.useCharts)(plugins, pluginParams, seriesConfig);
|
|
43
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartContext.ChartContext.Provider, {
|
|
44
|
-
value: contextValue,
|
|
45
|
-
children: children
|
|
46
|
-
});
|
|
47
|
-
}
|
|
7
|
+
exports.ChartProvider = void 0;
|
|
8
|
+
var _ChartsProvider = require("../ChartsProvider");
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Use `ChartsProvider` instead. We added S to the charts prefix to align with other components.
|
|
11
|
+
*/
|
|
12
|
+
const ChartProvider = exports.ChartProvider = _ChartsProvider.ChartsProvider;
|
|
@@ -1,42 +1,15 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
3
|
-
import type { ChartAnyPluginSignature, ChartInstance, ChartPublicAPI, ChartState, ConvertSignaturesIntoPlugins, MergeSignaturesProperty } from "../../internals/plugins/models/index.js";
|
|
4
|
-
import type { ChartCorePluginSignatures } from "../../internals/plugins/corePlugins/index.js";
|
|
5
|
-
import type { ChartSeriesConfig } from "../../internals/plugins/models/seriesConfig/index.js";
|
|
6
|
-
import type { UseChartBaseProps } from "../../internals/store/useCharts.types.js";
|
|
1
|
+
import type { ChartsContextValue, ChartsPluginParams, ChartsProviderProps } from "../ChartsProvider/ChartsProvider.types.js";
|
|
2
|
+
import type { ChartAnyPluginSignature } from "../../internals/plugins/models/index.js";
|
|
7
3
|
import type { ChartSeriesType } from "../../models/seriesType/config.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
store: Store<ChartState<TSignatures, TOptionalSignatures>>;
|
|
21
|
-
/**
|
|
22
|
-
* The ref to the <svg />.
|
|
23
|
-
*/
|
|
24
|
-
svgRef: React.RefObject<SVGSVGElement | null>;
|
|
25
|
-
/**
|
|
26
|
-
* The ref to the chart root element.
|
|
27
|
-
*/
|
|
28
|
-
chartRootRef: React.RefObject<HTMLDivElement | null>;
|
|
29
|
-
};
|
|
30
|
-
export type ChartPluginParams<TSignatures extends readonly ChartAnyPluginSignature[]> = UseChartBaseProps<TSignatures> & MergeSignaturesProperty<[...ChartCorePluginSignatures, ...TSignatures], 'params'>;
|
|
31
|
-
export interface ChartProviderProps<TSeries extends ChartSeriesType = ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[] = []> {
|
|
32
|
-
/**
|
|
33
|
-
* Array of plugins used to add features to the chart.
|
|
34
|
-
*/
|
|
35
|
-
plugins?: ConvertSignaturesIntoPlugins<TSignatures>;
|
|
36
|
-
pluginParams?: ChartPluginParams<TSignatures>;
|
|
37
|
-
/**
|
|
38
|
-
* The configuration helpers used to compute attributes according to the series type.
|
|
39
|
-
* @ignore Unstable props for internal usage.
|
|
40
|
-
*/
|
|
41
|
-
seriesConfig?: ChartSeriesConfig<TSeries>;
|
|
42
|
-
}
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Use `ChartsContextValue` instead. We added S to the charts prefix to align with other components.
|
|
6
|
+
*/
|
|
7
|
+
export type ChartContextValue<TSignatures extends readonly ChartAnyPluginSignature[], TOptionalSignatures extends readonly ChartAnyPluginSignature[] = []> = ChartsContextValue<TSignatures, TOptionalSignatures>;
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated Use `ChartsPluginParams` instead. We added S to the charts prefix to align with other components.
|
|
10
|
+
*/
|
|
11
|
+
export type ChartPluginParams<TSeriesType extends ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[]> = ChartsPluginParams<TSeriesType, TSignatures>;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Use `ChartsProviderProps` instead. We added S to the charts prefix to align with other components.
|
|
14
|
+
*/
|
|
15
|
+
export type ChartProviderProps<TSeriesType extends ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[]> = ChartsProviderProps<TSeriesType, TSignatures>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Use `useChartsContext` instead. We added S to the charts prefix to align with other components.
|
|
3
|
+
*/
|
|
4
|
+
export declare const useChartContext: <TSignatures extends readonly import("../../internals/index.js").ChartAnyPluginSignature[], TOptionalSignatures extends readonly import("../../internals/index.js").ChartAnyPluginSignature[] = []>() => import("../ChartsProvider/index.js").ChartsContextValue<TSignatures, TOptionalSignatures>;
|