@mui/x-charts 6.0.0-alpha.9 → 6.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/BarChart.d.ts +19 -5
- package/BarChart/BarChart.js +52 -13
- 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 +735 -55
- package/ChartContainer/index.js +7 -5
- package/ChartsAxis/ChartsAxis.d.ts +9 -0
- package/ChartsAxis/ChartsAxis.js +28 -2
- package/ChartsAxis/axisClasses.d.ts +1 -1
- 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 +44 -24
- package/ChartsLegend/ChartsLegend.js +192 -150
- package/ChartsLegend/chartsLegendClasses.js +1 -2
- package/ChartsLegend/utils.d.ts +1 -6
- package/ChartsSurface.d.ts +1 -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 +161 -40
- package/ChartsYAxis/ChartsYAxis.d.ts +9 -0
- package/ChartsYAxis/ChartsYAxis.js +86 -33
- 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 +16 -3
- package/LineChart/LineChart.js +48 -13
- 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 +14 -3
- 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 +40 -9
- 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 +61 -14
- 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.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 +43 -12
- 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 +28 -7
- package/colorPalettes/colorPalettes.js +6 -12
- package/constants.js +5 -8
- package/context/CartesianContextProvider.d.ts +5 -0
- package/context/CartesianContextProvider.js +31 -16
- package/context/DrawingProvider.d.ts +7 -0
- package/context/DrawingProvider.js +12 -6
- package/context/HighlightProvider.js +3 -4
- package/context/InteractionProvider.js +3 -4
- package/context/SeriesContextProvider.js +3 -4
- package/esm/BarChart/BarChart.js +49 -9
- 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 +26 -0
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +57 -20
- package/esm/ChartsClipPath/ChartsClipPath.js +5 -0
- package/esm/ChartsLegend/ChartsLegend.js +188 -142
- 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 +158 -37
- package/esm/ChartsYAxis/ChartsYAxis.js +83 -30
- package/esm/LineChart/AreaElement.js +10 -0
- package/esm/LineChart/AreaPlot.js +26 -6
- package/esm/LineChart/LineChart.js +45 -9
- package/esm/LineChart/LineElement.js +10 -0
- package/esm/LineChart/LineHighlightElement.js +10 -0
- package/esm/LineChart/LineHighlightPlot.js +12 -1
- package/esm/LineChart/LinePlot.js +25 -14
- package/esm/LineChart/MarkElement.js +11 -1
- package/esm/LineChart/MarkPlot.js +38 -7
- 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 +59 -12
- 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 +40 -8
- package/esm/ScatterChart/ScatterPlot.js +10 -0
- package/esm/SparkLineChart/SparkLineChart.js +25 -3
- package/esm/constants.js +1 -1
- package/esm/context/CartesianContextProvider.js +30 -14
- package/esm/context/DrawingProvider.js +8 -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/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.js +1 -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/stackSeries.js +2 -4
- package/legacy/BarChart/BarChart.js +49 -9
- 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 +26 -0
- package/legacy/ChartsAxisHighlight/ChartsAxisHighlight.js +60 -20
- package/legacy/ChartsClipPath/ChartsClipPath.js +5 -0
- package/legacy/ChartsLegend/ChartsLegend.js +203 -140
- 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 +162 -39
- package/legacy/ChartsYAxis/ChartsYAxis.js +83 -30
- package/legacy/LineChart/AreaElement.js +10 -0
- package/legacy/LineChart/AreaPlot.js +31 -7
- package/legacy/LineChart/LineChart.js +45 -9
- package/legacy/LineChart/LineElement.js +10 -0
- package/legacy/LineChart/LineHighlightElement.js +10 -0
- package/legacy/LineChart/LineHighlightPlot.js +12 -1
- package/legacy/LineChart/LinePlot.js +29 -12
- package/legacy/LineChart/MarkElement.js +11 -1
- package/legacy/LineChart/MarkPlot.js +37 -7
- 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 +59 -12
- 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 +40 -8
- package/legacy/ScatterChart/ScatterPlot.js +10 -0
- package/legacy/SparkLineChart/SparkLineChart.js +25 -3
- package/legacy/constants.js +1 -1
- package/legacy/context/CartesianContextProvider.js +30 -14
- package/legacy/context/DrawingProvider.js +8 -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 +1 -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 +27 -9
- package/models/layout.d.ts +7 -6
- package/models/seriesType/line.d.ts +8 -3
- package/models/seriesType/pie.d.ts +5 -1
- package/modern/BarChart/BarChart.js +49 -9
- 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 +26 -0
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +57 -20
- package/modern/ChartsClipPath/ChartsClipPath.js +5 -0
- package/modern/ChartsLegend/ChartsLegend.js +188 -142
- 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 +158 -37
- package/modern/ChartsYAxis/ChartsYAxis.js +83 -30
- package/modern/LineChart/AreaElement.js +10 -0
- package/modern/LineChart/AreaPlot.js +25 -6
- package/modern/LineChart/LineChart.js +45 -9
- package/modern/LineChart/LineElement.js +10 -0
- package/modern/LineChart/LineHighlightElement.js +10 -0
- package/modern/LineChart/LineHighlightPlot.js +12 -1
- package/modern/LineChart/LinePlot.js +23 -10
- package/modern/LineChart/MarkElement.js +11 -1
- package/modern/LineChart/MarkPlot.js +38 -7
- 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 +59 -12
- 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 +40 -8
- package/modern/ScatterChart/ScatterPlot.js +10 -0
- package/modern/SparkLineChart/SparkLineChart.js +25 -3
- package/modern/constants.js +1 -1
- package/modern/context/CartesianContextProvider.js +29 -13
- package/modern/context/DrawingProvider.js +8 -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 +1 -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,22 @@ 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
21
|
axisHighlight?: ChartsAxisHighlightProps;
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Consider using `slotProps.legend` instead.
|
|
24
|
+
*/
|
|
22
25
|
legend?: ChartsLegendProps;
|
|
23
26
|
/**
|
|
24
27
|
* If `true`, render the line highlight item.
|
|
@@ -35,5 +38,15 @@ export interface LineChartProps extends Omit<ResponsiveChartContainerProps, 'ser
|
|
|
35
38
|
*/
|
|
36
39
|
slotProps?: LineChartSlotComponentProps;
|
|
37
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Demos:
|
|
43
|
+
*
|
|
44
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
45
|
+
* - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
|
|
46
|
+
*
|
|
47
|
+
* API:
|
|
48
|
+
*
|
|
49
|
+
* - [LineChart API](https://mui.com/x/api/charts/line-chart/)
|
|
50
|
+
*/
|
|
38
51
|
declare const LineChart: React.ForwardRefExoticComponent<LineChartProps & React.RefAttributes<unknown>>;
|
|
39
52
|
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,12 +106,14 @@ 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 |
|
|
@@ -124,11 +136,15 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
124
136
|
fill: _propTypes.default.string,
|
|
125
137
|
label: _propTypes.default.string,
|
|
126
138
|
labelFontSize: _propTypes.default.number,
|
|
139
|
+
labelStyle: _propTypes.default.object,
|
|
127
140
|
position: _propTypes.default.oneOf(['bottom', 'top']),
|
|
128
141
|
slotProps: _propTypes.default.object,
|
|
129
142
|
slots: _propTypes.default.object,
|
|
130
143
|
stroke: _propTypes.default.string,
|
|
131
144
|
tickFontSize: _propTypes.default.number,
|
|
145
|
+
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
146
|
+
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
147
|
+
tickLabelStyle: _propTypes.default.object,
|
|
132
148
|
tickMaxStep: _propTypes.default.number,
|
|
133
149
|
tickMinStep: _propTypes.default.number,
|
|
134
150
|
tickNumber: _propTypes.default.number,
|
|
@@ -161,33 +177,33 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
161
177
|
fill: _propTypes.default.string,
|
|
162
178
|
label: _propTypes.default.string,
|
|
163
179
|
labelFontSize: _propTypes.default.number,
|
|
180
|
+
labelStyle: _propTypes.default.object,
|
|
164
181
|
position: _propTypes.default.oneOf(['left', 'right']),
|
|
165
182
|
slotProps: _propTypes.default.object,
|
|
166
183
|
slots: _propTypes.default.object,
|
|
167
184
|
stroke: _propTypes.default.string,
|
|
168
185
|
tickFontSize: _propTypes.default.number,
|
|
186
|
+
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
187
|
+
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
188
|
+
tickLabelStyle: _propTypes.default.object,
|
|
169
189
|
tickMaxStep: _propTypes.default.number,
|
|
170
190
|
tickMinStep: _propTypes.default.number,
|
|
171
191
|
tickNumber: _propTypes.default.number,
|
|
172
192
|
tickSize: _propTypes.default.number
|
|
173
193
|
}), _propTypes.default.string]),
|
|
194
|
+
/**
|
|
195
|
+
* @deprecated Consider using `slotProps.legend` instead.
|
|
196
|
+
*/
|
|
174
197
|
legend: _propTypes.default.shape({
|
|
175
198
|
classes: _propTypes.default.object,
|
|
176
199
|
direction: _propTypes.default.oneOf(['column', 'row']),
|
|
177
200
|
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
201
|
position: _propTypes.default.shape({
|
|
185
202
|
horizontal: _propTypes.default.oneOf(['left', 'middle', 'right']).isRequired,
|
|
186
203
|
vertical: _propTypes.default.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
187
204
|
}),
|
|
188
205
|
slotProps: _propTypes.default.object,
|
|
189
|
-
slots: _propTypes.default.object
|
|
190
|
-
spacing: _propTypes.default.number
|
|
206
|
+
slots: _propTypes.default.object
|
|
191
207
|
}),
|
|
192
208
|
margin: _propTypes.default.shape({
|
|
193
209
|
bottom: _propTypes.default.number,
|
|
@@ -208,11 +224,15 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
208
224
|
fill: _propTypes.default.string,
|
|
209
225
|
label: _propTypes.default.string,
|
|
210
226
|
labelFontSize: _propTypes.default.number,
|
|
227
|
+
labelStyle: _propTypes.default.object,
|
|
211
228
|
position: _propTypes.default.oneOf(['left', 'right']),
|
|
212
229
|
slotProps: _propTypes.default.object,
|
|
213
230
|
slots: _propTypes.default.object,
|
|
214
231
|
stroke: _propTypes.default.string,
|
|
215
232
|
tickFontSize: _propTypes.default.number,
|
|
233
|
+
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
234
|
+
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
235
|
+
tickLabelStyle: _propTypes.default.object,
|
|
216
236
|
tickMaxStep: _propTypes.default.number,
|
|
217
237
|
tickMinStep: _propTypes.default.number,
|
|
218
238
|
tickNumber: _propTypes.default.number,
|
|
@@ -221,6 +241,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
221
241
|
series: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
222
242
|
area: _propTypes.default.bool,
|
|
223
243
|
color: _propTypes.default.string,
|
|
244
|
+
connectNulls: _propTypes.default.bool,
|
|
224
245
|
curve: _propTypes.default.oneOf(['catmullRom', 'linear', 'monotoneX', 'monotoneY', 'natural', 'step', 'stepAfter', 'stepBefore']),
|
|
225
246
|
data: _propTypes.default.arrayOf(_propTypes.default.number),
|
|
226
247
|
dataKey: _propTypes.default.string,
|
|
@@ -256,6 +277,8 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
256
277
|
axisContent: _propTypes.default.elementType,
|
|
257
278
|
classes: _propTypes.default.object,
|
|
258
279
|
itemContent: _propTypes.default.elementType,
|
|
280
|
+
slotProps: _propTypes.default.object,
|
|
281
|
+
slots: _propTypes.default.object,
|
|
259
282
|
trigger: _propTypes.default.oneOf(['axis', 'item', 'none'])
|
|
260
283
|
}),
|
|
261
284
|
/**
|
|
@@ -271,11 +294,15 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
271
294
|
fill: _propTypes.default.string,
|
|
272
295
|
label: _propTypes.default.string,
|
|
273
296
|
labelFontSize: _propTypes.default.number,
|
|
297
|
+
labelStyle: _propTypes.default.object,
|
|
274
298
|
position: _propTypes.default.oneOf(['bottom', 'top']),
|
|
275
299
|
slotProps: _propTypes.default.object,
|
|
276
300
|
slots: _propTypes.default.object,
|
|
277
301
|
stroke: _propTypes.default.string,
|
|
278
302
|
tickFontSize: _propTypes.default.number,
|
|
303
|
+
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
304
|
+
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
305
|
+
tickLabelStyle: _propTypes.default.object,
|
|
279
306
|
tickMaxStep: _propTypes.default.number,
|
|
280
307
|
tickMinStep: _propTypes.default.number,
|
|
281
308
|
tickNumber: _propTypes.default.number,
|
|
@@ -300,6 +327,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
300
327
|
id: _propTypes.default.string,
|
|
301
328
|
label: _propTypes.default.string,
|
|
302
329
|
labelFontSize: _propTypes.default.number,
|
|
330
|
+
labelStyle: _propTypes.default.object,
|
|
303
331
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
304
332
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
305
333
|
position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
|
|
@@ -308,6 +336,9 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
308
336
|
slots: _propTypes.default.object,
|
|
309
337
|
stroke: _propTypes.default.string,
|
|
310
338
|
tickFontSize: _propTypes.default.number,
|
|
339
|
+
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
340
|
+
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
341
|
+
tickLabelStyle: _propTypes.default.object,
|
|
311
342
|
tickMaxStep: _propTypes.default.number,
|
|
312
343
|
tickMinStep: _propTypes.default.number,
|
|
313
344
|
tickNumber: _propTypes.default.number,
|
|
@@ -326,6 +357,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
326
357
|
id: _propTypes.default.string,
|
|
327
358
|
label: _propTypes.default.string,
|
|
328
359
|
labelFontSize: _propTypes.default.number,
|
|
360
|
+
labelStyle: _propTypes.default.object,
|
|
329
361
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
330
362
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
331
363
|
position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
|
|
@@ -334,6 +366,9 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
334
366
|
slots: _propTypes.default.object,
|
|
335
367
|
stroke: _propTypes.default.string,
|
|
336
368
|
tickFontSize: _propTypes.default.number,
|
|
369
|
+
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
370
|
+
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
371
|
+
tickLabelStyle: _propTypes.default.object,
|
|
337
372
|
tickMaxStep: _propTypes.default.number,
|
|
338
373
|
tickMinStep: _propTypes.default.number,
|
|
339
374
|
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);
|
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;
|
package/LineChart/LinePlot.js
CHANGED
|
@@ -17,8 +17,18 @@ 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
|
+
* - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
|
|
27
|
+
*
|
|
28
|
+
* API:
|
|
29
|
+
*
|
|
30
|
+
* - [LinePlot API](https://mui.com/x/api/charts/line-plot/)
|
|
31
|
+
*/
|
|
22
32
|
function LinePlot(props) {
|
|
23
33
|
const {
|
|
24
34
|
slots,
|
|
@@ -50,25 +60,28 @@ function LinePlot(props) {
|
|
|
50
60
|
const {
|
|
51
61
|
xAxisKey = defaultXAxisId,
|
|
52
62
|
yAxisKey = defaultYAxisId,
|
|
53
|
-
stackedData
|
|
63
|
+
stackedData,
|
|
64
|
+
data,
|
|
65
|
+
connectNulls
|
|
54
66
|
} = series[seriesId];
|
|
55
67
|
const xScale = (0, _useScale.getValueToPositionMapper)(xAxis[xAxisKey].scale);
|
|
56
68
|
const yScale = yAxis[yAxisKey].scale;
|
|
57
69
|
const xData = xAxis[xAxisKey].data;
|
|
58
|
-
if (xData === undefined) {
|
|
59
|
-
throw new Error(`Axis of id "${xAxisKey}" should have data property to be able to display a line plot`);
|
|
60
|
-
}
|
|
61
|
-
const linePath = (0, _d3Shape.line)().x(d => xScale(d.x)).y(d => yScale(d.y[1]));
|
|
62
70
|
if (process.env.NODE_ENV !== 'production') {
|
|
63
|
-
if (xData
|
|
64
|
-
throw new Error(`
|
|
71
|
+
if (xData === undefined) {
|
|
72
|
+
throw new Error(`Axis of id "${xAxisKey}" should have data property to be able to display a line plot`);
|
|
73
|
+
}
|
|
74
|
+
if (xData.length < stackedData.length) {
|
|
75
|
+
throw new Error(`MUI: data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items)`);
|
|
65
76
|
}
|
|
66
77
|
}
|
|
78
|
+
const linePath = (0, _d3Shape.line)().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y(d => yScale(d.y[1]));
|
|
67
79
|
const curve = (0, _getCurve.default)(series[seriesId].curve);
|
|
68
|
-
const
|
|
80
|
+
const formattedData = xData?.map((x, index) => ({
|
|
69
81
|
x,
|
|
70
|
-
y: stackedData[index]
|
|
71
|
-
}));
|
|
82
|
+
y: stackedData[index]
|
|
83
|
+
})) ?? [];
|
|
84
|
+
const d3Data = connectNulls ? formattedData.filter((_, i) => data[i] != null) : formattedData;
|
|
72
85
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineElement.LineElement, {
|
|
73
86
|
id: seriesId,
|
|
74
87
|
d: linePath.curve(curve)(d3Data) || undefined,
|
|
@@ -31,6 +31,16 @@ export type MarkElementProps = Omit<MarkElementOwnerState, 'isFaded' | 'isHighli
|
|
|
31
31
|
dataIndex: number;
|
|
32
32
|
highlightScope?: Partial<HighlightScope>;
|
|
33
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* Demos:
|
|
36
|
+
*
|
|
37
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
38
|
+
* - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
|
|
39
|
+
*
|
|
40
|
+
* API:
|
|
41
|
+
*
|
|
42
|
+
* - [MarkElement API](https://mui.com/x/api/charts/mark-element/)
|
|
43
|
+
*/
|
|
34
44
|
declare function MarkElement(props: MarkElementProps): React.JSX.Element;
|
|
35
45
|
declare namespace MarkElement {
|
|
36
46
|
var propTypes: any;
|
package/LineChart/MarkElement.js
CHANGED
|
@@ -21,13 +21,12 @@ var _InteractionProvider = require("../context/InteractionProvider");
|
|
|
21
21
|
var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
|
|
22
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
23
|
const _excluded = ["x", "y", "id", "classes", "color", "shape", "dataIndex", "highlightScope"];
|
|
24
|
-
function _getRequireWildcardCache(
|
|
25
|
-
function _interopRequireWildcard(
|
|
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
26
|
function getMarkElementUtilityClass(slot) {
|
|
27
27
|
return (0, _generateUtilityClass.default)('MuiMarkElement', slot);
|
|
28
28
|
}
|
|
29
|
-
const markElementClasses = (0, _generateUtilityClasses.default)('MuiMarkElement', ['root', 'highlighted', 'faded']);
|
|
30
|
-
exports.markElementClasses = markElementClasses;
|
|
29
|
+
const markElementClasses = exports.markElementClasses = (0, _generateUtilityClasses.default)('MuiMarkElement', ['root', 'highlighted', 'faded']);
|
|
31
30
|
const useUtilityClasses = ownerState => {
|
|
32
31
|
const {
|
|
33
32
|
classes,
|
|
@@ -50,7 +49,7 @@ const MarkElementPath = (0, _styles.styled)('path', {
|
|
|
50
49
|
}) => ({
|
|
51
50
|
transform: `translate(${ownerState.x}px, ${ownerState.y}px)`,
|
|
52
51
|
transformOrigin: `${ownerState.x}px ${ownerState.y}px`,
|
|
53
|
-
fill: theme.palette.background.paper,
|
|
52
|
+
fill: (theme.vars || theme).palette.background.paper,
|
|
54
53
|
stroke: ownerState.color,
|
|
55
54
|
strokeWidth: 2
|
|
56
55
|
}));
|
|
@@ -71,6 +70,16 @@ MarkElementPath.propTypes = {
|
|
|
71
70
|
}).isRequired,
|
|
72
71
|
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
72
|
};
|
|
73
|
+
/**
|
|
74
|
+
* Demos:
|
|
75
|
+
*
|
|
76
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
77
|
+
* - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
|
|
78
|
+
*
|
|
79
|
+
* API:
|
|
80
|
+
*
|
|
81
|
+
* - [MarkElement API](https://mui.com/x/api/charts/mark-element/)
|
|
82
|
+
*/
|
|
74
83
|
function MarkElement(props) {
|
|
75
84
|
const {
|
|
76
85
|
x,
|