@mui/x-charts 7.11.0 → 7.12.0
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 +0 -2
- package/BarChart/BarElement.d.ts +22 -21
- package/BarChart/BarElement.js +3 -3
- package/BarChart/BarLabel/BarLabel.d.ts +20 -20
- package/BarChart/BarLabel/BarLabelItem.d.ts +2 -1
- package/BarChart/BarLabel/BarLabelItem.js +2 -2
- package/BarChart/BarPlot.js +8 -8
- package/BarChart/checkScaleErrors.d.ts +4 -4
- package/BarChart/checkScaleErrors.js +11 -11
- package/BarChart/extremums.js +4 -1
- package/BarChart/formatter.js +3 -3
- package/CHANGELOG.md +194 -4
- package/ChartContainer/ChartContainer.d.ts +3 -3
- package/ChartContainer/ChartContainer.js +3 -5
- package/ChartContainer/useChartContainerProps.d.ts +50 -52
- package/ChartContainer/useChartContainerProps.js +2 -2
- package/ChartContainer/useDefaultizeAxis.d.ts +24 -25
- package/ChartContainer/usePluginsMerge.d.ts +1 -1
- package/ChartsAxis/ChartsAxis.js +4 -4
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/ChartsLegend/ChartsLegend.js +6 -6
- package/ChartsLegend/DefaultChartsLegend.d.ts +1 -1
- package/ChartsLegend/LegendPerItem.js +2 -2
- package/ChartsLegend/utils.d.ts +1 -1
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +3 -1
- package/ChartsOverlay/ChartsOverlay.d.ts +3 -2
- package/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/ChartsReferenceLine/ChartsXReferenceLine.js +1 -2
- package/ChartsReferenceLine/ChartsYReferenceLine.js +1 -2
- package/ChartsTooltip/ChartsAxisTooltipContent.js +9 -5
- package/ChartsTooltip/ChartsItemTooltipContent.js +6 -6
- package/ChartsTooltip/ChartsTooltip.d.ts +1 -1
- package/ChartsTooltip/ChartsTooltip.js +10 -10
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +5 -3
- package/ChartsXAxis/ChartsXAxis.js +5 -5
- package/ChartsYAxis/ChartsYAxis.js +6 -6
- package/Gauge/GaugeReferenceArc.js +1 -1
- package/Gauge/GaugeValueArc.js +1 -1
- package/LineChart/AnimatedArea.d.ts +20 -20
- package/LineChart/AnimatedArea.js +1 -1
- package/LineChart/AnimatedLine.d.ts +20 -20
- package/LineChart/AnimatedLine.js +1 -1
- package/LineChart/AreaElement.d.ts +2 -1
- package/LineChart/AreaElement.js +2 -2
- package/LineChart/AreaPlot.js +11 -7
- package/LineChart/LineChart.js +4 -3
- package/LineChart/LineElement.d.ts +2 -1
- package/LineChart/LineElement.js +2 -2
- package/LineChart/LineHighlightPlot.d.ts +2 -1
- package/LineChart/LineHighlightPlot.js +9 -5
- package/LineChart/LinePlot.js +11 -7
- package/LineChart/MarkElement.js +1 -1
- package/LineChart/MarkPlot.js +9 -5
- package/LineChart/extremums.js +4 -1
- package/LineChart/formatter.js +3 -3
- package/PieChart/PieArc.js +2 -1
- package/PieChart/PieArcLabel.js +1 -1
- package/PieChart/PieChart.js +0 -2
- package/PieChart/formatter.js +1 -1
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -2
- package/ResponsiveChartContainer/useChartContainerDimensions.js +2 -2
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.d.ts +2 -2
- package/ScatterChart/ScatterChart.js +4 -3
- package/ScatterChart/ScatterPlot.js +6 -3
- package/ScatterChart/extremums.js +8 -2
- package/SparkLineChart/SparkLineChart.js +0 -2
- package/context/CartesianProvider/CartesianContext.d.ts +1 -1
- package/context/CartesianProvider/computeValue.d.ts +1 -1
- package/context/CartesianProvider/computeValue.js +1 -1
- package/context/CartesianProvider/defaultizeAxis.d.ts +24 -25
- package/context/CartesianProvider/getAxisExtremum.d.ts +1 -1
- package/context/CartesianProvider/normalizeAxis.js +1 -1
- package/context/DrawingProvider.d.ts +2 -1
- package/context/DrawingProvider.js +7 -1
- package/context/{SeriesContextProvider.d.ts → SeriesProvider/Series.types.d.ts} +4 -8
- package/context/SeriesProvider/Series.types.js +5 -0
- package/context/SeriesProvider/SeriesContext.d.ts +4 -0
- package/context/SeriesProvider/SeriesContext.js +16 -0
- package/context/SeriesProvider/SeriesProvider.d.ts +5 -0
- package/context/SeriesProvider/SeriesProvider.js +37 -0
- package/context/SeriesProvider/index.d.ts +12 -0
- package/context/SeriesProvider/index.js +49 -0
- package/context/SeriesProvider/processSeries.d.ts +17 -0
- package/context/SeriesProvider/processSeries.js +55 -0
- package/context/ZAxisContextProvider.d.ts +1 -1
- package/context/ZAxisContextProvider.js +1 -1
- package/esm/BarChart/BarChart.js +0 -2
- package/esm/BarChart/BarElement.js +2 -2
- package/esm/BarChart/BarLabel/BarLabelItem.js +1 -1
- package/esm/BarChart/BarPlot.js +8 -8
- package/esm/BarChart/checkScaleErrors.js +11 -11
- package/esm/BarChart/extremums.js +4 -1
- package/esm/BarChart/formatter.js +3 -3
- package/esm/ChartContainer/ChartContainer.js +3 -5
- package/esm/ChartContainer/useChartContainerProps.js +2 -2
- package/esm/ChartsAxis/ChartsAxis.js +4 -4
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/esm/ChartsLegend/ChartsLegend.js +2 -2
- package/esm/ChartsLegend/LegendPerItem.js +1 -1
- package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +3 -1
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +2 -3
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +2 -3
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +8 -4
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +5 -5
- package/esm/ChartsTooltip/ChartsTooltip.js +3 -3
- package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +5 -3
- package/esm/ChartsXAxis/ChartsXAxis.js +2 -2
- package/esm/ChartsYAxis/ChartsYAxis.js +2 -2
- package/esm/Gauge/GaugeReferenceArc.js +1 -1
- package/esm/Gauge/GaugeValueArc.js +1 -1
- package/esm/LineChart/AnimatedArea.js +1 -1
- package/esm/LineChart/AnimatedLine.js +1 -1
- package/esm/LineChart/AreaElement.js +1 -1
- package/esm/LineChart/AreaPlot.js +11 -7
- package/esm/LineChart/LineChart.js +4 -3
- package/esm/LineChart/LineElement.js +1 -1
- package/esm/LineChart/LineHighlightPlot.js +9 -5
- package/esm/LineChart/LinePlot.js +11 -7
- package/esm/LineChart/MarkElement.js +1 -1
- package/esm/LineChart/MarkPlot.js +9 -5
- package/esm/LineChart/extremums.js +4 -1
- package/esm/LineChart/formatter.js +3 -3
- package/esm/PieChart/PieArc.js +2 -1
- package/esm/PieChart/PieArcLabel.js +1 -1
- package/esm/PieChart/PieChart.js +0 -2
- package/esm/PieChart/formatter.js +1 -1
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -2
- package/esm/ResponsiveChartContainer/useChartContainerDimensions.js +2 -2
- package/esm/ScatterChart/ScatterChart.js +4 -3
- package/esm/ScatterChart/ScatterPlot.js +6 -3
- package/esm/ScatterChart/extremums.js +8 -2
- package/esm/SparkLineChart/SparkLineChart.js +0 -2
- package/esm/context/CartesianProvider/computeValue.js +1 -1
- package/esm/context/CartesianProvider/normalizeAxis.js +1 -1
- package/esm/context/DrawingProvider.js +7 -1
- package/esm/context/SeriesProvider/Series.types.js +1 -0
- package/esm/context/SeriesProvider/SeriesContext.js +8 -0
- package/esm/context/SeriesProvider/SeriesProvider.js +30 -0
- package/esm/context/SeriesProvider/index.js +8 -0
- package/esm/context/{SeriesContextProvider.js → SeriesProvider/processSeries.js} +10 -35
- package/esm/context/ZAxisContextProvider.js +1 -1
- package/esm/hooks/useAxisEvents.js +12 -8
- package/esm/hooks/useReducedMotion.js +2 -2
- package/esm/hooks/useSeries.js +1 -1
- package/esm/internals/SlotComponentPropsFromProps.js +1 -0
- package/esm/internals/colorScale.js +1 -1
- package/esm/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +1 -1
- package/esm/internals/geometry.js +1 -1
- package/esm/internals/getCurve.js +1 -1
- package/esm/internals/getPercentageValue.js +1 -1
- package/esm/internals/getScale.js +1 -1
- package/esm/internals/index.js +1 -1
- package/esm/internals/stackSeries.js +1 -1
- package/esm/internals/useAnimatedPath.js +1 -1
- package/esm/internals/warning.js +19 -11
- package/hooks/useAxisEvents.js +12 -8
- package/hooks/useReducedMotion.js +2 -2
- package/hooks/useSeries.d.ts +1 -1
- package/hooks/useSeries.js +2 -2
- package/hooks/useTicks.d.ts +1 -1
- package/index.js +1 -1
- package/internals/SlotComponentPropsFromProps.d.ts +1 -0
- package/internals/SlotComponentPropsFromProps.js +5 -0
- package/internals/colorScale.d.ts +3 -3
- package/internals/colorScale.js +1 -1
- package/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +1 -1
- package/internals/defaultizeColor.d.ts +8 -1
- package/internals/geometry.js +1 -1
- package/internals/getCurve.d.ts +1 -1
- package/internals/getCurve.js +1 -1
- package/internals/getPercentageValue.js +1 -1
- package/internals/getScale.js +1 -1
- package/internals/index.d.ts +1 -1
- package/internals/index.js +4 -4
- package/internals/isBandScale.d.ts +1 -1
- package/internals/stackSeries.d.ts +1 -1
- package/internals/stackSeries.js +1 -1
- package/internals/useAnimatedPath.js +1 -1
- package/internals/warning.d.ts +2 -1
- package/internals/warning.js +21 -12
- package/models/axis.d.ts +2 -2
- package/models/seriesType/common.d.ts +10 -0
- package/models/seriesType/pie.d.ts +1 -1
- package/models/seriesType/scatter.d.ts +5 -0
- package/models/z-axis.d.ts +1 -1
- package/modern/BarChart/BarChart.js +0 -2
- package/modern/BarChart/BarElement.js +2 -2
- package/modern/BarChart/BarLabel/BarLabelItem.js +1 -1
- package/modern/BarChart/BarPlot.js +8 -8
- package/modern/BarChart/checkScaleErrors.js +11 -11
- package/modern/BarChart/extremums.js +4 -1
- package/modern/BarChart/formatter.js +3 -3
- package/modern/ChartContainer/ChartContainer.js +3 -5
- package/modern/ChartContainer/useChartContainerProps.js +2 -2
- package/modern/ChartsAxis/ChartsAxis.js +4 -4
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/modern/ChartsLegend/ChartsLegend.js +2 -2
- package/modern/ChartsLegend/LegendPerItem.js +1 -1
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +3 -1
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +2 -3
- package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +2 -3
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +8 -4
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +5 -5
- package/modern/ChartsTooltip/ChartsTooltip.js +3 -3
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +5 -3
- package/modern/ChartsXAxis/ChartsXAxis.js +2 -2
- package/modern/ChartsYAxis/ChartsYAxis.js +2 -2
- package/modern/Gauge/GaugeReferenceArc.js +1 -1
- package/modern/Gauge/GaugeValueArc.js +1 -1
- package/modern/LineChart/AnimatedArea.js +1 -1
- package/modern/LineChart/AnimatedLine.js +1 -1
- package/modern/LineChart/AreaElement.js +1 -1
- package/modern/LineChart/AreaPlot.js +11 -7
- package/modern/LineChart/LineChart.js +4 -3
- package/modern/LineChart/LineElement.js +1 -1
- package/modern/LineChart/LineHighlightPlot.js +9 -5
- package/modern/LineChart/LinePlot.js +11 -7
- package/modern/LineChart/MarkElement.js +1 -1
- package/modern/LineChart/MarkPlot.js +9 -5
- package/modern/LineChart/extremums.js +4 -1
- package/modern/LineChart/formatter.js +3 -3
- package/modern/PieChart/PieArc.js +2 -1
- package/modern/PieChart/PieArcLabel.js +1 -1
- package/modern/PieChart/PieChart.js +0 -2
- package/modern/PieChart/formatter.js +1 -1
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -2
- package/modern/ResponsiveChartContainer/useChartContainerDimensions.js +2 -2
- package/modern/ScatterChart/ScatterChart.js +4 -3
- package/modern/ScatterChart/ScatterPlot.js +6 -3
- package/modern/ScatterChart/extremums.js +8 -2
- package/modern/SparkLineChart/SparkLineChart.js +0 -2
- package/modern/context/CartesianProvider/computeValue.js +1 -1
- package/modern/context/CartesianProvider/normalizeAxis.js +1 -1
- package/modern/context/DrawingProvider.js +7 -1
- package/modern/context/SeriesProvider/Series.types.js +1 -0
- package/modern/context/SeriesProvider/SeriesContext.js +8 -0
- package/modern/context/SeriesProvider/SeriesProvider.js +30 -0
- package/modern/context/SeriesProvider/index.js +8 -0
- package/modern/context/{SeriesContextProvider.js → SeriesProvider/processSeries.js} +10 -35
- package/modern/context/ZAxisContextProvider.js +1 -1
- package/modern/hooks/useAxisEvents.js +12 -8
- package/modern/hooks/useReducedMotion.js +2 -2
- package/modern/hooks/useSeries.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/SlotComponentPropsFromProps.js +1 -0
- package/modern/internals/colorScale.js +1 -1
- package/modern/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +1 -1
- package/modern/internals/geometry.js +1 -1
- package/modern/internals/getCurve.js +1 -1
- package/modern/internals/getPercentageValue.js +1 -1
- package/modern/internals/getScale.js +1 -1
- package/modern/internals/index.js +1 -1
- package/modern/internals/stackSeries.js +1 -1
- package/modern/internals/useAnimatedPath.js +1 -1
- package/modern/internals/warning.js +19 -11
- package/package.json +8 -25
- package/context/SeriesContextProvider.js +0 -81
package/hooks/useTicks.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type SlotComponentPropsFromProps<TProps extends {}, TOverrides extends {}, TOwnerState extends {}> = (Partial<TProps> & TOverrides) | ((ownerState: TOwnerState) => Partial<TProps> & TOverrides);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ScaleOrdinal } from 'd3-scale';
|
|
1
|
+
import { ScaleOrdinal } from '@mui/x-charts-vendor/d3-scale';
|
|
2
2
|
import { ContinuousColorConfig, PiecewiseColorConfig, OrdinalColorConfig } from '../models/colorMapping';
|
|
3
|
-
export declare function getSequentialColorScale<Value extends number | Date>(config: ContinuousColorConfig<Value> | PiecewiseColorConfig<Value>): import("d3-scale").ScaleThreshold<Value, string, never> | import("d3-scale").ScaleSequential<string, never>;
|
|
3
|
+
export declare function getSequentialColorScale<Value extends number | Date>(config: ContinuousColorConfig<Value> | PiecewiseColorConfig<Value>): import("@mui/x-charts-vendor/d3-scale").ScaleThreshold<Value, string, never> | import("@mui/x-charts-vendor/d3-scale").ScaleSequential<string, never>;
|
|
4
4
|
export declare function getOrdinalColorScale<Value extends number | Date | string>(config: OrdinalColorConfig<Value>): ScaleOrdinal<Value, string, null | string> | ScaleOrdinal<number, string, null | string>;
|
|
5
|
-
export declare function getColorScale(config: ContinuousColorConfig | PiecewiseColorConfig | OrdinalColorConfig): import("d3-scale").ScaleSequential<string, never> | ScaleOrdinal<number, string, string | null> | ScaleOrdinal<string | number | Date, string, string | null> | import("d3-scale").ScaleThreshold<number | Date, string, never>;
|
|
5
|
+
export declare function getColorScale(config: ContinuousColorConfig | PiecewiseColorConfig | OrdinalColorConfig): import("@mui/x-charts-vendor/d3-scale").ScaleSequential<string, never> | ScaleOrdinal<number, string, string | null> | ScaleOrdinal<string | number | Date, string, string | null> | import("@mui/x-charts-vendor/d3-scale").ScaleThreshold<number | Date, string, never>;
|
package/internals/colorScale.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getColorScale = getColorScale;
|
|
7
7
|
exports.getOrdinalColorScale = getOrdinalColorScale;
|
|
8
8
|
exports.getSequentialColorScale = getSequentialColorScale;
|
|
9
|
-
var _d3Scale = require("d3-scale");
|
|
9
|
+
var _d3Scale = require("@mui/x-charts-vendor/d3-scale");
|
|
10
10
|
function getSequentialColorScale(config) {
|
|
11
11
|
if (config.type === 'piecewise') {
|
|
12
12
|
return (0, _d3Scale.scaleThreshold)(config.thresholds, config.colors);
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = ChartsContinuousGradient;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _d3Interpolate = require("d3-interpolate");
|
|
8
|
+
var _d3Interpolate = require("@mui/x-charts-vendor/d3-interpolate");
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
10
|
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); }
|
|
11
11
|
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 && {}.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; }
|
|
@@ -2,7 +2,7 @@ import { AllSeriesType } from '../models/seriesType';
|
|
|
2
2
|
export declare function defaultizeColor(series: AllSeriesType, seriesIndex: number, colors?: string[]): {
|
|
3
3
|
data: {
|
|
4
4
|
color: string;
|
|
5
|
-
label?: string | ((location: "tooltip" | "legend" | "arc") => string);
|
|
5
|
+
label?: (string | ((location: "tooltip" | "legend" | "arc") => string)) | undefined;
|
|
6
6
|
value: number;
|
|
7
7
|
id?: import("../models/seriesType").PieItemId | undefined;
|
|
8
8
|
}[];
|
|
@@ -56,6 +56,8 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
|
|
|
56
56
|
highlightScope?: Partial<import("..").HighlightScope>;
|
|
57
57
|
xAxisKey?: string;
|
|
58
58
|
yAxisKey?: string;
|
|
59
|
+
xAxisId?: string;
|
|
60
|
+
yAxisId?: string;
|
|
59
61
|
stack?: string;
|
|
60
62
|
stackOrder?: import("..").StackOrderType;
|
|
61
63
|
} | {
|
|
@@ -76,6 +78,8 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
|
|
|
76
78
|
highlightScope?: Partial<import("..").HighlightScope>;
|
|
77
79
|
xAxisKey?: string;
|
|
78
80
|
yAxisKey?: string;
|
|
81
|
+
xAxisId?: string;
|
|
82
|
+
yAxisId?: string;
|
|
79
83
|
stackOrder?: import("..").StackOrderType;
|
|
80
84
|
} | {
|
|
81
85
|
type: "scatter";
|
|
@@ -84,10 +88,13 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
|
|
|
84
88
|
label?: string | ((location: "tooltip" | "legend") => string);
|
|
85
89
|
disableHover?: boolean;
|
|
86
90
|
zAxisKey?: string;
|
|
91
|
+
zAxisId?: string;
|
|
87
92
|
id?: import(".").SeriesId;
|
|
88
93
|
color: string;
|
|
89
94
|
valueFormatter?: import(".").SeriesValueFormatter<import("../models/seriesType").ScatterValueType> | undefined;
|
|
90
95
|
highlightScope?: Partial<import("..").HighlightScope>;
|
|
91
96
|
xAxisKey?: string;
|
|
92
97
|
yAxisKey?: string;
|
|
98
|
+
xAxisId?: string;
|
|
99
|
+
yAxisId?: string;
|
|
93
100
|
};
|
package/internals/geometry.js
CHANGED
|
@@ -20,7 +20,7 @@ function getMinXTranslation(width, height, angle = 0) {
|
|
|
20
20
|
if (process.env.NODE_ENV !== 'production') {
|
|
21
21
|
if (!warnedOnce && angle > 90 && angle < -90) {
|
|
22
22
|
warnedOnce = true;
|
|
23
|
-
console.warn([`MUI X
|
|
23
|
+
console.warn([`MUI X: It seems you applied an angle larger than 90° or smaller than -90° to an axis text.`, `This could cause some text overlapping.`, `If you encounter a use case where it's needed, please open an issue.`].join('\n'));
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
const standardAngle = Math.min(Math.abs(angle) % 180, Math.abs(Math.abs(angle) % 180 - 180) % 180); // Map from R to [0, 90]
|
package/internals/getCurve.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { CurveType } from '../models/seriesType/line';
|
|
2
|
-
export default function getCurveFactory(curveType?: CurveType): import("d3-shape").CurveFactory;
|
|
2
|
+
export default function getCurveFactory(curveType?: CurveType): import("@mui/x-charts-vendor/d3-shape").CurveFactory;
|
package/internals/getCurve.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = getCurveFactory;
|
|
7
|
-
var _d3Shape = require("d3-shape");
|
|
7
|
+
var _d3Shape = require("@mui/x-charts-vendor/d3-shape");
|
|
8
8
|
function getCurveFactory(curveType) {
|
|
9
9
|
switch (curveType) {
|
|
10
10
|
case 'catmullRom':
|
|
@@ -30,5 +30,5 @@ function getPercentageValue(value, refValue) {
|
|
|
30
30
|
return val;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
throw Error(`MUI X
|
|
33
|
+
throw Error(`MUI X: Received an unknown value "${value}". It should be a number, or a string with a percentage value.`);
|
|
34
34
|
}
|
package/internals/getScale.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getScale = getScale;
|
|
7
|
-
var _d3Scale = require("d3-scale");
|
|
7
|
+
var _d3Scale = require("@mui/x-charts-vendor/d3-scale");
|
|
8
8
|
function getScale(scaleType, domain, range) {
|
|
9
9
|
switch (scaleType) {
|
|
10
10
|
case 'log':
|
package/internals/index.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export * from '../context/CartesianProvider';
|
|
|
19
19
|
export * from '../context/DrawingProvider';
|
|
20
20
|
export * from '../context/ColorProvider';
|
|
21
21
|
export * from '../context/InteractionProvider';
|
|
22
|
-
export * from '../context/
|
|
22
|
+
export * from '../context/SeriesProvider';
|
|
23
23
|
export * from '../context/ZAxisContextProvider';
|
|
24
24
|
export type * from '../context/context.types';
|
|
25
25
|
export * from '../models/seriesType/config';
|
package/internals/index.js
CHANGED
|
@@ -221,15 +221,15 @@ Object.keys(_InteractionProvider).forEach(function (key) {
|
|
|
221
221
|
}
|
|
222
222
|
});
|
|
223
223
|
});
|
|
224
|
-
var
|
|
225
|
-
Object.keys(
|
|
224
|
+
var _SeriesProvider = require("../context/SeriesProvider");
|
|
225
|
+
Object.keys(_SeriesProvider).forEach(function (key) {
|
|
226
226
|
if (key === "default" || key === "__esModule") return;
|
|
227
227
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
228
|
-
if (key in exports && exports[key] ===
|
|
228
|
+
if (key in exports && exports[key] === _SeriesProvider[key]) return;
|
|
229
229
|
Object.defineProperty(exports, key, {
|
|
230
230
|
enumerable: true,
|
|
231
231
|
get: function () {
|
|
232
|
-
return
|
|
232
|
+
return _SeriesProvider[key];
|
|
233
233
|
}
|
|
234
234
|
});
|
|
235
235
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Series } from 'd3-shape';
|
|
1
|
+
import { Series } from '@mui/x-charts-vendor/d3-shape';
|
|
2
2
|
import type { BarSeriesType, LineSeriesType } from '../models/seriesType';
|
|
3
3
|
import type { StackOffsetType, StackOrderType } from '../models/stacking';
|
|
4
4
|
import { SeriesId } from '../models/seriesType/common';
|
package/internals/stackSeries.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getStackingGroups = exports.StackOrder = exports.StackOffset = void 0;
|
|
7
|
-
var _d3Shape = require("d3-shape");
|
|
7
|
+
var _d3Shape = require("@mui/x-charts-vendor/d3-shape");
|
|
8
8
|
const StackOrder = exports.StackOrder = {
|
|
9
9
|
/**
|
|
10
10
|
* Series order such that the earliest series (according to the maximum value) is at the bottom.
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useAnimatedPath = void 0;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _d3Interpolate = require("d3-interpolate");
|
|
8
|
+
var _d3Interpolate = require("@mui/x-charts-vendor/d3-interpolate");
|
|
9
9
|
var _web = require("@react-spring/web");
|
|
10
10
|
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); }
|
|
11
11
|
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 && {}.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; }
|
package/internals/warning.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export declare function
|
|
1
|
+
export declare function warnOnce(message: string | string[], gravity?: 'warning' | 'error'): void;
|
|
2
|
+
export declare function clearWarningsCache(): void;
|
package/internals/warning.js
CHANGED
|
@@ -3,17 +3,26 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
exports.clearWarningsCache = clearWarningsCache;
|
|
7
|
+
exports.warnOnce = warnOnce;
|
|
8
|
+
const warnedOnceCache = new Set();
|
|
9
|
+
|
|
10
|
+
// TODO move to @mui/x-internals
|
|
11
|
+
// TODO eventually move to @base_ui/internals. Base UI, etc. too need this helper.
|
|
12
|
+
function warnOnce(message, gravity = 'warning') {
|
|
13
|
+
if (process.env.NODE_ENV === 'production') {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const cleanMessage = Array.isArray(message) ? message.join('\n') : message;
|
|
17
|
+
if (!warnedOnceCache.has(cleanMessage)) {
|
|
18
|
+
warnedOnceCache.add(cleanMessage);
|
|
19
|
+
if (gravity === 'error') {
|
|
20
|
+
console.error(cleanMessage);
|
|
21
|
+
} else {
|
|
22
|
+
console.warn(cleanMessage);
|
|
17
23
|
}
|
|
18
|
-
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function clearWarningsCache() {
|
|
27
|
+
warnedOnceCache.clear();
|
|
19
28
|
}
|
package/models/axis.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ScaleBand, ScaleLogarithmic, ScalePower, ScaleTime, ScaleLinear, ScalePoint, ScaleOrdinal, ScaleSequential, ScaleThreshold } from 'd3-scale';
|
|
1
|
+
import type { ScaleBand, ScaleLogarithmic, ScalePower, ScaleTime, ScaleLinear, ScalePoint, ScaleOrdinal, ScaleSequential, ScaleThreshold } from '@mui/x-charts-vendor/d3-scale';
|
|
2
2
|
import { ChartsAxisClasses } from '../ChartsAxis/axisClasses';
|
|
3
3
|
import type { TickParams } from '../hooks/useTicks';
|
|
4
4
|
import { ChartsTextProps } from '../ChartsText';
|
|
@@ -254,7 +254,7 @@ export type AxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps = Cha
|
|
|
254
254
|
* If `true`, Reverse the axis scaleBand.
|
|
255
255
|
*/
|
|
256
256
|
reverse?: boolean;
|
|
257
|
-
} & Partial<AxisProps> & Partial<Omit<AxisScaleConfig[S], 'scale'>> & TickParams & AxisConfigExtension;
|
|
257
|
+
} & Omit<Partial<AxisProps>, 'axisId'> & Partial<Omit<AxisScaleConfig[S], 'scale'>> & TickParams & AxisConfigExtension;
|
|
258
258
|
export interface AxisConfigExtension {
|
|
259
259
|
}
|
|
260
260
|
export type AxisDefaultized<S extends ScaleName = ScaleName, V = any, AxisProps = ChartsXAxisProps | ChartsYAxisProps> = Omit<AxisConfig<S, V, AxisProps>, 'scaleType'> & AxisScaleConfig[S] & AxisScaleComputedConfig[S] & {
|
|
@@ -27,12 +27,22 @@ export type CommonDefaultizedProps = 'id' | 'valueFormatter' | 'data';
|
|
|
27
27
|
export type CartesianSeriesType = {
|
|
28
28
|
/**
|
|
29
29
|
* The id of the x-axis used to render the series.
|
|
30
|
+
* @deprecated Use `xAxisId` instead
|
|
30
31
|
*/
|
|
31
32
|
xAxisKey?: string;
|
|
32
33
|
/**
|
|
33
34
|
* The id of the y-axis used to render the series.
|
|
35
|
+
* @deprecated Use `xAxisId` instead
|
|
34
36
|
*/
|
|
35
37
|
yAxisKey?: string;
|
|
38
|
+
/**
|
|
39
|
+
* The id of the x-axis used to render the series.
|
|
40
|
+
*/
|
|
41
|
+
xAxisId?: string;
|
|
42
|
+
/**
|
|
43
|
+
* The id of the y-axis used to render the series.
|
|
44
|
+
*/
|
|
45
|
+
yAxisId?: string;
|
|
36
46
|
};
|
|
37
47
|
export type StackableSeriesType = {
|
|
38
48
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PieArcDatum as D3PieArcDatum } from 'd3-shape';
|
|
1
|
+
import { PieArcDatum as D3PieArcDatum } from '@mui/x-charts-vendor/d3-shape';
|
|
2
2
|
import { DefaultizedProps } from '../helpers';
|
|
3
3
|
import { CommonDefaultizedProps, CommonSeriesType, SeriesId } from './common';
|
|
4
4
|
export type PieItemId = string | number;
|
|
@@ -24,8 +24,13 @@ export interface ScatterSeriesType extends CommonSeriesType<ScatterValueType>, C
|
|
|
24
24
|
disableHover?: boolean;
|
|
25
25
|
/**
|
|
26
26
|
* The id of the z-axis used to render the series.
|
|
27
|
+
* @deprecated Use `zAxisId` instead.
|
|
27
28
|
*/
|
|
28
29
|
zAxisKey?: string;
|
|
30
|
+
/**
|
|
31
|
+
* The id of the z-axis used to render the series.
|
|
32
|
+
*/
|
|
33
|
+
zAxisId?: string;
|
|
29
34
|
}
|
|
30
35
|
/**
|
|
31
36
|
* An object that allows to identify a single scatter item.
|
package/models/z-axis.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ScaleOrdinal, ScaleSequential, ScaleThreshold } from 'd3-scale';
|
|
1
|
+
import type { ScaleOrdinal, ScaleSequential, ScaleThreshold } from '@mui/x-charts-vendor/d3-scale';
|
|
2
2
|
import { ContinuousColorConfig, OrdinalColorConfig, PiecewiseColorConfig } from './colorMapping';
|
|
3
3
|
export interface ZAxisConfig<V = any> {
|
|
4
4
|
id: string;
|
|
@@ -239,7 +239,6 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
239
239
|
* An array of [[AxisConfig]] objects.
|
|
240
240
|
*/
|
|
241
241
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
242
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
243
242
|
classes: PropTypes.object,
|
|
244
243
|
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
245
244
|
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
@@ -292,7 +291,6 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
292
291
|
* An array of [[AxisConfig]] objects.
|
|
293
292
|
*/
|
|
294
293
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
295
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
296
294
|
classes: PropTypes.object,
|
|
297
295
|
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
298
296
|
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
@@ -4,11 +4,11 @@ const _excluded = ["id", "dataIndex", "classes", "color", "slots", "slotProps",
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import composeClasses from '@mui/utils/composeClasses';
|
|
7
|
-
import
|
|
7
|
+
import useSlotProps from '@mui/utils/useSlotProps';
|
|
8
8
|
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
9
9
|
import { styled } from '@mui/material/styles';
|
|
10
|
-
import { color as d3Color } from 'd3-color';
|
|
11
10
|
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
11
|
+
import { color as d3Color } from '@mui/x-charts-vendor/d3-color';
|
|
12
12
|
import { animated } from '@react-spring/web';
|
|
13
13
|
import { useInteractionItemProps } from '../hooks/useInteractionItemProps';
|
|
14
14
|
import { useItemHighlighted } from '../context';
|
|
@@ -3,7 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
const _excluded = ["seriesId", "classes", "color", "style", "dataIndex", "barLabel", "slots", "slotProps", "height", "width", "value"],
|
|
4
4
|
_excluded2 = ["ownerState"];
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import
|
|
6
|
+
import useSlotProps from '@mui/utils/useSlotProps';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { useUtilityClasses } from './barLabelClasses';
|
|
9
9
|
import { getBarLabel } from './getBarLabel';
|
|
@@ -66,16 +66,16 @@ const useAggregatedData = () => {
|
|
|
66
66
|
ids: groupIds
|
|
67
67
|
}, groupIndex) => {
|
|
68
68
|
return groupIds.flatMap(seriesId => {
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
const xAxisConfig = xAxis[
|
|
72
|
-
const yAxisConfig = yAxis[
|
|
69
|
+
const xAxisId = series[seriesId].xAxisId ?? series[seriesId].xAxisKey ?? defaultXAxisId;
|
|
70
|
+
const yAxisId = series[seriesId].yAxisId ?? series[seriesId].yAxisKey ?? defaultYAxisId;
|
|
71
|
+
const xAxisConfig = xAxis[xAxisId];
|
|
72
|
+
const yAxisConfig = yAxis[yAxisId];
|
|
73
73
|
const verticalLayout = series[seriesId].layout === 'vertical';
|
|
74
|
-
checkScaleErrors(verticalLayout, seriesId,
|
|
74
|
+
checkScaleErrors(verticalLayout, seriesId, xAxisId, xAxis, yAxisId, yAxis);
|
|
75
75
|
const baseScaleConfig = verticalLayout ? xAxisConfig : yAxisConfig;
|
|
76
76
|
const xScale = xAxisConfig.scale;
|
|
77
77
|
const yScale = yAxisConfig.scale;
|
|
78
|
-
const colorGetter = getColor(series[seriesId], xAxis[
|
|
78
|
+
const colorGetter = getColor(series[seriesId], xAxis[xAxisId], yAxis[yAxisId]);
|
|
79
79
|
const bandWidth = baseScaleConfig.scale.bandwidth();
|
|
80
80
|
const {
|
|
81
81
|
barWidth,
|
|
@@ -98,8 +98,8 @@ const useAggregatedData = () => {
|
|
|
98
98
|
seriesId,
|
|
99
99
|
dataIndex,
|
|
100
100
|
layout: series[seriesId].layout,
|
|
101
|
-
x: verticalLayout ? xScale(xAxis[
|
|
102
|
-
y: verticalLayout ? minValueCoord : yScale(yAxis[
|
|
101
|
+
x: verticalLayout ? xScale(xAxis[xAxisId].data?.[dataIndex]) + barOffset : minValueCoord,
|
|
102
|
+
y: verticalLayout ? minValueCoord : yScale(yAxis[yAxisId].data?.[dataIndex]) + barOffset,
|
|
103
103
|
xOrigin: xScale(0),
|
|
104
104
|
yOrigin: yScale(0),
|
|
105
105
|
height: verticalLayout ? maxValueCoord - minValueCoord : barWidth,
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '../constants';
|
|
2
2
|
import { isBandScaleConfig, isPointScaleConfig } from '../models/axis';
|
|
3
|
-
const getAxisMessage = (axisDirection,
|
|
3
|
+
const getAxisMessage = (axisDirection, axisId) => {
|
|
4
4
|
const axisName = `${axisDirection}-axis`;
|
|
5
|
-
const
|
|
5
|
+
const axisIdName = `${axisDirection}Axis`;
|
|
6
6
|
const axisDefaultKey = axisDirection === 'x' ? DEFAULT_X_AXIS_KEY : DEFAULT_Y_AXIS_KEY;
|
|
7
|
-
return
|
|
7
|
+
return axisId === axisDefaultKey ? `The first \`${axisIdName}\`` : `The ${axisName} with id "${axisId}"`;
|
|
8
8
|
};
|
|
9
|
-
export function checkScaleErrors(verticalLayout, seriesId,
|
|
10
|
-
const xAxisConfig = xAxis[
|
|
11
|
-
const yAxisConfig = yAxis[
|
|
9
|
+
export function checkScaleErrors(verticalLayout, seriesId, xAxisId, xAxis, yAxisId, yAxis) {
|
|
10
|
+
const xAxisConfig = xAxis[xAxisId];
|
|
11
|
+
const yAxisConfig = yAxis[yAxisId];
|
|
12
12
|
const discreteAxisConfig = verticalLayout ? xAxisConfig : yAxisConfig;
|
|
13
13
|
const continuousAxisConfig = verticalLayout ? yAxisConfig : xAxisConfig;
|
|
14
|
-
const
|
|
15
|
-
const
|
|
14
|
+
const discreteAxisId = verticalLayout ? xAxisId : yAxisId;
|
|
15
|
+
const continuousAxisId = verticalLayout ? yAxisId : xAxisId;
|
|
16
16
|
const discreteAxisDirection = verticalLayout ? 'x' : 'y';
|
|
17
17
|
const continuousAxisDirection = verticalLayout ? 'y' : 'x';
|
|
18
18
|
if (!isBandScaleConfig(discreteAxisConfig)) {
|
|
19
|
-
throw new Error(`MUI X
|
|
19
|
+
throw new Error(`MUI X: ${getAxisMessage(discreteAxisDirection, discreteAxisId)} should be of type "band" to display the bar series of id "${seriesId}".`);
|
|
20
20
|
}
|
|
21
21
|
if (discreteAxisConfig.data === undefined) {
|
|
22
|
-
throw new Error(`MUI X
|
|
22
|
+
throw new Error(`MUI X: ${getAxisMessage(discreteAxisDirection, discreteAxisId)} should have data property.`);
|
|
23
23
|
}
|
|
24
24
|
if (isBandScaleConfig(continuousAxisConfig) || isPointScaleConfig(continuousAxisConfig)) {
|
|
25
|
-
throw new Error(`MUI X
|
|
25
|
+
throw new Error(`MUI X: ${getAxisMessage(continuousAxisDirection, continuousAxisId)} should be a continuous type to display the bar series of id "${seriesId}".`);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -12,7 +12,10 @@ const getValueExtremum = params => {
|
|
|
12
12
|
axis,
|
|
13
13
|
isDefaultAxis
|
|
14
14
|
} = params;
|
|
15
|
-
return Object.keys(series).filter(seriesId =>
|
|
15
|
+
return Object.keys(series).filter(seriesId => {
|
|
16
|
+
const yAxisId = series[seriesId].yAxisId ?? series[seriesId].yAxisKey;
|
|
17
|
+
return yAxisId === axis.id || isDefaultAxis && yAxisId === undefined;
|
|
18
|
+
}).reduce((acc, seriesId) => {
|
|
16
19
|
const [seriesMin, seriesMax] = series[seriesId].stackedData?.reduce((seriesAcc, values) => [Math.min(...values, ...(seriesAcc[0] === null ? [] : [seriesAcc[0]])), Math.max(...values, ...(seriesAcc[1] === null ? [] : [seriesAcc[1]]))], series[seriesId].stackedData[0]) ?? [null, null];
|
|
17
20
|
return [acc[0] === null ? seriesMin : Math.min(seriesMin, acc[0]), acc[1] === null ? seriesMax : Math.max(seriesMax, acc[1])];
|
|
18
21
|
}, [null, null]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { stack as d3Stack } from 'd3-shape';
|
|
2
|
+
import { stack as d3Stack } from '@mui/x-charts-vendor/d3-shape';
|
|
3
3
|
import { getStackingGroups } from '../internals/stackSeries';
|
|
4
4
|
import { defaultizeValueFormatter } from '../internals/defaultizeValueFormatter';
|
|
5
5
|
let warnOnce = false;
|
|
@@ -25,7 +25,7 @@ const formatter = (params, dataset) => {
|
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
} else if (dataset === undefined) {
|
|
28
|
-
throw new Error([`MUI X
|
|
28
|
+
throw new Error([`MUI X: bar series with id='${id}' has no data.`, 'Either provide a data property to the series or use the dataset prop.'].join('\n'));
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
const completedSeries = {};
|
|
@@ -52,7 +52,7 @@ const formatter = (params, dataset) => {
|
|
|
52
52
|
if (typeof value !== 'number') {
|
|
53
53
|
if (process.env.NODE_ENV !== 'production' && !warnOnce && value !== null) {
|
|
54
54
|
warnOnce = true;
|
|
55
|
-
console.error([`MUI X charts: your dataset key "${dataKey}" is used for plotting bars, but contains nonnumerical elements.`, 'Bar plots only support numbers and null values.']);
|
|
55
|
+
console.error([`MUI X charts: your dataset key "${dataKey}" is used for plotting bars, but contains nonnumerical elements.`, 'Bar plots only support numbers and null values.'].join('\n'));
|
|
56
56
|
}
|
|
57
57
|
return 0;
|
|
58
58
|
}
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { DrawingProvider } from '../context/DrawingProvider';
|
|
5
|
-
import {
|
|
5
|
+
import { SeriesProvider } from '../context/SeriesProvider';
|
|
6
6
|
import { InteractionProvider } from '../context/InteractionProvider';
|
|
7
7
|
import { ColorProvider } from '../context/ColorProvider';
|
|
8
8
|
import { ChartsSurface } from '../ChartsSurface';
|
|
@@ -16,7 +16,7 @@ const ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContainer(pro
|
|
|
16
16
|
children,
|
|
17
17
|
drawingProviderProps,
|
|
18
18
|
colorProviderProps,
|
|
19
|
-
|
|
19
|
+
seriesProviderProps,
|
|
20
20
|
cartesianContextProps,
|
|
21
21
|
zAxisContextProps,
|
|
22
22
|
highlightedProviderProps,
|
|
@@ -24,7 +24,7 @@ const ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContainer(pro
|
|
|
24
24
|
} = useChartContainerProps(props, ref);
|
|
25
25
|
return /*#__PURE__*/_jsx(DrawingProvider, _extends({}, drawingProviderProps, {
|
|
26
26
|
children: /*#__PURE__*/_jsx(ColorProvider, _extends({}, colorProviderProps, {
|
|
27
|
-
children: /*#__PURE__*/_jsx(
|
|
27
|
+
children: /*#__PURE__*/_jsx(SeriesProvider, _extends({}, seriesProviderProps, {
|
|
28
28
|
children: /*#__PURE__*/_jsx(CartesianContextProvider, _extends({}, cartesianContextProps, {
|
|
29
29
|
children: /*#__PURE__*/_jsx(ZAxisContextProvider, _extends({}, zAxisContextProps, {
|
|
30
30
|
children: /*#__PURE__*/_jsx(InteractionProvider, {
|
|
@@ -121,7 +121,6 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
121
121
|
* An array of [[AxisConfig]] objects.
|
|
122
122
|
*/
|
|
123
123
|
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
124
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
125
124
|
classes: PropTypes.object,
|
|
126
125
|
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
127
126
|
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
@@ -174,7 +173,6 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
174
173
|
* An array of [[AxisConfig]] objects.
|
|
175
174
|
*/
|
|
176
175
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
177
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
178
176
|
classes: PropTypes.object,
|
|
179
177
|
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
180
178
|
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
@@ -42,7 +42,7 @@ export const useChartContainerProps = (props, ref) => {
|
|
|
42
42
|
const colorProviderProps = {
|
|
43
43
|
colorProcessors
|
|
44
44
|
};
|
|
45
|
-
const
|
|
45
|
+
const seriesProviderProps = {
|
|
46
46
|
series,
|
|
47
47
|
colors,
|
|
48
48
|
dataset,
|
|
@@ -76,7 +76,7 @@ export const useChartContainerProps = (props, ref) => {
|
|
|
76
76
|
children,
|
|
77
77
|
drawingProviderProps,
|
|
78
78
|
colorProviderProps,
|
|
79
|
-
|
|
79
|
+
seriesProviderProps,
|
|
80
80
|
cartesianContextProps,
|
|
81
81
|
zAxisContextProps,
|
|
82
82
|
highlightedProviderProps,
|
|
@@ -57,16 +57,16 @@ function ChartsAxis(props) {
|
|
|
57
57
|
const topId = getAxisId(topAxis, xAxisIds[0]);
|
|
58
58
|
const rightId = getAxisId(rightAxis, yAxisIds[0]);
|
|
59
59
|
if (topId !== null && !xAxis[topId]) {
|
|
60
|
-
throw Error([`MUI X
|
|
60
|
+
throw Error([`MUI X: id used for top axis "${topId}" is not defined.`, `Available ids are: ${xAxisIds.join(', ')}.`].join('\n'));
|
|
61
61
|
}
|
|
62
62
|
if (leftId !== null && !yAxis[leftId]) {
|
|
63
|
-
throw Error([`MUI X
|
|
63
|
+
throw Error([`MUI X: id used for left axis "${leftId}" is not defined.`, `Available ids are: ${yAxisIds.join(', ')}.`].join('\n'));
|
|
64
64
|
}
|
|
65
65
|
if (rightId !== null && !yAxis[rightId]) {
|
|
66
|
-
throw Error([`MUI X
|
|
66
|
+
throw Error([`MUI X: id used for right axis "${rightId}" is not defined.`, `Available ids are: ${yAxisIds.join(', ')}.`].join('\n'));
|
|
67
67
|
}
|
|
68
68
|
if (bottomId !== null && !xAxis[bottomId]) {
|
|
69
|
-
throw Error([`MUI X
|
|
69
|
+
throw Error([`MUI X: id used for bottom axis "${bottomId}" is not defined.`, `Available ids are: ${xAxisIds.join(', ')}.`].join('\n'));
|
|
70
70
|
}
|
|
71
71
|
const topAxisProps = mergeProps(topAxis, slots, slotProps);
|
|
72
72
|
const bottomAxisProps = mergeProps(bottomAxis, slots, slotProps);
|
|
@@ -74,7 +74,7 @@ function ChartsAxisHighlight(props) {
|
|
|
74
74
|
const isXError = isBandScaleX && xScale(axisX.value) === undefined;
|
|
75
75
|
const isYError = isBandScaleY && yScale(axisY.value) === undefined;
|
|
76
76
|
if (isXError || isYError) {
|
|
77
|
-
console.error([`MUI X
|
|
77
|
+
console.error([`MUI X: The position value provided for the axis is not valid for the current scale.`, `This probably means something is wrong with the data passed to the chart.`, `The ChartsAxisHighlight component will not be displayed.`].join('\n'));
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import useSlotProps from '@mui/utils/useSlotProps';
|
|
5
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
6
6
|
import { useThemeProps, useTheme } from '@mui/material/styles';
|
|
7
7
|
import { getSeriesToDisplay } from './utils';
|
|
8
8
|
import { getLegendUtilityClass } from './chartsLegendClasses';
|
|
@@ -2,7 +2,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
const _excluded = ["rotate", "dominantBaseline"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import
|
|
5
|
+
import NoSsr from '@mui/material/NoSsr';
|
|
6
6
|
import { useTheme, styled } from '@mui/material/styles';
|
|
7
7
|
import { ChartsText } from '../ChartsText';
|
|
8
8
|
import { getWordsByLines } from '../internals/getWordsByLines';
|
|
@@ -37,7 +37,9 @@ function ChartsOnAxisClickHandler(props) {
|
|
|
37
37
|
Object.keys(series).filter(seriesType => ['bar', 'line'].includes(seriesType)).forEach(seriesType => {
|
|
38
38
|
series[seriesType]?.seriesOrder.forEach(seriesId => {
|
|
39
39
|
const seriesItem = series[seriesType].series[seriesId];
|
|
40
|
-
const
|
|
40
|
+
const providedXAxisId = seriesItem.xAxisId ?? seriesItem.xAxisKey;
|
|
41
|
+
const providedYAxisId = seriesItem.yAxisId ?? seriesItem.yAxisKey;
|
|
42
|
+
const axisKey = isXaxis ? providedXAxisId : providedYAxisId;
|
|
41
43
|
if (axisKey === undefined || axisKey === USED_AXIS_ID) {
|
|
42
44
|
seriesValues[seriesId] = seriesItem.data[dataIndex];
|
|
43
45
|
}
|