@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
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ChartsYReferenceLine = ChartsYReferenceLine;
|
|
8
|
+
exports.getYReferenceLineClasses = getYReferenceLineClasses;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
12
|
+
var _hooks = require("../hooks");
|
|
13
|
+
var _common = require("./common");
|
|
14
|
+
var _ChartsText = require("../internals/components/ChartsText");
|
|
15
|
+
var _chartsReferenceLineClasses = require("./chartsReferenceLineClasses");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
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); }
|
|
18
|
+
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; }
|
|
19
|
+
const getTextParams = ({
|
|
20
|
+
left,
|
|
21
|
+
width,
|
|
22
|
+
spacingX,
|
|
23
|
+
labelAlign = 'middle'
|
|
24
|
+
}) => {
|
|
25
|
+
switch (labelAlign) {
|
|
26
|
+
case 'start':
|
|
27
|
+
return {
|
|
28
|
+
x: left + spacingX,
|
|
29
|
+
style: {
|
|
30
|
+
dominantBaseline: 'auto',
|
|
31
|
+
textAnchor: 'start'
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
case 'end':
|
|
35
|
+
return {
|
|
36
|
+
x: left + width - spacingX,
|
|
37
|
+
style: {
|
|
38
|
+
dominantBaseline: 'auto',
|
|
39
|
+
textAnchor: 'end'
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
default:
|
|
43
|
+
return {
|
|
44
|
+
x: left + width / 2,
|
|
45
|
+
style: {
|
|
46
|
+
dominantBaseline: 'auto',
|
|
47
|
+
textAnchor: 'middle'
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
let warnedOnce = false;
|
|
53
|
+
function getYReferenceLineClasses(classes) {
|
|
54
|
+
return (0, _composeClasses.default)({
|
|
55
|
+
root: ['root', 'horizontal'],
|
|
56
|
+
line: ['line'],
|
|
57
|
+
label: ['label']
|
|
58
|
+
}, _chartsReferenceLineClasses.getReferenceLineUtilityClass, classes);
|
|
59
|
+
}
|
|
60
|
+
function ChartsYReferenceLine(props) {
|
|
61
|
+
const {
|
|
62
|
+
y,
|
|
63
|
+
label = '',
|
|
64
|
+
spacing = 5,
|
|
65
|
+
classes: inClasses,
|
|
66
|
+
labelAlign,
|
|
67
|
+
lineStyle,
|
|
68
|
+
labelStyle,
|
|
69
|
+
axisId
|
|
70
|
+
} = props;
|
|
71
|
+
const {
|
|
72
|
+
left,
|
|
73
|
+
width
|
|
74
|
+
} = (0, _hooks.useDrawingArea)();
|
|
75
|
+
const yAxisScale = (0, _hooks.useYScale)(axisId);
|
|
76
|
+
const yPosition = yAxisScale(y);
|
|
77
|
+
if (yPosition === undefined) {
|
|
78
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
79
|
+
if (!warnedOnce) {
|
|
80
|
+
warnedOnce = true;
|
|
81
|
+
console.error(`MUI X: the value ${y} does not exist in the data of y axis with id ${axisId}.`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
const d = `M ${left} ${yPosition} l ${width} 0`;
|
|
87
|
+
const classes = getYReferenceLineClasses(inClasses);
|
|
88
|
+
const spacingX = typeof spacing === 'object' ? spacing.x ?? 0 : spacing;
|
|
89
|
+
const spacingY = typeof spacing === 'object' ? spacing.y ?? 0 : spacing;
|
|
90
|
+
const textParams = (0, _extends2.default)({
|
|
91
|
+
y: yPosition - spacingY,
|
|
92
|
+
text: label,
|
|
93
|
+
fontSize: 12
|
|
94
|
+
}, getTextParams({
|
|
95
|
+
left,
|
|
96
|
+
width,
|
|
97
|
+
spacingX,
|
|
98
|
+
labelAlign
|
|
99
|
+
}), {
|
|
100
|
+
className: classes.label
|
|
101
|
+
});
|
|
102
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_common.ReferenceLineRoot, {
|
|
103
|
+
className: classes.root,
|
|
104
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
105
|
+
d: d,
|
|
106
|
+
className: classes.line,
|
|
107
|
+
style: lineStyle
|
|
108
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsText.ChartsText, (0, _extends2.default)({}, textParams, {
|
|
109
|
+
style: (0, _extends2.default)({}, textParams.style, labelStyle)
|
|
110
|
+
}))]
|
|
111
|
+
});
|
|
112
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ChartsReferenceLineClasses {
|
|
2
|
+
/** Styles applied to the root element. */
|
|
3
|
+
root: string;
|
|
4
|
+
/** Styles applied to the root element if the reference line is vertical. */
|
|
5
|
+
vertical: string;
|
|
6
|
+
/** Styles applied to the root element if the reference line is horizontal. */
|
|
7
|
+
horizontal: string;
|
|
8
|
+
/** Styles applied to the reference line. */
|
|
9
|
+
line: string;
|
|
10
|
+
/** Styles applied to the reference label. */
|
|
11
|
+
label: string;
|
|
12
|
+
}
|
|
13
|
+
export type ChartsReferenceLineClassKey = keyof ChartsReferenceLineClasses;
|
|
14
|
+
export declare function getReferenceLineUtilityClass(slot: string): string;
|
|
15
|
+
export declare const referenceLineClasses: ChartsReferenceLineClasses;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getReferenceLineUtilityClass = getReferenceLineUtilityClass;
|
|
8
|
+
exports.referenceLineClasses = void 0;
|
|
9
|
+
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
|
|
10
|
+
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
11
|
+
function getReferenceLineUtilityClass(slot) {
|
|
12
|
+
return (0, _generateUtilityClass.default)('MuiChartsReferenceLine', slot);
|
|
13
|
+
}
|
|
14
|
+
const referenceLineClasses = exports.referenceLineClasses = (0, _generateUtilityClasses.default)('MuiChartsReferenceLine', ['root', 'vertical', 'horizontal', 'line', 'label']);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ChartsReferenceLineClasses } from './chartsReferenceLineClasses';
|
|
3
|
+
import { ChartsTextStyle } from '../internals/components/ChartsText';
|
|
4
|
+
export type CommonChartsReferenceLineProps = {
|
|
5
|
+
/**
|
|
6
|
+
* The alignment if the label is in the chart drawing area.
|
|
7
|
+
* @default 'middle'
|
|
8
|
+
*/
|
|
9
|
+
labelAlign?: 'start' | 'middle' | 'end';
|
|
10
|
+
/**
|
|
11
|
+
* The label to display along the reference line.
|
|
12
|
+
*/
|
|
13
|
+
label?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Additional space arround the label in px.
|
|
16
|
+
* Can be a number or an object `{ x, y }` to distinguish space with the reference line and space with axes.
|
|
17
|
+
* @default 5
|
|
18
|
+
*/
|
|
19
|
+
spacing?: number | {
|
|
20
|
+
x?: number;
|
|
21
|
+
y?: number;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* The id of the axis used for the reference value.
|
|
25
|
+
* @default The `id` of the first defined axis.
|
|
26
|
+
*/
|
|
27
|
+
axisId?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The style applied to the label.
|
|
30
|
+
*/
|
|
31
|
+
labelStyle?: ChartsTextStyle;
|
|
32
|
+
/**
|
|
33
|
+
* The style applied to the line.
|
|
34
|
+
*/
|
|
35
|
+
lineStyle?: React.CSSProperties;
|
|
36
|
+
/**
|
|
37
|
+
* Override or extend the styles applied to the component.
|
|
38
|
+
*/
|
|
39
|
+
classes?: Partial<ChartsReferenceLineClasses>;
|
|
40
|
+
};
|
|
41
|
+
export declare const ReferenceLineRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").SVGProps<SVGGElement>, {}>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ReferenceLineRoot = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _styles = require("@mui/material/styles");
|
|
10
|
+
var _chartsReferenceLineClasses = require("./chartsReferenceLineClasses");
|
|
11
|
+
const ReferenceLineRoot = exports.ReferenceLineRoot = (0, _styles.styled)('g')(({
|
|
12
|
+
theme
|
|
13
|
+
}) => ({
|
|
14
|
+
[`& .${_chartsReferenceLineClasses.referenceLineClasses.line}`]: {
|
|
15
|
+
fill: 'none',
|
|
16
|
+
stroke: (theme.vars || theme).palette.text.primary,
|
|
17
|
+
shapeRendering: 'crispEdges',
|
|
18
|
+
strokeWidth: 1,
|
|
19
|
+
pointerEvents: 'none'
|
|
20
|
+
},
|
|
21
|
+
[`& .${_chartsReferenceLineClasses.referenceLineClasses.label}`]: (0, _extends2.default)({
|
|
22
|
+
fill: (theme.vars || theme).palette.text.primary,
|
|
23
|
+
stroke: 'none',
|
|
24
|
+
pointerEvents: 'none',
|
|
25
|
+
fontSize: 12
|
|
26
|
+
}, theme.typography.body1)
|
|
27
|
+
}));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _ChartsReferenceLine = require("./ChartsReferenceLine");
|
|
7
|
+
Object.keys(_ChartsReferenceLine).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _ChartsReferenceLine[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _ChartsReferenceLine[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _chartsReferenceLineClasses = require("./chartsReferenceLineClasses");
|
|
18
|
+
Object.keys(_chartsReferenceLineClasses).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _chartsReferenceLineClasses[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _chartsReferenceLineClasses[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
package/ChartsSurface.d.ts
CHANGED
|
@@ -7,7 +7,13 @@ type ViewBox = {
|
|
|
7
7
|
height?: number;
|
|
8
8
|
};
|
|
9
9
|
export interface ChartsSurfaceProps {
|
|
10
|
+
/**
|
|
11
|
+
* The width of the chart in px.
|
|
12
|
+
*/
|
|
10
13
|
width: number;
|
|
14
|
+
/**
|
|
15
|
+
* The height of the chart in px.
|
|
16
|
+
*/
|
|
11
17
|
height: number;
|
|
12
18
|
viewBox?: ViewBox;
|
|
13
19
|
className?: string;
|
|
@@ -15,6 +21,11 @@ export interface ChartsSurfaceProps {
|
|
|
15
21
|
desc?: string;
|
|
16
22
|
sx?: SxProps<Theme>;
|
|
17
23
|
children?: React.ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* If `true`, the charts will not listen to the mouse move event.
|
|
26
|
+
* It might break interactive features, but will improve performance.
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
18
29
|
disableAxisListener?: boolean;
|
|
19
30
|
}
|
|
20
31
|
export declare const ChartsSurface: React.ForwardRefExoticComponent<ChartsSurfaceProps & React.RefAttributes<SVGSVGElement>>;
|
|
@@ -3,7 +3,7 @@ import { SxProps, Theme } from '@mui/material/styles';
|
|
|
3
3
|
import { AxisInteractionData } from '../context/InteractionProvider';
|
|
4
4
|
import { ChartSeriesDefaultized, ChartSeriesType } from '../models/seriesType/config';
|
|
5
5
|
import { AxisDefaultized } from '../models/axis';
|
|
6
|
-
import { ChartsTooltipClasses } from './
|
|
6
|
+
import { ChartsTooltipClasses } from './chartsTooltipClasses';
|
|
7
7
|
export type ChartsAxisContentProps = {
|
|
8
8
|
/**
|
|
9
9
|
* Data identifying the triggered axis.
|
|
@@ -8,6 +8,7 @@ exports.ChartsAxisTooltipContent = ChartsAxisTooltipContent;
|
|
|
8
8
|
exports.DefaultChartsAxisContent = DefaultChartsAxisContent;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
11
12
|
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
12
13
|
var _utils = require("@mui/base/utils");
|
|
13
14
|
var _SeriesContextProvider = require("../context/SeriesContextProvider");
|
|
@@ -33,6 +34,7 @@ function DefaultChartsAxisContent(props) {
|
|
|
33
34
|
sx: sx,
|
|
34
35
|
className: classes.root,
|
|
35
36
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsTooltipTable.ChartsTooltipTable, {
|
|
37
|
+
className: classes.table,
|
|
36
38
|
children: [axisValue != null && !axis.hideTooltip && /*#__PURE__*/(0, _jsxRuntime.jsx)("thead", {
|
|
37
39
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltipTable.ChartsTooltipRow, {
|
|
38
40
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltipTable.ChartsTooltipCell, {
|
|
@@ -55,21 +57,23 @@ function DefaultChartsAxisContent(props) {
|
|
|
55
57
|
return null;
|
|
56
58
|
}
|
|
57
59
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsTooltipTable.ChartsTooltipRow, {
|
|
60
|
+
className: classes.row,
|
|
58
61
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltipTable.ChartsTooltipCell, {
|
|
59
|
-
className: classes.markCell,
|
|
62
|
+
className: (0, _clsx.default)(classes.markCell, classes.cell),
|
|
60
63
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltipTable.ChartsTooltipMark, {
|
|
61
64
|
ownerState: {
|
|
62
65
|
color
|
|
63
66
|
},
|
|
64
|
-
boxShadow: 1
|
|
67
|
+
boxShadow: 1,
|
|
68
|
+
className: classes.mark
|
|
65
69
|
})
|
|
66
70
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltipTable.ChartsTooltipCell, {
|
|
67
|
-
className: classes.labelCell,
|
|
71
|
+
className: (0, _clsx.default)(classes.labelCell, classes.cell),
|
|
68
72
|
children: label ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
69
73
|
children: label
|
|
70
74
|
}) : null
|
|
71
75
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltipTable.ChartsTooltipCell, {
|
|
72
|
-
className: classes.valueCell,
|
|
76
|
+
className: (0, _clsx.default)(classes.valueCell, classes.cell),
|
|
73
77
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
74
78
|
children: formattedValue
|
|
75
79
|
})
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
3
|
import { ItemInteractionData } from '../context/InteractionProvider';
|
|
4
4
|
import { ChartSeriesDefaultized, ChartSeriesType } from '../models/seriesType/config';
|
|
5
|
-
import { ChartsTooltipClasses } from './
|
|
5
|
+
import { ChartsTooltipClasses } from './chartsTooltipClasses';
|
|
6
6
|
export type ChartsItemContentProps<T extends ChartSeriesType = ChartSeriesType> = {
|
|
7
7
|
/**
|
|
8
8
|
* The data used to identify the triggered item.
|
|
@@ -8,6 +8,7 @@ exports.ChartsItemTooltipContent = ChartsItemTooltipContent;
|
|
|
8
8
|
exports.DefaultChartsItemContent = DefaultChartsItemContent;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
11
12
|
var _utils = require("@mui/base/utils");
|
|
12
13
|
var _SeriesContextProvider = require("../context/SeriesContextProvider");
|
|
13
14
|
var _ChartsTooltipTable = require("./ChartsTooltipTable");
|
|
@@ -42,20 +43,23 @@ function DefaultChartsItemContent(props) {
|
|
|
42
43
|
sx: sx,
|
|
43
44
|
className: classes.root,
|
|
44
45
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltipTable.ChartsTooltipTable, {
|
|
46
|
+
className: classes.table,
|
|
45
47
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("tbody", {
|
|
46
48
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsTooltipTable.ChartsTooltipRow, {
|
|
49
|
+
className: classes.row,
|
|
47
50
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltipTable.ChartsTooltipCell, {
|
|
48
|
-
className: classes.markCell,
|
|
51
|
+
className: (0, _clsx.default)(classes.markCell, classes.cell),
|
|
49
52
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltipTable.ChartsTooltipMark, {
|
|
50
53
|
ownerState: {
|
|
51
54
|
color
|
|
52
|
-
}
|
|
55
|
+
},
|
|
56
|
+
className: classes.mark
|
|
53
57
|
})
|
|
54
58
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltipTable.ChartsTooltipCell, {
|
|
55
|
-
className: classes.labelCell,
|
|
59
|
+
className: (0, _clsx.default)(classes.labelCell, classes.cell),
|
|
56
60
|
children: displayedLabel
|
|
57
61
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltipTable.ChartsTooltipCell, {
|
|
58
|
-
className: classes.valueCell,
|
|
62
|
+
className: (0, _clsx.default)(classes.valueCell, classes.cell),
|
|
59
63
|
children: formattedValue
|
|
60
64
|
})]
|
|
61
65
|
})
|
|
@@ -3,7 +3,7 @@ import { PopperProps } from '@mui/base/Popper';
|
|
|
3
3
|
import { TriggerOptions } from './utils';
|
|
4
4
|
import { ChartsItemContentProps } from './ChartsItemTooltipContent';
|
|
5
5
|
import { ChartsAxisContentProps } from './ChartsAxisTooltipContent';
|
|
6
|
-
import { ChartsTooltipClasses } from './
|
|
6
|
+
import { ChartsTooltipClasses } from './chartsTooltipClasses';
|
|
7
7
|
export interface ChartsTooltipSlotsComponent {
|
|
8
8
|
popper?: React.ElementType<PopperProps>;
|
|
9
9
|
axisContent?: React.ElementType<ChartsAxisContentProps>;
|
|
@@ -17,7 +17,7 @@ var _InteractionProvider = require("../context/InteractionProvider");
|
|
|
17
17
|
var _utils2 = require("./utils");
|
|
18
18
|
var _ChartsItemTooltipContent = require("./ChartsItemTooltipContent");
|
|
19
19
|
var _ChartsAxisTooltipContent = require("./ChartsAxisTooltipContent");
|
|
20
|
-
var
|
|
20
|
+
var _chartsTooltipClasses = require("./chartsTooltipClasses");
|
|
21
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
22
|
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); }
|
|
23
23
|
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,11 +27,15 @@ const useUtilityClasses = ownerState => {
|
|
|
27
27
|
} = ownerState;
|
|
28
28
|
const slots = {
|
|
29
29
|
root: ['root'],
|
|
30
|
+
table: ['table'],
|
|
31
|
+
row: ['row'],
|
|
32
|
+
cell: ['cell'],
|
|
33
|
+
mark: ['mark'],
|
|
30
34
|
markCell: ['markCell'],
|
|
31
35
|
labelCell: ['labelCell'],
|
|
32
36
|
valueCell: ['valueCell']
|
|
33
37
|
};
|
|
34
|
-
return (0, _composeClasses.default)(slots,
|
|
38
|
+
return (0, _composeClasses.default)(slots, _chartsTooltipClasses.getChartsTooltipUtilityClass, classes);
|
|
35
39
|
};
|
|
36
40
|
const ChartsTooltipRoot = (0, _styles.styled)(_Popper.Popper, {
|
|
37
41
|
name: 'MuiChartsTooltip',
|
|
@@ -54,23 +58,27 @@ const ChartsTooltipRoot = (0, _styles.styled)(_Popper.Popper, {
|
|
|
54
58
|
* - [ChartsTooltip API](https://mui.com/x/api/charts/charts-tool-tip/)
|
|
55
59
|
*/
|
|
56
60
|
function ChartsTooltip(props) {
|
|
61
|
+
const themeProps = (0, _styles.useThemeProps)({
|
|
62
|
+
props,
|
|
63
|
+
name: 'MuiChartsTooltip'
|
|
64
|
+
});
|
|
57
65
|
const {
|
|
58
66
|
trigger = 'axis',
|
|
59
67
|
itemContent,
|
|
60
68
|
axisContent,
|
|
61
69
|
slots,
|
|
62
70
|
slotProps
|
|
63
|
-
} =
|
|
71
|
+
} = themeProps;
|
|
64
72
|
const mousePosition = (0, _utils2.useMouseTracker)();
|
|
65
73
|
const {
|
|
66
74
|
item,
|
|
67
75
|
axis
|
|
68
76
|
} = React.useContext(_InteractionProvider.InteractionContext);
|
|
69
77
|
const displayedData = trigger === 'item' ? item : axis;
|
|
70
|
-
const tooltipHasData = (0, _utils2.
|
|
78
|
+
const tooltipHasData = (0, _utils2.getTooltipHasData)(trigger, displayedData);
|
|
71
79
|
const popperOpen = mousePosition !== null && tooltipHasData;
|
|
72
80
|
const classes = useUtilityClasses({
|
|
73
|
-
classes:
|
|
81
|
+
classes: themeProps.classes
|
|
74
82
|
});
|
|
75
83
|
const PopperComponent = slots?.popper ?? ChartsTooltipRoot;
|
|
76
84
|
const popperProps = (0, _utils.useSlotProps)({
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.ChartsTooltipTable = exports.ChartsTooltipRow = exports.ChartsTooltipPaper = exports.ChartsTooltipMark = exports.ChartsTooltipCell = void 0;
|
|
8
8
|
var _Box = _interopRequireDefault(require("@mui/system/Box"));
|
|
9
9
|
var _styles = require("@mui/material/styles");
|
|
10
|
-
var
|
|
10
|
+
var _chartsTooltipClasses = require("./chartsTooltipClasses");
|
|
11
11
|
const ChartsTooltipPaper = exports.ChartsTooltipPaper = (0, _styles.styled)('div', {
|
|
12
12
|
name: 'MuiChartsTooltip',
|
|
13
13
|
slot: 'Container'
|
|
@@ -52,10 +52,10 @@ const ChartsTooltipCell = exports.ChartsTooltipCell = (0, _styles.styled)('td',
|
|
|
52
52
|
}) => ({
|
|
53
53
|
verticalAlign: 'middle',
|
|
54
54
|
color: (theme.vars || theme).palette.text.secondary,
|
|
55
|
-
[`&.${
|
|
55
|
+
[`&.${_chartsTooltipClasses.chartsTooltipClasses.labelCell}`]: {
|
|
56
56
|
paddingLeft: theme.spacing(1)
|
|
57
57
|
},
|
|
58
|
-
[`&.${
|
|
58
|
+
[`&.${_chartsTooltipClasses.chartsTooltipClasses.valueCell}`]: {
|
|
59
59
|
paddingLeft: theme.spacing(4),
|
|
60
60
|
color: (theme.vars || theme).palette.text.primary
|
|
61
61
|
},
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface ChartsTooltipClasses {
|
|
2
|
+
/** Styles applied to the root element. */
|
|
3
|
+
root: string;
|
|
4
|
+
/** Styles applied to the table element. */
|
|
5
|
+
table: string;
|
|
6
|
+
/** Styles applied to the row element. */
|
|
7
|
+
row: string;
|
|
8
|
+
/** Styles applied to the cell element. */
|
|
9
|
+
cell: string;
|
|
10
|
+
/** Styles applied to the mark element. */
|
|
11
|
+
mark: string;
|
|
12
|
+
/** Styles applied to the markCell element. */
|
|
13
|
+
markCell: string;
|
|
14
|
+
/** Styles applied to the labelCell element. */
|
|
15
|
+
labelCell: string;
|
|
16
|
+
/** Styles applied to the valueCell element. */
|
|
17
|
+
valueCell: string;
|
|
18
|
+
}
|
|
19
|
+
export type ChartsTooltipClassKey = keyof Omit<ChartsTooltipClasses, 'markCell' | 'labelCell' | 'valueCell'>;
|
|
20
|
+
export declare function getChartsTooltipUtilityClass(slot: string): string;
|
|
21
|
+
export declare const chartsTooltipClasses: ChartsTooltipClasses;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.chartsTooltipClasses = void 0;
|
|
7
|
+
exports.getChartsTooltipUtilityClass = getChartsTooltipUtilityClass;
|
|
8
|
+
var _utils = require("@mui/utils");
|
|
9
|
+
function getChartsTooltipUtilityClass(slot) {
|
|
10
|
+
return (0, _utils.unstable_generateUtilityClass)('MuiChartsTooltip', slot);
|
|
11
|
+
}
|
|
12
|
+
const chartsTooltipClasses = exports.chartsTooltipClasses = (0, _utils.unstable_generateUtilityClasses)('MuiChartsTooltip', ['root', 'table', 'row', 'cell', 'mark', 'markCell', 'labelCell', 'valueCell']);
|
package/ChartsTooltip/index.d.ts
CHANGED
package/ChartsTooltip/index.js
CHANGED
|
@@ -13,4 +13,15 @@ Object.keys(_ChartsTooltip).forEach(function (key) {
|
|
|
13
13
|
return _ChartsTooltip[key];
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
+
});
|
|
17
|
+
var _chartsTooltipClasses = require("./chartsTooltipClasses");
|
|
18
|
+
Object.keys(_chartsTooltipClasses).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _chartsTooltipClasses[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _chartsTooltipClasses[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
16
27
|
});
|
package/ChartsTooltip/utils.d.ts
CHANGED
|
@@ -21,4 +21,4 @@ export declare function useMouseTracker(): {
|
|
|
21
21
|
y: number;
|
|
22
22
|
} | null;
|
|
23
23
|
export type TriggerOptions = 'item' | 'axis' | 'none';
|
|
24
|
-
export declare function
|
|
24
|
+
export declare function getTooltipHasData(trigger: TriggerOptions, displayedData: null | AxisInteractionData | ItemInteractionData<ChartSeriesType>): boolean;
|
package/ChartsTooltip/utils.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.generateVirtualElement = generateVirtualElement;
|
|
7
|
-
exports.
|
|
7
|
+
exports.getTooltipHasData = getTooltipHasData;
|
|
8
8
|
exports.useMouseTracker = useMouseTracker;
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _DrawingProvider = require("../context/DrawingProvider");
|
|
@@ -81,7 +81,7 @@ function useMouseTracker() {
|
|
|
81
81
|
}, [svgRef]);
|
|
82
82
|
return mousePosition;
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function getTooltipHasData(trigger, displayedData) {
|
|
85
85
|
if (trigger === 'item') {
|
|
86
86
|
return displayedData !== null;
|
|
87
87
|
}
|
|
@@ -114,17 +114,20 @@ function ChartsXAxis(inProps) {
|
|
|
114
114
|
props: (0, _extends2.default)({}, defaultProps, inProps),
|
|
115
115
|
name: 'MuiChartsXAxis'
|
|
116
116
|
});
|
|
117
|
+
const {
|
|
118
|
+
xAxisIds
|
|
119
|
+
} = React.useContext(_CartesianContextProvider.CartesianContext);
|
|
117
120
|
const _React$useContext = React.useContext(_CartesianContextProvider.CartesianContext),
|
|
118
|
-
|
|
121
|
+
_ref = props.axisId ?? xAxisIds[0],
|
|
119
122
|
{
|
|
120
123
|
xAxis: {
|
|
121
|
-
[
|
|
124
|
+
[_ref]: {
|
|
122
125
|
scale: xScale,
|
|
123
126
|
tickNumber
|
|
124
127
|
}
|
|
125
128
|
}
|
|
126
129
|
} = _React$useContext,
|
|
127
|
-
settings = (0, _objectWithoutPropertiesLoose2.default)(_React$useContext.xAxis[
|
|
130
|
+
settings = (0, _objectWithoutPropertiesLoose2.default)(_React$useContext.xAxis[_ref], _excluded);
|
|
128
131
|
const isMounted = (0, _useMounted.useMounted)();
|
|
129
132
|
const defaultizedProps = (0, _extends2.default)({}, defaultProps, settings, props);
|
|
130
133
|
const {
|
|
@@ -242,9 +245,10 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
|
|
|
242
245
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
243
246
|
// ----------------------------------------------------------------------
|
|
244
247
|
/**
|
|
245
|
-
*
|
|
248
|
+
* The id of the axis to render.
|
|
249
|
+
* If undefined, it will be the first defined axis.
|
|
246
250
|
*/
|
|
247
|
-
axisId: _propTypes.default.string
|
|
251
|
+
axisId: _propTypes.default.string,
|
|
248
252
|
/**
|
|
249
253
|
* Override or extend the styles applied to the component.
|
|
250
254
|
*/
|
|
@@ -60,17 +60,20 @@ function ChartsYAxis(inProps) {
|
|
|
60
60
|
props: (0, _extends2.default)({}, defaultProps, inProps),
|
|
61
61
|
name: 'MuiChartsYAxis'
|
|
62
62
|
});
|
|
63
|
+
const {
|
|
64
|
+
yAxisIds
|
|
65
|
+
} = React.useContext(_CartesianContextProvider.CartesianContext);
|
|
63
66
|
const _React$useContext = React.useContext(_CartesianContextProvider.CartesianContext),
|
|
64
|
-
|
|
67
|
+
_ref = props.axisId ?? yAxisIds[0],
|
|
65
68
|
{
|
|
66
69
|
yAxis: {
|
|
67
|
-
[
|
|
70
|
+
[_ref]: {
|
|
68
71
|
scale: yScale,
|
|
69
72
|
tickNumber
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
75
|
} = _React$useContext,
|
|
73
|
-
settings = (0, _objectWithoutPropertiesLoose2.default)(_React$useContext.yAxis[
|
|
76
|
+
settings = (0, _objectWithoutPropertiesLoose2.default)(_React$useContext.yAxis[_ref], _excluded);
|
|
74
77
|
const defaultizedProps = (0, _extends2.default)({}, defaultProps, settings, props);
|
|
75
78
|
const {
|
|
76
79
|
position,
|
|
@@ -175,9 +178,10 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
|
|
|
175
178
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
176
179
|
// ----------------------------------------------------------------------
|
|
177
180
|
/**
|
|
178
|
-
*
|
|
181
|
+
* The id of the axis to render.
|
|
182
|
+
* If undefined, it will be the first defined axis.
|
|
179
183
|
*/
|
|
180
|
-
axisId: _propTypes.default.string
|
|
184
|
+
axisId: _propTypes.default.string,
|
|
181
185
|
/**
|
|
182
186
|
* Override or extend the styles applied to the component.
|
|
183
187
|
*/
|
package/LineChart/LineChart.d.ts
CHANGED
|
@@ -18,6 +18,13 @@ export interface LineChartSlotComponentProps extends ChartsAxisSlotComponentProp
|
|
|
18
18
|
export interface LineChartProps extends Omit<ResponsiveChartContainerProps, 'series'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'> {
|
|
19
19
|
series: MakeOptional<LineSeriesType, 'type'>[];
|
|
20
20
|
tooltip?: ChartsTooltipProps;
|
|
21
|
+
/**
|
|
22
|
+
* Object `{ x, y }` that defines how the charts highlight the mouse position along the x- and y-axes.
|
|
23
|
+
* The two properties accept the following values:
|
|
24
|
+
* - 'none': display nothing.
|
|
25
|
+
* - 'line': display a line at the current mouse position.
|
|
26
|
+
* - 'band': display a band at the current mouse position. Only available with band scale.
|
|
27
|
+
*/
|
|
21
28
|
axisHighlight?: ChartsAxisHighlightProps;
|
|
22
29
|
/**
|
|
23
30
|
* @deprecated Consider using `slotProps.legend` instead.
|