@fluentui/react-charts 0.0.0-nightly-20251210-0407.1 → 0.0.0-nightly-20251211-0406.1
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 +13 -13
- package/dist/index.d.ts +25 -5
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +87 -49
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +81 -155
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +54 -38
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/types/ChartAnnotation.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +87 -49
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +81 -155
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +54 -38
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/types/ChartAnnotation.js.map +1 -1
- package/package.json +13 -13
|
@@ -464,7 +464,6 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
464
464
|
stroke: activePoint === circleId ? lineColor : '',
|
|
465
465
|
role: "img",
|
|
466
466
|
"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),
|
|
467
|
-
"data-is-focusable": isLegendSelected,
|
|
468
467
|
ref: (e)=>{
|
|
469
468
|
_refCallback(e, circleId);
|
|
470
469
|
},
|
|
@@ -527,7 +526,6 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
527
526
|
key: lineId,
|
|
528
527
|
d: line(lineData),
|
|
529
528
|
fill: "transparent",
|
|
530
|
-
"data-is-focusable": true,
|
|
531
529
|
stroke: lineColor,
|
|
532
530
|
strokeWidth: strokeWidth,
|
|
533
531
|
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',
|
|
@@ -547,7 +545,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
547
545
|
key: lineId,
|
|
548
546
|
d: line(lineData),
|
|
549
547
|
fill: "transparent",
|
|
550
|
-
|
|
548
|
+
tabIndex: -1,
|
|
551
549
|
stroke: lineColor,
|
|
552
550
|
strokeWidth: strokeWidth,
|
|
553
551
|
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',
|
|
@@ -564,6 +562,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
564
562
|
cy: 0,
|
|
565
563
|
fill: tokens.colorNeutralBackground1,
|
|
566
564
|
strokeWidth: DEFAULT_LINE_STROKE_SIZE,
|
|
565
|
+
tabIndex: isLegendSelected ? 0 : undefined,
|
|
567
566
|
stroke: lineColor,
|
|
568
567
|
visibility: 'hidden',
|
|
569
568
|
onMouseMove: (event)=>_onMouseOverLargeDataset(i, verticaLineHeight, event, yScale),
|
|
@@ -587,11 +586,13 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
587
586
|
cx: xPoint,
|
|
588
587
|
cy: yPoint,
|
|
589
588
|
fill: activePoint === _circleId ? tokens.colorNeutralBackground1 : perPointColor || ((_points_i = _points[i]) === null || _points_i === void 0 ? void 0 : _points_i.color) || lineColor,
|
|
589
|
+
tabIndex: isLegendSelected ? 0 : undefined,
|
|
590
590
|
stroke: perPointColor || lineColor,
|
|
591
591
|
strokeWidth: 1,
|
|
592
592
|
opacity: isLegendSelected ? 1 : 0.1,
|
|
593
|
-
onMouseMove: _onMouseOverLargeDataset
|
|
594
|
-
onMouseOver: _onMouseOverLargeDataset
|
|
593
|
+
onMouseMove: (event)=>_onMouseOverLargeDataset(i, verticaLineHeight, event, yScale),
|
|
594
|
+
onMouseOver: (event)=>_onMouseOverLargeDataset(i, verticaLineHeight, event, yScale),
|
|
595
|
+
onFocus: (event)=>_onFocusLargeDataset(i, verticaLineHeight, event, yScale, k),
|
|
595
596
|
onMouseOut: _handleMouseOut
|
|
596
597
|
}));
|
|
597
598
|
}
|
|
@@ -629,7 +630,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
629
630
|
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
630
631
|
cx: xPoint1,
|
|
631
632
|
cy: yPoint1,
|
|
632
|
-
|
|
633
|
+
tabIndex: isLegendSelected ? 0 : undefined,
|
|
633
634
|
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
634
635
|
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
635
636
|
onMouseOut: _handleMouseOut,
|
|
@@ -652,7 +653,6 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
652
653
|
id: circleId,
|
|
653
654
|
key: circleId,
|
|
654
655
|
d: path,
|
|
655
|
-
"data-is-focusable": isLegendSelected,
|
|
656
656
|
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
657
657
|
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
658
658
|
onMouseOut: _handleMouseOut,
|
|
@@ -691,7 +691,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
691
691
|
r: currentMarkerSize ? currentMarkerSize * extraMaxPixels / maxMarkerSize : 4,
|
|
692
692
|
cx: xPoint2,
|
|
693
693
|
cy: yPoint2,
|
|
694
|
-
|
|
694
|
+
tabIndex: isLegendSelected ? 0 : undefined,
|
|
695
695
|
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
696
696
|
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
697
697
|
onMouseOut: _handleMouseOut,
|
|
@@ -713,7 +713,6 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
713
713
|
id: lastCircleId,
|
|
714
714
|
key: lastCircleId,
|
|
715
715
|
d: path,
|
|
716
|
-
"data-is-focusable": isLegendSelected,
|
|
717
716
|
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
718
717
|
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale, legendVal, lineColor, targetElement),
|
|
719
718
|
onMouseOut: _handleMouseOut,
|
|
@@ -941,6 +940,50 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
941
940
|
refElement: element
|
|
942
941
|
});
|
|
943
942
|
}
|
|
943
|
+
// Helper function to update highlight circle, vertical line, and callout for large datasets
|
|
944
|
+
const _updateLargeDatasetHighlightAndCallout = (linenumber, lineHeight, pointToHighlight, xAxisCalloutData, formattedDate, yScale)=>{
|
|
945
|
+
// Check if this point is plottable. If not, close the popover and return.
|
|
946
|
+
const xPoint = _xAxisScale(pointToHighlight.x);
|
|
947
|
+
const yPoint = yScale(pointToHighlight.y);
|
|
948
|
+
if (!isPlottable(xPoint, yPoint)) {
|
|
949
|
+
return;
|
|
950
|
+
}
|
|
951
|
+
const found = findCalloutPoints(calloutPointsRef.current, pointToHighlight.x);
|
|
952
|
+
const pointToHighlightUpdated = nearestCircleToHighlight === null || nearestCircleToHighlight !== null && pointToHighlight !== null && (nearestCircleToHighlight.x !== pointToHighlight.x || nearestCircleToHighlight.y !== pointToHighlight.y);
|
|
953
|
+
// if no points need to be called out then don't show vertical line and callout card
|
|
954
|
+
if (found && pointToHighlightUpdated) {
|
|
955
|
+
_uniqueCallOutID = `#${_staticHighlightCircle}_${linenumber}`;
|
|
956
|
+
d3Select(`#${_staticHighlightCircle}_${linenumber}`).attr('cx', `${xPoint}`).attr('cy', `${yPoint}`).attr('visibility', 'visibility');
|
|
957
|
+
d3Select(`#${_verticalLine}`).attr('transform', ()=>`translate(${xPoint}, ${yPoint})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - 5 - yPoint}`);
|
|
958
|
+
const targetElement = document.getElementById(`${_staticHighlightCircle}_${linenumber}`);
|
|
959
|
+
const rect = targetElement.getBoundingClientRect();
|
|
960
|
+
setNearestCircleToHighlight(pointToHighlight);
|
|
961
|
+
updatePosition(rect.x, rect.y);
|
|
962
|
+
setStackCalloutProps(found);
|
|
963
|
+
setYValueHover(found.values);
|
|
964
|
+
setDataPointCalloutProps(found);
|
|
965
|
+
xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue(formattedDate);
|
|
966
|
+
setActivePoint('');
|
|
967
|
+
}
|
|
968
|
+
if (!found) {
|
|
969
|
+
setPopoverOpen(false);
|
|
970
|
+
setNearestCircleToHighlight(pointToHighlight);
|
|
971
|
+
setActivePoint('');
|
|
972
|
+
}
|
|
973
|
+
};
|
|
974
|
+
const _onFocusLargeDataset = (linenumber, lineHeight, focusEvent, yScale, pointIndex)=>{
|
|
975
|
+
focusEvent.persist();
|
|
976
|
+
const { data } = props;
|
|
977
|
+
const { lineChartData } = data;
|
|
978
|
+
// For focus events, we use the provided point index directly
|
|
979
|
+
const pointToHighlight = lineChartData[linenumber].data[pointIndex];
|
|
980
|
+
if (!pointToHighlight) {
|
|
981
|
+
return;
|
|
982
|
+
}
|
|
983
|
+
const { xAxisCalloutData } = pointToHighlight;
|
|
984
|
+
const formattedDate = pointToHighlight.x instanceof Date ? formatDateToLocaleString(pointToHighlight.x, props.culture, props.useUTC) : pointToHighlight.x;
|
|
985
|
+
_updateLargeDatasetHighlightAndCallout(linenumber, lineHeight, pointToHighlight, xAxisCalloutData, formattedDate, yScale);
|
|
986
|
+
};
|
|
944
987
|
const _onMouseOverLargeDataset = (linenumber, lineHeight, mouseEvent, yScale)=>{
|
|
945
988
|
mouseEvent.persist();
|
|
946
989
|
const { data } = props;
|
|
@@ -985,35 +1028,8 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
985
1028
|
}
|
|
986
1029
|
const { xAxisCalloutData } = lineChartData[linenumber].data[index];
|
|
987
1030
|
const formattedDate = xPointToHighlight instanceof Date ? formatDateToLocaleString(xPointToHighlight, props.culture, props.useUTC) : xPointToHighlight;
|
|
988
|
-
const found = findCalloutPoints(calloutPointsRef.current, xPointToHighlight);
|
|
989
1031
|
const pointToHighlight = lineChartData[linenumber].data[index];
|
|
990
|
-
|
|
991
|
-
const xPoint = _xAxisScale(pointToHighlight.x);
|
|
992
|
-
const yPoint = yScale(pointToHighlight.y);
|
|
993
|
-
if (!isPlottable(xPoint, yPoint)) {
|
|
994
|
-
return;
|
|
995
|
-
}
|
|
996
|
-
const pointToHighlightUpdated = nearestCircleToHighlight === null || nearestCircleToHighlight !== null && pointToHighlight !== null && (nearestCircleToHighlight.x !== pointToHighlight.x || nearestCircleToHighlight.y !== pointToHighlight.y);
|
|
997
|
-
// if no points need to be called out then don't show vertical line and callout card
|
|
998
|
-
if (found && pointToHighlightUpdated) {
|
|
999
|
-
_uniqueCallOutID = `#${_staticHighlightCircle}_${linenumber}`;
|
|
1000
|
-
d3Select(`#${_staticHighlightCircle}_${linenumber}`).attr('cx', `${xPoint}`).attr('cy', `${yPoint}`).attr('visibility', 'visibility');
|
|
1001
|
-
d3Select(`#${_verticalLine}`).attr('transform', ()=>`translate(${xPoint}, ${yPoint})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - 5 - yPoint}`);
|
|
1002
|
-
const targetElement = document.getElementById(`${_staticHighlightCircle}_${linenumber}`);
|
|
1003
|
-
const rect = targetElement.getBoundingClientRect();
|
|
1004
|
-
setNearestCircleToHighlight(pointToHighlight);
|
|
1005
|
-
updatePosition(rect.x, rect.y);
|
|
1006
|
-
setStackCalloutProps(found);
|
|
1007
|
-
setYValueHover(found.values);
|
|
1008
|
-
setDataPointCalloutProps(found);
|
|
1009
|
-
xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue(formattedDate);
|
|
1010
|
-
setActivePoint('');
|
|
1011
|
-
}
|
|
1012
|
-
if (!found) {
|
|
1013
|
-
setPopoverOpen(false);
|
|
1014
|
-
setNearestCircleToHighlight(pointToHighlight);
|
|
1015
|
-
setActivePoint('');
|
|
1016
|
-
}
|
|
1032
|
+
_updateLargeDatasetHighlightAndCallout(linenumber, lineHeight, pointToHighlight, xAxisCalloutData, formattedDate, yScale);
|
|
1017
1033
|
};
|
|
1018
1034
|
function _handleFocus(event, lineId, x, xAxisCalloutData, circleId, targetElement, xAxisCalloutAccessibilityData) {
|
|
1019
1035
|
_uniqueCallOutID = circleId;
|
|
@@ -1216,7 +1232,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
1216
1232
|
color: lineColor,
|
|
1217
1233
|
XValue: hoverXValue,
|
|
1218
1234
|
descriptionMessage: props.getCalloutDescriptionMessage && stackCalloutProps ? props.getCalloutDescriptionMessage(stackCalloutProps) : undefined,
|
|
1219
|
-
|
|
1235
|
+
tabIndex: 0,
|
|
1220
1236
|
xAxisCalloutAccessibilityData: xAxisCalloutAccessibilityData,
|
|
1221
1237
|
...props.calloutProps,
|
|
1222
1238
|
isPopoverOpen: isPopoverOpen,
|