@mui/x-charts 8.9.0 → 8.9.2
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 +94 -1
- package/BarChart/BarClipPath.d.ts +17 -12
- package/BarChart/BarClipPath.js +70 -57
- package/BarChart/BarPlot.js +4 -0
- package/BarChart/seriesConfig/extremums.js +2 -3
- package/BarChart/useBarChartProps.d.ts +1 -1
- package/CHANGELOG.md +124 -0
- package/ChartContainer/ChartContainer.js +141 -0
- package/{internals/components/ChartsWrapper → ChartsWrapper}/ChartsWrapper.d.ts +13 -4
- package/{internals/components/ChartsWrapper → ChartsWrapper}/ChartsWrapper.js +33 -7
- package/LineChart/LineChart.js +94 -1
- package/LineChart/seriesConfig/extremums.js +2 -3
- package/LineChart/useLineChartProps.d.ts +1 -1
- package/PieChart/PieChart.js +1 -1
- package/RadarChart/RadarChart.d.ts +1 -1
- package/RadarChart/RadarChart.js +1 -1
- package/RadarChart/useRadarChartProps.d.ts +1 -1
- package/ScatterChart/ScatterChart.js +94 -1
- package/ScatterChart/seriesConfig/extremums.js +50 -23
- package/ScatterChart/useScatterChartProps.d.ts +1 -1
- package/SparkLineChart/SparkLineChart.js +93 -0
- package/esm/BarChart/BarChart.js +94 -1
- package/esm/BarChart/BarClipPath.d.ts +17 -12
- package/esm/BarChart/BarClipPath.js +69 -55
- package/esm/BarChart/BarPlot.js +4 -0
- package/esm/BarChart/seriesConfig/extremums.js +2 -3
- package/esm/BarChart/useBarChartProps.d.ts +1 -1
- package/esm/ChartContainer/ChartContainer.js +141 -0
- package/esm/{internals/components/ChartsWrapper → ChartsWrapper}/ChartsWrapper.d.ts +13 -4
- package/esm/{internals/components/ChartsWrapper → ChartsWrapper}/ChartsWrapper.js +31 -6
- package/esm/LineChart/LineChart.js +94 -1
- package/esm/LineChart/seriesConfig/extremums.js +2 -3
- package/esm/LineChart/useLineChartProps.d.ts +1 -1
- package/esm/PieChart/PieChart.js +1 -1
- package/esm/RadarChart/RadarChart.d.ts +1 -1
- package/esm/RadarChart/RadarChart.js +1 -1
- package/esm/RadarChart/useRadarChartProps.d.ts +1 -1
- package/esm/ScatterChart/ScatterChart.js +94 -1
- package/esm/ScatterChart/seriesConfig/extremums.js +50 -23
- package/esm/ScatterChart/useScatterChartProps.d.ts +1 -1
- package/esm/SparkLineChart/SparkLineChart.js +93 -0
- package/esm/index.d.ts +2 -1
- package/esm/index.js +6 -2
- package/esm/internals/findMinMax.d.ts +1 -0
- package/esm/internals/findMinMax.js +13 -0
- package/esm/internals/getScale.js +3 -0
- package/esm/internals/index.d.ts +1 -1
- package/esm/internals/index.js +1 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +4 -1
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +17 -12
- package/esm/internals/symlogScale.d.ts +2 -0
- package/esm/internals/symlogScale.js +94 -0
- package/esm/models/axis.d.ts +20 -4
- package/esm/models/axis.js +3 -0
- package/index.d.ts +2 -1
- package/index.js +13 -1
- package/internals/findMinMax.d.ts +1 -0
- package/internals/findMinMax.js +19 -0
- package/internals/getScale.js +3 -0
- package/internals/index.d.ts +1 -1
- package/internals/index.js +12 -12
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +3 -0
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +17 -12
- package/internals/symlogScale.d.ts +2 -0
- package/internals/symlogScale.js +100 -0
- package/models/axis.d.ts +20 -4
- package/models/axis.js +4 -0
- package/package.json +5 -6
- package/BarChart/getRadius.d.ts +0 -20
- package/BarChart/getRadius.js +0 -37
- package/esm/BarChart/getRadius.d.ts +0 -20
- package/esm/BarChart/getRadius.js +0 -30
- /package/{esm/internals/components/ChartsWrapper → ChartsWrapper}/index.d.ts +0 -0
- /package/{internals/components/ChartsWrapper → ChartsWrapper}/index.js +0 -0
- /package/{internals/components → esm}/ChartsWrapper/index.d.ts +0 -0
- /package/esm/{internals/components/ChartsWrapper → ChartsWrapper}/index.js +0 -0
|
@@ -361,6 +361,54 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
361
361
|
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
362
362
|
tickSize: PropTypes.number,
|
|
363
363
|
valueFormatter: PropTypes.func
|
|
364
|
+
}), PropTypes.shape({
|
|
365
|
+
classes: PropTypes.object,
|
|
366
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
367
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
368
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
369
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
370
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
371
|
+
}), PropTypes.shape({
|
|
372
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
373
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
374
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
375
|
+
})]),
|
|
376
|
+
constant: PropTypes.number,
|
|
377
|
+
data: PropTypes.array,
|
|
378
|
+
dataKey: PropTypes.string,
|
|
379
|
+
disableLine: PropTypes.bool,
|
|
380
|
+
disableTicks: PropTypes.bool,
|
|
381
|
+
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
382
|
+
endAngle: PropTypes.number,
|
|
383
|
+
fill: PropTypes.string,
|
|
384
|
+
height: PropTypes.number,
|
|
385
|
+
hideTooltip: PropTypes.bool,
|
|
386
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
387
|
+
ignoreTooltip: PropTypes.bool,
|
|
388
|
+
label: PropTypes.string,
|
|
389
|
+
labelGap: PropTypes.number,
|
|
390
|
+
labelStyle: PropTypes.object,
|
|
391
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
392
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
393
|
+
offset: PropTypes.number,
|
|
394
|
+
position: PropTypes.oneOf(['bottom', 'none', 'top']),
|
|
395
|
+
reverse: PropTypes.bool,
|
|
396
|
+
scaleType: PropTypes.oneOf(['symlog']),
|
|
397
|
+
slotProps: PropTypes.object,
|
|
398
|
+
slots: PropTypes.object,
|
|
399
|
+
startAngle: PropTypes.number,
|
|
400
|
+
stroke: PropTypes.string,
|
|
401
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
402
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
403
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
404
|
+
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
405
|
+
tickLabelStyle: PropTypes.object,
|
|
406
|
+
tickMaxStep: PropTypes.number,
|
|
407
|
+
tickMinStep: PropTypes.number,
|
|
408
|
+
tickNumber: PropTypes.number,
|
|
409
|
+
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
410
|
+
tickSize: PropTypes.number,
|
|
411
|
+
valueFormatter: PropTypes.func
|
|
364
412
|
}), PropTypes.shape({
|
|
365
413
|
classes: PropTypes.object,
|
|
366
414
|
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
@@ -783,6 +831,53 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
783
831
|
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
784
832
|
tickSize: PropTypes.number,
|
|
785
833
|
valueFormatter: PropTypes.func
|
|
834
|
+
}), PropTypes.shape({
|
|
835
|
+
axis: PropTypes.oneOf(['x']),
|
|
836
|
+
classes: PropTypes.object,
|
|
837
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
838
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
839
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
840
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
841
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
842
|
+
}), PropTypes.shape({
|
|
843
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
844
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
845
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
846
|
+
})]),
|
|
847
|
+
constant: PropTypes.number,
|
|
848
|
+
data: PropTypes.array,
|
|
849
|
+
dataKey: PropTypes.string,
|
|
850
|
+
disableLine: PropTypes.bool,
|
|
851
|
+
disableTicks: PropTypes.bool,
|
|
852
|
+
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
853
|
+
fill: PropTypes.string,
|
|
854
|
+
height: PropTypes.number,
|
|
855
|
+
hideTooltip: PropTypes.bool,
|
|
856
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
857
|
+
ignoreTooltip: PropTypes.bool,
|
|
858
|
+
label: PropTypes.string,
|
|
859
|
+
labelStyle: PropTypes.object,
|
|
860
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
861
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
862
|
+
offset: PropTypes.number,
|
|
863
|
+
position: PropTypes.oneOf(['bottom', 'none', 'top']),
|
|
864
|
+
reverse: PropTypes.bool,
|
|
865
|
+
scaleType: PropTypes.oneOf(['symlog']),
|
|
866
|
+
slotProps: PropTypes.object,
|
|
867
|
+
slots: PropTypes.object,
|
|
868
|
+
stroke: PropTypes.string,
|
|
869
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
870
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
871
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
872
|
+
tickLabelMinGap: PropTypes.number,
|
|
873
|
+
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
874
|
+
tickLabelStyle: PropTypes.object,
|
|
875
|
+
tickMaxStep: PropTypes.number,
|
|
876
|
+
tickMinStep: PropTypes.number,
|
|
877
|
+
tickNumber: PropTypes.number,
|
|
878
|
+
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
879
|
+
tickSize: PropTypes.number,
|
|
880
|
+
valueFormatter: PropTypes.func
|
|
786
881
|
}), PropTypes.shape({
|
|
787
882
|
axis: PropTypes.oneOf(['x']),
|
|
788
883
|
classes: PropTypes.object,
|
|
@@ -1166,6 +1261,52 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
1166
1261
|
tickSize: PropTypes.number,
|
|
1167
1262
|
valueFormatter: PropTypes.func,
|
|
1168
1263
|
width: PropTypes.number
|
|
1264
|
+
}), PropTypes.shape({
|
|
1265
|
+
axis: PropTypes.oneOf(['y']),
|
|
1266
|
+
classes: PropTypes.object,
|
|
1267
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
1268
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
1269
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
1270
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
1271
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
1272
|
+
}), PropTypes.shape({
|
|
1273
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
1274
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
1275
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
1276
|
+
})]),
|
|
1277
|
+
constant: PropTypes.number,
|
|
1278
|
+
data: PropTypes.array,
|
|
1279
|
+
dataKey: PropTypes.string,
|
|
1280
|
+
disableLine: PropTypes.bool,
|
|
1281
|
+
disableTicks: PropTypes.bool,
|
|
1282
|
+
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
1283
|
+
fill: PropTypes.string,
|
|
1284
|
+
hideTooltip: PropTypes.bool,
|
|
1285
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
1286
|
+
ignoreTooltip: PropTypes.bool,
|
|
1287
|
+
label: PropTypes.string,
|
|
1288
|
+
labelStyle: PropTypes.object,
|
|
1289
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
1290
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
1291
|
+
offset: PropTypes.number,
|
|
1292
|
+
position: PropTypes.oneOf(['left', 'none', 'right']),
|
|
1293
|
+
reverse: PropTypes.bool,
|
|
1294
|
+
scaleType: PropTypes.oneOf(['symlog']),
|
|
1295
|
+
slotProps: PropTypes.object,
|
|
1296
|
+
slots: PropTypes.object,
|
|
1297
|
+
stroke: PropTypes.string,
|
|
1298
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
1299
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
1300
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
1301
|
+
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
1302
|
+
tickLabelStyle: PropTypes.object,
|
|
1303
|
+
tickMaxStep: PropTypes.number,
|
|
1304
|
+
tickMinStep: PropTypes.number,
|
|
1305
|
+
tickNumber: PropTypes.number,
|
|
1306
|
+
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
1307
|
+
tickSize: PropTypes.number,
|
|
1308
|
+
valueFormatter: PropTypes.func,
|
|
1309
|
+
width: PropTypes.number
|
|
1169
1310
|
}), PropTypes.shape({
|
|
1170
1311
|
axis: PropTypes.oneOf(['y']),
|
|
1171
1312
|
classes: PropTypes.object,
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
-
import { Direction } from "
|
|
4
|
-
import { Position } from "
|
|
3
|
+
import { Direction } from "../ChartsLegend/index.js";
|
|
4
|
+
import { Position } from "../models/index.js";
|
|
5
5
|
export interface ChartsWrapperProps {
|
|
6
|
+
/**
|
|
7
|
+
* The position of the legend.
|
|
8
|
+
* @default { horizontal: 'center', vertical: 'bottom' }
|
|
9
|
+
*/
|
|
6
10
|
legendPosition?: Position;
|
|
11
|
+
/**
|
|
12
|
+
* The direction of the legend.
|
|
13
|
+
* @default 'horizontal'
|
|
14
|
+
*/
|
|
7
15
|
legendDirection?: Direction;
|
|
8
16
|
/**
|
|
9
17
|
* If `true`, the chart wrapper set `height: 100%`.
|
|
@@ -14,10 +22,11 @@ export interface ChartsWrapperProps {
|
|
|
14
22
|
sx?: SxProps<Theme>;
|
|
15
23
|
}
|
|
16
24
|
/**
|
|
17
|
-
* @ignore - internal component.
|
|
18
|
-
*
|
|
19
25
|
* Wrapper for the charts components.
|
|
20
26
|
* Its main purpose is to position the HTML legend in the correct place.
|
|
21
27
|
*/
|
|
22
28
|
declare function ChartsWrapper(props: ChartsWrapperProps): React.JSX.Element;
|
|
29
|
+
declare namespace ChartsWrapper {
|
|
30
|
+
var propTypes: any;
|
|
31
|
+
}
|
|
23
32
|
export { ChartsWrapper };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
2
3
|
import { styled } from '@mui/material/styles';
|
|
3
4
|
import { shouldForwardProp } from '@mui/system/createStyled';
|
|
4
|
-
import { useChartRootRef } from "
|
|
5
|
-
import { useStore } from "
|
|
6
|
-
import { useSelector } from "
|
|
7
|
-
import { selectorChartPropsSize } from "
|
|
5
|
+
import { useChartRootRef } from "../hooks/useChartRootRef.js";
|
|
6
|
+
import { useStore } from "../internals/store/useStore.js";
|
|
7
|
+
import { useSelector } from "../internals/store/useSelector.js";
|
|
8
|
+
import { selectorChartPropsSize } from "../internals/plugins/corePlugins/useChartDimensions/index.js";
|
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
10
|
const getDirection = (direction, position) => {
|
|
10
11
|
if (direction === 'vertical') {
|
|
@@ -60,8 +61,6 @@ const Root = styled('div', {
|
|
|
60
61
|
}));
|
|
61
62
|
|
|
62
63
|
/**
|
|
63
|
-
* @ignore - internal component.
|
|
64
|
-
*
|
|
65
64
|
* Wrapper for the charts components.
|
|
66
65
|
* Its main purpose is to position the HTML legend in the correct place.
|
|
67
66
|
*/
|
|
@@ -84,4 +83,30 @@ function ChartsWrapper(props) {
|
|
|
84
83
|
children: children
|
|
85
84
|
});
|
|
86
85
|
}
|
|
86
|
+
process.env.NODE_ENV !== "production" ? ChartsWrapper.propTypes = {
|
|
87
|
+
// ----------------------------- Warning --------------------------------
|
|
88
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
89
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
90
|
+
// ----------------------------------------------------------------------
|
|
91
|
+
children: PropTypes.node,
|
|
92
|
+
/**
|
|
93
|
+
* If `true`, the chart wrapper set `height: 100%`.
|
|
94
|
+
* @default `false` if the `height` prop is set. And `true` otherwise.
|
|
95
|
+
*/
|
|
96
|
+
extendVertically: PropTypes.bool,
|
|
97
|
+
/**
|
|
98
|
+
* The direction of the legend.
|
|
99
|
+
* @default 'horizontal'
|
|
100
|
+
*/
|
|
101
|
+
legendDirection: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
102
|
+
/**
|
|
103
|
+
* The position of the legend.
|
|
104
|
+
* @default { horizontal: 'center', vertical: 'bottom' }
|
|
105
|
+
*/
|
|
106
|
+
legendPosition: PropTypes.shape({
|
|
107
|
+
horizontal: PropTypes.oneOf(['center', 'end', 'start']),
|
|
108
|
+
vertical: PropTypes.oneOf(['bottom', 'middle', 'top'])
|
|
109
|
+
}),
|
|
110
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
111
|
+
} : void 0;
|
|
87
112
|
export { ChartsWrapper };
|
|
@@ -19,7 +19,7 @@ import { useLineChartProps } from "./useLineChartProps.js";
|
|
|
19
19
|
import { useChartContainerProps } from "../ChartContainer/useChartContainerProps.js";
|
|
20
20
|
import { ChartDataProvider } from "../ChartDataProvider/index.js";
|
|
21
21
|
import { ChartsSurface } from "../ChartsSurface/index.js";
|
|
22
|
-
import { ChartsWrapper } from "../
|
|
22
|
+
import { ChartsWrapper } from "../ChartsWrapper/index.js";
|
|
23
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
24
|
/**
|
|
25
25
|
* Demos:
|
|
@@ -394,6 +394,53 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
394
394
|
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
395
395
|
tickSize: PropTypes.number,
|
|
396
396
|
valueFormatter: PropTypes.func
|
|
397
|
+
}), PropTypes.shape({
|
|
398
|
+
axis: PropTypes.oneOf(['x']),
|
|
399
|
+
classes: PropTypes.object,
|
|
400
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
401
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
402
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
403
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
404
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
405
|
+
}), PropTypes.shape({
|
|
406
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
407
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
408
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
409
|
+
})]),
|
|
410
|
+
constant: PropTypes.number,
|
|
411
|
+
data: PropTypes.array,
|
|
412
|
+
dataKey: PropTypes.string,
|
|
413
|
+
disableLine: PropTypes.bool,
|
|
414
|
+
disableTicks: PropTypes.bool,
|
|
415
|
+
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
416
|
+
fill: PropTypes.string,
|
|
417
|
+
height: PropTypes.number,
|
|
418
|
+
hideTooltip: PropTypes.bool,
|
|
419
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
420
|
+
ignoreTooltip: PropTypes.bool,
|
|
421
|
+
label: PropTypes.string,
|
|
422
|
+
labelStyle: PropTypes.object,
|
|
423
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
424
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
425
|
+
offset: PropTypes.number,
|
|
426
|
+
position: PropTypes.oneOf(['bottom', 'none', 'top']),
|
|
427
|
+
reverse: PropTypes.bool,
|
|
428
|
+
scaleType: PropTypes.oneOf(['symlog']),
|
|
429
|
+
slotProps: PropTypes.object,
|
|
430
|
+
slots: PropTypes.object,
|
|
431
|
+
stroke: PropTypes.string,
|
|
432
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
433
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
434
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
435
|
+
tickLabelMinGap: PropTypes.number,
|
|
436
|
+
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
437
|
+
tickLabelStyle: PropTypes.object,
|
|
438
|
+
tickMaxStep: PropTypes.number,
|
|
439
|
+
tickMinStep: PropTypes.number,
|
|
440
|
+
tickNumber: PropTypes.number,
|
|
441
|
+
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
442
|
+
tickSize: PropTypes.number,
|
|
443
|
+
valueFormatter: PropTypes.func
|
|
397
444
|
}), PropTypes.shape({
|
|
398
445
|
axis: PropTypes.oneOf(['x']),
|
|
399
446
|
classes: PropTypes.object,
|
|
@@ -777,6 +824,52 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
777
824
|
tickSize: PropTypes.number,
|
|
778
825
|
valueFormatter: PropTypes.func,
|
|
779
826
|
width: PropTypes.number
|
|
827
|
+
}), PropTypes.shape({
|
|
828
|
+
axis: PropTypes.oneOf(['y']),
|
|
829
|
+
classes: PropTypes.object,
|
|
830
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
831
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
832
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
833
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
834
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
835
|
+
}), PropTypes.shape({
|
|
836
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
837
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
838
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
839
|
+
})]),
|
|
840
|
+
constant: PropTypes.number,
|
|
841
|
+
data: PropTypes.array,
|
|
842
|
+
dataKey: PropTypes.string,
|
|
843
|
+
disableLine: PropTypes.bool,
|
|
844
|
+
disableTicks: PropTypes.bool,
|
|
845
|
+
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
846
|
+
fill: PropTypes.string,
|
|
847
|
+
hideTooltip: PropTypes.bool,
|
|
848
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
849
|
+
ignoreTooltip: PropTypes.bool,
|
|
850
|
+
label: PropTypes.string,
|
|
851
|
+
labelStyle: PropTypes.object,
|
|
852
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
853
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
854
|
+
offset: PropTypes.number,
|
|
855
|
+
position: PropTypes.oneOf(['left', 'none', 'right']),
|
|
856
|
+
reverse: PropTypes.bool,
|
|
857
|
+
scaleType: PropTypes.oneOf(['symlog']),
|
|
858
|
+
slotProps: PropTypes.object,
|
|
859
|
+
slots: PropTypes.object,
|
|
860
|
+
stroke: PropTypes.string,
|
|
861
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
862
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
863
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
864
|
+
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
865
|
+
tickLabelStyle: PropTypes.object,
|
|
866
|
+
tickMaxStep: PropTypes.number,
|
|
867
|
+
tickMinStep: PropTypes.number,
|
|
868
|
+
tickNumber: PropTypes.number,
|
|
869
|
+
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
870
|
+
tickSize: PropTypes.number,
|
|
871
|
+
valueFormatter: PropTypes.func,
|
|
872
|
+
width: PropTypes.number
|
|
780
873
|
}), PropTypes.shape({
|
|
781
874
|
axis: PropTypes.oneOf(['y']),
|
|
782
875
|
classes: PropTypes.object,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import { findMinMax } from "../../internals/findMinMax.js";
|
|
1
2
|
export const getExtremumX = params => {
|
|
2
3
|
const {
|
|
3
4
|
axis
|
|
4
5
|
} = params;
|
|
5
|
-
|
|
6
|
-
const maxX = Math.max(...(axis.data ?? []));
|
|
7
|
-
return [minX, maxX];
|
|
6
|
+
return findMinMax(axis.data ?? []);
|
|
8
7
|
};
|
|
9
8
|
function getSeriesExtremums(getValues, data, stackedData, filter) {
|
|
10
9
|
return stackedData.reduce((seriesAcc, stackedValue, index) => {
|
|
@@ -11,7 +11,7 @@ import type { LineChartProps } from "./LineChart.js";
|
|
|
11
11
|
import { LineHighlightPlotProps } from "./LineHighlightPlot.js";
|
|
12
12
|
import { LinePlotProps } from "./LinePlot.js";
|
|
13
13
|
import { MarkPlotProps } from "./MarkPlot.js";
|
|
14
|
-
import type { ChartsWrapperProps } from "../
|
|
14
|
+
import type { ChartsWrapperProps } from "../ChartsWrapper/index.js";
|
|
15
15
|
import { LineChartPluginsSignatures } from "./LineChart.plugins.js";
|
|
16
16
|
/**
|
|
17
17
|
* A helper function that extracts LineChartProps from the input props
|
package/esm/PieChart/PieChart.js
CHANGED
|
@@ -14,7 +14,7 @@ import { ChartsOverlay } from "../ChartsOverlay/index.js";
|
|
|
14
14
|
import { ChartsSurface } from "../ChartsSurface/index.js";
|
|
15
15
|
import { ChartDataProvider } from "../ChartDataProvider/index.js";
|
|
16
16
|
import { useChartContainerProps } from "../ChartContainer/useChartContainerProps.js";
|
|
17
|
-
import { ChartsWrapper } from "../
|
|
17
|
+
import { ChartsWrapper } from "../ChartsWrapper/index.js";
|
|
18
18
|
import { PIE_CHART_PLUGINS } from "./PieChart.plugins.js";
|
|
19
19
|
import { defaultizeMargin } from "../internals/defaultizeMargin.js";
|
|
20
20
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { ChartsLegendSlotProps, ChartsLegendSlots } from "../ChartsLegend/index.js";
|
|
3
3
|
import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from "../ChartsOverlay/ChartsOverlay.js";
|
|
4
4
|
import { ChartsSurfaceProps } from "../ChartsSurface/index.js";
|
|
5
|
-
import { ChartsWrapperProps } from "../
|
|
5
|
+
import { ChartsWrapperProps } from "../ChartsWrapper/index.js";
|
|
6
6
|
import { RadarGridProps } from "./RadarGrid/index.js";
|
|
7
7
|
import { RadarDataProviderProps } from "./RadarDataProvider/RadarDataProvider.js";
|
|
8
8
|
import { RadarSeriesPlotProps } from "./RadarSeriesPlot/index.js";
|
|
@@ -8,7 +8,7 @@ import { ChartsLegend } from "../ChartsLegend/index.js";
|
|
|
8
8
|
import { ChartsOverlay } from "../ChartsOverlay/ChartsOverlay.js";
|
|
9
9
|
import { useRadarChartProps } from "./useRadarChartProps.js";
|
|
10
10
|
import { ChartsSurface } from "../ChartsSurface/index.js";
|
|
11
|
-
import { ChartsWrapper } from "../
|
|
11
|
+
import { ChartsWrapper } from "../ChartsWrapper/index.js";
|
|
12
12
|
import { RadarGrid } from "./RadarGrid/index.js";
|
|
13
13
|
import { RadarDataProvider } from "./RadarDataProvider/RadarDataProvider.js";
|
|
14
14
|
import { RadarSeriesArea, RadarSeriesMarks } from "./RadarSeriesPlot/index.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RadarChartProps } from "./RadarChart.js";
|
|
2
2
|
import { ChartsOverlayProps } from "../ChartsOverlay/index.js";
|
|
3
3
|
import { ChartsLegendSlotExtension } from "../ChartsLegend/index.js";
|
|
4
|
-
import type { ChartsWrapperProps } from "../
|
|
4
|
+
import type { ChartsWrapperProps } from "../ChartsWrapper/index.js";
|
|
5
5
|
import { RadarDataProviderProps } from "./RadarDataProvider/RadarDataProvider.js";
|
|
6
6
|
import { ChartsSurfaceProps } from "../ChartsSurface/index.js";
|
|
7
7
|
import { RadarGridProps } from "./RadarGrid/index.js";
|
|
@@ -15,7 +15,7 @@ import { useScatterChartProps } from "./useScatterChartProps.js";
|
|
|
15
15
|
import { useChartContainerProps } from "../ChartContainer/useChartContainerProps.js";
|
|
16
16
|
import { ChartDataProvider } from "../ChartDataProvider/index.js";
|
|
17
17
|
import { ChartsSurface } from "../ChartsSurface/index.js";
|
|
18
|
-
import { ChartsWrapper } from "../
|
|
18
|
+
import { ChartsWrapper } from "../ChartsWrapper/index.js";
|
|
19
19
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
20
|
/**
|
|
21
21
|
* Demos:
|
|
@@ -363,6 +363,53 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
363
363
|
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
364
364
|
tickSize: PropTypes.number,
|
|
365
365
|
valueFormatter: PropTypes.func
|
|
366
|
+
}), PropTypes.shape({
|
|
367
|
+
axis: PropTypes.oneOf(['x']),
|
|
368
|
+
classes: PropTypes.object,
|
|
369
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
370
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
371
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
372
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
373
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
374
|
+
}), PropTypes.shape({
|
|
375
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
376
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
377
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
378
|
+
})]),
|
|
379
|
+
constant: PropTypes.number,
|
|
380
|
+
data: PropTypes.array,
|
|
381
|
+
dataKey: PropTypes.string,
|
|
382
|
+
disableLine: PropTypes.bool,
|
|
383
|
+
disableTicks: PropTypes.bool,
|
|
384
|
+
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
385
|
+
fill: PropTypes.string,
|
|
386
|
+
height: PropTypes.number,
|
|
387
|
+
hideTooltip: PropTypes.bool,
|
|
388
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
389
|
+
ignoreTooltip: PropTypes.bool,
|
|
390
|
+
label: PropTypes.string,
|
|
391
|
+
labelStyle: PropTypes.object,
|
|
392
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
393
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
394
|
+
offset: PropTypes.number,
|
|
395
|
+
position: PropTypes.oneOf(['bottom', 'none', 'top']),
|
|
396
|
+
reverse: PropTypes.bool,
|
|
397
|
+
scaleType: PropTypes.oneOf(['symlog']),
|
|
398
|
+
slotProps: PropTypes.object,
|
|
399
|
+
slots: PropTypes.object,
|
|
400
|
+
stroke: PropTypes.string,
|
|
401
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
402
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
403
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
404
|
+
tickLabelMinGap: PropTypes.number,
|
|
405
|
+
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
406
|
+
tickLabelStyle: PropTypes.object,
|
|
407
|
+
tickMaxStep: PropTypes.number,
|
|
408
|
+
tickMinStep: PropTypes.number,
|
|
409
|
+
tickNumber: PropTypes.number,
|
|
410
|
+
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
411
|
+
tickSize: PropTypes.number,
|
|
412
|
+
valueFormatter: PropTypes.func
|
|
366
413
|
}), PropTypes.shape({
|
|
367
414
|
axis: PropTypes.oneOf(['x']),
|
|
368
415
|
classes: PropTypes.object,
|
|
@@ -746,6 +793,52 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
746
793
|
tickSize: PropTypes.number,
|
|
747
794
|
valueFormatter: PropTypes.func,
|
|
748
795
|
width: PropTypes.number
|
|
796
|
+
}), PropTypes.shape({
|
|
797
|
+
axis: PropTypes.oneOf(['y']),
|
|
798
|
+
classes: PropTypes.object,
|
|
799
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
800
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
801
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
802
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
803
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
804
|
+
}), PropTypes.shape({
|
|
805
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
806
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
807
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
808
|
+
})]),
|
|
809
|
+
constant: PropTypes.number,
|
|
810
|
+
data: PropTypes.array,
|
|
811
|
+
dataKey: PropTypes.string,
|
|
812
|
+
disableLine: PropTypes.bool,
|
|
813
|
+
disableTicks: PropTypes.bool,
|
|
814
|
+
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
815
|
+
fill: PropTypes.string,
|
|
816
|
+
hideTooltip: PropTypes.bool,
|
|
817
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
818
|
+
ignoreTooltip: PropTypes.bool,
|
|
819
|
+
label: PropTypes.string,
|
|
820
|
+
labelStyle: PropTypes.object,
|
|
821
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
822
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
823
|
+
offset: PropTypes.number,
|
|
824
|
+
position: PropTypes.oneOf(['left', 'none', 'right']),
|
|
825
|
+
reverse: PropTypes.bool,
|
|
826
|
+
scaleType: PropTypes.oneOf(['symlog']),
|
|
827
|
+
slotProps: PropTypes.object,
|
|
828
|
+
slots: PropTypes.object,
|
|
829
|
+
stroke: PropTypes.string,
|
|
830
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
831
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
832
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
833
|
+
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
834
|
+
tickLabelStyle: PropTypes.object,
|
|
835
|
+
tickMaxStep: PropTypes.number,
|
|
836
|
+
tickMinStep: PropTypes.number,
|
|
837
|
+
tickNumber: PropTypes.number,
|
|
838
|
+
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
839
|
+
tickSize: PropTypes.number,
|
|
840
|
+
valueFormatter: PropTypes.func,
|
|
841
|
+
width: PropTypes.number
|
|
749
842
|
}), PropTypes.shape({
|
|
750
843
|
axis: PropTypes.oneOf(['y']),
|
|
751
844
|
classes: PropTypes.object,
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
const mergeMinMax = (acc, val) => {
|
|
2
|
-
return [val[0] === null ? acc[0] : Math.min(acc[0], val[0]), val[1] === null ? acc[1] : Math.max(acc[1], val[1])];
|
|
3
|
-
};
|
|
4
1
|
export const getExtremumX = params => {
|
|
5
2
|
const {
|
|
6
3
|
series,
|
|
@@ -8,24 +5,39 @@ export const getExtremumX = params => {
|
|
|
8
5
|
isDefaultAxis,
|
|
9
6
|
getFilters
|
|
10
7
|
} = params;
|
|
11
|
-
|
|
8
|
+
let min = Infinity;
|
|
9
|
+
let max = -Infinity;
|
|
10
|
+
for (const seriesId in series) {
|
|
11
|
+
if (!Object.hasOwn(series, seriesId)) {
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
12
14
|
const axisId = series[seriesId].xAxisId;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
if (!(axisId === axis.id || axisId === undefined && isDefaultAxis)) {
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
15
18
|
const filter = getFilters?.({
|
|
16
19
|
currentAxisId: axis.id,
|
|
17
20
|
isDefaultAxis,
|
|
18
21
|
seriesXAxisId: series[seriesId].xAxisId,
|
|
19
22
|
seriesYAxisId: series[seriesId].yAxisId
|
|
20
23
|
});
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
const seriesData = series[seriesId].data ?? [];
|
|
25
|
+
for (let i = 0; i < seriesData.length; i += 1) {
|
|
26
|
+
const d = seriesData[i];
|
|
27
|
+
if (filter && !filter(d, i)) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
if (d.x !== null) {
|
|
31
|
+
if (d.x < min) {
|
|
32
|
+
min = d.x;
|
|
33
|
+
}
|
|
34
|
+
if (d.x > max) {
|
|
35
|
+
max = d.x;
|
|
36
|
+
}
|
|
24
37
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}, [Infinity, -Infinity]);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return [min, max];
|
|
29
41
|
};
|
|
30
42
|
export const getExtremumY = params => {
|
|
31
43
|
const {
|
|
@@ -34,22 +46,37 @@ export const getExtremumY = params => {
|
|
|
34
46
|
isDefaultAxis,
|
|
35
47
|
getFilters
|
|
36
48
|
} = params;
|
|
37
|
-
|
|
49
|
+
let min = Infinity;
|
|
50
|
+
let max = -Infinity;
|
|
51
|
+
for (const seriesId in series) {
|
|
52
|
+
if (!Object.hasOwn(series, seriesId)) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
38
55
|
const axisId = series[seriesId].yAxisId;
|
|
39
|
-
|
|
40
|
-
|
|
56
|
+
if (!(axisId === axis.id || axisId === undefined && isDefaultAxis)) {
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
41
59
|
const filter = getFilters?.({
|
|
42
60
|
currentAxisId: axis.id,
|
|
43
61
|
isDefaultAxis,
|
|
44
62
|
seriesXAxisId: series[seriesId].xAxisId,
|
|
45
63
|
seriesYAxisId: series[seriesId].yAxisId
|
|
46
64
|
});
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
65
|
+
const seriesData = series[seriesId].data ?? [];
|
|
66
|
+
for (let i = 0; i < seriesData.length; i += 1) {
|
|
67
|
+
const d = seriesData[i];
|
|
68
|
+
if (filter && !filter(d, i)) {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (d.y !== null) {
|
|
72
|
+
if (d.y < min) {
|
|
73
|
+
min = d.y;
|
|
74
|
+
}
|
|
75
|
+
if (d.y > max) {
|
|
76
|
+
max = d.y;
|
|
77
|
+
}
|
|
50
78
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}, [Infinity, -Infinity]);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return [min, max];
|
|
55
82
|
};
|
|
@@ -7,7 +7,7 @@ import { ChartsOverlayProps } from "../ChartsOverlay/index.js";
|
|
|
7
7
|
import { ChartContainerProps } from "../ChartContainer/index.js";
|
|
8
8
|
import type { ScatterChartProps } from "./ScatterChart.js";
|
|
9
9
|
import type { ScatterPlotProps } from "./ScatterPlot.js";
|
|
10
|
-
import type { ChartsWrapperProps } from "../
|
|
10
|
+
import type { ChartsWrapperProps } from "../ChartsWrapper/index.js";
|
|
11
11
|
import { ScatterChartPluginsSignatures } from "./ScatterChart.plugins.js";
|
|
12
12
|
/**
|
|
13
13
|
* A helper function that extracts ScatterChartProps from the input props
|