@mui/x-charts 8.0.0-alpha.3 → 8.0.0-alpha.4
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/CHANGELOG.md +274 -0
- package/ChartsAxis/ChartsAxis.js +0 -4
- package/ChartsLabel/ChartsLabel.d.ts +19 -0
- package/ChartsLabel/ChartsLabel.js +58 -0
- package/ChartsLabel/ChartsLabelGradient.d.ts +40 -0
- package/ChartsLabel/ChartsLabelGradient.js +133 -0
- package/ChartsLabel/ChartsLabelMark.d.ts +27 -0
- package/ChartsLabel/ChartsLabelMark.js +108 -0
- package/ChartsLabel/labelClasses.d.ts +9 -0
- package/ChartsLabel/labelClasses.js +13 -0
- package/ChartsLabel/labelGradientClasses.d.ts +15 -0
- package/ChartsLabel/labelGradientClasses.js +17 -0
- package/ChartsLabel/labelMarkClasses.d.ts +17 -0
- package/ChartsLabel/labelMarkClasses.js +17 -0
- package/ChartsLegend/useAxis.js +3 -3
- package/ChartsTooltip/ChartsAxisTooltipContent.js +5 -3
- package/ChartsTooltip/ChartsTooltipTable.js +15 -13
- package/ChartsTooltip/chartsTooltipClasses.d.ts +3 -1
- package/ChartsTooltip/chartsTooltipClasses.js +3 -2
- package/ChartsTooltip/useAxisTooltip.js +2 -3
- package/ChartsTooltip/useItemTooltip.js +2 -3
- package/PieChart/PiePlot.js +2 -2
- package/README.md +1 -1
- package/ScatterChart/ScatterPlot.js +2 -2
- package/ScatterChart/extremums.js +1 -3
- package/ScatterChart/formatter.js +2 -2
- package/hooks/useChartId.d.ts +1 -1
- package/hooks/useColorScale.js +2 -3
- package/hooks/useZAxis.d.ts +6 -0
- package/hooks/useZAxis.js +8 -0
- package/index.js +1 -1
- package/internals/consumeThemeProps.d.ts +54 -0
- package/internals/consumeThemeProps.js +79 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.js +1 -1
- package/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +6 -6
- package/internals/plugins/corePlugins/useChartId/useChartId.types.d.ts +3 -3
- package/internals/store/useCharts.js +8 -2
- package/modern/ChartsAxis/ChartsAxis.js +0 -4
- package/modern/ChartsLabel/ChartsLabel.js +58 -0
- package/modern/ChartsLabel/ChartsLabelGradient.js +133 -0
- package/modern/ChartsLabel/ChartsLabelMark.js +108 -0
- package/modern/ChartsLabel/labelClasses.js +13 -0
- package/modern/ChartsLabel/labelGradientClasses.js +17 -0
- package/modern/ChartsLabel/labelMarkClasses.js +17 -0
- package/modern/ChartsLegend/useAxis.js +3 -3
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +5 -3
- package/modern/ChartsTooltip/ChartsTooltipTable.js +15 -13
- package/modern/ChartsTooltip/chartsTooltipClasses.js +3 -2
- package/modern/ChartsTooltip/useAxisTooltip.js +2 -3
- package/modern/ChartsTooltip/useItemTooltip.js +2 -3
- package/modern/PieChart/PiePlot.js +2 -2
- package/modern/ScatterChart/ScatterPlot.js +2 -2
- package/modern/ScatterChart/extremums.js +1 -3
- package/modern/ScatterChart/formatter.js +2 -2
- package/modern/hooks/useColorScale.js +2 -3
- package/modern/hooks/useZAxis.js +8 -0
- package/modern/index.js +1 -1
- package/modern/internals/consumeThemeProps.js +79 -0
- package/modern/internals/plugins/corePlugins/useChartId/useChartId.js +1 -1
- package/modern/internals/store/useCharts.js +8 -2
- package/node/ChartsAxis/ChartsAxis.js +0 -4
- package/node/ChartsLabel/ChartsLabel.js +64 -0
- package/node/ChartsLabel/ChartsLabelGradient.js +139 -0
- package/node/ChartsLabel/ChartsLabelMark.js +114 -0
- package/node/ChartsLabel/labelClasses.js +22 -0
- package/node/ChartsLabel/labelGradientClasses.js +26 -0
- package/node/ChartsLabel/labelMarkClasses.js +26 -0
- package/node/ChartsLegend/useAxis.js +2 -4
- package/node/ChartsTooltip/ChartsAxisTooltipContent.js +5 -3
- package/node/ChartsTooltip/ChartsTooltipTable.js +15 -13
- package/node/ChartsTooltip/chartsTooltipClasses.js +3 -2
- package/node/ChartsTooltip/useAxisTooltip.js +2 -4
- package/node/ChartsTooltip/useItemTooltip.js +2 -4
- package/node/PieChart/PiePlot.js +2 -2
- package/node/ScatterChart/ScatterPlot.js +2 -2
- package/node/ScatterChart/extremums.js +1 -3
- package/node/ScatterChart/formatter.js +2 -2
- package/node/hooks/useColorScale.js +2 -4
- package/node/hooks/useZAxis.js +15 -0
- package/node/index.js +1 -1
- package/node/internals/consumeThemeProps.js +87 -0
- package/node/internals/plugins/corePlugins/useChartId/useChartId.js +1 -1
- package/node/internals/store/useCharts.js +9 -2
- package/package.json +4 -3
|
@@ -50,10 +50,6 @@ function ChartsAxis(props) {
|
|
|
50
50
|
yAxis,
|
|
51
51
|
yAxisIds
|
|
52
52
|
} = useCartesianContext();
|
|
53
|
-
|
|
54
|
-
// TODO: use for plotting line without ticks or any thing
|
|
55
|
-
// const drawingArea = React.useContext(DrawingContext);
|
|
56
|
-
|
|
57
53
|
const leftId = getAxisId(leftAxis === undefined ? yAxisIds[0] : leftAxis, yAxisIds[0]);
|
|
58
54
|
const bottomId = getAxisId(bottomAxis === undefined ? xAxisIds[0] : bottomAxis, xAxisIds[0]);
|
|
59
55
|
const topId = getAxisId(topAxis, xAxisIds[0]);
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
|
+
const _excluded = ["children", "className", "classes"];
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { styled } from '@mui/material/styles';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import { useUtilityClasses } from "./labelClasses.js";
|
|
11
|
+
import { consumeThemeProps } from "../internals/consumeThemeProps.js";
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
const Root = styled('span', {
|
|
14
|
+
name: 'MuiChartsLabel',
|
|
15
|
+
slot: 'Root',
|
|
16
|
+
overridesResolver: (props, styles) => styles.root
|
|
17
|
+
})(({
|
|
18
|
+
theme
|
|
19
|
+
}) => _extends({}, theme.typography.caption, {
|
|
20
|
+
color: (theme.vars || theme).palette.text.primary,
|
|
21
|
+
lineHeight: undefined,
|
|
22
|
+
display: 'flex'
|
|
23
|
+
}));
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @ignore - internal component.
|
|
27
|
+
*
|
|
28
|
+
* Generates the label mark for the tooltip and legend.
|
|
29
|
+
*/
|
|
30
|
+
const ChartsLabel = consumeThemeProps('MuiChartsLabel', {
|
|
31
|
+
classesResolver: useUtilityClasses
|
|
32
|
+
}, function ChartsLabel(props, ref) {
|
|
33
|
+
const {
|
|
34
|
+
children,
|
|
35
|
+
className,
|
|
36
|
+
classes
|
|
37
|
+
} = props,
|
|
38
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
39
|
+
return /*#__PURE__*/_jsx(Root, _extends({
|
|
40
|
+
className: clsx(classes?.root, className),
|
|
41
|
+
ownerState: props,
|
|
42
|
+
ref: ref
|
|
43
|
+
}, other, {
|
|
44
|
+
children: children
|
|
45
|
+
}));
|
|
46
|
+
});
|
|
47
|
+
process.env.NODE_ENV !== "production" ? ChartsLabel.propTypes = {
|
|
48
|
+
// ----------------------------- Warning --------------------------------
|
|
49
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
50
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
51
|
+
// ----------------------------------------------------------------------
|
|
52
|
+
children: PropTypes.node,
|
|
53
|
+
/**
|
|
54
|
+
* Override or extend the styles applied to the component.
|
|
55
|
+
*/
|
|
56
|
+
classes: PropTypes.object
|
|
57
|
+
} : void 0;
|
|
58
|
+
export { ChartsLabel };
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
+
const _excluded = ["gradientId", "direction", "classes", "className"];
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { styled } from '@mui/material/styles';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import { useUtilityClasses, labelGradientClasses } from "./labelGradientClasses.js";
|
|
11
|
+
import { consumeThemeProps } from "../internals/consumeThemeProps.js";
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
const getRotation = (direction, reverse, rotate) => {
|
|
14
|
+
if (!rotate && reverse) {
|
|
15
|
+
return direction === 'column' ? 90 : 180;
|
|
16
|
+
}
|
|
17
|
+
if (rotate && !reverse) {
|
|
18
|
+
return direction === 'column' ? 0 : 90;
|
|
19
|
+
}
|
|
20
|
+
if (rotate && reverse) {
|
|
21
|
+
return direction === 'column' ? 180 : -90;
|
|
22
|
+
}
|
|
23
|
+
return direction === 'column' ? -90 : 0;
|
|
24
|
+
};
|
|
25
|
+
const Root = styled('div', {
|
|
26
|
+
name: 'MuiChartsLabelGradient',
|
|
27
|
+
slot: 'Root',
|
|
28
|
+
overridesResolver: (props, styles) => styles.root
|
|
29
|
+
})(({
|
|
30
|
+
ownerState
|
|
31
|
+
}) => {
|
|
32
|
+
const rotation = getRotation(ownerState.direction, ownerState.reverse, ownerState.rotate);
|
|
33
|
+
return {
|
|
34
|
+
display: 'flex',
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
justifyContent: 'center',
|
|
37
|
+
[`.${labelGradientClasses.mask}`]: {
|
|
38
|
+
borderRadius: 2,
|
|
39
|
+
overflow: 'hidden'
|
|
40
|
+
},
|
|
41
|
+
[`&.${labelGradientClasses.row}`]: {
|
|
42
|
+
width: '100%',
|
|
43
|
+
[`.${labelGradientClasses.mask}`]: {
|
|
44
|
+
height: 12,
|
|
45
|
+
width: '100%'
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
[`&.${labelGradientClasses.column}`]: {
|
|
49
|
+
height: '100%',
|
|
50
|
+
[`.${labelGradientClasses.mask}`]: {
|
|
51
|
+
width: 12,
|
|
52
|
+
height: '100%',
|
|
53
|
+
'> svg': {
|
|
54
|
+
height: '100%'
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
svg: {
|
|
59
|
+
transform: `rotate(${rotation}deg)`,
|
|
60
|
+
display: 'block'
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @ignore - internal component.
|
|
67
|
+
*
|
|
68
|
+
* Generates the label Gradient for the tooltip and legend.
|
|
69
|
+
*/
|
|
70
|
+
const ChartsLabelGradient = consumeThemeProps('MuiChartsLabelGradient', {
|
|
71
|
+
defaultProps: {
|
|
72
|
+
direction: 'row'
|
|
73
|
+
},
|
|
74
|
+
classesResolver: useUtilityClasses
|
|
75
|
+
}, function ChartsLabelGradient(props, ref) {
|
|
76
|
+
const {
|
|
77
|
+
gradientId,
|
|
78
|
+
classes,
|
|
79
|
+
className
|
|
80
|
+
} = props,
|
|
81
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
82
|
+
return /*#__PURE__*/_jsx(Root, _extends({
|
|
83
|
+
className: clsx(classes?.root, className),
|
|
84
|
+
ownerState: props,
|
|
85
|
+
"aria-hidden": "true",
|
|
86
|
+
ref: ref
|
|
87
|
+
}, other, {
|
|
88
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
89
|
+
className: classes?.mask,
|
|
90
|
+
children: /*#__PURE__*/_jsx("svg", {
|
|
91
|
+
viewBox: "0 0 24 24",
|
|
92
|
+
children: /*#__PURE__*/_jsx("rect", {
|
|
93
|
+
width: "24",
|
|
94
|
+
height: "24",
|
|
95
|
+
fill: `url(#${gradientId})`
|
|
96
|
+
})
|
|
97
|
+
})
|
|
98
|
+
})
|
|
99
|
+
}));
|
|
100
|
+
});
|
|
101
|
+
process.env.NODE_ENV !== "production" ? ChartsLabelGradient.propTypes = {
|
|
102
|
+
// ----------------------------- Warning --------------------------------
|
|
103
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
104
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
105
|
+
// ----------------------------------------------------------------------
|
|
106
|
+
/**
|
|
107
|
+
* Override or extend the styles applied to the component.
|
|
108
|
+
*/
|
|
109
|
+
classes: PropTypes.object,
|
|
110
|
+
/**
|
|
111
|
+
* The direction of the gradient.
|
|
112
|
+
*
|
|
113
|
+
* @default 'row'
|
|
114
|
+
*/
|
|
115
|
+
direction: PropTypes.oneOf(['column', 'row']),
|
|
116
|
+
/**
|
|
117
|
+
* A unique identifier for the gradient.
|
|
118
|
+
*
|
|
119
|
+
* The `gradientId` will be used as `fill="url(#gradientId)"`.
|
|
120
|
+
*/
|
|
121
|
+
gradientId: PropTypes.string.isRequired,
|
|
122
|
+
/**
|
|
123
|
+
* If `true`, the gradient will be reversed.
|
|
124
|
+
*/
|
|
125
|
+
reverse: PropTypes.bool,
|
|
126
|
+
/**
|
|
127
|
+
* If provided, the gradient will be rotated by 90deg.
|
|
128
|
+
*
|
|
129
|
+
* Useful for linear gradients that are not in the correct orientation.
|
|
130
|
+
*/
|
|
131
|
+
rotate: PropTypes.bool
|
|
132
|
+
} : void 0;
|
|
133
|
+
export { ChartsLabelGradient };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
+
const _excluded = ["type", "color", "className", "classes"];
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { styled } from '@mui/material/styles';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import { labelMarkClasses, useUtilityClasses } from "./labelMarkClasses.js";
|
|
11
|
+
import { consumeThemeProps } from "../internals/consumeThemeProps.js";
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
const Root = styled('div', {
|
|
14
|
+
name: 'MuiChartsLabelMark',
|
|
15
|
+
slot: 'Root',
|
|
16
|
+
overridesResolver: (props, styles) => styles.root
|
|
17
|
+
})(() => {
|
|
18
|
+
return {
|
|
19
|
+
display: 'flex',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
justifyContent: 'center',
|
|
22
|
+
flexShrink: 0,
|
|
23
|
+
[`&.${labelMarkClasses.line}`]: {
|
|
24
|
+
width: 16,
|
|
25
|
+
display: 'flex',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
[`.${labelMarkClasses.mask}`]: {
|
|
28
|
+
height: 4,
|
|
29
|
+
width: '100%',
|
|
30
|
+
borderRadius: 1,
|
|
31
|
+
overflow: 'hidden'
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
[`&.${labelMarkClasses.square}`]: {
|
|
35
|
+
height: 13,
|
|
36
|
+
width: 13,
|
|
37
|
+
borderRadius: 2,
|
|
38
|
+
overflow: 'hidden'
|
|
39
|
+
},
|
|
40
|
+
[`&.${labelMarkClasses.circle}`]: {
|
|
41
|
+
height: 15,
|
|
42
|
+
width: 15,
|
|
43
|
+
borderRadius: '50%',
|
|
44
|
+
overflow: 'hidden'
|
|
45
|
+
},
|
|
46
|
+
svg: {
|
|
47
|
+
display: 'block',
|
|
48
|
+
height: '100%',
|
|
49
|
+
width: '100%'
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @ignore - internal component.
|
|
56
|
+
*
|
|
57
|
+
* Generates the label mark for the tooltip and legend.
|
|
58
|
+
*/
|
|
59
|
+
const ChartsLabelMark = consumeThemeProps('MuiChartsLabelMark', {
|
|
60
|
+
classesResolver: useUtilityClasses
|
|
61
|
+
}, function ChartsLabelMark(props, ref) {
|
|
62
|
+
const {
|
|
63
|
+
type,
|
|
64
|
+
color,
|
|
65
|
+
className,
|
|
66
|
+
classes
|
|
67
|
+
} = props,
|
|
68
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
69
|
+
return /*#__PURE__*/_jsx(Root, _extends({
|
|
70
|
+
className: clsx(classes?.root, className),
|
|
71
|
+
ownerState: props,
|
|
72
|
+
"aria-hidden": "true",
|
|
73
|
+
ref: ref
|
|
74
|
+
}, other, {
|
|
75
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
76
|
+
className: classes?.mask,
|
|
77
|
+
children: /*#__PURE__*/_jsx("svg", {
|
|
78
|
+
viewBox: "0 0 24 24",
|
|
79
|
+
preserveAspectRatio: type === 'line' ? 'none' : undefined,
|
|
80
|
+
children: /*#__PURE__*/_jsx("rect", {
|
|
81
|
+
width: "24",
|
|
82
|
+
height: "24",
|
|
83
|
+
fill: color
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
})
|
|
87
|
+
}));
|
|
88
|
+
});
|
|
89
|
+
process.env.NODE_ENV !== "production" ? ChartsLabelMark.propTypes = {
|
|
90
|
+
// ----------------------------- Warning --------------------------------
|
|
91
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
92
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
93
|
+
// ----------------------------------------------------------------------
|
|
94
|
+
/**
|
|
95
|
+
* Override or extend the styles applied to the component.
|
|
96
|
+
*/
|
|
97
|
+
classes: PropTypes.object,
|
|
98
|
+
/**
|
|
99
|
+
* The color of the mark.
|
|
100
|
+
*/
|
|
101
|
+
color: PropTypes.string,
|
|
102
|
+
/**
|
|
103
|
+
* The type of the mark.
|
|
104
|
+
* @default 'square'
|
|
105
|
+
*/
|
|
106
|
+
type: PropTypes.oneOf(['circle', 'line', 'square'])
|
|
107
|
+
} : void 0;
|
|
108
|
+
export { ChartsLabelMark };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
2
|
+
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
3
|
+
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
4
|
+
export function getLabelUtilityClass(slot) {
|
|
5
|
+
return generateUtilityClass('MuiChartsLabel', slot);
|
|
6
|
+
}
|
|
7
|
+
export const labelClasses = generateUtilityClasses('MuiChartsLabel', ['root']);
|
|
8
|
+
export const useUtilityClasses = props => {
|
|
9
|
+
const slots = {
|
|
10
|
+
root: ['root']
|
|
11
|
+
};
|
|
12
|
+
return composeClasses(slots, getLabelUtilityClass, props.classes);
|
|
13
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
2
|
+
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
3
|
+
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
4
|
+
export function getLabelGradientUtilityClass(slot) {
|
|
5
|
+
return generateUtilityClass('MuiChartsLabelGradient', slot);
|
|
6
|
+
}
|
|
7
|
+
export const labelGradientClasses = generateUtilityClasses('MuiChartsLabelGradient', ['root', 'column', 'row', 'mask']);
|
|
8
|
+
export const useUtilityClasses = props => {
|
|
9
|
+
const {
|
|
10
|
+
direction
|
|
11
|
+
} = props;
|
|
12
|
+
const slots = {
|
|
13
|
+
root: ['root', direction],
|
|
14
|
+
mask: ['mask']
|
|
15
|
+
};
|
|
16
|
+
return composeClasses(slots, getLabelGradientUtilityClass, props.classes);
|
|
17
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
2
|
+
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
3
|
+
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
4
|
+
export function getLabelMarkUtilityClass(slot) {
|
|
5
|
+
return generateUtilityClass('MuiChartsLabelMark', slot);
|
|
6
|
+
}
|
|
7
|
+
export const labelMarkClasses = generateUtilityClasses('MuiChartsLabelMark', ['root', 'line', 'square', 'circle', 'mask']);
|
|
8
|
+
export const useUtilityClasses = props => {
|
|
9
|
+
const {
|
|
10
|
+
type
|
|
11
|
+
} = props;
|
|
12
|
+
const slots = {
|
|
13
|
+
root: ['root', type],
|
|
14
|
+
mask: ['mask']
|
|
15
|
+
};
|
|
16
|
+
return composeClasses(slots, getLabelMarkUtilityClass, props.classes);
|
|
17
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { ZAxisContext } from "../context/ZAxisContextProvider.js";
|
|
5
3
|
import { useCartesianContext } from "../context/CartesianProvider/useCartesianContext.js";
|
|
4
|
+
import { useZAxis } from "../hooks/useZAxis.js";
|
|
5
|
+
|
|
6
6
|
/**
|
|
7
7
|
* Helper to select an axis definition according to its direction and id.
|
|
8
8
|
*/
|
|
@@ -19,7 +19,7 @@ export function useAxis({
|
|
|
19
19
|
const {
|
|
20
20
|
zAxis,
|
|
21
21
|
zAxisIds
|
|
22
|
-
} =
|
|
22
|
+
} = useZAxis();
|
|
23
23
|
switch (axisDirection) {
|
|
24
24
|
case 'x':
|
|
25
25
|
{
|
|
@@ -14,11 +14,11 @@ function ChartsAxisTooltipContent(props) {
|
|
|
14
14
|
classes: propClasses,
|
|
15
15
|
sx
|
|
16
16
|
} = props;
|
|
17
|
-
const
|
|
17
|
+
const tooltipData = useAxisTooltip();
|
|
18
18
|
const xAxis = useXAxis();
|
|
19
19
|
const yAxis = useYAxis();
|
|
20
20
|
const classes = useUtilityClasses(propClasses);
|
|
21
|
-
if (
|
|
21
|
+
if (tooltipData === null) {
|
|
22
22
|
return null;
|
|
23
23
|
}
|
|
24
24
|
const {
|
|
@@ -26,7 +26,7 @@ function ChartsAxisTooltipContent(props) {
|
|
|
26
26
|
axisValue,
|
|
27
27
|
axisFormattedValue,
|
|
28
28
|
seriesItems
|
|
29
|
-
} =
|
|
29
|
+
} = tooltipData;
|
|
30
30
|
const axis = axisDirection === 'x' ? xAxis : yAxis;
|
|
31
31
|
return /*#__PURE__*/_jsx(ChartsTooltipPaper, {
|
|
32
32
|
sx: sx,
|
|
@@ -35,8 +35,10 @@ function ChartsAxisTooltipContent(props) {
|
|
|
35
35
|
className: classes.table,
|
|
36
36
|
children: [axisValue != null && !axis.hideTooltip && /*#__PURE__*/_jsx("thead", {
|
|
37
37
|
children: /*#__PURE__*/_jsx(ChartsTooltipRow, {
|
|
38
|
+
className: classes.row,
|
|
38
39
|
children: /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
39
40
|
colSpan: 3,
|
|
41
|
+
className: clsx(classes.cell, classes.axisValueCell),
|
|
40
42
|
children: /*#__PURE__*/_jsx(Typography, {
|
|
41
43
|
children: axisFormattedValue
|
|
42
44
|
})
|
|
@@ -12,11 +12,10 @@ export const ChartsTooltipPaper = styled('div', {
|
|
|
12
12
|
})(({
|
|
13
13
|
theme
|
|
14
14
|
}) => ({
|
|
15
|
-
boxShadow: theme.shadows[1],
|
|
16
15
|
backgroundColor: (theme.vars || theme).palette.background.paper,
|
|
17
16
|
color: (theme.vars || theme).palette.text.primary,
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
borderRadius: theme.shape.borderRadius,
|
|
18
|
+
border: `solid ${(theme.vars || theme).palette.divider} 1px`
|
|
20
19
|
}));
|
|
21
20
|
|
|
22
21
|
/**
|
|
@@ -46,10 +45,10 @@ export const ChartsTooltipRow = styled('tr', {
|
|
|
46
45
|
theme
|
|
47
46
|
}) => ({
|
|
48
47
|
'tr:first-of-type& td': {
|
|
49
|
-
paddingTop: theme.spacing(
|
|
48
|
+
paddingTop: theme.spacing(0.5)
|
|
50
49
|
},
|
|
51
50
|
'tr:last-of-type& td': {
|
|
52
|
-
paddingBottom: theme.spacing(
|
|
51
|
+
paddingBottom: theme.spacing(0.5)
|
|
53
52
|
}
|
|
54
53
|
}));
|
|
55
54
|
|
|
@@ -66,17 +65,23 @@ export const ChartsTooltipCell = styled('td', {
|
|
|
66
65
|
verticalAlign: 'middle',
|
|
67
66
|
color: (theme.vars || theme).palette.text.secondary,
|
|
68
67
|
[`&.${chartsTooltipClasses.labelCell}`]: {
|
|
69
|
-
paddingLeft: theme.spacing(1)
|
|
68
|
+
paddingLeft: theme.spacing(1),
|
|
69
|
+
paddingRight: theme.spacing(1.5),
|
|
70
|
+
fontWeight: theme.typography.fontWeightRegular
|
|
71
|
+
},
|
|
72
|
+
[`&.${chartsTooltipClasses.valueCell}, &.${chartsTooltipClasses.axisValueCell}`]: {
|
|
73
|
+
color: (theme.vars || theme).palette.text.primary,
|
|
74
|
+
fontWeight: theme.typography.fontWeightMedium
|
|
70
75
|
},
|
|
71
76
|
[`&.${chartsTooltipClasses.valueCell}`]: {
|
|
72
|
-
paddingLeft: theme.spacing(
|
|
73
|
-
|
|
77
|
+
paddingLeft: theme.spacing(1.5),
|
|
78
|
+
paddingRight: theme.spacing(1.5)
|
|
74
79
|
},
|
|
75
80
|
'td:first-of-type&': {
|
|
76
|
-
paddingLeft: theme.spacing(
|
|
81
|
+
paddingLeft: theme.spacing(1.5)
|
|
77
82
|
},
|
|
78
83
|
'td:last-of-type&': {
|
|
79
|
-
paddingRight: theme.spacing(
|
|
84
|
+
paddingRight: theme.spacing(1.5)
|
|
80
85
|
}
|
|
81
86
|
}));
|
|
82
87
|
|
|
@@ -95,9 +100,6 @@ export const ChartsTooltipMark = styled('div', {
|
|
|
95
100
|
width: theme.spacing(1),
|
|
96
101
|
height: theme.spacing(1),
|
|
97
102
|
borderRadius: '50%',
|
|
98
|
-
boxShadow: theme.shadows[1],
|
|
99
103
|
background: color,
|
|
100
|
-
borderColor: (theme.vars || theme).palette.background.paper,
|
|
101
|
-
border: `solid ${(theme.vars || theme).palette.background.paper} ${theme.spacing(0.25)}`,
|
|
102
104
|
boxSizing: 'content-box'
|
|
103
105
|
}));
|
|
@@ -4,7 +4,7 @@ import composeClasses from '@mui/utils/composeClasses';
|
|
|
4
4
|
export function getChartsTooltipUtilityClass(slot) {
|
|
5
5
|
return generateUtilityClass('MuiChartsTooltip', slot);
|
|
6
6
|
}
|
|
7
|
-
export const chartsTooltipClasses = generateUtilityClasses('MuiChartsTooltip', ['root', 'paper', 'table', 'row', 'cell', 'mark', 'markCell', 'labelCell', 'valueCell']);
|
|
7
|
+
export const chartsTooltipClasses = generateUtilityClasses('MuiChartsTooltip', ['root', 'paper', 'table', 'row', 'cell', 'mark', 'markCell', 'labelCell', 'valueCell', 'axisValueCell']);
|
|
8
8
|
export const useUtilityClasses = classes => {
|
|
9
9
|
const slots = {
|
|
10
10
|
root: ['root'],
|
|
@@ -15,7 +15,8 @@ export const useUtilityClasses = classes => {
|
|
|
15
15
|
mark: ['mark'],
|
|
16
16
|
markCell: ['markCell'],
|
|
17
17
|
labelCell: ['labelCell'],
|
|
18
|
-
valueCell: ['valueCell']
|
|
18
|
+
valueCell: ['valueCell'],
|
|
19
|
+
axisValueCell: ['axisValueCell']
|
|
19
20
|
};
|
|
20
21
|
return composeClasses(slots, getChartsTooltipUtilityClass, classes);
|
|
21
22
|
};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import * as React from 'react';
|
|
4
3
|
import { useSeries } from "../hooks/useSeries.js";
|
|
5
4
|
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
6
|
-
import { ZAxisContext } from "../context/ZAxisContextProvider.js";
|
|
7
5
|
import { useColorProcessor } from "../context/PluginProvider/useColorProcessor.js";
|
|
8
6
|
import { useStore } from "../internals/store/useStore.js";
|
|
9
7
|
import { useSelector } from "../internals/store/useSelector.js";
|
|
@@ -11,6 +9,7 @@ import { getLabel } from "../internals/getLabel.js";
|
|
|
11
9
|
import { isCartesianSeriesType } from "../internals/isCartesian.js";
|
|
12
10
|
import { utcFormatter } from "./utils.js";
|
|
13
11
|
import { useXAxis, useYAxis } from "../hooks/useAxis.js";
|
|
12
|
+
import { useZAxis } from "../hooks/useZAxis.js";
|
|
14
13
|
import { selectorChartsInteractionXAxis, selectorChartsInteractionYAxis } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
15
14
|
export function useAxisTooltip() {
|
|
16
15
|
const defaultXAxis = useXAxis();
|
|
@@ -26,7 +25,7 @@ export function useAxisTooltip() {
|
|
|
26
25
|
const {
|
|
27
26
|
zAxis,
|
|
28
27
|
zAxisIds
|
|
29
|
-
} =
|
|
28
|
+
} = useZAxis();
|
|
30
29
|
const colorProcessors = useColorProcessor();
|
|
31
30
|
if (axisData === null) {
|
|
32
31
|
return null;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
-
import * as React from 'react';
|
|
5
4
|
import { useSeries } from "../hooks/useSeries.js";
|
|
6
5
|
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
7
|
-
import { ZAxisContext } from "../context/ZAxisContextProvider.js";
|
|
8
6
|
import { useColorProcessor } from "../context/PluginProvider/useColorProcessor.js";
|
|
9
7
|
import { getLabel } from "../internals/getLabel.js";
|
|
10
8
|
import { selectorChartsInteractionItem } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
11
9
|
import { useSelector } from "../internals/store/useSelector.js";
|
|
12
10
|
import { useStore } from "../internals/store/useStore.js";
|
|
11
|
+
import { useZAxis } from "../hooks/useZAxis.js";
|
|
13
12
|
export function useItemTooltip() {
|
|
14
13
|
const store = useStore();
|
|
15
14
|
const item = useSelector(store, selectorChartsInteractionItem);
|
|
@@ -23,7 +22,7 @@ export function useItemTooltip() {
|
|
|
23
22
|
const {
|
|
24
23
|
zAxis,
|
|
25
24
|
zAxisIds
|
|
26
|
-
} =
|
|
25
|
+
} = useZAxis();
|
|
27
26
|
const colorProcessors = useColorProcessor();
|
|
28
27
|
const xAxisId = series.xAxisId ?? xAxisIds[0];
|
|
29
28
|
const yAxisId = series.yAxisId ?? yAxisIds[0];
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import { DrawingAreaContext } from "../context/DrawingAreaProvider/index.js";
|
|
6
5
|
import { PieArcPlot } from "./PieArcPlot.js";
|
|
7
6
|
import { PieArcLabelPlot } from "./PieArcLabelPlot.js";
|
|
8
7
|
import { getPercentageValue } from "../internals/getPercentageValue.js";
|
|
9
8
|
import { getPieCoordinates } from "./getPieCoordinates.js";
|
|
10
9
|
import { usePieSeries } from "../hooks/useSeries.js";
|
|
11
10
|
import { useSkipAnimation } from "../context/AnimationProvider/index.js";
|
|
11
|
+
import { useDrawingArea } from "../hooks/index.js";
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
/**
|
|
14
14
|
* Demos:
|
|
@@ -33,7 +33,7 @@ function PiePlot(props) {
|
|
|
33
33
|
top,
|
|
34
34
|
width,
|
|
35
35
|
height
|
|
36
|
-
} =
|
|
36
|
+
} = useDrawingArea();
|
|
37
37
|
const skipAnimation = useSkipAnimation(inSkipAnimation);
|
|
38
38
|
if (seriesData === undefined) {
|
|
39
39
|
return null;
|
|
@@ -6,8 +6,8 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { Scatter } from "./Scatter.js";
|
|
7
7
|
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
8
8
|
import getColor from "./getColor.js";
|
|
9
|
-
import { ZAxisContext } from "../context/ZAxisContextProvider.js";
|
|
10
9
|
import { useScatterSeries } from "../hooks/useSeries.js";
|
|
10
|
+
import { useZAxis } from "../hooks/useZAxis.js";
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
/**
|
|
13
13
|
* Demos:
|
|
@@ -30,7 +30,7 @@ function ScatterPlot(props) {
|
|
|
30
30
|
const {
|
|
31
31
|
zAxis,
|
|
32
32
|
zAxisIds
|
|
33
|
-
} =
|
|
33
|
+
} = useZAxis();
|
|
34
34
|
if (seriesData === undefined) {
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
const mergeMinMax = (acc, val) =>
|
|
2
|
-
return [Math.min(acc[0], val[0]), Math.max(acc[1], val[1])];
|
|
3
|
-
};
|
|
1
|
+
const mergeMinMax = (acc, val) => [val[0] === null ? acc[0] : Math.min(acc[0], val[0]), val[1] === null ? acc[1] : Math.max(acc[1], val[1])];
|
|
4
2
|
export const getExtremumX = params => {
|
|
5
3
|
const {
|
|
6
4
|
series,
|
|
@@ -11,8 +11,8 @@ const formatter = ({
|
|
|
11
11
|
}
|
|
12
12
|
const data = !datasetKeys ? seriesData.data ?? [] : dataset?.map(d => {
|
|
13
13
|
return {
|
|
14
|
-
x: d[datasetKeys.x],
|
|
15
|
-
y: d[datasetKeys.y],
|
|
14
|
+
x: d[datasetKeys.x] ?? null,
|
|
15
|
+
y: d[datasetKeys.y] ?? null,
|
|
16
16
|
z: datasetKeys.z && d[datasetKeys.z],
|
|
17
17
|
id: d[datasetKeys.id]
|
|
18
18
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import * as React from 'react';
|
|
4
3
|
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
5
|
-
import {
|
|
4
|
+
import { useZAxis } from "./useZAxis.js";
|
|
6
5
|
export function useXColorScale(identifier) {
|
|
7
6
|
const {
|
|
8
7
|
xAxis,
|
|
@@ -23,7 +22,7 @@ export function useZColorScale(identifier) {
|
|
|
23
22
|
const {
|
|
24
23
|
zAxis,
|
|
25
24
|
zAxisIds
|
|
26
|
-
} =
|
|
25
|
+
} = useZAxis();
|
|
27
26
|
const id = typeof identifier === 'string' ? identifier : zAxisIds[identifier ?? 0];
|
|
28
27
|
return zAxis[id]?.colorScale;
|
|
29
28
|
}
|
package/modern/index.js
CHANGED