@mui/x-charts 6.0.0-alpha.9 → 6.18.1
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 +26 -5
- package/BarChart/BarChart.js +93 -17
- package/BarChart/BarElement.d.ts +1319 -4
- package/BarChart/BarElement.js +10 -10
- package/BarChart/BarPlot.d.ts +17 -1
- package/BarChart/BarPlot.js +152 -66
- package/BarChart/formatter.js +2 -3
- package/BarChart/legend.js +1 -2
- package/CHANGELOG.md +797 -59
- package/ChartContainer/index.js +7 -5
- package/ChartsAxis/ChartsAxis.d.ts +9 -0
- package/ChartsAxis/ChartsAxis.js +33 -7
- package/ChartsAxis/axisClasses.d.ts +3 -3
- package/ChartsAxis/axisClasses.js +1 -2
- package/ChartsAxisHighlight/ChartsAxisHighlight.d.ts +21 -0
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +61 -22
- package/ChartsClipPath/ChartsClipPath.d.ts +5 -0
- package/ChartsClipPath/ChartsClipPath.js +7 -2
- package/ChartsLegend/ChartsLegend.d.ts +45 -24
- package/ChartsLegend/ChartsLegend.js +193 -151
- package/ChartsLegend/chartsLegendClasses.d.ts +1 -1
- package/ChartsLegend/chartsLegendClasses.js +3 -4
- package/ChartsLegend/utils.d.ts +1 -6
- package/ChartsReferenceLine/ChartsReferenceLine.d.ts +10 -0
- package/ChartsReferenceLine/ChartsReferenceLine.js +78 -0
- package/ChartsReferenceLine/ChartsXReferenceLine.d.ts +13 -0
- package/ChartsReferenceLine/ChartsXReferenceLine.js +112 -0
- package/ChartsReferenceLine/ChartsYReferenceLine.d.ts +13 -0
- package/ChartsReferenceLine/ChartsYReferenceLine.js +112 -0
- package/ChartsReferenceLine/chartsReferenceLineClasses.d.ts +15 -0
- package/ChartsReferenceLine/chartsReferenceLineClasses.js +14 -0
- package/ChartsReferenceLine/common.d.ts +41 -0
- package/ChartsReferenceLine/common.js +27 -0
- package/ChartsReferenceLine/index.d.ts +2 -0
- package/ChartsReferenceLine/index.js +27 -0
- package/ChartsReferenceLine/package.json +6 -0
- package/ChartsSurface.d.ts +12 -1
- package/ChartsSurface.js +9 -18
- package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +1 -0
- package/ChartsTooltip/ChartsAxisTooltipContent.js +46 -32
- package/ChartsTooltip/ChartsItemTooltipContent.d.ts +3 -2
- package/ChartsTooltip/ChartsItemTooltipContent.js +18 -9
- package/ChartsTooltip/ChartsTooltip.d.ts +32 -0
- package/ChartsTooltip/ChartsTooltip.js +62 -18
- package/ChartsTooltip/ChartsTooltipTable.d.ts +3 -10
- package/ChartsTooltip/ChartsTooltipTable.js +22 -20
- package/ChartsTooltip/tooltipClasses.js +1 -2
- package/ChartsTooltip/utils.js +2 -2
- package/ChartsXAxis/ChartsXAxis.d.ts +9 -0
- package/ChartsXAxis/ChartsXAxis.js +170 -45
- package/ChartsYAxis/ChartsYAxis.d.ts +9 -0
- package/ChartsYAxis/ChartsYAxis.js +95 -38
- package/LineChart/AreaElement.d.ts +11 -1
- package/LineChart/AreaElement.js +14 -6
- package/LineChart/AreaPlot.d.ts +11 -0
- package/LineChart/AreaPlot.js +27 -8
- package/LineChart/LineChart.d.ts +23 -3
- package/LineChart/LineChart.js +89 -17
- package/LineChart/LineElement.d.ts +11 -1
- package/LineChart/LineElement.js +14 -6
- package/LineChart/LineHighlightElement.d.ts +10 -0
- package/LineChart/LineHighlightElement.js +13 -4
- package/LineChart/LineHighlightPlot.d.ts +10 -0
- package/LineChart/LineHighlightPlot.js +15 -4
- package/LineChart/LinePlot.d.ts +10 -0
- package/LineChart/LinePlot.js +25 -12
- package/LineChart/MarkElement.d.ts +10 -0
- package/LineChart/MarkElement.js +14 -5
- package/LineChart/MarkPlot.d.ts +10 -0
- package/LineChart/MarkPlot.js +42 -10
- package/LineChart/formatter.js +5 -5
- package/LineChart/legend.js +1 -2
- package/PieChart/PieArc.d.ts +11 -13
- package/PieChart/PieArc.js +28 -60
- package/PieChart/PieArcLabel.d.ts +8 -9
- package/PieChart/PieArcLabel.js +46 -38
- package/PieChart/PieArcLabelPlot.d.ts +28 -0
- package/PieChart/PieArcLabelPlot.js +99 -0
- package/PieChart/PieArcPlot.d.ts +35 -0
- package/PieChart/PieArcPlot.js +92 -0
- package/PieChart/PieChart.d.ts +19 -5
- package/PieChart/PieChart.js +95 -18
- package/PieChart/PiePlot.d.ts +15 -9
- package/PieChart/PiePlot.js +77 -55
- package/PieChart/dataTransform/transition.d.ts +4 -0
- package/PieChart/dataTransform/transition.js +136 -0
- package/PieChart/dataTransform/useTransformData.d.ts +15 -0
- package/PieChart/dataTransform/useTransformData.js +67 -0
- package/PieChart/formatter.js +1 -2
- package/PieChart/legend.js +1 -2
- package/README.md +8 -14
- package/ResponsiveChartContainer/index.d.ts +13 -3
- package/ResponsiveChartContainer/index.js +7 -8
- package/ScatterChart/Scatter.d.ts +10 -0
- package/ScatterChart/Scatter.js +12 -2
- package/ScatterChart/ScatterChart.d.ts +16 -3
- package/ScatterChart/ScatterChart.js +77 -16
- package/ScatterChart/ScatterPlot.d.ts +10 -0
- package/ScatterChart/ScatterPlot.js +12 -2
- package/ScatterChart/formatter.js +1 -2
- package/ScatterChart/legend.js +1 -2
- package/SparkLineChart/SparkLineChart.d.ts +12 -3
- package/SparkLineChart/SparkLineChart.js +50 -7
- package/colorPalettes/colorPalettes.js +6 -12
- package/constants.js +5 -8
- package/context/CartesianContextProvider.d.ts +26 -1
- package/context/CartesianContextProvider.js +42 -16
- package/context/DrawingProvider.d.ts +25 -0
- package/context/DrawingProvider.js +18 -6
- package/context/HighlightProvider.d.ts +17 -0
- package/context/HighlightProvider.js +3 -4
- package/context/InteractionProvider.d.ts +6 -0
- package/context/InteractionProvider.js +3 -4
- package/context/SeriesContextProvider.d.ts +5 -0
- package/context/SeriesContextProvider.js +3 -4
- package/esm/BarChart/BarChart.js +90 -13
- package/esm/BarChart/BarElement.js +7 -4
- package/esm/BarChart/BarPlot.js +152 -67
- package/esm/BarChart/formatter.js +1 -1
- package/esm/ChartContainer/index.js +3 -0
- package/esm/ChartsAxis/ChartsAxis.js +32 -5
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +57 -20
- package/esm/ChartsClipPath/ChartsClipPath.js +5 -0
- package/esm/ChartsLegend/ChartsLegend.js +190 -144
- package/esm/ChartsLegend/chartsLegendClasses.js +1 -1
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +105 -0
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +105 -0
- package/esm/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
- package/esm/ChartsReferenceLine/common.js +20 -0
- package/esm/ChartsReferenceLine/index.js +2 -0
- package/esm/ChartsSurface.js +4 -12
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +44 -30
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +15 -7
- package/esm/ChartsTooltip/ChartsTooltip.js +59 -14
- package/esm/ChartsTooltip/ChartsTooltipTable.js +17 -10
- package/esm/ChartsXAxis/ChartsXAxis.js +168 -43
- package/esm/ChartsYAxis/ChartsYAxis.js +93 -36
- package/esm/LineChart/AreaElement.js +10 -0
- package/esm/LineChart/AreaPlot.js +26 -6
- package/esm/LineChart/LineChart.js +86 -13
- package/esm/LineChart/LineElement.js +10 -0
- package/esm/LineChart/LineHighlightElement.js +10 -0
- package/esm/LineChart/LineHighlightPlot.js +13 -2
- package/esm/LineChart/LinePlot.js +25 -14
- package/esm/LineChart/MarkElement.js +11 -1
- package/esm/LineChart/MarkPlot.js +40 -8
- package/esm/LineChart/formatter.js +7 -3
- package/esm/PieChart/PieArc.js +26 -58
- package/esm/PieChart/PieArcLabel.js +43 -34
- package/esm/PieChart/PieArcLabelPlot.js +92 -0
- package/esm/PieChart/PieArcPlot.js +84 -0
- package/esm/PieChart/PieChart.js +93 -16
- package/esm/PieChart/PiePlot.js +76 -57
- package/esm/PieChart/dataTransform/transition.js +130 -0
- package/esm/PieChart/dataTransform/useTransformData.js +59 -0
- package/esm/ResponsiveChartContainer/index.js +3 -3
- package/esm/ScatterChart/Scatter.js +10 -0
- package/esm/ScatterChart/ScatterChart.js +74 -12
- package/esm/ScatterChart/ScatterPlot.js +10 -0
- package/esm/SparkLineChart/SparkLineChart.js +47 -3
- package/esm/constants.js +1 -1
- package/esm/context/CartesianContextProvider.js +41 -14
- package/esm/context/DrawingProvider.js +14 -0
- package/esm/hooks/useChartDimensions.js +2 -0
- package/esm/hooks/useMounted.js +16 -0
- package/esm/hooks/useReducedMotion.js +27 -0
- package/esm/hooks/useTicks.js +15 -9
- package/esm/index.js +1 -0
- package/esm/internals/components/AxisSharedComponents.js +15 -70
- package/esm/internals/components/ChartsText.js +77 -0
- package/esm/internals/domUtils.js +113 -0
- package/esm/internals/geometry.js +36 -0
- package/hooks/useAxisEvents.js +2 -2
- package/hooks/useChartDimensions.d.ts +2 -0
- package/hooks/useChartDimensions.js +5 -4
- package/hooks/useDrawingArea.js +2 -2
- package/hooks/useInteractionItemProps.js +2 -2
- package/hooks/useMounted.d.ts +1 -0
- package/hooks/useMounted.js +25 -0
- package/hooks/useReducedMotion.d.ts +8 -0
- package/hooks/useReducedMotion.js +33 -0
- package/hooks/useScale.d.ts +2 -2
- package/hooks/useScale.js +2 -2
- package/hooks/useTicks.d.ts +19 -11
- package/hooks/useTicks.js +19 -14
- package/index.d.ts +1 -0
- package/index.js +12 -1
- package/internals/components/AxisSharedComponents.d.ts +0 -4
- package/internals/components/AxisSharedComponents.js +18 -78
- package/internals/components/ChartsText.d.ts +35 -0
- package/internals/components/ChartsText.js +87 -0
- package/internals/defaultizeColor.d.ts +7 -2
- package/internals/defaultizeValueFormatter.js +1 -2
- package/internals/domUtils.d.ts +13 -0
- package/internals/domUtils.js +122 -0
- package/internals/geometry.d.ts +9 -0
- package/internals/geometry.js +42 -0
- package/internals/isBandScale.d.ts +3 -1
- package/internals/stackSeries.js +2 -4
- package/internals/utils.d.ts +5 -0
- package/legacy/BarChart/BarChart.js +90 -13
- package/legacy/BarChart/BarElement.js +6 -3
- package/legacy/BarChart/BarPlot.js +151 -63
- package/legacy/BarChart/formatter.js +1 -1
- package/legacy/ChartContainer/index.js +3 -0
- package/legacy/ChartsAxis/ChartsAxis.js +32 -5
- package/legacy/ChartsAxisHighlight/ChartsAxisHighlight.js +60 -20
- package/legacy/ChartsClipPath/ChartsClipPath.js +5 -0
- package/legacy/ChartsLegend/ChartsLegend.js +205 -142
- package/legacy/ChartsLegend/chartsLegendClasses.js +1 -1
- package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
- package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +105 -0
- package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +105 -0
- package/legacy/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
- package/legacy/ChartsReferenceLine/common.js +20 -0
- package/legacy/ChartsReferenceLine/index.js +2 -0
- package/legacy/ChartsSurface.js +3 -12
- package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +22 -10
- package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +15 -7
- package/legacy/ChartsTooltip/ChartsTooltip.js +62 -14
- package/legacy/ChartsTooltip/ChartsTooltipTable.js +34 -26
- package/legacy/ChartsXAxis/ChartsXAxis.js +176 -50
- package/legacy/ChartsYAxis/ChartsYAxis.js +97 -41
- package/legacy/LineChart/AreaElement.js +10 -0
- package/legacy/LineChart/AreaPlot.js +31 -7
- package/legacy/LineChart/LineChart.js +86 -13
- package/legacy/LineChart/LineElement.js +10 -0
- package/legacy/LineChart/LineHighlightElement.js +10 -0
- package/legacy/LineChart/LineHighlightPlot.js +13 -2
- package/legacy/LineChart/LinePlot.js +29 -12
- package/legacy/LineChart/MarkElement.js +11 -1
- package/legacy/LineChart/MarkPlot.js +39 -8
- package/legacy/LineChart/formatter.js +7 -3
- package/legacy/PieChart/PieArc.js +30 -62
- package/legacy/PieChart/PieArcLabel.js +48 -34
- package/legacy/PieChart/PieArcLabelPlot.js +93 -0
- package/legacy/PieChart/PieArcPlot.js +84 -0
- package/legacy/PieChart/PieChart.js +93 -16
- package/legacy/PieChart/PiePlot.js +76 -59
- package/legacy/PieChart/dataTransform/transition.js +142 -0
- package/legacy/PieChart/dataTransform/useTransformData.js +60 -0
- package/legacy/ResponsiveChartContainer/index.js +3 -3
- package/legacy/ScatterChart/Scatter.js +10 -0
- package/legacy/ScatterChart/ScatterChart.js +74 -12
- package/legacy/ScatterChart/ScatterPlot.js +10 -0
- package/legacy/SparkLineChart/SparkLineChart.js +47 -3
- package/legacy/constants.js +1 -1
- package/legacy/context/CartesianContextProvider.js +41 -14
- package/legacy/context/DrawingProvider.js +14 -0
- package/legacy/hooks/useChartDimensions.js +2 -0
- package/legacy/hooks/useMounted.js +21 -0
- package/legacy/hooks/useReducedMotion.js +27 -0
- package/legacy/hooks/useTicks.js +16 -9
- package/legacy/index.js +2 -1
- package/legacy/internals/components/AxisSharedComponents.js +11 -65
- package/legacy/internals/components/ChartsText.js +79 -0
- package/legacy/internals/domUtils.js +121 -0
- package/legacy/internals/geometry.js +37 -0
- package/models/axis.d.ts +58 -20
- package/models/layout.d.ts +13 -6
- package/models/seriesType/common.d.ts +16 -0
- package/models/seriesType/line.d.ts +8 -3
- package/models/seriesType/pie.d.ts +5 -1
- package/modern/BarChart/BarChart.js +90 -13
- package/modern/BarChart/BarElement.js +7 -4
- package/modern/BarChart/BarPlot.js +149 -65
- package/modern/BarChart/formatter.js +1 -1
- package/modern/ChartContainer/index.js +3 -0
- package/modern/ChartsAxis/ChartsAxis.js +31 -5
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +57 -20
- package/modern/ChartsClipPath/ChartsClipPath.js +5 -0
- package/modern/ChartsLegend/ChartsLegend.js +190 -144
- package/modern/ChartsLegend/chartsLegendClasses.js +1 -1
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
- package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +104 -0
- package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +104 -0
- package/modern/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
- package/modern/ChartsReferenceLine/common.js +20 -0
- package/modern/ChartsReferenceLine/index.js +2 -0
- package/modern/ChartsSurface.js +4 -12
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +44 -30
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +15 -7
- package/modern/ChartsTooltip/ChartsTooltip.js +58 -14
- package/modern/ChartsTooltip/ChartsTooltipTable.js +17 -10
- package/modern/ChartsXAxis/ChartsXAxis.js +167 -42
- package/modern/ChartsYAxis/ChartsYAxis.js +92 -35
- package/modern/LineChart/AreaElement.js +10 -0
- package/modern/LineChart/AreaPlot.js +25 -6
- package/modern/LineChart/LineChart.js +86 -13
- package/modern/LineChart/LineElement.js +10 -0
- package/modern/LineChart/LineHighlightElement.js +10 -0
- package/modern/LineChart/LineHighlightPlot.js +13 -2
- package/modern/LineChart/LinePlot.js +23 -10
- package/modern/LineChart/MarkElement.js +11 -1
- package/modern/LineChart/MarkPlot.js +40 -8
- package/modern/LineChart/formatter.js +4 -3
- package/modern/PieChart/PieArc.js +26 -57
- package/modern/PieChart/PieArcLabel.js +43 -34
- package/modern/PieChart/PieArcLabelPlot.js +90 -0
- package/modern/PieChart/PieArcPlot.js +83 -0
- package/modern/PieChart/PieChart.js +93 -16
- package/modern/PieChart/PiePlot.js +76 -55
- package/modern/PieChart/dataTransform/transition.js +130 -0
- package/modern/PieChart/dataTransform/useTransformData.js +58 -0
- package/modern/ResponsiveChartContainer/index.js +3 -3
- package/modern/ScatterChart/Scatter.js +10 -0
- package/modern/ScatterChart/ScatterChart.js +74 -12
- package/modern/ScatterChart/ScatterPlot.js +10 -0
- package/modern/SparkLineChart/SparkLineChart.js +47 -3
- package/modern/constants.js +1 -1
- package/modern/context/CartesianContextProvider.js +40 -13
- package/modern/context/DrawingProvider.js +14 -0
- package/modern/hooks/useChartDimensions.js +2 -0
- package/modern/hooks/useMounted.js +16 -0
- package/modern/hooks/useReducedMotion.js +27 -0
- package/modern/hooks/useTicks.js +15 -9
- package/modern/index.js +2 -1
- package/modern/internals/components/AxisSharedComponents.js +15 -70
- package/modern/internals/components/ChartsText.js +77 -0
- package/modern/internals/domUtils.js +113 -0
- package/modern/internals/geometry.js +36 -0
- package/package.json +9 -6
- package/themeAugmentation/components.d.ts +1 -0
- package/themeAugmentation/overrides.d.ts +2 -0
package/LineChart/AreaPlot.js
CHANGED
|
@@ -17,8 +17,19 @@ var _useScale = require("../hooks/useScale");
|
|
|
17
17
|
var _getCurve = _interopRequireDefault(require("../internals/getCurve"));
|
|
18
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
19
|
const _excluded = ["slots", "slotProps"];
|
|
20
|
-
function _getRequireWildcardCache(
|
|
21
|
-
function _interopRequireWildcard(
|
|
20
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
21
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
|
+
/**
|
|
23
|
+
* Demos:
|
|
24
|
+
*
|
|
25
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
26
|
+
* - [Areas demonstration](https://mui.com/x/react-charts/areas-demo/)
|
|
27
|
+
* - [Stacking](https://mui.com/x/react-charts/stacking/)
|
|
28
|
+
*
|
|
29
|
+
* API:
|
|
30
|
+
*
|
|
31
|
+
* - [AreaPlot API](https://mui.com/x/api/charts/area-plot/)
|
|
32
|
+
*/
|
|
22
33
|
function AreaPlot(props) {
|
|
23
34
|
const {
|
|
24
35
|
slots,
|
|
@@ -50,20 +61,28 @@ function AreaPlot(props) {
|
|
|
50
61
|
const {
|
|
51
62
|
xAxisKey = defaultXAxisId,
|
|
52
63
|
yAxisKey = defaultYAxisId,
|
|
53
|
-
stackedData
|
|
64
|
+
stackedData,
|
|
65
|
+
data,
|
|
66
|
+
connectNulls
|
|
54
67
|
} = series[seriesId];
|
|
55
68
|
const xScale = (0, _useScale.getValueToPositionMapper)(xAxis[xAxisKey].scale);
|
|
56
69
|
const yScale = yAxis[yAxisKey].scale;
|
|
57
70
|
const xData = xAxis[xAxisKey].data;
|
|
58
|
-
if (
|
|
59
|
-
|
|
71
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
72
|
+
if (xData === undefined) {
|
|
73
|
+
throw new Error(`Axis of id "${xAxisKey}" should have data property to be able to display a line plot.`);
|
|
74
|
+
}
|
|
75
|
+
if (xData.length < stackedData.length) {
|
|
76
|
+
throw new Error(`MUI: data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items)`);
|
|
77
|
+
}
|
|
60
78
|
}
|
|
61
|
-
const areaPath = (0, _d3Shape.area)().x(d => xScale(d.x)).y0(d => yScale(d.y[0])).y1(d => yScale(d.y[1]));
|
|
79
|
+
const areaPath = (0, _d3Shape.area)().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y0(d => d.y && yScale(d.y[0])).y1(d => d.y && yScale(d.y[1]));
|
|
62
80
|
const curve = (0, _getCurve.default)(series[seriesId].curve);
|
|
63
|
-
const
|
|
81
|
+
const formattedData = xData?.map((x, index) => ({
|
|
64
82
|
x,
|
|
65
83
|
y: stackedData[index]
|
|
66
|
-
}));
|
|
84
|
+
})) ?? [];
|
|
85
|
+
const d3Data = connectNulls ? formattedData.filter((_, i) => data[i] != null) : formattedData;
|
|
67
86
|
return !!series[seriesId].area && /*#__PURE__*/(0, _jsxRuntime.jsx)(_AreaElement.AreaElement, {
|
|
68
87
|
id: seriesId,
|
|
69
88
|
d: areaPath.curve(curve)(d3Data) || undefined,
|
package/LineChart/LineChart.d.ts
CHANGED
|
@@ -6,19 +6,29 @@ import { MarkPlotSlotComponentProps, MarkPlotSlotsComponent } from './MarkPlot';
|
|
|
6
6
|
import { ChartsAxisProps } from '../ChartsAxis/ChartsAxis';
|
|
7
7
|
import { LineSeriesType } from '../models/seriesType/line';
|
|
8
8
|
import { MakeOptional } from '../models/helpers';
|
|
9
|
-
import { ChartsTooltipProps } from '../ChartsTooltip';
|
|
9
|
+
import { ChartsTooltipProps, ChartsTooltipSlotComponentProps, ChartsTooltipSlotsComponent } from '../ChartsTooltip';
|
|
10
10
|
import { ChartsLegendProps, ChartsLegendSlotComponentProps, ChartsLegendSlotsComponent } from '../ChartsLegend';
|
|
11
11
|
import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
|
|
12
12
|
import { ChartsAxisSlotComponentProps, ChartsAxisSlotsComponent } from '../models/axis';
|
|
13
13
|
import { LineHighlightPlotSlotsComponent, LineHighlightPlotSlotComponentProps } from './LineHighlightPlot';
|
|
14
|
-
export interface LineChartSlotsComponent extends ChartsAxisSlotsComponent, AreaPlotSlotsComponent, LinePlotSlotsComponent, MarkPlotSlotsComponent, LineHighlightPlotSlotsComponent, ChartsLegendSlotsComponent {
|
|
14
|
+
export interface LineChartSlotsComponent extends ChartsAxisSlotsComponent, AreaPlotSlotsComponent, LinePlotSlotsComponent, MarkPlotSlotsComponent, LineHighlightPlotSlotsComponent, ChartsLegendSlotsComponent, ChartsTooltipSlotsComponent {
|
|
15
15
|
}
|
|
16
|
-
export interface LineChartSlotComponentProps extends ChartsAxisSlotComponentProps, AreaPlotSlotComponentProps, LinePlotSlotComponentProps, MarkPlotSlotComponentProps, LineHighlightPlotSlotComponentProps, ChartsLegendSlotComponentProps {
|
|
16
|
+
export interface LineChartSlotComponentProps extends ChartsAxisSlotComponentProps, AreaPlotSlotComponentProps, LinePlotSlotComponentProps, MarkPlotSlotComponentProps, LineHighlightPlotSlotComponentProps, ChartsLegendSlotComponentProps, ChartsTooltipSlotComponentProps {
|
|
17
17
|
}
|
|
18
18
|
export interface LineChartProps extends Omit<ResponsiveChartContainerProps, 'series'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'> {
|
|
19
19
|
series: MakeOptional<LineSeriesType, 'type'>[];
|
|
20
20
|
tooltip?: ChartsTooltipProps;
|
|
21
|
+
/**
|
|
22
|
+
* Object `{ x, y }` that defines how the charts highlight the mouse position along the x- and y-axes.
|
|
23
|
+
* The two properties accept the following values:
|
|
24
|
+
* - 'none': display nothing.
|
|
25
|
+
* - 'line': display a line at the current mouse position.
|
|
26
|
+
* - 'band': display a band at the current mouse position. Only available with band scale.
|
|
27
|
+
*/
|
|
21
28
|
axisHighlight?: ChartsAxisHighlightProps;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated Consider using `slotProps.legend` instead.
|
|
31
|
+
*/
|
|
22
32
|
legend?: ChartsLegendProps;
|
|
23
33
|
/**
|
|
24
34
|
* If `true`, render the line highlight item.
|
|
@@ -35,5 +45,15 @@ export interface LineChartProps extends Omit<ResponsiveChartContainerProps, 'ser
|
|
|
35
45
|
*/
|
|
36
46
|
slotProps?: LineChartSlotComponentProps;
|
|
37
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Demos:
|
|
50
|
+
*
|
|
51
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
52
|
+
* - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
|
|
53
|
+
*
|
|
54
|
+
* API:
|
|
55
|
+
*
|
|
56
|
+
* - [LineChart API](https://mui.com/x/api/charts/line-chart/)
|
|
57
|
+
*/
|
|
38
58
|
declare const LineChart: React.ForwardRefExoticComponent<LineChartProps & React.RefAttributes<unknown>>;
|
|
39
59
|
export { LineChart };
|
package/LineChart/LineChart.js
CHANGED
|
@@ -21,9 +21,19 @@ var _ChartsAxisHighlight = require("../ChartsAxisHighlight");
|
|
|
21
21
|
var _ChartsClipPath = require("../ChartsClipPath");
|
|
22
22
|
var _LineHighlightPlot = require("./LineHighlightPlot");
|
|
23
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
|
-
function _getRequireWildcardCache(
|
|
25
|
-
function _interopRequireWildcard(
|
|
26
|
-
|
|
24
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
25
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
26
|
+
/**
|
|
27
|
+
* Demos:
|
|
28
|
+
*
|
|
29
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
30
|
+
* - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
|
|
31
|
+
*
|
|
32
|
+
* API:
|
|
33
|
+
*
|
|
34
|
+
* - [LineChart API](https://mui.com/x/api/charts/line-chart/)
|
|
35
|
+
*/
|
|
36
|
+
const LineChart = exports.LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
|
|
27
37
|
const {
|
|
28
38
|
xAxis,
|
|
29
39
|
yAxis,
|
|
@@ -96,17 +106,26 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
|
|
|
96
106
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legend, {
|
|
97
107
|
slots: slots,
|
|
98
108
|
slotProps: slotProps
|
|
99
|
-
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltip
|
|
109
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltip, {
|
|
110
|
+
slots: slots,
|
|
111
|
+
slotProps: slotProps
|
|
112
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, {
|
|
100
113
|
id: clipPathId
|
|
101
114
|
}), children]
|
|
102
115
|
});
|
|
103
116
|
});
|
|
104
|
-
exports.LineChart = LineChart;
|
|
105
117
|
process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
106
118
|
// ----------------------------- Warning --------------------------------
|
|
107
119
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
108
120
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
109
121
|
// ----------------------------------------------------------------------
|
|
122
|
+
/**
|
|
123
|
+
* Object `{ x, y }` that defines how the charts highlight the mouse position along the x- and y-axes.
|
|
124
|
+
* The two properties accept the following values:
|
|
125
|
+
* - 'none': display nothing.
|
|
126
|
+
* - 'line': display a line at the current mouse position.
|
|
127
|
+
* - 'band': display a band at the current mouse position. Only available with band scale.
|
|
128
|
+
*/
|
|
110
129
|
axisHighlight: _propTypes.default.shape({
|
|
111
130
|
x: _propTypes.default.oneOf(['band', 'line', 'none']),
|
|
112
131
|
y: _propTypes.default.oneOf(['band', 'line', 'none'])
|
|
@@ -117,18 +136,22 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
117
136
|
* @default xAxisIds[0] The id of the first provided axis
|
|
118
137
|
*/
|
|
119
138
|
bottomAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
120
|
-
axisId: _propTypes.default.string
|
|
139
|
+
axisId: _propTypes.default.string,
|
|
121
140
|
classes: _propTypes.default.object,
|
|
122
141
|
disableLine: _propTypes.default.bool,
|
|
123
142
|
disableTicks: _propTypes.default.bool,
|
|
124
143
|
fill: _propTypes.default.string,
|
|
125
144
|
label: _propTypes.default.string,
|
|
126
145
|
labelFontSize: _propTypes.default.number,
|
|
146
|
+
labelStyle: _propTypes.default.object,
|
|
127
147
|
position: _propTypes.default.oneOf(['bottom', 'top']),
|
|
128
148
|
slotProps: _propTypes.default.object,
|
|
129
149
|
slots: _propTypes.default.object,
|
|
130
150
|
stroke: _propTypes.default.string,
|
|
131
151
|
tickFontSize: _propTypes.default.number,
|
|
152
|
+
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
153
|
+
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
154
|
+
tickLabelStyle: _propTypes.default.object,
|
|
132
155
|
tickMaxStep: _propTypes.default.number,
|
|
133
156
|
tickMinStep: _propTypes.default.number,
|
|
134
157
|
tickNumber: _propTypes.default.number,
|
|
@@ -140,13 +163,25 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
140
163
|
* Color palette used to colorize multiple series.
|
|
141
164
|
*/
|
|
142
165
|
colors: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.func]),
|
|
166
|
+
/**
|
|
167
|
+
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
168
|
+
*/
|
|
143
169
|
dataset: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
144
170
|
desc: _propTypes.default.string,
|
|
171
|
+
/**
|
|
172
|
+
* If `true`, the charts will not listen to the mouse move event.
|
|
173
|
+
* It might break interactive features, but will improve performance.
|
|
174
|
+
* @default false
|
|
175
|
+
*/
|
|
145
176
|
disableAxisListener: _propTypes.default.bool,
|
|
146
177
|
/**
|
|
147
178
|
* If `true`, render the line highlight item.
|
|
148
179
|
*/
|
|
149
180
|
disableLineItemHighlight: _propTypes.default.bool,
|
|
181
|
+
/**
|
|
182
|
+
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
183
|
+
* @default undefined
|
|
184
|
+
*/
|
|
150
185
|
height: _propTypes.default.number,
|
|
151
186
|
/**
|
|
152
187
|
* Indicate which axis to display the left of the charts.
|
|
@@ -154,41 +189,47 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
154
189
|
* @default yAxisIds[0] The id of the first provided axis
|
|
155
190
|
*/
|
|
156
191
|
leftAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
157
|
-
axisId: _propTypes.default.string
|
|
192
|
+
axisId: _propTypes.default.string,
|
|
158
193
|
classes: _propTypes.default.object,
|
|
159
194
|
disableLine: _propTypes.default.bool,
|
|
160
195
|
disableTicks: _propTypes.default.bool,
|
|
161
196
|
fill: _propTypes.default.string,
|
|
162
197
|
label: _propTypes.default.string,
|
|
163
198
|
labelFontSize: _propTypes.default.number,
|
|
199
|
+
labelStyle: _propTypes.default.object,
|
|
164
200
|
position: _propTypes.default.oneOf(['left', 'right']),
|
|
165
201
|
slotProps: _propTypes.default.object,
|
|
166
202
|
slots: _propTypes.default.object,
|
|
167
203
|
stroke: _propTypes.default.string,
|
|
168
204
|
tickFontSize: _propTypes.default.number,
|
|
205
|
+
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
206
|
+
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
207
|
+
tickLabelStyle: _propTypes.default.object,
|
|
169
208
|
tickMaxStep: _propTypes.default.number,
|
|
170
209
|
tickMinStep: _propTypes.default.number,
|
|
171
210
|
tickNumber: _propTypes.default.number,
|
|
172
211
|
tickSize: _propTypes.default.number
|
|
173
212
|
}), _propTypes.default.string]),
|
|
213
|
+
/**
|
|
214
|
+
* @deprecated Consider using `slotProps.legend` instead.
|
|
215
|
+
*/
|
|
174
216
|
legend: _propTypes.default.shape({
|
|
175
217
|
classes: _propTypes.default.object,
|
|
176
218
|
direction: _propTypes.default.oneOf(['column', 'row']),
|
|
177
219
|
hidden: _propTypes.default.bool,
|
|
178
|
-
itemWidth: _propTypes.default.number,
|
|
179
|
-
markSize: _propTypes.default.number,
|
|
180
|
-
offset: _propTypes.default.shape({
|
|
181
|
-
x: _propTypes.default.number,
|
|
182
|
-
y: _propTypes.default.number
|
|
183
|
-
}),
|
|
184
220
|
position: _propTypes.default.shape({
|
|
185
221
|
horizontal: _propTypes.default.oneOf(['left', 'middle', 'right']).isRequired,
|
|
186
222
|
vertical: _propTypes.default.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
187
223
|
}),
|
|
188
224
|
slotProps: _propTypes.default.object,
|
|
189
|
-
slots: _propTypes.default.object
|
|
190
|
-
spacing: _propTypes.default.number
|
|
225
|
+
slots: _propTypes.default.object
|
|
191
226
|
}),
|
|
227
|
+
/**
|
|
228
|
+
* The margin between the SVG and the drawing area.
|
|
229
|
+
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
230
|
+
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
231
|
+
* @default object Depends on the charts type.
|
|
232
|
+
*/
|
|
192
233
|
margin: _propTypes.default.shape({
|
|
193
234
|
bottom: _propTypes.default.number,
|
|
194
235
|
left: _propTypes.default.number,
|
|
@@ -201,18 +242,22 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
201
242
|
* @default null
|
|
202
243
|
*/
|
|
203
244
|
rightAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
204
|
-
axisId: _propTypes.default.string
|
|
245
|
+
axisId: _propTypes.default.string,
|
|
205
246
|
classes: _propTypes.default.object,
|
|
206
247
|
disableLine: _propTypes.default.bool,
|
|
207
248
|
disableTicks: _propTypes.default.bool,
|
|
208
249
|
fill: _propTypes.default.string,
|
|
209
250
|
label: _propTypes.default.string,
|
|
210
251
|
labelFontSize: _propTypes.default.number,
|
|
252
|
+
labelStyle: _propTypes.default.object,
|
|
211
253
|
position: _propTypes.default.oneOf(['left', 'right']),
|
|
212
254
|
slotProps: _propTypes.default.object,
|
|
213
255
|
slots: _propTypes.default.object,
|
|
214
256
|
stroke: _propTypes.default.string,
|
|
215
257
|
tickFontSize: _propTypes.default.number,
|
|
258
|
+
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
259
|
+
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
260
|
+
tickLabelStyle: _propTypes.default.object,
|
|
216
261
|
tickMaxStep: _propTypes.default.number,
|
|
217
262
|
tickMinStep: _propTypes.default.number,
|
|
218
263
|
tickNumber: _propTypes.default.number,
|
|
@@ -221,6 +266,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
221
266
|
series: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
222
267
|
area: _propTypes.default.bool,
|
|
223
268
|
color: _propTypes.default.string,
|
|
269
|
+
connectNulls: _propTypes.default.bool,
|
|
224
270
|
curve: _propTypes.default.oneOf(['catmullRom', 'linear', 'monotoneX', 'monotoneY', 'natural', 'step', 'stepAfter', 'stepBefore']),
|
|
225
271
|
data: _propTypes.default.arrayOf(_propTypes.default.number),
|
|
226
272
|
dataKey: _propTypes.default.string,
|
|
@@ -256,6 +302,8 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
256
302
|
axisContent: _propTypes.default.elementType,
|
|
257
303
|
classes: _propTypes.default.object,
|
|
258
304
|
itemContent: _propTypes.default.elementType,
|
|
305
|
+
slotProps: _propTypes.default.object,
|
|
306
|
+
slots: _propTypes.default.object,
|
|
259
307
|
trigger: _propTypes.default.oneOf(['axis', 'item', 'none'])
|
|
260
308
|
}),
|
|
261
309
|
/**
|
|
@@ -264,18 +312,22 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
264
312
|
* @default null
|
|
265
313
|
*/
|
|
266
314
|
topAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
267
|
-
axisId: _propTypes.default.string
|
|
315
|
+
axisId: _propTypes.default.string,
|
|
268
316
|
classes: _propTypes.default.object,
|
|
269
317
|
disableLine: _propTypes.default.bool,
|
|
270
318
|
disableTicks: _propTypes.default.bool,
|
|
271
319
|
fill: _propTypes.default.string,
|
|
272
320
|
label: _propTypes.default.string,
|
|
273
321
|
labelFontSize: _propTypes.default.number,
|
|
322
|
+
labelStyle: _propTypes.default.object,
|
|
274
323
|
position: _propTypes.default.oneOf(['bottom', 'top']),
|
|
275
324
|
slotProps: _propTypes.default.object,
|
|
276
325
|
slots: _propTypes.default.object,
|
|
277
326
|
stroke: _propTypes.default.string,
|
|
278
327
|
tickFontSize: _propTypes.default.number,
|
|
328
|
+
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
329
|
+
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
330
|
+
tickLabelStyle: _propTypes.default.object,
|
|
279
331
|
tickMaxStep: _propTypes.default.number,
|
|
280
332
|
tickMinStep: _propTypes.default.number,
|
|
281
333
|
tickNumber: _propTypes.default.number,
|
|
@@ -287,7 +339,15 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
287
339
|
x: _propTypes.default.number,
|
|
288
340
|
y: _propTypes.default.number
|
|
289
341
|
}),
|
|
342
|
+
/**
|
|
343
|
+
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
344
|
+
* @default undefined
|
|
345
|
+
*/
|
|
290
346
|
width: _propTypes.default.number,
|
|
347
|
+
/**
|
|
348
|
+
* The configuration of the x-axes.
|
|
349
|
+
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
350
|
+
*/
|
|
291
351
|
xAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
292
352
|
axisId: _propTypes.default.string,
|
|
293
353
|
classes: _propTypes.default.object,
|
|
@@ -300,6 +360,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
300
360
|
id: _propTypes.default.string,
|
|
301
361
|
label: _propTypes.default.string,
|
|
302
362
|
labelFontSize: _propTypes.default.number,
|
|
363
|
+
labelStyle: _propTypes.default.object,
|
|
303
364
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
304
365
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
305
366
|
position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
|
|
@@ -308,12 +369,19 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
308
369
|
slots: _propTypes.default.object,
|
|
309
370
|
stroke: _propTypes.default.string,
|
|
310
371
|
tickFontSize: _propTypes.default.number,
|
|
372
|
+
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
373
|
+
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
374
|
+
tickLabelStyle: _propTypes.default.object,
|
|
311
375
|
tickMaxStep: _propTypes.default.number,
|
|
312
376
|
tickMinStep: _propTypes.default.number,
|
|
313
377
|
tickNumber: _propTypes.default.number,
|
|
314
378
|
tickSize: _propTypes.default.number,
|
|
315
379
|
valueFormatter: _propTypes.default.func
|
|
316
380
|
})),
|
|
381
|
+
/**
|
|
382
|
+
* The configuration of the y-axes.
|
|
383
|
+
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
384
|
+
*/
|
|
317
385
|
yAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
318
386
|
axisId: _propTypes.default.string,
|
|
319
387
|
classes: _propTypes.default.object,
|
|
@@ -326,6 +394,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
326
394
|
id: _propTypes.default.string,
|
|
327
395
|
label: _propTypes.default.string,
|
|
328
396
|
labelFontSize: _propTypes.default.number,
|
|
397
|
+
labelStyle: _propTypes.default.object,
|
|
329
398
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
330
399
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
331
400
|
position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
|
|
@@ -334,6 +403,9 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
334
403
|
slots: _propTypes.default.object,
|
|
335
404
|
stroke: _propTypes.default.string,
|
|
336
405
|
tickFontSize: _propTypes.default.number,
|
|
406
|
+
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
407
|
+
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
408
|
+
tickLabelStyle: _propTypes.default.object,
|
|
337
409
|
tickMaxStep: _propTypes.default.number,
|
|
338
410
|
tickMinStep: _propTypes.default.number,
|
|
339
411
|
tickNumber: _propTypes.default.number,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { SlotComponentProps } from '@mui/base';
|
|
2
|
+
import { SlotComponentProps } from '@mui/base/utils';
|
|
3
3
|
import { HighlightScope } from '../context/HighlightProvider';
|
|
4
4
|
export interface LineElementClasses {
|
|
5
5
|
/** Styles applied to the root element. */
|
|
@@ -43,6 +43,16 @@ export type LineElementProps = Omit<LineElementOwnerState, 'isFaded' | 'isHighli
|
|
|
43
43
|
line?: React.ElementType;
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* Demos:
|
|
48
|
+
*
|
|
49
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
50
|
+
* - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
|
|
51
|
+
*
|
|
52
|
+
* API:
|
|
53
|
+
*
|
|
54
|
+
* - [LineElement API](https://mui.com/x/api/charts/line-element/)
|
|
55
|
+
*/
|
|
46
56
|
declare function LineElement(props: LineElementProps): React.JSX.Element;
|
|
47
57
|
declare namespace LineElement {
|
|
48
58
|
var propTypes: any;
|
package/LineChart/LineElement.js
CHANGED
|
@@ -22,13 +22,12 @@ var _InteractionProvider = require("../context/InteractionProvider");
|
|
|
22
22
|
var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
|
|
23
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
24
|
const _excluded = ["id", "classes", "color", "highlightScope", "slots", "slotProps"];
|
|
25
|
-
function _getRequireWildcardCache(
|
|
26
|
-
function _interopRequireWildcard(
|
|
25
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
26
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
27
27
|
function getLineElementUtilityClass(slot) {
|
|
28
28
|
return (0, _generateUtilityClass.default)('MuiLineElement', slot);
|
|
29
29
|
}
|
|
30
|
-
const lineElementClasses = (0, _generateUtilityClasses.default)('MuiLineElement', ['root', 'highlighted', 'faded']);
|
|
31
|
-
exports.lineElementClasses = lineElementClasses;
|
|
30
|
+
const lineElementClasses = exports.lineElementClasses = (0, _generateUtilityClasses.default)('MuiLineElement', ['root', 'highlighted', 'faded']);
|
|
32
31
|
const useUtilityClasses = ownerState => {
|
|
33
32
|
const {
|
|
34
33
|
classes,
|
|
@@ -41,7 +40,7 @@ const useUtilityClasses = ownerState => {
|
|
|
41
40
|
};
|
|
42
41
|
return (0, _composeClasses.default)(slots, getLineElementUtilityClass, classes);
|
|
43
42
|
};
|
|
44
|
-
const LineElementPath = (0, _styles.styled)('path', {
|
|
43
|
+
const LineElementPath = exports.LineElementPath = (0, _styles.styled)('path', {
|
|
45
44
|
name: 'MuiLineElement',
|
|
46
45
|
slot: 'Root',
|
|
47
46
|
overridesResolver: (_, styles) => styles.root
|
|
@@ -55,7 +54,6 @@ const LineElementPath = (0, _styles.styled)('path', {
|
|
|
55
54
|
transition: 'opacity 0.2s ease-in, stroke 0.2s ease-in',
|
|
56
55
|
opacity: ownerState.isFaded ? 0.3 : 1
|
|
57
56
|
}));
|
|
58
|
-
exports.LineElementPath = LineElementPath;
|
|
59
57
|
LineElementPath.propTypes = {
|
|
60
58
|
// ----------------------------- Warning --------------------------------
|
|
61
59
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -71,6 +69,16 @@ LineElementPath.propTypes = {
|
|
|
71
69
|
}).isRequired,
|
|
72
70
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object])
|
|
73
71
|
};
|
|
72
|
+
/**
|
|
73
|
+
* Demos:
|
|
74
|
+
*
|
|
75
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
76
|
+
* - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
|
|
77
|
+
*
|
|
78
|
+
* API:
|
|
79
|
+
*
|
|
80
|
+
* - [LineElement API](https://mui.com/x/api/charts/line-element/)
|
|
81
|
+
*/
|
|
74
82
|
function LineElement(props) {
|
|
75
83
|
const {
|
|
76
84
|
id,
|
|
@@ -14,6 +14,16 @@ interface LineHighlightElementOwnerState {
|
|
|
14
14
|
export declare function getHighlightElementUtilityClass(slot: string): string;
|
|
15
15
|
export declare const lineHighlightElementClasses: LineHighlightElementClasses;
|
|
16
16
|
export type LineHighlightElementProps = LineHighlightElementOwnerState & React.ComponentPropsWithoutRef<'circle'> & {};
|
|
17
|
+
/**
|
|
18
|
+
* Demos:
|
|
19
|
+
*
|
|
20
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
21
|
+
* - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
|
|
22
|
+
*
|
|
23
|
+
* API:
|
|
24
|
+
*
|
|
25
|
+
* - [LineHighlightElement API](https://mui.com/x/api/charts/line-highlight-element/)
|
|
26
|
+
*/
|
|
17
27
|
declare function LineHighlightElement(props: LineHighlightElementProps): React.JSX.Element;
|
|
18
28
|
declare namespace LineHighlightElement {
|
|
19
29
|
var propTypes: any;
|
|
@@ -17,13 +17,12 @@ var _styles = require("@mui/material/styles");
|
|
|
17
17
|
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
18
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
19
|
const _excluded = ["x", "y", "id", "classes", "color"];
|
|
20
|
-
function _getRequireWildcardCache(
|
|
21
|
-
function _interopRequireWildcard(
|
|
20
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
21
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
22
|
function getHighlightElementUtilityClass(slot) {
|
|
23
23
|
return (0, _generateUtilityClass.default)('MuiHighlightElement', slot);
|
|
24
24
|
}
|
|
25
|
-
const lineHighlightElementClasses = (0, _generateUtilityClasses.default)('MuiHighlightElement', ['root']);
|
|
26
|
-
exports.lineHighlightElementClasses = lineHighlightElementClasses;
|
|
25
|
+
const lineHighlightElementClasses = exports.lineHighlightElementClasses = (0, _generateUtilityClasses.default)('MuiHighlightElement', ['root']);
|
|
27
26
|
const useUtilityClasses = ownerState => {
|
|
28
27
|
const {
|
|
29
28
|
classes,
|
|
@@ -45,6 +44,16 @@ const HighlightElement = (0, _styles.styled)('circle', {
|
|
|
45
44
|
transformOrigin: `${ownerState.x}px ${ownerState.y}px`,
|
|
46
45
|
fill: ownerState.color
|
|
47
46
|
}));
|
|
47
|
+
/**
|
|
48
|
+
* Demos:
|
|
49
|
+
*
|
|
50
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
51
|
+
* - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
|
|
52
|
+
*
|
|
53
|
+
* API:
|
|
54
|
+
*
|
|
55
|
+
* - [LineHighlightElement API](https://mui.com/x/api/charts/line-highlight-element/)
|
|
56
|
+
*/
|
|
48
57
|
function LineHighlightElement(props) {
|
|
49
58
|
const {
|
|
50
59
|
x,
|
|
@@ -18,6 +18,16 @@ export interface LineHighlightPlotProps extends React.SVGAttributes<SVGSVGElemen
|
|
|
18
18
|
*/
|
|
19
19
|
slotProps?: LineHighlightPlotSlotComponentProps;
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Demos:
|
|
23
|
+
*
|
|
24
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
25
|
+
* - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
|
|
26
|
+
*
|
|
27
|
+
* API:
|
|
28
|
+
*
|
|
29
|
+
* - [LineHighlightPlot API](https://mui.com/x/api/charts/line-highlight-plot/)
|
|
30
|
+
*/
|
|
21
31
|
declare function LineHighlightPlot(props: LineHighlightPlotProps): React.JSX.Element | null;
|
|
22
32
|
declare namespace LineHighlightPlot {
|
|
23
33
|
var propTypes: any;
|
|
@@ -16,8 +16,18 @@ var _useScale = require("../hooks/useScale");
|
|
|
16
16
|
var _InteractionProvider = require("../context/InteractionProvider");
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
18
|
const _excluded = ["slots", "slotProps"];
|
|
19
|
-
function _getRequireWildcardCache(
|
|
20
|
-
function _interopRequireWildcard(
|
|
19
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
20
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
|
+
/**
|
|
22
|
+
* Demos:
|
|
23
|
+
*
|
|
24
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
25
|
+
* - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
|
|
26
|
+
*
|
|
27
|
+
* API:
|
|
28
|
+
*
|
|
29
|
+
* - [LineHighlightPlot API](https://mui.com/x/api/charts/line-highlight-plot/)
|
|
30
|
+
*/
|
|
21
31
|
function LineHighlightPlot(props) {
|
|
22
32
|
const {
|
|
23
33
|
slots,
|
|
@@ -58,9 +68,10 @@ function LineHighlightPlot(props) {
|
|
|
58
68
|
xAxisKey = defaultXAxisId,
|
|
59
69
|
yAxisKey = defaultYAxisId,
|
|
60
70
|
stackedData,
|
|
71
|
+
data,
|
|
61
72
|
disableHighlight
|
|
62
73
|
} = series[seriesId];
|
|
63
|
-
if (disableHighlight) {
|
|
74
|
+
if (disableHighlight || data[highlightedIndex] == null) {
|
|
64
75
|
return null;
|
|
65
76
|
}
|
|
66
77
|
const xScale = (0, _useScale.getValueToPositionMapper)(xAxis[xAxisKey].scale);
|
|
@@ -70,7 +81,7 @@ function LineHighlightPlot(props) {
|
|
|
70
81
|
throw new Error(`Axis of id "${xAxisKey}" should have data property to be able to display a line plot.`);
|
|
71
82
|
}
|
|
72
83
|
const x = xScale(xData[highlightedIndex]);
|
|
73
|
-
const y = yScale(stackedData[highlightedIndex][1]);
|
|
84
|
+
const y = yScale(stackedData[highlightedIndex][1]); // This should not be undefined since y should not be a band scale
|
|
74
85
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Element, (0, _extends2.default)({
|
|
75
86
|
id: seriesId,
|
|
76
87
|
color: series[seriesId].color,
|
package/LineChart/LinePlot.d.ts
CHANGED
|
@@ -8,6 +8,16 @@ export interface LinePlotSlotComponentProps {
|
|
|
8
8
|
}
|
|
9
9
|
export interface LinePlotProps extends React.SVGAttributes<SVGSVGElement>, Pick<LineElementProps, 'slots' | 'slotProps'> {
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Demos:
|
|
13
|
+
*
|
|
14
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
15
|
+
* - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
|
|
16
|
+
*
|
|
17
|
+
* API:
|
|
18
|
+
*
|
|
19
|
+
* - [LinePlot API](https://mui.com/x/api/charts/line-plot/)
|
|
20
|
+
*/
|
|
11
21
|
declare function LinePlot(props: LinePlotProps): React.JSX.Element | null;
|
|
12
22
|
declare namespace LinePlot {
|
|
13
23
|
var propTypes: any;
|