@mui/x-charts 7.0.0-alpha.7 → 7.0.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/BarChart.js +1 -0
- package/BarChart/BarElement.d.ts +37 -20
- package/BarChart/BarPlot.js +4 -4
- package/BarChart/formatter.js +1 -1
- package/CHANGELOG.md +175 -49
- package/ChartsAxis/ChartsAxis.js +4 -4
- package/ChartsReferenceLine/ChartsReferenceLine.js +9 -5
- package/ChartsSurface.d.ts +2 -2
- package/ChartsSurface.js +33 -1
- package/ChartsTooltip/ChartsTooltipTable.d.ts +1 -1
- package/ChartsTooltip/ChartsTooltipTable.js +2 -0
- package/LineChart/AreaPlot.js +2 -2
- package/LineChart/LineChart.d.ts +1 -0
- package/LineChart/LineChart.js +2 -0
- package/LineChart/LineHighlightPlot.js +1 -1
- package/LineChart/LinePlot.js +2 -2
- package/LineChart/MarkPlot.js +1 -1
- package/LineChart/formatter.js +1 -1
- package/PieChart/PieArcLabelPlot.d.ts +5 -0
- package/PieChart/PieArcLabelPlot.js +2 -0
- package/PieChart/PieArcPlot.d.ts +5 -0
- package/PieChart/PieArcPlot.js +1 -0
- package/PieChart/PieChart.d.ts +14 -2
- package/PieChart/PieChart.js +3 -2
- package/ResponsiveChartContainer/index.js +2 -2
- package/ScatterChart/ScatterChart.js +1 -0
- package/SparkLineChart/SparkLineChart.d.ts +15 -1
- package/SparkLineChart/SparkLineChart.js +8 -1
- package/context/CartesianContextProvider.d.ts +1 -1
- package/context/CartesianContextProvider.js +9 -8
- package/context/DrawingProvider.d.ts +1 -1
- package/context/DrawingProvider.js +8 -7
- package/context/HighlightProvider.d.ts +2 -2
- package/context/HighlightProvider.js +4 -3
- package/context/InteractionProvider.d.ts +2 -2
- package/context/InteractionProvider.js +4 -3
- package/context/SeriesContextProvider.d.ts +3 -1
- package/context/SeriesContextProvider.js +8 -7
- package/esm/BarChart/BarChart.js +1 -0
- package/esm/BarChart/BarPlot.js +4 -4
- package/esm/BarChart/formatter.js +1 -1
- package/esm/ChartsAxis/ChartsAxis.js +4 -4
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +9 -5
- package/esm/ChartsSurface.js +35 -2
- package/esm/ChartsTooltip/ChartsTooltipTable.js +2 -0
- package/esm/LineChart/AreaPlot.js +2 -2
- package/esm/LineChart/LineChart.js +2 -0
- package/esm/LineChart/LineHighlightPlot.js +1 -1
- package/esm/LineChart/LinePlot.js +2 -2
- package/esm/LineChart/MarkPlot.js +1 -1
- package/esm/LineChart/formatter.js +1 -1
- package/esm/PieChart/PieArcLabelPlot.js +2 -0
- package/esm/PieChart/PieArcPlot.js +1 -0
- package/esm/PieChart/PieChart.js +3 -2
- package/esm/ResponsiveChartContainer/index.js +2 -2
- package/esm/ScatterChart/ScatterChart.js +1 -0
- package/esm/SparkLineChart/SparkLineChart.js +8 -1
- package/esm/context/CartesianContextProvider.js +9 -8
- package/esm/context/DrawingProvider.js +8 -7
- package/esm/context/HighlightProvider.js +6 -4
- package/esm/context/InteractionProvider.js +6 -4
- package/esm/context/SeriesContextProvider.js +10 -8
- package/esm/index.js +1 -0
- package/esm/internals/domUtils.js +3 -1
- package/index.d.ts +1 -0
- package/index.js +12 -1
- package/internals/domUtils.js +3 -1
- package/legacy/BarChart/BarChart.js +1 -0
- package/legacy/BarChart/BarPlot.js +4 -4
- package/legacy/BarChart/formatter.js +1 -1
- package/legacy/ChartsAxis/ChartsAxis.js +4 -4
- package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +7 -5
- package/legacy/ChartsSurface.js +35 -2
- package/legacy/ChartsTooltip/ChartsTooltipTable.js +2 -0
- package/legacy/LineChart/AreaPlot.js +2 -2
- package/legacy/LineChart/LineChart.js +2 -0
- package/legacy/LineChart/LineHighlightPlot.js +1 -1
- package/legacy/LineChart/LinePlot.js +2 -2
- package/legacy/LineChart/MarkPlot.js +1 -1
- package/legacy/LineChart/formatter.js +1 -1
- package/legacy/PieChart/PieArcLabelPlot.js +2 -0
- package/legacy/PieChart/PieArcPlot.js +1 -0
- package/legacy/PieChart/PieChart.js +3 -2
- package/legacy/ResponsiveChartContainer/index.js +2 -2
- package/legacy/ScatterChart/ScatterChart.js +1 -0
- package/legacy/SparkLineChart/SparkLineChart.js +8 -1
- package/legacy/context/CartesianContextProvider.js +17 -17
- package/legacy/context/DrawingProvider.js +6 -6
- package/legacy/context/HighlightProvider.js +4 -3
- package/legacy/context/InteractionProvider.js +4 -3
- package/legacy/context/SeriesContextProvider.js +9 -8
- package/legacy/index.js +2 -1
- package/legacy/internals/domUtils.js +3 -3
- package/models/seriesType/pie.d.ts +1 -0
- package/modern/BarChart/BarChart.js +1 -0
- package/modern/BarChart/BarPlot.js +4 -4
- package/modern/BarChart/formatter.js +1 -1
- package/modern/ChartsAxis/ChartsAxis.js +4 -4
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +9 -5
- package/modern/ChartsSurface.js +35 -2
- package/modern/ChartsTooltip/ChartsTooltipTable.js +2 -0
- package/modern/LineChart/AreaPlot.js +2 -2
- package/modern/LineChart/LineChart.js +2 -0
- package/modern/LineChart/LineHighlightPlot.js +1 -1
- package/modern/LineChart/LinePlot.js +2 -2
- package/modern/LineChart/MarkPlot.js +1 -1
- package/modern/LineChart/formatter.js +1 -1
- package/modern/PieChart/PieArcLabelPlot.js +2 -0
- package/modern/PieChart/PieArcPlot.js +1 -0
- package/modern/PieChart/PieChart.js +3 -2
- package/modern/ResponsiveChartContainer/index.js +2 -2
- package/modern/ScatterChart/ScatterChart.js +1 -0
- package/modern/SparkLineChart/SparkLineChart.js +8 -1
- package/modern/context/CartesianContextProvider.js +9 -8
- package/modern/context/DrawingProvider.js +8 -7
- package/modern/context/HighlightProvider.js +6 -4
- package/modern/context/InteractionProvider.js +6 -4
- package/modern/context/SeriesContextProvider.js +10 -8
- package/modern/index.js +2 -1
- package/modern/internals/domUtils.js +3 -1
- package/package.json +1 -1
package/ChartsSurface.d.ts
CHANGED
|
@@ -28,5 +28,5 @@ export interface ChartsSurfaceProps {
|
|
|
28
28
|
*/
|
|
29
29
|
disableAxisListener?: boolean;
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
export {};
|
|
31
|
+
declare const ChartsSurface: React.ForwardRefExoticComponent<ChartsSurfaceProps & React.RefAttributes<SVGSVGElement>>;
|
|
32
|
+
export { ChartsSurface };
|
package/ChartsSurface.js
CHANGED
|
@@ -8,6 +8,7 @@ exports.ChartsSurface = void 0;
|
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
10
|
var _styles = require("@mui/material/styles");
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
12
|
var React = _interopRequireWildcard(require("react"));
|
|
12
13
|
var _useAxisEvents = require("./hooks/useAxisEvents");
|
|
13
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -46,4 +47,35 @@ const ChartsSurface = exports.ChartsSurface = /*#__PURE__*/React.forwardRef(func
|
|
|
46
47
|
children: props.desc
|
|
47
48
|
}), children]
|
|
48
49
|
}));
|
|
49
|
-
});
|
|
50
|
+
});
|
|
51
|
+
process.env.NODE_ENV !== "production" ? ChartsSurface.propTypes = {
|
|
52
|
+
// ----------------------------- Warning --------------------------------
|
|
53
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
54
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
55
|
+
// ----------------------------------------------------------------------
|
|
56
|
+
children: _propTypes.default.node,
|
|
57
|
+
className: _propTypes.default.string,
|
|
58
|
+
desc: _propTypes.default.string,
|
|
59
|
+
/**
|
|
60
|
+
* If `true`, the charts will not listen to the mouse move event.
|
|
61
|
+
* It might break interactive features, but will improve performance.
|
|
62
|
+
* @default false
|
|
63
|
+
*/
|
|
64
|
+
disableAxisListener: _propTypes.default.bool,
|
|
65
|
+
/**
|
|
66
|
+
* The height of the chart in px.
|
|
67
|
+
*/
|
|
68
|
+
height: _propTypes.default.number.isRequired,
|
|
69
|
+
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]),
|
|
70
|
+
title: _propTypes.default.string,
|
|
71
|
+
viewBox: _propTypes.default.shape({
|
|
72
|
+
height: _propTypes.default.number,
|
|
73
|
+
width: _propTypes.default.number,
|
|
74
|
+
x: _propTypes.default.number,
|
|
75
|
+
y: _propTypes.default.number
|
|
76
|
+
}),
|
|
77
|
+
/**
|
|
78
|
+
* The width of the chart in px.
|
|
79
|
+
*/
|
|
80
|
+
width: _propTypes.default.number.isRequired
|
|
81
|
+
} : void 0;
|
|
@@ -5,7 +5,7 @@ export declare const ChartsTooltipRow: import("@emotion/styled").StyledComponent
|
|
|
5
5
|
export declare const ChartsTooltipCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, keyof import("react").ClassAttributes<HTMLTableDataCellElement> | keyof import("react").TdHTMLAttributes<HTMLTableDataCellElement>>, {}>;
|
|
6
6
|
export declare const ChartsTooltipMark: import("@emotion/styled").StyledComponent<Pick<import("@mui/system/Box").BoxOwnProps<import("@mui/system").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
7
7
|
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
8
|
-
}, keyof import("@mui/system/Box").BoxOwnProps<import("@mui/system").Theme>>, "hidden" | "content" | "style" | "translate" | "slot" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "nonce" | "
|
|
8
|
+
}, keyof import("@mui/system/Box").BoxOwnProps<import("@mui/system").Theme>>, "hidden" | "content" | "style" | "translate" | "slot" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | keyof import("@mui/system/Box").BoxOwnProps<import("@mui/system").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
9
9
|
ownerState: {
|
|
10
10
|
color: string;
|
|
11
11
|
};
|
|
@@ -66,6 +66,8 @@ const ChartsTooltipCell = exports.ChartsTooltipCell = (0, _styles.styled)('td',
|
|
|
66
66
|
paddingRight: theme.spacing(2)
|
|
67
67
|
}
|
|
68
68
|
}));
|
|
69
|
+
|
|
70
|
+
// eslint-disable-next-line material-ui/no-styled-box
|
|
69
71
|
const ChartsTooltipMark = exports.ChartsTooltipMark = (0, _styles.styled)(_Box.default, {
|
|
70
72
|
name: 'MuiChartsTooltip',
|
|
71
73
|
slot: 'Mark'
|
package/LineChart/AreaPlot.js
CHANGED
|
@@ -71,10 +71,10 @@ function AreaPlot(props) {
|
|
|
71
71
|
const xData = xAxis[xAxisKey].data;
|
|
72
72
|
if (process.env.NODE_ENV !== 'production') {
|
|
73
73
|
if (xData === undefined) {
|
|
74
|
-
throw new Error(`MUI
|
|
74
|
+
throw new Error(`MUI X Charts: ${xAxisKey === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should have data property to be able to display a line plot.`);
|
|
75
75
|
}
|
|
76
76
|
if (xData.length < stackedData.length) {
|
|
77
|
-
throw new Error(`MUI
|
|
77
|
+
throw new Error(`MUI X Charts: The data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items).`);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
const areaPath = (0, _d3Shape.area)().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y0(d => d.y && yScale(d.y[0])).y1(d => d.y && yScale(d.y[1]));
|
package/LineChart/LineChart.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export interface LineChartProps extends Omit<ResponsiveChartContainerProps, 'ser
|
|
|
24
24
|
* - 'none': display nothing.
|
|
25
25
|
* - 'line': display a line at the current mouse position.
|
|
26
26
|
* - 'band': display a band at the current mouse position. Only available with band scale.
|
|
27
|
+
* @default { x: 'line' }
|
|
27
28
|
*/
|
|
28
29
|
axisHighlight?: ChartsAxisHighlightProps;
|
|
29
30
|
/**
|
package/LineChart/LineChart.js
CHANGED
|
@@ -125,6 +125,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
125
125
|
* - 'none': display nothing.
|
|
126
126
|
* - 'line': display a line at the current mouse position.
|
|
127
127
|
* - 'band': display a band at the current mouse position. Only available with band scale.
|
|
128
|
+
* @default { x: 'line' }
|
|
128
129
|
*/
|
|
129
130
|
axisHighlight: _propTypes.default.shape({
|
|
130
131
|
x: _propTypes.default.oneOf(['band', 'line', 'none']),
|
|
@@ -161,6 +162,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
161
162
|
className: _propTypes.default.string,
|
|
162
163
|
/**
|
|
163
164
|
* Color palette used to colorize multiple series.
|
|
165
|
+
* @default blueberryTwilightPalette
|
|
164
166
|
*/
|
|
165
167
|
colors: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.func]),
|
|
166
168
|
/**
|
|
@@ -79,7 +79,7 @@ function LineHighlightPlot(props) {
|
|
|
79
79
|
const yScale = yAxis[yAxisKey].scale;
|
|
80
80
|
const xData = xAxis[xAxisKey].data;
|
|
81
81
|
if (xData === undefined) {
|
|
82
|
-
throw new Error(`MUI
|
|
82
|
+
throw new Error(`MUI X Charts: ${xAxisKey === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should have data property to be able to display a line plot.`);
|
|
83
83
|
}
|
|
84
84
|
const x = xScale(xData[highlightedIndex]);
|
|
85
85
|
const y = yScale(stackedData[highlightedIndex][1]); // This should not be undefined since y should not be a band scale
|
package/LineChart/LinePlot.js
CHANGED
|
@@ -70,10 +70,10 @@ function LinePlot(props) {
|
|
|
70
70
|
const xData = xAxis[xAxisKey].data;
|
|
71
71
|
if (process.env.NODE_ENV !== 'production') {
|
|
72
72
|
if (xData === undefined) {
|
|
73
|
-
throw new Error(`MUI
|
|
73
|
+
throw new Error(`MUI X Charts: ${xAxisKey === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should have data property to be able to display a line plot.`);
|
|
74
74
|
}
|
|
75
75
|
if (xData.length < stackedData.length) {
|
|
76
|
-
throw new Error(`MUI
|
|
76
|
+
throw new Error(`MUI X Charts: The data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items).`);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
const linePath = (0, _d3Shape.line)().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y(d => yScale(d.y[1]));
|
package/LineChart/MarkPlot.js
CHANGED
|
@@ -85,7 +85,7 @@ function MarkPlot(props) {
|
|
|
85
85
|
return true;
|
|
86
86
|
};
|
|
87
87
|
if (xData === undefined) {
|
|
88
|
-
throw new Error(`MUI
|
|
88
|
+
throw new Error(`MUI X Charts: ${xAxisKey === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should have data property to be able to display a line plot.`);
|
|
89
89
|
}
|
|
90
90
|
return xData?.map((x, index) => {
|
|
91
91
|
const value = data[index] == null ? null : stackedData[index][1];
|
package/LineChart/formatter.js
CHANGED
|
@@ -34,7 +34,7 @@ const formatter = (params, dataset) => {
|
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
} else if (dataset === undefined && process.env.NODE_ENV !== 'production') {
|
|
37
|
-
throw new Error([`MUI
|
|
37
|
+
throw new Error([`MUI X Charts: line series with id='${id}' has no data.`, 'Either provide a data property to the series or use the dataset prop.'].join('\n'));
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
const completedSeries = {};
|
|
@@ -8,6 +8,11 @@ export interface PieArcLabelPlotSlotProps {
|
|
|
8
8
|
pieArcLabel?: Partial<PieArcLabelProps>;
|
|
9
9
|
}
|
|
10
10
|
export interface PieArcLabelPlotProps extends Pick<DefaultizedPieSeriesType, 'data' | 'faded' | 'highlighted' | 'cornerRadius' | 'paddingAngle' | 'arcLabel' | 'arcLabelMinAngle' | 'id' | 'highlightScope'>, ComputedPieRadius {
|
|
11
|
+
/**
|
|
12
|
+
* Override the arc attibutes when it is faded.
|
|
13
|
+
* @default { additionalRadius: -5 }
|
|
14
|
+
*/
|
|
15
|
+
faded?: DefaultizedPieSeriesType['faded'];
|
|
11
16
|
/**
|
|
12
17
|
* Overridable component slots.
|
|
13
18
|
* @default {}
|
|
@@ -113,6 +113,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
113
113
|
arcLabel: _propTypes.default.oneOfType([_propTypes.default.oneOf(['formattedValue', 'label', 'value']), _propTypes.default.func]),
|
|
114
114
|
/**
|
|
115
115
|
* The minimal angle required to display the arc label.
|
|
116
|
+
* @default 0
|
|
116
117
|
*/
|
|
117
118
|
arcLabelMinAngle: _propTypes.default.number,
|
|
118
119
|
/**
|
|
@@ -138,6 +139,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
138
139
|
})).isRequired,
|
|
139
140
|
/**
|
|
140
141
|
* Override the arc attibutes when it is faded.
|
|
142
|
+
* @default { additionalRadius: -5 }
|
|
141
143
|
*/
|
|
142
144
|
faded: _propTypes.default.shape({
|
|
143
145
|
additionalRadius: _propTypes.default.number,
|
package/PieChart/PieArcPlot.d.ts
CHANGED
|
@@ -8,6 +8,11 @@ export interface PieArcPlotSlotProps {
|
|
|
8
8
|
pieArc?: Partial<PieArcProps>;
|
|
9
9
|
}
|
|
10
10
|
export interface PieArcPlotProps extends Pick<DefaultizedPieSeriesType, 'data' | 'faded' | 'highlighted' | 'cornerRadius' | 'paddingAngle' | 'id' | 'highlightScope'>, ComputedPieRadius {
|
|
11
|
+
/**
|
|
12
|
+
* Override the arc attibutes when it is faded.
|
|
13
|
+
* @default { additionalRadius: -5 }
|
|
14
|
+
*/
|
|
15
|
+
faded?: DefaultizedPieSeriesType['faded'];
|
|
11
16
|
/**
|
|
12
17
|
* Overridable component slots.
|
|
13
18
|
* @default {}
|
package/PieChart/PieArcPlot.js
CHANGED
|
@@ -119,6 +119,7 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
119
119
|
})).isRequired,
|
|
120
120
|
/**
|
|
121
121
|
* Override the arc attibutes when it is faded.
|
|
122
|
+
* @default { additionalRadius: -5 }
|
|
122
123
|
*/
|
|
123
124
|
faded: _propTypes.default.shape({
|
|
124
125
|
additionalRadius: _propTypes.default.number,
|
package/PieChart/PieChart.d.ts
CHANGED
|
@@ -8,12 +8,24 @@ import { ChartsLegendProps, ChartsLegendSlotProps, ChartsLegendSlots } from '../
|
|
|
8
8
|
import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
|
|
9
9
|
import { PiePlotProps, PiePlotSlotProps, PiePlotSlots } from './PiePlot';
|
|
10
10
|
import { PieValueType } from '../models/seriesType/pie';
|
|
11
|
-
import { ChartsAxisSlots, ChartsAxisSlotProps } from '../models/axis';
|
|
11
|
+
import { ChartsAxisSlots, ChartsAxisSlotProps, ChartsXAxisProps, ChartsYAxisProps } from '../models/axis';
|
|
12
12
|
export interface PieChartSlots extends ChartsAxisSlots, PiePlotSlots, ChartsLegendSlots, ChartsTooltipSlots {
|
|
13
13
|
}
|
|
14
14
|
export interface PieChartSlotProps extends ChartsAxisSlotProps, PiePlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps {
|
|
15
15
|
}
|
|
16
|
-
export interface PieChartProps extends Omit<ResponsiveChartContainerProps, 'series'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Pick<PiePlotProps, 'skipAnimation'> {
|
|
16
|
+
export interface PieChartProps extends Omit<ResponsiveChartContainerProps, 'series' | 'leftAxis' | 'bottomAxis'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Pick<PiePlotProps, 'skipAnimation'> {
|
|
17
|
+
/**
|
|
18
|
+
* Indicate which axis to display the bottom of the charts.
|
|
19
|
+
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
20
|
+
* @default null
|
|
21
|
+
*/
|
|
22
|
+
bottomAxis?: null | string | ChartsXAxisProps;
|
|
23
|
+
/**
|
|
24
|
+
* Indicate which axis to display the left of the charts.
|
|
25
|
+
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
26
|
+
* @default null
|
|
27
|
+
*/
|
|
28
|
+
leftAxis?: null | string | ChartsYAxisProps;
|
|
17
29
|
series: MakeOptional<PieSeriesType<MakeOptional<PieValueType, 'id'>>, 'type'>[];
|
|
18
30
|
tooltip?: ChartsTooltipProps;
|
|
19
31
|
axisHighlight?: ChartsAxisHighlightProps;
|
package/PieChart/PieChart.js
CHANGED
|
@@ -116,7 +116,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
116
116
|
/**
|
|
117
117
|
* Indicate which axis to display the bottom of the charts.
|
|
118
118
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
119
|
-
* @default
|
|
119
|
+
* @default null
|
|
120
120
|
*/
|
|
121
121
|
bottomAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
122
122
|
axisId: _propTypes.default.string,
|
|
@@ -144,6 +144,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
144
144
|
className: _propTypes.default.string,
|
|
145
145
|
/**
|
|
146
146
|
* Color palette used to colorize multiple series.
|
|
147
|
+
* @default blueberryTwilightPalette
|
|
147
148
|
*/
|
|
148
149
|
colors: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.func]),
|
|
149
150
|
/**
|
|
@@ -165,7 +166,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
165
166
|
/**
|
|
166
167
|
* Indicate which axis to display the left of the charts.
|
|
167
168
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
168
|
-
* @default
|
|
169
|
+
* @default null
|
|
169
170
|
*/
|
|
170
171
|
leftAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
171
172
|
axisId: _propTypes.default.string,
|
|
@@ -69,11 +69,11 @@ const useChartDimensions = (inWidth, inHeight) => {
|
|
|
69
69
|
}, [computeSize, inHeight, inWidth]);
|
|
70
70
|
if (process.env.NODE_ENV !== 'production') {
|
|
71
71
|
if (displayError.current && inWidth === undefined && width === 0) {
|
|
72
|
-
console.error(`MUI
|
|
72
|
+
console.error(`MUI X Charts: ChartContainer does not have \`width\` prop, and its container has no \`width\` defined.`);
|
|
73
73
|
displayError.current = false;
|
|
74
74
|
}
|
|
75
75
|
if (displayError.current && inHeight === undefined && height === 0) {
|
|
76
|
-
console.error(`MUI
|
|
76
|
+
console.error(`MUI X Charts: ChartContainer does not have \`height\` prop, and its container has no \`height\` defined.`);
|
|
77
77
|
displayError.current = false;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -126,6 +126,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
126
126
|
className: _propTypes.default.string,
|
|
127
127
|
/**
|
|
128
128
|
* Color palette used to colorize multiple series.
|
|
129
|
+
* @default blueberryTwilightPalette
|
|
129
130
|
*/
|
|
130
131
|
colors: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.func]),
|
|
131
132
|
/**
|
|
@@ -5,6 +5,7 @@ import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
|
|
|
5
5
|
import { AxisConfig } from '../models/axis';
|
|
6
6
|
import { MakeOptional } from '../models/helpers';
|
|
7
7
|
import { LineSeriesType } from '../models/seriesType/line';
|
|
8
|
+
import { CardinalDirections } from '../models/layout';
|
|
8
9
|
import { AreaPlotSlots, AreaPlotSlotProps } from '../LineChart/AreaPlot';
|
|
9
10
|
import { LinePlotSlots, LinePlotSlotProps } from '../LineChart/LinePlot';
|
|
10
11
|
import { MarkPlotSlots, MarkPlotSlotProps } from '../LineChart/MarkPlot';
|
|
@@ -14,7 +15,7 @@ export interface SparkLineChartSlots extends AreaPlotSlots, LinePlotSlots, MarkP
|
|
|
14
15
|
}
|
|
15
16
|
export interface SparkLineChartSlotProps extends AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, BarPlotSlotProps, ChartsTooltipSlotProps {
|
|
16
17
|
}
|
|
17
|
-
export interface SparkLineChartProps extends Omit<ResponsiveChartContainerProps, 'series' | 'xAxis' | 'yAxis'> {
|
|
18
|
+
export interface SparkLineChartProps extends Omit<ResponsiveChartContainerProps, 'series' | 'xAxis' | 'yAxis' | 'margin'> {
|
|
18
19
|
/**
|
|
19
20
|
* The xAxis configuration.
|
|
20
21
|
* Notice it is a single configuration object, not an array of configuration.
|
|
@@ -35,6 +36,7 @@ export interface SparkLineChartProps extends Omit<ResponsiveChartContainerProps,
|
|
|
35
36
|
* Formatter used by the tooltip.
|
|
36
37
|
* @param {number} value The value to format.
|
|
37
38
|
* @returns {string} the formatted value.
|
|
39
|
+
* @default (v: number) => v.toString()
|
|
38
40
|
*/
|
|
39
41
|
valueFormatter?: (value: number) => string;
|
|
40
42
|
/**
|
|
@@ -59,6 +61,18 @@ export interface SparkLineChartProps extends Omit<ResponsiveChartContainerProps,
|
|
|
59
61
|
* @default 'linear'
|
|
60
62
|
*/
|
|
61
63
|
curve?: LineSeriesType['curve'];
|
|
64
|
+
/**
|
|
65
|
+
* The margin between the SVG and the drawing area.
|
|
66
|
+
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
67
|
+
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
68
|
+
* @default {
|
|
69
|
+
* top: 5,
|
|
70
|
+
* bottom: 5,
|
|
71
|
+
* left: 5,
|
|
72
|
+
* right: 5,
|
|
73
|
+
* }
|
|
74
|
+
*/
|
|
75
|
+
margin?: Partial<CardinalDirections<number>>;
|
|
62
76
|
/**
|
|
63
77
|
* Overridable component slots.
|
|
64
78
|
* @default {}
|
|
@@ -128,6 +128,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
128
128
|
className: _propTypes.default.string,
|
|
129
129
|
/**
|
|
130
130
|
* Color palette used to colorize multiple series.
|
|
131
|
+
* @default blueberryTwilightPalette
|
|
131
132
|
*/
|
|
132
133
|
colors: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.func]),
|
|
133
134
|
/**
|
|
@@ -158,7 +159,12 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
158
159
|
* The margin between the SVG and the drawing area.
|
|
159
160
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
160
161
|
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
161
|
-
* @default
|
|
162
|
+
* @default {
|
|
163
|
+
* top: 5,
|
|
164
|
+
* bottom: 5,
|
|
165
|
+
* left: 5,
|
|
166
|
+
* right: 5,
|
|
167
|
+
* }
|
|
162
168
|
*/
|
|
163
169
|
margin: _propTypes.default.shape({
|
|
164
170
|
bottom: _propTypes.default.number,
|
|
@@ -207,6 +213,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
207
213
|
* Formatter used by the tooltip.
|
|
208
214
|
* @param {number} value The value to format.
|
|
209
215
|
* @returns {string} the formatted value.
|
|
216
|
+
* @default (v: number) => v.toString()
|
|
210
217
|
*/
|
|
211
218
|
valueFormatter: _propTypes.default.func,
|
|
212
219
|
viewBox: _propTypes.default.shape({
|
|
@@ -50,7 +50,7 @@ export declare const CartesianContext: React.Context<{
|
|
|
50
50
|
*
|
|
51
51
|
* - [CartesianContextProvider API](https://mui.com/x/api/charts/cartesian-context-provider/)
|
|
52
52
|
*/
|
|
53
|
-
declare function CartesianContextProvider(
|
|
53
|
+
declare function CartesianContextProvider(props: CartesianContextProviderProps): React.JSX.Element;
|
|
54
54
|
declare namespace CartesianContextProvider {
|
|
55
55
|
var propTypes: any;
|
|
56
56
|
}
|
|
@@ -48,12 +48,13 @@ const CartesianContext = exports.CartesianContext = /*#__PURE__*/React.createCon
|
|
|
48
48
|
*
|
|
49
49
|
* - [CartesianContextProvider API](https://mui.com/x/api/charts/cartesian-context-provider/)
|
|
50
50
|
*/
|
|
51
|
-
function CartesianContextProvider({
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
function CartesianContextProvider(props) {
|
|
52
|
+
const {
|
|
53
|
+
xAxis: inXAxis,
|
|
54
|
+
yAxis: inYAxis,
|
|
55
|
+
dataset,
|
|
56
|
+
children
|
|
57
|
+
} = props;
|
|
57
58
|
const formattedSeries = React.useContext(_SeriesContextProvider.SeriesContext);
|
|
58
59
|
const drawingArea = React.useContext(_DrawingProvider.DrawingContext);
|
|
59
60
|
const xAxis = React.useMemo(() => inXAxis?.map(axisConfig => {
|
|
@@ -62,7 +63,7 @@ function CartesianContextProvider({
|
|
|
62
63
|
return axisConfig;
|
|
63
64
|
}
|
|
64
65
|
if (dataset === undefined) {
|
|
65
|
-
throw Error('MUI
|
|
66
|
+
throw Error('MUI X Charts: x-axis uses `dataKey` but no `dataset` is provided.');
|
|
66
67
|
}
|
|
67
68
|
return (0, _extends2.default)({}, axisConfig, {
|
|
68
69
|
data: dataset.map(d => d[dataKey])
|
|
@@ -74,7 +75,7 @@ function CartesianContextProvider({
|
|
|
74
75
|
return axisConfig;
|
|
75
76
|
}
|
|
76
77
|
if (dataset === undefined) {
|
|
77
|
-
throw Error('MUI
|
|
78
|
+
throw Error('MUI X Charts: y-axis uses `dataKey` but no `dataset` is provided.');
|
|
78
79
|
}
|
|
79
80
|
return (0, _extends2.default)({}, axisConfig, {
|
|
80
81
|
data: dataset.map(d => d[dataKey])
|
|
@@ -40,7 +40,7 @@ export declare const SVGContext: React.Context<React.RefObject<SVGSVGElement>>;
|
|
|
40
40
|
*
|
|
41
41
|
* - [DrawingProvider API](https://mui.com/x/api/charts/drawing-provider/)
|
|
42
42
|
*/
|
|
43
|
-
declare function DrawingProvider(
|
|
43
|
+
declare function DrawingProvider(props: DrawingProviderProps): React.JSX.Element;
|
|
44
44
|
declare namespace DrawingProvider {
|
|
45
45
|
var propTypes: any;
|
|
46
46
|
}
|
|
@@ -34,13 +34,14 @@ const SVGContext = exports.SVGContext = /*#__PURE__*/React.createContext({
|
|
|
34
34
|
*
|
|
35
35
|
* - [DrawingProvider API](https://mui.com/x/api/charts/drawing-provider/)
|
|
36
36
|
*/
|
|
37
|
-
function DrawingProvider({
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
function DrawingProvider(props) {
|
|
38
|
+
const {
|
|
39
|
+
width,
|
|
40
|
+
height,
|
|
41
|
+
margin,
|
|
42
|
+
svgRef,
|
|
43
|
+
children
|
|
44
|
+
} = props;
|
|
44
45
|
const drawingArea = (0, _useChartDimensions.default)(width, height, margin);
|
|
45
46
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(SVGContext.Provider, {
|
|
46
47
|
value: svgRef,
|
|
@@ -41,5 +41,5 @@ type HighlighState = {
|
|
|
41
41
|
dispatch: React.Dispatch<HighlighActions>;
|
|
42
42
|
};
|
|
43
43
|
export declare const HighlighContext: React.Context<HighlighState>;
|
|
44
|
-
|
|
45
|
-
export {};
|
|
44
|
+
declare function HighlightProvider(props: HighlightProviderProps): React.JSX.Element;
|
|
45
|
+
export { HighlightProvider };
|
|
@@ -39,9 +39,10 @@ const dataReducer = (prevState, action) => {
|
|
|
39
39
|
return prevState;
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
-
function HighlightProvider({
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
function HighlightProvider(props) {
|
|
43
|
+
const {
|
|
44
|
+
children
|
|
45
|
+
} = props;
|
|
45
46
|
const [data, dispatch] = React.useReducer(dataReducer, {
|
|
46
47
|
item: null,
|
|
47
48
|
scope: defaultScope
|
|
@@ -46,5 +46,5 @@ type InteractionState = {
|
|
|
46
46
|
dispatch: React.Dispatch<InteractionActions>;
|
|
47
47
|
};
|
|
48
48
|
export declare const InteractionContext: React.Context<InteractionState>;
|
|
49
|
-
|
|
50
|
-
export {};
|
|
49
|
+
declare function InteractionProvider(props: InteractionProviderProps): React.JSX.Element;
|
|
50
|
+
export { InteractionProvider };
|
|
@@ -60,9 +60,10 @@ const dataReducer = (prevState, action) => {
|
|
|
60
60
|
return prevState;
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
|
-
function InteractionProvider({
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
function InteractionProvider(props) {
|
|
64
|
+
const {
|
|
65
|
+
children
|
|
66
|
+
} = props;
|
|
66
67
|
const [data, dispatch] = React.useReducer(dataReducer, {
|
|
67
68
|
item: null,
|
|
68
69
|
axis: {
|
|
@@ -12,6 +12,7 @@ export type SeriesContextProviderProps = {
|
|
|
12
12
|
series: AllSeriesType[];
|
|
13
13
|
/**
|
|
14
14
|
* Color palette used to colorize multiple series.
|
|
15
|
+
* @default blueberryTwilightPalette
|
|
15
16
|
*/
|
|
16
17
|
colors?: ChartsColorPalette;
|
|
17
18
|
children: React.ReactNode;
|
|
@@ -20,4 +21,5 @@ export type FormattedSeries = {
|
|
|
20
21
|
[type in ChartSeriesType]?: FormatterResult<type>;
|
|
21
22
|
};
|
|
22
23
|
export declare const SeriesContext: React.Context<FormattedSeries>;
|
|
23
|
-
|
|
24
|
+
declare function SeriesContextProvider(props: SeriesContextProviderProps): React.JSX.Element;
|
|
25
|
+
export { SeriesContextProvider };
|
|
@@ -49,7 +49,7 @@ const formatSeries = (series, colors, dataset) => {
|
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
if (seriesGroups[type]?.series[id] !== undefined) {
|
|
52
|
-
throw new Error(`MUI
|
|
52
|
+
throw new Error(`MUI X Charts: series' id "${id}" is not unique.`);
|
|
53
53
|
}
|
|
54
54
|
seriesGroups[type].series[id] = (0, _extends2.default)({
|
|
55
55
|
id
|
|
@@ -65,12 +65,13 @@ const formatSeries = (series, colors, dataset) => {
|
|
|
65
65
|
});
|
|
66
66
|
return formattedSeries;
|
|
67
67
|
};
|
|
68
|
-
function SeriesContextProvider({
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
function SeriesContextProvider(props) {
|
|
69
|
+
const {
|
|
70
|
+
series,
|
|
71
|
+
dataset,
|
|
72
|
+
colors = _colorPalettes.blueberryTwilightPalette,
|
|
73
|
+
children
|
|
74
|
+
} = props;
|
|
74
75
|
const theme = (0, _styles.useTheme)();
|
|
75
76
|
const formattedSeries = React.useMemo(() => formatSeries(series, typeof colors === 'function' ? colors(theme.palette.mode) : colors, dataset), [series, colors, theme.palette.mode, dataset]);
|
|
76
77
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(SeriesContext.Provider, {
|
package/esm/BarChart/BarChart.js
CHANGED
|
@@ -156,6 +156,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
156
156
|
className: PropTypes.string,
|
|
157
157
|
/**
|
|
158
158
|
* Color palette used to colorize multiple series.
|
|
159
|
+
* @default blueberryTwilightPalette
|
|
159
160
|
*/
|
|
160
161
|
colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
|
|
161
162
|
/**
|
package/esm/BarChart/BarPlot.js
CHANGED
|
@@ -71,18 +71,18 @@ const useCompletedData = () => {
|
|
|
71
71
|
let baseScaleConfig;
|
|
72
72
|
if (verticalLayout) {
|
|
73
73
|
if (!isBandScaleConfig(xAxisConfig)) {
|
|
74
|
-
throw new Error(`MUI
|
|
74
|
+
throw new Error(`MUI X Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} shoud be of type "band" to display the bar series of id "${seriesId}".`);
|
|
75
75
|
}
|
|
76
76
|
if (xAxis[xAxisKey].data === undefined) {
|
|
77
|
-
throw new Error(`MUI
|
|
77
|
+
throw new Error(`MUI X Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} shoud have data property.`);
|
|
78
78
|
}
|
|
79
79
|
baseScaleConfig = xAxisConfig;
|
|
80
80
|
} else {
|
|
81
81
|
if (!isBandScaleConfig(yAxisConfig)) {
|
|
82
|
-
throw new Error(`MUI
|
|
82
|
+
throw new Error(`MUI X Charts: ${yAxisKey === DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : `The y-axis with id "${yAxisKey}"`} shoud be of type "band" to display the bar series of id "${seriesId}".`);
|
|
83
83
|
}
|
|
84
84
|
if (yAxis[yAxisKey].data === undefined) {
|
|
85
|
-
throw new Error(`MUI
|
|
85
|
+
throw new Error(`MUI X Charts: ${yAxisKey === DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : `The y-axis with id "${yAxisKey}"`} shoud have data property.`);
|
|
86
86
|
}
|
|
87
87
|
baseScaleConfig = yAxisConfig;
|
|
88
88
|
}
|
|
@@ -26,7 +26,7 @@ const formatter = (params, dataset) => {
|
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
} else if (dataset === undefined) {
|
|
29
|
-
throw new Error([`MUI
|
|
29
|
+
throw new Error([`MUI X Charts: bar series with id='${id}' has no data.`, 'Either provide a data property to the series or use the dataset prop.'].join('\n'));
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
const completedSeries = {};
|