@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
|
@@ -122,7 +122,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
122
122
|
let lines;
|
|
123
123
|
let _renderedColorFillBars;
|
|
124
124
|
const _colorFillBars = _react.useRef([]);
|
|
125
|
-
let _tooltipId = (0, _reactutilities.useId)('LineChartTooltipId_');
|
|
126
125
|
let _rectId = (0, _reactutilities.useId)('containerRectLD');
|
|
127
126
|
let _staticHighlightCircle = (0, _reactutilities.useId)('staticHighlightCircle');
|
|
128
127
|
let _firstRenderOptimization = true;
|
|
@@ -172,7 +171,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
172
171
|
function _getDomainNRangeValues(points, margins, width, chartType, isRTL, xAxisType, barWidth, tickValues) {
|
|
173
172
|
let domainNRangeValue;
|
|
174
173
|
if (xAxisType === _index1.XAxisTypes.NumericAxis) {
|
|
175
|
-
domainNRangeValue = (0, _index1.domainRangeOfNumericForAreaLineScatterCharts)(points, margins, width, isRTL, props.xScaleType, _hasMarkersMode);
|
|
174
|
+
domainNRangeValue = (0, _index1.domainRangeOfNumericForAreaLineScatterCharts)(points, margins, width, isRTL, props.xScaleType, _hasMarkersMode, props.xMinValue, props.xMaxValue);
|
|
176
175
|
} else if (xAxisType === _index1.XAxisTypes.DateAxis) {
|
|
177
176
|
domainNRangeValue = (0, _index1.domainRangeOfDateForAreaLineScatterVerticalBarCharts)(points, margins, width, isRTL, tickValues, chartType, barWidth, _hasMarkersMode);
|
|
178
177
|
} else {
|
|
@@ -432,7 +431,11 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
432
431
|
useSecondaryYScale,
|
|
433
432
|
xScaleType: props.xScaleType,
|
|
434
433
|
yScaleType: props.yScaleType,
|
|
435
|
-
secondaryYScaleType: props.secondaryYScaleType
|
|
434
|
+
secondaryYScaleType: props.secondaryYScaleType,
|
|
435
|
+
xMinValue: props.xMinValue,
|
|
436
|
+
xMaxValue: props.xMaxValue,
|
|
437
|
+
yMinValue: props.yMinValue,
|
|
438
|
+
yMaxValue: props.yMaxValue
|
|
436
439
|
}) : 0;
|
|
437
440
|
if (_points[i].data.length === 1) {
|
|
438
441
|
const { x: x1, y: y1, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[0];
|
|
@@ -465,7 +468,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
465
468
|
stroke: activePoint === circleId ? lineColor : '',
|
|
466
469
|
role: "img",
|
|
467
470
|
"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),
|
|
468
|
-
"data-is-focusable": isLegendSelected,
|
|
469
471
|
ref: (e)=>{
|
|
470
472
|
_refCallback(e, circleId);
|
|
471
473
|
},
|
|
@@ -528,7 +530,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
528
530
|
key: lineId,
|
|
529
531
|
d: line(lineData),
|
|
530
532
|
fill: "transparent",
|
|
531
|
-
"data-is-focusable": true,
|
|
532
533
|
stroke: lineColor,
|
|
533
534
|
strokeWidth: strokeWidth,
|
|
534
535
|
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',
|
|
@@ -548,7 +549,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
548
549
|
key: lineId,
|
|
549
550
|
d: line(lineData),
|
|
550
551
|
fill: "transparent",
|
|
551
|
-
|
|
552
|
+
tabIndex: -1,
|
|
552
553
|
stroke: lineColor,
|
|
553
554
|
strokeWidth: strokeWidth,
|
|
554
555
|
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',
|
|
@@ -565,6 +566,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
565
566
|
cy: 0,
|
|
566
567
|
fill: _reacttheme.tokens.colorNeutralBackground1,
|
|
567
568
|
strokeWidth: DEFAULT_LINE_STROKE_SIZE,
|
|
569
|
+
tabIndex: isLegendSelected ? 0 : undefined,
|
|
568
570
|
stroke: lineColor,
|
|
569
571
|
visibility: 'hidden',
|
|
570
572
|
onMouseMove: (event)=>_onMouseOverLargeDataset(i, verticaLineHeight, event, yScale),
|
|
@@ -588,11 +590,13 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
588
590
|
cx: xPoint,
|
|
589
591
|
cy: yPoint,
|
|
590
592
|
fill: activePoint === _circleId ? _reacttheme.tokens.colorNeutralBackground1 : perPointColor || ((_points_i = _points[i]) === null || _points_i === void 0 ? void 0 : _points_i.color) || lineColor,
|
|
593
|
+
tabIndex: isLegendSelected ? 0 : undefined,
|
|
591
594
|
stroke: perPointColor || lineColor,
|
|
592
595
|
strokeWidth: 1,
|
|
593
596
|
opacity: isLegendSelected ? 1 : 0.1,
|
|
594
|
-
onMouseMove: _onMouseOverLargeDataset
|
|
595
|
-
onMouseOver: _onMouseOverLargeDataset
|
|
597
|
+
onMouseMove: (event)=>_onMouseOverLargeDataset(i, verticaLineHeight, event, yScale),
|
|
598
|
+
onMouseOver: (event)=>_onMouseOverLargeDataset(i, verticaLineHeight, event, yScale),
|
|
599
|
+
onFocus: (event)=>_onFocusLargeDataset(i, verticaLineHeight, event, yScale, k),
|
|
596
600
|
onMouseOut: _handleMouseOut
|
|
597
601
|
}));
|
|
598
602
|
}
|
|
@@ -630,7 +634,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
630
634
|
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
631
635
|
cx: xPoint1,
|
|
632
636
|
cy: yPoint1,
|
|
633
|
-
|
|
637
|
+
tabIndex: isLegendSelected ? 0 : undefined,
|
|
634
638
|
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
635
639
|
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
636
640
|
onMouseOut: _handleMouseOut,
|
|
@@ -653,7 +657,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
653
657
|
id: circleId,
|
|
654
658
|
key: circleId,
|
|
655
659
|
d: path,
|
|
656
|
-
"data-is-focusable": isLegendSelected,
|
|
657
660
|
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
658
661
|
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
659
662
|
onMouseOut: _handleMouseOut,
|
|
@@ -692,7 +695,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
692
695
|
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
693
696
|
cx: xPoint2,
|
|
694
697
|
cy: yPoint2,
|
|
695
|
-
|
|
698
|
+
tabIndex: isLegendSelected ? 0 : undefined,
|
|
696
699
|
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
697
700
|
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
698
701
|
onMouseOut: _handleMouseOut,
|
|
@@ -714,7 +717,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
714
717
|
id: lastCircleId,
|
|
715
718
|
key: lastCircleId,
|
|
716
719
|
d: path,
|
|
717
|
-
"data-is-focusable": isLegendSelected,
|
|
718
720
|
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
719
721
|
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
720
722
|
onMouseOut: _handleMouseOut,
|
|
@@ -849,27 +851,6 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
849
851
|
"aria-label": `${legendVal}, line ${i + 1} of ${_points.length} with ${_points[i].data.length} data points.`
|
|
850
852
|
}, bordersForLine, linesForLine, pointsForLine));
|
|
851
853
|
}
|
|
852
|
-
// Removing un wanted tooltip div from DOM, when prop not provided.
|
|
853
|
-
if (!props.showXAxisLablesTooltip) {
|
|
854
|
-
try {
|
|
855
|
-
document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
|
|
856
|
-
// eslint-disable-next-line no-empty
|
|
857
|
-
} catch (e) {}
|
|
858
|
-
}
|
|
859
|
-
// Used to display tooltip at x axis labels.
|
|
860
|
-
if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {
|
|
861
|
-
const xAxisElement = (0, _d3selection.select)(xElement).call(_xAxisScale);
|
|
862
|
-
try {
|
|
863
|
-
document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
|
|
864
|
-
// eslint-disable-next-line no-empty
|
|
865
|
-
} catch (e) {}
|
|
866
|
-
const tooltipProps = {
|
|
867
|
-
tooltipCls: classes.tooltip,
|
|
868
|
-
id: _tooltipId,
|
|
869
|
-
axis: xAxisElement
|
|
870
|
-
};
|
|
871
|
-
xAxisElement && (0, _index1.tooltipOfAxislabels)(tooltipProps);
|
|
872
|
-
}
|
|
873
854
|
return lines;
|
|
874
855
|
}
|
|
875
856
|
function _createColorFillBars(containerHeight) {
|
|
@@ -942,6 +923,50 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
942
923
|
refElement: element
|
|
943
924
|
});
|
|
944
925
|
}
|
|
926
|
+
// Helper function to update highlight circle, vertical line, and callout for large datasets
|
|
927
|
+
const _updateLargeDatasetHighlightAndCallout = (linenumber, lineHeight, pointToHighlight, xAxisCalloutData, formattedDate, yScale)=>{
|
|
928
|
+
// Check if this point is plottable. If not, close the popover and return.
|
|
929
|
+
const xPoint = _xAxisScale(pointToHighlight.x);
|
|
930
|
+
const yPoint = yScale(pointToHighlight.y);
|
|
931
|
+
if (!(0, _index1.isPlottable)(xPoint, yPoint)) {
|
|
932
|
+
return;
|
|
933
|
+
}
|
|
934
|
+
const found = (0, _index1.findCalloutPoints)(calloutPointsRef.current, pointToHighlight.x);
|
|
935
|
+
const pointToHighlightUpdated = nearestCircleToHighlight === null || nearestCircleToHighlight !== null && pointToHighlight !== null && (nearestCircleToHighlight.x !== pointToHighlight.x || nearestCircleToHighlight.y !== pointToHighlight.y);
|
|
936
|
+
// if no points need to be called out then don't show vertical line and callout card
|
|
937
|
+
if (found && pointToHighlightUpdated) {
|
|
938
|
+
_uniqueCallOutID = `#${_staticHighlightCircle}_${linenumber}`;
|
|
939
|
+
(0, _d3selection.select)(`#${_staticHighlightCircle}_${linenumber}`).attr('cx', `${xPoint}`).attr('cy', `${yPoint}`).attr('visibility', 'visibility');
|
|
940
|
+
(0, _d3selection.select)(`#${_verticalLine}`).attr('transform', ()=>`translate(${xPoint}, ${yPoint})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - 5 - yPoint}`);
|
|
941
|
+
const targetElement = document.getElementById(`${_staticHighlightCircle}_${linenumber}`);
|
|
942
|
+
const rect = targetElement.getBoundingClientRect();
|
|
943
|
+
setNearestCircleToHighlight(pointToHighlight);
|
|
944
|
+
updatePosition(rect.x, rect.y);
|
|
945
|
+
setStackCalloutProps(found);
|
|
946
|
+
setYValueHover(found.values);
|
|
947
|
+
setDataPointCalloutProps(found);
|
|
948
|
+
xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue(formattedDate);
|
|
949
|
+
setActivePoint('');
|
|
950
|
+
}
|
|
951
|
+
if (!found) {
|
|
952
|
+
setPopoverOpen(false);
|
|
953
|
+
setNearestCircleToHighlight(pointToHighlight);
|
|
954
|
+
setActivePoint('');
|
|
955
|
+
}
|
|
956
|
+
};
|
|
957
|
+
const _onFocusLargeDataset = (linenumber, lineHeight, focusEvent, yScale, pointIndex)=>{
|
|
958
|
+
focusEvent.persist();
|
|
959
|
+
const { data } = props;
|
|
960
|
+
const { lineChartData } = data;
|
|
961
|
+
// For focus events, we use the provided point index directly
|
|
962
|
+
const pointToHighlight = lineChartData[linenumber].data[pointIndex];
|
|
963
|
+
if (!pointToHighlight) {
|
|
964
|
+
return;
|
|
965
|
+
}
|
|
966
|
+
const { xAxisCalloutData } = pointToHighlight;
|
|
967
|
+
const formattedDate = pointToHighlight.x instanceof Date ? (0, _chartutilities.formatDateToLocaleString)(pointToHighlight.x, props.culture, props.useUTC) : pointToHighlight.x;
|
|
968
|
+
_updateLargeDatasetHighlightAndCallout(linenumber, lineHeight, pointToHighlight, xAxisCalloutData, formattedDate, yScale);
|
|
969
|
+
};
|
|
945
970
|
const _onMouseOverLargeDataset = (linenumber, lineHeight, mouseEvent, yScale)=>{
|
|
946
971
|
mouseEvent.persist();
|
|
947
972
|
const { data } = props;
|
|
@@ -986,35 +1011,8 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
986
1011
|
}
|
|
987
1012
|
const { xAxisCalloutData } = lineChartData[linenumber].data[index];
|
|
988
1013
|
const formattedDate = xPointToHighlight instanceof Date ? (0, _chartutilities.formatDateToLocaleString)(xPointToHighlight, props.culture, props.useUTC) : xPointToHighlight;
|
|
989
|
-
const found = (0, _index1.findCalloutPoints)(calloutPointsRef.current, xPointToHighlight);
|
|
990
1014
|
const pointToHighlight = lineChartData[linenumber].data[index];
|
|
991
|
-
|
|
992
|
-
const xPoint = _xAxisScale(pointToHighlight.x);
|
|
993
|
-
const yPoint = yScale(pointToHighlight.y);
|
|
994
|
-
if (!(0, _index1.isPlottable)(xPoint, yPoint)) {
|
|
995
|
-
return;
|
|
996
|
-
}
|
|
997
|
-
const pointToHighlightUpdated = nearestCircleToHighlight === null || nearestCircleToHighlight !== null && pointToHighlight !== null && (nearestCircleToHighlight.x !== pointToHighlight.x || nearestCircleToHighlight.y !== pointToHighlight.y);
|
|
998
|
-
// if no points need to be called out then don't show vertical line and callout card
|
|
999
|
-
if (found && pointToHighlightUpdated) {
|
|
1000
|
-
_uniqueCallOutID = `#${_staticHighlightCircle}_${linenumber}`;
|
|
1001
|
-
(0, _d3selection.select)(`#${_staticHighlightCircle}_${linenumber}`).attr('cx', `${xPoint}`).attr('cy', `${yPoint}`).attr('visibility', 'visibility');
|
|
1002
|
-
(0, _d3selection.select)(`#${_verticalLine}`).attr('transform', ()=>`translate(${xPoint}, ${yPoint})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - 5 - yPoint}`);
|
|
1003
|
-
const targetElement = document.getElementById(`${_staticHighlightCircle}_${linenumber}`);
|
|
1004
|
-
const rect = targetElement.getBoundingClientRect();
|
|
1005
|
-
setNearestCircleToHighlight(pointToHighlight);
|
|
1006
|
-
updatePosition(rect.x, rect.y);
|
|
1007
|
-
setStackCalloutProps(found);
|
|
1008
|
-
setYValueHover(found.values);
|
|
1009
|
-
setDataPointCalloutProps(found);
|
|
1010
|
-
xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue(formattedDate);
|
|
1011
|
-
setActivePoint('');
|
|
1012
|
-
}
|
|
1013
|
-
if (!found) {
|
|
1014
|
-
setPopoverOpen(false);
|
|
1015
|
-
setNearestCircleToHighlight(pointToHighlight);
|
|
1016
|
-
setActivePoint('');
|
|
1017
|
-
}
|
|
1015
|
+
_updateLargeDatasetHighlightAndCallout(linenumber, lineHeight, pointToHighlight, xAxisCalloutData, formattedDate, yScale);
|
|
1018
1016
|
};
|
|
1019
1017
|
function _handleFocus(event, lineId, x, xAxisCalloutData, circleId, targetElement, xAxisCalloutAccessibilityData) {
|
|
1020
1018
|
_uniqueCallOutID = circleId;
|
|
@@ -1191,6 +1189,10 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
1191
1189
|
const yValue = point.yAxisCalloutData || point.y;
|
|
1192
1190
|
return ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || `${xValue}. ${legend}, ${yValue}.`;
|
|
1193
1191
|
}
|
|
1192
|
+
function _getChartTitle() {
|
|
1193
|
+
const { chartTitle, lineChartData } = props.data;
|
|
1194
|
+
return (chartTitle ? `${chartTitle}. ` : '') + `Line chart with ${(lineChartData === null || lineChartData === void 0 ? void 0 : lineChartData.length) || 0} lines. `;
|
|
1195
|
+
}
|
|
1194
1196
|
function _isChartEmpty() {
|
|
1195
1197
|
return !(props.data && props.data.lineChartData && props.data.lineChartData.length > 0 && props.data.lineChartData.filter((item)=>item.data.length).length > 0);
|
|
1196
1198
|
}
|
|
@@ -1217,7 +1219,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
1217
1219
|
color: lineColor,
|
|
1218
1220
|
XValue: hoverXValue,
|
|
1219
1221
|
descriptionMessage: props.getCalloutDescriptionMessage && stackCalloutProps ? props.getCalloutDescriptionMessage(stackCalloutProps) : undefined,
|
|
1220
|
-
|
|
1222
|
+
tabIndex: 0,
|
|
1221
1223
|
xAxisCalloutAccessibilityData: xAxisCalloutAccessibilityData,
|
|
1222
1224
|
...props.calloutProps,
|
|
1223
1225
|
isPopoverOpen: isPopoverOpen,
|
|
@@ -1239,7 +1241,7 @@ const LineChart = /*#__PURE__*/ _react.forwardRef(({ isCalloutForStack = true, .
|
|
|
1239
1241
|
};
|
|
1240
1242
|
return !_isChartEmpty() ? /*#__PURE__*/ _react.createElement(_index2.CartesianChart, {
|
|
1241
1243
|
...props,
|
|
1242
|
-
chartTitle:
|
|
1244
|
+
chartTitle: _getChartTitle(),
|
|
1243
1245
|
points: points,
|
|
1244
1246
|
chartType: _index1.ChartTypes.LineChart,
|
|
1245
1247
|
calloutProps: calloutProps,
|