@mui/x-charts 6.0.0-alpha.8 → 6.0.0-alpha.9
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 +59 -1
- package/LineChart/AreaElement.d.ts +1 -1
- package/LineChart/LineChart.d.ts +7 -2
- package/LineChart/LineChart.js +14 -2
- package/LineChart/LineElement.d.ts +1 -1
- package/LineChart/LineHighlightElement.d.ts +21 -0
- package/LineChart/LineHighlightElement.js +79 -0
- package/LineChart/LineHighlightPlot.d.ts +25 -0
- package/LineChart/LineHighlightPlot.js +99 -0
- package/LineChart/MarkElement.d.ts +1 -1
- package/LineChart/MarkElement.js +1 -4
- package/LineChart/MarkPlot.js +27 -11
- package/LineChart/index.d.ts +2 -0
- package/LineChart/index.js +20 -0
- package/PieChart/PieArc.d.ts +1 -1
- package/PieChart/PieArcLabel.d.ts +1 -1
- package/SparkLineChart/SparkLineChart.d.ts +3 -2
- package/SparkLineChart/SparkLineChart.js +6 -11
- package/esm/LineChart/LineChart.js +14 -2
- package/esm/LineChart/LineHighlightElement.js +68 -0
- package/esm/LineChart/LineHighlightPlot.js +92 -0
- package/esm/LineChart/MarkElement.js +1 -4
- package/esm/LineChart/MarkPlot.js +27 -11
- package/esm/LineChart/index.js +3 -1
- package/esm/SparkLineChart/SparkLineChart.js +7 -12
- package/index.js +1 -1
- package/internals/defaultizeColor.d.ts +2 -0
- package/legacy/LineChart/LineChart.js +14 -2
- package/legacy/LineChart/LineHighlightElement.js +67 -0
- package/legacy/LineChart/LineHighlightPlot.js +85 -0
- package/legacy/LineChart/MarkElement.js +1 -4
- package/legacy/LineChart/MarkPlot.js +19 -4
- package/legacy/LineChart/index.js +3 -1
- package/legacy/SparkLineChart/SparkLineChart.js +7 -10
- package/legacy/index.js +1 -1
- package/models/seriesType/line.d.ts +33 -0
- package/modern/LineChart/LineChart.js +14 -2
- package/modern/LineChart/LineHighlightElement.js +68 -0
- package/modern/LineChart/LineHighlightPlot.js +91 -0
- package/modern/LineChart/MarkElement.js +1 -4
- package/modern/LineChart/MarkPlot.js +27 -11
- package/modern/LineChart/index.js +3 -1
- package/modern/SparkLineChart/SparkLineChart.js +7 -12
- package/modern/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,64 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 6.12.1
|
|
7
|
+
|
|
8
|
+
_Aug 31, 2023_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🏎️ Perf improvement for line charts
|
|
13
|
+
- 🎁 Add `referenceDate` prop on pickers (#9991) @flaviendelangle
|
|
14
|
+
Find out more about this feature in the [documentation section](https://mui.com/x/react-date-pickers/base-concepts/#reference-date-when-no-value-is-defined).
|
|
15
|
+
- 🐞 Bugfixes
|
|
16
|
+
- 📚 Documentation improvements
|
|
17
|
+
|
|
18
|
+
### Data Grid
|
|
19
|
+
|
|
20
|
+
#### `@mui/x-data-grid@v6.12.1`
|
|
21
|
+
|
|
22
|
+
- [DataGrid] Add a recipe showing how to render components outside of the grid (#10121) @DanailH
|
|
23
|
+
- [DataGrid] Fix `valueFormatter` being persisted on column type change (#10041) @cherniavskii
|
|
24
|
+
- [DataGrid] Fix error when keyboard navigating an empty grid (#10081) @romgrk
|
|
25
|
+
- [DataGrid] Replace timeout with `useTimeout` (#10179) @romgrk
|
|
26
|
+
|
|
27
|
+
#### `@mui/x-data-grid-pro@v6.12.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
28
|
+
|
|
29
|
+
Same changes as in `@mui/x-data-grid@v6.12.1`.
|
|
30
|
+
|
|
31
|
+
#### `@mui/x-data-grid-premium@v6.12.1` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
32
|
+
|
|
33
|
+
Same changes as in `@mui/x-data-grid-pro@v6.12.1`.
|
|
34
|
+
|
|
35
|
+
### Date Pickers
|
|
36
|
+
|
|
37
|
+
#### `@mui/x-date-pickers@v6.12.1`
|
|
38
|
+
|
|
39
|
+
- [pickers] Add `referenceDate` on picker components (and `DateRangeCalendar`) (#9991) @flaviendelangle
|
|
40
|
+
|
|
41
|
+
#### `@mui/x-date-pickers-pro@v6.12.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
42
|
+
|
|
43
|
+
Same changes as in `@mui/x-date-pickers@v6.12.1`.
|
|
44
|
+
|
|
45
|
+
### Charts / `@mui/x-charts@6.0.0-alpha.9`
|
|
46
|
+
|
|
47
|
+
- [charts] Move the line item highligh into a dedicated component (#10117) @alexfauquette
|
|
48
|
+
|
|
49
|
+
### Docs
|
|
50
|
+
|
|
51
|
+
- [docs] Add `DemoContainer` and `DemoItem` JSDoc (#10186) @LukasTy
|
|
52
|
+
- [docs] Add link to `custom layout` page (#10184) @LukasTy
|
|
53
|
+
- [docs] Add tree view nav item (#10181) @LukasTy
|
|
54
|
+
- [docs] Fix wrong chart tooltip reference (#10169) @oliviertassinari
|
|
55
|
+
- [docs] Improve chart SEO (#10170) @oliviertassinari
|
|
56
|
+
- [docs] Precise expired license key condition (#10165) @oliviertassinari
|
|
57
|
+
- [docs] Reorganize the page menu (#10139) @alexfauquette
|
|
58
|
+
|
|
59
|
+
### Core
|
|
60
|
+
|
|
61
|
+
- [core] Update babel configs (#9713) @romgrk
|
|
62
|
+
- [test] Disable false positive e2e test on webkit (#10187) @LukasTy
|
|
63
|
+
|
|
6
64
|
## 6.12.0
|
|
7
65
|
|
|
8
66
|
_Aug 25, 2023_
|
|
@@ -46,7 +104,7 @@ Same changes as in `@mui/x-data-grid-pro@v6.12.0`.
|
|
|
46
104
|
|
|
47
105
|
Same changes as in `@mui/x-date-pickers@v6.12.0`.
|
|
48
106
|
|
|
49
|
-
### Charts / `@mui/x-charts@6.
|
|
107
|
+
### Charts / `@mui/x-charts@6.0.0-alpha.8`
|
|
50
108
|
|
|
51
109
|
- [charts] Fix import issue (#10111) @alexfauquette
|
|
52
110
|
- [charts] Fix `slotProps` propagation (#10105) @alexfauquette
|
package/LineChart/LineChart.d.ts
CHANGED
|
@@ -10,15 +10,20 @@ import { ChartsTooltipProps } from '../ChartsTooltip';
|
|
|
10
10
|
import { ChartsLegendProps, ChartsLegendSlotComponentProps, ChartsLegendSlotsComponent } from '../ChartsLegend';
|
|
11
11
|
import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
|
|
12
12
|
import { ChartsAxisSlotComponentProps, ChartsAxisSlotsComponent } from '../models/axis';
|
|
13
|
-
|
|
13
|
+
import { LineHighlightPlotSlotsComponent, LineHighlightPlotSlotComponentProps } from './LineHighlightPlot';
|
|
14
|
+
export interface LineChartSlotsComponent extends ChartsAxisSlotsComponent, AreaPlotSlotsComponent, LinePlotSlotsComponent, MarkPlotSlotsComponent, LineHighlightPlotSlotsComponent, ChartsLegendSlotsComponent {
|
|
14
15
|
}
|
|
15
|
-
export interface LineChartSlotComponentProps extends ChartsAxisSlotComponentProps, AreaPlotSlotComponentProps, LinePlotSlotComponentProps, MarkPlotSlotComponentProps, ChartsLegendSlotComponentProps {
|
|
16
|
+
export interface LineChartSlotComponentProps extends ChartsAxisSlotComponentProps, AreaPlotSlotComponentProps, LinePlotSlotComponentProps, MarkPlotSlotComponentProps, LineHighlightPlotSlotComponentProps, ChartsLegendSlotComponentProps {
|
|
16
17
|
}
|
|
17
18
|
export interface LineChartProps extends Omit<ResponsiveChartContainerProps, 'series'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'> {
|
|
18
19
|
series: MakeOptional<LineSeriesType, 'type'>[];
|
|
19
20
|
tooltip?: ChartsTooltipProps;
|
|
20
21
|
axisHighlight?: ChartsAxisHighlightProps;
|
|
21
22
|
legend?: ChartsLegendProps;
|
|
23
|
+
/**
|
|
24
|
+
* If `true`, render the line highlight item.
|
|
25
|
+
*/
|
|
26
|
+
disableLineItemHighlight?: boolean;
|
|
22
27
|
/**
|
|
23
28
|
* Overridable component slots.
|
|
24
29
|
* @default {}
|
package/LineChart/LineChart.js
CHANGED
|
@@ -19,6 +19,7 @@ var _ChartsTooltip = require("../ChartsTooltip");
|
|
|
19
19
|
var _ChartsLegend = require("../ChartsLegend");
|
|
20
20
|
var _ChartsAxisHighlight = require("../ChartsAxisHighlight");
|
|
21
21
|
var _ChartsClipPath = require("../ChartsClipPath");
|
|
22
|
+
var _LineHighlightPlot = require("./LineHighlightPlot");
|
|
22
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
24
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
24
25
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -37,6 +38,7 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
|
|
|
37
38
|
axisHighlight = {
|
|
38
39
|
x: 'line'
|
|
39
40
|
},
|
|
41
|
+
disableLineItemHighlight,
|
|
40
42
|
legend,
|
|
41
43
|
topAxis,
|
|
42
44
|
leftAxis,
|
|
@@ -51,6 +53,7 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
|
|
|
51
53
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ResponsiveChartContainer.ResponsiveChartContainer, {
|
|
52
54
|
ref: ref,
|
|
53
55
|
series: series.map(s => (0, _extends2.default)({
|
|
56
|
+
disableHighlight: !!disableLineItemHighlight,
|
|
54
57
|
type: 'line'
|
|
55
58
|
}, s)),
|
|
56
59
|
width: width,
|
|
@@ -84,13 +87,16 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
|
|
|
84
87
|
bottomAxis: bottomAxis,
|
|
85
88
|
slots: slots,
|
|
86
89
|
slotProps: slotProps
|
|
87
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_MarkPlot.MarkPlot, {
|
|
90
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlight)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_MarkPlot.MarkPlot, {
|
|
91
|
+
slots: slots,
|
|
92
|
+
slotProps: slotProps
|
|
93
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineHighlightPlot.LineHighlightPlot, {
|
|
88
94
|
slots: slots,
|
|
89
95
|
slotProps: slotProps
|
|
90
96
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legend, {
|
|
91
97
|
slots: slots,
|
|
92
98
|
slotProps: slotProps
|
|
93
|
-
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
99
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltip)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, {
|
|
94
100
|
id: clipPathId
|
|
95
101
|
}), children]
|
|
96
102
|
});
|
|
@@ -137,6 +143,10 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
137
143
|
dataset: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
138
144
|
desc: _propTypes.default.string,
|
|
139
145
|
disableAxisListener: _propTypes.default.bool,
|
|
146
|
+
/**
|
|
147
|
+
* If `true`, render the line highlight item.
|
|
148
|
+
*/
|
|
149
|
+
disableLineItemHighlight: _propTypes.default.bool,
|
|
140
150
|
height: _propTypes.default.number,
|
|
141
151
|
/**
|
|
142
152
|
* Indicate which axis to display the left of the charts.
|
|
@@ -214,12 +224,14 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
214
224
|
curve: _propTypes.default.oneOf(['catmullRom', 'linear', 'monotoneX', 'monotoneY', 'natural', 'step', 'stepAfter', 'stepBefore']),
|
|
215
225
|
data: _propTypes.default.arrayOf(_propTypes.default.number),
|
|
216
226
|
dataKey: _propTypes.default.string,
|
|
227
|
+
disableHighlight: _propTypes.default.bool,
|
|
217
228
|
highlightScope: _propTypes.default.shape({
|
|
218
229
|
faded: _propTypes.default.oneOf(['global', 'none', 'series']),
|
|
219
230
|
highlighted: _propTypes.default.oneOf(['item', 'none', 'series'])
|
|
220
231
|
}),
|
|
221
232
|
id: _propTypes.default.string,
|
|
222
233
|
label: _propTypes.default.string,
|
|
234
|
+
showMark: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.bool]),
|
|
223
235
|
stack: _propTypes.default.string,
|
|
224
236
|
stackOffset: _propTypes.default.oneOf(['diverging', 'expand', 'none', 'silhouette', 'wiggle']),
|
|
225
237
|
stackOrder: _propTypes.default.oneOf(['appearance', 'ascending', 'descending', 'insideOut', 'none', 'reverse']),
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface LineHighlightElementClasses {
|
|
3
|
+
/** Styles applied to the root element. */
|
|
4
|
+
root: string;
|
|
5
|
+
}
|
|
6
|
+
export type HighlightElementClassKey = keyof LineHighlightElementClasses;
|
|
7
|
+
interface LineHighlightElementOwnerState {
|
|
8
|
+
id: string;
|
|
9
|
+
color: string;
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
classes?: Partial<LineHighlightElementClasses>;
|
|
13
|
+
}
|
|
14
|
+
export declare function getHighlightElementUtilityClass(slot: string): string;
|
|
15
|
+
export declare const lineHighlightElementClasses: LineHighlightElementClasses;
|
|
16
|
+
export type LineHighlightElementProps = LineHighlightElementOwnerState & React.ComponentPropsWithoutRef<'circle'> & {};
|
|
17
|
+
declare function LineHighlightElement(props: LineHighlightElementProps): React.JSX.Element;
|
|
18
|
+
declare namespace LineHighlightElement {
|
|
19
|
+
var propTypes: any;
|
|
20
|
+
}
|
|
21
|
+
export { LineHighlightElement };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.LineHighlightElement = LineHighlightElement;
|
|
8
|
+
exports.getHighlightElementUtilityClass = getHighlightElementUtilityClass;
|
|
9
|
+
exports.lineHighlightElementClasses = void 0;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
|
+
var React = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
+
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
15
|
+
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
|
|
16
|
+
var _styles = require("@mui/material/styles");
|
|
17
|
+
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
const _excluded = ["x", "y", "id", "classes", "color"];
|
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
22
|
+
function getHighlightElementUtilityClass(slot) {
|
|
23
|
+
return (0, _generateUtilityClass.default)('MuiHighlightElement', slot);
|
|
24
|
+
}
|
|
25
|
+
const lineHighlightElementClasses = (0, _generateUtilityClasses.default)('MuiHighlightElement', ['root']);
|
|
26
|
+
exports.lineHighlightElementClasses = lineHighlightElementClasses;
|
|
27
|
+
const useUtilityClasses = ownerState => {
|
|
28
|
+
const {
|
|
29
|
+
classes,
|
|
30
|
+
id
|
|
31
|
+
} = ownerState;
|
|
32
|
+
const slots = {
|
|
33
|
+
root: ['root', `series-${id}`]
|
|
34
|
+
};
|
|
35
|
+
return (0, _composeClasses.default)(slots, getHighlightElementUtilityClass, classes);
|
|
36
|
+
};
|
|
37
|
+
const HighlightElement = (0, _styles.styled)('circle', {
|
|
38
|
+
name: 'MuiHighlightElement',
|
|
39
|
+
slot: 'Root',
|
|
40
|
+
overridesResolver: (_, styles) => styles.root
|
|
41
|
+
})(({
|
|
42
|
+
ownerState
|
|
43
|
+
}) => ({
|
|
44
|
+
transform: `translate(${ownerState.x}px, ${ownerState.y}px)`,
|
|
45
|
+
transformOrigin: `${ownerState.x}px ${ownerState.y}px`,
|
|
46
|
+
fill: ownerState.color
|
|
47
|
+
}));
|
|
48
|
+
function LineHighlightElement(props) {
|
|
49
|
+
const {
|
|
50
|
+
x,
|
|
51
|
+
y,
|
|
52
|
+
id,
|
|
53
|
+
classes: innerClasses,
|
|
54
|
+
color
|
|
55
|
+
} = props,
|
|
56
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
57
|
+
const ownerState = {
|
|
58
|
+
id,
|
|
59
|
+
classes: innerClasses,
|
|
60
|
+
color,
|
|
61
|
+
x,
|
|
62
|
+
y
|
|
63
|
+
};
|
|
64
|
+
const classes = useUtilityClasses(ownerState);
|
|
65
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(HighlightElement, (0, _extends2.default)({}, other, {
|
|
66
|
+
ownerState: ownerState,
|
|
67
|
+
className: classes.root,
|
|
68
|
+
cx: 0,
|
|
69
|
+
cy: 0,
|
|
70
|
+
r: other.r === undefined ? 5 : other.r
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
process.env.NODE_ENV !== "production" ? LineHighlightElement.propTypes = {
|
|
74
|
+
// ----------------------------- Warning --------------------------------
|
|
75
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
76
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
77
|
+
// ----------------------------------------------------------------------
|
|
78
|
+
classes: _propTypes.default.object
|
|
79
|
+
} : void 0;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { LineHighlightElementProps } from './LineHighlightElement';
|
|
3
|
+
export interface LineHighlightPlotSlotsComponent {
|
|
4
|
+
lineHighlight?: React.JSXElementConstructor<LineHighlightElementProps>;
|
|
5
|
+
}
|
|
6
|
+
export interface LineHighlightPlotSlotComponentProps {
|
|
7
|
+
lineHighlight?: Partial<LineHighlightElementProps>;
|
|
8
|
+
}
|
|
9
|
+
export interface LineHighlightPlotProps extends React.SVGAttributes<SVGSVGElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Overridable component slots.
|
|
12
|
+
* @default {}
|
|
13
|
+
*/
|
|
14
|
+
slots?: LineHighlightPlotSlotsComponent;
|
|
15
|
+
/**
|
|
16
|
+
* The props used for each component slot.
|
|
17
|
+
* @default {}
|
|
18
|
+
*/
|
|
19
|
+
slotProps?: LineHighlightPlotSlotComponentProps;
|
|
20
|
+
}
|
|
21
|
+
declare function LineHighlightPlot(props: LineHighlightPlotProps): React.JSX.Element | null;
|
|
22
|
+
declare namespace LineHighlightPlot {
|
|
23
|
+
var propTypes: any;
|
|
24
|
+
}
|
|
25
|
+
export { LineHighlightPlot };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.LineHighlightPlot = LineHighlightPlot;
|
|
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 _SeriesContextProvider = require("../context/SeriesContextProvider");
|
|
13
|
+
var _CartesianContextProvider = require("../context/CartesianContextProvider");
|
|
14
|
+
var _LineHighlightElement = require("./LineHighlightElement");
|
|
15
|
+
var _useScale = require("../hooks/useScale");
|
|
16
|
+
var _InteractionProvider = require("../context/InteractionProvider");
|
|
17
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
+
const _excluded = ["slots", "slotProps"];
|
|
19
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
function LineHighlightPlot(props) {
|
|
22
|
+
const {
|
|
23
|
+
slots,
|
|
24
|
+
slotProps
|
|
25
|
+
} = props,
|
|
26
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
27
|
+
const seriesData = React.useContext(_SeriesContextProvider.SeriesContext).line;
|
|
28
|
+
const axisData = React.useContext(_CartesianContextProvider.CartesianContext);
|
|
29
|
+
const {
|
|
30
|
+
axis
|
|
31
|
+
} = React.useContext(_InteractionProvider.InteractionContext);
|
|
32
|
+
const highlightedIndex = axis.x?.index;
|
|
33
|
+
if (highlightedIndex === undefined) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
if (seriesData === undefined) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
const {
|
|
40
|
+
series,
|
|
41
|
+
stackingGroups
|
|
42
|
+
} = seriesData;
|
|
43
|
+
const {
|
|
44
|
+
xAxis,
|
|
45
|
+
yAxis,
|
|
46
|
+
xAxisIds,
|
|
47
|
+
yAxisIds
|
|
48
|
+
} = axisData;
|
|
49
|
+
const defaultXAxisId = xAxisIds[0];
|
|
50
|
+
const defaultYAxisId = yAxisIds[0];
|
|
51
|
+
const Element = slots?.lineHighlight ?? _LineHighlightElement.LineHighlightElement;
|
|
52
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", (0, _extends2.default)({}, other, {
|
|
53
|
+
children: stackingGroups.flatMap(({
|
|
54
|
+
ids: groupIds
|
|
55
|
+
}) => {
|
|
56
|
+
return groupIds.flatMap(seriesId => {
|
|
57
|
+
const {
|
|
58
|
+
xAxisKey = defaultXAxisId,
|
|
59
|
+
yAxisKey = defaultYAxisId,
|
|
60
|
+
stackedData,
|
|
61
|
+
disableHighlight
|
|
62
|
+
} = series[seriesId];
|
|
63
|
+
if (disableHighlight) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const xScale = (0, _useScale.getValueToPositionMapper)(xAxis[xAxisKey].scale);
|
|
67
|
+
const yScale = yAxis[yAxisKey].scale;
|
|
68
|
+
const xData = xAxis[xAxisKey].data;
|
|
69
|
+
if (xData === undefined) {
|
|
70
|
+
throw new Error(`Axis of id "${xAxisKey}" should have data property to be able to display a line plot.`);
|
|
71
|
+
}
|
|
72
|
+
const x = xScale(xData[highlightedIndex]);
|
|
73
|
+
const y = yScale(stackedData[highlightedIndex][1]);
|
|
74
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Element, (0, _extends2.default)({
|
|
75
|
+
id: seriesId,
|
|
76
|
+
color: series[seriesId].color,
|
|
77
|
+
x: x,
|
|
78
|
+
y: y
|
|
79
|
+
}, slotProps?.lineHighlight), `${seriesId}`);
|
|
80
|
+
});
|
|
81
|
+
})
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
process.env.NODE_ENV !== "production" ? LineHighlightPlot.propTypes = {
|
|
85
|
+
// ----------------------------- Warning --------------------------------
|
|
86
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
87
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
88
|
+
// ----------------------------------------------------------------------
|
|
89
|
+
/**
|
|
90
|
+
* The props used for each component slot.
|
|
91
|
+
* @default {}
|
|
92
|
+
*/
|
|
93
|
+
slotProps: _propTypes.default.object,
|
|
94
|
+
/**
|
|
95
|
+
* Overridable component slots.
|
|
96
|
+
* @default {}
|
|
97
|
+
*/
|
|
98
|
+
slots: _propTypes.default.object
|
|
99
|
+
} : void 0;
|
package/LineChart/MarkElement.js
CHANGED
|
@@ -52,10 +52,7 @@ const MarkElementPath = (0, _styles.styled)('path', {
|
|
|
52
52
|
transformOrigin: `${ownerState.x}px ${ownerState.y}px`,
|
|
53
53
|
fill: theme.palette.background.paper,
|
|
54
54
|
stroke: ownerState.color,
|
|
55
|
-
strokeWidth: 2
|
|
56
|
-
'&.MuiMarkElement-highlighted': {
|
|
57
|
-
fill: ownerState.color
|
|
58
|
-
}
|
|
55
|
+
strokeWidth: 2
|
|
59
56
|
}));
|
|
60
57
|
MarkElementPath.propTypes = {
|
|
61
58
|
// ----------------------------- Warning --------------------------------
|
package/LineChart/MarkPlot.js
CHANGED
|
@@ -49,8 +49,12 @@ function MarkPlot(props) {
|
|
|
49
49
|
const {
|
|
50
50
|
xAxisKey = defaultXAxisId,
|
|
51
51
|
yAxisKey = defaultYAxisId,
|
|
52
|
-
stackedData
|
|
52
|
+
stackedData,
|
|
53
|
+
showMark = true
|
|
53
54
|
} = series[seriesId];
|
|
55
|
+
if (showMark === false) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
54
58
|
const xScale = (0, _useScale.getValueToPositionMapper)(xAxis[xAxisKey].scale);
|
|
55
59
|
const yScale = yAxis[yAxisKey].scale;
|
|
56
60
|
const xData = xAxis[xAxisKey].data;
|
|
@@ -76,21 +80,33 @@ function MarkPlot(props) {
|
|
|
76
80
|
return {
|
|
77
81
|
x: xScale(x),
|
|
78
82
|
y: yScale(y),
|
|
83
|
+
position: x,
|
|
84
|
+
value: y,
|
|
79
85
|
index
|
|
80
86
|
};
|
|
81
87
|
}).filter(isInRange).map(({
|
|
82
88
|
x,
|
|
83
89
|
y,
|
|
84
|
-
index
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
index,
|
|
91
|
+
position,
|
|
92
|
+
value
|
|
93
|
+
}) => {
|
|
94
|
+
return showMark === true || showMark({
|
|
95
|
+
x,
|
|
96
|
+
y,
|
|
97
|
+
index,
|
|
98
|
+
position,
|
|
99
|
+
value
|
|
100
|
+
}) ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Mark, (0, _extends2.default)({
|
|
101
|
+
id: seriesId,
|
|
102
|
+
dataIndex: index,
|
|
103
|
+
shape: "circle",
|
|
104
|
+
color: series[seriesId].color,
|
|
105
|
+
x: x,
|
|
106
|
+
y: y,
|
|
107
|
+
highlightScope: series[seriesId].highlightScope
|
|
108
|
+
}, slotProps?.mark), `${seriesId}-${index}`) : null;
|
|
109
|
+
});
|
|
94
110
|
});
|
|
95
111
|
})
|
|
96
112
|
}));
|
package/LineChart/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { LinePlot } from './LinePlot';
|
|
2
2
|
export { AreaPlot } from './AreaPlot';
|
|
3
3
|
export { MarkPlot } from './MarkPlot';
|
|
4
|
+
export { LineHighlightPlot } from './LineHighlightPlot';
|
|
4
5
|
export { LineChart } from './LineChart';
|
|
5
6
|
export * from './AreaElement';
|
|
6
7
|
export * from './LineElement';
|
|
7
8
|
export * from './MarkElement';
|
|
9
|
+
export * from './LineHighlightElement';
|
package/LineChart/index.js
CHANGED
|
@@ -7,6 +7,7 @@ var _exportNames = {
|
|
|
7
7
|
LinePlot: true,
|
|
8
8
|
AreaPlot: true,
|
|
9
9
|
MarkPlot: true,
|
|
10
|
+
LineHighlightPlot: true,
|
|
10
11
|
LineChart: true
|
|
11
12
|
};
|
|
12
13
|
Object.defineProperty(exports, "AreaPlot", {
|
|
@@ -21,6 +22,12 @@ Object.defineProperty(exports, "LineChart", {
|
|
|
21
22
|
return _LineChart.LineChart;
|
|
22
23
|
}
|
|
23
24
|
});
|
|
25
|
+
Object.defineProperty(exports, "LineHighlightPlot", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _LineHighlightPlot.LineHighlightPlot;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
24
31
|
Object.defineProperty(exports, "LinePlot", {
|
|
25
32
|
enumerable: true,
|
|
26
33
|
get: function () {
|
|
@@ -36,6 +43,7 @@ Object.defineProperty(exports, "MarkPlot", {
|
|
|
36
43
|
var _LinePlot = require("./LinePlot");
|
|
37
44
|
var _AreaPlot = require("./AreaPlot");
|
|
38
45
|
var _MarkPlot = require("./MarkPlot");
|
|
46
|
+
var _LineHighlightPlot = require("./LineHighlightPlot");
|
|
39
47
|
var _LineChart = require("./LineChart");
|
|
40
48
|
var _AreaElement = require("./AreaElement");
|
|
41
49
|
Object.keys(_AreaElement).forEach(function (key) {
|
|
@@ -72,4 +80,16 @@ Object.keys(_MarkElement).forEach(function (key) {
|
|
|
72
80
|
return _MarkElement[key];
|
|
73
81
|
}
|
|
74
82
|
});
|
|
83
|
+
});
|
|
84
|
+
var _LineHighlightElement = require("./LineHighlightElement");
|
|
85
|
+
Object.keys(_LineHighlightElement).forEach(function (key) {
|
|
86
|
+
if (key === "default" || key === "__esModule") return;
|
|
87
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
88
|
+
if (key in exports && exports[key] === _LineHighlightElement[key]) return;
|
|
89
|
+
Object.defineProperty(exports, key, {
|
|
90
|
+
enumerable: true,
|
|
91
|
+
get: function () {
|
|
92
|
+
return _LineHighlightElement[key];
|
|
93
|
+
}
|
|
94
|
+
});
|
|
75
95
|
});
|
package/PieChart/PieArc.d.ts
CHANGED
|
@@ -8,10 +8,11 @@ import { LineSeriesType } from '../models/seriesType/line';
|
|
|
8
8
|
import { AreaPlotSlotsComponent, AreaPlotSlotComponentProps } from '../LineChart/AreaPlot';
|
|
9
9
|
import { LinePlotSlotsComponent, LinePlotSlotComponentProps } from '../LineChart/LinePlot';
|
|
10
10
|
import { MarkPlotSlotsComponent, MarkPlotSlotComponentProps } from '../LineChart/MarkPlot';
|
|
11
|
+
import { LineHighlightPlotSlotsComponent, LineHighlightPlotSlotComponentProps } from '../LineChart/LineHighlightPlot';
|
|
11
12
|
import { BarPlotSlotsComponent, BarPlotSlotComponentProps } from '../BarChart/BarPlot';
|
|
12
|
-
export interface SparkLineChartSlotsComponent extends AreaPlotSlotsComponent, LinePlotSlotsComponent, MarkPlotSlotsComponent, BarPlotSlotsComponent {
|
|
13
|
+
export interface SparkLineChartSlotsComponent extends AreaPlotSlotsComponent, LinePlotSlotsComponent, MarkPlotSlotsComponent, LineHighlightPlotSlotsComponent, BarPlotSlotsComponent {
|
|
13
14
|
}
|
|
14
|
-
export interface SparkLineChartSlotComponentProps extends AreaPlotSlotComponentProps, LinePlotSlotComponentProps, MarkPlotSlotComponentProps, BarPlotSlotComponentProps {
|
|
15
|
+
export interface SparkLineChartSlotComponentProps extends AreaPlotSlotComponentProps, LinePlotSlotComponentProps, MarkPlotSlotComponentProps, LineHighlightPlotSlotComponentProps, BarPlotSlotComponentProps {
|
|
15
16
|
}
|
|
16
17
|
export interface SparkLineChartProps extends Omit<ResponsiveChartContainerProps, 'series' | 'xAxis' | 'yAxis'> {
|
|
17
18
|
/**
|
|
@@ -8,7 +8,6 @@ exports.SparkLineChart = void 0;
|
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
var _styles = require("@mui/material/styles");
|
|
12
11
|
var _BarChart = require("../BarChart");
|
|
13
12
|
var _LineChart = require("../LineChart");
|
|
14
13
|
var _ResponsiveChartContainer = require("../ResponsiveChartContainer");
|
|
@@ -18,14 +17,6 @@ var _ChartsAxisHighlight = require("../ChartsAxisHighlight");
|
|
|
18
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
19
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
const SparkLineMarkPlot = (0, _styles.styled)(_LineChart.MarkPlot)({
|
|
22
|
-
[`& .${_LineChart.markElementClasses.root}`]: {
|
|
23
|
-
display: 'none',
|
|
24
|
-
[`&.${_LineChart.markElementClasses.highlighted}`]: {
|
|
25
|
-
display: 'inherit'
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
20
|
const SPARKLINE_DEFAULT_MARGIN = {
|
|
30
21
|
top: 5,
|
|
31
22
|
bottom: 5,
|
|
@@ -67,7 +58,8 @@ const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(pro
|
|
|
67
58
|
valueFormatter
|
|
68
59
|
}, plotType === 'bar' ? {} : {
|
|
69
60
|
area,
|
|
70
|
-
curve
|
|
61
|
+
curve,
|
|
62
|
+
disableHighlight: !showHighlight
|
|
71
63
|
})],
|
|
72
64
|
width: width,
|
|
73
65
|
height: height,
|
|
@@ -93,7 +85,10 @@ const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(pro
|
|
|
93
85
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.LinePlot, {
|
|
94
86
|
slots: slots,
|
|
95
87
|
slotProps: slotProps
|
|
96
|
-
}),
|
|
88
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.LineHighlightPlot, {
|
|
89
|
+
slots: slots,
|
|
90
|
+
slotProps: slotProps
|
|
91
|
+
})]
|
|
97
92
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlight)), showTooltip && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltip)), children]
|
|
98
93
|
});
|
|
99
94
|
});
|