@fluentui/react-charts 9.3.7 → 9.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -2
- package/dist/index.d.ts +55 -7
- package/lib/components/AreaChart/AreaChart.js +1 -28
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +1 -2
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.js +6 -1
- package/lib/components/ChartTable/ChartTable.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +107 -67
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +7 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +7 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +50 -32
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +5 -5
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +4 -3
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +261 -187
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +6 -3
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.js +6 -3
- package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib/components/GanttChart/GanttChart.js +1 -1
- package/lib/components/GanttChart/GanttChart.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.js +6 -3
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +17 -17
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +1 -2
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +2 -4
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib/components/Legends/Legends.js +3 -4
- package/lib/components/Legends/Legends.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +66 -64
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.js +1 -2
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.js +1 -1
- package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +1 -2
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +18 -26
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js +1 -2
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +13 -78
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +1 -2
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +21 -32
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +1 -2
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib/types/ChartAnnotation.js.map +1 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/Common.styles.js +0 -1
- package/lib/utilities/Common.styles.js.map +1 -1
- package/lib/utilities/Common.styles.raw.js +0 -1
- package/lib/utilities/Common.styles.raw.js.map +1 -1
- package/lib/utilities/image-export-utils.js +4 -4
- package/lib/utilities/image-export-utils.js.map +1 -1
- package/lib/utilities/utilities.js +220 -78
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js +0 -26
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +0 -2
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +6 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +107 -67
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +7 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +7 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +49 -31
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +3 -4
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +3 -2
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +261 -186
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +5 -2
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.js +5 -2
- package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib-commonjs/components/GanttChart/GanttChart.js +1 -1
- package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.js +5 -2
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +15 -15
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +0 -2
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +2 -4
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.js +3 -4
- package/lib-commonjs/components/Legends/Legends.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +65 -63
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +0 -2
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.js +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +0 -2
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +17 -25
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +0 -2
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +12 -77
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +0 -2
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +20 -31
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +0 -2
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/types/ChartAnnotation.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/Common.styles.js +0 -1
- package/lib-commonjs/utilities/Common.styles.js.map +1 -1
- package/lib-commonjs/utilities/Common.styles.raw.js +0 -1
- package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
- package/lib-commonjs/utilities/image-export-utils.js +3 -3
- package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +232 -81
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +9 -9
- package/lib/components/DeclarativeChart/imageExporter.js +0 -223
- package/lib/components/DeclarativeChart/imageExporter.js.map +0 -1
- package/lib-commonjs/components/DeclarativeChart/imageExporter.js +0 -233
- package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +0 -1
|
@@ -11,7 +11,7 @@ import { find, findCalloutPoints } from '../../utilities/index';
|
|
|
11
11
|
import { CartesianChart } from '../../index';
|
|
12
12
|
import { EventsAnnotation } from './eventAnnotation/EventAnnotation';
|
|
13
13
|
import { tokens } from '@fluentui/react-theme';
|
|
14
|
-
import { calloutData, ChartTypes, getXAxisType, XAxisTypes,
|
|
14
|
+
import { calloutData, ChartTypes, getXAxisType, XAxisTypes, Points, pointTypes, getTypeOfAxis, getNextColor, getColorFromToken, findNumericMinMaxOfY, createNumericYAxis, domainRangeOfDateForAreaLineScatterVerticalBarCharts, domainRangeOfNumericForAreaLineScatterCharts, createStringYAxis, useRtl, getCurveFactory, isScatterPolarSeries, getDomainPaddingForMarkers, isPlottable, getRangeForScatterMarkerSize } from '../../utilities/index';
|
|
15
15
|
import { renderScatterPolarCategoryLabels } from '../../utilities/scatterpolar-utils';
|
|
16
16
|
import { formatDateToLocaleString } from '@fluentui/chart-utilities';
|
|
17
17
|
import { useImageExport } from '../../utilities/hooks';
|
|
@@ -117,7 +117,6 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
117
117
|
let lines;
|
|
118
118
|
let _renderedColorFillBars;
|
|
119
119
|
const _colorFillBars = React.useRef([]);
|
|
120
|
-
let _tooltipId = useId('LineChartTooltipId_');
|
|
121
120
|
let _rectId = useId('containerRectLD');
|
|
122
121
|
let _staticHighlightCircle = useId('staticHighlightCircle');
|
|
123
122
|
let _firstRenderOptimization = true;
|
|
@@ -167,7 +166,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
167
166
|
function _getDomainNRangeValues(points, margins, width, chartType, isRTL, xAxisType, barWidth, tickValues) {
|
|
168
167
|
let domainNRangeValue;
|
|
169
168
|
if (xAxisType === XAxisTypes.NumericAxis) {
|
|
170
|
-
domainNRangeValue = domainRangeOfNumericForAreaLineScatterCharts(points, margins, width, isRTL, props.xScaleType, _hasMarkersMode);
|
|
169
|
+
domainNRangeValue = domainRangeOfNumericForAreaLineScatterCharts(points, margins, width, isRTL, props.xScaleType, _hasMarkersMode, props.xMinValue, props.xMaxValue);
|
|
171
170
|
} else if (xAxisType === XAxisTypes.DateAxis) {
|
|
172
171
|
domainNRangeValue = domainRangeOfDateForAreaLineScatterVerticalBarCharts(points, margins, width, isRTL, tickValues, chartType, barWidth, _hasMarkersMode);
|
|
173
172
|
} else {
|
|
@@ -427,7 +426,11 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
427
426
|
useSecondaryYScale,
|
|
428
427
|
xScaleType: props.xScaleType,
|
|
429
428
|
yScaleType: props.yScaleType,
|
|
430
|
-
secondaryYScaleType: props.secondaryYScaleType
|
|
429
|
+
secondaryYScaleType: props.secondaryYScaleType,
|
|
430
|
+
xMinValue: props.xMinValue,
|
|
431
|
+
xMaxValue: props.xMaxValue,
|
|
432
|
+
yMinValue: props.yMinValue,
|
|
433
|
+
yMaxValue: props.yMaxValue
|
|
431
434
|
}) : 0;
|
|
432
435
|
if (_points[i].data.length === 1) {
|
|
433
436
|
const { x: x1, y: y1, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[0];
|
|
@@ -460,7 +463,6 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
460
463
|
stroke: activePoint === circleId ? lineColor : '',
|
|
461
464
|
role: "img",
|
|
462
465
|
"aria-label": (_points_i_data__text = _points[i].data[0].text) !== null && _points_i_data__text !== void 0 ? _points_i_data__text : _getAriaLabel(i, 0),
|
|
463
|
-
"data-is-focusable": isLegendSelected,
|
|
464
466
|
ref: (e)=>{
|
|
465
467
|
_refCallback(e, circleId);
|
|
466
468
|
},
|
|
@@ -523,7 +525,6 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
523
525
|
key: lineId,
|
|
524
526
|
d: line(lineData),
|
|
525
527
|
fill: "transparent",
|
|
526
|
-
"data-is-focusable": true,
|
|
527
528
|
stroke: lineColor,
|
|
528
529
|
strokeWidth: strokeWidth,
|
|
529
530
|
strokeLinecap: (_points_i_lineOptions_strokeLinecap1 = (_points_i_lineOptions6 = _points[i].lineOptions) === null || _points_i_lineOptions6 === void 0 ? void 0 : _points_i_lineOptions6.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap1 !== void 0 ? _points_i_lineOptions_strokeLinecap1 : 'round',
|
|
@@ -543,7 +544,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
543
544
|
key: lineId,
|
|
544
545
|
d: line(lineData),
|
|
545
546
|
fill: "transparent",
|
|
546
|
-
|
|
547
|
+
tabIndex: -1,
|
|
547
548
|
stroke: lineColor,
|
|
548
549
|
strokeWidth: strokeWidth,
|
|
549
550
|
strokeLinecap: (_points_i_lineOptions_strokeLinecap2 = (_points_i_lineOptions10 = _points[i].lineOptions) === null || _points_i_lineOptions10 === void 0 ? void 0 : _points_i_lineOptions10.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap2 !== void 0 ? _points_i_lineOptions_strokeLinecap2 : 'round',
|
|
@@ -560,6 +561,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
560
561
|
cy: 0,
|
|
561
562
|
fill: tokens.colorNeutralBackground1,
|
|
562
563
|
strokeWidth: DEFAULT_LINE_STROKE_SIZE,
|
|
564
|
+
tabIndex: isLegendSelected ? 0 : undefined,
|
|
563
565
|
stroke: lineColor,
|
|
564
566
|
visibility: 'hidden',
|
|
565
567
|
onMouseMove: (event)=>_onMouseOverLargeDataset(i, verticaLineHeight, event, yScale),
|
|
@@ -583,11 +585,13 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
583
585
|
cx: xPoint,
|
|
584
586
|
cy: yPoint,
|
|
585
587
|
fill: activePoint === _circleId ? tokens.colorNeutralBackground1 : perPointColor || ((_points_i = _points[i]) === null || _points_i === void 0 ? void 0 : _points_i.color) || lineColor,
|
|
588
|
+
tabIndex: isLegendSelected ? 0 : undefined,
|
|
586
589
|
stroke: perPointColor || lineColor,
|
|
587
590
|
strokeWidth: 1,
|
|
588
591
|
opacity: isLegendSelected ? 1 : 0.1,
|
|
589
|
-
onMouseMove: _onMouseOverLargeDataset
|
|
590
|
-
onMouseOver: _onMouseOverLargeDataset
|
|
592
|
+
onMouseMove: (event)=>_onMouseOverLargeDataset(i, verticaLineHeight, event, yScale),
|
|
593
|
+
onMouseOver: (event)=>_onMouseOverLargeDataset(i, verticaLineHeight, event, yScale),
|
|
594
|
+
onFocus: (event)=>_onFocusLargeDataset(i, verticaLineHeight, event, yScale, k),
|
|
591
595
|
onMouseOut: _handleMouseOut
|
|
592
596
|
}));
|
|
593
597
|
}
|
|
@@ -625,7 +629,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
625
629
|
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
626
630
|
cx: xPoint1,
|
|
627
631
|
cy: yPoint1,
|
|
628
|
-
|
|
632
|
+
tabIndex: isLegendSelected ? 0 : undefined,
|
|
629
633
|
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
630
634
|
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
631
635
|
onMouseOut: _handleMouseOut,
|
|
@@ -648,7 +652,6 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
648
652
|
id: circleId,
|
|
649
653
|
key: circleId,
|
|
650
654
|
d: path,
|
|
651
|
-
"data-is-focusable": isLegendSelected,
|
|
652
655
|
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
653
656
|
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
654
657
|
onMouseOut: _handleMouseOut,
|
|
@@ -687,7 +690,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
687
690
|
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
688
691
|
cx: xPoint2,
|
|
689
692
|
cy: yPoint2,
|
|
690
|
-
|
|
693
|
+
tabIndex: isLegendSelected ? 0 : undefined,
|
|
691
694
|
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
692
695
|
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
693
696
|
onMouseOut: _handleMouseOut,
|
|
@@ -709,7 +712,6 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
709
712
|
id: lastCircleId,
|
|
710
713
|
key: lastCircleId,
|
|
711
714
|
d: path,
|
|
712
|
-
"data-is-focusable": isLegendSelected,
|
|
713
715
|
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
714
716
|
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
715
717
|
onMouseOut: _handleMouseOut,
|
|
@@ -844,27 +846,6 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
844
846
|
"aria-label": `${legendVal}, line ${i + 1} of ${_points.length} with ${_points[i].data.length} data points.`
|
|
845
847
|
}, bordersForLine, linesForLine, pointsForLine));
|
|
846
848
|
}
|
|
847
|
-
// Removing un wanted tooltip div from DOM, when prop not provided.
|
|
848
|
-
if (!props.showXAxisLablesTooltip) {
|
|
849
|
-
try {
|
|
850
|
-
document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
|
|
851
|
-
// eslint-disable-next-line no-empty
|
|
852
|
-
} catch (e) {}
|
|
853
|
-
}
|
|
854
|
-
// Used to display tooltip at x axis labels.
|
|
855
|
-
if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {
|
|
856
|
-
const xAxisElement = d3Select(xElement).call(_xAxisScale);
|
|
857
|
-
try {
|
|
858
|
-
document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
|
|
859
|
-
// eslint-disable-next-line no-empty
|
|
860
|
-
} catch (e) {}
|
|
861
|
-
const tooltipProps = {
|
|
862
|
-
tooltipCls: classes.tooltip,
|
|
863
|
-
id: _tooltipId,
|
|
864
|
-
axis: xAxisElement
|
|
865
|
-
};
|
|
866
|
-
xAxisElement && tooltipOfAxislabels(tooltipProps);
|
|
867
|
-
}
|
|
868
849
|
return lines;
|
|
869
850
|
}
|
|
870
851
|
function _createColorFillBars(containerHeight) {
|
|
@@ -937,6 +918,50 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
937
918
|
refElement: element
|
|
938
919
|
});
|
|
939
920
|
}
|
|
921
|
+
// Helper function to update highlight circle, vertical line, and callout for large datasets
|
|
922
|
+
const _updateLargeDatasetHighlightAndCallout = (linenumber, lineHeight, pointToHighlight, xAxisCalloutData, formattedDate, yScale)=>{
|
|
923
|
+
// Check if this point is plottable. If not, close the popover and return.
|
|
924
|
+
const xPoint = _xAxisScale(pointToHighlight.x);
|
|
925
|
+
const yPoint = yScale(pointToHighlight.y);
|
|
926
|
+
if (!isPlottable(xPoint, yPoint)) {
|
|
927
|
+
return;
|
|
928
|
+
}
|
|
929
|
+
const found = findCalloutPoints(calloutPointsRef.current, pointToHighlight.x);
|
|
930
|
+
const pointToHighlightUpdated = nearestCircleToHighlight === null || nearestCircleToHighlight !== null && pointToHighlight !== null && (nearestCircleToHighlight.x !== pointToHighlight.x || nearestCircleToHighlight.y !== pointToHighlight.y);
|
|
931
|
+
// if no points need to be called out then don't show vertical line and callout card
|
|
932
|
+
if (found && pointToHighlightUpdated) {
|
|
933
|
+
_uniqueCallOutID = `#${_staticHighlightCircle}_${linenumber}`;
|
|
934
|
+
d3Select(`#${_staticHighlightCircle}_${linenumber}`).attr('cx', `${xPoint}`).attr('cy', `${yPoint}`).attr('visibility', 'visibility');
|
|
935
|
+
d3Select(`#${_verticalLine}`).attr('transform', ()=>`translate(${xPoint}, ${yPoint})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - 5 - yPoint}`);
|
|
936
|
+
const targetElement = document.getElementById(`${_staticHighlightCircle}_${linenumber}`);
|
|
937
|
+
const rect = targetElement.getBoundingClientRect();
|
|
938
|
+
setNearestCircleToHighlight(pointToHighlight);
|
|
939
|
+
updatePosition(rect.x, rect.y);
|
|
940
|
+
setStackCalloutProps(found);
|
|
941
|
+
setYValueHover(found.values);
|
|
942
|
+
setDataPointCalloutProps(found);
|
|
943
|
+
xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue(formattedDate);
|
|
944
|
+
setActivePoint('');
|
|
945
|
+
}
|
|
946
|
+
if (!found) {
|
|
947
|
+
setPopoverOpen(false);
|
|
948
|
+
setNearestCircleToHighlight(pointToHighlight);
|
|
949
|
+
setActivePoint('');
|
|
950
|
+
}
|
|
951
|
+
};
|
|
952
|
+
const _onFocusLargeDataset = (linenumber, lineHeight, focusEvent, yScale, pointIndex)=>{
|
|
953
|
+
focusEvent.persist();
|
|
954
|
+
const { data } = props;
|
|
955
|
+
const { lineChartData } = data;
|
|
956
|
+
// For focus events, we use the provided point index directly
|
|
957
|
+
const pointToHighlight = lineChartData[linenumber].data[pointIndex];
|
|
958
|
+
if (!pointToHighlight) {
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
961
|
+
const { xAxisCalloutData } = pointToHighlight;
|
|
962
|
+
const formattedDate = pointToHighlight.x instanceof Date ? formatDateToLocaleString(pointToHighlight.x, props.culture, props.useUTC) : pointToHighlight.x;
|
|
963
|
+
_updateLargeDatasetHighlightAndCallout(linenumber, lineHeight, pointToHighlight, xAxisCalloutData, formattedDate, yScale);
|
|
964
|
+
};
|
|
940
965
|
const _onMouseOverLargeDataset = (linenumber, lineHeight, mouseEvent, yScale)=>{
|
|
941
966
|
mouseEvent.persist();
|
|
942
967
|
const { data } = props;
|
|
@@ -981,35 +1006,8 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
981
1006
|
}
|
|
982
1007
|
const { xAxisCalloutData } = lineChartData[linenumber].data[index];
|
|
983
1008
|
const formattedDate = xPointToHighlight instanceof Date ? formatDateToLocaleString(xPointToHighlight, props.culture, props.useUTC) : xPointToHighlight;
|
|
984
|
-
const found = findCalloutPoints(calloutPointsRef.current, xPointToHighlight);
|
|
985
1009
|
const pointToHighlight = lineChartData[linenumber].data[index];
|
|
986
|
-
|
|
987
|
-
const xPoint = _xAxisScale(pointToHighlight.x);
|
|
988
|
-
const yPoint = yScale(pointToHighlight.y);
|
|
989
|
-
if (!isPlottable(xPoint, yPoint)) {
|
|
990
|
-
return;
|
|
991
|
-
}
|
|
992
|
-
const pointToHighlightUpdated = nearestCircleToHighlight === null || nearestCircleToHighlight !== null && pointToHighlight !== null && (nearestCircleToHighlight.x !== pointToHighlight.x || nearestCircleToHighlight.y !== pointToHighlight.y);
|
|
993
|
-
// if no points need to be called out then don't show vertical line and callout card
|
|
994
|
-
if (found && pointToHighlightUpdated) {
|
|
995
|
-
_uniqueCallOutID = `#${_staticHighlightCircle}_${linenumber}`;
|
|
996
|
-
d3Select(`#${_staticHighlightCircle}_${linenumber}`).attr('cx', `${xPoint}`).attr('cy', `${yPoint}`).attr('visibility', 'visibility');
|
|
997
|
-
d3Select(`#${_verticalLine}`).attr('transform', ()=>`translate(${xPoint}, ${yPoint})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - 5 - yPoint}`);
|
|
998
|
-
const targetElement = document.getElementById(`${_staticHighlightCircle}_${linenumber}`);
|
|
999
|
-
const rect = targetElement.getBoundingClientRect();
|
|
1000
|
-
setNearestCircleToHighlight(pointToHighlight);
|
|
1001
|
-
updatePosition(rect.x, rect.y);
|
|
1002
|
-
setStackCalloutProps(found);
|
|
1003
|
-
setYValueHover(found.values);
|
|
1004
|
-
setDataPointCalloutProps(found);
|
|
1005
|
-
xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue(formattedDate);
|
|
1006
|
-
setActivePoint('');
|
|
1007
|
-
}
|
|
1008
|
-
if (!found) {
|
|
1009
|
-
setPopoverOpen(false);
|
|
1010
|
-
setNearestCircleToHighlight(pointToHighlight);
|
|
1011
|
-
setActivePoint('');
|
|
1012
|
-
}
|
|
1010
|
+
_updateLargeDatasetHighlightAndCallout(linenumber, lineHeight, pointToHighlight, xAxisCalloutData, formattedDate, yScale);
|
|
1013
1011
|
};
|
|
1014
1012
|
function _handleFocus(event, lineId, x, xAxisCalloutData, circleId, targetElement, xAxisCalloutAccessibilityData) {
|
|
1015
1013
|
_uniqueCallOutID = circleId;
|
|
@@ -1186,6 +1184,10 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
1186
1184
|
const yValue = point.yAxisCalloutData || point.y;
|
|
1187
1185
|
return ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || `${xValue}. ${legend}, ${yValue}.`;
|
|
1188
1186
|
}
|
|
1187
|
+
function _getChartTitle() {
|
|
1188
|
+
const { chartTitle, lineChartData } = props.data;
|
|
1189
|
+
return (chartTitle ? `${chartTitle}. ` : '') + `Line chart with ${(lineChartData === null || lineChartData === void 0 ? void 0 : lineChartData.length) || 0} lines. `;
|
|
1190
|
+
}
|
|
1189
1191
|
function _isChartEmpty() {
|
|
1190
1192
|
return !(props.data && props.data.lineChartData && props.data.lineChartData.length > 0 && props.data.lineChartData.filter((item)=>item.data.length).length > 0);
|
|
1191
1193
|
}
|
|
@@ -1212,7 +1214,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
1212
1214
|
color: lineColor,
|
|
1213
1215
|
XValue: hoverXValue,
|
|
1214
1216
|
descriptionMessage: props.getCalloutDescriptionMessage && stackCalloutProps ? props.getCalloutDescriptionMessage(stackCalloutProps) : undefined,
|
|
1215
|
-
|
|
1217
|
+
tabIndex: 0,
|
|
1216
1218
|
xAxisCalloutAccessibilityData: xAxisCalloutAccessibilityData,
|
|
1217
1219
|
...props.calloutProps,
|
|
1218
1220
|
isPopoverOpen: isPopoverOpen,
|
|
@@ -1234,7 +1236,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
1234
1236
|
};
|
|
1235
1237
|
return !_isChartEmpty() ? /*#__PURE__*/ React.createElement(CartesianChart, {
|
|
1236
1238
|
...props,
|
|
1237
|
-
chartTitle:
|
|
1239
|
+
chartTitle: _getChartTitle(),
|
|
1238
1240
|
points: points,
|
|
1239
1241
|
chartType: ChartTypes.LineChart,
|
|
1240
1242
|
calloutProps: calloutProps,
|