@fluentui/react-charts 9.3.3 → 9.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -7
- package/dist/index.d.ts +4 -0
- package/lib/components/AreaChart/AreaChart.js +188 -36
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.js +14 -12
- package/lib/components/ChartTable/ChartTable.js.map +1 -1
- package/lib/components/ChartTable/useChartTableStyles.styles.js +3 -3
- package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +2 -2
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +5 -6
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +3 -2
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +2 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.js +3 -2
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js +2 -1
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +106 -63
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.js +3 -2
- package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +2 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.js +3 -2
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js +2 -1
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +3 -2
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +2 -1
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +3 -2
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +2 -1
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +3 -2
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +2 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/utilities.js +63 -18
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js +188 -36
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +13 -12
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +3 -3
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +2 -2
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +5 -6
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +7 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js +7 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +106 -63
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +7 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js +7 -1
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +7 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +7 -1
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +7 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +63 -18
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +13 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-charts
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 31 Oct 2025 16:17:34 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.3.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-charts_v9.3.4)
|
|
8
|
+
|
|
9
|
+
Fri, 31 Oct 2025 16:17:34 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-charts_v9.3.3..@fluentui/react-charts_v9.3.4)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- fix chart crash issue ([PR #35399](https://github.com/microsoft/fluentui/pull/35399) by anushgupta@microsoft.com)
|
|
15
|
+
- update react version to react 19 ([PR #35402](https://github.com/microsoft/fluentui/pull/35402) by anushgupta@microsoft.com)
|
|
16
|
+
- fix dark mode styles of chart table ([PR #35377](https://github.com/microsoft/fluentui/pull/35377) by anushgupta@microsoft.com)
|
|
17
|
+
- fix chart exceptions ([PR #35393](https://github.com/microsoft/fluentui/pull/35393) by anushgupta@microsoft.com)
|
|
18
|
+
- feat: map deprecated plotly create_gantt() scatter traces to gantt chart ([PR #35334](https://github.com/microsoft/fluentui/pull/35334) by kumarkshitij@microsoft.com)
|
|
19
|
+
- Bump @fluentui/react-button to v9.6.10 ([PR #35402](https://github.com/microsoft/fluentui/pull/35402) by beachball)
|
|
20
|
+
- Bump @fluentui/react-jsx-runtime to v9.3.1 ([PR #35402](https://github.com/microsoft/fluentui/pull/35402) by beachball)
|
|
21
|
+
- Bump @fluentui/react-overflow to v9.6.3 ([PR #35402](https://github.com/microsoft/fluentui/pull/35402) by beachball)
|
|
22
|
+
- Bump @fluentui/react-popover to v9.12.10 ([PR #35402](https://github.com/microsoft/fluentui/pull/35402) by beachball)
|
|
23
|
+
- Bump @fluentui/react-tabster to v9.26.8 ([PR #35402](https://github.com/microsoft/fluentui/pull/35402) by beachball)
|
|
24
|
+
- Bump @fluentui/react-tooltip to v9.8.9 ([PR #35402](https://github.com/microsoft/fluentui/pull/35402) by beachball)
|
|
25
|
+
- Bump @fluentui/react-utilities to v9.25.2 ([PR #35402](https://github.com/microsoft/fluentui/pull/35402) by beachball)
|
|
26
|
+
|
|
7
27
|
## [9.3.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-charts_v9.3.3)
|
|
8
28
|
|
|
9
|
-
Tue, 21 Oct 2025 14:
|
|
29
|
+
Tue, 21 Oct 2025 14:16:55 GMT
|
|
10
30
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-charts_v9.3.2..@fluentui/react-charts_v9.3.3)
|
|
11
31
|
|
|
12
32
|
### Patches
|
|
@@ -23,11 +43,11 @@ Tue, 21 Oct 2025 14:13:08 GMT
|
|
|
23
43
|
- fix(react-charts): Show markers only when mode has markers for large data ([PR #35311](https://github.com/microsoft/fluentui/pull/35311) by 120183316+srmukher@users.noreply.github.com)
|
|
24
44
|
- fix popover positioning issue ([PR #35289](https://github.com/microsoft/fluentui/pull/35289) by anushgupta@microsoft.com)
|
|
25
45
|
- fix chart exception issue ([PR #35342](https://github.com/microsoft/fluentui/pull/35342) by anushgupta@microsoft.com)
|
|
26
|
-
- Bump @fluentui/react-button to v9.6.9 ([PR #
|
|
27
|
-
- Bump @fluentui/react-jsx-runtime to v9.3.0 ([PR #
|
|
28
|
-
- Bump @fluentui/react-overflow to v9.6.2 ([PR #
|
|
29
|
-
- Bump @fluentui/react-popover to v9.12.9 ([PR #
|
|
30
|
-
- Bump @fluentui/react-tooltip to v9.8.8 ([PR #
|
|
46
|
+
- Bump @fluentui/react-button to v9.6.9 ([PR #35343](https://github.com/microsoft/fluentui/pull/35343) by beachball)
|
|
47
|
+
- Bump @fluentui/react-jsx-runtime to v9.3.0 ([PR #35343](https://github.com/microsoft/fluentui/pull/35343) by beachball)
|
|
48
|
+
- Bump @fluentui/react-overflow to v9.6.2 ([PR #35343](https://github.com/microsoft/fluentui/pull/35343) by beachball)
|
|
49
|
+
- Bump @fluentui/react-popover to v9.12.9 ([PR #35343](https://github.com/microsoft/fluentui/pull/35343) by beachball)
|
|
50
|
+
- Bump @fluentui/react-tooltip to v9.8.8 ([PR #35343](https://github.com/microsoft/fluentui/pull/35343) by beachball)
|
|
31
51
|
|
|
32
52
|
## [9.3.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-charts_v9.3.2)
|
|
33
53
|
|
package/dist/index.d.ts
CHANGED
|
@@ -162,6 +162,10 @@ export declare type AxisProps = {
|
|
|
162
162
|
* - Exception: when `tickStep` uses `"L<f>"`, you can specify the raw value directly.
|
|
163
163
|
*/
|
|
164
164
|
tick0?: number | Date;
|
|
165
|
+
/**
|
|
166
|
+
* Sets the text displayed at each tick position specified by `tickValues`. Used with `tickValues`.
|
|
167
|
+
*/
|
|
168
|
+
tickText?: string[];
|
|
165
169
|
};
|
|
166
170
|
|
|
167
171
|
/**
|
|
@@ -33,6 +33,8 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
33
33
|
const _firstRenderOptimization = true;
|
|
34
34
|
const _emptyChartId = useId('_AreaChart_empty');
|
|
35
35
|
let _containsSecondaryYAxis = false;
|
|
36
|
+
let _hasMissingXValues = _containsMissingXValues();
|
|
37
|
+
let _hasDuplicateXValues = _xCoordinateContainsMultipleY();
|
|
36
38
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
37
39
|
let _calloutPoints;
|
|
38
40
|
let _createSet;
|
|
@@ -268,7 +270,7 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
268
270
|
};
|
|
269
271
|
}
|
|
270
272
|
function _createDataSet(points) {
|
|
271
|
-
if (props.enablePerfOptimization && _enableComputationOptimization) {
|
|
273
|
+
if (props.enablePerfOptimization && _enableComputationOptimization && !_hasDuplicateXValues) {
|
|
272
274
|
const allChartPoints = [];
|
|
273
275
|
const dataSet = [];
|
|
274
276
|
const colors = [];
|
|
@@ -323,35 +325,50 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
323
325
|
const colors = [];
|
|
324
326
|
const opacity = [];
|
|
325
327
|
const calloutPoints = calloutData(points);
|
|
328
|
+
let data = {};
|
|
329
|
+
const keys = [];
|
|
330
|
+
let index = 0;
|
|
326
331
|
points && points.length && points.forEach((singleChartPoint)=>{
|
|
332
|
+
// if legend is not populated, then assign a legend
|
|
333
|
+
if (_hasDuplicateXValues && !singleChartPoint.legend) {
|
|
334
|
+
singleChartPoint.legend = `chart${index}`;
|
|
335
|
+
++index;
|
|
336
|
+
}
|
|
337
|
+
singleChartPoint.data.forEach((point)=>{
|
|
338
|
+
point.legend = singleChartPoint.legend;
|
|
339
|
+
});
|
|
327
340
|
colors.push(singleChartPoint.color);
|
|
328
341
|
opacity.push(singleChartPoint.opacity || 1);
|
|
329
342
|
allChartPoints.push(...singleChartPoint.data);
|
|
330
343
|
});
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
344
|
+
if (!_hasDuplicateXValues) {
|
|
345
|
+
let tempArr = allChartPoints;
|
|
346
|
+
while(tempArr.length){
|
|
347
|
+
const valToCheck = tempArr[0].x instanceof Date ? tempArr[0].x.toLocaleString() : tempArr[0].x;
|
|
348
|
+
const filteredChartPoints = tempArr.filter((point)=>(point.x instanceof Date ? point.x.toLocaleString() : point.x) === valToCheck);
|
|
349
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
350
|
+
const singleDataset = {};
|
|
351
|
+
filteredChartPoints.forEach((singleDataPoint, id)=>{
|
|
352
|
+
singleDataset.xVal = singleDataPoint.x;
|
|
353
|
+
singleDataset[`chart${id}`] = singleDataPoint.y;
|
|
354
|
+
});
|
|
355
|
+
dataSet.push(singleDataset);
|
|
356
|
+
// removing compared objects from array
|
|
357
|
+
const val = tempArr[0].x instanceof Date ? tempArr[0].x.toLocaleString() : tempArr[0].x;
|
|
358
|
+
tempArr = tempArr.filter((point)=>(point.x instanceof Date ? point.x.toLocaleString() : point.x) !== val);
|
|
359
|
+
}
|
|
360
|
+
// get keys from dataset, used to create stacked data
|
|
361
|
+
const keysLength = dataSet && Object.keys(dataSet[0]).length;
|
|
362
|
+
for(let i = 0; i < keysLength - 1; i++){
|
|
363
|
+
const keyVal = `chart${i}`;
|
|
364
|
+
keys.push(keyVal);
|
|
365
|
+
}
|
|
366
|
+
// Data used to draw graph
|
|
367
|
+
data = _getDataPoints(keys, dataSet);
|
|
368
|
+
} else {
|
|
369
|
+
const datasetForDuplicateValues = _createDatasetForXCoordinateWithMultipleYValues(allChartPoints);
|
|
370
|
+
data = _getDataPoints(datasetForDuplicateValues.keys, datasetForDuplicateValues.filteredDataSet);
|
|
352
371
|
}
|
|
353
|
-
// Data used to draw graph
|
|
354
|
-
const data = _getDataPoints(keys, dataSet);
|
|
355
372
|
return {
|
|
356
373
|
colors,
|
|
357
374
|
opacity,
|
|
@@ -361,6 +378,56 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
361
378
|
};
|
|
362
379
|
}
|
|
363
380
|
}
|
|
381
|
+
function _createDatasetForXCoordinateWithMultipleYValues(allChartPoints) {
|
|
382
|
+
const dataSet = [];
|
|
383
|
+
// Group data points by x-axis value
|
|
384
|
+
const groupedData = {};
|
|
385
|
+
allChartPoints.forEach((dataPoint)=>{
|
|
386
|
+
const xValue = dataPoint.x instanceof Date ? dataPoint.x.toLocaleString() : dataPoint.x;
|
|
387
|
+
if (!groupedData[xValue]) {
|
|
388
|
+
groupedData[xValue] = [];
|
|
389
|
+
}
|
|
390
|
+
groupedData[xValue].push(dataPoint);
|
|
391
|
+
});
|
|
392
|
+
// Aggregate data points for each x-axis value
|
|
393
|
+
Object.keys(groupedData).forEach((xValue)=>{
|
|
394
|
+
const dataPoints = groupedData[xValue];
|
|
395
|
+
dataPoints.forEach((dataPoint, id)=>{
|
|
396
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
397
|
+
const singleDataset = {
|
|
398
|
+
xVal: dataPoints[0].x
|
|
399
|
+
};
|
|
400
|
+
const key = dataPoint.legend ? dataPoint.legend : `chart${id}`;
|
|
401
|
+
singleDataset[key] = dataPoint.y;
|
|
402
|
+
dataSet.push(singleDataset);
|
|
403
|
+
});
|
|
404
|
+
});
|
|
405
|
+
// get all unique keys from each array within the dataSet
|
|
406
|
+
const allLegends = [];
|
|
407
|
+
dataSet.forEach((item)=>{
|
|
408
|
+
Object.keys(item).forEach((key)=>{
|
|
409
|
+
if (key !== 'xVal' && !allLegends.includes(key)) {
|
|
410
|
+
allLegends.push(key);
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
});
|
|
414
|
+
dataSet.forEach((item)=>{
|
|
415
|
+
allLegends.forEach((legend)=>{
|
|
416
|
+
if (!item[legend]) {
|
|
417
|
+
item[legend] = 0; // Fill with 0 if the legend is missing
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
});
|
|
421
|
+
// exclude all items within dataset having all legend values 0
|
|
422
|
+
const filteredDataSet = dataSet.filter((item)=>{
|
|
423
|
+
return allLegends.some((legend)=>item[legend] !== 0);
|
|
424
|
+
});
|
|
425
|
+
const keys = Array.from(new Set(filteredDataSet.flatMap((item)=>Object.keys(item).filter((key)=>key !== 'xVal'))));
|
|
426
|
+
return {
|
|
427
|
+
keys,
|
|
428
|
+
filteredDataSet
|
|
429
|
+
};
|
|
430
|
+
}
|
|
364
431
|
function _getCustomizedCallout() {
|
|
365
432
|
return props.onRenderCalloutPerStack ? props.onRenderCalloutPerStack(stackCalloutProps) : props.onRenderCalloutPerDataPoint ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps) : null;
|
|
366
433
|
}
|
|
@@ -462,9 +529,9 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
462
529
|
let lineColor;
|
|
463
530
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
464
531
|
_data.forEach((singleStackedData, index)=>{
|
|
465
|
-
var _points_index_lineOptions, _points_index_lineOptions1, _points_index_lineOptions2, _points_index_lineOptions3, _points_index_lineOptions4;
|
|
466
|
-
const yScale = points[index].useSecondaryYScale && yScaleSecondary ? yScaleSecondary : yScalePrimary;
|
|
467
|
-
const curveFactory = getCurveFactory((
|
|
532
|
+
var _points_index, _points_index_lineOptions, _points_index1, _points_index_lineOptions1, _points_index2, _points_index_lineOptions2, _points_index3, _points_index_lineOptions3, _points_index4, _points_index_lineOptions4, _points_index5;
|
|
533
|
+
const yScale = ((_points_index = points[index]) === null || _points_index === void 0 ? void 0 : _points_index.useSecondaryYScale) && yScaleSecondary ? yScaleSecondary : yScalePrimary;
|
|
534
|
+
const curveFactory = getCurveFactory((_points_index1 = points[index]) === null || _points_index1 === void 0 ? void 0 : (_points_index_lineOptions = _points_index1.lineOptions) === null || _points_index_lineOptions === void 0 ? void 0 : _points_index_lineOptions.curve, d3CurveBasis);
|
|
468
535
|
const area = d3Area()// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
469
536
|
.x((d)=>xScale(d.xVal))// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
470
537
|
.y0((d)=>yScale(d.values[0]))// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -492,15 +559,15 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
492
559
|
id: `${index}-line-${_uniqueIdForGraph}`,
|
|
493
560
|
d: line(singleStackedData),
|
|
494
561
|
fill: 'transparent',
|
|
495
|
-
strokeWidth: (_points_index_lineOptions_strokeWidth = (
|
|
562
|
+
strokeWidth: (_points_index_lineOptions_strokeWidth = (_points_index2 = points[index]) === null || _points_index2 === void 0 ? void 0 : (_points_index_lineOptions1 = _points_index2.lineOptions) === null || _points_index_lineOptions1 === void 0 ? void 0 : _points_index_lineOptions1.strokeWidth) !== null && _points_index_lineOptions_strokeWidth !== void 0 ? _points_index_lineOptions_strokeWidth : 3,
|
|
496
563
|
stroke: _colors[index],
|
|
497
564
|
opacity: _getLineOpacity(points[index].legend),
|
|
498
565
|
onMouseMove: (event)=>_onRectMouseMove(event),
|
|
499
566
|
onMouseOut: _onRectMouseOut,
|
|
500
567
|
onMouseOver: (event)=>_onRectMouseMove(event),
|
|
501
|
-
strokeDasharray: (
|
|
502
|
-
strokeDashoffset: (
|
|
503
|
-
strokeLinecap: (
|
|
568
|
+
strokeDasharray: (_points_index3 = points[index]) === null || _points_index3 === void 0 ? void 0 : (_points_index_lineOptions2 = _points_index3.lineOptions) === null || _points_index_lineOptions2 === void 0 ? void 0 : _points_index_lineOptions2.strokeDasharray,
|
|
569
|
+
strokeDashoffset: (_points_index4 = points[index]) === null || _points_index4 === void 0 ? void 0 : (_points_index_lineOptions3 = _points_index4.lineOptions) === null || _points_index_lineOptions3 === void 0 ? void 0 : _points_index_lineOptions3.strokeDashoffset,
|
|
570
|
+
strokeLinecap: (_points_index5 = points[index]) === null || _points_index5 === void 0 ? void 0 : (_points_index_lineOptions4 = _points_index5.lineOptions) === null || _points_index_lineOptions4 === void 0 ? void 0 : _points_index_lineOptions4.strokeLinecap
|
|
504
571
|
}), singleStackedData.length === 1 ? /*#__PURE__*/ React.createElement("circle", {
|
|
505
572
|
id: `${index}-graph-${_uniqueIdForGraph}`,
|
|
506
573
|
cx: xScale(singleStackedData[0].xVal),
|
|
@@ -534,10 +601,11 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
534
601
|
const circleRadius = pointOptions && pointOptions.r ? Number(pointOptions.r) : 8;
|
|
535
602
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
536
603
|
_data.forEach((singleStackedData, index)=>{
|
|
604
|
+
var _points_index;
|
|
537
605
|
if (points.length === index) {
|
|
538
606
|
return;
|
|
539
607
|
}
|
|
540
|
-
const yScale = points[index].useSecondaryYScale && yScaleSecondary ? yScaleSecondary : yScalePrimary;
|
|
608
|
+
const yScale = ((_points_index = points[index]) === null || _points_index === void 0 ? void 0 : _points_index.useSecondaryYScale) && yScaleSecondary ? yScaleSecondary : yScalePrimary;
|
|
541
609
|
if (!props.optimizeLargeData || singleStackedData.length === 1) {
|
|
542
610
|
// Render circles for all data points
|
|
543
611
|
graph.push(/*#__PURE__*/ React.createElement("g", {
|
|
@@ -561,13 +629,13 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
561
629
|
fill: _updateCircleFillColor(xDataPoint, lineColor, circleId),
|
|
562
630
|
onMouseOut: _onRectMouseOut,
|
|
563
631
|
onMouseOver: (event)=>_onRectMouseMove(event),
|
|
564
|
-
|
|
632
|
+
..._getOnClickHandler(points, index, pointIndex),
|
|
565
633
|
onFocus: (event)=>_handleFocus(event, index, pointIndex, circleId),
|
|
566
634
|
onBlur: _handleBlur,
|
|
567
635
|
...getSecureProps(pointOptions),
|
|
568
636
|
r: _getCircleRadius(xDataPoint, circleRadius, circleId, legend),
|
|
569
637
|
role: "img",
|
|
570
|
-
"aria-label": _getAriaLabel(index, pointIndex)
|
|
638
|
+
"aria-label": !_hasDuplicateXValues && !_hasMissingXValues && _getAriaLabel(index, pointIndex) || undefined
|
|
571
639
|
});
|
|
572
640
|
})));
|
|
573
641
|
} else {
|
|
@@ -589,7 +657,7 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
589
657
|
onMouseOut: _onRectMouseOut,
|
|
590
658
|
onMouseOver: (event)=>_onRectMouseMove(event),
|
|
591
659
|
onFocus: (event)=>_handleFocus(event, index, pointIndex, circleId),
|
|
592
|
-
|
|
660
|
+
..._getOnClickHandler(points, index, pointIndex),
|
|
593
661
|
...getSecureProps(pointOptions),
|
|
594
662
|
r: _getCircleRadius(xDataPoint, circleRadius, circleId, legend)
|
|
595
663
|
}));
|
|
@@ -636,6 +704,14 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
636
704
|
}
|
|
637
705
|
return graph;
|
|
638
706
|
}
|
|
707
|
+
function _getOnClickHandler(points, index, pointIndex) {
|
|
708
|
+
if (!_hasDuplicateXValues && !_hasMissingXValues) {
|
|
709
|
+
return {
|
|
710
|
+
onClick: ()=>_onDataPointClick(points[index].data[pointIndex].onDataPointClick)
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
return {};
|
|
714
|
+
}
|
|
639
715
|
function _getCircleRadius(xDataPoint, circleRadius, circleId, legend) {
|
|
640
716
|
// Show the circle if no legends are selected or if the point's legend is in the selected legends
|
|
641
717
|
if (!_noLegendHighlighted() && !_legendHighlighted(legend)) {
|
|
@@ -668,6 +744,36 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
668
744
|
] : [];
|
|
669
745
|
}
|
|
670
746
|
function _addDefaultColors(lineChartData) {
|
|
747
|
+
if (_hasMissingXValues) {
|
|
748
|
+
// get union of all x values
|
|
749
|
+
const allXValues = new Set();
|
|
750
|
+
lineChartData && lineChartData.forEach((line)=>{
|
|
751
|
+
line.data.forEach((point)=>{
|
|
752
|
+
const xValue = point.x instanceof Date ? point.x.toLocaleString() : point.x;
|
|
753
|
+
allXValues.add(xValue);
|
|
754
|
+
});
|
|
755
|
+
});
|
|
756
|
+
lineChartData && lineChartData.forEach((line)=>{
|
|
757
|
+
allXValues.forEach((xValue)=>{
|
|
758
|
+
const point = line.data.find((item)=>{
|
|
759
|
+
return item.x instanceof Date ? item.x.toLocaleString() === xValue : item.x === xValue;
|
|
760
|
+
});
|
|
761
|
+
if (!point) {
|
|
762
|
+
line.data.push({
|
|
763
|
+
x: typeof xValue === 'string' ? new Date(xValue) : xValue,
|
|
764
|
+
y: 0,
|
|
765
|
+
legend: line.legend
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
});
|
|
769
|
+
// sort the data points by x value
|
|
770
|
+
line.data.sort((a, b)=>{
|
|
771
|
+
const xA = a.x instanceof Date ? a.x.getTime() : a.x;
|
|
772
|
+
const xB = b.x instanceof Date ? b.x.getTime() : b.x;
|
|
773
|
+
return xA < xB ? -1 : xA > xB ? 1 : 0;
|
|
774
|
+
});
|
|
775
|
+
});
|
|
776
|
+
}
|
|
671
777
|
return lineChartData ? lineChartData.map((item, index)=>{
|
|
672
778
|
let color;
|
|
673
779
|
// isInverted property is applicable to v8 themes only
|
|
@@ -740,6 +846,52 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
740
846
|
const { chartTitle, lineChartData } = props.data;
|
|
741
847
|
return (chartTitle ? `${chartTitle}. ` : '') + `Area chart with ${(lineChartData === null || lineChartData === void 0 ? void 0 : lineChartData.length) || 0} data series. `;
|
|
742
848
|
}
|
|
849
|
+
function _xCoordinateContainsMultipleY() {
|
|
850
|
+
const { lineChartData } = props.data;
|
|
851
|
+
if (!lineChartData) {
|
|
852
|
+
return false;
|
|
853
|
+
}
|
|
854
|
+
for (const item of lineChartData){
|
|
855
|
+
const xValueMap = {};
|
|
856
|
+
for (const point of item.data){
|
|
857
|
+
const xValue = point.x instanceof Date ? point.x.toLocaleString() : point.x;
|
|
858
|
+
if (!xValueMap[xValue]) {
|
|
859
|
+
xValueMap[xValue] = [];
|
|
860
|
+
}
|
|
861
|
+
xValueMap[xValue].push(point.y);
|
|
862
|
+
if (xValueMap[xValue].length > 1) {
|
|
863
|
+
return true;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
return false;
|
|
868
|
+
}
|
|
869
|
+
function _containsMissingXValues() {
|
|
870
|
+
const { lineChartData } = props.data;
|
|
871
|
+
if (!lineChartData) {
|
|
872
|
+
return false;
|
|
873
|
+
}
|
|
874
|
+
const allXValues = new Set();
|
|
875
|
+
lineChartData.forEach((line)=>{
|
|
876
|
+
line.data.forEach((point)=>{
|
|
877
|
+
const xValue = point.x instanceof Date ? point.x.toLocaleString() : point.x;
|
|
878
|
+
allXValues.add(xValue);
|
|
879
|
+
});
|
|
880
|
+
});
|
|
881
|
+
// for all x values, check if the x value is present in all series
|
|
882
|
+
let hasMissingValues = false;
|
|
883
|
+
lineChartData.forEach((line)=>{
|
|
884
|
+
allXValues.forEach((xValue)=>{
|
|
885
|
+
const point = line.data.find((item)=>{
|
|
886
|
+
return item.x instanceof Date ? item.x.toLocaleString() === xValue : item.x === xValue;
|
|
887
|
+
});
|
|
888
|
+
if (!point) {
|
|
889
|
+
hasMissingValues = true;
|
|
890
|
+
}
|
|
891
|
+
});
|
|
892
|
+
});
|
|
893
|
+
return hasMissingValues;
|
|
894
|
+
}
|
|
743
895
|
function _shouldFillToZeroY() {
|
|
744
896
|
return props.mode === 'tozeroy' || _containsSecondaryYAxis;
|
|
745
897
|
}
|
|
@@ -765,7 +917,7 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
|
765
917
|
xAxisCalloutAccessibilityData,
|
|
766
918
|
...props.calloutProps,
|
|
767
919
|
clickPosition,
|
|
768
|
-
isPopoverOpen,
|
|
920
|
+
isPopoverOpen: isPopoverOpen && !_hasDuplicateXValues && !_hasMissingXValues,
|
|
769
921
|
isCartesian: true,
|
|
770
922
|
customCallout: {
|
|
771
923
|
customizedCallout: _getCustomizedCallout() !== null ? _getCustomizedCallout() : undefined,
|