@mui/x-charts 7.6.2 → 7.7.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 +1 -1
- package/CHANGELOG.md +81 -0
- package/ChartContainer/ChartContainer.d.ts +3 -3
- package/ChartContainer/ChartContainer.js +59 -22
- package/ChartsOverlay/index.d.ts +1 -0
- package/ChartsReferenceLine/ChartsXReferenceLine.js +3 -5
- package/ChartsReferenceLine/ChartsYReferenceLine.js +3 -5
- package/ChartsText/ChartsText.js +1 -3
- package/ChartsTooltip/ChartsAxisTooltipContent.js +6 -12
- package/ChartsTooltip/ChartsItemTooltipContent.js +6 -16
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +3 -3
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/LineChart/LineChart.d.ts +2 -2
- package/LineChart/LineChart.js +1 -1
- package/PieChart/PieChart.d.ts +2 -2
- package/PieChart/PieChart.js +1 -1
- package/ResponsiveChartContainer/ResizableContainer.d.ts +10 -0
- package/ResponsiveChartContainer/ResizableContainer.js +32 -0
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +25 -22
- package/ScatterChart/ScatterChart.d.ts +1 -1
- package/ScatterChart/ScatterChart.js +1 -1
- package/SparkLineChart/SparkLineChart.d.ts +8 -3
- package/SparkLineChart/SparkLineChart.js +57 -1
- package/context/CartesianContextProvider.d.ts +8 -0
- package/context/CartesianContextProvider.js +5 -18
- package/context/ColorProvider.d.ts +12 -0
- package/context/ColorProvider.js +25 -0
- package/esm/ChartContainer/ChartContainer.js +60 -23
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +3 -5
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +3 -5
- package/esm/ChartsText/ChartsText.js +1 -3
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +6 -12
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +6 -16
- package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +3 -3
- package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/esm/LineChart/LineChart.js +1 -1
- package/esm/PieChart/PieChart.js +1 -1
- package/esm/ResponsiveChartContainer/ResizableContainer.js +26 -0
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +24 -21
- package/esm/ScatterChart/ScatterChart.js +1 -1
- package/esm/SparkLineChart/SparkLineChart.js +57 -1
- package/esm/context/CartesianContextProvider.js +5 -18
- package/esm/context/ColorProvider.js +16 -0
- package/esm/hooks/index.js +1 -0
- package/esm/hooks/useColor.js +9 -0
- package/esm/hooks/useColorScale.js +27 -0
- package/esm/hooks/useReducedMotion.js +7 -0
- package/esm/internals/index.js +27 -1
- package/esm/internals/warning.js +13 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +12 -0
- package/hooks/useColor.d.ts +4 -0
- package/hooks/useColor.js +17 -0
- package/hooks/useColorScale.d.ts +4 -0
- package/hooks/useColorScale.js +37 -0
- package/hooks/useReducedMotion.js +7 -0
- package/index.js +1 -1
- package/internals/defaultizeColor.d.ts +8 -8
- package/internals/index.d.ts +16 -0
- package/internals/index.js +187 -0
- package/internals/warning.d.ts +1 -0
- package/internals/warning.js +19 -0
- package/models/axis.d.ts +1 -2
- package/modern/ChartContainer/ChartContainer.js +60 -23
- package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +3 -5
- package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +3 -5
- package/modern/ChartsText/ChartsText.js +1 -3
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +6 -12
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +6 -16
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +3 -3
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/modern/LineChart/LineChart.js +1 -1
- package/modern/PieChart/PieChart.js +1 -1
- package/modern/ResponsiveChartContainer/ResizableContainer.js +26 -0
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +24 -21
- package/modern/ScatterChart/ScatterChart.js +1 -1
- package/modern/SparkLineChart/SparkLineChart.js +57 -1
- package/modern/context/CartesianContextProvider.js +5 -18
- package/modern/context/ColorProvider.js +16 -0
- package/modern/hooks/index.js +1 -0
- package/modern/hooks/useColor.js +9 -0
- package/modern/hooks/useColorScale.js +27 -0
- package/modern/hooks/useReducedMotion.js +7 -0
- package/modern/index.js +1 -1
- package/modern/internals/index.js +27 -1
- package/modern/internals/warning.js +13 -0
- package/package.json +2 -2
- package/themeAugmentation/components.d.ts +12 -12
- package/esm/internals/colorGetter.js +0 -22
- package/internals/colorGetter.d.ts +0 -7
- package/internals/colorGetter.js +0 -29
- package/modern/internals/colorGetter.js +0 -22
|
@@ -6,7 +6,7 @@ import { ResponsiveChartContainer } from '../ResponsiveChartContainer';
|
|
|
6
6
|
import { ChartsAxis } from '../ChartsAxis';
|
|
7
7
|
import { ChartsTooltip } from '../ChartsTooltip';
|
|
8
8
|
import { ChartsLegend } from '../ChartsLegend';
|
|
9
|
-
import { ChartsOverlay } from '../ChartsOverlay
|
|
9
|
+
import { ChartsOverlay } from '../ChartsOverlay';
|
|
10
10
|
import { ChartsAxisHighlight } from '../ChartsAxisHighlight';
|
|
11
11
|
import { ChartsVoronoiHandler } from '../ChartsVoronoiHandler/ChartsVoronoiHandler';
|
|
12
12
|
import { ChartsGrid } from '../ChartsGrid';
|
|
@@ -27,6 +27,7 @@ const SPARKLINE_DEFAULT_MARGIN = {
|
|
|
27
27
|
const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(props, ref) {
|
|
28
28
|
const {
|
|
29
29
|
xAxis,
|
|
30
|
+
yAxis,
|
|
30
31
|
width,
|
|
31
32
|
height,
|
|
32
33
|
margin = SPARKLINE_DEFAULT_MARGIN,
|
|
@@ -73,6 +74,9 @@ const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(pro
|
|
|
73
74
|
}, (_, index) => index),
|
|
74
75
|
hideTooltip: xAxis === undefined
|
|
75
76
|
}, xAxis)],
|
|
77
|
+
yAxis: [_extends({
|
|
78
|
+
id: DEFAULT_X_AXIS_KEY
|
|
79
|
+
}, yAxis)],
|
|
76
80
|
colors: colors,
|
|
77
81
|
sx: sx,
|
|
78
82
|
disableAxisListener: (!showTooltip || tooltip?.trigger !== 'axis') && axisHighlight?.x === 'none' && axisHighlight?.y === 'none',
|
|
@@ -233,7 +237,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
233
237
|
width: PropTypes.number,
|
|
234
238
|
/**
|
|
235
239
|
* The xAxis configuration.
|
|
236
|
-
* Notice it is a single
|
|
240
|
+
* Notice it is a single [[AxisConfig]] object, not an array of configuration.
|
|
237
241
|
*/
|
|
238
242
|
xAxis: PropTypes.shape({
|
|
239
243
|
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -282,6 +286,58 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
282
286
|
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
283
287
|
tickSize: PropTypes.number,
|
|
284
288
|
valueFormatter: PropTypes.func
|
|
289
|
+
}),
|
|
290
|
+
/**
|
|
291
|
+
* The yAxis configuration.
|
|
292
|
+
* Notice it is a single [[AxisConfig]] object, not an array of configuration.
|
|
293
|
+
*/
|
|
294
|
+
yAxis: PropTypes.shape({
|
|
295
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
296
|
+
classes: PropTypes.object,
|
|
297
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
298
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
299
|
+
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
300
|
+
unknownColor: PropTypes.string,
|
|
301
|
+
values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
|
|
302
|
+
}), PropTypes.shape({
|
|
303
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
304
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
305
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
306
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
307
|
+
}), PropTypes.shape({
|
|
308
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
309
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
310
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
311
|
+
})]),
|
|
312
|
+
data: PropTypes.array,
|
|
313
|
+
dataKey: PropTypes.string,
|
|
314
|
+
disableLine: PropTypes.bool,
|
|
315
|
+
disableTicks: PropTypes.bool,
|
|
316
|
+
fill: PropTypes.string,
|
|
317
|
+
hideTooltip: PropTypes.bool,
|
|
318
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
319
|
+
label: PropTypes.string,
|
|
320
|
+
labelFontSize: PropTypes.number,
|
|
321
|
+
labelStyle: PropTypes.object,
|
|
322
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
323
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
324
|
+
position: PropTypes.oneOf(['left', 'right']),
|
|
325
|
+
reverse: PropTypes.bool,
|
|
326
|
+
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
327
|
+
slotProps: PropTypes.object,
|
|
328
|
+
slots: PropTypes.object,
|
|
329
|
+
stroke: PropTypes.string,
|
|
330
|
+
tickFontSize: PropTypes.number,
|
|
331
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
332
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
333
|
+
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
334
|
+
tickLabelStyle: PropTypes.object,
|
|
335
|
+
tickMaxStep: PropTypes.number,
|
|
336
|
+
tickMinStep: PropTypes.number,
|
|
337
|
+
tickNumber: PropTypes.number,
|
|
338
|
+
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
339
|
+
tickSize: PropTypes.number,
|
|
340
|
+
valueFormatter: PropTypes.func
|
|
285
341
|
})
|
|
286
342
|
} : void 0;
|
|
287
343
|
export { SparkLineChart };
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { scaleBand, scalePoint } from 'd3-scale';
|
|
4
|
-
import { getExtremumX as getBarExtremumX, getExtremumY as getBarExtremumY } from '../BarChart/extremums';
|
|
5
|
-
import { getExtremumX as getScatterExtremumX, getExtremumY as getScatterExtremumY } from '../ScatterChart/extremums';
|
|
6
|
-
import { getExtremumX as getLineExtremumX, getExtremumY as getLineExtremumY } from '../LineChart/extremums';
|
|
7
4
|
import { isBandScaleConfig, isPointScaleConfig } from '../models/axis';
|
|
8
5
|
import { getScale } from '../internals/getScale';
|
|
9
6
|
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '../constants';
|
|
@@ -14,18 +11,6 @@ import { useSeries } from '../hooks/useSeries';
|
|
|
14
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
12
|
const DEFAULT_CATEGORY_GAP_RATIO = 0.2;
|
|
16
13
|
const DEFAULT_BAR_GAP_RATIO = 0.1;
|
|
17
|
-
|
|
18
|
-
// TODO: those might be better placed in a distinct file
|
|
19
|
-
const xExtremumGetters = {
|
|
20
|
-
bar: getBarExtremumX,
|
|
21
|
-
scatter: getScatterExtremumX,
|
|
22
|
-
line: getLineExtremumX
|
|
23
|
-
};
|
|
24
|
-
const yExtremumGetters = {
|
|
25
|
-
bar: getBarExtremumY,
|
|
26
|
-
scatter: getScatterExtremumY,
|
|
27
|
-
line: getLineExtremumY
|
|
28
|
-
};
|
|
29
14
|
export const CartesianContext = /*#__PURE__*/React.createContext({
|
|
30
15
|
xAxis: {},
|
|
31
16
|
yAxis: {},
|
|
@@ -40,6 +25,8 @@ function CartesianContextProvider(props) {
|
|
|
40
25
|
xAxis: inXAxis,
|
|
41
26
|
yAxis: inYAxis,
|
|
42
27
|
dataset,
|
|
28
|
+
xExtremumGetters,
|
|
29
|
+
yExtremumGetters,
|
|
43
30
|
children
|
|
44
31
|
} = props;
|
|
45
32
|
const formattedSeries = useSeries();
|
|
@@ -72,11 +59,11 @@ function CartesianContextProvider(props) {
|
|
|
72
59
|
const axisExtremumCallback = (acc, chartType, axis, getters, isDefaultAxis) => {
|
|
73
60
|
const getter = getters[chartType];
|
|
74
61
|
const series = formattedSeries[chartType]?.series ?? {};
|
|
75
|
-
const [minChartTypeData, maxChartTypeData] = getter({
|
|
62
|
+
const [minChartTypeData, maxChartTypeData] = getter?.({
|
|
76
63
|
series,
|
|
77
64
|
axis,
|
|
78
65
|
isDefaultAxis
|
|
79
|
-
});
|
|
66
|
+
}) ?? [null, null];
|
|
80
67
|
const [minData, maxData] = acc;
|
|
81
68
|
if (minData === null || maxData === null) {
|
|
82
69
|
return [minChartTypeData, maxChartTypeData];
|
|
@@ -213,7 +200,7 @@ function CartesianContextProvider(props) {
|
|
|
213
200
|
id
|
|
214
201
|
}) => id)
|
|
215
202
|
};
|
|
216
|
-
}, [drawingArea.height, drawingArea.left, drawingArea.top, drawingArea.width, formattedSeries, xAxis, yAxis]);
|
|
203
|
+
}, [drawingArea.height, drawingArea.left, drawingArea.top, drawingArea.width, formattedSeries, xAxis, xExtremumGetters, yAxis, yExtremumGetters]);
|
|
217
204
|
|
|
218
205
|
// @ts-ignore
|
|
219
206
|
return /*#__PURE__*/_jsx(CartesianContext.Provider, {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
export const ColorContext = /*#__PURE__*/React.createContext({});
|
|
4
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5
|
+
ColorContext.displayName = 'ColorContext';
|
|
6
|
+
}
|
|
7
|
+
export function ColorProvider(props) {
|
|
8
|
+
const {
|
|
9
|
+
colorProcessors,
|
|
10
|
+
children
|
|
11
|
+
} = props;
|
|
12
|
+
return /*#__PURE__*/_jsx(ColorContext.Provider, {
|
|
13
|
+
value: colorProcessors,
|
|
14
|
+
children: children
|
|
15
|
+
});
|
|
16
|
+
}
|
package/modern/hooks/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './useDrawingArea';
|
|
2
2
|
export * from './useChartId';
|
|
3
3
|
export * from './useScale';
|
|
4
|
+
export * from './useColorScale';
|
|
4
5
|
export * from './useSvgRef';
|
|
5
6
|
export { useSeries as unstable_useSeries, usePieSeries as unstable_usePieSeries, useLineSeries as unstable_useLineSeries, useBarSeries as unstable_useBarSeries, useScatterSeries as unstable_useScatterSeries } from './useSeries';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ColorContext } from '../context/ColorProvider';
|
|
3
|
+
export function useColorProcessor(seriesType) {
|
|
4
|
+
const colorProcessors = React.useContext(ColorContext);
|
|
5
|
+
if (!seriesType) {
|
|
6
|
+
return colorProcessors;
|
|
7
|
+
}
|
|
8
|
+
return colorProcessors[seriesType];
|
|
9
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { CartesianContext } from '../context/CartesianContextProvider';
|
|
3
|
+
import { ZAxisContext } from '../context/ZAxisContextProvider';
|
|
4
|
+
export function useXColorScale(identifier) {
|
|
5
|
+
const {
|
|
6
|
+
xAxis,
|
|
7
|
+
xAxisIds
|
|
8
|
+
} = React.useContext(CartesianContext);
|
|
9
|
+
const id = typeof identifier === 'string' ? identifier : xAxisIds[identifier ?? 0];
|
|
10
|
+
return xAxis[id].colorScale;
|
|
11
|
+
}
|
|
12
|
+
export function useYColorScale(identifier) {
|
|
13
|
+
const {
|
|
14
|
+
yAxis,
|
|
15
|
+
yAxisIds
|
|
16
|
+
} = React.useContext(CartesianContext);
|
|
17
|
+
const id = typeof identifier === 'string' ? identifier : yAxisIds[identifier ?? 0];
|
|
18
|
+
return yAxis[id].colorScale;
|
|
19
|
+
}
|
|
20
|
+
export function useZColorScale(identifier) {
|
|
21
|
+
const {
|
|
22
|
+
zAxis,
|
|
23
|
+
zAxisIds
|
|
24
|
+
} = React.useContext(ZAxisContext);
|
|
25
|
+
const id = typeof identifier === 'string' ? identifier : zAxisIds[identifier ?? 0];
|
|
26
|
+
return zAxis[id]?.colorScale;
|
|
27
|
+
}
|
|
@@ -11,6 +11,13 @@ export const useReducedMotion = () => {
|
|
|
11
11
|
// Taken from: https://github.com/pmndrs/react-spring/blob/02ec877bbfab0df46da0e4a47d5f68d3e731206a/packages/shared/src/hooks/useReducedMotion.ts#L13
|
|
12
12
|
|
|
13
13
|
useIsomorphicLayoutEffect(() => {
|
|
14
|
+
if (!window.matchMedia) {
|
|
15
|
+
// skip animation in environments where `window.matchMedia` would not be available (i.e. test/jsdom)
|
|
16
|
+
Globals.assign({
|
|
17
|
+
skipAnimation: true
|
|
18
|
+
});
|
|
19
|
+
return () => {};
|
|
20
|
+
}
|
|
14
21
|
const mql = window.matchMedia('(prefers-reduced-motion)');
|
|
15
22
|
const handleMediaChange = e => {
|
|
16
23
|
Globals.assign({
|
package/modern/index.js
CHANGED
|
@@ -1 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
// Components
|
|
2
|
+
export * from './components/ChartsAxesGradients';
|
|
3
|
+
export * from '../ResponsiveChartContainer/useChartContainerDimensions';
|
|
4
|
+
export * from '../ResponsiveChartContainer/ResizableContainer';
|
|
5
|
+
|
|
6
|
+
// hooks
|
|
7
|
+
export { useReducedMotion } from '../hooks/useReducedMotion';
|
|
8
|
+
export { useSeries } from '../hooks/useSeries';
|
|
9
|
+
|
|
10
|
+
// utils
|
|
11
|
+
export * from './defaultizeValueFormatter';
|
|
12
|
+
export * from './configInit';
|
|
13
|
+
|
|
14
|
+
// contexts
|
|
15
|
+
|
|
16
|
+
export * from '../context/CartesianContextProvider';
|
|
17
|
+
export * from '../context/DrawingProvider';
|
|
18
|
+
export * from '../context/InteractionProvider';
|
|
19
|
+
export * from '../context/SeriesContextProvider';
|
|
20
|
+
export * from '../context/ZAxisContextProvider';
|
|
21
|
+
|
|
22
|
+
// series configuration
|
|
23
|
+
export * from '../models/seriesType/config';
|
|
24
|
+
export * from '../models/seriesType/common';
|
|
25
|
+
export * from '../models/helpers';
|
|
26
|
+
export * from '../models/z-axis';
|
|
27
|
+
export * from '../models/axis';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function buildWarning(message, gravity = 'warning') {
|
|
2
|
+
let alreadyWarned = false;
|
|
3
|
+
return (...args) => {
|
|
4
|
+
if (!alreadyWarned) {
|
|
5
|
+
alreadyWarned = true;
|
|
6
|
+
if (gravity === 'error') {
|
|
7
|
+
console.error(message(...args));
|
|
8
|
+
} else {
|
|
9
|
+
console.warn(message(...args));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-charts",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.7.0",
|
|
4
4
|
"description": "The community edition of the Charts components (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"directory": "packages/x-charts"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@babel/runtime": "^7.24.
|
|
32
|
+
"@babel/runtime": "^7.24.7",
|
|
33
33
|
"@mui/base": "^5.0.0-beta.40",
|
|
34
34
|
"@mui/system": "^5.15.15",
|
|
35
35
|
"@mui/utils": "^5.15.14",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ComponentsProps, ComponentsOverrides } from '@mui/material/styles';
|
|
2
2
|
|
|
3
|
-
export interface ChartsComponents {
|
|
3
|
+
export interface ChartsComponents<Theme = unknown> {
|
|
4
4
|
MuiChartsAxis?: {
|
|
5
5
|
defaultProps?: ComponentsProps['MuiChartsAxis'];
|
|
6
|
-
styleOverrides?: ComponentsOverrides['MuiChartsAxis'];
|
|
6
|
+
styleOverrides?: ComponentsOverrides<Theme>['MuiChartsAxis'];
|
|
7
7
|
};
|
|
8
8
|
MuiChartsXAxis?: {
|
|
9
9
|
defaultProps?: ComponentsProps['MuiChartsXAxis'];
|
|
@@ -13,22 +13,22 @@ export interface ChartsComponents {
|
|
|
13
13
|
};
|
|
14
14
|
MuiChartsAxisHighlight?: {
|
|
15
15
|
defaultProps?: ComponentsProps['MuiChartsAxisHighlight'];
|
|
16
|
-
styleOverrides?: ComponentsOverrides['MuiChartsAxisHighlight'];
|
|
16
|
+
styleOverrides?: ComponentsOverrides<Theme>['MuiChartsAxisHighlight'];
|
|
17
17
|
};
|
|
18
18
|
MuiChartsClipPath?: {
|
|
19
19
|
defaultProps?: ComponentsProps['MuiChartsClipPath'];
|
|
20
20
|
};
|
|
21
21
|
MuiChartsGrid?: {
|
|
22
22
|
defaultProps?: ComponentsProps['MuiChartsGrid'];
|
|
23
|
-
styleOverrides?: ComponentsOverrides['MuiChartsGrid'];
|
|
23
|
+
styleOverrides?: ComponentsOverrides<Theme>['MuiChartsGrid'];
|
|
24
24
|
};
|
|
25
25
|
MuiChartsLegend?: {
|
|
26
26
|
defaultProps?: ComponentsProps['MuiChartsLegend'];
|
|
27
|
-
styleOverrides?: ComponentsOverrides['MuiChartsLegend'];
|
|
27
|
+
styleOverrides?: ComponentsOverrides<Theme>['MuiChartsLegend'];
|
|
28
28
|
};
|
|
29
29
|
MuiChartsTooltip?: {
|
|
30
30
|
defaultProps?: ComponentsProps['MuiChartsTooltip'];
|
|
31
|
-
styleOverrides?: ComponentsOverrides['MuiChartsTooltip'];
|
|
31
|
+
styleOverrides?: ComponentsOverrides<Theme>['MuiChartsTooltip'];
|
|
32
32
|
};
|
|
33
33
|
MuiChartsSurface?: {
|
|
34
34
|
defaultProps?: ComponentsProps['MuiChartsSurface'];
|
|
@@ -38,26 +38,26 @@ export interface ChartsComponents {
|
|
|
38
38
|
};
|
|
39
39
|
MuiBarElement?: {
|
|
40
40
|
defaultProps?: ComponentsProps['MuiBarElement'];
|
|
41
|
-
styleOverrides?: ComponentsOverrides['MuiBarElement'];
|
|
41
|
+
styleOverrides?: ComponentsOverrides<Theme>['MuiBarElement'];
|
|
42
42
|
};
|
|
43
43
|
MuiBarLabel?: {
|
|
44
44
|
defaultProps?: ComponentsProps['MuiBarLabel'];
|
|
45
|
-
styleOverrides?: ComponentsOverrides['MuiBarLabel'];
|
|
45
|
+
styleOverrides?: ComponentsOverrides<Theme>['MuiBarLabel'];
|
|
46
46
|
};
|
|
47
47
|
MuiLineChart?: {
|
|
48
48
|
defaultProps?: ComponentsProps['MuiLineChart'];
|
|
49
49
|
};
|
|
50
50
|
MuiAreaElement?: {
|
|
51
51
|
defaultProps?: ComponentsProps['MuiAreaElement'];
|
|
52
|
-
styleOverrides?: ComponentsOverrides['MuiAreaElement'];
|
|
52
|
+
styleOverrides?: ComponentsOverrides<Theme>['MuiAreaElement'];
|
|
53
53
|
};
|
|
54
54
|
MuiLineElement?: {
|
|
55
55
|
defaultProps?: ComponentsProps['MuiLineElement'];
|
|
56
|
-
styleOverrides?: ComponentsOverrides['MuiLineElement'];
|
|
56
|
+
styleOverrides?: ComponentsOverrides<Theme>['MuiLineElement'];
|
|
57
57
|
};
|
|
58
58
|
MuiMarkElement?: {
|
|
59
59
|
defaultProps?: ComponentsProps['MuiMarkElement'];
|
|
60
|
-
styleOverrides?: ComponentsOverrides['MuiMarkElement'];
|
|
60
|
+
styleOverrides?: ComponentsOverrides<Theme>['MuiMarkElement'];
|
|
61
61
|
};
|
|
62
62
|
MuiScatterChart?: {
|
|
63
63
|
defaultProps?: ComponentsProps['MuiScatterChart'];
|
|
@@ -68,5 +68,5 @@ export interface ChartsComponents {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
declare module '@mui/material/styles' {
|
|
71
|
-
interface Components extends ChartsComponents {}
|
|
71
|
+
interface Components<Theme = unknown> extends ChartsComponents<Theme> {}
|
|
72
72
|
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import getBarColor from '../BarChart/getColor';
|
|
2
|
-
import getLineColor from '../LineChart/getColor';
|
|
3
|
-
import getScatterColor from '../ScatterChart/getColor';
|
|
4
|
-
import getPieColor from '../PieChart/getColor';
|
|
5
|
-
function getColor(series, xAxis, yAxis, zAxis) {
|
|
6
|
-
if (xAxis !== undefined && yAxis !== undefined) {
|
|
7
|
-
if (series.type === 'bar') {
|
|
8
|
-
return getBarColor(series, xAxis, yAxis);
|
|
9
|
-
}
|
|
10
|
-
if (series.type === 'line') {
|
|
11
|
-
return getLineColor(series, xAxis, yAxis);
|
|
12
|
-
}
|
|
13
|
-
if (series.type === 'scatter') {
|
|
14
|
-
return getScatterColor(series, xAxis, yAxis, zAxis);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
if (series.type === 'pie') {
|
|
18
|
-
return getPieColor(series);
|
|
19
|
-
}
|
|
20
|
-
throw Error(`MUI X Charts: getColor called with unexpected arguments for series with id "${series.id}"`);
|
|
21
|
-
}
|
|
22
|
-
export default getColor;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { DefaultizedBarSeriesType, DefaultizedLineSeriesType, DefaultizedPieSeriesType, DefaultizedScatterSeriesType } from '../models';
|
|
2
|
-
import { AxisDefaultized } from '../models/axis';
|
|
3
|
-
import { ZAxisDefaultized } from '../models/z-axis';
|
|
4
|
-
declare function getColor(series: DefaultizedPieSeriesType): (dataIndex: number) => string;
|
|
5
|
-
declare function getColor(series: DefaultizedBarSeriesType | DefaultizedLineSeriesType, xAxis: AxisDefaultized, yAxis: AxisDefaultized): (dataIndex: number) => string;
|
|
6
|
-
declare function getColor(series: DefaultizedScatterSeriesType, xAxis: AxisDefaultized, yAxis: AxisDefaultized, zAxis?: ZAxisDefaultized): (dataIndex: number) => string;
|
|
7
|
-
export default getColor;
|
package/internals/colorGetter.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _getColor = _interopRequireDefault(require("../BarChart/getColor"));
|
|
9
|
-
var _getColor2 = _interopRequireDefault(require("../LineChart/getColor"));
|
|
10
|
-
var _getColor3 = _interopRequireDefault(require("../ScatterChart/getColor"));
|
|
11
|
-
var _getColor4 = _interopRequireDefault(require("../PieChart/getColor"));
|
|
12
|
-
function getColor(series, xAxis, yAxis, zAxis) {
|
|
13
|
-
if (xAxis !== undefined && yAxis !== undefined) {
|
|
14
|
-
if (series.type === 'bar') {
|
|
15
|
-
return (0, _getColor.default)(series, xAxis, yAxis);
|
|
16
|
-
}
|
|
17
|
-
if (series.type === 'line') {
|
|
18
|
-
return (0, _getColor2.default)(series, xAxis, yAxis);
|
|
19
|
-
}
|
|
20
|
-
if (series.type === 'scatter') {
|
|
21
|
-
return (0, _getColor3.default)(series, xAxis, yAxis, zAxis);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
if (series.type === 'pie') {
|
|
25
|
-
return (0, _getColor4.default)(series);
|
|
26
|
-
}
|
|
27
|
-
throw Error(`MUI X Charts: getColor called with unexpected arguments for series with id "${series.id}"`);
|
|
28
|
-
}
|
|
29
|
-
var _default = exports.default = getColor;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import getBarColor from '../BarChart/getColor';
|
|
2
|
-
import getLineColor from '../LineChart/getColor';
|
|
3
|
-
import getScatterColor from '../ScatterChart/getColor';
|
|
4
|
-
import getPieColor from '../PieChart/getColor';
|
|
5
|
-
function getColor(series, xAxis, yAxis, zAxis) {
|
|
6
|
-
if (xAxis !== undefined && yAxis !== undefined) {
|
|
7
|
-
if (series.type === 'bar') {
|
|
8
|
-
return getBarColor(series, xAxis, yAxis);
|
|
9
|
-
}
|
|
10
|
-
if (series.type === 'line') {
|
|
11
|
-
return getLineColor(series, xAxis, yAxis);
|
|
12
|
-
}
|
|
13
|
-
if (series.type === 'scatter') {
|
|
14
|
-
return getScatterColor(series, xAxis, yAxis, zAxis);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
if (series.type === 'pie') {
|
|
18
|
-
return getPieColor(series);
|
|
19
|
-
}
|
|
20
|
-
throw Error(`MUI X Charts: getColor called with unexpected arguments for series with id "${series.id}"`);
|
|
21
|
-
}
|
|
22
|
-
export default getColor;
|