@mui/x-charts 8.0.0-alpha.6 → 8.0.0-alpha.7
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/AnimatedBarElement.js +1 -0
- package/BarChart/BarChart.js +17 -7
- package/BarChart/BarLabel/BarLabel.d.ts +1 -479
- package/BarChart/BarLabel/barLabelClasses.d.ts +1 -1
- package/BarChart/legend.js +1 -0
- package/BarChart/useBarChartProps.d.ts +4 -2
- package/BarChart/useBarChartProps.js +16 -3
- package/CHANGELOG.md +127 -1
- package/ChartsLabel/ChartsLabel.d.ts +2 -3
- package/ChartsLabel/ChartsLabel.js +3 -18
- package/ChartsLabel/ChartsLabelGradient.d.ts +9 -8
- package/ChartsLabel/ChartsLabelGradient.js +21 -18
- package/ChartsLabel/ChartsLabelMark.d.ts +2 -3
- package/ChartsLabel/ChartsLabelMark.js +5 -2
- package/ChartsLabel/index.d.ts +7 -0
- package/ChartsLabel/index.js +6 -0
- package/ChartsLabel/labelClasses.d.ts +0 -1
- package/ChartsLabel/labelGradientClasses.d.ts +5 -4
- package/ChartsLabel/labelGradientClasses.js +3 -2
- package/ChartsLabel/labelMarkClasses.d.ts +3 -2
- package/ChartsLabel/labelMarkClasses.js +3 -2
- package/ChartsLabel/package.json +6 -0
- package/ChartsLegend/ChartsLegend.d.ts +18 -22
- package/ChartsLegend/ChartsLegend.js +100 -109
- package/ChartsLegend/ContinuousColorLegend.d.ts +29 -38
- package/ChartsLegend/ContinuousColorLegend.js +198 -321
- package/ChartsLegend/PiecewiseColorLegend.d.ts +27 -19
- package/ChartsLegend/PiecewiseColorLegend.js +201 -111
- package/ChartsLegend/chartsLegend.types.d.ts +17 -60
- package/ChartsLegend/chartsLegendClasses.d.ts +7 -8
- package/ChartsLegend/chartsLegendClasses.js +16 -2
- package/ChartsLegend/colorLegend.types.d.ts +13 -0
- package/ChartsLegend/colorLegend.types.js +1 -0
- package/ChartsLegend/continuousColorLegendClasses.d.ts +26 -0
- package/ChartsLegend/continuousColorLegendClasses.js +23 -0
- package/ChartsLegend/direction.d.ts +1 -0
- package/ChartsLegend/direction.js +1 -0
- package/ChartsLegend/index.d.ts +13 -3
- package/ChartsLegend/index.js +9 -3
- package/ChartsLegend/legend.types.d.ts +10 -54
- package/ChartsLegend/legendContext.types.d.ts +55 -0
- package/ChartsLegend/legendContext.types.js +1 -0
- package/ChartsLegend/onClickContextBuilder.d.ts +2 -0
- package/ChartsLegend/onClickContextBuilder.js +7 -0
- package/ChartsLegend/piecewiseColorDefaultLabelFormatter.d.ts +2 -0
- package/ChartsLegend/piecewiseColorDefaultLabelFormatter.js +9 -0
- package/ChartsLegend/piecewiseColorLegend.types.d.ts +26 -0
- package/ChartsLegend/piecewiseColorLegend.types.js +1 -0
- package/ChartsLegend/piecewiseColorLegendClasses.d.ts +28 -0
- package/ChartsLegend/piecewiseColorLegendClasses.js +23 -0
- package/ChartsLegend/useAxis.d.ts +1 -1
- package/ChartsLegend/useAxis.js +0 -1
- package/ChartsReferenceLine/ChartsXReferenceLine.d.ts +1 -1
- package/ChartsReferenceLine/ChartsYReferenceLine.d.ts +1 -1
- package/ChartsSurface/ChartsSurface.js +0 -1
- package/ChartsTooltip/chartsTooltipClasses.d.ts +1 -1
- package/LineChart/AnimatedArea.js +1 -0
- package/LineChart/AnimatedLine.js +1 -0
- package/LineChart/AppearingMask.js +1 -0
- package/LineChart/CircleMarkElement.js +1 -0
- package/LineChart/LineChart.js +20 -10
- package/LineChart/MarkElement.js +3 -1
- package/LineChart/legend.js +1 -0
- package/LineChart/useLineChartProps.d.ts +4 -2
- package/LineChart/useLineChartProps.js +15 -2
- package/PieChart/PieArc.js +3 -1
- package/PieChart/PieArcLabel.js +13 -9
- package/PieChart/PieArcLabelPlot.js +1 -0
- package/PieChart/PieArcPlot.js +1 -0
- package/PieChart/PieChart.js +42 -41
- package/PieChart/legend.js +1 -0
- package/ScatterChart/ScatterChart.js +21 -11
- package/ScatterChart/legend.js +1 -0
- package/ScatterChart/useScatterChartProps.d.ts +4 -2
- package/ScatterChart/useScatterChartProps.js +15 -2
- package/SparkLineChart/SparkLineChart.js +1 -4
- package/constants/index.d.ts +1 -0
- package/constants/index.js +2 -1
- package/context/CartesianProvider/defaultizeAxis.d.ts +9 -9
- package/context/ChartDataProvider/useChartDataProviderProps.d.ts +18 -18
- package/context/ChartDataProvider/useDefaultizeAxis.d.ts +9 -9
- package/context/ChartProvider/ChartProvider.types.d.ts +1 -1
- package/context/InteractionSelectors.d.ts +11 -11
- package/context/PluginProvider/SeriesFormatter.types.d.ts +1 -1
- package/context/PluginProvider/mergePlugins.d.ts +8 -8
- package/context/SizeProvider/Size.types.d.ts +1 -1
- package/context/SizeProvider/useChartContainerDimensions.d.ts +1 -1
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +2 -1
- package/hooks/useLegend.d.ts +13 -0
- package/{modern/ChartsLegend/utils.js → hooks/useLegend.js} +20 -1
- package/hooks/useSvgRef.d.ts +1 -1
- package/index.d.ts +1 -0
- package/index.js +2 -1
- package/internals/calculateMargins.d.ts +7 -0
- package/internals/calculateMargins.js +25 -0
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.d.ts +2 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +60 -16
- package/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +6 -6
- package/internals/components/ChartsAxesGradients/ChartsContinuousGradientObjectBound.d.ts +13 -0
- package/internals/components/ChartsAxesGradients/ChartsContinuousGradientObjectBound.js +61 -0
- package/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +3 -0
- package/internals/components/ChartsWrapper/ChartsWrapper.d.ts +17 -0
- package/internals/components/ChartsWrapper/ChartsWrapper.js +66 -0
- package/internals/components/ChartsWrapper/index.d.ts +1 -0
- package/internals/components/ChartsWrapper/index.js +1 -0
- package/internals/consumeSlots.d.ts +48 -0
- package/internals/consumeSlots.js +101 -0
- package/internals/consumeThemeProps.d.ts +3 -7
- package/internals/consumeThemeProps.js +18 -27
- package/internals/defaultizeColor.d.ts +6 -1
- package/internals/index.d.ts +1 -0
- package/internals/index.js +1 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +11 -11
- package/internals/plugins/models/plugin.d.ts +1 -1
- package/internals/store/useCharts.d.ts +2 -2
- package/internals/store/useCharts.types.d.ts +1 -1
- package/models/seriesType/common.d.ts +9 -0
- package/models/seriesType/pie.d.ts +9 -0
- package/modern/BarChart/AnimatedBarElement.js +1 -0
- package/modern/BarChart/BarChart.js +17 -7
- package/modern/BarChart/legend.js +1 -0
- package/modern/BarChart/useBarChartProps.js +16 -3
- package/modern/ChartsLabel/ChartsLabel.js +3 -18
- package/modern/ChartsLabel/ChartsLabelGradient.js +21 -18
- package/modern/ChartsLabel/ChartsLabelMark.js +5 -2
- package/modern/ChartsLabel/index.js +6 -0
- package/modern/ChartsLabel/labelGradientClasses.js +3 -2
- package/modern/ChartsLabel/labelMarkClasses.js +3 -2
- package/modern/ChartsLegend/ChartsLegend.js +100 -109
- package/modern/ChartsLegend/ContinuousColorLegend.js +198 -321
- package/modern/ChartsLegend/PiecewiseColorLegend.js +201 -111
- package/modern/ChartsLegend/chartsLegendClasses.js +16 -2
- package/modern/ChartsLegend/colorLegend.types.js +1 -0
- package/modern/ChartsLegend/continuousColorLegendClasses.js +23 -0
- package/modern/ChartsLegend/direction.js +1 -0
- package/modern/ChartsLegend/index.js +9 -3
- package/modern/ChartsLegend/legendContext.types.js +1 -0
- package/modern/ChartsLegend/onClickContextBuilder.js +7 -0
- package/modern/ChartsLegend/piecewiseColorDefaultLabelFormatter.js +9 -0
- package/modern/ChartsLegend/piecewiseColorLegend.types.js +1 -0
- package/modern/ChartsLegend/piecewiseColorLegendClasses.js +23 -0
- package/modern/ChartsLegend/useAxis.js +0 -1
- package/modern/ChartsSurface/ChartsSurface.js +0 -1
- package/modern/LineChart/AnimatedArea.js +1 -0
- package/modern/LineChart/AnimatedLine.js +1 -0
- package/modern/LineChart/AppearingMask.js +1 -0
- package/modern/LineChart/CircleMarkElement.js +1 -0
- package/modern/LineChart/LineChart.js +20 -10
- package/modern/LineChart/MarkElement.js +3 -1
- package/modern/LineChart/legend.js +1 -0
- package/modern/LineChart/useLineChartProps.js +15 -2
- package/modern/PieChart/PieArc.js +3 -1
- package/modern/PieChart/PieArcLabel.js +13 -9
- package/modern/PieChart/PieArcLabelPlot.js +1 -0
- package/modern/PieChart/PieArcPlot.js +1 -0
- package/modern/PieChart/PieChart.js +42 -41
- package/modern/PieChart/legend.js +1 -0
- package/modern/ScatterChart/ScatterChart.js +21 -11
- package/modern/ScatterChart/legend.js +1 -0
- package/modern/ScatterChart/useScatterChartProps.js +15 -2
- package/modern/SparkLineChart/SparkLineChart.js +1 -4
- package/modern/constants/index.js +2 -1
- package/modern/hooks/index.js +2 -1
- package/{ChartsLegend/utils.js → modern/hooks/useLegend.js} +20 -1
- package/modern/index.js +2 -1
- package/modern/internals/calculateMargins.js +25 -0
- package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +60 -16
- package/modern/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +6 -6
- package/modern/internals/components/ChartsAxesGradients/ChartsContinuousGradientObjectBound.js +61 -0
- package/modern/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +3 -0
- package/modern/internals/components/ChartsWrapper/ChartsWrapper.js +66 -0
- package/modern/internals/components/ChartsWrapper/index.js +1 -0
- package/modern/internals/consumeSlots.js +101 -0
- package/modern/internals/consumeThemeProps.js +18 -27
- package/modern/internals/index.js +1 -0
- package/node/BarChart/AnimatedBarElement.js +1 -0
- package/node/BarChart/BarChart.js +17 -7
- package/node/BarChart/legend.js +1 -0
- package/node/BarChart/useBarChartProps.js +15 -3
- package/node/ChartsLabel/ChartsLabel.js +3 -18
- package/node/ChartsLabel/ChartsLabelGradient.js +21 -18
- package/node/ChartsLabel/ChartsLabelMark.js +5 -2
- package/node/ChartsLabel/index.js +26 -0
- package/node/ChartsLabel/labelGradientClasses.js +3 -2
- package/node/ChartsLabel/labelMarkClasses.js +3 -2
- package/node/ChartsLegend/ChartsLegend.js +99 -108
- package/node/ChartsLegend/ContinuousColorLegend.js +199 -322
- package/node/ChartsLegend/PiecewiseColorLegend.js +201 -111
- package/node/ChartsLegend/chartsLegendClasses.js +17 -3
- package/node/ChartsLegend/colorLegend.types.js +5 -0
- package/node/ChartsLegend/continuousColorLegendClasses.js +31 -0
- package/node/ChartsLegend/direction.js +5 -0
- package/node/ChartsLegend/index.js +80 -16
- package/node/ChartsLegend/legendContext.types.js +5 -0
- package/node/ChartsLegend/onClickContextBuilder.js +14 -0
- package/node/ChartsLegend/piecewiseColorDefaultLabelFormatter.js +15 -0
- package/node/ChartsLegend/piecewiseColorLegend.types.js +5 -0
- package/node/ChartsLegend/piecewiseColorLegendClasses.js +31 -0
- package/node/ChartsSurface/ChartsSurface.js +0 -1
- package/node/LineChart/AnimatedArea.js +1 -0
- package/node/LineChart/AnimatedLine.js +1 -0
- package/node/LineChart/AppearingMask.js +1 -0
- package/node/LineChart/CircleMarkElement.js +1 -0
- package/node/LineChart/LineChart.js +20 -10
- package/node/LineChart/MarkElement.js +3 -1
- package/node/LineChart/legend.js +1 -0
- package/node/LineChart/useLineChartProps.js +14 -2
- package/node/PieChart/PieArc.js +3 -1
- package/node/PieChart/PieArcLabel.js +13 -9
- package/node/PieChart/PieArcLabelPlot.js +1 -0
- package/node/PieChart/PieArcPlot.js +1 -0
- package/node/PieChart/PieChart.js +42 -41
- package/node/PieChart/legend.js +1 -0
- package/node/ScatterChart/ScatterChart.js +21 -11
- package/node/ScatterChart/legend.js +1 -0
- package/node/ScatterChart/useScatterChartProps.js +14 -2
- package/node/SparkLineChart/SparkLineChart.js +1 -4
- package/node/constants/index.js +3 -2
- package/node/hooks/index.js +13 -1
- package/node/{ChartsLegend/utils.js → hooks/useLegend.js} +19 -1
- package/node/index.js +12 -1
- package/node/internals/calculateMargins.js +33 -0
- package/node/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +61 -16
- package/node/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +6 -6
- package/node/internals/components/ChartsAxesGradients/ChartsContinuousGradientObjectBound.js +69 -0
- package/node/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +3 -0
- package/node/internals/components/ChartsWrapper/ChartsWrapper.js +72 -0
- package/node/internals/components/ChartsWrapper/index.js +16 -0
- package/node/internals/consumeSlots.js +109 -0
- package/node/internals/consumeThemeProps.js +18 -27
- package/node/internals/index.js +12 -0
- package/package.json +4 -4
- package/ChartsLegend/ChartsLegendItem.d.ts +0 -26
- package/ChartsLegend/ChartsLegendItem.js +0 -65
- package/ChartsLegend/DefaultChartsLegend.d.ts +0 -25
- package/ChartsLegend/DefaultChartsLegend.js +0 -112
- package/ChartsLegend/LegendPerItem.d.ts +0 -65
- package/ChartsLegend/LegendPerItem.js +0 -129
- package/ChartsLegend/legendItemsPlacement.d.ts +0 -3
- package/ChartsLegend/legendItemsPlacement.js +0 -72
- package/ChartsLegend/utils.d.ts +0 -2
- package/modern/ChartsLegend/ChartsLegendItem.js +0 -65
- package/modern/ChartsLegend/DefaultChartsLegend.js +0 -112
- package/modern/ChartsLegend/LegendPerItem.js +0 -129
- package/modern/ChartsLegend/legendItemsPlacement.js +0 -72
- package/node/ChartsLegend/ChartsLegendItem.js +0 -72
- package/node/ChartsLegend/DefaultChartsLegend.js +0 -118
- package/node/ChartsLegend/LegendPerItem.js +0 -137
- package/node/ChartsLegend/legendItemsPlacement.js +0 -79
|
@@ -51,6 +51,7 @@ function AnimatedArea(props) {
|
|
|
51
51
|
skipAnimation: skipAnimation,
|
|
52
52
|
id: `${ownerState.id}-area-clip`,
|
|
53
53
|
children: transitionChange((style, interpolator) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_web.animated.path, (0, _extends2.default)({
|
|
54
|
+
// @ts-expect-error
|
|
54
55
|
d: style.value.to(interpolator),
|
|
55
56
|
fill: ownerState.gradientId ? `url(#${ownerState.gradientId})` : ownerState.color,
|
|
56
57
|
filter:
|
|
@@ -51,6 +51,7 @@ function AnimatedLine(props) {
|
|
|
51
51
|
skipAnimation: skipAnimation,
|
|
52
52
|
id: `${ownerState.id}-line-clip`,
|
|
53
53
|
children: transitionChange((style, interpolator) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_web.animated.path, (0, _extends2.default)({
|
|
54
|
+
// @ts-expect-error
|
|
54
55
|
d: style.value.to(interpolator),
|
|
55
56
|
stroke: ownerState.gradientId ? `url(#${ownerState.gradientId})` : ownerState.color,
|
|
56
57
|
strokeWidth: 2,
|
|
@@ -35,6 +35,7 @@ function AppearingMask(props) {
|
|
|
35
35
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("clipPath", {
|
|
36
36
|
id: clipId,
|
|
37
37
|
children: transitionAppear(style => /*#__PURE__*/(0, _jsxRuntime.jsx)(_web.animated.rect, {
|
|
38
|
+
// @ts-expect-error
|
|
38
39
|
x: 0,
|
|
39
40
|
y: 0,
|
|
40
41
|
width: style.animatedWidth,
|
|
@@ -76,6 +76,7 @@ function CircleMarkElement(props) {
|
|
|
76
76
|
};
|
|
77
77
|
const classes = (0, _markElementClasses.useUtilityClasses)(ownerState);
|
|
78
78
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_web.animated.circle, (0, _extends2.default)({}, other, {
|
|
79
|
+
// @ts-expect-error
|
|
79
80
|
cx: position.x,
|
|
80
81
|
cy: position.y,
|
|
81
82
|
r: 5,
|
|
@@ -13,7 +13,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
13
13
|
var _styles = require("@mui/material/styles");
|
|
14
14
|
var _AreaPlot = require("./AreaPlot");
|
|
15
15
|
var _LinePlot = require("./LinePlot");
|
|
16
|
-
var _ChartContainer = require("../ChartContainer");
|
|
17
16
|
var _MarkPlot = require("./MarkPlot");
|
|
18
17
|
var _ChartsAxis = require("../ChartsAxis/ChartsAxis");
|
|
19
18
|
var _ChartsTooltip = require("../ChartsTooltip");
|
|
@@ -25,6 +24,10 @@ var _ChartsGrid = require("../ChartsGrid");
|
|
|
25
24
|
var _ChartsOnAxisClickHandler = require("../ChartsOnAxisClickHandler");
|
|
26
25
|
var _ChartsOverlay = require("../ChartsOverlay");
|
|
27
26
|
var _useLineChartProps = require("./useLineChartProps");
|
|
27
|
+
var _useChartContainerProps = require("../ChartContainer/useChartContainerProps");
|
|
28
|
+
var _context = require("../context");
|
|
29
|
+
var _ChartsSurface = require("../ChartsSurface");
|
|
30
|
+
var _ChartsWrapper = require("../internals/components/ChartsWrapper");
|
|
28
31
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
32
|
/**
|
|
30
33
|
* Demos:
|
|
@@ -42,6 +45,7 @@ const LineChart = exports.LineChart = /*#__PURE__*/React.forwardRef(function Lin
|
|
|
42
45
|
name: 'MuiLineChart'
|
|
43
46
|
});
|
|
44
47
|
const {
|
|
48
|
+
chartsWrapperProps,
|
|
45
49
|
chartContainerProps,
|
|
46
50
|
axisClickHandlerProps,
|
|
47
51
|
gridProps,
|
|
@@ -57,16 +61,22 @@ const LineChart = exports.LineChart = /*#__PURE__*/React.forwardRef(function Lin
|
|
|
57
61
|
legendProps,
|
|
58
62
|
children
|
|
59
63
|
} = (0, _useLineChartProps.useLineChartProps)(props);
|
|
64
|
+
const {
|
|
65
|
+
chartDataProviderProps,
|
|
66
|
+
chartsSurfaceProps
|
|
67
|
+
} = (0, _useChartContainerProps.useChartContainerProps)(chartContainerProps, ref);
|
|
60
68
|
const Tooltip = props.slots?.tooltip ?? _ChartsTooltip.ChartsTooltip;
|
|
61
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.ChartDataProvider, (0, _extends2.default)({}, chartDataProviderProps, {
|
|
70
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsWrapper.ChartsWrapper, (0, _extends2.default)({}, chartsWrapperProps, {
|
|
71
|
+
children: [!props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
|
|
72
|
+
children: [props.onAxisClick && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOnAxisClickHandler.ChartsOnAxisClickHandler, (0, _extends2.default)({}, axisClickHandlerProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", (0, _extends2.default)({}, clipPathGroupProps, {
|
|
73
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_AreaPlot.AreaPlot, (0, _extends2.default)({}, areaPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinePlot.LinePlot, (0, _extends2.default)({}, linePlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps))]
|
|
74
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
75
|
+
"data-drawing-container": true,
|
|
76
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_MarkPlot.MarkPlot, (0, _extends2.default)({}, markPlotProps))
|
|
77
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineHighlightPlot.LineHighlightPlot, (0, _extends2.default)({}, lineHighlightPlotProps)), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, props.slotProps?.tooltip)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, (0, _extends2.default)({}, clipPathProps)), children]
|
|
78
|
+
}))]
|
|
79
|
+
}))
|
|
70
80
|
}));
|
|
71
81
|
});
|
|
72
82
|
process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
@@ -87,7 +87,9 @@ function MarkElement(props) {
|
|
|
87
87
|
transform: (0, _web.to)([position.x, position.y], (pX, pY) => `translate(${pX}px, ${pY}px)`),
|
|
88
88
|
transformOrigin: (0, _web.to)([position.x, position.y], (pX, pY) => `${pX}px ${pY}px`)
|
|
89
89
|
},
|
|
90
|
-
ownerState: ownerState
|
|
90
|
+
ownerState: ownerState
|
|
91
|
+
// @ts-expect-error
|
|
92
|
+
,
|
|
91
93
|
className: classes.root,
|
|
92
94
|
d: (0, _d3Shape.symbol)(_d3Shape.symbolsFill[(0, _getSymbol.getSymbol)(shape)])(),
|
|
93
95
|
onClick: onClick,
|
package/node/LineChart/legend.js
CHANGED
|
@@ -10,6 +10,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
10
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
11
|
var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
12
12
|
var _constants = require("../constants");
|
|
13
|
+
var _calculateMargins = require("../internals/calculateMargins");
|
|
13
14
|
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "onAxisClick", "onAreaClick", "onLineClick", "onMarkClick", "axisHighlight", "disableLineItemHighlight", "hideLegend", "grid", "topAxis", "leftAxis", "rightAxis", "bottomAxis", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "className", "experimentalMarkRendering"];
|
|
14
15
|
/**
|
|
15
16
|
* A helper function that extracts LineChartProps from the input props
|
|
@@ -35,6 +36,7 @@ const useLineChartProps = props => {
|
|
|
35
36
|
onMarkClick,
|
|
36
37
|
axisHighlight,
|
|
37
38
|
disableLineItemHighlight,
|
|
39
|
+
hideLegend,
|
|
38
40
|
grid,
|
|
39
41
|
topAxis,
|
|
40
42
|
leftAxis,
|
|
@@ -60,7 +62,12 @@ const useLineChartProps = props => {
|
|
|
60
62
|
}, s)),
|
|
61
63
|
width,
|
|
62
64
|
height,
|
|
63
|
-
margin,
|
|
65
|
+
margin: (0, _calculateMargins.calculateMargins)({
|
|
66
|
+
margin,
|
|
67
|
+
hideLegend,
|
|
68
|
+
slotProps,
|
|
69
|
+
series
|
|
70
|
+
}),
|
|
64
71
|
colors,
|
|
65
72
|
dataset,
|
|
66
73
|
xAxis: xAxis ?? [{
|
|
@@ -71,7 +78,6 @@ const useLineChartProps = props => {
|
|
|
71
78
|
}, (_, index) => index)
|
|
72
79
|
}],
|
|
73
80
|
yAxis,
|
|
74
|
-
sx,
|
|
75
81
|
highlightedItem,
|
|
76
82
|
onHighlightChange,
|
|
77
83
|
disableAxisListener: slotProps?.tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
|
|
@@ -132,7 +138,13 @@ const useLineChartProps = props => {
|
|
|
132
138
|
slots,
|
|
133
139
|
slotProps
|
|
134
140
|
};
|
|
141
|
+
const chartsWrapperProps = {
|
|
142
|
+
sx,
|
|
143
|
+
legendPosition: props.slotProps?.legend?.position,
|
|
144
|
+
legendDirection: props.slotProps?.legend?.direction
|
|
145
|
+
};
|
|
135
146
|
return {
|
|
147
|
+
chartsWrapperProps,
|
|
136
148
|
chartContainerProps,
|
|
137
149
|
axisClickHandlerProps,
|
|
138
150
|
gridProps,
|
package/node/PieChart/PieArc.js
CHANGED
|
@@ -85,7 +85,9 @@ function PieArc(props) {
|
|
|
85
85
|
innerRadius: iR,
|
|
86
86
|
outerRadius: oR
|
|
87
87
|
})),
|
|
88
|
-
visibility: (0, _web.to)([startAngle, endAngle], (sA, eA) => sA === eA ? 'hidden' : 'visible')
|
|
88
|
+
visibility: (0, _web.to)([startAngle, endAngle], (sA, eA) => sA === eA ? 'hidden' : 'visible')
|
|
89
|
+
// @ts-expect-error
|
|
90
|
+
,
|
|
89
91
|
onClick: onClick,
|
|
90
92
|
cursor: onClick ? 'pointer' : 'unset',
|
|
91
93
|
ownerState: ownerState,
|
|
@@ -93,15 +93,19 @@ function PieArcLabel(props) {
|
|
|
93
93
|
isHighlighted
|
|
94
94
|
};
|
|
95
95
|
const classes = useUtilityClasses(ownerState);
|
|
96
|
-
return
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
96
|
+
return (
|
|
97
|
+
/*#__PURE__*/
|
|
98
|
+
// @ts-expect-error
|
|
99
|
+
(0, _jsxRuntime.jsx)(PieArcLabelRoot, (0, _extends2.default)({
|
|
100
|
+
className: classes.root
|
|
101
|
+
}, other, {
|
|
102
|
+
style: (0, _extends2.default)({
|
|
103
|
+
x: (0, _web.to)([startAngle, endAngle, paddingAngle, arcLabelRadius, cornerRadius], getLabelPosition(formattedArcLabel, 'x')),
|
|
104
|
+
y: (0, _web.to)([startAngle, endAngle, paddingAngle, arcLabelRadius, cornerRadius], getLabelPosition(formattedArcLabel, 'y'))
|
|
105
|
+
}, style),
|
|
106
|
+
children: formattedArcLabel
|
|
107
|
+
}))
|
|
108
|
+
);
|
|
105
109
|
}
|
|
106
110
|
process.env.NODE_ENV !== "production" ? PieArcLabel.propTypes = {
|
|
107
111
|
// ----------------------------- Warning --------------------------------
|
|
@@ -140,6 +140,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
140
140
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
141
141
|
index: _propTypes.default.number.isRequired,
|
|
142
142
|
label: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.string]),
|
|
143
|
+
labelMarkType: _propTypes.default.oneOf(['circle', 'line', 'square']),
|
|
143
144
|
padAngle: _propTypes.default.number.isRequired,
|
|
144
145
|
startAngle: _propTypes.default.number.isRequired,
|
|
145
146
|
value: _propTypes.default.number.isRequired
|
|
@@ -106,6 +106,7 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
106
106
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
107
107
|
index: _propTypes.default.number.isRequired,
|
|
108
108
|
label: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.string]),
|
|
109
|
+
labelMarkType: _propTypes.default.oneOf(['circle', 'line', 'square']),
|
|
109
110
|
padAngle: _propTypes.default.number.isRequired,
|
|
110
111
|
startAngle: _propTypes.default.number.isRequired,
|
|
111
112
|
value: _propTypes.default.number.isRequired
|
|
@@ -11,25 +11,21 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
11
11
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
-
var _RtlProvider = require("@mui/system/RtlProvider");
|
|
15
14
|
var _styles = require("@mui/material/styles");
|
|
16
|
-
var _ChartContainer = require("../ChartContainer");
|
|
17
15
|
var _ChartsTooltip = require("../ChartsTooltip");
|
|
18
16
|
var _ChartsLegend = require("../ChartsLegend");
|
|
19
17
|
var _PiePlot = require("./PiePlot");
|
|
20
18
|
var _ChartsOverlay = require("../ChartsOverlay");
|
|
19
|
+
var _ChartsSurface = require("../ChartsSurface");
|
|
20
|
+
var _context = require("../context");
|
|
21
|
+
var _useChartContainerProps = require("../ChartContainer/useChartContainerProps");
|
|
22
|
+
var _ChartsWrapper = require("../internals/components/ChartsWrapper");
|
|
21
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
24
|
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "sx", "skipAnimation", "hideLegend", "children", "slots", "slotProps", "onItemClick", "loading", "highlightedItem", "onHighlightChange", "className"];
|
|
23
25
|
const defaultMargin = {
|
|
24
26
|
top: 5,
|
|
25
27
|
bottom: 5,
|
|
26
28
|
left: 5,
|
|
27
|
-
right: 100
|
|
28
|
-
};
|
|
29
|
-
const defaultRTLMargin = {
|
|
30
|
-
top: 5,
|
|
31
|
-
bottom: 5,
|
|
32
|
-
left: 100,
|
|
33
29
|
right: 5
|
|
34
30
|
};
|
|
35
31
|
|
|
@@ -67,43 +63,48 @@ const PieChart = exports.PieChart = /*#__PURE__*/React.forwardRef(function PieCh
|
|
|
67
63
|
className
|
|
68
64
|
} = props,
|
|
69
65
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
const margin = (0, _extends2.default)({}, defaultMargin, marginProps);
|
|
67
|
+
const {
|
|
68
|
+
chartDataProviderProps,
|
|
69
|
+
chartsSurfaceProps
|
|
70
|
+
} = (0, _useChartContainerProps.useChartContainerProps)((0, _extends2.default)({}, other, {
|
|
75
71
|
series: series.map(s => (0, _extends2.default)({
|
|
76
72
|
type: 'pie'
|
|
77
73
|
}, s)),
|
|
78
|
-
width
|
|
79
|
-
height
|
|
80
|
-
margin
|
|
81
|
-
colors
|
|
82
|
-
sx: sx,
|
|
74
|
+
width,
|
|
75
|
+
height,
|
|
76
|
+
margin,
|
|
77
|
+
colors,
|
|
83
78
|
disableAxisListener: true,
|
|
84
|
-
highlightedItem
|
|
85
|
-
onHighlightChange
|
|
86
|
-
className
|
|
87
|
-
skipAnimation
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
79
|
+
highlightedItem,
|
|
80
|
+
onHighlightChange,
|
|
81
|
+
className,
|
|
82
|
+
skipAnimation
|
|
83
|
+
}), ref);
|
|
84
|
+
const Tooltip = slots?.tooltip ?? _ChartsTooltip.ChartsTooltip;
|
|
85
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.ChartDataProvider, (0, _extends2.default)({}, chartDataProviderProps, {
|
|
86
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsWrapper.ChartsWrapper, {
|
|
87
|
+
legendPosition: props.slotProps?.legend?.position,
|
|
88
|
+
legendDirection: props?.slotProps?.legend?.direction ?? 'vertical',
|
|
89
|
+
sx: sx,
|
|
90
|
+
children: [!hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, {
|
|
91
|
+
direction: props?.slotProps?.legend?.direction ?? 'vertical',
|
|
92
|
+
slots: slots,
|
|
93
|
+
slotProps: slotProps
|
|
94
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
|
|
95
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PiePlot.PiePlot, {
|
|
96
|
+
slots: slots,
|
|
97
|
+
slotProps: slotProps,
|
|
98
|
+
onItemClick: onItemClick
|
|
99
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, {
|
|
100
|
+
loading: loading,
|
|
101
|
+
slots: slots,
|
|
102
|
+
slotProps: slotProps
|
|
103
|
+
}), !loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({
|
|
104
|
+
trigger: "item"
|
|
105
|
+
}, slotProps?.tooltip)), children]
|
|
106
|
+
}))]
|
|
107
|
+
})
|
|
107
108
|
}));
|
|
108
109
|
});
|
|
109
110
|
process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
package/node/PieChart/legend.js
CHANGED
|
@@ -12,7 +12,6 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
var _styles = require("@mui/material/styles");
|
|
14
14
|
var _ScatterPlot = require("./ScatterPlot");
|
|
15
|
-
var _ChartContainer = require("../ChartContainer");
|
|
16
15
|
var _ChartsAxis = require("../ChartsAxis");
|
|
17
16
|
var _ChartsTooltip = require("../ChartsTooltip");
|
|
18
17
|
var _ChartsLegend = require("../ChartsLegend");
|
|
@@ -22,6 +21,10 @@ var _ChartsVoronoiHandler = require("../ChartsVoronoiHandler/ChartsVoronoiHandle
|
|
|
22
21
|
var _ChartsGrid = require("../ChartsGrid");
|
|
23
22
|
var _ZAxisContextProvider = require("../context/ZAxisContextProvider");
|
|
24
23
|
var _useScatterChartProps = require("./useScatterChartProps");
|
|
24
|
+
var _useChartContainerProps = require("../ChartContainer/useChartContainerProps");
|
|
25
|
+
var _context = require("../context");
|
|
26
|
+
var _ChartsSurface = require("../ChartsSurface");
|
|
27
|
+
var _ChartsWrapper = require("../internals/components/ChartsWrapper");
|
|
25
28
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
26
29
|
/**
|
|
27
30
|
* Demos:
|
|
@@ -39,6 +42,7 @@ const ScatterChart = exports.ScatterChart = /*#__PURE__*/React.forwardRef(functi
|
|
|
39
42
|
name: 'MuiScatterChart'
|
|
40
43
|
});
|
|
41
44
|
const {
|
|
45
|
+
chartsWrapperProps,
|
|
42
46
|
chartContainerProps,
|
|
43
47
|
zAxisProps,
|
|
44
48
|
voronoiHandlerProps,
|
|
@@ -50,17 +54,23 @@ const ScatterChart = exports.ScatterChart = /*#__PURE__*/React.forwardRef(functi
|
|
|
50
54
|
axisHighlightProps,
|
|
51
55
|
children
|
|
52
56
|
} = (0, _useScatterChartProps.useScatterChartProps)(props);
|
|
57
|
+
const {
|
|
58
|
+
chartDataProviderProps,
|
|
59
|
+
chartsSurfaceProps
|
|
60
|
+
} = (0, _useChartContainerProps.useChartContainerProps)(chartContainerProps, ref);
|
|
53
61
|
const Tooltip = props.slots?.tooltip ?? _ChartsTooltip.ChartsTooltip;
|
|
54
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.ChartDataProvider, (0, _extends2.default)({}, chartDataProviderProps, {
|
|
63
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsWrapper.ChartsWrapper, (0, _extends2.default)({}, chartsWrapperProps, {
|
|
64
|
+
children: [!props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
|
|
65
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ZAxisContextProvider.ZAxisContextProvider, (0, _extends2.default)({}, zAxisProps, {
|
|
66
|
+
children: [!props.disableVoronoi && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsVoronoiHandler.ChartsVoronoiHandler, (0, _extends2.default)({}, voronoiHandlerProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
67
|
+
"data-drawing-container": true,
|
|
68
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScatterPlot.ScatterPlot, (0, _extends2.default)({}, scatterPlotProps))
|
|
69
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps)), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({
|
|
70
|
+
trigger: "item"
|
|
71
|
+
}, props.slotProps?.tooltip)), children]
|
|
72
|
+
}))
|
|
73
|
+
}))]
|
|
64
74
|
}))
|
|
65
75
|
}));
|
|
66
76
|
});
|
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.useScatterChartProps = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
|
+
var _calculateMargins = require("../internals/calculateMargins");
|
|
11
12
|
const _excluded = ["xAxis", "yAxis", "zAxis", "series", "axisHighlight", "voronoiMaxRadius", "disableVoronoi", "hideLegend", "width", "height", "margin", "colors", "sx", "grid", "topAxis", "leftAxis", "rightAxis", "bottomAxis", "onItemClick", "children", "slots", "slotProps", "loading", "highlightedItem", "onHighlightChange", "className"];
|
|
12
13
|
/**
|
|
13
14
|
* A helper function that extracts ScatterChartProps from the input props
|
|
@@ -25,6 +26,7 @@ const useScatterChartProps = props => {
|
|
|
25
26
|
axisHighlight,
|
|
26
27
|
voronoiMaxRadius,
|
|
27
28
|
disableVoronoi,
|
|
29
|
+
hideLegend,
|
|
28
30
|
width,
|
|
29
31
|
height,
|
|
30
32
|
margin,
|
|
@@ -51,11 +53,15 @@ const useScatterChartProps = props => {
|
|
|
51
53
|
}, s)),
|
|
52
54
|
width,
|
|
53
55
|
height,
|
|
54
|
-
margin,
|
|
56
|
+
margin: (0, _calculateMargins.calculateMargins)({
|
|
57
|
+
margin,
|
|
58
|
+
hideLegend,
|
|
59
|
+
slotProps,
|
|
60
|
+
series
|
|
61
|
+
}),
|
|
55
62
|
colors,
|
|
56
63
|
xAxis,
|
|
57
64
|
yAxis,
|
|
58
|
-
sx,
|
|
59
65
|
highlightedItem,
|
|
60
66
|
onHighlightChange,
|
|
61
67
|
className
|
|
@@ -97,7 +103,13 @@ const useScatterChartProps = props => {
|
|
|
97
103
|
y: 'none',
|
|
98
104
|
x: 'none'
|
|
99
105
|
}, axisHighlight);
|
|
106
|
+
const chartsWrapperProps = {
|
|
107
|
+
sx,
|
|
108
|
+
legendPosition: props.slotProps?.legend?.position,
|
|
109
|
+
legendDirection: props.slotProps?.legend?.direction
|
|
110
|
+
};
|
|
100
111
|
return {
|
|
112
|
+
chartsWrapperProps,
|
|
101
113
|
chartContainerProps,
|
|
102
114
|
zAxisProps,
|
|
103
115
|
voronoiHandlerProps,
|
|
@@ -97,10 +97,7 @@ const SparkLineChart = exports.SparkLineChart = /*#__PURE__*/React.forwardRef(fu
|
|
|
97
97
|
children: [plotType === 'bar' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarChart.BarPlot, {
|
|
98
98
|
skipAnimation: true,
|
|
99
99
|
slots: slots,
|
|
100
|
-
slotProps: slotProps
|
|
101
|
-
sx: {
|
|
102
|
-
shapeRendering: 'auto'
|
|
103
|
-
}
|
|
100
|
+
slotProps: slotProps
|
|
104
101
|
}), plotType === 'line' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
105
102
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.AreaPlot, {
|
|
106
103
|
skipAnimation: true,
|
package/node/constants/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.DEFAULT_Y_AXIS_KEY = exports.DEFAULT_X_AXIS_KEY = exports.DEFAULT_MARGINS = void 0;
|
|
6
|
+
exports.DEFAULT_Y_AXIS_KEY = exports.DEFAULT_X_AXIS_KEY = exports.DEFAULT_MARGINS = exports.DEFAULT_LEGEND_FACING_MARGIN = void 0;
|
|
7
7
|
const DEFAULT_X_AXIS_KEY = exports.DEFAULT_X_AXIS_KEY = 'DEFAULT_X_AXIS_KEY';
|
|
8
8
|
const DEFAULT_Y_AXIS_KEY = exports.DEFAULT_Y_AXIS_KEY = 'DEFAULT_Y_AXIS_KEY';
|
|
9
9
|
const DEFAULT_MARGINS = exports.DEFAULT_MARGINS = {
|
|
@@ -11,4 +11,5 @@ const DEFAULT_MARGINS = exports.DEFAULT_MARGINS = {
|
|
|
11
11
|
bottom: 50,
|
|
12
12
|
left: 50,
|
|
13
13
|
right: 50
|
|
14
|
-
};
|
|
14
|
+
};
|
|
15
|
+
const DEFAULT_LEGEND_FACING_MARGIN = exports.DEFAULT_LEGEND_FACING_MARGIN = 20;
|
package/node/hooks/index.js
CHANGED
|
@@ -112,4 +112,16 @@ Object.keys(_useSvgRef).forEach(function (key) {
|
|
|
112
112
|
}
|
|
113
113
|
});
|
|
114
114
|
});
|
|
115
|
-
var _useSeries = require("./useSeries");
|
|
115
|
+
var _useSeries = require("./useSeries");
|
|
116
|
+
var _useLegend = require("./useLegend");
|
|
117
|
+
Object.keys(_useLegend).forEach(function (key) {
|
|
118
|
+
if (key === "default" || key === "__esModule") return;
|
|
119
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
120
|
+
if (key in exports && exports[key] === _useLegend[key]) return;
|
|
121
|
+
Object.defineProperty(exports, key, {
|
|
122
|
+
enumerable: true,
|
|
123
|
+
get: function () {
|
|
124
|
+
return _useLegend[key];
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
});
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
'use client';
|
|
2
3
|
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
|
-
exports.
|
|
8
|
+
exports.useLegend = useLegend;
|
|
8
9
|
var _legend = _interopRequireDefault(require("../BarChart/legend"));
|
|
9
10
|
var _legend2 = _interopRequireDefault(require("../ScatterChart/legend"));
|
|
10
11
|
var _legend3 = _interopRequireDefault(require("../LineChart/legend"));
|
|
11
12
|
var _legend4 = _interopRequireDefault(require("../PieChart/legend"));
|
|
13
|
+
var _useSeries = require("./useSeries");
|
|
12
14
|
const legendGetter = {
|
|
13
15
|
bar: _legend.default,
|
|
14
16
|
scatter: _legend2.default,
|
|
@@ -20,4 +22,20 @@ function getSeriesToDisplay(series) {
|
|
|
20
22
|
const getter = legendGetter[seriesType];
|
|
21
23
|
return getter === undefined ? [] : getter(series[seriesType]);
|
|
22
24
|
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Get the legend items to display.
|
|
29
|
+
*
|
|
30
|
+
* This hook is used by the `ChartsLegend` component. And will return the legend items formatted for display.
|
|
31
|
+
*
|
|
32
|
+
* An alternative is to use the `useSeries` hook and format the legend items yourself.
|
|
33
|
+
*
|
|
34
|
+
* @returns legend data
|
|
35
|
+
*/
|
|
36
|
+
function useLegend() {
|
|
37
|
+
const series = (0, _useSeries.useSeries)();
|
|
38
|
+
return {
|
|
39
|
+
items: getSeriesToDisplay(series)
|
|
40
|
+
};
|
|
23
41
|
}
|
package/node/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts v8.0.0-alpha.
|
|
2
|
+
* @mui/x-charts v8.0.0-alpha.7
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -153,6 +153,17 @@ Object.keys(_ChartsTooltip).forEach(function (key) {
|
|
|
153
153
|
}
|
|
154
154
|
});
|
|
155
155
|
});
|
|
156
|
+
var _ChartsLabel = require("./ChartsLabel");
|
|
157
|
+
Object.keys(_ChartsLabel).forEach(function (key) {
|
|
158
|
+
if (key === "default" || key === "__esModule") return;
|
|
159
|
+
if (key in exports && exports[key] === _ChartsLabel[key]) return;
|
|
160
|
+
Object.defineProperty(exports, key, {
|
|
161
|
+
enumerable: true,
|
|
162
|
+
get: function () {
|
|
163
|
+
return _ChartsLabel[key];
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
});
|
|
156
167
|
var _ChartsLegend = require("./ChartsLegend");
|
|
157
168
|
Object.keys(_ChartsLegend).forEach(function (key) {
|
|
158
169
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.calculateMargins = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _constants = require("../constants");
|
|
10
|
+
const calculateMargins = props => {
|
|
11
|
+
if (props.hideLegend || !props.series?.some(s => s.label)) {
|
|
12
|
+
return (0, _extends2.default)({}, _constants.DEFAULT_MARGINS, props.margin);
|
|
13
|
+
}
|
|
14
|
+
if (props.slotProps?.legend?.direction === 'vertical') {
|
|
15
|
+
if (props.slotProps?.legend?.position?.horizontal === 'left') {
|
|
16
|
+
return (0, _extends2.default)({}, _constants.DEFAULT_MARGINS, {
|
|
17
|
+
left: _constants.DEFAULT_LEGEND_FACING_MARGIN
|
|
18
|
+
}, props.margin);
|
|
19
|
+
}
|
|
20
|
+
return (0, _extends2.default)({}, _constants.DEFAULT_MARGINS, {
|
|
21
|
+
right: _constants.DEFAULT_LEGEND_FACING_MARGIN
|
|
22
|
+
}, props.margin);
|
|
23
|
+
}
|
|
24
|
+
if (props.slotProps?.legend?.position?.vertical === 'bottom') {
|
|
25
|
+
return (0, _extends2.default)({}, _constants.DEFAULT_MARGINS, {
|
|
26
|
+
bottom: _constants.DEFAULT_LEGEND_FACING_MARGIN
|
|
27
|
+
}, props.margin);
|
|
28
|
+
}
|
|
29
|
+
return (0, _extends2.default)({}, _constants.DEFAULT_MARGINS, {
|
|
30
|
+
top: _constants.DEFAULT_LEGEND_FACING_MARGIN
|
|
31
|
+
}, props.margin);
|
|
32
|
+
};
|
|
33
|
+
exports.calculateMargins = calculateMargins;
|