@mui/x-charts 7.22.1 → 8.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/BarChart.d.ts +7 -7
- package/BarChart/BarChart.js +9 -29
- package/BarChart/BarElement.d.ts +1 -1
- package/BarChart/BarLabel/BarLabelItem.d.ts +1 -1
- package/BarChart/BarPlot.js +12 -4
- package/BarChart/extremums.js +3 -3
- package/BarChart/useBarChartProps.d.ts +2 -2
- package/BarChart/useBarChartProps.js +3 -4
- package/CHANGELOG.md +143 -92
- package/ChartContainer/ChartContainer.d.ts +16 -33
- package/ChartContainer/ChartContainer.js +24 -41
- package/{ResponsiveChartContainer → ChartContainer}/ResizableContainer.d.ts +2 -2
- package/{ResponsiveChartContainer → ChartContainer}/useChartContainerDimensions.d.ts +1 -1
- package/{ResponsiveChartContainer → ChartContainer}/useChartContainerDimensions.js +6 -4
- package/ChartContainer/useChartContainerProps.d.ts +11 -86
- package/ChartContainer/useChartContainerProps.js +42 -58
- package/ChartsLegend/ChartsLegend.js +0 -3
- package/ChartsLegend/DefaultChartsLegend.d.ts +0 -5
- package/ChartsLegend/DefaultChartsLegend.js +1 -12
- package/ChartsLegend/LegendPerItem.d.ts +1 -1
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/ChartsOverlay/ChartsOverlay.d.ts +1 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +3 -3
- package/ChartsTooltip/ChartsItemTooltipContent.js +3 -3
- package/ChartsTooltip/ChartsTooltip.js +45 -6
- package/ChartsTooltip/useAxisTooltip.js +3 -3
- package/ChartsTooltip/useItemTooltip.js +3 -3
- package/ChartsTooltip/utils.d.ts +5 -13
- package/ChartsTooltip/utils.js +45 -42
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -5
- package/Gauge/GaugeContainer.js +1 -1
- package/LineChart/AreaElement.d.ts +1 -1
- package/LineChart/AreaPlot.js +2 -6
- package/LineChart/LineChart.d.ts +7 -7
- package/LineChart/LineChart.js +9 -29
- package/LineChart/LineElement.d.ts +1 -1
- package/LineChart/LineHighlightPlot.d.ts +1 -1
- package/LineChart/LineHighlightPlot.js +2 -6
- package/LineChart/LinePlot.js +2 -6
- package/LineChart/MarkPlot.js +2 -6
- package/LineChart/extremums.js +10 -6
- package/LineChart/useLineChartProps.d.ts +2 -2
- package/LineChart/useLineChartProps.js +3 -4
- package/PieChart/PieArc.d.ts +0 -5
- package/PieChart/PieArc.js +1 -10
- package/PieChart/PieArcPlot.js +0 -5
- package/PieChart/PieChart.d.ts +9 -32
- package/PieChart/PieChart.js +19 -102
- package/README.md +2 -2
- package/ScatterChart/ScatterChart.d.ts +7 -7
- package/ScatterChart/ScatterChart.js +9 -29
- package/ScatterChart/ScatterPlot.js +3 -6
- package/ScatterChart/extremums.js +6 -6
- package/ScatterChart/useScatterChartProps.d.ts +2 -2
- package/ScatterChart/useScatterChartProps.js +3 -4
- package/SparkLineChart/SparkLineChart.d.ts +4 -4
- package/SparkLineChart/SparkLineChart.js +4 -2
- package/context/CartesianProvider/defaultizeAxis.d.ts +5 -1
- package/context/ChartDataProvider/ChartDataProvider.d.ts +41 -0
- package/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +48 -27
- package/context/ChartDataProvider/index.d.ts +1 -0
- package/context/ChartDataProvider/index.js +1 -0
- package/context/ChartDataProvider/useChartDataProviderProps.d.ts +97 -0
- package/context/ChartDataProvider/useChartDataProviderProps.js +86 -0
- package/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.d.ts +16 -12
- package/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
- package/context/HighlightedProvider/HighlightedContext.d.ts +0 -8
- package/context/HighlightedProvider/HighlightedProvider.js +1 -16
- package/context/PluginProvider/ExtremumGetter.types.d.ts +2 -2
- package/context/ZAxisContextProvider.d.ts +1 -1
- package/index.d.ts +1 -2
- package/index.js +2 -3
- package/internals/computeAxisValue.js +13 -5
- package/internals/defaultizeColor.d.ts +1 -8
- package/internals/getSymbol.js +19 -3
- package/internals/index.d.ts +5 -5
- package/internals/index.js +5 -5
- package/internals/useStringInterpolator.js +1 -0
- package/models/axis.d.ts +10 -0
- package/models/seriesType/bar.d.ts +1 -1
- package/models/seriesType/common.d.ts +2 -12
- package/models/seriesType/config.d.ts +1 -1
- package/models/seriesType/line.d.ts +1 -1
- package/models/seriesType/pie.d.ts +1 -1
- package/models/seriesType/scatter.d.ts +1 -6
- package/modern/BarChart/BarChart.js +9 -29
- package/modern/BarChart/BarPlot.js +12 -4
- package/modern/BarChart/extremums.js +3 -3
- package/modern/BarChart/useBarChartProps.js +3 -4
- package/modern/ChartContainer/ChartContainer.js +24 -41
- package/modern/{ResponsiveChartContainer → ChartContainer}/useChartContainerDimensions.js +6 -4
- package/modern/ChartContainer/useChartContainerProps.js +42 -58
- package/modern/ChartsLegend/ChartsLegend.js +0 -3
- package/modern/ChartsLegend/DefaultChartsLegend.js +1 -12
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +3 -3
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +3 -3
- package/modern/ChartsTooltip/ChartsTooltip.js +45 -6
- package/modern/ChartsTooltip/useAxisTooltip.js +3 -3
- package/modern/ChartsTooltip/useItemTooltip.js +3 -3
- package/modern/ChartsTooltip/utils.js +45 -42
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -5
- package/modern/Gauge/GaugeContainer.js +1 -1
- package/modern/LineChart/AreaPlot.js +2 -6
- package/modern/LineChart/LineChart.js +9 -29
- package/modern/LineChart/LineHighlightPlot.js +2 -6
- package/modern/LineChart/LinePlot.js +2 -6
- package/modern/LineChart/MarkPlot.js +2 -6
- package/modern/LineChart/extremums.js +10 -6
- package/modern/LineChart/useLineChartProps.js +3 -4
- package/modern/PieChart/PieArc.js +1 -10
- package/modern/PieChart/PieArcPlot.js +0 -5
- package/modern/PieChart/PieChart.js +19 -102
- package/modern/ScatterChart/ScatterChart.js +9 -29
- package/modern/ScatterChart/ScatterPlot.js +3 -6
- package/modern/ScatterChart/extremums.js +6 -6
- package/modern/ScatterChart/useScatterChartProps.js +3 -4
- package/modern/SparkLineChart/SparkLineChart.js +4 -2
- package/modern/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +48 -27
- package/modern/context/ChartDataProvider/index.js +1 -0
- package/modern/context/ChartDataProvider/useChartDataProviderProps.js +86 -0
- package/modern/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
- package/modern/context/HighlightedProvider/HighlightedProvider.js +1 -16
- package/modern/index.js +2 -3
- package/modern/internals/computeAxisValue.js +13 -5
- package/modern/internals/getSymbol.js +19 -3
- package/modern/internals/index.js +5 -5
- package/modern/internals/useStringInterpolator.js +1 -0
- package/node/BarChart/BarChart.js +9 -29
- package/node/BarChart/BarPlot.js +11 -3
- package/node/BarChart/extremums.js +3 -3
- package/node/BarChart/useBarChartProps.js +3 -4
- package/node/ChartContainer/ChartContainer.js +23 -40
- package/node/{ResponsiveChartContainer → ChartContainer}/useChartContainerDimensions.js +6 -4
- package/node/ChartContainer/useChartContainerProps.js +42 -59
- package/node/ChartsLegend/ChartsLegend.js +0 -3
- package/node/ChartsLegend/DefaultChartsLegend.js +1 -12
- package/node/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/node/ChartsTooltip/ChartsAxisTooltipContent.js +3 -3
- package/node/ChartsTooltip/ChartsItemTooltipContent.js +3 -3
- package/node/ChartsTooltip/ChartsTooltip.js +44 -5
- package/node/ChartsTooltip/useAxisTooltip.js +3 -3
- package/node/ChartsTooltip/useItemTooltip.js +3 -3
- package/node/ChartsTooltip/utils.js +46 -44
- package/node/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -5
- package/node/Gauge/GaugeContainer.js +1 -1
- package/node/LineChart/AreaPlot.js +2 -6
- package/node/LineChart/LineChart.js +9 -29
- package/node/LineChart/LineHighlightPlot.js +2 -6
- package/node/LineChart/LinePlot.js +2 -6
- package/node/LineChart/MarkPlot.js +2 -6
- package/node/LineChart/extremums.js +10 -6
- package/node/LineChart/useLineChartProps.js +3 -4
- package/node/PieChart/PieArc.js +1 -10
- package/node/PieChart/PieArcPlot.js +0 -5
- package/node/PieChart/PieChart.js +19 -102
- package/node/ScatterChart/ScatterChart.js +9 -29
- package/node/ScatterChart/ScatterPlot.js +3 -6
- package/node/ScatterChart/extremums.js +6 -6
- package/node/ScatterChart/useScatterChartProps.js +3 -4
- package/node/SparkLineChart/SparkLineChart.js +4 -2
- package/node/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +47 -26
- package/node/context/ChartDataProvider/index.js +16 -0
- package/node/context/ChartDataProvider/useChartDataProviderProps.js +94 -0
- package/node/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
- package/node/context/HighlightedProvider/HighlightedProvider.js +1 -16
- package/node/index.js +5 -16
- package/node/internals/computeAxisValue.js +13 -5
- package/node/internals/getSymbol.js +19 -3
- package/node/internals/index.js +37 -29
- package/node/internals/useStringInterpolator.js +2 -0
- package/package.json +4 -4
- package/ResponsiveChartContainer/ResponsiveChartContainer.d.ts +0 -24
- package/ResponsiveChartContainer/index.d.ts +0 -1
- package/ResponsiveChartContainer/index.js +0 -1
- package/ResponsiveChartContainer/package.json +0 -6
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.d.ts +0 -19
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -70
- package/internals/SlotComponentPropsFromProps.d.ts +0 -1
- package/internals/SlotComponentPropsFromProps.js +0 -1
- package/models/helpers.d.ts +0 -3
- package/models/helpers.js +0 -1
- package/modern/ResponsiveChartContainer/index.js +0 -1
- package/modern/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -70
- package/modern/internals/SlotComponentPropsFromProps.js +0 -1
- package/modern/models/helpers.js +0 -1
- package/node/ResponsiveChartContainer/index.js +0 -16
- package/node/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -77
- package/node/internals/SlotComponentPropsFromProps.js +0 -5
- package/node/models/helpers.js +0 -5
- /package/{ResponsiveChartContainer → ChartContainer}/ResizableContainer.js +0 -0
- /package/modern/{ResponsiveChartContainer → ChartContainer}/ResizableContainer.js +0 -0
- /package/node/{ResponsiveChartContainer → ChartContainer}/ResizableContainer.js +0 -0
package/PieChart/PieArc.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["classes", "color", "cornerRadius", "dataIndex", "endAngle", "id", "innerRadius", "isFaded", "isHighlighted", "onClick", "outerRadius", "paddingAngle", "startAngle"
|
|
5
|
+
const _excluded = ["classes", "color", "cornerRadius", "dataIndex", "endAngle", "id", "innerRadius", "isFaded", "isHighlighted", "onClick", "outerRadius", "paddingAngle", "startAngle"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { arc as d3Arc } from '@mui/x-charts-vendor/d3-shape';
|
|
@@ -93,15 +93,6 @@ process.env.NODE_ENV !== "production" ? PieArc.propTypes = {
|
|
|
93
93
|
// ----------------------------------------------------------------------
|
|
94
94
|
classes: PropTypes.object,
|
|
95
95
|
dataIndex: PropTypes.number.isRequired,
|
|
96
|
-
/**
|
|
97
|
-
* @deprecated Use the `isFaded` or `isHighlighted` props instead.
|
|
98
|
-
*/
|
|
99
|
-
highlightScope: PropTypes.shape({
|
|
100
|
-
fade: PropTypes.oneOf(['global', 'none', 'series']),
|
|
101
|
-
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
102
|
-
highlight: PropTypes.oneOf(['item', 'none', 'series']),
|
|
103
|
-
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
104
|
-
}),
|
|
105
96
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
106
97
|
isFaded: PropTypes.bool.isRequired,
|
|
107
98
|
isHighlighted: PropTypes.bool.isRequired
|
package/PieChart/PieArcPlot.js
CHANGED
|
@@ -10,7 +10,6 @@ import { useTransition } from '@react-spring/web';
|
|
|
10
10
|
import { PieArc } from "./PieArc.js";
|
|
11
11
|
import { defaultTransitionConfig } from "./dataTransform/transition.js";
|
|
12
12
|
import { useTransformData } from "./dataTransform/useTransformData.js";
|
|
13
|
-
import { useHighlighted } from "../context/index.js";
|
|
14
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
14
|
function PieArcPlot(props) {
|
|
16
15
|
const {
|
|
@@ -43,9 +42,6 @@ function PieArcPlot(props) {
|
|
|
43
42
|
const transition = useTransition(transformedData, _extends({}, defaultTransitionConfig, {
|
|
44
43
|
immediate: skipAnimation
|
|
45
44
|
}));
|
|
46
|
-
const {
|
|
47
|
-
highlightScope
|
|
48
|
-
} = useHighlighted();
|
|
49
45
|
if (data.length === 0) {
|
|
50
46
|
return null;
|
|
51
47
|
}
|
|
@@ -72,7 +68,6 @@ function PieArcPlot(props) {
|
|
|
72
68
|
id: id,
|
|
73
69
|
color: item.color,
|
|
74
70
|
dataIndex: index,
|
|
75
|
-
highlightScope: highlightScope,
|
|
76
71
|
isFaded: item.isFaded,
|
|
77
72
|
isHighlighted: item.isHighlighted,
|
|
78
73
|
onClick: onItemClick && (event => {
|
package/PieChart/PieChart.d.ts
CHANGED
|
@@ -1,32 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
3
|
+
import { ChartContainerProps } from '../ChartContainer';
|
|
4
4
|
import { PieSeriesType } from '../models/seriesType';
|
|
5
|
-
import { MakeOptional } from '../models/helpers';
|
|
6
5
|
import { ChartsTooltipProps, ChartsTooltipSlotProps, ChartsTooltipSlots } from '../ChartsTooltip';
|
|
7
|
-
import {
|
|
8
|
-
import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
|
|
6
|
+
import { ChartsLegendSlotProps, ChartsLegendSlots } from '../ChartsLegend';
|
|
9
7
|
import { PiePlotProps, PiePlotSlotProps, PiePlotSlots } from './PiePlot';
|
|
10
8
|
import { PieValueType } from '../models/seriesType/pie';
|
|
11
|
-
import { ChartsAxisSlots, ChartsAxisSlotProps, ChartsXAxisProps, ChartsYAxisProps } from '../models/axis';
|
|
12
9
|
import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from '../ChartsOverlay';
|
|
13
|
-
export interface PieChartSlots extends
|
|
10
|
+
export interface PieChartSlots extends PiePlotSlots, ChartsLegendSlots, ChartsTooltipSlots<'pie'>, ChartsOverlaySlots {
|
|
14
11
|
}
|
|
15
|
-
export interface PieChartSlotProps extends
|
|
12
|
+
export interface PieChartSlotProps extends PiePlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps<'pie'>, ChartsOverlaySlotProps {
|
|
16
13
|
}
|
|
17
|
-
export interface PieChartProps extends Omit<
|
|
18
|
-
/**
|
|
19
|
-
* Indicate which axis to display the bottom of the charts.
|
|
20
|
-
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
21
|
-
* @default null
|
|
22
|
-
*/
|
|
23
|
-
bottomAxis?: null | string | ChartsXAxisProps;
|
|
24
|
-
/**
|
|
25
|
-
* Indicate which axis to display the left of the charts.
|
|
26
|
-
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
27
|
-
* @default null
|
|
28
|
-
*/
|
|
29
|
-
leftAxis?: null | string | ChartsYAxisProps;
|
|
14
|
+
export interface PieChartProps extends Omit<ChartContainerProps, 'series' | 'leftAxis' | 'bottomAxis' | 'plugins' | 'zAxis'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<PiePlotProps, 'skipAnimation'> {
|
|
30
15
|
/**
|
|
31
16
|
* The series to display in the pie chart.
|
|
32
17
|
* An array of [[PieSeriesType]] objects.
|
|
@@ -39,17 +24,9 @@ export interface PieChartProps extends Omit<ResponsiveChartContainerProps, 'seri
|
|
|
39
24
|
*/
|
|
40
25
|
tooltip?: ChartsTooltipProps<'pie'>;
|
|
41
26
|
/**
|
|
42
|
-
*
|
|
43
|
-
* @see See {@link https://mui.com/x/react-charts/highlighting highlighting docs} for more details.
|
|
44
|
-
* @default { x: 'none', y: 'none' }
|
|
45
|
-
*/
|
|
46
|
-
axisHighlight?: ChartsAxisHighlightProps;
|
|
47
|
-
/**
|
|
48
|
-
* The props of the legend.
|
|
49
|
-
* @default { direction: 'column', position: { vertical: 'middle', horizontal: 'right' } }
|
|
50
|
-
* @deprecated Consider using `slotProps.legend` instead.
|
|
27
|
+
* If `true`, the legend is not rendered.
|
|
51
28
|
*/
|
|
52
|
-
|
|
29
|
+
hideLegend?: boolean;
|
|
53
30
|
/**
|
|
54
31
|
* Callback fired when a pie arc is clicked.
|
|
55
32
|
*/
|
|
@@ -75,5 +52,5 @@ export interface PieChartProps extends Omit<ResponsiveChartContainerProps, 'seri
|
|
|
75
52
|
*
|
|
76
53
|
* - [PieChart API](https://mui.com/x/api/charts/pie-chart/)
|
|
77
54
|
*/
|
|
78
|
-
declare const PieChart: React.ForwardRefExoticComponent<PieChartProps & React.RefAttributes<
|
|
55
|
+
declare const PieChart: React.ForwardRefExoticComponent<PieChartProps & React.RefAttributes<SVGSVGElement>>;
|
|
79
56
|
export { PieChart };
|
package/PieChart/PieChart.js
CHANGED
|
@@ -2,17 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "sx", "tooltip", "
|
|
5
|
+
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "sx", "tooltip", "skipAnimation", "hideLegend", "children", "slots", "slotProps", "onItemClick", "loading", "highlightedItem", "onHighlightChange", "className"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { useRtl } from '@mui/system/RtlProvider';
|
|
9
9
|
import { useThemeProps } from '@mui/material/styles';
|
|
10
|
-
import {
|
|
11
|
-
import { ChartsAxis } from "../ChartsAxis/ChartsAxis.js";
|
|
12
|
-
import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
|
|
10
|
+
import { ChartContainer } from "../ChartContainer/index.js";
|
|
13
11
|
import { ChartsTooltip } from "../ChartsTooltip/index.js";
|
|
14
12
|
import { ChartsLegend } from "../ChartsLegend/index.js";
|
|
15
|
-
import { ChartsAxisHighlight } from "../ChartsAxisHighlight/index.js";
|
|
16
13
|
import { PiePlot } from "./PiePlot.js";
|
|
17
14
|
import { ChartsOverlay } from "../ChartsOverlay/index.js";
|
|
18
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -45,8 +42,6 @@ const PieChart = /*#__PURE__*/React.forwardRef(function PieChart(inProps, ref) {
|
|
|
45
42
|
name: 'MuiPieChart'
|
|
46
43
|
});
|
|
47
44
|
const {
|
|
48
|
-
xAxis,
|
|
49
|
-
yAxis,
|
|
50
45
|
series,
|
|
51
46
|
width,
|
|
52
47
|
height,
|
|
@@ -56,16 +51,8 @@ const PieChart = /*#__PURE__*/React.forwardRef(function PieChart(inProps, ref) {
|
|
|
56
51
|
tooltip = {
|
|
57
52
|
trigger: 'item'
|
|
58
53
|
},
|
|
59
|
-
axisHighlight = {
|
|
60
|
-
x: 'none',
|
|
61
|
-
y: 'none'
|
|
62
|
-
},
|
|
63
54
|
skipAnimation,
|
|
64
|
-
|
|
65
|
-
topAxis = null,
|
|
66
|
-
leftAxis = null,
|
|
67
|
-
rightAxis = null,
|
|
68
|
-
bottomAxis = null,
|
|
55
|
+
hideLegend,
|
|
69
56
|
children,
|
|
70
57
|
slots,
|
|
71
58
|
slotProps,
|
|
@@ -78,14 +65,7 @@ const PieChart = /*#__PURE__*/React.forwardRef(function PieChart(inProps, ref) {
|
|
|
78
65
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
79
66
|
const isRtl = useRtl();
|
|
80
67
|
const margin = _extends({}, isRtl ? defaultRTLMargin : defaultMargin, marginProps);
|
|
81
|
-
|
|
82
|
-
direction: 'column',
|
|
83
|
-
position: {
|
|
84
|
-
vertical: 'middle',
|
|
85
|
-
horizontal: isRtl ? 'left' : 'right'
|
|
86
|
-
}
|
|
87
|
-
}, legendProps);
|
|
88
|
-
return /*#__PURE__*/_jsxs(ResponsiveChartContainer, _extends({}, other, {
|
|
68
|
+
return /*#__PURE__*/_jsxs(ChartContainer, _extends({}, other, {
|
|
89
69
|
ref: ref,
|
|
90
70
|
series: series.map(s => _extends({
|
|
91
71
|
type: 'pie'
|
|
@@ -93,27 +73,14 @@ const PieChart = /*#__PURE__*/React.forwardRef(function PieChart(inProps, ref) {
|
|
|
93
73
|
width: width,
|
|
94
74
|
height: height,
|
|
95
75
|
margin: margin,
|
|
96
|
-
xAxis: xAxis ?? [{
|
|
97
|
-
id: DEFAULT_X_AXIS_KEY,
|
|
98
|
-
scaleType: 'point',
|
|
99
|
-
data: [...new Array(Math.max(...series.map(s => s.data.length)))].map((_, index) => index)
|
|
100
|
-
}],
|
|
101
|
-
yAxis: yAxis,
|
|
102
76
|
colors: colors,
|
|
103
77
|
sx: sx,
|
|
104
|
-
disableAxisListener:
|
|
78
|
+
disableAxisListener: true,
|
|
105
79
|
highlightedItem: highlightedItem,
|
|
106
80
|
onHighlightChange: onHighlightChange,
|
|
107
81
|
className: className,
|
|
108
82
|
skipAnimation: skipAnimation,
|
|
109
|
-
children: [/*#__PURE__*/_jsx(
|
|
110
|
-
topAxis: topAxis,
|
|
111
|
-
leftAxis: leftAxis,
|
|
112
|
-
rightAxis: rightAxis,
|
|
113
|
-
bottomAxis: bottomAxis,
|
|
114
|
-
slots: slots,
|
|
115
|
-
slotProps: slotProps
|
|
116
|
-
}), /*#__PURE__*/_jsx(PiePlot, {
|
|
83
|
+
children: [/*#__PURE__*/_jsx(PiePlot, {
|
|
117
84
|
slots: slots,
|
|
118
85
|
slotProps: slotProps,
|
|
119
86
|
onItemClick: onItemClick
|
|
@@ -121,10 +88,15 @@ const PieChart = /*#__PURE__*/React.forwardRef(function PieChart(inProps, ref) {
|
|
|
121
88
|
loading: loading,
|
|
122
89
|
slots: slots,
|
|
123
90
|
slotProps: slotProps
|
|
124
|
-
}), /*#__PURE__*/_jsx(ChartsLegend,
|
|
91
|
+
}), !hideLegend && /*#__PURE__*/_jsx(ChartsLegend, {
|
|
92
|
+
direction: "column",
|
|
93
|
+
position: {
|
|
94
|
+
vertical: 'middle',
|
|
95
|
+
horizontal: isRtl ? 'left' : 'right'
|
|
96
|
+
},
|
|
125
97
|
slots: slots,
|
|
126
98
|
slotProps: slotProps
|
|
127
|
-
})
|
|
99
|
+
}), !loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip, {
|
|
128
100
|
slots: slots,
|
|
129
101
|
slotProps: slotProps
|
|
130
102
|
})), children]
|
|
@@ -135,21 +107,6 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
135
107
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
136
108
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
137
109
|
// ----------------------------------------------------------------------
|
|
138
|
-
/**
|
|
139
|
-
* The configuration of axes highlight.
|
|
140
|
-
* @see See {@link https://mui.com/x/react-charts/highlighting highlighting docs} for more details.
|
|
141
|
-
* @default { x: 'none', y: 'none' }
|
|
142
|
-
*/
|
|
143
|
-
axisHighlight: PropTypes.shape({
|
|
144
|
-
x: PropTypes.oneOf(['band', 'line', 'none']),
|
|
145
|
-
y: PropTypes.oneOf(['band', 'line', 'none'])
|
|
146
|
-
}),
|
|
147
|
-
/**
|
|
148
|
-
* Indicate which axis to display the bottom of the charts.
|
|
149
|
-
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
150
|
-
* @default null
|
|
151
|
-
*/
|
|
152
|
-
bottomAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
153
110
|
children: PropTypes.node,
|
|
154
111
|
className: PropTypes.string,
|
|
155
112
|
/**
|
|
@@ -172,6 +129,10 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
172
129
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
173
130
|
*/
|
|
174
131
|
height: PropTypes.number,
|
|
132
|
+
/**
|
|
133
|
+
* If `true`, the legend is not rendered.
|
|
134
|
+
*/
|
|
135
|
+
hideLegend: PropTypes.bool,
|
|
175
136
|
/**
|
|
176
137
|
* The item currently highlighted. Turns highlighting into a controlled prop.
|
|
177
138
|
*/
|
|
@@ -179,40 +140,6 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
179
140
|
dataIndex: PropTypes.number,
|
|
180
141
|
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
181
142
|
}),
|
|
182
|
-
/**
|
|
183
|
-
* Indicate which axis to display the left of the charts.
|
|
184
|
-
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
185
|
-
* @default null
|
|
186
|
-
*/
|
|
187
|
-
leftAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
188
|
-
/**
|
|
189
|
-
* The props of the legend.
|
|
190
|
-
* @default { direction: 'column', position: { vertical: 'middle', horizontal: 'right' } }
|
|
191
|
-
* @deprecated Consider using `slotProps.legend` instead.
|
|
192
|
-
*/
|
|
193
|
-
legend: PropTypes.shape({
|
|
194
|
-
classes: PropTypes.object,
|
|
195
|
-
direction: PropTypes.oneOf(['column', 'row']),
|
|
196
|
-
hidden: PropTypes.bool,
|
|
197
|
-
itemGap: PropTypes.number,
|
|
198
|
-
itemMarkHeight: PropTypes.number,
|
|
199
|
-
itemMarkWidth: PropTypes.number,
|
|
200
|
-
labelStyle: PropTypes.object,
|
|
201
|
-
markGap: PropTypes.number,
|
|
202
|
-
onItemClick: PropTypes.func,
|
|
203
|
-
padding: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
204
|
-
bottom: PropTypes.number,
|
|
205
|
-
left: PropTypes.number,
|
|
206
|
-
right: PropTypes.number,
|
|
207
|
-
top: PropTypes.number
|
|
208
|
-
})]),
|
|
209
|
-
position: PropTypes.shape({
|
|
210
|
-
horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
|
|
211
|
-
vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
212
|
-
}),
|
|
213
|
-
slotProps: PropTypes.object,
|
|
214
|
-
slots: PropTypes.object
|
|
215
|
-
}),
|
|
216
143
|
/**
|
|
217
144
|
* If `true`, a loading overlay is displayed.
|
|
218
145
|
* @default false
|
|
@@ -250,12 +177,6 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
250
177
|
* @default false
|
|
251
178
|
*/
|
|
252
179
|
resolveSizeBeforeRender: PropTypes.bool,
|
|
253
|
-
/**
|
|
254
|
-
* Indicate which axis to display the right of the charts.
|
|
255
|
-
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
256
|
-
* @default null
|
|
257
|
-
*/
|
|
258
|
-
rightAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
259
180
|
/**
|
|
260
181
|
* The series to display in the pie chart.
|
|
261
182
|
* An array of [[PieSeriesType]] objects.
|
|
@@ -291,12 +212,6 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
291
212
|
slots: PropTypes.object,
|
|
292
213
|
trigger: PropTypes.oneOf(['axis', 'item', 'none'])
|
|
293
214
|
}),
|
|
294
|
-
/**
|
|
295
|
-
* Indicate which axis to display the top of the charts.
|
|
296
|
-
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
297
|
-
* @default null
|
|
298
|
-
*/
|
|
299
|
-
topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
300
215
|
viewBox: PropTypes.shape({
|
|
301
216
|
height: PropTypes.number,
|
|
302
217
|
width: PropTypes.number,
|
|
@@ -333,6 +248,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
333
248
|
dataKey: PropTypes.string,
|
|
334
249
|
disableLine: PropTypes.bool,
|
|
335
250
|
disableTicks: PropTypes.bool,
|
|
251
|
+
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
336
252
|
fill: PropTypes.string,
|
|
337
253
|
hideTooltip: PropTypes.bool,
|
|
338
254
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -386,6 +302,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
386
302
|
dataKey: PropTypes.string,
|
|
387
303
|
disableLine: PropTypes.bool,
|
|
388
304
|
disableTicks: PropTypes.bool,
|
|
305
|
+
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
389
306
|
fill: PropTypes.string,
|
|
390
307
|
hideTooltip: PropTypes.bool,
|
|
391
308
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
package/README.md
CHANGED
|
@@ -11,11 +11,11 @@ Install the package in your project directory with:
|
|
|
11
11
|
npm install @mui/x-charts
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
This component has the following peer dependencies that you
|
|
14
|
+
This component has the following peer dependencies that you need to install as well.
|
|
15
15
|
|
|
16
16
|
```json
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"@mui/material": "^5.15.14",
|
|
18
|
+
"@mui/material": "^5.15.14 || ^6.0.0",
|
|
19
19
|
"react": "^17.0.0 || ^18.0.0",
|
|
20
20
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
21
21
|
},
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
2
3
|
import { ScatterPlotProps, ScatterPlotSlotProps, ScatterPlotSlots } from './ScatterPlot';
|
|
3
|
-
import {
|
|
4
|
+
import { ChartContainerProps } from '../ChartContainer';
|
|
4
5
|
import { ChartsAxisProps } from '../ChartsAxis';
|
|
5
6
|
import { ScatterSeriesType } from '../models/seriesType/scatter';
|
|
6
|
-
import { MakeOptional } from '../models/helpers';
|
|
7
7
|
import { ChartsTooltipProps, ChartsTooltipSlotProps, ChartsTooltipSlots } from '../ChartsTooltip';
|
|
8
|
-
import {
|
|
8
|
+
import { ChartsLegendSlotProps, ChartsLegendSlots } from '../ChartsLegend';
|
|
9
9
|
import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from '../ChartsOverlay';
|
|
10
10
|
import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
|
|
11
11
|
import { ChartsAxisSlots, ChartsAxisSlotProps } from '../models/axis';
|
|
@@ -16,7 +16,7 @@ export interface ScatterChartSlots extends ChartsAxisSlots, ScatterPlotSlots, Ch
|
|
|
16
16
|
}
|
|
17
17
|
export interface ScatterChartSlotProps extends ChartsAxisSlotProps, ScatterPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps<'scatter'>, ChartsOverlaySlotProps {
|
|
18
18
|
}
|
|
19
|
-
export interface ScatterChartProps extends Omit<
|
|
19
|
+
export interface ScatterChartProps extends Omit<ChartContainerProps, 'series' | 'plugins'>, Omit<ZAxisContextProviderProps, 'children' | 'dataset'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Omit<ChartsVoronoiHandlerProps, 'onItemClick'> {
|
|
20
20
|
/**
|
|
21
21
|
* The series to display in the scatter chart.
|
|
22
22
|
* An array of [[ScatterSeriesType]] objects.
|
|
@@ -44,9 +44,9 @@ export interface ScatterChartProps extends Omit<ResponsiveChartContainerProps, '
|
|
|
44
44
|
*/
|
|
45
45
|
disableVoronoi?: boolean;
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
47
|
+
* If `true`, the legend is not rendered.
|
|
48
48
|
*/
|
|
49
|
-
|
|
49
|
+
hideLegend?: boolean;
|
|
50
50
|
/**
|
|
51
51
|
* Overridable component slots.
|
|
52
52
|
* @default {}
|
|
@@ -74,5 +74,5 @@ export interface ScatterChartProps extends Omit<ResponsiveChartContainerProps, '
|
|
|
74
74
|
*
|
|
75
75
|
* - [ScatterChart API](https://mui.com/x/api/charts/scatter-chart/)
|
|
76
76
|
*/
|
|
77
|
-
declare const ScatterChart: React.ForwardRefExoticComponent<ScatterChartProps & React.RefAttributes<
|
|
77
|
+
declare const ScatterChart: React.ForwardRefExoticComponent<ScatterChartProps & React.RefAttributes<SVGSVGElement>>;
|
|
78
78
|
export { ScatterChart };
|
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useThemeProps } from '@mui/material/styles';
|
|
7
7
|
import { ScatterPlot } from "./ScatterPlot.js";
|
|
8
|
-
import {
|
|
8
|
+
import { ChartContainer } from "../ChartContainer/index.js";
|
|
9
9
|
import { ChartsAxis } from "../ChartsAxis/index.js";
|
|
10
10
|
import { ChartsTooltip } from "../ChartsTooltip/index.js";
|
|
11
11
|
import { ChartsLegend } from "../ChartsLegend/index.js";
|
|
@@ -44,14 +44,14 @@ const ScatterChart = /*#__PURE__*/React.forwardRef(function ScatterChart(inProps
|
|
|
44
44
|
tooltipProps,
|
|
45
45
|
children
|
|
46
46
|
} = useScatterChartProps(props);
|
|
47
|
-
return /*#__PURE__*/_jsx(
|
|
47
|
+
return /*#__PURE__*/_jsx(ChartContainer, _extends({
|
|
48
48
|
ref: ref
|
|
49
49
|
}, chartContainerProps, {
|
|
50
50
|
children: /*#__PURE__*/_jsxs(ZAxisContextProvider, _extends({}, zAxisProps, {
|
|
51
51
|
children: [!props.disableVoronoi && /*#__PURE__*/_jsx(ChartsVoronoiHandler, _extends({}, voronoiHandlerProps)), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsx("g", {
|
|
52
52
|
"data-drawing-container": true,
|
|
53
53
|
children: /*#__PURE__*/_jsx(ScatterPlot, _extends({}, scatterPlotProps))
|
|
54
|
-
}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), !props.loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltipProps)), children]
|
|
54
|
+
}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), !props.loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltipProps)), children]
|
|
55
55
|
}))
|
|
56
56
|
}));
|
|
57
57
|
});
|
|
@@ -109,6 +109,10 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
109
109
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
110
110
|
*/
|
|
111
111
|
height: PropTypes.number,
|
|
112
|
+
/**
|
|
113
|
+
* If `true`, the legend is not rendered.
|
|
114
|
+
*/
|
|
115
|
+
hideLegend: PropTypes.bool,
|
|
112
116
|
/**
|
|
113
117
|
* The item currently highlighted. Turns highlighting into a controlled prop.
|
|
114
118
|
*/
|
|
@@ -122,32 +126,6 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
122
126
|
* @default yAxisIds[0] The id of the first provided axis
|
|
123
127
|
*/
|
|
124
128
|
leftAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
125
|
-
/**
|
|
126
|
-
* @deprecated Consider using `slotProps.legend` instead.
|
|
127
|
-
*/
|
|
128
|
-
legend: PropTypes.shape({
|
|
129
|
-
classes: PropTypes.object,
|
|
130
|
-
direction: PropTypes.oneOf(['column', 'row']),
|
|
131
|
-
hidden: PropTypes.bool,
|
|
132
|
-
itemGap: PropTypes.number,
|
|
133
|
-
itemMarkHeight: PropTypes.number,
|
|
134
|
-
itemMarkWidth: PropTypes.number,
|
|
135
|
-
labelStyle: PropTypes.object,
|
|
136
|
-
markGap: PropTypes.number,
|
|
137
|
-
onItemClick: PropTypes.func,
|
|
138
|
-
padding: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
139
|
-
bottom: PropTypes.number,
|
|
140
|
-
left: PropTypes.number,
|
|
141
|
-
right: PropTypes.number,
|
|
142
|
-
top: PropTypes.number
|
|
143
|
-
})]),
|
|
144
|
-
position: PropTypes.shape({
|
|
145
|
-
horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
|
|
146
|
-
vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
147
|
-
}),
|
|
148
|
-
slotProps: PropTypes.object,
|
|
149
|
-
slots: PropTypes.object
|
|
150
|
-
}),
|
|
151
129
|
/**
|
|
152
130
|
* If `true`, a loading overlay is displayed.
|
|
153
131
|
* @default false
|
|
@@ -275,6 +253,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
275
253
|
dataKey: PropTypes.string,
|
|
276
254
|
disableLine: PropTypes.bool,
|
|
277
255
|
disableTicks: PropTypes.bool,
|
|
256
|
+
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
278
257
|
fill: PropTypes.string,
|
|
279
258
|
hideTooltip: PropTypes.bool,
|
|
280
259
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -328,6 +307,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
328
307
|
dataKey: PropTypes.string,
|
|
329
308
|
disableLine: PropTypes.bool,
|
|
330
309
|
disableTicks: PropTypes.bool,
|
|
310
|
+
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
331
311
|
fill: PropTypes.string,
|
|
332
312
|
hideTooltip: PropTypes.bool,
|
|
333
313
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -52,18 +52,15 @@ function ScatterPlot(props) {
|
|
|
52
52
|
children: seriesOrder.map(seriesId => {
|
|
53
53
|
const {
|
|
54
54
|
id,
|
|
55
|
-
xAxisKey,
|
|
56
|
-
yAxisKey,
|
|
57
|
-
zAxisKey,
|
|
58
55
|
xAxisId,
|
|
59
56
|
yAxisId,
|
|
60
57
|
zAxisId,
|
|
61
58
|
markerSize,
|
|
62
59
|
color
|
|
63
60
|
} = series[seriesId];
|
|
64
|
-
const colorGetter = getColor(series[seriesId], xAxis[xAxisId ??
|
|
65
|
-
const xScale = xAxis[xAxisId ??
|
|
66
|
-
const yScale = yAxis[yAxisId ??
|
|
61
|
+
const colorGetter = getColor(series[seriesId], xAxis[xAxisId ?? defaultXAxisId], yAxis[yAxisId ?? defaultYAxisId], zAxis[zAxisId ?? defaultZAxisId]);
|
|
62
|
+
const xScale = xAxis[xAxisId ?? defaultXAxisId].scale;
|
|
63
|
+
const yScale = yAxis[yAxisId ?? defaultYAxisId].scale;
|
|
67
64
|
return /*#__PURE__*/_jsx(ScatterItems, _extends({
|
|
68
65
|
xScale: xScale,
|
|
69
66
|
yScale: yScale,
|
|
@@ -9,14 +9,14 @@ export const getExtremumX = params => {
|
|
|
9
9
|
getFilters
|
|
10
10
|
} = params;
|
|
11
11
|
return Object.keys(series).filter(seriesId => {
|
|
12
|
-
const axisId = series[seriesId].xAxisId
|
|
12
|
+
const axisId = series[seriesId].xAxisId;
|
|
13
13
|
return axisId === axis.id || axisId === undefined && isDefaultAxis;
|
|
14
14
|
}).reduce((acc, seriesId) => {
|
|
15
15
|
const filter = getFilters?.({
|
|
16
16
|
currentAxisId: axis.id,
|
|
17
17
|
isDefaultAxis,
|
|
18
|
-
seriesXAxisId: series[seriesId].xAxisId
|
|
19
|
-
seriesYAxisId: series[seriesId].yAxisId
|
|
18
|
+
seriesXAxisId: series[seriesId].xAxisId,
|
|
19
|
+
seriesYAxisId: series[seriesId].yAxisId
|
|
20
20
|
});
|
|
21
21
|
const seriesMinMax = series[seriesId].data?.reduce((accSeries, d, dataIndex) => {
|
|
22
22
|
if (filter && !filter(d, dataIndex)) {
|
|
@@ -35,14 +35,14 @@ export const getExtremumY = params => {
|
|
|
35
35
|
getFilters
|
|
36
36
|
} = params;
|
|
37
37
|
return Object.keys(series).filter(seriesId => {
|
|
38
|
-
const axisId = series[seriesId].yAxisId
|
|
38
|
+
const axisId = series[seriesId].yAxisId;
|
|
39
39
|
return axisId === axis.id || axisId === undefined && isDefaultAxis;
|
|
40
40
|
}).reduce((acc, seriesId) => {
|
|
41
41
|
const filter = getFilters?.({
|
|
42
42
|
currentAxisId: axis.id,
|
|
43
43
|
isDefaultAxis,
|
|
44
|
-
seriesXAxisId: series[seriesId].xAxisId
|
|
45
|
-
seriesYAxisId: series[seriesId].yAxisId
|
|
44
|
+
seriesXAxisId: series[seriesId].xAxisId,
|
|
45
|
+
seriesYAxisId: series[seriesId].yAxisId
|
|
46
46
|
});
|
|
47
47
|
const seriesMinMax = series[seriesId].data?.reduce((accSeries, d, dataIndex) => {
|
|
48
48
|
if (filter && !filter(d, dataIndex)) {
|
|
@@ -5,7 +5,7 @@ import { ChartsLegendProps } from '../ChartsLegend';
|
|
|
5
5
|
import { ChartsOverlayProps } from '../ChartsOverlay';
|
|
6
6
|
import { ChartsTooltipProps } from '../ChartsTooltip';
|
|
7
7
|
import type { ChartsVoronoiHandlerProps } from '../ChartsVoronoiHandler';
|
|
8
|
-
import {
|
|
8
|
+
import { ChartContainerProps } from '../ChartContainer';
|
|
9
9
|
import { ZAxisContextProviderProps } from '../context';
|
|
10
10
|
import type { ScatterChartProps } from './ScatterChart';
|
|
11
11
|
import type { ScatterPlotProps } from './ScatterPlot';
|
|
@@ -17,7 +17,7 @@ import type { ScatterPlotProps } from './ScatterPlot';
|
|
|
17
17
|
* @returns An object with props for the children components of ScatterChart
|
|
18
18
|
*/
|
|
19
19
|
export declare const useScatterChartProps: (props: ScatterChartProps) => {
|
|
20
|
-
chartContainerProps:
|
|
20
|
+
chartContainerProps: ChartContainerProps;
|
|
21
21
|
zAxisProps: Omit<ZAxisContextProviderProps, "children">;
|
|
22
22
|
voronoiHandlerProps: ChartsVoronoiHandlerProps;
|
|
23
23
|
chartsAxisProps: ChartsAxisProps;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["xAxis", "yAxis", "zAxis", "series", "tooltip", "axisHighlight", "voronoiMaxRadius", "disableVoronoi", "
|
|
5
|
+
const _excluded = ["xAxis", "yAxis", "zAxis", "series", "tooltip", "axisHighlight", "voronoiMaxRadius", "disableVoronoi", "hideLegend", "width", "height", "margin", "colors", "sx", "grid", "topAxis", "leftAxis", "rightAxis", "bottomAxis", "onItemClick", "children", "slots", "slotProps", "loading", "highlightedItem", "onHighlightChange", "className"];
|
|
6
6
|
/**
|
|
7
7
|
* A helper function that extracts ScatterChartProps from the input props
|
|
8
8
|
* and returns an object with props for the children components of ScatterChart.
|
|
@@ -20,7 +20,6 @@ export const useScatterChartProps = props => {
|
|
|
20
20
|
axisHighlight,
|
|
21
21
|
voronoiMaxRadius,
|
|
22
22
|
disableVoronoi,
|
|
23
|
-
legend,
|
|
24
23
|
width,
|
|
25
24
|
height,
|
|
26
25
|
margin,
|
|
@@ -85,10 +84,10 @@ export const useScatterChartProps = props => {
|
|
|
85
84
|
slots,
|
|
86
85
|
slotProps
|
|
87
86
|
};
|
|
88
|
-
const legendProps =
|
|
87
|
+
const legendProps = {
|
|
89
88
|
slots,
|
|
90
89
|
slotProps
|
|
91
|
-
}
|
|
90
|
+
};
|
|
92
91
|
const axisHighlightProps = _extends({
|
|
93
92
|
y: 'none',
|
|
94
93
|
x: 'none'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
3
|
+
import { ChartContainerProps } from '../ChartContainer';
|
|
3
4
|
import { ChartsTooltipProps, ChartsTooltipSlotProps, ChartsTooltipSlots } from '../ChartsTooltip';
|
|
4
5
|
import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
|
|
5
6
|
import { AxisConfig, ChartsXAxisProps, ChartsYAxisProps, ScaleName } from '../models/axis';
|
|
6
|
-
import { MakeOptional } from '../models/helpers';
|
|
7
7
|
import { LineSeriesType } from '../models/seriesType';
|
|
8
8
|
import { CardinalDirections } from '../models/layout';
|
|
9
9
|
import { AreaPlotSlots, AreaPlotSlotProps } from '../LineChart/AreaPlot';
|
|
@@ -15,7 +15,7 @@ export interface SparkLineChartSlots extends AreaPlotSlots, LinePlotSlots, MarkP
|
|
|
15
15
|
}
|
|
16
16
|
export interface SparkLineChartSlotProps extends AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, BarPlotSlotProps, ChartsTooltipSlotProps<'line' | 'bar'> {
|
|
17
17
|
}
|
|
18
|
-
export interface SparkLineChartProps extends Omit<
|
|
18
|
+
export interface SparkLineChartProps extends Omit<ChartContainerProps, 'series' | 'xAxis' | 'yAxis' | 'zAxis' | 'margin' | 'plugins'> {
|
|
19
19
|
/**
|
|
20
20
|
* The xAxis configuration.
|
|
21
21
|
* Notice it is a single [[AxisConfig]] object, not an array of configuration.
|
|
@@ -98,5 +98,5 @@ export interface SparkLineChartProps extends Omit<ResponsiveChartContainerProps,
|
|
|
98
98
|
*
|
|
99
99
|
* - [SparkLineChart API](https://mui.com/x/api/charts/spark-line-chart/)
|
|
100
100
|
*/
|
|
101
|
-
declare const SparkLineChart: React.ForwardRefExoticComponent<SparkLineChartProps & React.RefAttributes<
|
|
101
|
+
declare const SparkLineChart: React.ForwardRefExoticComponent<SparkLineChartProps & React.RefAttributes<SVGSVGElement>>;
|
|
102
102
|
export { SparkLineChart };
|
|
@@ -7,7 +7,7 @@ import * as React from 'react';
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { BarPlot } from "../BarChart/index.js";
|
|
9
9
|
import { LinePlot, AreaPlot, LineHighlightPlot } from "../LineChart/index.js";
|
|
10
|
-
import {
|
|
10
|
+
import { ChartContainer } from "../ChartContainer/index.js";
|
|
11
11
|
import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
|
|
12
12
|
import { ChartsTooltip } from "../ChartsTooltip/index.js";
|
|
13
13
|
import { ChartsAxisHighlight } from "../ChartsAxisHighlight/index.js";
|
|
@@ -58,7 +58,7 @@ const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(pro
|
|
|
58
58
|
x: 'none'
|
|
59
59
|
};
|
|
60
60
|
const axisHighlight = _extends({}, defaultXHighlight, inAxisHighlight);
|
|
61
|
-
return /*#__PURE__*/_jsxs(
|
|
61
|
+
return /*#__PURE__*/_jsxs(ChartContainer, _extends({}, other, {
|
|
62
62
|
ref: ref,
|
|
63
63
|
series: [_extends({
|
|
64
64
|
type: plotType,
|
|
@@ -282,6 +282,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
282
282
|
dataKey: PropTypes.string,
|
|
283
283
|
disableLine: PropTypes.bool,
|
|
284
284
|
disableTicks: PropTypes.bool,
|
|
285
|
+
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
285
286
|
fill: PropTypes.string,
|
|
286
287
|
hideTooltip: PropTypes.bool,
|
|
287
288
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -334,6 +335,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
334
335
|
dataKey: PropTypes.string,
|
|
335
336
|
disableLine: PropTypes.bool,
|
|
336
337
|
disableTicks: PropTypes.bool,
|
|
338
|
+
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
337
339
|
fill: PropTypes.string,
|
|
338
340
|
hideTooltip: PropTypes.bool,
|
|
339
341
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|