@mui/x-charts 8.9.2 → 8.10.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.js +16 -0
- package/CHANGELOG.md +121 -6
- package/ChartContainer/ChartContainer.js +24 -0
- package/ChartsAxisHighlight/ChartsXAxisHighlight.js +1 -3
- package/ChartsAxisHighlight/ChartsYAxisHighlight.js +1 -3
- package/ChartsTooltip/ChartsTooltip.d.ts +2 -1
- package/ChartsTooltip/ChartsTooltip.js +3 -3
- package/ChartsTooltip/ChartsTooltipContainer.d.ts +5 -5
- package/ChartsTooltip/ChartsTooltipContainer.js +3 -3
- package/ChartsXAxis/ChartsGroupedXAxis.d.ts +7 -0
- package/ChartsXAxis/ChartsGroupedXAxis.js +142 -0
- package/ChartsXAxis/ChartsSingleXAxis.d.ts +7 -0
- package/ChartsXAxis/ChartsSingleXAxis.js +144 -0
- package/ChartsXAxis/ChartsXAxis.d.ts +1 -1
- package/ChartsXAxis/ChartsXAxis.js +8 -210
- package/ChartsXAxis/getVisibleLabels.d.ts +2 -2
- package/ChartsXAxis/useAxisProps.d.ts +4526 -0
- package/ChartsXAxis/useAxisProps.js +105 -0
- package/ChartsXAxis/utilities.d.ts +11 -0
- package/ChartsXAxis/utilities.js +43 -0
- package/LineChart/LineChart.js +16 -0
- package/RadarChart/index.d.ts +9 -2
- package/RadarChart/index.js +13 -14
- package/ScatterChart/ScatterChart.d.ts +8 -1
- package/ScatterChart/ScatterChart.js +16 -0
- package/SparkLineChart/SparkLineChart.js +16 -0
- package/esm/BarChart/BarChart.js +16 -0
- package/esm/ChartContainer/ChartContainer.js +24 -0
- package/esm/ChartsAxisHighlight/ChartsXAxisHighlight.js +1 -3
- package/esm/ChartsAxisHighlight/ChartsYAxisHighlight.js +1 -3
- package/esm/ChartsTooltip/ChartsTooltip.d.ts +2 -1
- package/esm/ChartsTooltip/ChartsTooltip.js +3 -3
- package/esm/ChartsTooltip/ChartsTooltipContainer.d.ts +5 -5
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +3 -3
- package/esm/ChartsXAxis/ChartsGroupedXAxis.d.ts +7 -0
- package/esm/ChartsXAxis/ChartsGroupedXAxis.js +136 -0
- package/esm/ChartsXAxis/ChartsSingleXAxis.d.ts +7 -0
- package/esm/ChartsXAxis/ChartsSingleXAxis.js +140 -0
- package/esm/ChartsXAxis/ChartsXAxis.d.ts +1 -1
- package/esm/ChartsXAxis/ChartsXAxis.js +7 -207
- package/esm/ChartsXAxis/getVisibleLabels.d.ts +2 -2
- package/esm/ChartsXAxis/useAxisProps.d.ts +4526 -0
- package/esm/ChartsXAxis/useAxisProps.js +98 -0
- package/esm/ChartsXAxis/utilities.d.ts +11 -0
- package/esm/ChartsXAxis/utilities.js +35 -0
- package/esm/LineChart/LineChart.js +16 -0
- package/esm/RadarChart/index.d.ts +9 -2
- package/esm/RadarChart/index.js +12 -2
- package/esm/ScatterChart/ScatterChart.d.ts +8 -1
- package/esm/ScatterChart/ScatterChart.js +16 -0
- package/esm/SparkLineChart/SparkLineChart.js +16 -0
- package/esm/hooks/useTicksGrouped.d.ts +28 -0
- package/esm/hooks/useTicksGrouped.js +98 -0
- package/esm/index.js +1 -1
- package/esm/internals/getScale.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +3 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +32 -23
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.d.ts +1 -1
- package/esm/models/axis.d.ts +61 -0
- package/hooks/useTicksGrouped.d.ts +28 -0
- package/hooks/useTicksGrouped.js +104 -0
- package/index.js +1 -1
- package/internals/getScale.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +3 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +34 -23
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.d.ts +1 -1
- package/models/axis.d.ts +61 -0
- package/package.json +3 -4
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.useAxisProps = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
|
+
var _useSlotProps = _interopRequireDefault(require("@mui/utils/useSlotProps"));
|
|
12
|
+
var _styles = require("@mui/material/styles");
|
|
13
|
+
var _RtlProvider = require("@mui/system/RtlProvider");
|
|
14
|
+
var _ChartsText = require("../ChartsText");
|
|
15
|
+
var _useAxis = require("../hooks/useAxis");
|
|
16
|
+
var _defaultTextPlacement = require("../ChartsText/defaultTextPlacement");
|
|
17
|
+
var _invertTextAnchor = require("../internals/invertTextAnchor");
|
|
18
|
+
var _utilities = require("./utilities");
|
|
19
|
+
var _isBandScale = require("../internals/isBandScale");
|
|
20
|
+
var _isInfinity = require("../internals/isInfinity");
|
|
21
|
+
const _excluded = ["scale", "tickNumber", "reverse"];
|
|
22
|
+
const useAxisProps = inProps => {
|
|
23
|
+
const {
|
|
24
|
+
xAxis,
|
|
25
|
+
xAxisIds
|
|
26
|
+
} = (0, _useAxis.useXAxes)();
|
|
27
|
+
const _xAxis = xAxis[inProps.axisId ?? xAxisIds[0]],
|
|
28
|
+
{
|
|
29
|
+
scale: xScale,
|
|
30
|
+
tickNumber,
|
|
31
|
+
reverse
|
|
32
|
+
} = _xAxis,
|
|
33
|
+
settings = (0, _objectWithoutPropertiesLoose2.default)(_xAxis, _excluded);
|
|
34
|
+
|
|
35
|
+
// eslint-disable-next-line material-ui/mui-name-matches-component-name
|
|
36
|
+
const themedProps = (0, _styles.useThemeProps)({
|
|
37
|
+
props: (0, _extends2.default)({}, settings, inProps),
|
|
38
|
+
name: 'MuiChartsXAxis'
|
|
39
|
+
});
|
|
40
|
+
const defaultizedProps = (0, _extends2.default)({}, _utilities.defaultProps, themedProps);
|
|
41
|
+
const {
|
|
42
|
+
position,
|
|
43
|
+
tickLabelStyle,
|
|
44
|
+
labelStyle,
|
|
45
|
+
slots,
|
|
46
|
+
slotProps
|
|
47
|
+
} = defaultizedProps;
|
|
48
|
+
const theme = (0, _styles.useTheme)();
|
|
49
|
+
const isRtl = (0, _RtlProvider.useRtl)();
|
|
50
|
+
const classes = (0, _utilities.useUtilityClasses)(defaultizedProps);
|
|
51
|
+
const positionSign = position === 'bottom' ? 1 : -1;
|
|
52
|
+
const Line = slots?.axisLine ?? 'line';
|
|
53
|
+
const Tick = slots?.axisTick ?? 'line';
|
|
54
|
+
const TickLabel = slots?.axisTickLabel ?? _ChartsText.ChartsText;
|
|
55
|
+
const Label = slots?.axisLabel ?? _ChartsText.ChartsText;
|
|
56
|
+
const defaultTextAnchor = (0, _defaultTextPlacement.getDefaultTextAnchor)((position === 'bottom' ? 0 : 180) - (tickLabelStyle?.angle ?? 0));
|
|
57
|
+
const defaultDominantBaseline = (0, _defaultTextPlacement.getDefaultBaseline)((position === 'bottom' ? 0 : 180) - (tickLabelStyle?.angle ?? 0));
|
|
58
|
+
const axisTickLabelProps = (0, _useSlotProps.default)({
|
|
59
|
+
elementType: TickLabel,
|
|
60
|
+
externalSlotProps: slotProps?.axisTickLabel,
|
|
61
|
+
additionalProps: {
|
|
62
|
+
style: (0, _extends2.default)({}, theme.typography.caption, {
|
|
63
|
+
fontSize: 12,
|
|
64
|
+
lineHeight: 1.25,
|
|
65
|
+
textAnchor: isRtl ? (0, _invertTextAnchor.invertTextAnchor)(defaultTextAnchor) : defaultTextAnchor,
|
|
66
|
+
dominantBaseline: defaultDominantBaseline
|
|
67
|
+
}, tickLabelStyle)
|
|
68
|
+
},
|
|
69
|
+
className: classes.tickLabel,
|
|
70
|
+
ownerState: {}
|
|
71
|
+
});
|
|
72
|
+
const axisLabelProps = (0, _useSlotProps.default)({
|
|
73
|
+
elementType: Label,
|
|
74
|
+
externalSlotProps: slotProps?.axisLabel,
|
|
75
|
+
additionalProps: {
|
|
76
|
+
style: (0, _extends2.default)({}, theme.typography.body1, {
|
|
77
|
+
lineHeight: 1,
|
|
78
|
+
fontSize: 14,
|
|
79
|
+
textAnchor: 'middle',
|
|
80
|
+
dominantBaseline: position === 'bottom' ? 'text-after-edge' : 'text-before-edge'
|
|
81
|
+
}, labelStyle)
|
|
82
|
+
},
|
|
83
|
+
ownerState: {}
|
|
84
|
+
});
|
|
85
|
+
const domain = xScale.domain();
|
|
86
|
+
const isScaleBand = (0, _isBandScale.isBandScale)(xScale);
|
|
87
|
+
const skipAxisRendering = isScaleBand && domain.length === 0 || !isScaleBand && domain.some(_isInfinity.isInfinity) || position === 'none';
|
|
88
|
+
return {
|
|
89
|
+
xScale,
|
|
90
|
+
defaultizedProps,
|
|
91
|
+
tickNumber,
|
|
92
|
+
positionSign,
|
|
93
|
+
skipAxisRendering,
|
|
94
|
+
classes,
|
|
95
|
+
Line,
|
|
96
|
+
Tick,
|
|
97
|
+
TickLabel,
|
|
98
|
+
Label,
|
|
99
|
+
axisTickLabelProps,
|
|
100
|
+
axisLabelProps,
|
|
101
|
+
reverse,
|
|
102
|
+
isRtl
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
exports.useAxisProps = useAxisProps;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AxisConfig, ChartsXAxisProps } from "../models/axis.js";
|
|
2
|
+
export declare const useUtilityClasses: (ownerState: AxisConfig<any, any, ChartsXAxisProps>) => Record<"root" | "line" | "label" | "tickContainer" | "tick" | "tickLabel", string>;
|
|
3
|
+
export declare const TICK_LABEL_GAP = 3;
|
|
4
|
+
export declare const AXIS_LABEL_TICK_LABEL_GAP = 4;
|
|
5
|
+
export declare const XAxisRoot: import("@emotion/styled").StyledComponent<Pick<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & Pick<import("react").SVGProps<SVGGElement>, keyof import("react").SVGProps<SVGGElement>>, keyof import("react").SVGProps<SVGGElement> | keyof import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
6
|
+
export declare const defaultProps: {
|
|
7
|
+
readonly disableLine: false;
|
|
8
|
+
readonly disableTicks: false;
|
|
9
|
+
readonly tickSize: 6;
|
|
10
|
+
readonly tickLabelMinGap: 4;
|
|
11
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useUtilityClasses = exports.defaultProps = exports.XAxisRoot = exports.TICK_LABEL_GAP = exports.AXIS_LABEL_TICK_LABEL_GAP = void 0;
|
|
8
|
+
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
9
|
+
var _styles = require("@mui/material/styles");
|
|
10
|
+
var _axisClasses = require("../ChartsAxis/axisClasses");
|
|
11
|
+
var _AxisSharedComponents = require("../internals/components/AxisSharedComponents");
|
|
12
|
+
const useUtilityClasses = ownerState => {
|
|
13
|
+
const {
|
|
14
|
+
classes,
|
|
15
|
+
position,
|
|
16
|
+
id
|
|
17
|
+
} = ownerState;
|
|
18
|
+
const slots = {
|
|
19
|
+
root: ['root', 'directionX', position, `id-${id}`],
|
|
20
|
+
line: ['line'],
|
|
21
|
+
tickContainer: ['tickContainer'],
|
|
22
|
+
tick: ['tick'],
|
|
23
|
+
tickLabel: ['tickLabel'],
|
|
24
|
+
label: ['label']
|
|
25
|
+
};
|
|
26
|
+
return (0, _composeClasses.default)(slots, _axisClasses.getAxisUtilityClass, classes);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/* Gap between a tick and its label. */
|
|
30
|
+
exports.useUtilityClasses = useUtilityClasses;
|
|
31
|
+
const TICK_LABEL_GAP = exports.TICK_LABEL_GAP = 3;
|
|
32
|
+
/* Gap between the axis label and tick labels. */
|
|
33
|
+
const AXIS_LABEL_TICK_LABEL_GAP = exports.AXIS_LABEL_TICK_LABEL_GAP = 4;
|
|
34
|
+
const XAxisRoot = exports.XAxisRoot = (0, _styles.styled)(_AxisSharedComponents.AxisRoot, {
|
|
35
|
+
name: 'MuiChartsXAxis',
|
|
36
|
+
slot: 'Root'
|
|
37
|
+
})({});
|
|
38
|
+
const defaultProps = exports.defaultProps = {
|
|
39
|
+
disableLine: false,
|
|
40
|
+
disableTicks: false,
|
|
41
|
+
tickSize: 6,
|
|
42
|
+
tickLabelMinGap: 4
|
|
43
|
+
};
|
package/LineChart/LineChart.js
CHANGED
|
@@ -277,6 +277,10 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
277
277
|
disableTicks: _propTypes.default.bool,
|
|
278
278
|
domainLimit: _propTypes.default.oneOfType([_propTypes.default.oneOf(['nice', 'strict']), _propTypes.default.func]),
|
|
279
279
|
fill: _propTypes.default.string,
|
|
280
|
+
groups: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
281
|
+
getValue: _propTypes.default.func.isRequired,
|
|
282
|
+
tickSize: _propTypes.default.number
|
|
283
|
+
})),
|
|
280
284
|
height: _propTypes.default.number,
|
|
281
285
|
hideTooltip: _propTypes.default.bool,
|
|
282
286
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
@@ -328,6 +332,10 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
328
332
|
disableTicks: _propTypes.default.bool,
|
|
329
333
|
domainLimit: _propTypes.default.oneOfType([_propTypes.default.oneOf(['nice', 'strict']), _propTypes.default.func]),
|
|
330
334
|
fill: _propTypes.default.string,
|
|
335
|
+
groups: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
336
|
+
getValue: _propTypes.default.func.isRequired,
|
|
337
|
+
tickSize: _propTypes.default.number
|
|
338
|
+
})),
|
|
331
339
|
height: _propTypes.default.number,
|
|
332
340
|
hideTooltip: _propTypes.default.bool,
|
|
333
341
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
@@ -710,6 +718,10 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
710
718
|
disableTicks: _propTypes.default.bool,
|
|
711
719
|
domainLimit: _propTypes.default.oneOfType([_propTypes.default.oneOf(['nice', 'strict']), _propTypes.default.func]),
|
|
712
720
|
fill: _propTypes.default.string,
|
|
721
|
+
groups: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
722
|
+
getValue: _propTypes.default.func.isRequired,
|
|
723
|
+
tickSize: _propTypes.default.number
|
|
724
|
+
})),
|
|
713
725
|
hideTooltip: _propTypes.default.bool,
|
|
714
726
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
715
727
|
ignoreTooltip: _propTypes.default.bool,
|
|
@@ -760,6 +772,10 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
760
772
|
disableTicks: _propTypes.default.bool,
|
|
761
773
|
domainLimit: _propTypes.default.oneOfType([_propTypes.default.oneOf(['nice', 'strict']), _propTypes.default.func]),
|
|
762
774
|
fill: _propTypes.default.string,
|
|
775
|
+
groups: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
776
|
+
getValue: _propTypes.default.func.isRequired,
|
|
777
|
+
tickSize: _propTypes.default.number
|
|
778
|
+
})),
|
|
763
779
|
hideTooltip: _propTypes.default.bool,
|
|
764
780
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
765
781
|
ignoreTooltip: _propTypes.default.bool,
|
package/RadarChart/index.d.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { RadarDataProvider } from "./RadarDataProvider/index.js";
|
|
2
2
|
export { RadarChart } from "./RadarChart.js";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated radar chart is now stable, import `RadarChart` instead
|
|
5
|
+
*/
|
|
6
|
+
export declare const Unstable_RadarChart: import("react").ForwardRefExoticComponent<import("./RadarChart.js").RadarChartProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
4
7
|
export { RadarDataProvider } from "./RadarDataProvider/index.js";
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated radar data provider is now stable, import `RadarDataProvider` instead
|
|
10
|
+
*/
|
|
11
|
+
export declare const Unstable_RadarDataProvider: typeof RadarDataProvider;
|
|
5
12
|
export type { RadarChartProps, RadarChartSlots, RadarChartSlotProps } from "./RadarChart.js";
|
|
6
13
|
export type { RadarDataProviderProps, RadarSeries } from "./RadarDataProvider/index.js";
|
|
7
14
|
export * from "./RadarGrid/index.js";
|
package/RadarChart/index.js
CHANGED
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
7
|
Unstable_RadarChart: true,
|
|
8
|
-
RadarChart: true,
|
|
9
8
|
Unstable_RadarDataProvider: true,
|
|
9
|
+
RadarChart: true,
|
|
10
10
|
RadarDataProvider: true
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "RadarChart", {
|
|
@@ -21,18 +21,7 @@ Object.defineProperty(exports, "RadarDataProvider", {
|
|
|
21
21
|
return _RadarDataProvider.RadarDataProvider;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _RadarChart.RadarChart;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "Unstable_RadarDataProvider", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _RadarDataProvider.RadarDataProvider;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
24
|
+
exports.Unstable_RadarDataProvider = exports.Unstable_RadarChart = void 0;
|
|
36
25
|
var _RadarChart = require("./RadarChart");
|
|
37
26
|
var _RadarDataProvider = require("./RadarDataProvider");
|
|
38
27
|
var _RadarGrid = require("./RadarGrid");
|
|
@@ -82,4 +71,14 @@ Object.keys(_RadarSeriesPlot).forEach(function (key) {
|
|
|
82
71
|
return _RadarSeriesPlot[key];
|
|
83
72
|
}
|
|
84
73
|
});
|
|
85
|
-
});
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* @deprecated radar chart is now stable, import `RadarChart` instead
|
|
77
|
+
*/
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
79
|
+
const Unstable_RadarChart = exports.Unstable_RadarChart = _RadarChart.RadarChart;
|
|
80
|
+
/**
|
|
81
|
+
* @deprecated radar data provider is now stable, import `RadarDataProvider` instead
|
|
82
|
+
*/
|
|
83
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
84
|
+
const Unstable_RadarDataProvider = exports.Unstable_RadarDataProvider = _RadarDataProvider.RadarDataProvider;
|
|
@@ -6,6 +6,7 @@ import { ScatterPlotProps, ScatterPlotSlotProps, ScatterPlotSlots } from "./Scat
|
|
|
6
6
|
import { ChartContainerProps } from "../ChartContainer/index.js";
|
|
7
7
|
import { ChartsAxisProps } from "../ChartsAxis/index.js";
|
|
8
8
|
import { ScatterSeriesType } from "../models/seriesType/scatter.js";
|
|
9
|
+
import { ChartsTooltipProps } from "../ChartsTooltip/index.js";
|
|
9
10
|
import { ChartsTooltipSlots, ChartsTooltipSlotProps } from "../ChartsTooltip/ChartTooltip.types.js";
|
|
10
11
|
import { ChartsLegendSlotProps, ChartsLegendSlots } from "../ChartsLegend/index.js";
|
|
11
12
|
import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from "../ChartsOverlay/index.js";
|
|
@@ -15,7 +16,13 @@ import { ChartsGridProps } from "../ChartsGrid/index.js";
|
|
|
15
16
|
import { UseChartVoronoiSignature } from "../internals/plugins/featurePlugins/useChartVoronoi/index.js";
|
|
16
17
|
import { ScatterChartPluginsSignatures } from "./ScatterChart.plugins.js";
|
|
17
18
|
export interface ScatterChartSlots extends ChartsAxisSlots, ScatterPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
|
|
18
|
-
export interface ScatterChartSlotProps extends ChartsAxisSlotProps, ScatterPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {
|
|
19
|
+
export interface ScatterChartSlotProps extends ChartsAxisSlotProps, ScatterPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, Omit<ChartsTooltipSlotProps, 'tooltip'>, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {
|
|
20
|
+
/**
|
|
21
|
+
* Slot props for the tooltip component.
|
|
22
|
+
* @default {}
|
|
23
|
+
*/
|
|
24
|
+
tooltip?: Partial<ChartsTooltipProps<'item' | 'none'>>;
|
|
25
|
+
}
|
|
19
26
|
export type ScatterSeries = MakeOptional<ScatterSeriesType, 'type'>;
|
|
20
27
|
export interface ScatterChartProps extends Omit<ChartContainerProps<'scatter', ScatterChartPluginsSignatures>, 'series' | 'plugins' | 'onItemClick' | 'experimentalFeatures' | 'highlightedAxis' | 'onHighlightedAxisChange'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
|
|
21
28
|
/**
|
|
@@ -246,6 +246,10 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
246
246
|
disableTicks: _propTypes.default.bool,
|
|
247
247
|
domainLimit: _propTypes.default.oneOfType([_propTypes.default.oneOf(['nice', 'strict']), _propTypes.default.func]),
|
|
248
248
|
fill: _propTypes.default.string,
|
|
249
|
+
groups: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
250
|
+
getValue: _propTypes.default.func.isRequired,
|
|
251
|
+
tickSize: _propTypes.default.number
|
|
252
|
+
})),
|
|
249
253
|
height: _propTypes.default.number,
|
|
250
254
|
hideTooltip: _propTypes.default.bool,
|
|
251
255
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
@@ -297,6 +301,10 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
297
301
|
disableTicks: _propTypes.default.bool,
|
|
298
302
|
domainLimit: _propTypes.default.oneOfType([_propTypes.default.oneOf(['nice', 'strict']), _propTypes.default.func]),
|
|
299
303
|
fill: _propTypes.default.string,
|
|
304
|
+
groups: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
305
|
+
getValue: _propTypes.default.func.isRequired,
|
|
306
|
+
tickSize: _propTypes.default.number
|
|
307
|
+
})),
|
|
300
308
|
height: _propTypes.default.number,
|
|
301
309
|
hideTooltip: _propTypes.default.bool,
|
|
302
310
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
@@ -679,6 +687,10 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
679
687
|
disableTicks: _propTypes.default.bool,
|
|
680
688
|
domainLimit: _propTypes.default.oneOfType([_propTypes.default.oneOf(['nice', 'strict']), _propTypes.default.func]),
|
|
681
689
|
fill: _propTypes.default.string,
|
|
690
|
+
groups: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
691
|
+
getValue: _propTypes.default.func.isRequired,
|
|
692
|
+
tickSize: _propTypes.default.number
|
|
693
|
+
})),
|
|
682
694
|
hideTooltip: _propTypes.default.bool,
|
|
683
695
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
684
696
|
ignoreTooltip: _propTypes.default.bool,
|
|
@@ -729,6 +741,10 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
729
741
|
disableTicks: _propTypes.default.bool,
|
|
730
742
|
domainLimit: _propTypes.default.oneOfType([_propTypes.default.oneOf(['nice', 'strict']), _propTypes.default.func]),
|
|
731
743
|
fill: _propTypes.default.string,
|
|
744
|
+
groups: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
745
|
+
getValue: _propTypes.default.func.isRequired,
|
|
746
|
+
tickSize: _propTypes.default.number
|
|
747
|
+
})),
|
|
732
748
|
hideTooltip: _propTypes.default.bool,
|
|
733
749
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
734
750
|
ignoreTooltip: _propTypes.default.bool,
|
|
@@ -360,6 +360,10 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
360
360
|
disableTicks: _propTypes.default.bool,
|
|
361
361
|
domainLimit: _propTypes.default.oneOfType([_propTypes.default.oneOf(['nice', 'strict']), _propTypes.default.func]),
|
|
362
362
|
fill: _propTypes.default.string,
|
|
363
|
+
groups: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
364
|
+
getValue: _propTypes.default.func.isRequired,
|
|
365
|
+
tickSize: _propTypes.default.number
|
|
366
|
+
})),
|
|
363
367
|
height: _propTypes.default.number,
|
|
364
368
|
hideTooltip: _propTypes.default.bool,
|
|
365
369
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
@@ -411,6 +415,10 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
411
415
|
disableTicks: _propTypes.default.bool,
|
|
412
416
|
domainLimit: _propTypes.default.oneOfType([_propTypes.default.oneOf(['nice', 'strict']), _propTypes.default.func]),
|
|
413
417
|
fill: _propTypes.default.string,
|
|
418
|
+
groups: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
419
|
+
getValue: _propTypes.default.func.isRequired,
|
|
420
|
+
tickSize: _propTypes.default.number
|
|
421
|
+
})),
|
|
414
422
|
height: _propTypes.default.number,
|
|
415
423
|
hideTooltip: _propTypes.default.bool,
|
|
416
424
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
@@ -792,6 +800,10 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
792
800
|
disableTicks: _propTypes.default.bool,
|
|
793
801
|
domainLimit: _propTypes.default.oneOfType([_propTypes.default.oneOf(['nice', 'strict']), _propTypes.default.func]),
|
|
794
802
|
fill: _propTypes.default.string,
|
|
803
|
+
groups: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
804
|
+
getValue: _propTypes.default.func.isRequired,
|
|
805
|
+
tickSize: _propTypes.default.number
|
|
806
|
+
})),
|
|
795
807
|
hideTooltip: _propTypes.default.bool,
|
|
796
808
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
797
809
|
ignoreTooltip: _propTypes.default.bool,
|
|
@@ -842,6 +854,10 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
842
854
|
disableTicks: _propTypes.default.bool,
|
|
843
855
|
domainLimit: _propTypes.default.oneOfType([_propTypes.default.oneOf(['nice', 'strict']), _propTypes.default.func]),
|
|
844
856
|
fill: _propTypes.default.string,
|
|
857
|
+
groups: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
858
|
+
getValue: _propTypes.default.func.isRequired,
|
|
859
|
+
tickSize: _propTypes.default.number
|
|
860
|
+
})),
|
|
845
861
|
hideTooltip: _propTypes.default.bool,
|
|
846
862
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
847
863
|
ignoreTooltip: _propTypes.default.bool,
|
package/esm/BarChart/BarChart.js
CHANGED
|
@@ -264,6 +264,10 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
264
264
|
disableTicks: PropTypes.bool,
|
|
265
265
|
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
266
266
|
fill: PropTypes.string,
|
|
267
|
+
groups: PropTypes.arrayOf(PropTypes.shape({
|
|
268
|
+
getValue: PropTypes.func.isRequired,
|
|
269
|
+
tickSize: PropTypes.number
|
|
270
|
+
})),
|
|
267
271
|
height: PropTypes.number,
|
|
268
272
|
hideTooltip: PropTypes.bool,
|
|
269
273
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -315,6 +319,10 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
315
319
|
disableTicks: PropTypes.bool,
|
|
316
320
|
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
317
321
|
fill: PropTypes.string,
|
|
322
|
+
groups: PropTypes.arrayOf(PropTypes.shape({
|
|
323
|
+
getValue: PropTypes.func.isRequired,
|
|
324
|
+
tickSize: PropTypes.number
|
|
325
|
+
})),
|
|
318
326
|
height: PropTypes.number,
|
|
319
327
|
hideTooltip: PropTypes.bool,
|
|
320
328
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -697,6 +705,10 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
697
705
|
disableTicks: PropTypes.bool,
|
|
698
706
|
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
699
707
|
fill: PropTypes.string,
|
|
708
|
+
groups: PropTypes.arrayOf(PropTypes.shape({
|
|
709
|
+
getValue: PropTypes.func.isRequired,
|
|
710
|
+
tickSize: PropTypes.number
|
|
711
|
+
})),
|
|
700
712
|
hideTooltip: PropTypes.bool,
|
|
701
713
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
702
714
|
ignoreTooltip: PropTypes.bool,
|
|
@@ -747,6 +759,10 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
747
759
|
disableTicks: PropTypes.bool,
|
|
748
760
|
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
749
761
|
fill: PropTypes.string,
|
|
762
|
+
groups: PropTypes.arrayOf(PropTypes.shape({
|
|
763
|
+
getValue: PropTypes.func.isRequired,
|
|
764
|
+
tickSize: PropTypes.number
|
|
765
|
+
})),
|
|
750
766
|
hideTooltip: PropTypes.bool,
|
|
751
767
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
752
768
|
ignoreTooltip: PropTypes.bool,
|
|
@@ -234,6 +234,10 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
234
234
|
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
235
235
|
endAngle: PropTypes.number,
|
|
236
236
|
fill: PropTypes.string,
|
|
237
|
+
groups: PropTypes.arrayOf(PropTypes.shape({
|
|
238
|
+
getValue: PropTypes.func.isRequired,
|
|
239
|
+
tickSize: PropTypes.number
|
|
240
|
+
})),
|
|
237
241
|
height: PropTypes.number,
|
|
238
242
|
hideTooltip: PropTypes.bool,
|
|
239
243
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
@@ -286,6 +290,10 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
286
290
|
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
287
291
|
endAngle: PropTypes.number,
|
|
288
292
|
fill: PropTypes.string,
|
|
293
|
+
groups: PropTypes.arrayOf(PropTypes.shape({
|
|
294
|
+
getValue: PropTypes.func.isRequired,
|
|
295
|
+
tickSize: PropTypes.number
|
|
296
|
+
})),
|
|
289
297
|
height: PropTypes.number,
|
|
290
298
|
hideTooltip: PropTypes.bool,
|
|
291
299
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
@@ -707,6 +715,10 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
707
715
|
disableTicks: PropTypes.bool,
|
|
708
716
|
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
709
717
|
fill: PropTypes.string,
|
|
718
|
+
groups: PropTypes.arrayOf(PropTypes.shape({
|
|
719
|
+
getValue: PropTypes.func.isRequired,
|
|
720
|
+
tickSize: PropTypes.number
|
|
721
|
+
})),
|
|
710
722
|
height: PropTypes.number,
|
|
711
723
|
hideTooltip: PropTypes.bool,
|
|
712
724
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -758,6 +770,10 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
758
770
|
disableTicks: PropTypes.bool,
|
|
759
771
|
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
760
772
|
fill: PropTypes.string,
|
|
773
|
+
groups: PropTypes.arrayOf(PropTypes.shape({
|
|
774
|
+
getValue: PropTypes.func.isRequired,
|
|
775
|
+
tickSize: PropTypes.number
|
|
776
|
+
})),
|
|
761
777
|
height: PropTypes.number,
|
|
762
778
|
hideTooltip: PropTypes.bool,
|
|
763
779
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -1140,6 +1156,10 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
1140
1156
|
disableTicks: PropTypes.bool,
|
|
1141
1157
|
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
1142
1158
|
fill: PropTypes.string,
|
|
1159
|
+
groups: PropTypes.arrayOf(PropTypes.shape({
|
|
1160
|
+
getValue: PropTypes.func.isRequired,
|
|
1161
|
+
tickSize: PropTypes.number
|
|
1162
|
+
})),
|
|
1143
1163
|
hideTooltip: PropTypes.bool,
|
|
1144
1164
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
1145
1165
|
ignoreTooltip: PropTypes.bool,
|
|
@@ -1190,6 +1210,10 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
1190
1210
|
disableTicks: PropTypes.bool,
|
|
1191
1211
|
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
1192
1212
|
fill: PropTypes.string,
|
|
1213
|
+
groups: PropTypes.arrayOf(PropTypes.shape({
|
|
1214
|
+
getValue: PropTypes.func.isRequired,
|
|
1215
|
+
tickSize: PropTypes.number
|
|
1216
|
+
})),
|
|
1193
1217
|
hideTooltip: PropTypes.bool,
|
|
1194
1218
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
1195
1219
|
ignoreTooltip: PropTypes.bool,
|
|
@@ -43,9 +43,7 @@ export default function ChartsXHighlight(props) {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
46
|
-
children: [isBandScaleX && xScale(value) !== undefined && /*#__PURE__*/_jsx(ChartsAxisHighlightPath
|
|
47
|
-
// @ts-expect-error, xScale value is checked in the statement above
|
|
48
|
-
, {
|
|
46
|
+
children: [isBandScaleX && xScale(value) !== undefined && /*#__PURE__*/_jsx(ChartsAxisHighlightPath, {
|
|
49
47
|
d: `M ${xScale(value) - (xScale.step() - xScale.bandwidth()) / 2} ${top} l ${xScale.step()} 0 l 0 ${height} l ${-xScale.step()} 0 Z`,
|
|
50
48
|
className: classes.root,
|
|
51
49
|
ownerState: {
|
|
@@ -44,9 +44,7 @@ export default function ChartsYHighlight(props) {
|
|
|
44
44
|
}
|
|
45
45
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
46
46
|
children: [isBandScaleY && yScale(value) !== undefined && /*#__PURE__*/_jsx(ChartsAxisHighlightPath, {
|
|
47
|
-
d: `M ${left} ${
|
|
48
|
-
// @ts-expect-error, yScale value is checked in the statement above
|
|
49
|
-
yScale(value) - (yScale.step() - yScale.bandwidth()) / 2} l 0 ${yScale.step()} l ${width} 0 l 0 ${-yScale.step()} Z`,
|
|
47
|
+
d: `M ${left} ${yScale(value) - (yScale.step() - yScale.bandwidth()) / 2} l 0 ${yScale.step()} l ${width} 0 l 0 ${-yScale.step()} Z`,
|
|
50
48
|
className: classes.root,
|
|
51
49
|
ownerState: {
|
|
52
50
|
axisHighlight: 'band'
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ChartsTooltipContainerProps } from "./ChartsTooltipContainer.js";
|
|
3
|
-
|
|
3
|
+
import { TriggerOptions } from "./utils.js";
|
|
4
|
+
export interface ChartsTooltipProps<T extends TriggerOptions = TriggerOptions> extends Omit<ChartsTooltipContainerProps<T>, 'children'> {}
|
|
4
5
|
/**
|
|
5
6
|
* Demos:
|
|
6
7
|
*
|
|
@@ -189,9 +189,9 @@ process.env.NODE_ENV !== "production" ? ChartsTooltip.propTypes = {
|
|
|
189
189
|
transition: PropTypes.bool,
|
|
190
190
|
/**
|
|
191
191
|
* Select the kind of tooltip to display
|
|
192
|
-
* - 'item': Shows data about the item below the mouse
|
|
193
|
-
* - 'axis': Shows values associated with the hovered x value
|
|
194
|
-
* - 'none': Does not display tooltip
|
|
192
|
+
* - 'item': Shows data about the item below the mouse;
|
|
193
|
+
* - 'axis': Shows values associated with the hovered x value;
|
|
194
|
+
* - 'none': Does not display tooltip.
|
|
195
195
|
* @default 'axis'
|
|
196
196
|
*/
|
|
197
197
|
trigger: PropTypes.oneOf(['axis', 'item', 'none'])
|
|
@@ -2,15 +2,15 @@ import * as React from 'react';
|
|
|
2
2
|
import { PopperProps } from '@mui/material/Popper';
|
|
3
3
|
import { TriggerOptions } from "./utils.js";
|
|
4
4
|
import { ChartsTooltipClasses } from "./chartsTooltipClasses.js";
|
|
5
|
-
export interface ChartsTooltipContainerProps extends Partial<PopperProps> {
|
|
5
|
+
export interface ChartsTooltipContainerProps<T extends TriggerOptions = TriggerOptions> extends Partial<PopperProps> {
|
|
6
6
|
/**
|
|
7
7
|
* Select the kind of tooltip to display
|
|
8
|
-
* - 'item': Shows data about the item below the mouse
|
|
9
|
-
* - 'axis': Shows values associated with the hovered x value
|
|
10
|
-
* - 'none': Does not display tooltip
|
|
8
|
+
* - 'item': Shows data about the item below the mouse;
|
|
9
|
+
* - 'axis': Shows values associated with the hovered x value;
|
|
10
|
+
* - 'none': Does not display tooltip.
|
|
11
11
|
* @default 'axis'
|
|
12
12
|
*/
|
|
13
|
-
trigger?:
|
|
13
|
+
trigger?: T;
|
|
14
14
|
/**
|
|
15
15
|
* Override or extend the styles applied to the component.
|
|
16
16
|
*/
|
|
@@ -295,9 +295,9 @@ process.env.NODE_ENV !== "production" ? ChartsTooltipContainer.propTypes = {
|
|
|
295
295
|
transition: PropTypes.bool,
|
|
296
296
|
/**
|
|
297
297
|
* Select the kind of tooltip to display
|
|
298
|
-
* - 'item': Shows data about the item below the mouse
|
|
299
|
-
* - 'axis': Shows values associated with the hovered x value
|
|
300
|
-
* - 'none': Does not display tooltip
|
|
298
|
+
* - 'item': Shows data about the item below the mouse;
|
|
299
|
+
* - 'axis': Shows values associated with the hovered x value;
|
|
300
|
+
* - 'none': Does not display tooltip.
|
|
301
301
|
* @default 'axis'
|
|
302
302
|
*/
|
|
303
303
|
trigger: PropTypes.oneOf(['axis', 'item', 'none'])
|