@mui/x-charts 7.12.0 → 7.13.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 +2 -0
- package/BarChart/BarPlot.js +2 -2
- package/BarChart/extremums.d.ts +1 -1
- package/BarChart/extremums.js +5 -3
- package/BarChart/formatter.d.ts +2 -2
- package/BarChart/getColor.d.ts +3 -3
- package/BarChart/getColor.js +4 -3
- package/BarChart/legend.d.ts +1 -1
- package/BarChart/plugin.d.ts +2 -2
- package/CHANGELOG.md +151 -2
- package/ChartContainer/ChartContainer.d.ts +4 -15
- package/ChartContainer/ChartContainer.js +8 -6
- package/ChartContainer/useChartContainerProps.d.ts +10 -7
- package/ChartContainer/useChartContainerProps.js +16 -19
- package/ChartContainer/useDefaultizeAxis.d.ts +2 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +2 -2
- package/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/ChartsTooltip/utils.js +4 -2
- package/ChartsXAxis/ChartsXAxis.js +11 -5
- package/ChartsYAxis/ChartsYAxis.js +11 -5
- package/LineChart/AreaPlot.js +11 -1
- package/LineChart/LineChart.js +2 -0
- package/LineChart/extremums.d.ts +1 -1
- package/LineChart/extremums.js +4 -15
- package/LineChart/formatter.d.ts +2 -2
- package/LineChart/getColor.d.ts +3 -3
- package/LineChart/getColor.js +4 -3
- package/LineChart/legend.d.ts +1 -1
- package/LineChart/plugin.d.ts +2 -2
- package/PieChart/PieChart.js +2 -0
- package/PieChart/formatter.d.ts +2 -2
- package/PieChart/getColor.d.ts +3 -2
- package/PieChart/getColor.js +4 -3
- package/PieChart/legend.d.ts +1 -1
- package/PieChart/plugin.d.ts +2 -2
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -0
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.d.ts +1 -2
- package/ScatterChart/ScatterChart.js +2 -0
- package/ScatterChart/extremums.d.ts +1 -1
- package/ScatterChart/extremums.js +6 -14
- package/ScatterChart/formatter.d.ts +2 -2
- package/ScatterChart/getColor.d.ts +3 -4
- package/ScatterChart/getColor.js +4 -3
- package/ScatterChart/legend.d.ts +1 -1
- package/ScatterChart/plugin.d.ts +2 -2
- package/SparkLineChart/SparkLineChart.js +2 -0
- package/context/CartesianProvider/CartesianProvider.d.ts +3 -12
- package/context/CartesianProvider/CartesianProvider.js +6 -4
- package/context/CartesianProvider/computeValue.d.ts +2 -1
- package/context/CartesianProvider/defaultizeAxis.d.ts +2 -1
- package/context/CartesianProvider/getAxisExtremum.d.ts +2 -2
- package/context/CartesianProvider/getAxisExtremum.js +3 -10
- package/context/PluginProvider/ColorProcessor.types.d.ts +8 -0
- package/context/PluginProvider/ExtremumGetter.types.d.ts +14 -0
- package/context/PluginProvider/ExtremumGetter.types.js +5 -0
- package/context/PluginProvider/Plugin.types.d.ts +25 -0
- package/context/PluginProvider/Plugin.types.js +5 -0
- package/context/PluginProvider/PluginContext.d.ts +4 -0
- package/{hooks/useColor.js → context/PluginProvider/PluginContext.js} +11 -7
- package/context/PluginProvider/PluginProvider.d.ts +4 -0
- package/context/{ColorProvider.js → PluginProvider/PluginProvider.js} +12 -11
- package/context/PluginProvider/SeriesFormatter.types.d.ts +21 -0
- package/context/PluginProvider/SeriesFormatter.types.js +5 -0
- package/context/PluginProvider/index.d.ts +10 -0
- package/context/PluginProvider/index.js +115 -0
- package/context/PluginProvider/mergePlugins.d.ts +36 -0
- package/context/PluginProvider/mergePlugins.js +37 -0
- package/context/PluginProvider/useColorProcessor.d.ts +4 -0
- package/context/PluginProvider/useColorProcessor.js +23 -0
- package/context/PluginProvider/useSeriesFormatter.d.ts +4 -0
- package/context/PluginProvider/useSeriesFormatter.js +23 -0
- package/context/PluginProvider/useXExtremumGetter.d.ts +4 -0
- package/context/PluginProvider/useXExtremumGetter.js +23 -0
- package/context/PluginProvider/useYExtremumGetter.d.ts +4 -0
- package/context/PluginProvider/useYExtremumGetter.js +23 -0
- package/context/SeriesProvider/Series.types.d.ts +4 -10
- package/context/SeriesProvider/SeriesProvider.js +2 -1
- package/context/SeriesProvider/index.d.ts +1 -1
- package/context/SeriesProvider/processSeries.d.ts +2 -1
- package/esm/BarChart/BarChart.js +2 -0
- package/esm/BarChart/BarPlot.js +1 -2
- package/esm/BarChart/extremums.js +5 -3
- package/esm/BarChart/getColor.js +3 -2
- package/esm/ChartContainer/ChartContainer.js +9 -7
- package/esm/ChartContainer/useChartContainerProps.js +14 -19
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +1 -1
- package/esm/ChartsTooltip/utils.js +4 -2
- package/esm/ChartsXAxis/ChartsXAxis.js +11 -5
- package/esm/ChartsYAxis/ChartsYAxis.js +11 -5
- package/esm/LineChart/AreaPlot.js +11 -1
- package/esm/LineChart/LineChart.js +2 -0
- package/esm/LineChart/extremums.js +4 -15
- package/esm/LineChart/getColor.js +3 -2
- package/esm/PieChart/PieChart.js +2 -0
- package/esm/PieChart/getColor.js +3 -2
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -0
- package/esm/ScatterChart/ScatterChart.js +2 -0
- package/esm/ScatterChart/extremums.js +6 -14
- package/esm/ScatterChart/getColor.js +3 -2
- package/esm/SparkLineChart/SparkLineChart.js +2 -0
- package/esm/context/CartesianProvider/CartesianProvider.js +6 -4
- package/esm/context/CartesianProvider/getAxisExtremum.js +3 -10
- package/esm/context/PluginProvider/Plugin.types.js +1 -0
- package/esm/context/PluginProvider/PluginContext.js +13 -0
- package/esm/context/PluginProvider/PluginProvider.js +19 -0
- package/esm/context/PluginProvider/SeriesFormatter.types.js +1 -0
- package/esm/context/PluginProvider/index.js +10 -0
- package/esm/context/PluginProvider/mergePlugins.js +30 -0
- package/esm/context/PluginProvider/useColorProcessor.js +15 -0
- package/esm/context/PluginProvider/useSeriesFormatter.js +15 -0
- package/esm/context/PluginProvider/useXExtremumGetter.js +15 -0
- package/esm/context/PluginProvider/useYExtremumGetter.js +15 -0
- package/esm/context/SeriesProvider/SeriesProvider.js +2 -1
- package/esm/hooks/useTicks.js +5 -2
- package/esm/internals/index.js +1 -1
- package/esm/internals/isInfinity.js +3 -0
- package/esm/models/index.js +0 -1
- package/hooks/useTicks.js +5 -2
- package/index.js +1 -1
- package/internals/colorScale.d.ts +1 -1
- package/internals/defaultizeColor.d.ts +1 -0
- package/internals/index.d.ts +1 -1
- package/internals/index.js +12 -12
- package/internals/isInfinity.d.ts +1 -0
- package/internals/isInfinity.js +9 -0
- package/models/axis.d.ts +2 -0
- package/models/index.d.ts +0 -1
- package/models/index.js +0 -11
- package/models/seriesType/config.d.ts +0 -26
- package/models/seriesType/line.d.ts +10 -0
- package/modern/BarChart/BarChart.js +2 -0
- package/modern/BarChart/BarPlot.js +1 -2
- package/modern/BarChart/extremums.js +5 -3
- package/modern/BarChart/getColor.js +3 -2
- package/modern/ChartContainer/ChartContainer.js +9 -7
- package/modern/ChartContainer/useChartContainerProps.js +14 -19
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +1 -1
- package/modern/ChartsTooltip/utils.js +4 -2
- package/modern/ChartsXAxis/ChartsXAxis.js +11 -5
- package/modern/ChartsYAxis/ChartsYAxis.js +11 -5
- package/modern/LineChart/AreaPlot.js +11 -1
- package/modern/LineChart/LineChart.js +2 -0
- package/modern/LineChart/extremums.js +4 -15
- package/modern/LineChart/getColor.js +3 -2
- package/modern/PieChart/PieChart.js +2 -0
- package/modern/PieChart/getColor.js +3 -2
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -0
- package/modern/ScatterChart/ScatterChart.js +2 -0
- package/modern/ScatterChart/extremums.js +6 -14
- package/modern/ScatterChart/getColor.js +3 -2
- package/modern/SparkLineChart/SparkLineChart.js +2 -0
- package/modern/context/CartesianProvider/CartesianProvider.js +6 -4
- package/modern/context/CartesianProvider/getAxisExtremum.js +3 -10
- package/modern/context/PluginProvider/ColorProcessor.types.js +1 -0
- package/modern/context/PluginProvider/ExtremumGetter.types.js +1 -0
- package/modern/context/PluginProvider/Plugin.types.js +1 -0
- package/modern/context/PluginProvider/PluginContext.js +13 -0
- package/modern/context/PluginProvider/PluginProvider.js +19 -0
- package/modern/context/PluginProvider/SeriesFormatter.types.js +1 -0
- package/modern/context/PluginProvider/index.js +10 -0
- package/modern/context/PluginProvider/mergePlugins.js +30 -0
- package/modern/context/PluginProvider/useColorProcessor.js +15 -0
- package/modern/context/PluginProvider/useSeriesFormatter.js +15 -0
- package/modern/context/PluginProvider/useXExtremumGetter.js +15 -0
- package/modern/context/PluginProvider/useYExtremumGetter.js +15 -0
- package/modern/context/SeriesProvider/SeriesProvider.js +2 -1
- package/modern/hooks/useTicks.js +5 -2
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -1
- package/modern/internals/isInfinity.js +3 -0
- package/modern/models/index.js +0 -1
- package/package.json +2 -2
- package/ChartContainer/defaultPlugins.d.ts +0 -2
- package/ChartContainer/defaultPlugins.js +0 -11
- package/ChartContainer/useChartContainerHooks.d.ts +0 -11
- package/ChartContainer/useChartContainerHooks.js +0 -34
- package/ChartContainer/usePluginsMerge.d.ts +0 -9
- package/ChartContainer/usePluginsMerge.js +0 -39
- package/context/ColorProvider.d.ts +0 -12
- package/esm/ChartContainer/defaultPlugins.js +0 -5
- package/esm/ChartContainer/useChartContainerHooks.js +0 -24
- package/esm/ChartContainer/usePluginsMerge.js +0 -31
- package/esm/context/ColorProvider.js +0 -16
- package/esm/hooks/useColor.js +0 -9
- package/hooks/useColor.d.ts +0 -4
- package/models/plugin.d.ts +0 -19
- package/modern/ChartContainer/defaultPlugins.js +0 -5
- package/modern/ChartContainer/useChartContainerHooks.js +0 -24
- package/modern/ChartContainer/usePluginsMerge.js +0 -31
- package/modern/context/ColorProvider.js +0 -16
- package/modern/hooks/useColor.js +0 -9
- /package/{models/plugin.js → context/PluginProvider/ColorProcessor.types.js} +0 -0
- /package/esm/{models/plugin.js → context/PluginProvider/ColorProcessor.types.js} +0 -0
- /package/{modern/models/plugin.js → esm/context/PluginProvider/ExtremumGetter.types.js} +0 -0
|
@@ -21,6 +21,8 @@ var _geometry = require("../internals/geometry");
|
|
|
21
21
|
var _useMounted = require("../hooks/useMounted");
|
|
22
22
|
var _useDrawingArea = require("../hooks/useDrawingArea");
|
|
23
23
|
var _getWordsByLines = require("../internals/getWordsByLines");
|
|
24
|
+
var _isInfinity = require("../internals/isInfinity");
|
|
25
|
+
var _isBandScale = require("../internals/isBandScale");
|
|
24
26
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
27
|
const _excluded = ["scale", "tickNumber", "reverse"];
|
|
26
28
|
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); }
|
|
@@ -146,7 +148,8 @@ function ChartsXAxis(inProps) {
|
|
|
146
148
|
tickInterval,
|
|
147
149
|
tickLabelInterval,
|
|
148
150
|
tickPlacement,
|
|
149
|
-
tickLabelPlacement
|
|
151
|
+
tickLabelPlacement,
|
|
152
|
+
sx
|
|
150
153
|
} = defaultizedProps;
|
|
151
154
|
const theme = (0, _styles.useTheme)();
|
|
152
155
|
const classes = useUtilityClasses((0, _extends2.default)({}, defaultizedProps, {
|
|
@@ -208,15 +211,17 @@ function ChartsXAxis(inProps) {
|
|
|
208
211
|
ownerState: {}
|
|
209
212
|
});
|
|
210
213
|
const domain = xScale.domain();
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
214
|
+
const ordinalAxis = (0, _isBandScale.isBandScale)(xScale);
|
|
215
|
+
// Skip axis rendering if no data is available
|
|
216
|
+
// - The domain is an empty array for band/point scales.
|
|
217
|
+
// - The domains contains Infinity for continuous scales.
|
|
218
|
+
if (ordinalAxis && domain.length === 0 || !ordinalAxis && domain.some(_isInfinity.isInfinity)) {
|
|
215
219
|
return null;
|
|
216
220
|
}
|
|
217
221
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_AxisSharedComponents.AxisRoot, {
|
|
218
222
|
transform: `translate(0, ${position === 'bottom' ? top + height : top})`,
|
|
219
223
|
className: classes.root,
|
|
224
|
+
sx: sx,
|
|
220
225
|
children: [!disableLine && /*#__PURE__*/(0, _jsxRuntime.jsx)(Line, (0, _extends2.default)({
|
|
221
226
|
x1: left,
|
|
222
227
|
x2: left + width,
|
|
@@ -314,6 +319,7 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
|
|
|
314
319
|
* @default 'currentColor'
|
|
315
320
|
*/
|
|
316
321
|
stroke: _propTypes.default.string,
|
|
322
|
+
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]),
|
|
317
323
|
/**
|
|
318
324
|
* The font size of the axis ticks text.
|
|
319
325
|
* @default 12
|
|
@@ -18,6 +18,8 @@ var _useDrawingArea = require("../hooks/useDrawingArea");
|
|
|
18
18
|
var _AxisSharedComponents = require("../internals/components/AxisSharedComponents");
|
|
19
19
|
var _ChartsText = require("../ChartsText");
|
|
20
20
|
var _axisClasses = require("../ChartsAxis/axisClasses");
|
|
21
|
+
var _isInfinity = require("../internals/isInfinity");
|
|
22
|
+
var _isBandScale = require("../internals/isBandScale");
|
|
21
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
24
|
const _excluded = ["scale", "tickNumber"];
|
|
23
25
|
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); }
|
|
@@ -87,7 +89,8 @@ function ChartsYAxis(inProps) {
|
|
|
87
89
|
tickPlacement,
|
|
88
90
|
tickLabelPlacement,
|
|
89
91
|
tickInterval,
|
|
90
|
-
tickLabelInterval
|
|
92
|
+
tickLabelInterval,
|
|
93
|
+
sx
|
|
91
94
|
} = defaultizedProps;
|
|
92
95
|
const theme = (0, _styles.useTheme)();
|
|
93
96
|
const isRTL = theme.direction === 'rtl';
|
|
@@ -154,15 +157,17 @@ function ChartsYAxis(inProps) {
|
|
|
154
157
|
ownerState: {}
|
|
155
158
|
});
|
|
156
159
|
const domain = yScale.domain();
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
160
|
+
const ordinalAxis = (0, _isBandScale.isBandScale)(yScale);
|
|
161
|
+
// Skip axis rendering if no data is available
|
|
162
|
+
// - The domain is an empty array for band/point scales.
|
|
163
|
+
// - The domains contains Infinity for continuous scales.
|
|
164
|
+
if (ordinalAxis && domain.length === 0 || !ordinalAxis && domain.some(_isInfinity.isInfinity)) {
|
|
161
165
|
return null;
|
|
162
166
|
}
|
|
163
167
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_AxisSharedComponents.AxisRoot, {
|
|
164
168
|
transform: `translate(${position === 'right' ? left + width : left}, 0)`,
|
|
165
169
|
className: classes.root,
|
|
170
|
+
sx: sx,
|
|
166
171
|
children: [!disableLine && /*#__PURE__*/(0, _jsxRuntime.jsx)(Line, (0, _extends2.default)({
|
|
167
172
|
y1: top,
|
|
168
173
|
y2: top + height,
|
|
@@ -262,6 +267,7 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
|
|
|
262
267
|
* @default 'currentColor'
|
|
263
268
|
*/
|
|
264
269
|
stroke: _propTypes.default.string,
|
|
270
|
+
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]),
|
|
265
271
|
/**
|
|
266
272
|
* The font size of the axis ticks text.
|
|
267
273
|
* @default 12
|
package/LineChart/AreaPlot.js
CHANGED
|
@@ -51,7 +51,8 @@ const useAggregatedData = () => {
|
|
|
51
51
|
yAxisKey = defaultYAxisId,
|
|
52
52
|
stackedData,
|
|
53
53
|
data,
|
|
54
|
-
connectNulls
|
|
54
|
+
connectNulls,
|
|
55
|
+
baseline
|
|
55
56
|
} = series[seriesId];
|
|
56
57
|
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
57
58
|
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
@@ -68,6 +69,15 @@ const useAggregatedData = () => {
|
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
const areaPath = (0, _d3Shape.area)().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y0(d => {
|
|
72
|
+
if (typeof baseline === 'number') {
|
|
73
|
+
return yScale(baseline);
|
|
74
|
+
}
|
|
75
|
+
if (baseline === 'max') {
|
|
76
|
+
return yScale.range()[1];
|
|
77
|
+
}
|
|
78
|
+
if (baseline === 'min') {
|
|
79
|
+
return yScale.range()[0];
|
|
80
|
+
}
|
|
71
81
|
const value = d.y && yScale(d.y[0]);
|
|
72
82
|
if (Number.isNaN(value)) {
|
|
73
83
|
return yScale.range()[0];
|
package/LineChart/LineChart.js
CHANGED
|
@@ -283,6 +283,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
283
283
|
slotProps: _propTypes.default.object,
|
|
284
284
|
slots: _propTypes.default.object,
|
|
285
285
|
stroke: _propTypes.default.string,
|
|
286
|
+
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]),
|
|
286
287
|
tickFontSize: _propTypes.default.number,
|
|
287
288
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
288
289
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
@@ -335,6 +336,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
335
336
|
slotProps: _propTypes.default.object,
|
|
336
337
|
slots: _propTypes.default.object,
|
|
337
338
|
stroke: _propTypes.default.string,
|
|
339
|
+
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]),
|
|
338
340
|
tickFontSize: _propTypes.default.number,
|
|
339
341
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
340
342
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
package/LineChart/extremums.d.ts
CHANGED
package/LineChart/extremums.js
CHANGED
|
@@ -14,16 +14,10 @@ const getExtremumX = params => {
|
|
|
14
14
|
};
|
|
15
15
|
exports.getExtremumX = getExtremumX;
|
|
16
16
|
function getSeriesExtremums(getValues, stackedData) {
|
|
17
|
-
if (stackedData.length === 0) {
|
|
18
|
-
return [null, null];
|
|
19
|
-
}
|
|
20
17
|
return stackedData.reduce((seriesAcc, stackedValue) => {
|
|
21
18
|
const [base, value] = getValues(stackedValue);
|
|
22
|
-
if (seriesAcc[0] === null) {
|
|
23
|
-
return [Math.min(base, value), Math.max(base, value)];
|
|
24
|
-
}
|
|
25
19
|
return [Math.min(base, value, seriesAcc[0]), Math.max(base, value, seriesAcc[1])];
|
|
26
|
-
},
|
|
20
|
+
}, [Infinity, -Infinity]);
|
|
27
21
|
}
|
|
28
22
|
const getExtremumY = params => {
|
|
29
23
|
const {
|
|
@@ -40,17 +34,12 @@ const getExtremumY = params => {
|
|
|
40
34
|
stackedData
|
|
41
35
|
} = series[seriesId];
|
|
42
36
|
const isArea = area !== undefined;
|
|
43
|
-
const getValues = isArea && axis.scaleType !== 'log' ? d => d : d => [d[1], d[1]]; // Since this series is not used to display an area, we do not consider the base (the d[0]).
|
|
44
37
|
|
|
38
|
+
// Since this series is not used to display an area, we do not consider the base (the d[0]).
|
|
39
|
+
const getValues = isArea && axis.scaleType !== 'log' && typeof series[seriesId].baseline !== 'string' ? d => d : d => [d[1], d[1]];
|
|
45
40
|
const seriesExtremums = getSeriesExtremums(getValues, stackedData);
|
|
46
|
-
if (acc[0] === null) {
|
|
47
|
-
return seriesExtremums;
|
|
48
|
-
}
|
|
49
|
-
if (seriesExtremums[0] === null) {
|
|
50
|
-
return acc;
|
|
51
|
-
}
|
|
52
41
|
const [seriesMin, seriesMax] = seriesExtremums;
|
|
53
42
|
return [Math.min(seriesMin, acc[0]), Math.max(seriesMax, acc[1])];
|
|
54
|
-
}, [
|
|
43
|
+
}, [Infinity, -Infinity]);
|
|
55
44
|
};
|
|
56
45
|
exports.getExtremumY = getExtremumY;
|
package/LineChart/formatter.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const formatter:
|
|
1
|
+
import { SeriesFormatter } from '../context/PluginProvider/SeriesFormatter.types';
|
|
2
|
+
declare const formatter: SeriesFormatter<'line'>;
|
|
3
3
|
export default formatter;
|
package/LineChart/getColor.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export default
|
|
1
|
+
import { ColorProcessor } from '../context/PluginProvider/ColorProcessor.types';
|
|
2
|
+
declare const getColor: ColorProcessor<'line'>;
|
|
3
|
+
export default getColor;
|
package/LineChart/getColor.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
7
|
-
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const getColor = (series, xAxis, yAxis) => {
|
|
8
8
|
const yColorScale = yAxis?.colorScale;
|
|
9
9
|
const xColorScale = xAxis?.colorScale;
|
|
10
10
|
if (yColorScale) {
|
|
@@ -28,4 +28,5 @@ function getColor(series, xAxis, yAxis) {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
return () => series.color;
|
|
31
|
-
}
|
|
31
|
+
};
|
|
32
|
+
var _default = exports.default = getColor;
|
package/LineChart/legend.d.ts
CHANGED
package/LineChart/plugin.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const plugin:
|
|
1
|
+
import type { ChartsPlugin } from '../context/PluginProvider';
|
|
2
|
+
export declare const plugin: ChartsPlugin<'line'>;
|
package/PieChart/PieChart.js
CHANGED
|
@@ -327,6 +327,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
327
327
|
slotProps: _propTypes.default.object,
|
|
328
328
|
slots: _propTypes.default.object,
|
|
329
329
|
stroke: _propTypes.default.string,
|
|
330
|
+
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]),
|
|
330
331
|
tickFontSize: _propTypes.default.number,
|
|
331
332
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
332
333
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
@@ -379,6 +380,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
379
380
|
slotProps: _propTypes.default.object,
|
|
380
381
|
slots: _propTypes.default.object,
|
|
381
382
|
stroke: _propTypes.default.string,
|
|
383
|
+
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]),
|
|
382
384
|
tickFontSize: _propTypes.default.number,
|
|
383
385
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
384
386
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
package/PieChart/formatter.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const formatter:
|
|
1
|
+
import { SeriesFormatter } from '../context/PluginProvider/SeriesFormatter.types';
|
|
2
|
+
declare const formatter: SeriesFormatter<'pie'>;
|
|
3
3
|
export default formatter;
|
package/PieChart/getColor.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ColorProcessor } from '../context/PluginProvider/ColorProcessor.types';
|
|
2
|
+
declare const getColor: ColorProcessor<'pie'>;
|
|
3
|
+
export default getColor;
|
package/PieChart/getColor.js
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
7
|
-
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const getColor = series => {
|
|
8
8
|
return dataIndex => {
|
|
9
9
|
return series.data[dataIndex].color;
|
|
10
10
|
};
|
|
11
|
-
}
|
|
11
|
+
};
|
|
12
|
+
var _default = exports.default = getColor;
|
package/PieChart/legend.d.ts
CHANGED
package/PieChart/plugin.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const plugin:
|
|
1
|
+
import type { ChartsPlugin } from '../context/PluginProvider';
|
|
2
|
+
export declare const plugin: ChartsPlugin<'pie'>;
|
|
@@ -139,6 +139,7 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
139
139
|
slotProps: _propTypes.default.object,
|
|
140
140
|
slots: _propTypes.default.object,
|
|
141
141
|
stroke: _propTypes.default.string,
|
|
142
|
+
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]),
|
|
142
143
|
tickFontSize: _propTypes.default.number,
|
|
143
144
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
144
145
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
@@ -191,6 +192,7 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
191
192
|
slotProps: _propTypes.default.object,
|
|
192
193
|
slots: _propTypes.default.object,
|
|
193
194
|
stroke: _propTypes.default.string,
|
|
195
|
+
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]),
|
|
194
196
|
tickFontSize: _propTypes.default.number,
|
|
195
197
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
196
198
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { ResponsiveChartContainerProps } from './ResponsiveChartContainer';
|
|
2
2
|
export declare const useResponsiveChartContainerProps: (props: ResponsiveChartContainerProps, ref: React.ForwardedRef<unknown>) => {
|
|
3
3
|
hasIntrinsicSize: number;
|
|
4
|
-
chartContainerProps: Omit<import("..").ChartsSurfaceProps & Omit<import("../internals").SeriesProviderProps, "seriesFormatters"> & Omit<import("../internals").DrawingProviderProps, "svgRef"> & Pick<import("../internals").
|
|
4
|
+
chartContainerProps: Omit<import("..").ChartsSurfaceProps & Omit<import("../internals").SeriesProviderProps, "seriesFormatters"> & Omit<import("../internals").DrawingProviderProps, "svgRef"> & Pick<import("../internals").CartesianProviderProps, "dataset"> & import("..").ZAxisContextProviderProps & import("..").HighlightedProviderProps & import("../internals").PluginProviderProps, "children"> & {
|
|
5
5
|
xAxis?: import("../internals").MakeOptional<import("..").AxisConfig<import("..").ScaleName, any, import("..").ChartsXAxisProps>, "id">[];
|
|
6
6
|
yAxis?: import("../internals").MakeOptional<import("..").AxisConfig<import("..").ScaleName, any, import("..").ChartsYAxisProps>, "id">[];
|
|
7
7
|
children?: import("react").ReactNode;
|
|
8
|
-
plugins?: import("..").ChartsPluginType<import("../internals").ChartSeriesType>[];
|
|
9
8
|
} & {
|
|
10
9
|
ref: React.ForwardedRef<unknown>;
|
|
11
10
|
};
|
|
@@ -264,6 +264,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
264
264
|
slotProps: _propTypes.default.object,
|
|
265
265
|
slots: _propTypes.default.object,
|
|
266
266
|
stroke: _propTypes.default.string,
|
|
267
|
+
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]),
|
|
267
268
|
tickFontSize: _propTypes.default.number,
|
|
268
269
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
269
270
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
@@ -316,6 +317,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
316
317
|
slotProps: _propTypes.default.object,
|
|
317
318
|
slots: _propTypes.default.object,
|
|
318
319
|
stroke: _propTypes.default.string,
|
|
320
|
+
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]),
|
|
319
321
|
tickFontSize: _propTypes.default.number,
|
|
320
322
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
321
323
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
@@ -5,12 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getExtremumY = exports.getExtremumX = void 0;
|
|
7
7
|
const mergeMinMax = (acc, val) => {
|
|
8
|
-
if (acc[0] === null || acc[1] === null) {
|
|
9
|
-
return val;
|
|
10
|
-
}
|
|
11
|
-
if (val[0] === null || val[1] === null) {
|
|
12
|
-
return acc;
|
|
13
|
-
}
|
|
14
8
|
return [Math.min(acc[0], val[0]), Math.max(acc[1], val[1])];
|
|
15
9
|
};
|
|
16
10
|
const getExtremumX = params => {
|
|
@@ -26,11 +20,10 @@ const getExtremumX = params => {
|
|
|
26
20
|
const seriesMinMax = series[seriesId].data.reduce((accSeries, {
|
|
27
21
|
x
|
|
28
22
|
}) => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}, [null, null]);
|
|
23
|
+
return mergeMinMax(accSeries, [x, x]);
|
|
24
|
+
}, [Infinity, -Infinity]);
|
|
32
25
|
return mergeMinMax(acc, seriesMinMax);
|
|
33
|
-
}, [
|
|
26
|
+
}, [Infinity, -Infinity]);
|
|
34
27
|
};
|
|
35
28
|
exports.getExtremumX = getExtremumX;
|
|
36
29
|
const getExtremumY = params => {
|
|
@@ -46,10 +39,9 @@ const getExtremumY = params => {
|
|
|
46
39
|
const seriesMinMax = series[seriesId].data.reduce((accSeries, {
|
|
47
40
|
y
|
|
48
41
|
}) => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}, [null, null]);
|
|
42
|
+
return mergeMinMax(accSeries, [y, y]);
|
|
43
|
+
}, [Infinity, -Infinity]);
|
|
52
44
|
return mergeMinMax(acc, seriesMinMax);
|
|
53
|
-
}, [
|
|
45
|
+
}, [Infinity, -Infinity]);
|
|
54
46
|
};
|
|
55
47
|
exports.getExtremumY = getExtremumY;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const formatter:
|
|
1
|
+
import { SeriesFormatter } from '../context/PluginProvider/SeriesFormatter.types';
|
|
2
|
+
declare const formatter: SeriesFormatter<'scatter'>;
|
|
3
3
|
export default formatter;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export default function getColor(series: DefaultizedScatterSeriesType, xAxis?: AxisDefaultized, yAxis?: AxisDefaultized, zAxis?: ZAxisDefaultized): (dataIndex: number) => string;
|
|
1
|
+
import { ColorProcessor } from '../context/PluginProvider/ColorProcessor.types';
|
|
2
|
+
declare const getColor: ColorProcessor<'scatter'>;
|
|
3
|
+
export default getColor;
|
package/ScatterChart/getColor.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
7
|
-
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const getColor = (series, xAxis, yAxis, zAxis) => {
|
|
8
8
|
const zColorScale = zAxis?.colorScale;
|
|
9
9
|
const yColorScale = yAxis?.colorScale;
|
|
10
10
|
const xColorScale = xAxis?.colorScale;
|
|
@@ -45,4 +45,5 @@ function getColor(series, xAxis, yAxis, zAxis) {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
return () => series.color;
|
|
48
|
-
}
|
|
48
|
+
};
|
|
49
|
+
var _default = exports.default = getColor;
|
package/ScatterChart/legend.d.ts
CHANGED
package/ScatterChart/plugin.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const plugin:
|
|
1
|
+
import type { ChartsPlugin } from '../context/PluginProvider';
|
|
2
|
+
export declare const plugin: ChartsPlugin<'scatter'>;
|
|
@@ -288,6 +288,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
288
288
|
slotProps: _propTypes.default.object,
|
|
289
289
|
slots: _propTypes.default.object,
|
|
290
290
|
stroke: _propTypes.default.string,
|
|
291
|
+
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]),
|
|
291
292
|
tickFontSize: _propTypes.default.number,
|
|
292
293
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
293
294
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
@@ -339,6 +340,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
339
340
|
slotProps: _propTypes.default.object,
|
|
340
341
|
slots: _propTypes.default.object,
|
|
341
342
|
stroke: _propTypes.default.string,
|
|
343
|
+
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]),
|
|
342
344
|
tickFontSize: _propTypes.default.number,
|
|
343
345
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
344
346
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { AxisConfig, ChartsXAxisProps, ChartsYAxisProps, ScaleName } from '../../models/axis';
|
|
3
3
|
import { DatasetType } from '../../models/seriesType/config';
|
|
4
|
-
|
|
5
|
-
export type CartesianContextProviderProps = {
|
|
4
|
+
export type CartesianProviderProps = {
|
|
6
5
|
/**
|
|
7
6
|
* The configuration of the x-axes.
|
|
8
7
|
* If not provided, a default axis config is used.
|
|
@@ -19,15 +18,7 @@ export type CartesianContextProviderProps = {
|
|
|
19
18
|
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
20
19
|
*/
|
|
21
20
|
dataset?: DatasetType;
|
|
22
|
-
/**
|
|
23
|
-
* An object with x-axis extremum getters per series type.
|
|
24
|
-
*/
|
|
25
|
-
xExtremumGetters: ExtremumGettersConfig;
|
|
26
|
-
/**
|
|
27
|
-
* An object with y-axis extremum getters per series type.
|
|
28
|
-
*/
|
|
29
|
-
yExtremumGetters: ExtremumGettersConfig;
|
|
30
21
|
children: React.ReactNode;
|
|
31
22
|
};
|
|
32
|
-
declare function
|
|
33
|
-
export {
|
|
23
|
+
declare function CartesianProvider(props: CartesianProviderProps): React.JSX.Element;
|
|
24
|
+
export { CartesianProvider };
|
|
@@ -3,26 +3,28 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.CartesianProvider = CartesianProvider;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _useDrawingArea = require("../../hooks/useDrawingArea");
|
|
9
9
|
var _useSeries = require("../../hooks/useSeries");
|
|
10
10
|
var _CartesianContext = require("./CartesianContext");
|
|
11
11
|
var _computeValue = require("./computeValue");
|
|
12
|
+
var _useXExtremumGetter = require("../PluginProvider/useXExtremumGetter");
|
|
13
|
+
var _PluginProvider = require("../PluginProvider");
|
|
12
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
15
|
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); }
|
|
14
16
|
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; }
|
|
15
|
-
function
|
|
17
|
+
function CartesianProvider(props) {
|
|
16
18
|
const {
|
|
17
19
|
xAxis,
|
|
18
20
|
yAxis,
|
|
19
21
|
dataset,
|
|
20
|
-
xExtremumGetters,
|
|
21
|
-
yExtremumGetters,
|
|
22
22
|
children
|
|
23
23
|
} = props;
|
|
24
24
|
const formattedSeries = (0, _useSeries.useSeries)();
|
|
25
25
|
const drawingArea = (0, _useDrawingArea.useDrawingArea)();
|
|
26
|
+
const xExtremumGetters = (0, _useXExtremumGetter.useXExtremumGetter)();
|
|
27
|
+
const yExtremumGetters = (0, _PluginProvider.useYExtremumGetter)();
|
|
26
28
|
const xValues = React.useMemo(() => (0, _computeValue.computeValue)({
|
|
27
29
|
drawingArea,
|
|
28
30
|
formattedSeries,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { AxisConfig, ScaleName } from '../../models';
|
|
2
2
|
import { ChartsXAxisProps, ChartsAxisProps, ChartsYAxisProps, AxisId } from '../../models/axis';
|
|
3
|
-
import { CartesianChartSeriesType, DatasetType
|
|
3
|
+
import { CartesianChartSeriesType, DatasetType } from '../../models/seriesType/config';
|
|
4
4
|
import { DefaultizedAxisConfig } from './CartesianContext';
|
|
5
5
|
import { DrawingArea } from '../DrawingProvider';
|
|
6
6
|
import { FormattedSeries } from '../SeriesProvider';
|
|
7
|
+
import { ExtremumGetter } from '../PluginProvider';
|
|
7
8
|
export declare function computeValue(options: {
|
|
8
9
|
drawingArea: DrawingArea;
|
|
9
10
|
formattedSeries: FormattedSeries;
|
|
@@ -9,12 +9,12 @@ export declare const defaultizeAxis: (inAxis: MakeOptional<AxisConfig<ScaleName,
|
|
|
9
9
|
label?: string | undefined;
|
|
10
10
|
max?: (number | Date) | undefined;
|
|
11
11
|
min?: (number | Date) | undefined;
|
|
12
|
+
sx?: import("@mui/system").SxProps | undefined;
|
|
12
13
|
classes?: Partial<import("../..").ChartsAxisClasses> | undefined;
|
|
13
14
|
slots?: Partial<import("../../models/axis").ChartsAxisSlots> | undefined;
|
|
14
15
|
slotProps?: Partial<import("../../models/axis").ChartsAxisSlotProps> | undefined;
|
|
15
16
|
dataKey?: string | undefined;
|
|
16
17
|
valueFormatter?: ((value: any, context: import("../../models/axis").AxisValueFormatterContext) => string) | undefined;
|
|
17
|
-
colorMap?: import("../../models/colorMapping").ContinuousColorConfig<number | Date> | import("../../models/colorMapping").PiecewiseColorConfig<number | Date> | import("../../models/colorMapping").OrdinalColorConfig<string | number | Date> | undefined;
|
|
18
18
|
tickMaxStep?: number | undefined;
|
|
19
19
|
tickMinStep?: number | undefined;
|
|
20
20
|
tickNumber?: number | undefined;
|
|
@@ -30,6 +30,7 @@ export declare const defaultizeAxis: (inAxis: MakeOptional<AxisConfig<ScaleName,
|
|
|
30
30
|
tickPlacement?: ("start" | "end" | "middle" | "extremities") | undefined;
|
|
31
31
|
tickLabelPlacement?: ("middle" | "tick") | undefined;
|
|
32
32
|
scaleType?: "linear" | "time" | "log" | "band" | "point" | "pow" | "sqrt" | "utc" | undefined;
|
|
33
|
+
colorMap?: import("../../models/colorMapping").ContinuousColorConfig<number | Date> | import("../../models/colorMapping").PiecewiseColorConfig<number | Date> | import("../../models/colorMapping").OrdinalColorConfig<string | number | Date> | undefined;
|
|
33
34
|
hideTooltip?: boolean | undefined;
|
|
34
35
|
id: import("../../models/axis").AxisId;
|
|
35
36
|
}[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AxisConfig
|
|
2
|
-
import { ExtremumGetterResult } from '../../models/seriesType/config';
|
|
1
|
+
import { AxisConfig } from '../../models';
|
|
3
2
|
import { FormattedSeries } from '../SeriesProvider';
|
|
3
|
+
import { ExtremumGettersConfig, ExtremumGetterResult } from '../PluginProvider';
|
|
4
4
|
export declare const getAxisExtremum: (axis: AxisConfig, getters: ExtremumGettersConfig, isDefaultAxis: boolean, formattedSeries: FormattedSeries) => ExtremumGetterResult;
|
|
@@ -11,18 +11,11 @@ const axisExtremumCallback = (acc, chartType, axis, getters, isDefaultAxis, form
|
|
|
11
11
|
series,
|
|
12
12
|
axis,
|
|
13
13
|
isDefaultAxis
|
|
14
|
-
}) ?? [
|
|
15
|
-
|
|
16
|
-
if (minData === null || maxData === null) {
|
|
17
|
-
return [minChartTypeData, maxChartTypeData];
|
|
18
|
-
}
|
|
19
|
-
if (minChartTypeData === null || maxChartTypeData === null) {
|
|
20
|
-
return [minData, maxData];
|
|
21
|
-
}
|
|
22
|
-
return [Math.min(minChartTypeData, minData), Math.max(maxChartTypeData, maxData)];
|
|
14
|
+
}) ?? [Infinity, -Infinity];
|
|
15
|
+
return [Math.min(minChartTypeData, acc[0]), Math.max(maxChartTypeData, acc[1])];
|
|
23
16
|
};
|
|
24
17
|
const getAxisExtremum = (axis, getters, isDefaultAxis, formattedSeries) => {
|
|
25
18
|
const charTypes = Object.keys(getters);
|
|
26
|
-
return charTypes.reduce((acc, charType) => axisExtremumCallback(acc, charType, axis, getters, isDefaultAxis, formattedSeries), [
|
|
19
|
+
return charTypes.reduce((acc, charType) => axisExtremumCallback(acc, charType, axis, getters, isDefaultAxis, formattedSeries), [Infinity, -Infinity]);
|
|
27
20
|
};
|
|
28
21
|
exports.getAxisExtremum = getAxisExtremum;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AxisDefaultized } from '../../models/axis';
|
|
2
|
+
import type { DefaultizedSeriesType } from '../../models/seriesType';
|
|
3
|
+
import type { ZAxisDefaultized } from '../../models/z-axis';
|
|
4
|
+
import type { ChartSeriesType } from '../../models/seriesType/config';
|
|
5
|
+
export type ColorProcessor<T extends ChartSeriesType> = (series: DefaultizedSeriesType<T>, xAxis?: AxisDefaultized, yAxis?: AxisDefaultized, zAxis?: ZAxisDefaultized) => (dataIndex: number) => string;
|
|
6
|
+
export type ColorProcessorsConfig<T extends ChartSeriesType> = {
|
|
7
|
+
[Key in T]?: ColorProcessor<Key>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CartesianChartSeriesType, ChartSeries, ChartSeriesType } from '../../models/seriesType/config';
|
|
2
|
+
import type { AxisConfig } from '../../models/axis';
|
|
3
|
+
import type { SeriesId } from '../../models/seriesType/common';
|
|
4
|
+
export type ExtremumGettersConfig<T extends ChartSeriesType = CartesianChartSeriesType> = {
|
|
5
|
+
[K in T]?: ExtremumGetter<K>;
|
|
6
|
+
};
|
|
7
|
+
type ExtremumGetterParams<T extends ChartSeriesType> = {
|
|
8
|
+
series: Record<SeriesId, ChartSeries<T>>;
|
|
9
|
+
axis: AxisConfig;
|
|
10
|
+
isDefaultAxis: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type ExtremumGetterResult = [number, number];
|
|
13
|
+
export type ExtremumGetter<T extends ChartSeriesType> = (params: ExtremumGetterParams<T>) => ExtremumGetterResult;
|
|
14
|
+
export {};
|