@mui/x-charts 6.0.0-alpha.8 → 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 +786 -48
- 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 +12 -2
- package/LineChart/AreaElement.js +14 -6
- package/LineChart/AreaPlot.d.ts +11 -0
- package/LineChart/AreaPlot.js +27 -8
- package/LineChart/LineChart.d.ts +21 -3
- package/LineChart/LineChart.js +61 -14
- package/LineChart/LineElement.d.ts +12 -2
- package/LineChart/LineElement.js +14 -6
- package/LineChart/LineHighlightElement.d.ts +31 -0
- package/LineChart/LineHighlightElement.js +88 -0
- package/LineChart/LineHighlightPlot.d.ts +35 -0
- package/LineChart/LineHighlightPlot.js +110 -0
- package/LineChart/LinePlot.d.ts +10 -0
- package/LineChart/LinePlot.js +25 -12
- package/LineChart/MarkElement.d.ts +11 -1
- package/LineChart/MarkElement.js +15 -9
- package/LineChart/MarkPlot.d.ts +10 -0
- package/LineChart/MarkPlot.js +62 -15
- package/LineChart/formatter.js +5 -5
- package/LineChart/index.d.ts +2 -0
- package/LineChart/index.js +20 -0
- package/LineChart/legend.js +1 -2
- package/PieChart/PieArc.d.ts +12 -14
- package/PieChart/PieArc.js +28 -60
- package/PieChart/PieArcLabel.d.ts +9 -10
- 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 +13 -3
- package/SparkLineChart/SparkLineChart.js +34 -18
- 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 +58 -10
- package/esm/LineChart/LineElement.js +10 -0
- package/esm/LineChart/LineHighlightElement.js +78 -0
- package/esm/LineChart/LineHighlightPlot.js +103 -0
- package/esm/LineChart/LinePlot.js +25 -14
- package/esm/LineChart/MarkElement.js +12 -5
- package/esm/LineChart/MarkPlot.js +60 -13
- package/esm/LineChart/formatter.js +7 -3
- package/esm/LineChart/index.js +3 -1
- 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 +32 -15
- 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 +8 -1
- 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 +58 -10
- package/legacy/LineChart/LineElement.js +10 -0
- package/legacy/LineChart/LineHighlightElement.js +77 -0
- package/legacy/LineChart/LineHighlightPlot.js +96 -0
- package/legacy/LineChart/LinePlot.js +29 -12
- package/legacy/LineChart/MarkElement.js +12 -5
- package/legacy/LineChart/MarkPlot.js +50 -5
- package/legacy/LineChart/formatter.js +7 -3
- package/legacy/LineChart/index.js +3 -1
- 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 +32 -13
- 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 +39 -1
- 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 +58 -10
- package/modern/LineChart/LineElement.js +10 -0
- package/modern/LineChart/LineHighlightElement.js +78 -0
- package/modern/LineChart/LineHighlightPlot.js +102 -0
- package/modern/LineChart/LinePlot.js +23 -10
- package/modern/LineChart/MarkElement.js +12 -5
- package/modern/LineChart/MarkPlot.js +60 -13
- package/modern/LineChart/formatter.js +4 -3
- package/modern/LineChart/index.js +3 -1
- 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 +32 -15
- 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,27 @@ 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, ChartsTooltipSlotsComponent {
|
|
14
15
|
}
|
|
15
|
-
export interface LineChartSlotComponentProps extends ChartsAxisSlotComponentProps, AreaPlotSlotComponentProps, LinePlotSlotComponentProps, MarkPlotSlotComponentProps, ChartsLegendSlotComponentProps {
|
|
16
|
+
export interface LineChartSlotComponentProps extends ChartsAxisSlotComponentProps, AreaPlotSlotComponentProps, LinePlotSlotComponentProps, MarkPlotSlotComponentProps, LineHighlightPlotSlotComponentProps, ChartsLegendSlotComponentProps, ChartsTooltipSlotComponentProps {
|
|
16
17
|
}
|
|
17
18
|
export interface LineChartProps extends Omit<ResponsiveChartContainerProps, 'series'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'> {
|
|
18
19
|
series: MakeOptional<LineSeriesType, 'type'>[];
|
|
19
20
|
tooltip?: ChartsTooltipProps;
|
|
20
21
|
axisHighlight?: ChartsAxisHighlightProps;
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Consider using `slotProps.legend` instead.
|
|
24
|
+
*/
|
|
21
25
|
legend?: ChartsLegendProps;
|
|
26
|
+
/**
|
|
27
|
+
* If `true`, render the line highlight item.
|
|
28
|
+
*/
|
|
29
|
+
disableLineItemHighlight?: boolean;
|
|
22
30
|
/**
|
|
23
31
|
* Overridable component slots.
|
|
24
32
|
* @default {}
|
|
@@ -30,5 +38,15 @@ export interface LineChartProps extends Omit<ResponsiveChartContainerProps, 'ser
|
|
|
30
38
|
*/
|
|
31
39
|
slotProps?: LineChartSlotComponentProps;
|
|
32
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
|
+
*/
|
|
33
51
|
declare const LineChart: React.ForwardRefExoticComponent<LineChartProps & React.RefAttributes<unknown>>;
|
|
34
52
|
export { LineChart };
|
package/LineChart/LineChart.js
CHANGED
|
@@ -19,10 +19,21 @@ var _ChartsTooltip = require("../ChartsTooltip");
|
|
|
19
19
|
var _ChartsLegend = require("../ChartsLegend");
|
|
20
20
|
var _ChartsAxisHighlight = require("../ChartsAxisHighlight");
|
|
21
21
|
var _ChartsClipPath = require("../ChartsClipPath");
|
|
22
|
+
var _LineHighlightPlot = require("./LineHighlightPlot");
|
|
22
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
-
function _getRequireWildcardCache(
|
|
24
|
-
function _interopRequireWildcard(
|
|
25
|
-
|
|
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) {
|
|
26
37
|
const {
|
|
27
38
|
xAxis,
|
|
28
39
|
yAxis,
|
|
@@ -37,6 +48,7 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
|
|
|
37
48
|
axisHighlight = {
|
|
38
49
|
x: 'line'
|
|
39
50
|
},
|
|
51
|
+
disableLineItemHighlight,
|
|
40
52
|
legend,
|
|
41
53
|
topAxis,
|
|
42
54
|
leftAxis,
|
|
@@ -51,6 +63,7 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
|
|
|
51
63
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ResponsiveChartContainer.ResponsiveChartContainer, {
|
|
52
64
|
ref: ref,
|
|
53
65
|
series: series.map(s => (0, _extends2.default)({
|
|
66
|
+
disableHighlight: !!disableLineItemHighlight,
|
|
54
67
|
type: 'line'
|
|
55
68
|
}, s)),
|
|
56
69
|
width: width,
|
|
@@ -84,18 +97,23 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
|
|
|
84
97
|
bottomAxis: bottomAxis,
|
|
85
98
|
slots: slots,
|
|
86
99
|
slotProps: slotProps
|
|
87
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_MarkPlot.MarkPlot, {
|
|
100
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlight)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_MarkPlot.MarkPlot, {
|
|
101
|
+
slots: slots,
|
|
102
|
+
slotProps: slotProps
|
|
103
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineHighlightPlot.LineHighlightPlot, {
|
|
88
104
|
slots: slots,
|
|
89
105
|
slotProps: slotProps
|
|
90
106
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legend, {
|
|
91
107
|
slots: slots,
|
|
92
108
|
slotProps: slotProps
|
|
93
|
-
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
109
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltip, {
|
|
110
|
+
slots: slots,
|
|
111
|
+
slotProps: slotProps
|
|
112
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, {
|
|
94
113
|
id: clipPathId
|
|
95
114
|
}), children]
|
|
96
115
|
});
|
|
97
116
|
});
|
|
98
|
-
exports.LineChart = LineChart;
|
|
99
117
|
process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
100
118
|
// ----------------------------- Warning --------------------------------
|
|
101
119
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -118,11 +136,15 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
118
136
|
fill: _propTypes.default.string,
|
|
119
137
|
label: _propTypes.default.string,
|
|
120
138
|
labelFontSize: _propTypes.default.number,
|
|
139
|
+
labelStyle: _propTypes.default.object,
|
|
121
140
|
position: _propTypes.default.oneOf(['bottom', 'top']),
|
|
122
141
|
slotProps: _propTypes.default.object,
|
|
123
142
|
slots: _propTypes.default.object,
|
|
124
143
|
stroke: _propTypes.default.string,
|
|
125
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,
|
|
126
148
|
tickMaxStep: _propTypes.default.number,
|
|
127
149
|
tickMinStep: _propTypes.default.number,
|
|
128
150
|
tickNumber: _propTypes.default.number,
|
|
@@ -137,6 +159,10 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
137
159
|
dataset: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
138
160
|
desc: _propTypes.default.string,
|
|
139
161
|
disableAxisListener: _propTypes.default.bool,
|
|
162
|
+
/**
|
|
163
|
+
* If `true`, render the line highlight item.
|
|
164
|
+
*/
|
|
165
|
+
disableLineItemHighlight: _propTypes.default.bool,
|
|
140
166
|
height: _propTypes.default.number,
|
|
141
167
|
/**
|
|
142
168
|
* Indicate which axis to display the left of the charts.
|
|
@@ -151,33 +177,33 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
151
177
|
fill: _propTypes.default.string,
|
|
152
178
|
label: _propTypes.default.string,
|
|
153
179
|
labelFontSize: _propTypes.default.number,
|
|
180
|
+
labelStyle: _propTypes.default.object,
|
|
154
181
|
position: _propTypes.default.oneOf(['left', 'right']),
|
|
155
182
|
slotProps: _propTypes.default.object,
|
|
156
183
|
slots: _propTypes.default.object,
|
|
157
184
|
stroke: _propTypes.default.string,
|
|
158
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,
|
|
159
189
|
tickMaxStep: _propTypes.default.number,
|
|
160
190
|
tickMinStep: _propTypes.default.number,
|
|
161
191
|
tickNumber: _propTypes.default.number,
|
|
162
192
|
tickSize: _propTypes.default.number
|
|
163
193
|
}), _propTypes.default.string]),
|
|
194
|
+
/**
|
|
195
|
+
* @deprecated Consider using `slotProps.legend` instead.
|
|
196
|
+
*/
|
|
164
197
|
legend: _propTypes.default.shape({
|
|
165
198
|
classes: _propTypes.default.object,
|
|
166
199
|
direction: _propTypes.default.oneOf(['column', 'row']),
|
|
167
200
|
hidden: _propTypes.default.bool,
|
|
168
|
-
itemWidth: _propTypes.default.number,
|
|
169
|
-
markSize: _propTypes.default.number,
|
|
170
|
-
offset: _propTypes.default.shape({
|
|
171
|
-
x: _propTypes.default.number,
|
|
172
|
-
y: _propTypes.default.number
|
|
173
|
-
}),
|
|
174
201
|
position: _propTypes.default.shape({
|
|
175
202
|
horizontal: _propTypes.default.oneOf(['left', 'middle', 'right']).isRequired,
|
|
176
203
|
vertical: _propTypes.default.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
177
204
|
}),
|
|
178
205
|
slotProps: _propTypes.default.object,
|
|
179
|
-
slots: _propTypes.default.object
|
|
180
|
-
spacing: _propTypes.default.number
|
|
206
|
+
slots: _propTypes.default.object
|
|
181
207
|
}),
|
|
182
208
|
margin: _propTypes.default.shape({
|
|
183
209
|
bottom: _propTypes.default.number,
|
|
@@ -198,11 +224,15 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
198
224
|
fill: _propTypes.default.string,
|
|
199
225
|
label: _propTypes.default.string,
|
|
200
226
|
labelFontSize: _propTypes.default.number,
|
|
227
|
+
labelStyle: _propTypes.default.object,
|
|
201
228
|
position: _propTypes.default.oneOf(['left', 'right']),
|
|
202
229
|
slotProps: _propTypes.default.object,
|
|
203
230
|
slots: _propTypes.default.object,
|
|
204
231
|
stroke: _propTypes.default.string,
|
|
205
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,
|
|
206
236
|
tickMaxStep: _propTypes.default.number,
|
|
207
237
|
tickMinStep: _propTypes.default.number,
|
|
208
238
|
tickNumber: _propTypes.default.number,
|
|
@@ -211,15 +241,18 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
211
241
|
series: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
212
242
|
area: _propTypes.default.bool,
|
|
213
243
|
color: _propTypes.default.string,
|
|
244
|
+
connectNulls: _propTypes.default.bool,
|
|
214
245
|
curve: _propTypes.default.oneOf(['catmullRom', 'linear', 'monotoneX', 'monotoneY', 'natural', 'step', 'stepAfter', 'stepBefore']),
|
|
215
246
|
data: _propTypes.default.arrayOf(_propTypes.default.number),
|
|
216
247
|
dataKey: _propTypes.default.string,
|
|
248
|
+
disableHighlight: _propTypes.default.bool,
|
|
217
249
|
highlightScope: _propTypes.default.shape({
|
|
218
250
|
faded: _propTypes.default.oneOf(['global', 'none', 'series']),
|
|
219
251
|
highlighted: _propTypes.default.oneOf(['item', 'none', 'series'])
|
|
220
252
|
}),
|
|
221
253
|
id: _propTypes.default.string,
|
|
222
254
|
label: _propTypes.default.string,
|
|
255
|
+
showMark: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.bool]),
|
|
223
256
|
stack: _propTypes.default.string,
|
|
224
257
|
stackOffset: _propTypes.default.oneOf(['diverging', 'expand', 'none', 'silhouette', 'wiggle']),
|
|
225
258
|
stackOrder: _propTypes.default.oneOf(['appearance', 'ascending', 'descending', 'insideOut', 'none', 'reverse']),
|
|
@@ -244,6 +277,8 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
244
277
|
axisContent: _propTypes.default.elementType,
|
|
245
278
|
classes: _propTypes.default.object,
|
|
246
279
|
itemContent: _propTypes.default.elementType,
|
|
280
|
+
slotProps: _propTypes.default.object,
|
|
281
|
+
slots: _propTypes.default.object,
|
|
247
282
|
trigger: _propTypes.default.oneOf(['axis', 'item', 'none'])
|
|
248
283
|
}),
|
|
249
284
|
/**
|
|
@@ -259,11 +294,15 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
259
294
|
fill: _propTypes.default.string,
|
|
260
295
|
label: _propTypes.default.string,
|
|
261
296
|
labelFontSize: _propTypes.default.number,
|
|
297
|
+
labelStyle: _propTypes.default.object,
|
|
262
298
|
position: _propTypes.default.oneOf(['bottom', 'top']),
|
|
263
299
|
slotProps: _propTypes.default.object,
|
|
264
300
|
slots: _propTypes.default.object,
|
|
265
301
|
stroke: _propTypes.default.string,
|
|
266
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,
|
|
267
306
|
tickMaxStep: _propTypes.default.number,
|
|
268
307
|
tickMinStep: _propTypes.default.number,
|
|
269
308
|
tickNumber: _propTypes.default.number,
|
|
@@ -288,6 +327,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
288
327
|
id: _propTypes.default.string,
|
|
289
328
|
label: _propTypes.default.string,
|
|
290
329
|
labelFontSize: _propTypes.default.number,
|
|
330
|
+
labelStyle: _propTypes.default.object,
|
|
291
331
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
292
332
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
293
333
|
position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
|
|
@@ -296,6 +336,9 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
296
336
|
slots: _propTypes.default.object,
|
|
297
337
|
stroke: _propTypes.default.string,
|
|
298
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,
|
|
299
342
|
tickMaxStep: _propTypes.default.number,
|
|
300
343
|
tickMinStep: _propTypes.default.number,
|
|
301
344
|
tickNumber: _propTypes.default.number,
|
|
@@ -314,6 +357,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
314
357
|
id: _propTypes.default.string,
|
|
315
358
|
label: _propTypes.default.string,
|
|
316
359
|
labelFontSize: _propTypes.default.number,
|
|
360
|
+
labelStyle: _propTypes.default.object,
|
|
317
361
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
318
362
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
319
363
|
position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
|
|
@@ -322,6 +366,9 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
322
366
|
slots: _propTypes.default.object,
|
|
323
367
|
stroke: _propTypes.default.string,
|
|
324
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,
|
|
325
372
|
tickMaxStep: _propTypes.default.number,
|
|
326
373
|
tickMinStep: _propTypes.default.number,
|
|
327
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. */
|
|
@@ -10,7 +10,7 @@ export interface LineElementClasses {
|
|
|
10
10
|
faded: string;
|
|
11
11
|
}
|
|
12
12
|
export type LineElementClassKey = keyof LineElementClasses;
|
|
13
|
-
|
|
13
|
+
interface LineElementOwnerState {
|
|
14
14
|
id: string;
|
|
15
15
|
color: string;
|
|
16
16
|
isFaded: boolean;
|
|
@@ -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,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface LineHighlightElementClasses {
|
|
3
|
+
/** Styles applied to the root element. */
|
|
4
|
+
root: string;
|
|
5
|
+
}
|
|
6
|
+
export type HighlightElementClassKey = keyof LineHighlightElementClasses;
|
|
7
|
+
interface LineHighlightElementOwnerState {
|
|
8
|
+
id: string;
|
|
9
|
+
color: string;
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
classes?: Partial<LineHighlightElementClasses>;
|
|
13
|
+
}
|
|
14
|
+
export declare function getHighlightElementUtilityClass(slot: string): string;
|
|
15
|
+
export declare const lineHighlightElementClasses: LineHighlightElementClasses;
|
|
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
|
+
*/
|
|
27
|
+
declare function LineHighlightElement(props: LineHighlightElementProps): React.JSX.Element;
|
|
28
|
+
declare namespace LineHighlightElement {
|
|
29
|
+
var propTypes: any;
|
|
30
|
+
}
|
|
31
|
+
export { LineHighlightElement };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.LineHighlightElement = LineHighlightElement;
|
|
8
|
+
exports.getHighlightElementUtilityClass = getHighlightElementUtilityClass;
|
|
9
|
+
exports.lineHighlightElementClasses = void 0;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
|
+
var React = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
+
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
15
|
+
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
|
|
16
|
+
var _styles = require("@mui/material/styles");
|
|
17
|
+
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
const _excluded = ["x", "y", "id", "classes", "color"];
|
|
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
|
+
function getHighlightElementUtilityClass(slot) {
|
|
23
|
+
return (0, _generateUtilityClass.default)('MuiHighlightElement', slot);
|
|
24
|
+
}
|
|
25
|
+
const lineHighlightElementClasses = exports.lineHighlightElementClasses = (0, _generateUtilityClasses.default)('MuiHighlightElement', ['root']);
|
|
26
|
+
const useUtilityClasses = ownerState => {
|
|
27
|
+
const {
|
|
28
|
+
classes,
|
|
29
|
+
id
|
|
30
|
+
} = ownerState;
|
|
31
|
+
const slots = {
|
|
32
|
+
root: ['root', `series-${id}`]
|
|
33
|
+
};
|
|
34
|
+
return (0, _composeClasses.default)(slots, getHighlightElementUtilityClass, classes);
|
|
35
|
+
};
|
|
36
|
+
const HighlightElement = (0, _styles.styled)('circle', {
|
|
37
|
+
name: 'MuiHighlightElement',
|
|
38
|
+
slot: 'Root',
|
|
39
|
+
overridesResolver: (_, styles) => styles.root
|
|
40
|
+
})(({
|
|
41
|
+
ownerState
|
|
42
|
+
}) => ({
|
|
43
|
+
transform: `translate(${ownerState.x}px, ${ownerState.y}px)`,
|
|
44
|
+
transformOrigin: `${ownerState.x}px ${ownerState.y}px`,
|
|
45
|
+
fill: ownerState.color
|
|
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
|
+
*/
|
|
57
|
+
function LineHighlightElement(props) {
|
|
58
|
+
const {
|
|
59
|
+
x,
|
|
60
|
+
y,
|
|
61
|
+
id,
|
|
62
|
+
classes: innerClasses,
|
|
63
|
+
color
|
|
64
|
+
} = props,
|
|
65
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
66
|
+
const ownerState = {
|
|
67
|
+
id,
|
|
68
|
+
classes: innerClasses,
|
|
69
|
+
color,
|
|
70
|
+
x,
|
|
71
|
+
y
|
|
72
|
+
};
|
|
73
|
+
const classes = useUtilityClasses(ownerState);
|
|
74
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(HighlightElement, (0, _extends2.default)({}, other, {
|
|
75
|
+
ownerState: ownerState,
|
|
76
|
+
className: classes.root,
|
|
77
|
+
cx: 0,
|
|
78
|
+
cy: 0,
|
|
79
|
+
r: other.r === undefined ? 5 : other.r
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
process.env.NODE_ENV !== "production" ? LineHighlightElement.propTypes = {
|
|
83
|
+
// ----------------------------- Warning --------------------------------
|
|
84
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
85
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
86
|
+
// ----------------------------------------------------------------------
|
|
87
|
+
classes: _propTypes.default.object
|
|
88
|
+
} : void 0;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { LineHighlightElementProps } from './LineHighlightElement';
|
|
3
|
+
export interface LineHighlightPlotSlotsComponent {
|
|
4
|
+
lineHighlight?: React.JSXElementConstructor<LineHighlightElementProps>;
|
|
5
|
+
}
|
|
6
|
+
export interface LineHighlightPlotSlotComponentProps {
|
|
7
|
+
lineHighlight?: Partial<LineHighlightElementProps>;
|
|
8
|
+
}
|
|
9
|
+
export interface LineHighlightPlotProps extends React.SVGAttributes<SVGSVGElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Overridable component slots.
|
|
12
|
+
* @default {}
|
|
13
|
+
*/
|
|
14
|
+
slots?: LineHighlightPlotSlotsComponent;
|
|
15
|
+
/**
|
|
16
|
+
* The props used for each component slot.
|
|
17
|
+
* @default {}
|
|
18
|
+
*/
|
|
19
|
+
slotProps?: LineHighlightPlotSlotComponentProps;
|
|
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
|
+
*/
|
|
31
|
+
declare function LineHighlightPlot(props: LineHighlightPlotProps): React.JSX.Element | null;
|
|
32
|
+
declare namespace LineHighlightPlot {
|
|
33
|
+
var propTypes: any;
|
|
34
|
+
}
|
|
35
|
+
export { LineHighlightPlot };
|