@mui/x-charts 7.0.0-beta.2 → 7.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/BarChart.d.ts +21 -5
- package/BarChart/BarChart.js +27 -5
- package/CHANGELOG.md +73 -9
- package/ChartsGrid/ChartsGrid.d.ts +30 -0
- package/ChartsGrid/ChartsGrid.js +128 -0
- package/ChartsGrid/chartsGridClasses.d.ts +13 -0
- package/ChartsGrid/chartsGridClasses.js +14 -0
- package/ChartsGrid/index.d.ts +2 -0
- package/ChartsGrid/index.js +27 -0
- package/ChartsGrid/package.json +6 -0
- package/ChartsSurface.js +6 -4
- package/ChartsXAxis/ChartsXAxis.js +2 -2
- package/ChartsYAxis/ChartsYAxis.js +2 -2
- package/Gauge/Gauge.d.ts +13 -0
- package/Gauge/Gauge.js +156 -0
- package/Gauge/GaugeContainer.d.ts +19 -0
- package/Gauge/GaugeContainer.js +216 -0
- package/Gauge/GaugeProvider.d.ts +117 -0
- package/Gauge/GaugeProvider.js +96 -0
- package/Gauge/GaugeReferenceArc.d.ts +2 -0
- package/Gauge/GaugeReferenceArc.js +44 -0
- package/Gauge/GaugeValueArc.d.ts +2 -0
- package/Gauge/GaugeValueArc.js +51 -0
- package/Gauge/GaugeValueText.d.ts +15 -0
- package/Gauge/GaugeValueText.js +77 -0
- package/Gauge/gaugeClasses.d.ts +14 -0
- package/Gauge/gaugeClasses.js +15 -0
- package/Gauge/index.d.ts +7 -0
- package/Gauge/index.js +87 -0
- package/Gauge/package.json +6 -0
- package/Gauge/utils.d.ts +19 -0
- package/Gauge/utils.js +75 -0
- package/LineChart/LineChart.d.ts +24 -5
- package/LineChart/LineChart.js +31 -5
- package/PieChart/PieArc.d.ts +4 -4
- package/PieChart/PieArc.js +9 -9
- package/PieChart/PieArcLabelPlot.js +13 -13
- package/PieChart/PieChart.d.ts +22 -0
- package/PieChart/PieChart.js +22 -0
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -66
- package/ResponsiveChartContainer/useChartContainerDimensions.d.ts +2 -0
- package/ResponsiveChartContainer/useChartContainerDimensions.js +76 -0
- package/ScatterChart/ScatterChart.d.ts +18 -0
- package/ScatterChart/ScatterChart.js +25 -0
- package/esm/BarChart/BarChart.js +27 -5
- package/esm/ChartsGrid/ChartsGrid.js +121 -0
- package/esm/ChartsGrid/chartsGridClasses.js +6 -0
- package/esm/ChartsGrid/index.js +2 -0
- package/esm/ChartsSurface.js +6 -4
- package/esm/ChartsXAxis/ChartsXAxis.js +1 -1
- package/esm/ChartsYAxis/ChartsYAxis.js +1 -1
- package/esm/Gauge/Gauge.js +149 -0
- package/esm/Gauge/GaugeContainer.js +211 -0
- package/esm/Gauge/GaugeProvider.js +85 -0
- package/esm/Gauge/GaugeReferenceArc.js +35 -0
- package/esm/Gauge/GaugeValueArc.js +42 -0
- package/esm/Gauge/GaugeValueText.js +69 -0
- package/esm/Gauge/gaugeClasses.js +7 -0
- package/esm/Gauge/index.js +7 -0
- package/esm/Gauge/utils.js +68 -0
- package/esm/LineChart/LineChart.js +31 -5
- package/esm/PieChart/PieArc.js +9 -9
- package/esm/PieChart/PieArcLabelPlot.js +13 -13
- package/esm/PieChart/PieChart.js +22 -0
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -66
- package/esm/ResponsiveChartContainer/useChartContainerDimensions.js +66 -0
- package/esm/ScatterChart/ScatterChart.js +25 -0
- package/esm/hooks/useTicks.js +2 -3
- package/esm/index.js +2 -0
- package/hooks/useTicks.d.ts +1 -2
- package/hooks/useTicks.js +2 -3
- package/index.d.ts +2 -0
- package/index.js +23 -1
- package/legacy/BarChart/BarChart.js +27 -5
- package/legacy/ChartsGrid/ChartsGrid.js +119 -0
- package/legacy/ChartsGrid/chartsGridClasses.js +6 -0
- package/legacy/ChartsGrid/index.js +2 -0
- package/legacy/ChartsSurface.js +5 -3
- package/legacy/ChartsXAxis/ChartsXAxis.js +1 -1
- package/legacy/ChartsYAxis/ChartsYAxis.js +1 -1
- package/legacy/Gauge/Gauge.js +146 -0
- package/legacy/Gauge/GaugeContainer.js +215 -0
- package/legacy/Gauge/GaugeProvider.js +87 -0
- package/legacy/Gauge/GaugeReferenceArc.js +37 -0
- package/legacy/Gauge/GaugeValueArc.js +44 -0
- package/legacy/Gauge/GaugeValueText.js +66 -0
- package/legacy/Gauge/gaugeClasses.js +7 -0
- package/legacy/Gauge/index.js +7 -0
- package/legacy/Gauge/utils.js +84 -0
- package/legacy/LineChart/LineChart.js +31 -5
- package/legacy/PieChart/PieArc.js +10 -10
- package/legacy/PieChart/PieArcLabelPlot.js +14 -14
- package/legacy/PieChart/PieChart.js +22 -0
- package/legacy/ResponsiveChartContainer/ResponsiveChartContainer.js +7 -77
- package/legacy/ResponsiveChartContainer/useChartContainerDimensions.js +73 -0
- package/legacy/ScatterChart/ScatterChart.js +25 -0
- package/legacy/hooks/useTicks.js +2 -3
- package/legacy/index.js +3 -1
- package/modern/BarChart/BarChart.js +27 -5
- package/modern/ChartsGrid/ChartsGrid.js +121 -0
- package/modern/ChartsGrid/chartsGridClasses.js +6 -0
- package/modern/ChartsGrid/index.js +2 -0
- package/modern/ChartsSurface.js +6 -4
- package/modern/ChartsXAxis/ChartsXAxis.js +1 -1
- package/modern/ChartsYAxis/ChartsYAxis.js +1 -1
- package/modern/Gauge/Gauge.js +149 -0
- package/modern/Gauge/GaugeContainer.js +208 -0
- package/modern/Gauge/GaugeProvider.js +85 -0
- package/modern/Gauge/GaugeReferenceArc.js +35 -0
- package/modern/Gauge/GaugeValueArc.js +42 -0
- package/modern/Gauge/GaugeValueText.js +69 -0
- package/modern/Gauge/gaugeClasses.js +7 -0
- package/modern/Gauge/index.js +7 -0
- package/modern/Gauge/utils.js +68 -0
- package/modern/LineChart/LineChart.js +31 -5
- package/modern/PieChart/PieArc.js +9 -9
- package/modern/PieChart/PieArcLabelPlot.js +13 -13
- package/modern/PieChart/PieChart.js +22 -0
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -66
- package/modern/ResponsiveChartContainer/useChartContainerDimensions.js +66 -0
- package/modern/ScatterChart/ScatterChart.js +25 -0
- package/modern/hooks/useTicks.js +2 -3
- package/modern/index.js +3 -1
- package/package.json +4 -4
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.GaugeValueArc = GaugeValueArc;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _d3Shape = require("d3-shape");
|
|
11
|
+
var _styles = require("@mui/material/styles");
|
|
12
|
+
var _GaugeProvider = require("./GaugeProvider");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
const StyledPath = (0, _styles.styled)('path', {
|
|
17
|
+
name: 'MuiGauge',
|
|
18
|
+
slot: 'ReferenceArc',
|
|
19
|
+
overridesResolver: (props, styles) => styles.referenceArc
|
|
20
|
+
})(({
|
|
21
|
+
theme
|
|
22
|
+
}) => ({
|
|
23
|
+
fill: (theme.vars || theme).palette.primary.main
|
|
24
|
+
}));
|
|
25
|
+
function GaugeValueArc(props) {
|
|
26
|
+
const {
|
|
27
|
+
value,
|
|
28
|
+
valueMin,
|
|
29
|
+
valueMax,
|
|
30
|
+
startAngle,
|
|
31
|
+
endAngle,
|
|
32
|
+
outerRadius,
|
|
33
|
+
innerRadius,
|
|
34
|
+
cornerRadius,
|
|
35
|
+
cx,
|
|
36
|
+
cy
|
|
37
|
+
} = (0, _GaugeProvider.useGaugeState)();
|
|
38
|
+
if (value === null) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
const valueAngle = startAngle + (value - valueMin) / (valueMax - valueMin) * (endAngle - startAngle);
|
|
42
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledPath, (0, _extends2.default)({
|
|
43
|
+
transform: `translate(${cx}, ${cy})`,
|
|
44
|
+
d: (0, _d3Shape.arc)().cornerRadius(cornerRadius)({
|
|
45
|
+
startAngle,
|
|
46
|
+
endAngle: valueAngle,
|
|
47
|
+
innerRadius,
|
|
48
|
+
outerRadius
|
|
49
|
+
})
|
|
50
|
+
}, props));
|
|
51
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartsTextProps } from '../ChartsText';
|
|
3
|
+
export interface GaugeFormatterParams {
|
|
4
|
+
value: number | null;
|
|
5
|
+
valueMin: number;
|
|
6
|
+
valueMax: number;
|
|
7
|
+
}
|
|
8
|
+
export interface GaugeValueTextProps extends Omit<ChartsTextProps, 'text'> {
|
|
9
|
+
text?: string | ((params: GaugeFormatterParams) => string | null);
|
|
10
|
+
}
|
|
11
|
+
declare function GaugeValueText(props: GaugeValueTextProps): React.JSX.Element | null;
|
|
12
|
+
declare namespace GaugeValueText {
|
|
13
|
+
var propTypes: any;
|
|
14
|
+
}
|
|
15
|
+
export { GaugeValueText };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.GaugeValueText = GaugeValueText;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _GaugeProvider = require("./GaugeProvider");
|
|
13
|
+
var _ChartsText = require("../ChartsText");
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
const _excluded = ["text", "className"];
|
|
16
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
|
+
function defaultFormatter({
|
|
19
|
+
value
|
|
20
|
+
}) {
|
|
21
|
+
return value === null ? 'NaN' : value.toLocaleString();
|
|
22
|
+
}
|
|
23
|
+
function GaugeValueText(props) {
|
|
24
|
+
const {
|
|
25
|
+
text = defaultFormatter,
|
|
26
|
+
className
|
|
27
|
+
} = props,
|
|
28
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
29
|
+
const {
|
|
30
|
+
value,
|
|
31
|
+
valueMin,
|
|
32
|
+
valueMax,
|
|
33
|
+
cx,
|
|
34
|
+
cy
|
|
35
|
+
} = (0, _GaugeProvider.useGaugeState)();
|
|
36
|
+
const formattedText = typeof text === 'function' ? text({
|
|
37
|
+
value,
|
|
38
|
+
valueMin,
|
|
39
|
+
valueMax
|
|
40
|
+
}) : text;
|
|
41
|
+
if (formattedText === null) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
45
|
+
className: className,
|
|
46
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsText.ChartsText, (0, _extends2.default)({
|
|
47
|
+
x: cx,
|
|
48
|
+
y: cy,
|
|
49
|
+
text: formattedText,
|
|
50
|
+
style: {
|
|
51
|
+
textAnchor: 'middle',
|
|
52
|
+
dominantBaseline: 'central'
|
|
53
|
+
}
|
|
54
|
+
}, other))
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
process.env.NODE_ENV !== "production" ? GaugeValueText.propTypes = {
|
|
58
|
+
// ----------------------------- Warning --------------------------------
|
|
59
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
60
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
61
|
+
// ----------------------------------------------------------------------
|
|
62
|
+
/**
|
|
63
|
+
* Height of a text line (in `em`).
|
|
64
|
+
*/
|
|
65
|
+
lineHeight: _propTypes.default.number,
|
|
66
|
+
/**
|
|
67
|
+
* If `true`, the line width is computed.
|
|
68
|
+
* @default false
|
|
69
|
+
*/
|
|
70
|
+
needsComputation: _propTypes.default.bool,
|
|
71
|
+
ownerState: _propTypes.default.any,
|
|
72
|
+
/**
|
|
73
|
+
* Style applied to text elements.
|
|
74
|
+
*/
|
|
75
|
+
style: _propTypes.default.object,
|
|
76
|
+
text: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.string])
|
|
77
|
+
} : void 0;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface GaugeClasses {
|
|
2
|
+
/** Styles applied to the root element. */
|
|
3
|
+
root: string;
|
|
4
|
+
/** Styles applied to the arc diplaying the value. */
|
|
5
|
+
valueArc: string;
|
|
6
|
+
/** Styles applied to the arc diplaying the range of available values. */
|
|
7
|
+
referenceArc: string;
|
|
8
|
+
/** Styles applied to the value text. */
|
|
9
|
+
valueText: string;
|
|
10
|
+
}
|
|
11
|
+
export type GaugeClassKey = keyof GaugeClasses;
|
|
12
|
+
export declare function getGaugeUtilityClass(slot: string): string;
|
|
13
|
+
export declare const gaugeClasses: GaugeClasses;
|
|
14
|
+
export default gaugeClasses;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.gaugeClasses = exports.default = void 0;
|
|
8
|
+
exports.getGaugeUtilityClass = getGaugeUtilityClass;
|
|
9
|
+
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
10
|
+
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
|
|
11
|
+
function getGaugeUtilityClass(slot) {
|
|
12
|
+
return (0, _generateUtilityClass.default)('MuiGauge', slot);
|
|
13
|
+
}
|
|
14
|
+
const gaugeClasses = exports.gaugeClasses = (0, _generateUtilityClasses.default)('MuiGauge', ['root', 'valueArc', 'referenceArc', 'valueText']);
|
|
15
|
+
var _default = exports.default = gaugeClasses;
|
package/Gauge/index.d.ts
ADDED
package/Gauge/index.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
useGaugeState: true
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "useGaugeState", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return _GaugeProvider.useGaugeState;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
var _Gauge = require("./Gauge");
|
|
16
|
+
Object.keys(_Gauge).forEach(function (key) {
|
|
17
|
+
if (key === "default" || key === "__esModule") return;
|
|
18
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
19
|
+
if (key in exports && exports[key] === _Gauge[key]) return;
|
|
20
|
+
Object.defineProperty(exports, key, {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () {
|
|
23
|
+
return _Gauge[key];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
var _GaugeContainer = require("./GaugeContainer");
|
|
28
|
+
Object.keys(_GaugeContainer).forEach(function (key) {
|
|
29
|
+
if (key === "default" || key === "__esModule") return;
|
|
30
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
31
|
+
if (key in exports && exports[key] === _GaugeContainer[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _GaugeContainer[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _GaugeValueText = require("./GaugeValueText");
|
|
40
|
+
Object.keys(_GaugeValueText).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
43
|
+
if (key in exports && exports[key] === _GaugeValueText[key]) return;
|
|
44
|
+
Object.defineProperty(exports, key, {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () {
|
|
47
|
+
return _GaugeValueText[key];
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
var _GaugeValueArc = require("./GaugeValueArc");
|
|
52
|
+
Object.keys(_GaugeValueArc).forEach(function (key) {
|
|
53
|
+
if (key === "default" || key === "__esModule") return;
|
|
54
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
55
|
+
if (key in exports && exports[key] === _GaugeValueArc[key]) return;
|
|
56
|
+
Object.defineProperty(exports, key, {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function () {
|
|
59
|
+
return _GaugeValueArc[key];
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
var _GaugeReferenceArc = require("./GaugeReferenceArc");
|
|
64
|
+
Object.keys(_GaugeReferenceArc).forEach(function (key) {
|
|
65
|
+
if (key === "default" || key === "__esModule") return;
|
|
66
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
67
|
+
if (key in exports && exports[key] === _GaugeReferenceArc[key]) return;
|
|
68
|
+
Object.defineProperty(exports, key, {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
get: function () {
|
|
71
|
+
return _GaugeReferenceArc[key];
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
var _gaugeClasses = require("./gaugeClasses");
|
|
76
|
+
Object.keys(_gaugeClasses).forEach(function (key) {
|
|
77
|
+
if (key === "default" || key === "__esModule") return;
|
|
78
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
79
|
+
if (key in exports && exports[key] === _gaugeClasses[key]) return;
|
|
80
|
+
Object.defineProperty(exports, key, {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
get: function () {
|
|
83
|
+
return _gaugeClasses[key];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
var _GaugeProvider = require("./GaugeProvider");
|
package/Gauge/utils.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retruns the ratio of the arc bounding box and its center.
|
|
3
|
+
* @param startAngle The start angle (in deg)
|
|
4
|
+
* @param endAngle The end angle (in deg)
|
|
5
|
+
*/
|
|
6
|
+
export declare function getArcRatios(startAngle: number, endAngle: number): {
|
|
7
|
+
cx: number;
|
|
8
|
+
cy: number;
|
|
9
|
+
minX: number;
|
|
10
|
+
maxX: number;
|
|
11
|
+
minY: number;
|
|
12
|
+
maxY: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function getAvailableRadius(cx: number, cy: number, width: number, height: number, { minX, maxX, minY, maxY, }: {
|
|
15
|
+
minX: number;
|
|
16
|
+
maxX: number;
|
|
17
|
+
minY: number;
|
|
18
|
+
maxY: number;
|
|
19
|
+
}): number;
|
package/Gauge/utils.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getArcRatios = getArcRatios;
|
|
7
|
+
exports.getAvailableRadius = getAvailableRadius;
|
|
8
|
+
function deg2rad(angle) {
|
|
9
|
+
return Math.PI * angle / 180;
|
|
10
|
+
}
|
|
11
|
+
function getPoint(angle) {
|
|
12
|
+
const radAngle = deg2rad(angle);
|
|
13
|
+
return [Math.sin(radAngle), -Math.cos(radAngle)];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Retruns the ratio of the arc bounding box and its center.
|
|
18
|
+
* @param startAngle The start angle (in deg)
|
|
19
|
+
* @param endAngle The end angle (in deg)
|
|
20
|
+
*/
|
|
21
|
+
function getArcRatios(startAngle, endAngle) {
|
|
22
|
+
// Set the start, end and center point.
|
|
23
|
+
const points = [[0, 0], getPoint(startAngle), getPoint(endAngle)];
|
|
24
|
+
|
|
25
|
+
// Add cardinal points included in the arc
|
|
26
|
+
const minAngle = Math.min(startAngle, endAngle);
|
|
27
|
+
const maxAngle = Math.max(startAngle, endAngle);
|
|
28
|
+
const initialAngle = Math.floor(minAngle / 90) * 90;
|
|
29
|
+
for (let step = 1; step <= 4; step += 1) {
|
|
30
|
+
const cartinalAngle = initialAngle + step * 90;
|
|
31
|
+
if (cartinalAngle < maxAngle) {
|
|
32
|
+
points.push(getPoint(cartinalAngle));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const minX = Math.min(...points.map(([x]) => x));
|
|
36
|
+
const maxX = Math.max(...points.map(([x]) => x));
|
|
37
|
+
const minY = Math.min(...points.map(([, y]) => y));
|
|
38
|
+
const maxY = Math.max(...points.map(([, y]) => y));
|
|
39
|
+
return {
|
|
40
|
+
cx: -minX / (maxX - minX),
|
|
41
|
+
cy: -minY / (maxY - minY),
|
|
42
|
+
minX,
|
|
43
|
+
maxX,
|
|
44
|
+
minY,
|
|
45
|
+
maxY
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function getAvailableRadius(cx, cy, width, height, {
|
|
49
|
+
minX,
|
|
50
|
+
maxX,
|
|
51
|
+
minY,
|
|
52
|
+
maxY
|
|
53
|
+
}) {
|
|
54
|
+
return Math.min(...[{
|
|
55
|
+
ratio: Math.abs(minX),
|
|
56
|
+
space: cx
|
|
57
|
+
}, {
|
|
58
|
+
ratio: Math.abs(maxX),
|
|
59
|
+
space: width - cx
|
|
60
|
+
}, {
|
|
61
|
+
ratio: Math.abs(minY),
|
|
62
|
+
space: cy
|
|
63
|
+
}, {
|
|
64
|
+
ratio: Math.abs(maxY),
|
|
65
|
+
space: height - cy
|
|
66
|
+
}].map(({
|
|
67
|
+
ratio,
|
|
68
|
+
space
|
|
69
|
+
}) => {
|
|
70
|
+
if (ratio < 0.00001) {
|
|
71
|
+
return Infinity;
|
|
72
|
+
}
|
|
73
|
+
return space / ratio;
|
|
74
|
+
}));
|
|
75
|
+
}
|
package/LineChart/LineChart.d.ts
CHANGED
|
@@ -11,20 +11,30 @@ import { ChartsLegendProps, ChartsLegendSlotProps, ChartsLegendSlots } from '../
|
|
|
11
11
|
import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
|
|
12
12
|
import { ChartsAxisSlotProps, ChartsAxisSlots } from '../models/axis';
|
|
13
13
|
import { LineHighlightPlotSlots, LineHighlightPlotSlotProps } from './LineHighlightPlot';
|
|
14
|
+
import { ChartsGridProps } from '../ChartsGrid';
|
|
14
15
|
import { ChartsOnAxisClickHandlerProps } from '../ChartsOnAxisClickHandler';
|
|
15
16
|
export interface LineChartSlots extends ChartsAxisSlots, AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, ChartsLegendSlots, ChartsTooltipSlots {
|
|
16
17
|
}
|
|
17
18
|
export interface LineChartSlotProps extends ChartsAxisSlotProps, AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps {
|
|
18
19
|
}
|
|
19
20
|
export interface LineChartProps extends Omit<ResponsiveChartContainerProps, 'series'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, ChartsOnAxisClickHandlerProps {
|
|
21
|
+
/**
|
|
22
|
+
* The series to display in the line chart.
|
|
23
|
+
*/
|
|
20
24
|
series: MakeOptional<LineSeriesType, 'type'>[];
|
|
25
|
+
/**
|
|
26
|
+
* The configuration of the tooltip.
|
|
27
|
+
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
28
|
+
* @default { trigger: 'item' }
|
|
29
|
+
*/
|
|
21
30
|
tooltip?: ChartsTooltipProps;
|
|
22
31
|
/**
|
|
23
|
-
*
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
*
|
|
32
|
+
* Option to display a cartesian grid in the background.
|
|
33
|
+
*/
|
|
34
|
+
grid?: Pick<ChartsGridProps, 'vertical' | 'horizontal'>;
|
|
35
|
+
/**
|
|
36
|
+
* The configuration of axes highlight.
|
|
37
|
+
* @see See {@link https://mui.com/x/react-charts/tooltip/#highlights highlight docs} for more details.
|
|
28
38
|
* @default { x: 'line' }
|
|
29
39
|
*/
|
|
30
40
|
axisHighlight?: ChartsAxisHighlightProps;
|
|
@@ -46,8 +56,17 @@ export interface LineChartProps extends Omit<ResponsiveChartContainerProps, 'ser
|
|
|
46
56
|
* @default {}
|
|
47
57
|
*/
|
|
48
58
|
slotProps?: LineChartSlotProps;
|
|
59
|
+
/**
|
|
60
|
+
* Callback fired when an area element is clicked.
|
|
61
|
+
*/
|
|
49
62
|
onAreaClick?: AreaPlotProps['onItemClick'];
|
|
63
|
+
/**
|
|
64
|
+
* Callback fired when a line element is clicked.
|
|
65
|
+
*/
|
|
50
66
|
onLineClick?: LinePlotProps['onItemClick'];
|
|
67
|
+
/**
|
|
68
|
+
* Callback fired when a mark element is clicked.
|
|
69
|
+
*/
|
|
51
70
|
onMarkClick?: MarkPlotProps['onItemClick'];
|
|
52
71
|
/**
|
|
53
72
|
* If `true`, animations are skipped.
|
package/LineChart/LineChart.js
CHANGED
|
@@ -20,6 +20,7 @@ var _ChartsLegend = require("../ChartsLegend");
|
|
|
20
20
|
var _ChartsAxisHighlight = require("../ChartsAxisHighlight");
|
|
21
21
|
var _ChartsClipPath = require("../ChartsClipPath");
|
|
22
22
|
var _LineHighlightPlot = require("./LineHighlightPlot");
|
|
23
|
+
var _ChartsGrid = require("../ChartsGrid");
|
|
23
24
|
var _ChartsOnAxisClickHandler = require("../ChartsOnAxisClickHandler");
|
|
24
25
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
26
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -55,6 +56,7 @@ const LineChart = exports.LineChart = /*#__PURE__*/React.forwardRef(function Lin
|
|
|
55
56
|
},
|
|
56
57
|
disableLineItemHighlight,
|
|
57
58
|
legend,
|
|
59
|
+
grid,
|
|
58
60
|
topAxis,
|
|
59
61
|
leftAxis,
|
|
60
62
|
rightAxis,
|
|
@@ -89,6 +91,9 @@ const LineChart = exports.LineChart = /*#__PURE__*/React.forwardRef(function Lin
|
|
|
89
91
|
disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
|
|
90
92
|
children: [onAxisClick && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOnAxisClickHandler.ChartsOnAxisClickHandler, {
|
|
91
93
|
onAxisClick: onAxisClick
|
|
94
|
+
}), grid && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, {
|
|
95
|
+
vertical: grid.vertical,
|
|
96
|
+
horizontal: grid.horizontal
|
|
92
97
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
|
|
93
98
|
clipPath: `url(#${clipPathId})`,
|
|
94
99
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_AreaPlot.AreaPlot, {
|
|
@@ -134,11 +139,8 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
134
139
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
135
140
|
// ----------------------------------------------------------------------
|
|
136
141
|
/**
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* - 'none': display nothing.
|
|
140
|
-
* - 'line': display a line at the current mouse position.
|
|
141
|
-
* - 'band': display a band at the current mouse position. Only available with band scale.
|
|
142
|
+
* The configuration of axes highlight.
|
|
143
|
+
* @see See {@link https://mui.com/x/react-charts/tooltip/#highlights highlight docs} for more details.
|
|
142
144
|
* @default { x: 'line' }
|
|
143
145
|
*/
|
|
144
146
|
axisHighlight: _propTypes.default.shape({
|
|
@@ -194,6 +196,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
194
196
|
* If `true`, render the line highlight item.
|
|
195
197
|
*/
|
|
196
198
|
disableLineItemHighlight: _propTypes.default.bool,
|
|
199
|
+
/**
|
|
200
|
+
* Option to display a cartesian grid in the background.
|
|
201
|
+
*/
|
|
202
|
+
grid: _propTypes.default.shape({
|
|
203
|
+
horizontal: _propTypes.default.bool,
|
|
204
|
+
vertical: _propTypes.default.bool
|
|
205
|
+
}),
|
|
197
206
|
/**
|
|
198
207
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
199
208
|
* @default undefined
|
|
@@ -252,6 +261,9 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
252
261
|
right: _propTypes.default.number,
|
|
253
262
|
top: _propTypes.default.number
|
|
254
263
|
}),
|
|
264
|
+
/**
|
|
265
|
+
* Callback fired when an area element is clicked.
|
|
266
|
+
*/
|
|
255
267
|
onAreaClick: _propTypes.default.func,
|
|
256
268
|
/**
|
|
257
269
|
* The function called for onClick events.
|
|
@@ -260,7 +272,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
260
272
|
* @param {null | AxisData} data The data about the clicked axis and items associated with it.
|
|
261
273
|
*/
|
|
262
274
|
onAxisClick: _propTypes.default.func,
|
|
275
|
+
/**
|
|
276
|
+
* Callback fired when a line element is clicked.
|
|
277
|
+
*/
|
|
263
278
|
onLineClick: _propTypes.default.func,
|
|
279
|
+
/**
|
|
280
|
+
* Callback fired when a mark element is clicked.
|
|
281
|
+
*/
|
|
264
282
|
onMarkClick: _propTypes.default.func,
|
|
265
283
|
/**
|
|
266
284
|
* Indicate which axis to display the right of the charts.
|
|
@@ -289,6 +307,9 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
289
307
|
tickNumber: _propTypes.default.number,
|
|
290
308
|
tickSize: _propTypes.default.number
|
|
291
309
|
}), _propTypes.default.string]),
|
|
310
|
+
/**
|
|
311
|
+
* The series to display in the line chart.
|
|
312
|
+
*/
|
|
292
313
|
series: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
|
293
314
|
/**
|
|
294
315
|
* If `true`, animations are skipped.
|
|
@@ -307,6 +328,11 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
307
328
|
slots: _propTypes.default.object,
|
|
308
329
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
309
330
|
title: _propTypes.default.string,
|
|
331
|
+
/**
|
|
332
|
+
* The configuration of the tooltip.
|
|
333
|
+
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
334
|
+
* @default { trigger: 'item' }
|
|
335
|
+
*/
|
|
310
336
|
tooltip: _propTypes.default.shape({
|
|
311
337
|
axisContent: _propTypes.default.elementType,
|
|
312
338
|
classes: _propTypes.default.object,
|
package/PieChart/PieArc.d.ts
CHANGED
|
@@ -22,14 +22,14 @@ interface PieArcOwnerState {
|
|
|
22
22
|
export declare function getPieArcUtilityClass(slot: string): string;
|
|
23
23
|
export declare const pieArcClasses: PieArcClasses;
|
|
24
24
|
export type PieArcProps = Omit<React.ComponentPropsWithoutRef<'path'>, 'id'> & PieArcOwnerState & {
|
|
25
|
-
|
|
25
|
+
cornerRadius: SpringValue<number>;
|
|
26
26
|
endAngle: SpringValue<number>;
|
|
27
|
+
highlightScope?: Partial<HighlightScope>;
|
|
27
28
|
innerRadius: SpringValue<number>;
|
|
29
|
+
onClick?: (event: React.MouseEvent<SVGPathElement, MouseEvent>) => void;
|
|
28
30
|
outerRadius: SpringValue<number>;
|
|
29
|
-
cornerRadius: SpringValue<number>;
|
|
30
31
|
paddingAngle: SpringValue<number>;
|
|
31
|
-
|
|
32
|
-
onClick?: (event: React.MouseEvent<SVGPathElement, MouseEvent>) => void;
|
|
32
|
+
startAngle: SpringValue<number>;
|
|
33
33
|
};
|
|
34
34
|
declare function PieArc(props: PieArcProps): React.JSX.Element;
|
|
35
35
|
declare namespace PieArc {
|
package/PieChart/PieArc.js
CHANGED
|
@@ -19,7 +19,7 @@ var _styles = require("@mui/material/styles");
|
|
|
19
19
|
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
20
20
|
var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
|
|
21
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
-
const _excluded = ["
|
|
22
|
+
const _excluded = ["classes", "color", "cornerRadius", "dataIndex", "endAngle", "highlightScope", "id", "innerRadius", "isFaded", "isHighlighted", "onClick", "outerRadius", "paddingAngle", "startAngle"];
|
|
23
23
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
24
24
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
25
25
|
function getPieArcUtilityClass(slot) {
|
|
@@ -51,20 +51,20 @@ const PieArcRoot = (0, _styles.styled)(_web.animated.path, {
|
|
|
51
51
|
}));
|
|
52
52
|
function PieArc(props) {
|
|
53
53
|
const {
|
|
54
|
-
id,
|
|
55
|
-
dataIndex,
|
|
56
54
|
classes: innerClasses,
|
|
57
55
|
color,
|
|
56
|
+
cornerRadius,
|
|
57
|
+
dataIndex,
|
|
58
|
+
endAngle,
|
|
58
59
|
highlightScope,
|
|
59
|
-
|
|
60
|
+
id,
|
|
61
|
+
innerRadius,
|
|
60
62
|
isFaded,
|
|
61
63
|
isHighlighted,
|
|
62
|
-
|
|
63
|
-
endAngle,
|
|
64
|
-
paddingAngle,
|
|
65
|
-
innerRadius,
|
|
64
|
+
onClick,
|
|
66
65
|
outerRadius,
|
|
67
|
-
|
|
66
|
+
paddingAngle,
|
|
67
|
+
startAngle
|
|
68
68
|
} = props,
|
|
69
69
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
70
70
|
const ownerState = {
|
|
@@ -14,7 +14,7 @@ var _transition = require("./dataTransform/transition");
|
|
|
14
14
|
var _useTransformData = require("./dataTransform/useTransformData");
|
|
15
15
|
var _PieArcLabel = require("./PieArcLabel");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
const _excluded = ["
|
|
17
|
+
const _excluded = ["arcLabel", "arcLabelMinAngle", "arcLabelRadius", "cornerRadius", "data", "faded", "highlighted", "highlightScope", "id", "innerRadius", "outerRadius", "paddingAngle", "skipAnimation", "slotProps", "slots"],
|
|
18
18
|
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "arcLabelRadius", "cornerRadius"];
|
|
19
19
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
20
20
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -34,23 +34,23 @@ function getItemLabel(arcLabel, arcLabelMinAngle, item) {
|
|
|
34
34
|
}
|
|
35
35
|
function PieArcLabelPlot(props) {
|
|
36
36
|
const {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
innerRadius,
|
|
40
|
-
outerRadius,
|
|
37
|
+
arcLabel,
|
|
38
|
+
arcLabelMinAngle = 0,
|
|
41
39
|
arcLabelRadius,
|
|
42
40
|
cornerRadius = 0,
|
|
43
|
-
|
|
44
|
-
id,
|
|
45
|
-
highlightScope,
|
|
46
|
-
highlighted,
|
|
41
|
+
data,
|
|
47
42
|
faded = {
|
|
48
43
|
additionalRadius: -5
|
|
49
44
|
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
highlighted,
|
|
46
|
+
highlightScope,
|
|
47
|
+
id,
|
|
48
|
+
innerRadius,
|
|
49
|
+
outerRadius,
|
|
50
|
+
paddingAngle = 0,
|
|
51
|
+
skipAnimation,
|
|
52
|
+
slotProps,
|
|
53
|
+
slots
|
|
54
54
|
} = props,
|
|
55
55
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
56
56
|
const transformedData = (0, _useTransformData.useTransformData)({
|