[Fix]: Markers are too big in LineChart and ScatterChart #35699
[Fix]: Markers are too big in LineChart and ScatterChart #35699singlayush wants to merge 8 commits intomicrosoft:masterfrom
Conversation
📊 Bundle size reportUnchanged fixtures
|
|
Pull request demo site: URL |
packages/charts/react-charts/library/src/components/LineChart/LineChart.tsx
Show resolved
Hide resolved
packages/charts/react-charts/library/src/components/LineChart/LineChart.tsx
Outdated
Show resolved
Hide resolved
…yushsingla/marker-bug
…ushsingla/marker-bug
|
@singlayush please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
| @@ -576,7 +581,9 @@ export const LineChart: React.FunctionComponent<LineChartProps> = React.forwardR | |||
| key={circleId} | |||
| r={ | |||
There was a problem hiding this comment.
The radius calculation can be extracted into a common function.
| <g | ||
| key={`line_${i}`} | ||
| role="region" | ||
| aria-label={`${legendVal}, line ${i + 1} of ${_points.length} with ${_points[i].data.length} data points.`} |
There was a problem hiding this comment.
Removing the role and aria-label attributes will affect screen reader accessibility. In the new structure, these attributes can be set on individual groups of points.

Fix marker sizing in LineChart and ScatterChart
Problem
Markers in LineChart and ScatterChart were rendering too large compared to expected behavior (e.g., Plotly). The previous formula
(markerSize * extraMaxPixels) / maxMarkerSizewould essentially result in scaling markers based on the extraMaxPixels. But we would only want to scale down and not scale up. The scaling down is needed to ensure there is no overflow out of the chart, while scaling up serves no purpose and results in too big markers.Solution
Updated the marker radius calculation to use conditional logic:
Logic:
extraMaxPixels > maxMarkerSize: Use the actualmarkerSizedirectly (enough space available)Test Run: https://github.com/microsoft/fluentui-charting-contrib/actions/runs/21618414015
Examples
Changes
Screenshots
Before
Before
Plotly
Before
Testing