@mui/x-charts 6.18.7 → 6.19.3
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 +1 -0
- package/BarChart/BarElement.d.ts +37 -20
- package/CHANGELOG.md +155 -0
- package/ChartsLegend/ChartsLegend.d.ts +5 -2
- package/ChartsLegend/ChartsLegend.js +137 -1
- package/ChartsReferenceLine/ChartsReferenceLine.js +7 -3
- package/ChartsSurface.d.ts +2 -2
- package/ChartsSurface.js +33 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +2 -54
- package/ChartsTooltip/ChartsItemTooltipContent.js +15 -1
- package/ChartsTooltip/ChartsTooltipTable.d.ts +1 -1
- package/ChartsTooltip/ChartsTooltipTable.js +2 -0
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -54
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +15 -1
- package/LineChart/LineChart.d.ts +1 -0
- package/LineChart/LineChart.js +2 -0
- package/LineChart/formatter.js +5 -1
- package/PieChart/PieArcLabel.d.ts +1 -0
- package/PieChart/PieArcLabel.js +7 -8
- package/PieChart/PieArcLabelPlot.d.ts +5 -0
- package/PieChart/PieArcLabelPlot.js +16 -3
- package/PieChart/PieArcPlot.d.ts +5 -0
- package/PieChart/PieArcPlot.js +9 -1
- package/PieChart/PieChart.d.ts +14 -2
- package/PieChart/PieChart.js +6 -2
- package/PieChart/PiePlot.js +3 -0
- package/PieChart/dataTransform/transition.js +9 -2
- package/PieChart/dataTransform/useTransformData.d.ts +1 -0
- package/PieChart/dataTransform/useTransformData.js +11 -8
- package/ScatterChart/ScatterChart.js +1 -0
- package/SparkLineChart/SparkLineChart.d.ts +15 -1
- package/SparkLineChart/SparkLineChart.js +8 -1
- package/context/CartesianContextProvider.d.ts +1 -1
- package/context/CartesianContextProvider.js +7 -6
- package/context/DrawingProvider.d.ts +1 -1
- package/context/DrawingProvider.js +8 -7
- package/context/HighlightProvider.d.ts +2 -2
- package/context/HighlightProvider.js +4 -3
- package/context/InteractionProvider.d.ts +2 -2
- package/context/InteractionProvider.js +4 -3
- package/context/SeriesContextProvider.d.ts +3 -1
- package/context/SeriesContextProvider.js +7 -6
- package/esm/BarChart/BarChart.js +1 -0
- package/esm/ChartsLegend/ChartsLegend.js +139 -2
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +7 -3
- package/esm/ChartsSurface.js +35 -2
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +2 -54
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +15 -1
- package/esm/ChartsTooltip/ChartsTooltipTable.js +2 -0
- package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -54
- package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +15 -1
- package/esm/LineChart/LineChart.js +2 -0
- package/esm/LineChart/formatter.js +5 -1
- package/esm/PieChart/PieArcLabel.js +7 -8
- package/esm/PieChart/PieArcLabelPlot.js +16 -3
- package/esm/PieChart/PieArcPlot.js +9 -1
- package/esm/PieChart/PieChart.js +6 -2
- package/esm/PieChart/PiePlot.js +3 -0
- package/esm/PieChart/dataTransform/transition.js +9 -2
- package/esm/PieChart/dataTransform/useTransformData.js +12 -9
- package/esm/ScatterChart/ScatterChart.js +1 -0
- package/esm/SparkLineChart/SparkLineChart.js +8 -1
- package/esm/context/CartesianContextProvider.js +7 -6
- package/esm/context/DrawingProvider.js +8 -7
- package/esm/context/HighlightProvider.js +6 -4
- package/esm/context/InteractionProvider.js +6 -4
- package/esm/context/SeriesContextProvider.js +9 -7
- package/esm/hooks/useDrawingArea.js +7 -3
- package/esm/index.js +2 -0
- package/esm/internals/stackSeries.js +5 -3
- package/esm/models/index.js +1 -0
- package/esm/models/stacking.js +1 -0
- package/hooks/useDrawingArea.d.ts +2 -0
- package/hooks/useDrawingArea.js +7 -3
- package/index.d.ts +2 -0
- package/index.js +23 -1
- package/internals/defaultizeColor.d.ts +7 -4
- package/internals/stackSeries.d.ts +8 -3
- package/internals/stackSeries.js +4 -3
- package/legacy/BarChart/BarChart.js +1 -0
- package/legacy/ChartsLegend/ChartsLegend.js +139 -2
- package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +5 -3
- package/legacy/ChartsReferenceLine/common.js +3 -4
- package/legacy/ChartsSurface.js +35 -2
- package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +2 -54
- package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +15 -1
- package/legacy/ChartsTooltip/ChartsTooltipTable.js +8 -7
- package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -54
- package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +15 -1
- package/legacy/LineChart/LineChart.js +2 -0
- package/legacy/LineChart/formatter.js +6 -2
- package/legacy/PieChart/PieArcLabel.js +7 -6
- package/legacy/PieChart/PieArcLabelPlot.js +16 -4
- package/legacy/PieChart/PieArcPlot.js +10 -1
- package/legacy/PieChart/PieChart.js +6 -2
- package/legacy/PieChart/PiePlot.js +3 -0
- package/legacy/PieChart/dataTransform/transition.js +9 -2
- package/legacy/PieChart/dataTransform/useTransformData.js +12 -9
- package/legacy/ScatterChart/ScatterChart.js +1 -0
- package/legacy/SparkLineChart/SparkLineChart.js +8 -1
- package/legacy/context/CartesianContextProvider.js +15 -15
- package/legacy/context/DrawingProvider.js +6 -6
- package/legacy/context/HighlightProvider.js +4 -3
- package/legacy/context/InteractionProvider.js +4 -3
- package/legacy/context/SeriesContextProvider.js +8 -7
- package/legacy/hooks/useDrawingArea.js +7 -3
- package/legacy/index.js +3 -1
- package/legacy/internals/components/AxisSharedComponents.js +5 -6
- package/legacy/internals/stackSeries.js +5 -3
- package/legacy/models/index.js +1 -0
- package/legacy/models/stacking.js +1 -0
- package/models/index.d.ts +1 -0
- package/models/index.js +11 -0
- package/models/seriesType/bar.d.ts +6 -0
- package/models/seriesType/common.d.ts +2 -3
- package/models/seriesType/index.d.ts +0 -1
- package/models/seriesType/line.d.ts +6 -0
- package/models/seriesType/pie.d.ts +15 -0
- package/models/stacking.d.ts +2 -0
- package/models/stacking.js +5 -0
- package/modern/BarChart/BarChart.js +1 -0
- package/modern/ChartsLegend/ChartsLegend.js +139 -2
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +7 -3
- package/modern/ChartsSurface.js +35 -2
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +2 -54
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +15 -1
- package/modern/ChartsTooltip/ChartsTooltipTable.js +2 -0
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -54
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +15 -1
- package/modern/LineChart/LineChart.js +2 -0
- package/modern/LineChart/formatter.js +5 -1
- package/modern/PieChart/PieArcLabel.js +7 -8
- package/modern/PieChart/PieArcLabelPlot.js +16 -3
- package/modern/PieChart/PieArcPlot.js +9 -1
- package/modern/PieChart/PieChart.js +6 -2
- package/modern/PieChart/PiePlot.js +3 -0
- package/modern/PieChart/dataTransform/transition.js +9 -2
- package/modern/PieChart/dataTransform/useTransformData.js +11 -8
- package/modern/ScatterChart/ScatterChart.js +1 -0
- package/modern/SparkLineChart/SparkLineChart.js +8 -1
- package/modern/context/CartesianContextProvider.js +7 -6
- package/modern/context/DrawingProvider.js +8 -7
- package/modern/context/HighlightProvider.js +6 -4
- package/modern/context/InteractionProvider.js +6 -4
- package/modern/context/SeriesContextProvider.js +9 -7
- package/modern/hooks/useDrawingArea.js +7 -3
- package/modern/index.js +3 -1
- package/modern/internals/stackSeries.js +4 -3
- package/modern/models/index.js +1 -0
- package/modern/models/stacking.js +1 -0
- package/package.json +1 -1
|
@@ -76,6 +76,7 @@ const defaultLabelTransitionConfig = exports.defaultLabelTransitionConfig = {
|
|
|
76
76
|
from: ({
|
|
77
77
|
innerRadius,
|
|
78
78
|
outerRadius,
|
|
79
|
+
arcLabelRadius,
|
|
79
80
|
cornerRadius,
|
|
80
81
|
startAngle,
|
|
81
82
|
endAngle,
|
|
@@ -84,6 +85,7 @@ const defaultLabelTransitionConfig = exports.defaultLabelTransitionConfig = {
|
|
|
84
85
|
innerRadius,
|
|
85
86
|
outerRadius: (innerRadius + outerRadius) / 2,
|
|
86
87
|
cornerRadius,
|
|
88
|
+
arcLabelRadius,
|
|
87
89
|
startAngle: (startAngle + endAngle) / 2,
|
|
88
90
|
endAngle: (startAngle + endAngle) / 2,
|
|
89
91
|
paddingAngle,
|
|
@@ -96,6 +98,7 @@ const defaultLabelTransitionConfig = exports.defaultLabelTransitionConfig = {
|
|
|
96
98
|
}) => ({
|
|
97
99
|
innerRadius,
|
|
98
100
|
outerRadius: innerRadius,
|
|
101
|
+
arcLabelRadius: innerRadius,
|
|
99
102
|
startAngle: (startAngle + endAngle) / 2,
|
|
100
103
|
endAngle: (startAngle + endAngle) / 2,
|
|
101
104
|
opacity: 0
|
|
@@ -104,12 +107,14 @@ const defaultLabelTransitionConfig = exports.defaultLabelTransitionConfig = {
|
|
|
104
107
|
innerRadius,
|
|
105
108
|
outerRadius,
|
|
106
109
|
startAngle,
|
|
107
|
-
endAngle
|
|
110
|
+
endAngle,
|
|
111
|
+
arcLabelRadius
|
|
108
112
|
}) => ({
|
|
109
113
|
innerRadius,
|
|
110
114
|
outerRadius,
|
|
111
115
|
startAngle,
|
|
112
116
|
endAngle,
|
|
117
|
+
arcLabelRadius,
|
|
113
118
|
opacity: 1
|
|
114
119
|
}),
|
|
115
120
|
update: ({
|
|
@@ -118,7 +123,8 @@ const defaultLabelTransitionConfig = exports.defaultLabelTransitionConfig = {
|
|
|
118
123
|
cornerRadius,
|
|
119
124
|
startAngle,
|
|
120
125
|
endAngle,
|
|
121
|
-
paddingAngle
|
|
126
|
+
paddingAngle,
|
|
127
|
+
arcLabelRadius
|
|
122
128
|
}) => ({
|
|
123
129
|
innerRadius,
|
|
124
130
|
outerRadius,
|
|
@@ -126,6 +132,7 @@ const defaultLabelTransitionConfig = exports.defaultLabelTransitionConfig = {
|
|
|
126
132
|
startAngle,
|
|
127
133
|
endAngle,
|
|
128
134
|
paddingAngle,
|
|
135
|
+
arcLabelRadius,
|
|
129
136
|
opacity: 1
|
|
130
137
|
}),
|
|
131
138
|
config: {
|
|
@@ -20,6 +20,7 @@ function useTransformData(series) {
|
|
|
20
20
|
highlighted,
|
|
21
21
|
paddingAngle: basePaddingAngle = 0,
|
|
22
22
|
innerRadius: baseInnerRadius = 0,
|
|
23
|
+
arcLabelRadius: baseArcLabelRadius,
|
|
23
24
|
outerRadius: baseOuterRadius,
|
|
24
25
|
cornerRadius: baseCornerRadius = 0
|
|
25
26
|
} = series;
|
|
@@ -47,21 +48,23 @@ function useTransformData(series) {
|
|
|
47
48
|
isHighlighted,
|
|
48
49
|
isFaded
|
|
49
50
|
} = getHighlightStatus(itemIndex);
|
|
50
|
-
const
|
|
51
|
+
const attributesOverride = (0, _extends2.default)({
|
|
51
52
|
additionalRadius: 0
|
|
52
53
|
}, isFaded && faded || isHighlighted && highlighted || {});
|
|
53
|
-
const paddingAngle = Math.max(0, Math.PI * (
|
|
54
|
-
const innerRadius = Math.max(0,
|
|
55
|
-
const outerRadius = Math.max(0,
|
|
56
|
-
const cornerRadius =
|
|
57
|
-
|
|
54
|
+
const paddingAngle = Math.max(0, Math.PI * (attributesOverride.paddingAngle ?? basePaddingAngle) / 180);
|
|
55
|
+
const innerRadius = Math.max(0, attributesOverride.innerRadius ?? baseInnerRadius);
|
|
56
|
+
const outerRadius = Math.max(0, attributesOverride.outerRadius ?? baseOuterRadius + attributesOverride.additionalRadius);
|
|
57
|
+
const cornerRadius = attributesOverride.cornerRadius ?? baseCornerRadius;
|
|
58
|
+
const arcLabelRadius = attributesOverride.arcLabelRadius ?? baseArcLabelRadius ?? (innerRadius + outerRadius) / 2;
|
|
59
|
+
return (0, _extends2.default)({}, item, attributesOverride, {
|
|
58
60
|
isFaded,
|
|
59
61
|
isHighlighted,
|
|
60
62
|
paddingAngle,
|
|
61
63
|
innerRadius,
|
|
62
64
|
outerRadius,
|
|
63
|
-
cornerRadius
|
|
65
|
+
cornerRadius,
|
|
66
|
+
arcLabelRadius
|
|
64
67
|
});
|
|
65
|
-
}), [baseCornerRadius, baseInnerRadius, baseOuterRadius, basePaddingAngle, data, faded, getHighlightStatus, highlighted]);
|
|
68
|
+
}), [baseCornerRadius, baseInnerRadius, baseOuterRadius, basePaddingAngle, baseArcLabelRadius, data, faded, getHighlightStatus, highlighted]);
|
|
66
69
|
return dataWithHighlight;
|
|
67
70
|
}
|
|
@@ -121,6 +121,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
121
121
|
className: _propTypes.default.string,
|
|
122
122
|
/**
|
|
123
123
|
* Color palette used to colorize multiple series.
|
|
124
|
+
* @default blueberryTwilightPalette
|
|
124
125
|
*/
|
|
125
126
|
colors: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.func]),
|
|
126
127
|
/**
|
|
@@ -10,11 +10,12 @@ import { LinePlotSlotsComponent, LinePlotSlotComponentProps } from '../LineChart
|
|
|
10
10
|
import { MarkPlotSlotsComponent, MarkPlotSlotComponentProps } from '../LineChart/MarkPlot';
|
|
11
11
|
import { LineHighlightPlotSlotsComponent, LineHighlightPlotSlotComponentProps } from '../LineChart/LineHighlightPlot';
|
|
12
12
|
import { BarPlotSlotsComponent, BarPlotSlotComponentProps } from '../BarChart/BarPlot';
|
|
13
|
+
import { CardinalDirections } from '../models/layout';
|
|
13
14
|
export interface SparkLineChartSlotsComponent extends AreaPlotSlotsComponent, LinePlotSlotsComponent, MarkPlotSlotsComponent, LineHighlightPlotSlotsComponent, BarPlotSlotsComponent, ChartsTooltipSlotsComponent {
|
|
14
15
|
}
|
|
15
16
|
export interface SparkLineChartSlotComponentProps extends AreaPlotSlotComponentProps, LinePlotSlotComponentProps, MarkPlotSlotComponentProps, LineHighlightPlotSlotComponentProps, BarPlotSlotComponentProps, ChartsTooltipSlotComponentProps {
|
|
16
17
|
}
|
|
17
|
-
export interface SparkLineChartProps extends Omit<ResponsiveChartContainerProps, 'series' | 'xAxis' | 'yAxis'> {
|
|
18
|
+
export interface SparkLineChartProps extends Omit<ResponsiveChartContainerProps, 'series' | 'xAxis' | 'yAxis' | 'margin'> {
|
|
18
19
|
/**
|
|
19
20
|
* The xAxis configuration.
|
|
20
21
|
* Notice it is a single configuration object, not an array of configuration.
|
|
@@ -35,6 +36,7 @@ export interface SparkLineChartProps extends Omit<ResponsiveChartContainerProps,
|
|
|
35
36
|
* Formatter used by the tooltip.
|
|
36
37
|
* @param {number} value The value to format.
|
|
37
38
|
* @returns {string} the formatted value.
|
|
39
|
+
* @default (v: number) => v.toString()
|
|
38
40
|
*/
|
|
39
41
|
valueFormatter?: (value: number) => string;
|
|
40
42
|
/**
|
|
@@ -59,6 +61,18 @@ export interface SparkLineChartProps extends Omit<ResponsiveChartContainerProps,
|
|
|
59
61
|
* @default 'linear'
|
|
60
62
|
*/
|
|
61
63
|
curve?: LineSeriesType['curve'];
|
|
64
|
+
/**
|
|
65
|
+
* The margin between the SVG and the drawing area.
|
|
66
|
+
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
67
|
+
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
68
|
+
* @default {
|
|
69
|
+
* top: 5,
|
|
70
|
+
* bottom: 5,
|
|
71
|
+
* left: 5,
|
|
72
|
+
* right: 5,
|
|
73
|
+
* }
|
|
74
|
+
*/
|
|
75
|
+
margin?: Partial<CardinalDirections<number>>;
|
|
62
76
|
/**
|
|
63
77
|
* Overridable component slots.
|
|
64
78
|
* @default {}
|
|
@@ -127,6 +127,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
127
127
|
className: _propTypes.default.string,
|
|
128
128
|
/**
|
|
129
129
|
* Color palette used to colorize multiple series.
|
|
130
|
+
* @default blueberryTwilightPalette
|
|
130
131
|
*/
|
|
131
132
|
colors: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.func]),
|
|
132
133
|
/**
|
|
@@ -157,7 +158,12 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
157
158
|
* The margin between the SVG and the drawing area.
|
|
158
159
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
159
160
|
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
160
|
-
* @default
|
|
161
|
+
* @default {
|
|
162
|
+
* top: 5,
|
|
163
|
+
* bottom: 5,
|
|
164
|
+
* left: 5,
|
|
165
|
+
* right: 5,
|
|
166
|
+
* }
|
|
161
167
|
*/
|
|
162
168
|
margin: _propTypes.default.shape({
|
|
163
169
|
bottom: _propTypes.default.number,
|
|
@@ -206,6 +212,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
206
212
|
* Formatter used by the tooltip.
|
|
207
213
|
* @param {number} value The value to format.
|
|
208
214
|
* @returns {string} the formatted value.
|
|
215
|
+
* @default (v: number) => v.toString()
|
|
209
216
|
*/
|
|
210
217
|
valueFormatter: _propTypes.default.func,
|
|
211
218
|
viewBox: _propTypes.default.shape({
|
|
@@ -50,7 +50,7 @@ export declare const CartesianContext: React.Context<{
|
|
|
50
50
|
*
|
|
51
51
|
* - [CartesianContextProvider API](https://mui.com/x/api/charts/cartesian-context-provider/)
|
|
52
52
|
*/
|
|
53
|
-
declare function CartesianContextProvider(
|
|
53
|
+
declare function CartesianContextProvider(props: CartesianContextProviderProps): React.JSX.Element;
|
|
54
54
|
declare namespace CartesianContextProvider {
|
|
55
55
|
var propTypes: any;
|
|
56
56
|
}
|
|
@@ -48,12 +48,13 @@ const CartesianContext = exports.CartesianContext = /*#__PURE__*/React.createCon
|
|
|
48
48
|
*
|
|
49
49
|
* - [CartesianContextProvider API](https://mui.com/x/api/charts/cartesian-context-provider/)
|
|
50
50
|
*/
|
|
51
|
-
function CartesianContextProvider({
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
function CartesianContextProvider(props) {
|
|
52
|
+
const {
|
|
53
|
+
xAxis: inXAxis,
|
|
54
|
+
yAxis: inYAxis,
|
|
55
|
+
dataset,
|
|
56
|
+
children
|
|
57
|
+
} = props;
|
|
57
58
|
const formattedSeries = React.useContext(_SeriesContextProvider.SeriesContext);
|
|
58
59
|
const drawingArea = React.useContext(_DrawingProvider.DrawingContext);
|
|
59
60
|
const xAxis = React.useMemo(() => inXAxis?.map(axisConfig => {
|
|
@@ -40,7 +40,7 @@ export declare const SVGContext: React.Context<React.RefObject<SVGSVGElement>>;
|
|
|
40
40
|
*
|
|
41
41
|
* - [DrawingProvider API](https://mui.com/x/api/charts/drawing-provider/)
|
|
42
42
|
*/
|
|
43
|
-
declare function DrawingProvider(
|
|
43
|
+
declare function DrawingProvider(props: DrawingProviderProps): React.JSX.Element;
|
|
44
44
|
declare namespace DrawingProvider {
|
|
45
45
|
var propTypes: any;
|
|
46
46
|
}
|
|
@@ -34,13 +34,14 @@ const SVGContext = exports.SVGContext = /*#__PURE__*/React.createContext({
|
|
|
34
34
|
*
|
|
35
35
|
* - [DrawingProvider API](https://mui.com/x/api/charts/drawing-provider/)
|
|
36
36
|
*/
|
|
37
|
-
function DrawingProvider({
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
function DrawingProvider(props) {
|
|
38
|
+
const {
|
|
39
|
+
width,
|
|
40
|
+
height,
|
|
41
|
+
margin,
|
|
42
|
+
svgRef,
|
|
43
|
+
children
|
|
44
|
+
} = props;
|
|
44
45
|
const drawingArea = (0, _useChartDimensions.default)(width, height, margin);
|
|
45
46
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(SVGContext.Provider, {
|
|
46
47
|
value: svgRef,
|
|
@@ -41,5 +41,5 @@ type HighlighState = {
|
|
|
41
41
|
dispatch: React.Dispatch<HighlighActions>;
|
|
42
42
|
};
|
|
43
43
|
export declare const HighlighContext: React.Context<HighlighState>;
|
|
44
|
-
|
|
45
|
-
export {};
|
|
44
|
+
declare function HighlightProvider(props: HighlightProviderProps): React.JSX.Element;
|
|
45
|
+
export { HighlightProvider };
|
|
@@ -39,9 +39,10 @@ const dataReducer = (prevState, action) => {
|
|
|
39
39
|
return prevState;
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
-
function HighlightProvider({
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
function HighlightProvider(props) {
|
|
43
|
+
const {
|
|
44
|
+
children
|
|
45
|
+
} = props;
|
|
45
46
|
const [data, dispatch] = React.useReducer(dataReducer, {
|
|
46
47
|
item: null,
|
|
47
48
|
scope: defaultScope
|
|
@@ -36,5 +36,5 @@ type InteractionState = {
|
|
|
36
36
|
dispatch: React.Dispatch<InteractionActions>;
|
|
37
37
|
};
|
|
38
38
|
export declare const InteractionContext: React.Context<InteractionState>;
|
|
39
|
-
|
|
40
|
-
export {};
|
|
39
|
+
declare function InteractionProvider(props: InteractionProviderProps): React.JSX.Element;
|
|
40
|
+
export { InteractionProvider };
|
|
@@ -41,9 +41,10 @@ const dataReducer = (prevState, action) => {
|
|
|
41
41
|
return prevState;
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
-
function InteractionProvider({
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
function InteractionProvider(props) {
|
|
45
|
+
const {
|
|
46
|
+
children
|
|
47
|
+
} = props;
|
|
47
48
|
const [data, dispatch] = React.useReducer(dataReducer, {
|
|
48
49
|
item: null,
|
|
49
50
|
axis: {
|
|
@@ -12,6 +12,7 @@ export type SeriesContextProviderProps = {
|
|
|
12
12
|
series: AllSeriesType[];
|
|
13
13
|
/**
|
|
14
14
|
* Color palette used to colorize multiple series.
|
|
15
|
+
* @default blueberryTwilightPalette
|
|
15
16
|
*/
|
|
16
17
|
colors?: ChartsColorPalette;
|
|
17
18
|
children: React.ReactNode;
|
|
@@ -20,4 +21,5 @@ export type FormattedSeries = {
|
|
|
20
21
|
[type in ChartSeriesType]?: FormatterResult<type>;
|
|
21
22
|
};
|
|
22
23
|
export declare const SeriesContext: React.Context<FormattedSeries>;
|
|
23
|
-
|
|
24
|
+
declare function SeriesContextProvider(props: SeriesContextProviderProps): React.JSX.Element;
|
|
25
|
+
export { SeriesContextProvider };
|
|
@@ -65,12 +65,13 @@ const formatSeries = (series, colors, dataset) => {
|
|
|
65
65
|
});
|
|
66
66
|
return formattedSeries;
|
|
67
67
|
};
|
|
68
|
-
function SeriesContextProvider({
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
function SeriesContextProvider(props) {
|
|
69
|
+
const {
|
|
70
|
+
series,
|
|
71
|
+
dataset,
|
|
72
|
+
colors = _colorPalettes.blueberryTwilightPalette,
|
|
73
|
+
children
|
|
74
|
+
} = props;
|
|
74
75
|
const theme = (0, _styles.useTheme)();
|
|
75
76
|
const formattedSeries = React.useMemo(() => formatSeries(series, typeof colors === 'function' ? colors(theme.palette.mode) : colors, dataset), [series, colors, theme.palette.mode, dataset]);
|
|
76
77
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(SeriesContext.Provider, {
|
package/esm/BarChart/BarChart.js
CHANGED
|
@@ -156,6 +156,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
156
156
|
className: PropTypes.string,
|
|
157
157
|
/**
|
|
158
158
|
* Color palette used to colorize multiple series.
|
|
159
|
+
* @default blueberryTwilightPalette
|
|
159
160
|
*/
|
|
160
161
|
colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
|
|
161
162
|
/**
|
|
@@ -3,6 +3,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
3
3
|
const _excluded = ["rotate", "dominantBaseline"],
|
|
4
4
|
_excluded2 = ["label"];
|
|
5
5
|
import * as React from 'react';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
6
7
|
import { useSlotProps } from '@mui/base/utils';
|
|
7
8
|
import { NoSsr } from '@mui/base/NoSsr';
|
|
8
9
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
@@ -234,7 +235,108 @@ function DefaultChartsLegend(props) {
|
|
|
234
235
|
})
|
|
235
236
|
});
|
|
236
237
|
}
|
|
237
|
-
|
|
238
|
+
process.env.NODE_ENV !== "production" ? DefaultChartsLegend.propTypes = {
|
|
239
|
+
// ----------------------------- Warning --------------------------------
|
|
240
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
241
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
242
|
+
// ----------------------------------------------------------------------
|
|
243
|
+
/**
|
|
244
|
+
* Override or extend the styles applied to the component.
|
|
245
|
+
*/
|
|
246
|
+
classes: PropTypes.object.isRequired,
|
|
247
|
+
/**
|
|
248
|
+
* The direction of the legend layout.
|
|
249
|
+
* The default depends on the chart.
|
|
250
|
+
*/
|
|
251
|
+
direction: PropTypes.oneOf(['column', 'row']).isRequired,
|
|
252
|
+
drawingArea: PropTypes.shape({
|
|
253
|
+
bottom: PropTypes.number.isRequired,
|
|
254
|
+
height: PropTypes.number.isRequired,
|
|
255
|
+
left: PropTypes.number.isRequired,
|
|
256
|
+
right: PropTypes.number.isRequired,
|
|
257
|
+
top: PropTypes.number.isRequired,
|
|
258
|
+
width: PropTypes.number.isRequired
|
|
259
|
+
}).isRequired,
|
|
260
|
+
/**
|
|
261
|
+
* Set to true to hide the legend.
|
|
262
|
+
* @default false
|
|
263
|
+
*/
|
|
264
|
+
hidden: PropTypes.bool,
|
|
265
|
+
/**
|
|
266
|
+
* Space between two legend items (in px).
|
|
267
|
+
* @default 10
|
|
268
|
+
*/
|
|
269
|
+
itemGap: PropTypes.number,
|
|
270
|
+
/**
|
|
271
|
+
* Height of the item mark (in px).
|
|
272
|
+
* @default 20
|
|
273
|
+
*/
|
|
274
|
+
itemMarkHeight: PropTypes.number,
|
|
275
|
+
/**
|
|
276
|
+
* Width of the item mark (in px).
|
|
277
|
+
* @default 20
|
|
278
|
+
*/
|
|
279
|
+
itemMarkWidth: PropTypes.number,
|
|
280
|
+
/**
|
|
281
|
+
* Style applied to legend labels.
|
|
282
|
+
* @default theme.typography.subtitle1
|
|
283
|
+
*/
|
|
284
|
+
labelStyle: PropTypes.object,
|
|
285
|
+
/**
|
|
286
|
+
* Space between the mark and the label (in px).
|
|
287
|
+
* @default 5
|
|
288
|
+
*/
|
|
289
|
+
markGap: PropTypes.number,
|
|
290
|
+
/**
|
|
291
|
+
* Legend padding (in px).
|
|
292
|
+
* Can either be a single number, or an object with top, left, bottom, right properties.
|
|
293
|
+
* @default 0
|
|
294
|
+
*/
|
|
295
|
+
padding: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
296
|
+
bottom: PropTypes.number,
|
|
297
|
+
left: PropTypes.number,
|
|
298
|
+
right: PropTypes.number,
|
|
299
|
+
top: PropTypes.number
|
|
300
|
+
})]),
|
|
301
|
+
position: PropTypes.shape({
|
|
302
|
+
horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
|
|
303
|
+
vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
304
|
+
}).isRequired,
|
|
305
|
+
series: PropTypes.shape({
|
|
306
|
+
bar: PropTypes.shape({
|
|
307
|
+
series: PropTypes.object.isRequired,
|
|
308
|
+
seriesOrder: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
309
|
+
stackingGroups: PropTypes.arrayOf(PropTypes.shape({
|
|
310
|
+
ids: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
311
|
+
stackingOffset: PropTypes.func.isRequired,
|
|
312
|
+
stackingOrder: PropTypes.func.isRequired
|
|
313
|
+
})).isRequired
|
|
314
|
+
}),
|
|
315
|
+
line: PropTypes.shape({
|
|
316
|
+
series: PropTypes.object.isRequired,
|
|
317
|
+
seriesOrder: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
318
|
+
stackingGroups: PropTypes.arrayOf(PropTypes.shape({
|
|
319
|
+
ids: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
320
|
+
stackingOffset: PropTypes.func.isRequired,
|
|
321
|
+
stackingOrder: PropTypes.func.isRequired
|
|
322
|
+
})).isRequired
|
|
323
|
+
}),
|
|
324
|
+
pie: PropTypes.shape({
|
|
325
|
+
series: PropTypes.object.isRequired,
|
|
326
|
+
seriesOrder: PropTypes.arrayOf(PropTypes.string).isRequired
|
|
327
|
+
}),
|
|
328
|
+
scatter: PropTypes.shape({
|
|
329
|
+
series: PropTypes.object.isRequired,
|
|
330
|
+
seriesOrder: PropTypes.arrayOf(PropTypes.string).isRequired
|
|
331
|
+
})
|
|
332
|
+
}).isRequired,
|
|
333
|
+
seriesToDisplay: PropTypes.arrayOf(PropTypes.shape({
|
|
334
|
+
color: PropTypes.string.isRequired,
|
|
335
|
+
id: PropTypes.string.isRequired,
|
|
336
|
+
label: PropTypes.string.isRequired
|
|
337
|
+
})).isRequired
|
|
338
|
+
} : void 0;
|
|
339
|
+
function ChartsLegend(inProps) {
|
|
238
340
|
var _slots$legend;
|
|
239
341
|
const props = useThemeProps({
|
|
240
342
|
props: _extends({}, defaultProps, inProps),
|
|
@@ -270,4 +372,39 @@ export function ChartsLegend(inProps) {
|
|
|
270
372
|
ownerState: {}
|
|
271
373
|
});
|
|
272
374
|
return /*#__PURE__*/_jsx(ChartLegendRender, _extends({}, chartLegendRenderProps));
|
|
273
|
-
}
|
|
375
|
+
}
|
|
376
|
+
process.env.NODE_ENV !== "production" ? ChartsLegend.propTypes = {
|
|
377
|
+
// ----------------------------- Warning --------------------------------
|
|
378
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
379
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
380
|
+
// ----------------------------------------------------------------------
|
|
381
|
+
/**
|
|
382
|
+
* Override or extend the styles applied to the component.
|
|
383
|
+
*/
|
|
384
|
+
classes: PropTypes.object,
|
|
385
|
+
/**
|
|
386
|
+
* The direction of the legend layout.
|
|
387
|
+
* The default depends on the chart.
|
|
388
|
+
*/
|
|
389
|
+
direction: PropTypes.oneOf(['column', 'row']),
|
|
390
|
+
/**
|
|
391
|
+
* Set to true to hide the legend.
|
|
392
|
+
* @default false
|
|
393
|
+
*/
|
|
394
|
+
hidden: PropTypes.bool,
|
|
395
|
+
position: PropTypes.shape({
|
|
396
|
+
horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
|
|
397
|
+
vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
398
|
+
}),
|
|
399
|
+
/**
|
|
400
|
+
* The props used for each component slot.
|
|
401
|
+
* @default {}
|
|
402
|
+
*/
|
|
403
|
+
slotProps: PropTypes.object,
|
|
404
|
+
/**
|
|
405
|
+
* Overridable component slots.
|
|
406
|
+
* @default {}
|
|
407
|
+
*/
|
|
408
|
+
slots: PropTypes.object
|
|
409
|
+
} : void 0;
|
|
410
|
+
export { ChartsLegend };
|
|
@@ -5,13 +5,17 @@ import { ChartsXReferenceLine } from './ChartsXReferenceLine';
|
|
|
5
5
|
import { ChartsYReferenceLine } from './ChartsYReferenceLine';
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
function ChartsReferenceLine(props) {
|
|
8
|
-
|
|
8
|
+
const {
|
|
9
|
+
x,
|
|
10
|
+
y
|
|
11
|
+
} = props;
|
|
12
|
+
if (x !== undefined && y !== undefined) {
|
|
9
13
|
throw new Error('MUI-X-Charts: The ChartsReferenceLine can not have both `x` and `y` props set.');
|
|
10
14
|
}
|
|
11
|
-
if (
|
|
15
|
+
if (x === undefined && y === undefined) {
|
|
12
16
|
throw new Error('MUI-X-Charts: The ChartsReferenceLine should have a value in `x` or `y` prop.');
|
|
13
17
|
}
|
|
14
|
-
if (
|
|
18
|
+
if (x !== undefined) {
|
|
15
19
|
return /*#__PURE__*/_jsx(ChartsXReferenceLine, _extends({}, props));
|
|
16
20
|
}
|
|
17
21
|
return /*#__PURE__*/_jsx(ChartsYReferenceLine, _extends({}, props));
|
package/esm/ChartsSurface.js
CHANGED
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["children", "width", "height", "viewBox", "disableAxisListener", "className"];
|
|
4
4
|
import { styled } from '@mui/material/styles';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
5
6
|
import * as React from 'react';
|
|
6
7
|
import { useAxisEvents } from './hooks/useAxisEvents';
|
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -10,7 +11,7 @@ const ChartChartsSurfaceStyles = styled('svg', {
|
|
|
10
11
|
name: 'MuiChartsSurface',
|
|
11
12
|
slot: 'Root'
|
|
12
13
|
})(() => ({}));
|
|
13
|
-
|
|
14
|
+
const ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurface(props, ref) {
|
|
14
15
|
const {
|
|
15
16
|
children,
|
|
16
17
|
width,
|
|
@@ -38,4 +39,36 @@ export const ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurfac
|
|
|
38
39
|
children: props.desc
|
|
39
40
|
}), children]
|
|
40
41
|
}));
|
|
41
|
-
});
|
|
42
|
+
});
|
|
43
|
+
process.env.NODE_ENV !== "production" ? ChartsSurface.propTypes = {
|
|
44
|
+
// ----------------------------- Warning --------------------------------
|
|
45
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
46
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
47
|
+
// ----------------------------------------------------------------------
|
|
48
|
+
children: PropTypes.node,
|
|
49
|
+
className: PropTypes.string,
|
|
50
|
+
desc: PropTypes.string,
|
|
51
|
+
/**
|
|
52
|
+
* If `true`, the charts will not listen to the mouse move event.
|
|
53
|
+
* It might break interactive features, but will improve performance.
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
56
|
+
disableAxisListener: PropTypes.bool,
|
|
57
|
+
/**
|
|
58
|
+
* The height of the chart in px.
|
|
59
|
+
*/
|
|
60
|
+
height: PropTypes.number.isRequired,
|
|
61
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
62
|
+
title: PropTypes.string,
|
|
63
|
+
viewBox: PropTypes.shape({
|
|
64
|
+
height: PropTypes.number,
|
|
65
|
+
width: PropTypes.number,
|
|
66
|
+
x: PropTypes.number,
|
|
67
|
+
y: PropTypes.number
|
|
68
|
+
}),
|
|
69
|
+
/**
|
|
70
|
+
* The width of the chart in px.
|
|
71
|
+
*/
|
|
72
|
+
width: PropTypes.number.isRequired
|
|
73
|
+
} : void 0;
|
|
74
|
+
export { ChartsSurface };
|
|
@@ -76,37 +76,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxisTooltipContent.propTypes = {
|
|
|
76
76
|
classes: PropTypes.object.isRequired,
|
|
77
77
|
content: PropTypes.elementType,
|
|
78
78
|
contentProps: PropTypes.shape({
|
|
79
|
-
axis: PropTypes.
|
|
80
|
-
axisId: PropTypes.string,
|
|
81
|
-
classes: PropTypes.object,
|
|
82
|
-
data: PropTypes.array,
|
|
83
|
-
dataKey: PropTypes.string,
|
|
84
|
-
disableLine: PropTypes.bool,
|
|
85
|
-
disableTicks: PropTypes.bool,
|
|
86
|
-
fill: PropTypes.string,
|
|
87
|
-
hideTooltip: PropTypes.bool,
|
|
88
|
-
id: PropTypes.string.isRequired,
|
|
89
|
-
label: PropTypes.string,
|
|
90
|
-
labelFontSize: PropTypes.number,
|
|
91
|
-
labelStyle: PropTypes.object,
|
|
92
|
-
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
93
|
-
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
94
|
-
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
95
|
-
scale: PropTypes.func.isRequired,
|
|
96
|
-
scaleType: PropTypes.oneOf(['time']).isRequired,
|
|
97
|
-
slotProps: PropTypes.object,
|
|
98
|
-
slots: PropTypes.object,
|
|
99
|
-
stroke: PropTypes.string,
|
|
100
|
-
tickFontSize: PropTypes.number,
|
|
101
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
102
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
103
|
-
tickLabelStyle: PropTypes.object,
|
|
104
|
-
tickMaxStep: PropTypes.number,
|
|
105
|
-
tickMinStep: PropTypes.number,
|
|
106
|
-
tickNumber: PropTypes.number.isRequired,
|
|
107
|
-
tickSize: PropTypes.number,
|
|
108
|
-
valueFormatter: PropTypes.func
|
|
109
|
-
}),
|
|
79
|
+
axis: PropTypes.object,
|
|
110
80
|
axisData: PropTypes.shape({
|
|
111
81
|
x: PropTypes.shape({
|
|
112
82
|
index: PropTypes.number,
|
|
@@ -120,29 +90,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxisTooltipContent.propTypes = {
|
|
|
120
90
|
axisValue: PropTypes.any,
|
|
121
91
|
classes: PropTypes.object,
|
|
122
92
|
dataIndex: PropTypes.number,
|
|
123
|
-
series: PropTypes.arrayOf(PropTypes.
|
|
124
|
-
area: PropTypes.bool,
|
|
125
|
-
color: PropTypes.string.isRequired,
|
|
126
|
-
connectNulls: PropTypes.bool,
|
|
127
|
-
curve: PropTypes.oneOf(['catmullRom', 'linear', 'monotoneX', 'monotoneY', 'natural', 'step', 'stepAfter', 'stepBefore']),
|
|
128
|
-
data: PropTypes.arrayOf(PropTypes.number).isRequired,
|
|
129
|
-
dataKey: PropTypes.string,
|
|
130
|
-
disableHighlight: PropTypes.bool,
|
|
131
|
-
highlightScope: PropTypes.shape({
|
|
132
|
-
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
133
|
-
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
134
|
-
}),
|
|
135
|
-
id: PropTypes.string.isRequired,
|
|
136
|
-
label: PropTypes.string,
|
|
137
|
-
showMark: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
|
|
138
|
-
stack: PropTypes.string,
|
|
139
|
-
stackOffset: PropTypes.oneOf(['diverging', 'expand', 'none', 'silhouette', 'wiggle']),
|
|
140
|
-
stackOrder: PropTypes.oneOf(['appearance', 'ascending', 'descending', 'insideOut', 'none', 'reverse']),
|
|
141
|
-
type: PropTypes.oneOf(['line']).isRequired,
|
|
142
|
-
valueFormatter: PropTypes.func.isRequired,
|
|
143
|
-
xAxisKey: PropTypes.string,
|
|
144
|
-
yAxisKey: PropTypes.string
|
|
145
|
-
})),
|
|
93
|
+
series: PropTypes.arrayOf(PropTypes.object),
|
|
146
94
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
147
95
|
}),
|
|
148
96
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|