@mui/x-charts 6.0.0-alpha.10 → 6.0.0-alpha.12
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/BarElement.d.ts +1 -1
- package/CHANGELOG.md +162 -1
- package/ChartsLegend/ChartsLegend.js +1 -1
- package/ChartsSurface.d.ts +1 -1
- package/ChartsSurface.js +2 -2
- package/ChartsTooltip/ChartsAxisTooltipContent.js +0 -1
- package/ChartsTooltip/ChartsItemTooltipContent.js +0 -1
- package/ChartsTooltip/ChartsTooltip.js +4 -4
- package/ChartsTooltip/ChartsTooltipTable.d.ts +3 -10
- package/ChartsTooltip/ChartsTooltipTable.js +17 -10
- package/LineChart/AreaElement.d.ts +1 -1
- package/LineChart/LineElement.d.ts +1 -1
- package/LineChart/MarkElement.js +1 -1
- package/PieChart/PieArc.js +1 -1
- package/PieChart/PieArcLabel.js +1 -1
- package/README.md +3 -9
- package/ResponsiveChartContainer/index.js +1 -1
- package/SparkLineChart/SparkLineChart.js +5 -2
- package/context/CartesianContextProvider.js +4 -2
- package/esm/ChartsLegend/ChartsLegend.js +1 -1
- package/esm/ChartsSurface.js +1 -1
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +0 -1
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +0 -1
- package/esm/ChartsTooltip/ChartsTooltip.js +2 -2
- package/esm/ChartsTooltip/ChartsTooltipTable.js +17 -10
- package/esm/LineChart/MarkElement.js +1 -1
- package/esm/PieChart/PieArc.js +1 -1
- package/esm/PieChart/PieArcLabel.js +1 -1
- package/esm/ResponsiveChartContainer/index.js +1 -1
- package/esm/SparkLineChart/SparkLineChart.js +5 -2
- package/esm/context/CartesianContextProvider.js +5 -3
- package/esm/internals/components/AxisSharedComponents.js +4 -4
- package/index.js +1 -1
- package/internals/components/AxisSharedComponents.js +4 -4
- package/legacy/ChartsLegend/ChartsLegend.js +1 -1
- package/legacy/ChartsSurface.js +1 -1
- package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +0 -1
- package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +0 -1
- package/legacy/ChartsTooltip/ChartsTooltip.js +2 -2
- package/legacy/ChartsTooltip/ChartsTooltipTable.js +34 -26
- package/legacy/LineChart/MarkElement.js +1 -1
- package/legacy/PieChart/PieArc.js +1 -1
- package/legacy/PieChart/PieArcLabel.js +1 -1
- package/legacy/ResponsiveChartContainer/index.js +1 -1
- package/legacy/SparkLineChart/SparkLineChart.js +5 -2
- package/legacy/context/CartesianContextProvider.js +5 -3
- package/legacy/index.js +1 -1
- package/legacy/internals/components/AxisSharedComponents.js +4 -4
- package/models/axis.d.ts +2 -2
- package/modern/ChartsLegend/ChartsLegend.js +1 -1
- package/modern/ChartsSurface.js +1 -1
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +0 -1
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +0 -1
- package/modern/ChartsTooltip/ChartsTooltip.js +2 -2
- package/modern/ChartsTooltip/ChartsTooltipTable.js +17 -10
- package/modern/LineChart/MarkElement.js +1 -1
- package/modern/PieChart/PieArc.js +1 -1
- package/modern/PieChart/PieArcLabel.js +1 -1
- package/modern/ResponsiveChartContainer/index.js +1 -1
- package/modern/SparkLineChart/SparkLineChart.js +5 -2
- package/modern/context/CartesianContextProvider.js +4 -2
- package/modern/index.js +1 -1
- package/modern/internals/components/AxisSharedComponents.js +4 -4
- package/package.json +2 -2
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import Box from '@mui/
|
|
2
|
-
import Paper from '@mui/material/Paper';
|
|
1
|
+
import Box from '@mui/system/Box';
|
|
3
2
|
import { styled } from '@mui/material/styles';
|
|
4
3
|
import { tooltipClasses } from './tooltipClasses';
|
|
5
|
-
export const ChartsTooltipPaper = styled(
|
|
4
|
+
export const ChartsTooltipPaper = styled('div', {
|
|
6
5
|
name: 'MuiChartsTooltip',
|
|
7
|
-
slot: '
|
|
8
|
-
})({
|
|
6
|
+
slot: 'Container'
|
|
7
|
+
})(({
|
|
8
|
+
theme
|
|
9
|
+
}) => ({
|
|
10
|
+
backgroundColor: (theme.vars || theme).palette.background.paper,
|
|
11
|
+
color: (theme.vars || theme).palette.text.primary,
|
|
12
|
+
transition: theme.transitions.create('box-shadow'),
|
|
13
|
+
border: `1px solid ${(theme.vars || theme).palette.divider}`,
|
|
14
|
+
borderRadius: theme.shape.borderRadius
|
|
15
|
+
}));
|
|
9
16
|
export const ChartsTooltipTable = styled('table', {
|
|
10
17
|
name: 'MuiChartsTooltip',
|
|
11
18
|
slot: 'Table'
|
|
@@ -14,7 +21,7 @@ export const ChartsTooltipTable = styled('table', {
|
|
|
14
21
|
}) => ({
|
|
15
22
|
borderSpacing: 0,
|
|
16
23
|
'& thead td': {
|
|
17
|
-
borderBottom: `solid ${theme.palette.divider} 1px`
|
|
24
|
+
borderBottom: `solid ${(theme.vars || theme).palette.divider} 1px`
|
|
18
25
|
}
|
|
19
26
|
}));
|
|
20
27
|
export const ChartsTooltipRow = styled('tr', {
|
|
@@ -37,13 +44,13 @@ export const ChartsTooltipCell = styled('td', {
|
|
|
37
44
|
theme
|
|
38
45
|
}) => ({
|
|
39
46
|
verticalAlign: 'middle',
|
|
40
|
-
color: theme.palette.text.secondary,
|
|
47
|
+
color: (theme.vars || theme).palette.text.secondary,
|
|
41
48
|
[`&.${tooltipClasses.labelCell}`]: {
|
|
42
49
|
paddingLeft: theme.spacing(1)
|
|
43
50
|
},
|
|
44
51
|
[`&.${tooltipClasses.valueCell}`]: {
|
|
45
52
|
paddingLeft: theme.spacing(4),
|
|
46
|
-
color: theme.palette.text.primary
|
|
53
|
+
color: (theme.vars || theme).palette.text.primary
|
|
47
54
|
},
|
|
48
55
|
'td:first-of-type&': {
|
|
49
56
|
paddingLeft: theme.spacing(2)
|
|
@@ -63,7 +70,7 @@ export const ChartsTooltipMark = styled(Box, {
|
|
|
63
70
|
height: theme.spacing(1),
|
|
64
71
|
borderRadius: '50%',
|
|
65
72
|
backgroundColor: ownerState.color,
|
|
66
|
-
borderColor: theme.palette.background.paper,
|
|
67
|
-
border: `solid ${theme.palette.background.paper} ${theme.spacing(0.25)}`,
|
|
73
|
+
borderColor: (theme.vars || theme).palette.background.paper,
|
|
74
|
+
border: `solid ${(theme.vars || theme).palette.background.paper} ${theme.spacing(0.25)}`,
|
|
68
75
|
boxSizing: 'content-box'
|
|
69
76
|
}));
|
|
@@ -38,7 +38,7 @@ const MarkElementPath = styled('path', {
|
|
|
38
38
|
}) => ({
|
|
39
39
|
transform: `translate(${ownerState.x}px, ${ownerState.y}px)`,
|
|
40
40
|
transformOrigin: `${ownerState.x}px ${ownerState.y}px`,
|
|
41
|
-
fill: theme.palette.background.paper,
|
|
41
|
+
fill: (theme.vars || theme).palette.background.paper,
|
|
42
42
|
stroke: ownerState.color,
|
|
43
43
|
strokeWidth: 2
|
|
44
44
|
}));
|
package/esm/PieChart/PieArc.js
CHANGED
|
@@ -42,7 +42,7 @@ const useChartDimensions = (inWidth, inHeight) => {
|
|
|
42
42
|
let animationFrame;
|
|
43
43
|
const observer = new ResizeObserver(() => {
|
|
44
44
|
// See https://github.com/mui/mui-x/issues/8733
|
|
45
|
-
animationFrame =
|
|
45
|
+
animationFrame = requestAnimationFrame(() => {
|
|
46
46
|
computeSize();
|
|
47
47
|
});
|
|
48
48
|
});
|
|
@@ -58,7 +58,7 @@ const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(pro
|
|
|
58
58
|
margin: margin,
|
|
59
59
|
xAxis: [_extends({
|
|
60
60
|
id: DEFAULT_X_AXIS_KEY,
|
|
61
|
-
scaleType: plotType === 'bar' ? 'band' : '
|
|
61
|
+
scaleType: plotType === 'bar' ? 'band' : 'point',
|
|
62
62
|
data: Array.from({
|
|
63
63
|
length: data.length
|
|
64
64
|
}, (_, index) => index),
|
|
@@ -69,7 +69,10 @@ const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(pro
|
|
|
69
69
|
disableAxisListener: (!showTooltip || (tooltip == null ? void 0 : tooltip.trigger) !== 'axis') && (axisHighlight == null ? void 0 : axisHighlight.x) === 'none' && (axisHighlight == null ? void 0 : axisHighlight.y) === 'none',
|
|
70
70
|
children: [plotType === 'bar' && /*#__PURE__*/_jsx(BarPlot, {
|
|
71
71
|
slots: slots,
|
|
72
|
-
slotProps: slotProps
|
|
72
|
+
slotProps: slotProps,
|
|
73
|
+
sx: {
|
|
74
|
+
shapeRendering: 'auto'
|
|
75
|
+
}
|
|
73
76
|
}), plotType === 'line' && /*#__PURE__*/_jsxs(React.Fragment, {
|
|
74
77
|
children: [/*#__PURE__*/_jsx(AreaPlot, {
|
|
75
78
|
slots: slots,
|
|
@@ -12,7 +12,8 @@ import { SeriesContext } from './SeriesContextProvider';
|
|
|
12
12
|
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '../constants';
|
|
13
13
|
import { getTicksNumber } from '../hooks/useTicks';
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
-
const DEFAULT_CATEGORY_GAP_RATIO = 0.
|
|
15
|
+
const DEFAULT_CATEGORY_GAP_RATIO = 0.2;
|
|
16
|
+
const DEFAULT_BAR_GAP_RATIO = 0.1;
|
|
16
17
|
|
|
17
18
|
// TODO: those might be better placed in a distinct file
|
|
18
19
|
const xExtremumGetters = {
|
|
@@ -104,11 +105,12 @@ function CartesianContextProvider({
|
|
|
104
105
|
const [minData, maxData] = getAxisExtremum(axis, xExtremumGetters, isDefaultAxis);
|
|
105
106
|
const range = [drawingArea.left, drawingArea.left + drawingArea.width];
|
|
106
107
|
if (isBandScaleConfig(axis)) {
|
|
107
|
-
var _axis$categoryGapRati;
|
|
108
|
+
var _axis$categoryGapRati, _axis$barGapRatio;
|
|
108
109
|
const categoryGapRatio = (_axis$categoryGapRati = axis.categoryGapRatio) != null ? _axis$categoryGapRati : DEFAULT_CATEGORY_GAP_RATIO;
|
|
110
|
+
const barGapRatio = (_axis$barGapRatio = axis.barGapRatio) != null ? _axis$barGapRatio : DEFAULT_BAR_GAP_RATIO;
|
|
109
111
|
completedXAxis[axis.id] = _extends({
|
|
110
112
|
categoryGapRatio,
|
|
111
|
-
barGapRatio
|
|
113
|
+
barGapRatio
|
|
112
114
|
}, axis, {
|
|
113
115
|
scale: scaleBand(axis.data, range).paddingInner(categoryGapRatio).paddingOuter(categoryGapRatio / 2),
|
|
114
116
|
ticksNumber: axis.data.length
|
|
@@ -47,7 +47,7 @@ export const ChartsLine = styled('line', {
|
|
|
47
47
|
})(({
|
|
48
48
|
theme
|
|
49
49
|
}) => ({
|
|
50
|
-
stroke: theme.palette.text.primary,
|
|
50
|
+
stroke: (theme.vars || theme).palette.text.primary,
|
|
51
51
|
shapeRendering: 'crispEdges',
|
|
52
52
|
strokeWidth: 1
|
|
53
53
|
}));
|
|
@@ -58,7 +58,7 @@ export const ChartsTick = styled('line', {
|
|
|
58
58
|
})(({
|
|
59
59
|
theme
|
|
60
60
|
}) => ({
|
|
61
|
-
stroke: theme.palette.text.primary,
|
|
61
|
+
stroke: (theme.vars || theme).palette.text.primary,
|
|
62
62
|
shapeRendering: 'crispEdges'
|
|
63
63
|
}));
|
|
64
64
|
export const ChartsTickLabel = styled('text', {
|
|
@@ -68,7 +68,7 @@ export const ChartsTickLabel = styled('text', {
|
|
|
68
68
|
})(({
|
|
69
69
|
theme
|
|
70
70
|
}) => _extends({}, theme.typography.caption, {
|
|
71
|
-
fill: theme.palette.text.primary
|
|
71
|
+
fill: (theme.vars || theme).palette.text.primary
|
|
72
72
|
}));
|
|
73
73
|
export const ChartsLabel = styled('text', {
|
|
74
74
|
name: 'MuiChartsAxis',
|
|
@@ -77,5 +77,5 @@ export const ChartsLabel = styled('text', {
|
|
|
77
77
|
})(({
|
|
78
78
|
theme
|
|
79
79
|
}) => _extends({}, theme.typography.body1, {
|
|
80
|
-
fill: theme.palette.text.primary
|
|
80
|
+
fill: (theme.vars || theme).palette.text.primary
|
|
81
81
|
}));
|
package/index.js
CHANGED
|
@@ -55,7 +55,7 @@ const ChartsLine = (0, _styles.styled)('line', {
|
|
|
55
55
|
})(({
|
|
56
56
|
theme
|
|
57
57
|
}) => ({
|
|
58
|
-
stroke: theme.palette.text.primary,
|
|
58
|
+
stroke: (theme.vars || theme).palette.text.primary,
|
|
59
59
|
shapeRendering: 'crispEdges',
|
|
60
60
|
strokeWidth: 1
|
|
61
61
|
}));
|
|
@@ -67,7 +67,7 @@ const ChartsTick = (0, _styles.styled)('line', {
|
|
|
67
67
|
})(({
|
|
68
68
|
theme
|
|
69
69
|
}) => ({
|
|
70
|
-
stroke: theme.palette.text.primary,
|
|
70
|
+
stroke: (theme.vars || theme).palette.text.primary,
|
|
71
71
|
shapeRendering: 'crispEdges'
|
|
72
72
|
}));
|
|
73
73
|
exports.ChartsTick = ChartsTick;
|
|
@@ -78,7 +78,7 @@ const ChartsTickLabel = (0, _styles.styled)('text', {
|
|
|
78
78
|
})(({
|
|
79
79
|
theme
|
|
80
80
|
}) => (0, _extends2.default)({}, theme.typography.caption, {
|
|
81
|
-
fill: theme.palette.text.primary
|
|
81
|
+
fill: (theme.vars || theme).palette.text.primary
|
|
82
82
|
}));
|
|
83
83
|
exports.ChartsTickLabel = ChartsTickLabel;
|
|
84
84
|
const ChartsLabel = (0, _styles.styled)('text', {
|
|
@@ -88,6 +88,6 @@ const ChartsLabel = (0, _styles.styled)('text', {
|
|
|
88
88
|
})(({
|
|
89
89
|
theme
|
|
90
90
|
}) => (0, _extends2.default)({}, theme.typography.body1, {
|
|
91
|
-
fill: theme.palette.text.primary
|
|
91
|
+
fill: (theme.vars || theme).palette.text.primary
|
|
92
92
|
}));
|
|
93
93
|
exports.ChartsLabel = ChartsLabel;
|
|
@@ -123,7 +123,7 @@ export var ChartsLegendLabel = styled('text', {
|
|
|
123
123
|
return _extends({}, theme.typography.body1, {
|
|
124
124
|
color: 'inherit',
|
|
125
125
|
transform: "translate(\n calc(var(--ChartsLegend-itemMarkSize) + var(--ChartsLegend-labelSpacing)),\n calc(0.5 * var(--ChartsLegend-itemMarkSize))\n )",
|
|
126
|
-
fill: theme.palette.text.primary,
|
|
126
|
+
fill: (theme.vars || theme).palette.text.primary,
|
|
127
127
|
dominantBaseline: 'central'
|
|
128
128
|
});
|
|
129
129
|
});
|
package/legacy/ChartsSurface.js
CHANGED
|
@@ -2,7 +2,7 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
4
|
var _excluded = ["children", "width", "height", "viewBox", "disableAxisListener", "className", "sx"];
|
|
5
|
-
import { styled } from '@mui/
|
|
5
|
+
import { styled } from '@mui/material/styles';
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { useAxisEvents } from './hooks/useAxisEvents';
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -21,7 +21,6 @@ export function DefaultChartsAxisContent(props) {
|
|
|
21
21
|
};
|
|
22
22
|
return /*#__PURE__*/_jsx(ChartsTooltipPaper, {
|
|
23
23
|
sx: sx,
|
|
24
|
-
variant: "outlined",
|
|
25
24
|
className: classes.root,
|
|
26
25
|
children: /*#__PURE__*/_jsxs(ChartsTooltipTable, {
|
|
27
26
|
children: [axisValue != null && !axis.hideTooltip && /*#__PURE__*/_jsx("thead", {
|
|
@@ -26,7 +26,6 @@ export function DefaultChartsItemContent(props) {
|
|
|
26
26
|
var formattedValue = series.valueFormatter(series.data[itemData.dataIndex]);
|
|
27
27
|
return /*#__PURE__*/_jsx(ChartsTooltipPaper, {
|
|
28
28
|
sx: sx,
|
|
29
|
-
variant: "outlined",
|
|
30
29
|
className: classes.root,
|
|
31
30
|
children: /*#__PURE__*/_jsx(ChartsTooltipTable, {
|
|
32
31
|
children: /*#__PURE__*/_jsx("tbody", {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
4
|
-
import Popper from '@mui/
|
|
5
|
-
import NoSsr from '@mui/
|
|
4
|
+
import { Popper } from '@mui/base/Popper';
|
|
5
|
+
import { NoSsr } from '@mui/base/NoSsr';
|
|
6
6
|
import { InteractionContext } from '../context/InteractionProvider';
|
|
7
7
|
import { generateVirtualElement, useMouseTracker, getTootipHasData } from './utils';
|
|
8
8
|
import { ChartsItemTooltipContent } from './ChartsItemTooltipContent';
|
|
@@ -1,29 +1,37 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import Box from '@mui/
|
|
3
|
-
import Paper from '@mui/material/Paper';
|
|
2
|
+
import Box from '@mui/system/Box';
|
|
4
3
|
import { styled } from '@mui/material/styles';
|
|
5
4
|
import { tooltipClasses } from './tooltipClasses';
|
|
6
|
-
export var ChartsTooltipPaper = styled(
|
|
5
|
+
export var ChartsTooltipPaper = styled('div', {
|
|
7
6
|
name: 'MuiChartsTooltip',
|
|
8
|
-
slot: '
|
|
9
|
-
})({
|
|
7
|
+
slot: 'Container'
|
|
8
|
+
})(function (_ref) {
|
|
9
|
+
var theme = _ref.theme;
|
|
10
|
+
return {
|
|
11
|
+
backgroundColor: (theme.vars || theme).palette.background.paper,
|
|
12
|
+
color: (theme.vars || theme).palette.text.primary,
|
|
13
|
+
transition: theme.transitions.create('box-shadow'),
|
|
14
|
+
border: "1px solid ".concat((theme.vars || theme).palette.divider),
|
|
15
|
+
borderRadius: theme.shape.borderRadius
|
|
16
|
+
};
|
|
17
|
+
});
|
|
10
18
|
export var ChartsTooltipTable = styled('table', {
|
|
11
19
|
name: 'MuiChartsTooltip',
|
|
12
20
|
slot: 'Table'
|
|
13
|
-
})(function (
|
|
14
|
-
var theme =
|
|
21
|
+
})(function (_ref2) {
|
|
22
|
+
var theme = _ref2.theme;
|
|
15
23
|
return {
|
|
16
24
|
borderSpacing: 0,
|
|
17
25
|
'& thead td': {
|
|
18
|
-
borderBottom: "solid ".concat(theme.palette.divider, " 1px")
|
|
26
|
+
borderBottom: "solid ".concat((theme.vars || theme).palette.divider, " 1px")
|
|
19
27
|
}
|
|
20
28
|
};
|
|
21
29
|
});
|
|
22
30
|
export var ChartsTooltipRow = styled('tr', {
|
|
23
31
|
name: 'MuiChartsTooltip',
|
|
24
32
|
slot: 'Row'
|
|
25
|
-
})(function (
|
|
26
|
-
var theme =
|
|
33
|
+
})(function (_ref3) {
|
|
34
|
+
var theme = _ref3.theme;
|
|
27
35
|
return {
|
|
28
36
|
'tr:first-of-type& td': {
|
|
29
37
|
paddingTop: theme.spacing(1)
|
|
@@ -36,36 +44,36 @@ export var ChartsTooltipRow = styled('tr', {
|
|
|
36
44
|
export var ChartsTooltipCell = styled('td', {
|
|
37
45
|
name: 'MuiChartsTooltip',
|
|
38
46
|
slot: 'Cell'
|
|
39
|
-
})(function (
|
|
40
|
-
var
|
|
41
|
-
var theme =
|
|
42
|
-
return
|
|
47
|
+
})(function (_ref4) {
|
|
48
|
+
var _ref5;
|
|
49
|
+
var theme = _ref4.theme;
|
|
50
|
+
return _ref5 = {
|
|
43
51
|
verticalAlign: 'middle',
|
|
44
|
-
color: theme.palette.text.secondary
|
|
45
|
-
}, _defineProperty(
|
|
52
|
+
color: (theme.vars || theme).palette.text.secondary
|
|
53
|
+
}, _defineProperty(_ref5, "&.".concat(tooltipClasses.labelCell), {
|
|
46
54
|
paddingLeft: theme.spacing(1)
|
|
47
|
-
}), _defineProperty(
|
|
55
|
+
}), _defineProperty(_ref5, "&.".concat(tooltipClasses.valueCell), {
|
|
48
56
|
paddingLeft: theme.spacing(4),
|
|
49
|
-
color: theme.palette.text.primary
|
|
50
|
-
}), _defineProperty(
|
|
57
|
+
color: (theme.vars || theme).palette.text.primary
|
|
58
|
+
}), _defineProperty(_ref5, 'td:first-of-type&', {
|
|
51
59
|
paddingLeft: theme.spacing(2)
|
|
52
|
-
}), _defineProperty(
|
|
60
|
+
}), _defineProperty(_ref5, 'td:last-of-type&', {
|
|
53
61
|
paddingRight: theme.spacing(2)
|
|
54
|
-
}),
|
|
62
|
+
}), _ref5;
|
|
55
63
|
});
|
|
56
64
|
export var ChartsTooltipMark = styled(Box, {
|
|
57
65
|
name: 'MuiChartsTooltip',
|
|
58
66
|
slot: 'Mark'
|
|
59
|
-
})(function (
|
|
60
|
-
var theme =
|
|
61
|
-
ownerState =
|
|
67
|
+
})(function (_ref6) {
|
|
68
|
+
var theme = _ref6.theme,
|
|
69
|
+
ownerState = _ref6.ownerState;
|
|
62
70
|
return {
|
|
63
71
|
width: theme.spacing(1),
|
|
64
72
|
height: theme.spacing(1),
|
|
65
73
|
borderRadius: '50%',
|
|
66
74
|
backgroundColor: ownerState.color,
|
|
67
|
-
borderColor: theme.palette.background.paper,
|
|
68
|
-
border: "solid ".concat(theme.palette.background.paper, " ").concat(theme.spacing(0.25)),
|
|
75
|
+
borderColor: (theme.vars || theme).palette.background.paper,
|
|
76
|
+
border: "solid ".concat((theme.vars || theme).palette.background.paper, " ").concat(theme.spacing(0.25)),
|
|
69
77
|
boxSizing: 'content-box'
|
|
70
78
|
};
|
|
71
79
|
});
|
|
@@ -38,7 +38,7 @@ var MarkElementPath = styled('path', {
|
|
|
38
38
|
return {
|
|
39
39
|
transform: "translate(".concat(ownerState.x, "px, ").concat(ownerState.y, "px)"),
|
|
40
40
|
transformOrigin: "".concat(ownerState.x, "px ").concat(ownerState.y, "px"),
|
|
41
|
-
fill: theme.palette.background.paper,
|
|
41
|
+
fill: (theme.vars || theme).palette.background.paper,
|
|
42
42
|
stroke: ownerState.color,
|
|
43
43
|
strokeWidth: 2
|
|
44
44
|
};
|
|
@@ -35,7 +35,7 @@ var PieArcRoot = styled('path', {
|
|
|
35
35
|
var ownerState = _ref.ownerState,
|
|
36
36
|
theme = _ref.theme;
|
|
37
37
|
return {
|
|
38
|
-
stroke: theme.palette.background.paper,
|
|
38
|
+
stroke: (theme.vars || theme).palette.background.paper,
|
|
39
39
|
strokeWidth: 1,
|
|
40
40
|
strokeLinejoin: 'round',
|
|
41
41
|
fill: ownerState.color,
|
|
@@ -49,7 +49,7 @@ var useChartDimensions = function useChartDimensions(inWidth, inHeight) {
|
|
|
49
49
|
var animationFrame;
|
|
50
50
|
var observer = new ResizeObserver(function () {
|
|
51
51
|
// See https://github.com/mui/mui-x/issues/8733
|
|
52
|
-
animationFrame =
|
|
52
|
+
animationFrame = requestAnimationFrame(function () {
|
|
53
53
|
computeSize();
|
|
54
54
|
});
|
|
55
55
|
});
|
|
@@ -62,7 +62,7 @@ var SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(props
|
|
|
62
62
|
margin: margin,
|
|
63
63
|
xAxis: [_extends({
|
|
64
64
|
id: DEFAULT_X_AXIS_KEY,
|
|
65
|
-
scaleType: plotType === 'bar' ? 'band' : '
|
|
65
|
+
scaleType: plotType === 'bar' ? 'band' : 'point',
|
|
66
66
|
data: Array.from({
|
|
67
67
|
length: data.length
|
|
68
68
|
}, function (_, index) {
|
|
@@ -75,7 +75,10 @@ var SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(props
|
|
|
75
75
|
disableAxisListener: (!showTooltip || (tooltip == null ? void 0 : tooltip.trigger) !== 'axis') && (axisHighlight == null ? void 0 : axisHighlight.x) === 'none' && (axisHighlight == null ? void 0 : axisHighlight.y) === 'none',
|
|
76
76
|
children: [plotType === 'bar' && /*#__PURE__*/_jsx(BarPlot, {
|
|
77
77
|
slots: slots,
|
|
78
|
-
slotProps: slotProps
|
|
78
|
+
slotProps: slotProps,
|
|
79
|
+
sx: {
|
|
80
|
+
shapeRendering: 'auto'
|
|
81
|
+
}
|
|
79
82
|
}), plotType === 'line' && /*#__PURE__*/_jsxs(React.Fragment, {
|
|
80
83
|
children: [/*#__PURE__*/_jsx(AreaPlot, {
|
|
81
84
|
slots: slots,
|
|
@@ -14,7 +14,8 @@ import { SeriesContext } from './SeriesContextProvider';
|
|
|
14
14
|
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '../constants';
|
|
15
15
|
import { getTicksNumber } from '../hooks/useTicks';
|
|
16
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
-
var DEFAULT_CATEGORY_GAP_RATIO = 0.
|
|
17
|
+
var DEFAULT_CATEGORY_GAP_RATIO = 0.2;
|
|
18
|
+
var DEFAULT_BAR_GAP_RATIO = 0.1;
|
|
18
19
|
|
|
19
20
|
// TODO: those might be better placed in a distinct file
|
|
20
21
|
var xExtremumGetters = {
|
|
@@ -124,11 +125,12 @@ function CartesianContextProvider(_ref) {
|
|
|
124
125
|
maxData = _getAxisExtremum2[1];
|
|
125
126
|
var range = [drawingArea.left, drawingArea.left + drawingArea.width];
|
|
126
127
|
if (isBandScaleConfig(axis)) {
|
|
127
|
-
var _axis$categoryGapRati;
|
|
128
|
+
var _axis$categoryGapRati, _axis$barGapRatio;
|
|
128
129
|
var categoryGapRatio = (_axis$categoryGapRati = axis.categoryGapRatio) != null ? _axis$categoryGapRati : DEFAULT_CATEGORY_GAP_RATIO;
|
|
130
|
+
var barGapRatio = (_axis$barGapRatio = axis.barGapRatio) != null ? _axis$barGapRatio : DEFAULT_BAR_GAP_RATIO;
|
|
129
131
|
completedXAxis[axis.id] = _extends({
|
|
130
132
|
categoryGapRatio: categoryGapRatio,
|
|
131
|
-
barGapRatio:
|
|
133
|
+
barGapRatio: barGapRatio
|
|
132
134
|
}, axis, {
|
|
133
135
|
scale: scaleBand(axis.data, range).paddingInner(categoryGapRatio).paddingOuter(categoryGapRatio / 2),
|
|
134
136
|
ticksNumber: axis.data.length
|
package/legacy/index.js
CHANGED
|
@@ -36,7 +36,7 @@ export var ChartsLine = styled('line', {
|
|
|
36
36
|
})(function (_ref) {
|
|
37
37
|
var theme = _ref.theme;
|
|
38
38
|
return {
|
|
39
|
-
stroke: theme.palette.text.primary,
|
|
39
|
+
stroke: (theme.vars || theme).palette.text.primary,
|
|
40
40
|
shapeRendering: 'crispEdges',
|
|
41
41
|
strokeWidth: 1
|
|
42
42
|
};
|
|
@@ -50,7 +50,7 @@ export var ChartsTick = styled('line', {
|
|
|
50
50
|
})(function (_ref2) {
|
|
51
51
|
var theme = _ref2.theme;
|
|
52
52
|
return {
|
|
53
|
-
stroke: theme.palette.text.primary,
|
|
53
|
+
stroke: (theme.vars || theme).palette.text.primary,
|
|
54
54
|
shapeRendering: 'crispEdges'
|
|
55
55
|
};
|
|
56
56
|
});
|
|
@@ -63,7 +63,7 @@ export var ChartsTickLabel = styled('text', {
|
|
|
63
63
|
})(function (_ref3) {
|
|
64
64
|
var theme = _ref3.theme;
|
|
65
65
|
return _extends({}, theme.typography.caption, {
|
|
66
|
-
fill: theme.palette.text.primary
|
|
66
|
+
fill: (theme.vars || theme).palette.text.primary
|
|
67
67
|
});
|
|
68
68
|
});
|
|
69
69
|
export var ChartsLabel = styled('text', {
|
|
@@ -75,6 +75,6 @@ export var ChartsLabel = styled('text', {
|
|
|
75
75
|
})(function (_ref4) {
|
|
76
76
|
var theme = _ref4.theme;
|
|
77
77
|
return _extends({}, theme.typography.body1, {
|
|
78
|
-
fill: theme.palette.text.primary
|
|
78
|
+
fill: (theme.vars || theme).palette.text.primary
|
|
79
79
|
});
|
|
80
80
|
});
|
package/models/axis.d.ts
CHANGED
|
@@ -96,13 +96,13 @@ interface AxisScaleConfig {
|
|
|
96
96
|
/**
|
|
97
97
|
* The ratio between the space allocated for padding between two categories and the category width.
|
|
98
98
|
* 0 means no gap, and 1 no data.
|
|
99
|
-
* @default 0.
|
|
99
|
+
* @default 0.2
|
|
100
100
|
*/
|
|
101
101
|
categoryGapRatio: number;
|
|
102
102
|
/**
|
|
103
103
|
* The ratio between the width of a bar, and the gap between two bars.
|
|
104
104
|
* 0 means no gap, and 1 no bar.
|
|
105
|
-
* @default 0
|
|
105
|
+
* @default 0.1
|
|
106
106
|
*/
|
|
107
107
|
barGapRatio: number;
|
|
108
108
|
};
|
|
@@ -126,7 +126,7 @@ export const ChartsLegendLabel = styled('text', {
|
|
|
126
126
|
calc(var(--ChartsLegend-itemMarkSize) + var(--ChartsLegend-labelSpacing)),
|
|
127
127
|
calc(0.5 * var(--ChartsLegend-itemMarkSize))
|
|
128
128
|
)`,
|
|
129
|
-
fill: theme.palette.text.primary,
|
|
129
|
+
fill: (theme.vars || theme).palette.text.primary,
|
|
130
130
|
dominantBaseline: 'central'
|
|
131
131
|
}));
|
|
132
132
|
const defaultProps = {
|
package/modern/ChartsSurface.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["children", "width", "height", "viewBox", "disableAxisListener", "className", "sx"];
|
|
4
|
-
import { styled } from '@mui/
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { useAxisEvents } from './hooks/useAxisEvents';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -20,7 +20,6 @@ export function DefaultChartsAxisContent(props) {
|
|
|
20
20
|
const axisFormatter = axis.valueFormatter ?? (v => v.toLocaleString());
|
|
21
21
|
return /*#__PURE__*/_jsx(ChartsTooltipPaper, {
|
|
22
22
|
sx: sx,
|
|
23
|
-
variant: "outlined",
|
|
24
23
|
className: classes.root,
|
|
25
24
|
children: /*#__PURE__*/_jsxs(ChartsTooltipTable, {
|
|
26
25
|
children: [axisValue != null && !axis.hideTooltip && /*#__PURE__*/_jsx("thead", {
|
|
@@ -29,7 +29,6 @@ export function DefaultChartsItemContent(props) {
|
|
|
29
29
|
const formattedValue = series.valueFormatter(series.data[itemData.dataIndex]);
|
|
30
30
|
return /*#__PURE__*/_jsx(ChartsTooltipPaper, {
|
|
31
31
|
sx: sx,
|
|
32
|
-
variant: "outlined",
|
|
33
32
|
className: classes.root,
|
|
34
33
|
children: /*#__PURE__*/_jsx(ChartsTooltipTable, {
|
|
35
34
|
children: /*#__PURE__*/_jsx("tbody", {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
4
|
-
import Popper from '@mui/
|
|
5
|
-
import NoSsr from '@mui/
|
|
4
|
+
import { Popper } from '@mui/base/Popper';
|
|
5
|
+
import { NoSsr } from '@mui/base/NoSsr';
|
|
6
6
|
import { InteractionContext } from '../context/InteractionProvider';
|
|
7
7
|
import { generateVirtualElement, useMouseTracker, getTootipHasData } from './utils';
|
|
8
8
|
import { ChartsItemTooltipContent } from './ChartsItemTooltipContent';
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import Box from '@mui/
|
|
2
|
-
import Paper from '@mui/material/Paper';
|
|
1
|
+
import Box from '@mui/system/Box';
|
|
3
2
|
import { styled } from '@mui/material/styles';
|
|
4
3
|
import { tooltipClasses } from './tooltipClasses';
|
|
5
|
-
export const ChartsTooltipPaper = styled(
|
|
4
|
+
export const ChartsTooltipPaper = styled('div', {
|
|
6
5
|
name: 'MuiChartsTooltip',
|
|
7
|
-
slot: '
|
|
8
|
-
})({
|
|
6
|
+
slot: 'Container'
|
|
7
|
+
})(({
|
|
8
|
+
theme
|
|
9
|
+
}) => ({
|
|
10
|
+
backgroundColor: (theme.vars || theme).palette.background.paper,
|
|
11
|
+
color: (theme.vars || theme).palette.text.primary,
|
|
12
|
+
transition: theme.transitions.create('box-shadow'),
|
|
13
|
+
border: `1px solid ${(theme.vars || theme).palette.divider}`,
|
|
14
|
+
borderRadius: theme.shape.borderRadius
|
|
15
|
+
}));
|
|
9
16
|
export const ChartsTooltipTable = styled('table', {
|
|
10
17
|
name: 'MuiChartsTooltip',
|
|
11
18
|
slot: 'Table'
|
|
@@ -14,7 +21,7 @@ export const ChartsTooltipTable = styled('table', {
|
|
|
14
21
|
}) => ({
|
|
15
22
|
borderSpacing: 0,
|
|
16
23
|
'& thead td': {
|
|
17
|
-
borderBottom: `solid ${theme.palette.divider} 1px`
|
|
24
|
+
borderBottom: `solid ${(theme.vars || theme).palette.divider} 1px`
|
|
18
25
|
}
|
|
19
26
|
}));
|
|
20
27
|
export const ChartsTooltipRow = styled('tr', {
|
|
@@ -37,13 +44,13 @@ export const ChartsTooltipCell = styled('td', {
|
|
|
37
44
|
theme
|
|
38
45
|
}) => ({
|
|
39
46
|
verticalAlign: 'middle',
|
|
40
|
-
color: theme.palette.text.secondary,
|
|
47
|
+
color: (theme.vars || theme).palette.text.secondary,
|
|
41
48
|
[`&.${tooltipClasses.labelCell}`]: {
|
|
42
49
|
paddingLeft: theme.spacing(1)
|
|
43
50
|
},
|
|
44
51
|
[`&.${tooltipClasses.valueCell}`]: {
|
|
45
52
|
paddingLeft: theme.spacing(4),
|
|
46
|
-
color: theme.palette.text.primary
|
|
53
|
+
color: (theme.vars || theme).palette.text.primary
|
|
47
54
|
},
|
|
48
55
|
'td:first-of-type&': {
|
|
49
56
|
paddingLeft: theme.spacing(2)
|
|
@@ -63,7 +70,7 @@ export const ChartsTooltipMark = styled(Box, {
|
|
|
63
70
|
height: theme.spacing(1),
|
|
64
71
|
borderRadius: '50%',
|
|
65
72
|
backgroundColor: ownerState.color,
|
|
66
|
-
borderColor: theme.palette.background.paper,
|
|
67
|
-
border: `solid ${theme.palette.background.paper} ${theme.spacing(0.25)}`,
|
|
73
|
+
borderColor: (theme.vars || theme).palette.background.paper,
|
|
74
|
+
border: `solid ${(theme.vars || theme).palette.background.paper} ${theme.spacing(0.25)}`,
|
|
68
75
|
boxSizing: 'content-box'
|
|
69
76
|
}));
|
|
@@ -38,7 +38,7 @@ const MarkElementPath = styled('path', {
|
|
|
38
38
|
}) => ({
|
|
39
39
|
transform: `translate(${ownerState.x}px, ${ownerState.y}px)`,
|
|
40
40
|
transformOrigin: `${ownerState.x}px ${ownerState.y}px`,
|
|
41
|
-
fill: theme.palette.background.paper,
|
|
41
|
+
fill: (theme.vars || theme).palette.background.paper,
|
|
42
42
|
stroke: ownerState.color,
|
|
43
43
|
strokeWidth: 2
|
|
44
44
|
}));
|