@mui/x-charts 6.18.0 → 6.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/BarChart.d.ts +7 -0
- package/BarChart/BarChart.js +41 -4
- package/CHANGELOG.md +116 -5
- package/ChartsAxis/ChartsAxis.js +5 -5
- package/ChartsAxis/axisClasses.d.ts +2 -2
- package/ChartsLegend/ChartsLegend.d.ts +1 -0
- package/ChartsLegend/ChartsLegend.js +1 -1
- package/ChartsLegend/chartsLegendClasses.d.ts +1 -1
- package/ChartsLegend/chartsLegendClasses.js +2 -2
- package/ChartsReferenceLine/ChartsReferenceLine.d.ts +10 -0
- package/ChartsReferenceLine/ChartsReferenceLine.js +78 -0
- package/ChartsReferenceLine/ChartsXReferenceLine.d.ts +13 -0
- package/ChartsReferenceLine/ChartsXReferenceLine.js +112 -0
- package/ChartsReferenceLine/ChartsYReferenceLine.d.ts +13 -0
- package/ChartsReferenceLine/ChartsYReferenceLine.js +112 -0
- package/ChartsReferenceLine/chartsReferenceLineClasses.d.ts +15 -0
- package/ChartsReferenceLine/chartsReferenceLineClasses.js +14 -0
- package/ChartsReferenceLine/common.d.ts +41 -0
- package/ChartsReferenceLine/common.js +27 -0
- package/ChartsReferenceLine/index.d.ts +2 -0
- package/ChartsReferenceLine/index.js +27 -0
- package/ChartsReferenceLine/package.json +6 -0
- package/ChartsSurface.d.ts +11 -0
- package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +1 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +8 -4
- package/ChartsTooltip/ChartsItemTooltipContent.d.ts +1 -1
- package/ChartsTooltip/ChartsItemTooltipContent.js +8 -4
- package/ChartsTooltip/ChartsTooltip.d.ts +1 -1
- package/ChartsTooltip/ChartsTooltip.js +13 -5
- package/ChartsTooltip/ChartsTooltipTable.js +3 -3
- package/ChartsTooltip/chartsTooltipClasses.d.ts +21 -0
- package/ChartsTooltip/chartsTooltipClasses.js +12 -0
- package/ChartsTooltip/index.d.ts +1 -0
- package/ChartsTooltip/index.js +11 -0
- package/ChartsTooltip/utils.d.ts +1 -1
- package/ChartsTooltip/utils.js +2 -2
- package/ChartsXAxis/ChartsXAxis.js +9 -5
- package/ChartsYAxis/ChartsYAxis.js +9 -5
- package/LineChart/LineChart.d.ts +7 -0
- package/LineChart/LineChart.js +41 -4
- package/LineChart/LineHighlightPlot.js +1 -1
- package/LineChart/MarkPlot.js +2 -1
- package/PieChart/PieArc.d.ts +5 -2
- package/PieChart/PieArc.js +17 -2
- package/PieChart/PieArcLabel.d.ts +1 -1
- package/PieChart/PieArcLabel.js +5 -10
- package/PieChart/PieArcLabelPlot.js +2 -2
- package/PieChart/PieArcPlot.js +2 -2
- package/PieChart/PieChart.js +34 -4
- package/PieChart/index.d.ts +4 -2
- package/PieChart/index.js +37 -27
- package/ResponsiveChartContainer/index.d.ts +13 -3
- package/ScatterChart/ScatterChart.js +34 -4
- package/SparkLineChart/SparkLineChart.js +22 -0
- package/context/CartesianContextProvider.d.ts +21 -1
- package/context/CartesianContextProvider.js +11 -0
- package/context/DrawingProvider.d.ts +18 -0
- package/context/DrawingProvider.js +6 -0
- package/context/HighlightProvider.d.ts +17 -0
- package/context/InteractionProvider.d.ts +6 -0
- package/context/SeriesContextProvider.d.ts +5 -0
- package/esm/BarChart/BarChart.js +41 -4
- package/esm/ChartsAxis/ChartsAxis.js +6 -5
- package/esm/ChartsLegend/ChartsLegend.js +2 -2
- package/esm/ChartsLegend/chartsLegendClasses.js +1 -1
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +105 -0
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +105 -0
- package/esm/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
- package/esm/ChartsReferenceLine/common.js +20 -0
- package/esm/ChartsReferenceLine/index.js +2 -0
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +8 -4
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +8 -4
- package/esm/ChartsTooltip/ChartsTooltip.js +15 -7
- package/esm/ChartsTooltip/ChartsTooltipTable.js +3 -3
- package/esm/ChartsTooltip/chartsTooltipClasses.js +5 -0
- package/esm/ChartsTooltip/index.js +2 -1
- package/esm/ChartsTooltip/utils.js +1 -1
- package/esm/ChartsXAxis/ChartsXAxis.js +10 -6
- package/esm/ChartsYAxis/ChartsYAxis.js +10 -6
- package/esm/LineChart/LineChart.js +41 -4
- package/esm/LineChart/LineHighlightPlot.js +1 -1
- package/esm/LineChart/MarkPlot.js +2 -1
- package/esm/PieChart/PieArc.js +18 -2
- package/esm/PieChart/PieArcLabel.js +7 -11
- package/esm/PieChart/PieArcLabelPlot.js +1 -1
- package/esm/PieChart/PieArcPlot.js +1 -1
- package/esm/PieChart/PieChart.js +34 -4
- package/esm/PieChart/index.js +2 -2
- package/esm/ScatterChart/ScatterChart.js +34 -4
- package/esm/SparkLineChart/SparkLineChart.js +22 -0
- package/esm/context/CartesianContextProvider.js +11 -0
- package/esm/context/DrawingProvider.js +6 -0
- package/esm/index.js +1 -0
- package/esm/internals/geometry.js +2 -2
- package/hooks/useScale.d.ts +2 -2
- package/index.d.ts +1 -0
- package/index.js +12 -1
- package/internals/components/ChartsText.d.ts +1 -1
- package/internals/geometry.d.ts +2 -2
- package/internals/geometry.js +2 -2
- package/internals/isBandScale.d.ts +3 -1
- package/internals/utils.d.ts +5 -0
- package/legacy/BarChart/BarChart.js +41 -4
- package/legacy/ChartsAxis/ChartsAxis.js +6 -5
- package/legacy/ChartsLegend/ChartsLegend.js +2 -2
- package/legacy/ChartsLegend/chartsLegendClasses.js +1 -1
- package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
- package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +105 -0
- package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +105 -0
- package/legacy/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
- package/legacy/ChartsReferenceLine/common.js +20 -0
- package/legacy/ChartsReferenceLine/index.js +2 -0
- package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +8 -4
- package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +8 -4
- package/legacy/ChartsTooltip/ChartsTooltip.js +20 -12
- package/legacy/ChartsTooltip/ChartsTooltipTable.js +3 -3
- package/legacy/ChartsTooltip/chartsTooltipClasses.js +5 -0
- package/legacy/ChartsTooltip/index.js +2 -1
- package/legacy/ChartsTooltip/utils.js +1 -1
- package/legacy/ChartsXAxis/ChartsXAxis.js +15 -12
- package/legacy/ChartsYAxis/ChartsYAxis.js +15 -12
- package/legacy/LineChart/LineChart.js +41 -4
- package/legacy/LineChart/LineHighlightPlot.js +1 -1
- package/legacy/LineChart/MarkPlot.js +2 -1
- package/legacy/PieChart/PieArc.js +18 -2
- package/legacy/PieChart/PieArcLabel.js +7 -11
- package/legacy/PieChart/PieArcLabelPlot.js +1 -1
- package/legacy/PieChart/PieArcPlot.js +1 -1
- package/legacy/PieChart/PieChart.js +34 -4
- package/legacy/PieChart/index.js +2 -2
- package/legacy/ScatterChart/ScatterChart.js +34 -4
- package/legacy/SparkLineChart/SparkLineChart.js +22 -0
- package/legacy/context/CartesianContextProvider.js +11 -0
- package/legacy/context/DrawingProvider.js +6 -0
- package/legacy/index.js +2 -1
- package/legacy/internals/geometry.js +2 -2
- package/models/axis.d.ts +33 -13
- package/models/layout.d.ts +6 -0
- package/models/seriesType/common.d.ts +16 -0
- package/modern/BarChart/BarChart.js +41 -4
- package/modern/ChartsAxis/ChartsAxis.js +5 -5
- package/modern/ChartsLegend/ChartsLegend.js +2 -2
- package/modern/ChartsLegend/chartsLegendClasses.js +1 -1
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
- package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +104 -0
- package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +104 -0
- package/modern/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
- package/modern/ChartsReferenceLine/common.js +20 -0
- package/modern/ChartsReferenceLine/index.js +2 -0
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +8 -4
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +8 -4
- package/modern/ChartsTooltip/ChartsTooltip.js +15 -7
- package/modern/ChartsTooltip/ChartsTooltipTable.js +3 -3
- package/modern/ChartsTooltip/chartsTooltipClasses.js +5 -0
- package/modern/ChartsTooltip/index.js +2 -1
- package/modern/ChartsTooltip/utils.js +1 -1
- package/modern/ChartsXAxis/ChartsXAxis.js +9 -5
- package/modern/ChartsYAxis/ChartsYAxis.js +9 -5
- package/modern/LineChart/LineChart.js +41 -4
- package/modern/LineChart/LineHighlightPlot.js +1 -1
- package/modern/LineChart/MarkPlot.js +2 -1
- package/modern/PieChart/PieArc.js +18 -2
- package/modern/PieChart/PieArcLabel.js +7 -11
- package/modern/PieChart/PieArcLabelPlot.js +1 -1
- package/modern/PieChart/PieArcPlot.js +1 -1
- package/modern/PieChart/PieChart.js +34 -4
- package/modern/PieChart/index.js +2 -2
- package/modern/ScatterChart/ScatterChart.js +34 -4
- package/modern/SparkLineChart/SparkLineChart.js +22 -0
- package/modern/context/CartesianContextProvider.js +11 -0
- package/modern/context/DrawingProvider.js +6 -0
- package/modern/index.js +2 -1
- package/modern/internals/geometry.js +2 -2
- package/package.json +1 -1
- package/themeAugmentation/components.d.ts +1 -0
- package/themeAugmentation/overrides.d.ts +2 -0
- package/ChartsTooltip/tooltipClasses.d.ts +0 -13
- package/ChartsTooltip/tooltipClasses.js +0 -12
- package/esm/ChartsTooltip/tooltipClasses.js +0 -5
- package/legacy/ChartsTooltip/tooltipClasses.js +0 -5
- package/modern/ChartsTooltip/tooltipClasses.js +0 -5
|
@@ -129,10 +129,28 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
129
129
|
* Data to plot.
|
|
130
130
|
*/
|
|
131
131
|
data: PropTypes.arrayOf(PropTypes.number).isRequired,
|
|
132
|
+
/**
|
|
133
|
+
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
134
|
+
*/
|
|
132
135
|
dataset: PropTypes.arrayOf(PropTypes.object),
|
|
133
136
|
desc: PropTypes.string,
|
|
137
|
+
/**
|
|
138
|
+
* If `true`, the charts will not listen to the mouse move event.
|
|
139
|
+
* It might break interactive features, but will improve performance.
|
|
140
|
+
* @default false
|
|
141
|
+
*/
|
|
134
142
|
disableAxisListener: PropTypes.bool,
|
|
143
|
+
/**
|
|
144
|
+
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
145
|
+
* @default undefined
|
|
146
|
+
*/
|
|
135
147
|
height: PropTypes.number,
|
|
148
|
+
/**
|
|
149
|
+
* The margin between the SVG and the drawing area.
|
|
150
|
+
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
151
|
+
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
152
|
+
* @default object Depends on the charts type.
|
|
153
|
+
*/
|
|
136
154
|
margin: PropTypes.shape({
|
|
137
155
|
bottom: PropTypes.number,
|
|
138
156
|
left: PropTypes.number,
|
|
@@ -188,6 +206,10 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
188
206
|
x: PropTypes.number,
|
|
189
207
|
y: PropTypes.number
|
|
190
208
|
}),
|
|
209
|
+
/**
|
|
210
|
+
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
211
|
+
* @default undefined
|
|
212
|
+
*/
|
|
191
213
|
width: PropTypes.number,
|
|
192
214
|
/**
|
|
193
215
|
* The xAxis configuration.
|
|
@@ -221,7 +221,14 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
221
221
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
222
222
|
// ----------------------------------------------------------------------
|
|
223
223
|
children: PropTypes.node,
|
|
224
|
+
/**
|
|
225
|
+
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
226
|
+
*/
|
|
224
227
|
dataset: PropTypes.arrayOf(PropTypes.object),
|
|
228
|
+
/**
|
|
229
|
+
* The configuration of the x-axes.
|
|
230
|
+
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
231
|
+
*/
|
|
225
232
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
226
233
|
axisId: PropTypes.string,
|
|
227
234
|
classes: PropTypes.object,
|
|
@@ -252,6 +259,10 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
252
259
|
tickSize: PropTypes.number,
|
|
253
260
|
valueFormatter: PropTypes.func
|
|
254
261
|
})),
|
|
262
|
+
/**
|
|
263
|
+
* The configuration of the y-axes.
|
|
264
|
+
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
265
|
+
*/
|
|
255
266
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
256
267
|
axisId: PropTypes.string,
|
|
257
268
|
classes: PropTypes.object,
|
|
@@ -46,6 +46,12 @@ process.env.NODE_ENV !== "production" ? DrawingProvider.propTypes = {
|
|
|
46
46
|
// ----------------------------------------------------------------------
|
|
47
47
|
children: PropTypes.node,
|
|
48
48
|
height: PropTypes.number.isRequired,
|
|
49
|
+
/**
|
|
50
|
+
* The margin between the SVG and the drawing area.
|
|
51
|
+
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
52
|
+
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
53
|
+
* @default object Depends on the charts type.
|
|
54
|
+
*/
|
|
49
55
|
margin: PropTypes.shape({
|
|
50
56
|
bottom: PropTypes.number,
|
|
51
57
|
left: PropTypes.number,
|
package/esm/index.js
CHANGED
|
@@ -6,8 +6,8 @@ let warnedOnce = false;
|
|
|
6
6
|
* Return the minimal translation along the x-axis to avoid overflow of a rectangle of a given width, height, and rotation.
|
|
7
7
|
* This assumes that all rectangles have the same height and angle between -90 and 90.
|
|
8
8
|
* Otherwise it would be problematic because you need the height/width of the next rectangle to do the correct computation.
|
|
9
|
-
* @param width the side along the x
|
|
10
|
-
* @param height the side along the y
|
|
9
|
+
* @param width the side along the x-axis.
|
|
10
|
+
* @param height the side along the y-axis.
|
|
11
11
|
* @param angle the rotation in degrees.
|
|
12
12
|
*/
|
|
13
13
|
export function getMinXTranslation(width, height, angle = 0) {
|
package/hooks/useScale.d.ts
CHANGED
|
@@ -6,5 +6,5 @@ import { D3Scale } from '../models/axis';
|
|
|
6
6
|
* @returns (value: any) => number
|
|
7
7
|
*/
|
|
8
8
|
export declare function getValueToPositionMapper(scale: D3Scale): (value: any) => number;
|
|
9
|
-
export declare function useXScale(identifier?: number | string): import("d3-scale").ScaleBand<
|
|
10
|
-
export declare function useYScale(identifier?: number | string): import("d3-scale").ScaleBand<
|
|
9
|
+
export declare function useXScale(identifier?: number | string): import("d3-scale").ScaleBand<string | number | Date> | import("d3-scale").ScalePoint<string | number | Date> | import("d3-scale").ScaleLogarithmic<number, number, never> | import("d3-scale").ScalePower<number, number, never> | import("d3-scale").ScaleTime<number, number, never> | import("d3-scale").ScaleLinear<number, number, never>;
|
|
10
|
+
export declare function useYScale(identifier?: number | string): import("d3-scale").ScaleBand<string | number | Date> | import("d3-scale").ScalePoint<string | number | Date> | import("d3-scale").ScaleLogarithmic<number, number, never> | import("d3-scale").ScalePower<number, number, never> | import("d3-scale").ScaleTime<number, number, never> | import("d3-scale").ScaleLinear<number, number, never>;
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts v6.18.
|
|
2
|
+
* @mui/x-charts v6.18.2
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -76,6 +76,17 @@ Object.keys(_ChartsClipPath).forEach(function (key) {
|
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
});
|
|
79
|
+
var _ChartsReferenceLine = require("./ChartsReferenceLine");
|
|
80
|
+
Object.keys(_ChartsReferenceLine).forEach(function (key) {
|
|
81
|
+
if (key === "default" || key === "__esModule") return;
|
|
82
|
+
if (key in exports && exports[key] === _ChartsReferenceLine[key]) return;
|
|
83
|
+
Object.defineProperty(exports, key, {
|
|
84
|
+
enumerable: true,
|
|
85
|
+
get: function () {
|
|
86
|
+
return _ChartsReferenceLine[key];
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
});
|
|
79
90
|
var _ChartsAxis = require("./ChartsAxis");
|
|
80
91
|
Object.keys(_ChartsAxis).forEach(function (key) {
|
|
81
92
|
if (key === "default" || key === "__esModule") return;
|
package/internals/geometry.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Return the minimal translation along the x-axis to avoid overflow of a rectangle of a given width, height, and rotation.
|
|
3
3
|
* This assumes that all rectangles have the same height and angle between -90 and 90.
|
|
4
4
|
* Otherwise it would be problematic because you need the height/width of the next rectangle to do the correct computation.
|
|
5
|
-
* @param width the side along the x
|
|
6
|
-
* @param height the side along the y
|
|
5
|
+
* @param width the side along the x-axis.
|
|
6
|
+
* @param height the side along the y-axis.
|
|
7
7
|
* @param angle the rotation in degrees.
|
|
8
8
|
*/
|
|
9
9
|
export declare function getMinXTranslation(width: number, height: number, angle?: number): number;
|
package/internals/geometry.js
CHANGED
|
@@ -12,8 +12,8 @@ let warnedOnce = false;
|
|
|
12
12
|
* Return the minimal translation along the x-axis to avoid overflow of a rectangle of a given width, height, and rotation.
|
|
13
13
|
* This assumes that all rectangles have the same height and angle between -90 and 90.
|
|
14
14
|
* Otherwise it would be problematic because you need the height/width of the next rectangle to do the correct computation.
|
|
15
|
-
* @param width the side along the x
|
|
16
|
-
* @param height the side along the y
|
|
15
|
+
* @param width the side along the x-axis.
|
|
16
|
+
* @param height the side along the y-axis.
|
|
17
17
|
* @param angle the rotation in degrees.
|
|
18
18
|
*/
|
|
19
19
|
function getMinXTranslation(width, height, angle = 0) {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { ScaleBand, ScalePoint } from 'd3-scale';
|
|
2
2
|
import { D3Scale } from '../models/axis';
|
|
3
|
-
export declare function isBandScale
|
|
3
|
+
export declare function isBandScale<T extends {
|
|
4
|
+
toString(): string;
|
|
5
|
+
}>(scale: D3Scale<T>): scale is ScaleBand<T> | ScalePoint<T>;
|
package/internals/utils.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
export type SymbolsTypes = 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye';
|
|
2
2
|
export declare function getSymbol(shape: SymbolsTypes): number;
|
|
3
|
+
type Without<T, U> = {
|
|
4
|
+
[P in Exclude<keyof T, keyof U>]?: never;
|
|
5
|
+
};
|
|
6
|
+
export type XOR<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
|
|
7
|
+
export {};
|
|
@@ -119,6 +119,13 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
119
119
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
120
120
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
121
121
|
// ----------------------------------------------------------------------
|
|
122
|
+
/**
|
|
123
|
+
* Object `{ x, y }` that defines how the charts highlight the mouse position along the x- and y-axes.
|
|
124
|
+
* The two properties accept the following values:
|
|
125
|
+
* - 'none': display nothing.
|
|
126
|
+
* - 'line': display a line at the current mouse position.
|
|
127
|
+
* - 'band': display a band at the current mouse position. Only available with band scale.
|
|
128
|
+
*/
|
|
122
129
|
axisHighlight: PropTypes.shape({
|
|
123
130
|
x: PropTypes.oneOf(['band', 'line', 'none']),
|
|
124
131
|
y: PropTypes.oneOf(['band', 'line', 'none'])
|
|
@@ -129,7 +136,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
129
136
|
* @default xAxisIds[0] The id of the first provided axis
|
|
130
137
|
*/
|
|
131
138
|
bottomAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
132
|
-
axisId: PropTypes.string
|
|
139
|
+
axisId: PropTypes.string,
|
|
133
140
|
classes: PropTypes.object,
|
|
134
141
|
disableLine: PropTypes.bool,
|
|
135
142
|
disableTicks: PropTypes.bool,
|
|
@@ -156,9 +163,21 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
156
163
|
* Color palette used to colorize multiple series.
|
|
157
164
|
*/
|
|
158
165
|
colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
|
|
166
|
+
/**
|
|
167
|
+
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
168
|
+
*/
|
|
159
169
|
dataset: PropTypes.arrayOf(PropTypes.object),
|
|
160
170
|
desc: PropTypes.string,
|
|
171
|
+
/**
|
|
172
|
+
* If `true`, the charts will not listen to the mouse move event.
|
|
173
|
+
* It might break interactive features, but will improve performance.
|
|
174
|
+
* @default false
|
|
175
|
+
*/
|
|
161
176
|
disableAxisListener: PropTypes.bool,
|
|
177
|
+
/**
|
|
178
|
+
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
179
|
+
* @default undefined
|
|
180
|
+
*/
|
|
162
181
|
height: PropTypes.number,
|
|
163
182
|
layout: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
164
183
|
/**
|
|
@@ -167,7 +186,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
167
186
|
* @default yAxisIds[0] The id of the first provided axis
|
|
168
187
|
*/
|
|
169
188
|
leftAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
170
|
-
axisId: PropTypes.string
|
|
189
|
+
axisId: PropTypes.string,
|
|
171
190
|
classes: PropTypes.object,
|
|
172
191
|
disableLine: PropTypes.bool,
|
|
173
192
|
disableTicks: PropTypes.bool,
|
|
@@ -202,6 +221,12 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
202
221
|
slotProps: PropTypes.object,
|
|
203
222
|
slots: PropTypes.object
|
|
204
223
|
}),
|
|
224
|
+
/**
|
|
225
|
+
* The margin between the SVG and the drawing area.
|
|
226
|
+
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
227
|
+
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
228
|
+
* @default object Depends on the charts type.
|
|
229
|
+
*/
|
|
205
230
|
margin: PropTypes.shape({
|
|
206
231
|
bottom: PropTypes.number,
|
|
207
232
|
left: PropTypes.number,
|
|
@@ -214,7 +239,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
214
239
|
* @default null
|
|
215
240
|
*/
|
|
216
241
|
rightAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
217
|
-
axisId: PropTypes.string
|
|
242
|
+
axisId: PropTypes.string,
|
|
218
243
|
classes: PropTypes.object,
|
|
219
244
|
disableLine: PropTypes.bool,
|
|
220
245
|
disableTicks: PropTypes.bool,
|
|
@@ -285,7 +310,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
285
310
|
* @default null
|
|
286
311
|
*/
|
|
287
312
|
topAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
288
|
-
axisId: PropTypes.string
|
|
313
|
+
axisId: PropTypes.string,
|
|
289
314
|
classes: PropTypes.object,
|
|
290
315
|
disableLine: PropTypes.bool,
|
|
291
316
|
disableTicks: PropTypes.bool,
|
|
@@ -312,7 +337,15 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
312
337
|
x: PropTypes.number,
|
|
313
338
|
y: PropTypes.number
|
|
314
339
|
}),
|
|
340
|
+
/**
|
|
341
|
+
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
342
|
+
* @default undefined
|
|
343
|
+
*/
|
|
315
344
|
width: PropTypes.number,
|
|
345
|
+
/**
|
|
346
|
+
* The configuration of the x-axes.
|
|
347
|
+
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
348
|
+
*/
|
|
316
349
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
317
350
|
axisId: PropTypes.string,
|
|
318
351
|
classes: PropTypes.object,
|
|
@@ -343,6 +376,10 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
343
376
|
tickSize: PropTypes.number,
|
|
344
377
|
valueFormatter: PropTypes.func
|
|
345
378
|
})),
|
|
379
|
+
/**
|
|
380
|
+
* The configuration of the y-axes.
|
|
381
|
+
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
382
|
+
*/
|
|
346
383
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
347
384
|
axisId: PropTypes.string,
|
|
348
385
|
classes: PropTypes.object,
|
|
@@ -12,7 +12,8 @@ var getAxisId = function getAxisId(propsValue) {
|
|
|
12
12
|
return null;
|
|
13
13
|
}
|
|
14
14
|
if (_typeof(propsValue) === 'object') {
|
|
15
|
-
|
|
15
|
+
var _propsValue$axisId;
|
|
16
|
+
return (_propsValue$axisId = propsValue.axisId) != null ? _propsValue$axisId : null;
|
|
16
17
|
}
|
|
17
18
|
return propsValue;
|
|
18
19
|
};
|
|
@@ -98,7 +99,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
98
99
|
* @default xAxisIds[0] The id of the first provided axis
|
|
99
100
|
*/
|
|
100
101
|
bottomAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
101
|
-
axisId: PropTypes.string
|
|
102
|
+
axisId: PropTypes.string,
|
|
102
103
|
classes: PropTypes.object,
|
|
103
104
|
disableLine: PropTypes.bool,
|
|
104
105
|
disableTicks: PropTypes.bool,
|
|
@@ -125,7 +126,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
125
126
|
* @default yAxisIds[0] The id of the first provided axis
|
|
126
127
|
*/
|
|
127
128
|
leftAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
128
|
-
axisId: PropTypes.string
|
|
129
|
+
axisId: PropTypes.string,
|
|
129
130
|
classes: PropTypes.object,
|
|
130
131
|
disableLine: PropTypes.bool,
|
|
131
132
|
disableTicks: PropTypes.bool,
|
|
@@ -152,7 +153,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
152
153
|
* @default null
|
|
153
154
|
*/
|
|
154
155
|
rightAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
155
|
-
axisId: PropTypes.string
|
|
156
|
+
axisId: PropTypes.string,
|
|
156
157
|
classes: PropTypes.object,
|
|
157
158
|
disableLine: PropTypes.bool,
|
|
158
159
|
disableTicks: PropTypes.bool,
|
|
@@ -189,7 +190,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
|
|
|
189
190
|
* @default null
|
|
190
191
|
*/
|
|
191
192
|
topAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
192
|
-
axisId: PropTypes.string
|
|
193
|
+
axisId: PropTypes.string,
|
|
193
194
|
classes: PropTypes.object,
|
|
194
195
|
disableLine: PropTypes.bool,
|
|
195
196
|
disableTicks: PropTypes.bool,
|
|
@@ -11,7 +11,7 @@ import { useThemeProps, useTheme, styled } from '@mui/material/styles';
|
|
|
11
11
|
import { DrawingContext } from '../context/DrawingProvider';
|
|
12
12
|
import { getSeriesToDisplay } from './utils';
|
|
13
13
|
import { SeriesContext } from '../context/SeriesContextProvider';
|
|
14
|
-
import {
|
|
14
|
+
import { getLegendUtilityClass } from './chartsLegendClasses';
|
|
15
15
|
import { ChartsText, getWordsByLines } from '../internals/components/ChartsText';
|
|
16
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -24,7 +24,7 @@ var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
|
24
24
|
label: ['label'],
|
|
25
25
|
series: ['series']
|
|
26
26
|
};
|
|
27
|
-
return composeClasses(slots,
|
|
27
|
+
return composeClasses(slots, getLegendUtilityClass, classes);
|
|
28
28
|
};
|
|
29
29
|
export var ChartsLegendRoot = styled('g', {
|
|
30
30
|
name: 'MuiChartsLegend',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
2
|
-
export function
|
|
2
|
+
export function getLegendUtilityClass(slot) {
|
|
3
3
|
return generateUtilityClass('MuiChartsLegend', slot);
|
|
4
4
|
}
|
|
5
5
|
export var legendClasses = generateUtilityClasses('MuiChartsLegend', ['root', 'series', 'mark', 'label', 'column', 'row']);
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { ChartsXReferenceLine } from './ChartsXReferenceLine';
|
|
5
|
+
import { ChartsYReferenceLine } from './ChartsYReferenceLine';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
function ChartsReferenceLine(props) {
|
|
8
|
+
if (props.x !== undefined && props.y !== undefined) {
|
|
9
|
+
throw new Error('MUI-X: The ChartsReferenceLine can not have both `x` and `y` props set.');
|
|
10
|
+
}
|
|
11
|
+
if (props.x === undefined && props.y === undefined) {
|
|
12
|
+
throw new Error('MUI-X: The ChartsReferenceLine should have a value in `x` or `y` prop.');
|
|
13
|
+
}
|
|
14
|
+
if (props.x !== undefined) {
|
|
15
|
+
return /*#__PURE__*/_jsx(ChartsXReferenceLine, _extends({}, props));
|
|
16
|
+
}
|
|
17
|
+
return /*#__PURE__*/_jsx(ChartsYReferenceLine, _extends({}, props));
|
|
18
|
+
}
|
|
19
|
+
process.env.NODE_ENV !== "production" ? ChartsReferenceLine.propTypes = {
|
|
20
|
+
// ----------------------------- Warning --------------------------------
|
|
21
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
22
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
23
|
+
// ----------------------------------------------------------------------
|
|
24
|
+
/**
|
|
25
|
+
* The id of the axis used for the reference value.
|
|
26
|
+
* @default The `id` of the first defined axis.
|
|
27
|
+
*/
|
|
28
|
+
axisId: PropTypes.string,
|
|
29
|
+
/**
|
|
30
|
+
* Override or extend the styles applied to the component.
|
|
31
|
+
*/
|
|
32
|
+
classes: PropTypes.object,
|
|
33
|
+
/**
|
|
34
|
+
* The label to display along the reference line.
|
|
35
|
+
*/
|
|
36
|
+
label: PropTypes.string,
|
|
37
|
+
/**
|
|
38
|
+
* The alignment if the label is in the chart drawing area.
|
|
39
|
+
* @default 'middle'
|
|
40
|
+
*/
|
|
41
|
+
labelAlign: PropTypes.oneOf(['end', 'middle', 'start']),
|
|
42
|
+
/**
|
|
43
|
+
* The style applied to the label.
|
|
44
|
+
*/
|
|
45
|
+
labelStyle: PropTypes.object,
|
|
46
|
+
/**
|
|
47
|
+
* The style applied to the line.
|
|
48
|
+
*/
|
|
49
|
+
lineStyle: PropTypes.object,
|
|
50
|
+
/**
|
|
51
|
+
* Additional space arround the label in px.
|
|
52
|
+
* Can be a number or an object `{ x, y }` to distinguish space with the reference line and space with axes.
|
|
53
|
+
* @default 5
|
|
54
|
+
*/
|
|
55
|
+
spacing: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
56
|
+
x: PropTypes.number,
|
|
57
|
+
y: PropTypes.number
|
|
58
|
+
})]),
|
|
59
|
+
/**
|
|
60
|
+
* The x value associated with the reference line.
|
|
61
|
+
* If defined the reference line will be vertical.
|
|
62
|
+
*/
|
|
63
|
+
x: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]),
|
|
64
|
+
/**
|
|
65
|
+
* The y value associated with the reference line.
|
|
66
|
+
* If defined the reference line will be horizontal.
|
|
67
|
+
*/
|
|
68
|
+
y: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string])
|
|
69
|
+
} : void 0;
|
|
70
|
+
export { ChartsReferenceLine };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
5
|
+
import { useDrawingArea, useXScale } from '../hooks';
|
|
6
|
+
import { ReferenceLineRoot } from './common';
|
|
7
|
+
import { ChartsText } from '../internals/components/ChartsText';
|
|
8
|
+
import { getReferenceLineUtilityClass } from './chartsReferenceLineClasses';
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
var getTextParams = function getTextParams(_ref) {
|
|
12
|
+
var top = _ref.top,
|
|
13
|
+
height = _ref.height,
|
|
14
|
+
spacingY = _ref.spacingY,
|
|
15
|
+
_ref$labelAlign = _ref.labelAlign,
|
|
16
|
+
labelAlign = _ref$labelAlign === void 0 ? 'middle' : _ref$labelAlign;
|
|
17
|
+
switch (labelAlign) {
|
|
18
|
+
case 'start':
|
|
19
|
+
return {
|
|
20
|
+
y: top + spacingY,
|
|
21
|
+
style: {
|
|
22
|
+
dominantBaseline: 'hanging',
|
|
23
|
+
textAnchor: 'start'
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
case 'end':
|
|
27
|
+
return {
|
|
28
|
+
y: top + height - spacingY,
|
|
29
|
+
style: {
|
|
30
|
+
dominantBaseline: 'auto',
|
|
31
|
+
textAnchor: 'start'
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
default:
|
|
35
|
+
return {
|
|
36
|
+
y: top + height / 2,
|
|
37
|
+
style: {
|
|
38
|
+
dominantBaseline: 'central',
|
|
39
|
+
textAnchor: 'start'
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
export function getXReferenceLineClasses(classes) {
|
|
45
|
+
return composeClasses({
|
|
46
|
+
root: ['root', 'vertical'],
|
|
47
|
+
line: ['line'],
|
|
48
|
+
label: ['label']
|
|
49
|
+
}, getReferenceLineUtilityClass, classes);
|
|
50
|
+
}
|
|
51
|
+
var warnedOnce = false;
|
|
52
|
+
function ChartsXReferenceLine(props) {
|
|
53
|
+
var _spacing$x, _spacing$y;
|
|
54
|
+
var x = props.x,
|
|
55
|
+
_props$label = props.label,
|
|
56
|
+
label = _props$label === void 0 ? '' : _props$label,
|
|
57
|
+
_props$spacing = props.spacing,
|
|
58
|
+
spacing = _props$spacing === void 0 ? 5 : _props$spacing,
|
|
59
|
+
inClasses = props.classes,
|
|
60
|
+
labelAlign = props.labelAlign,
|
|
61
|
+
lineStyle = props.lineStyle,
|
|
62
|
+
labelStyle = props.labelStyle,
|
|
63
|
+
axisId = props.axisId;
|
|
64
|
+
var _useDrawingArea = useDrawingArea(),
|
|
65
|
+
top = _useDrawingArea.top,
|
|
66
|
+
height = _useDrawingArea.height;
|
|
67
|
+
var xAxisScale = useXScale(axisId);
|
|
68
|
+
var xPosition = xAxisScale(x);
|
|
69
|
+
if (xPosition === undefined) {
|
|
70
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
71
|
+
if (!warnedOnce) {
|
|
72
|
+
warnedOnce = true;
|
|
73
|
+
console.error("MUI X: the value ".concat(x, " does not exist in the data of x axis with id ").concat(axisId, "."));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
var d = "M ".concat(xPosition, " ").concat(top, " l 0 ").concat(height);
|
|
79
|
+
var classes = getXReferenceLineClasses(inClasses);
|
|
80
|
+
var spacingX = _typeof(spacing) === 'object' ? (_spacing$x = spacing.x) != null ? _spacing$x : 0 : spacing;
|
|
81
|
+
var spacingY = _typeof(spacing) === 'object' ? (_spacing$y = spacing.y) != null ? _spacing$y : 0 : spacing;
|
|
82
|
+
var textParams = _extends({
|
|
83
|
+
x: xPosition + spacingX,
|
|
84
|
+
text: label,
|
|
85
|
+
fontSize: 12
|
|
86
|
+
}, getTextParams({
|
|
87
|
+
top: top,
|
|
88
|
+
height: height,
|
|
89
|
+
spacingY: spacingY,
|
|
90
|
+
labelAlign: labelAlign
|
|
91
|
+
}), {
|
|
92
|
+
className: classes.label
|
|
93
|
+
});
|
|
94
|
+
return /*#__PURE__*/_jsxs(ReferenceLineRoot, {
|
|
95
|
+
className: classes.root,
|
|
96
|
+
children: [/*#__PURE__*/_jsx("path", {
|
|
97
|
+
d: d,
|
|
98
|
+
className: classes.line,
|
|
99
|
+
style: lineStyle
|
|
100
|
+
}), /*#__PURE__*/_jsx(ChartsText, _extends({}, textParams, {
|
|
101
|
+
style: _extends({}, textParams.style, labelStyle)
|
|
102
|
+
}))]
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
export { ChartsXReferenceLine };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
5
|
+
import { useDrawingArea, useYScale } from '../hooks';
|
|
6
|
+
import { ReferenceLineRoot } from './common';
|
|
7
|
+
import { ChartsText } from '../internals/components/ChartsText';
|
|
8
|
+
import { getReferenceLineUtilityClass } from './chartsReferenceLineClasses';
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
var getTextParams = function getTextParams(_ref) {
|
|
12
|
+
var left = _ref.left,
|
|
13
|
+
width = _ref.width,
|
|
14
|
+
spacingX = _ref.spacingX,
|
|
15
|
+
_ref$labelAlign = _ref.labelAlign,
|
|
16
|
+
labelAlign = _ref$labelAlign === void 0 ? 'middle' : _ref$labelAlign;
|
|
17
|
+
switch (labelAlign) {
|
|
18
|
+
case 'start':
|
|
19
|
+
return {
|
|
20
|
+
x: left + spacingX,
|
|
21
|
+
style: {
|
|
22
|
+
dominantBaseline: 'auto',
|
|
23
|
+
textAnchor: 'start'
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
case 'end':
|
|
27
|
+
return {
|
|
28
|
+
x: left + width - spacingX,
|
|
29
|
+
style: {
|
|
30
|
+
dominantBaseline: 'auto',
|
|
31
|
+
textAnchor: 'end'
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
default:
|
|
35
|
+
return {
|
|
36
|
+
x: left + width / 2,
|
|
37
|
+
style: {
|
|
38
|
+
dominantBaseline: 'auto',
|
|
39
|
+
textAnchor: 'middle'
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
var warnedOnce = false;
|
|
45
|
+
export function getYReferenceLineClasses(classes) {
|
|
46
|
+
return composeClasses({
|
|
47
|
+
root: ['root', 'horizontal'],
|
|
48
|
+
line: ['line'],
|
|
49
|
+
label: ['label']
|
|
50
|
+
}, getReferenceLineUtilityClass, classes);
|
|
51
|
+
}
|
|
52
|
+
function ChartsYReferenceLine(props) {
|
|
53
|
+
var _spacing$x, _spacing$y;
|
|
54
|
+
var y = props.y,
|
|
55
|
+
_props$label = props.label,
|
|
56
|
+
label = _props$label === void 0 ? '' : _props$label,
|
|
57
|
+
_props$spacing = props.spacing,
|
|
58
|
+
spacing = _props$spacing === void 0 ? 5 : _props$spacing,
|
|
59
|
+
inClasses = props.classes,
|
|
60
|
+
labelAlign = props.labelAlign,
|
|
61
|
+
lineStyle = props.lineStyle,
|
|
62
|
+
labelStyle = props.labelStyle,
|
|
63
|
+
axisId = props.axisId;
|
|
64
|
+
var _useDrawingArea = useDrawingArea(),
|
|
65
|
+
left = _useDrawingArea.left,
|
|
66
|
+
width = _useDrawingArea.width;
|
|
67
|
+
var yAxisScale = useYScale(axisId);
|
|
68
|
+
var yPosition = yAxisScale(y);
|
|
69
|
+
if (yPosition === undefined) {
|
|
70
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
71
|
+
if (!warnedOnce) {
|
|
72
|
+
warnedOnce = true;
|
|
73
|
+
console.error("MUI X: the value ".concat(y, " does not exist in the data of y axis with id ").concat(axisId, "."));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
var d = "M ".concat(left, " ").concat(yPosition, " l ").concat(width, " 0");
|
|
79
|
+
var classes = getYReferenceLineClasses(inClasses);
|
|
80
|
+
var spacingX = _typeof(spacing) === 'object' ? (_spacing$x = spacing.x) != null ? _spacing$x : 0 : spacing;
|
|
81
|
+
var spacingY = _typeof(spacing) === 'object' ? (_spacing$y = spacing.y) != null ? _spacing$y : 0 : spacing;
|
|
82
|
+
var textParams = _extends({
|
|
83
|
+
y: yPosition - spacingY,
|
|
84
|
+
text: label,
|
|
85
|
+
fontSize: 12
|
|
86
|
+
}, getTextParams({
|
|
87
|
+
left: left,
|
|
88
|
+
width: width,
|
|
89
|
+
spacingX: spacingX,
|
|
90
|
+
labelAlign: labelAlign
|
|
91
|
+
}), {
|
|
92
|
+
className: classes.label
|
|
93
|
+
});
|
|
94
|
+
return /*#__PURE__*/_jsxs(ReferenceLineRoot, {
|
|
95
|
+
className: classes.root,
|
|
96
|
+
children: [/*#__PURE__*/_jsx("path", {
|
|
97
|
+
d: d,
|
|
98
|
+
className: classes.line,
|
|
99
|
+
style: lineStyle
|
|
100
|
+
}), /*#__PURE__*/_jsx(ChartsText, _extends({}, textParams, {
|
|
101
|
+
style: _extends({}, textParams.style, labelStyle)
|
|
102
|
+
}))]
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
export { ChartsYReferenceLine };
|