Skip to content

Commit 9be0f1d

Browse files
Anush2303Anush
andauthored
fix(react-charts): add support for dashed line in line chart (microsoft#35183)
Co-authored-by: Anush <[email protected]>
1 parent 261fa27 commit 9be0f1d

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "fix dashed line bug in line chart",
4+
"packageName": "@fluentui/react-charts",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

packages/charts/react-charts/library/src/components/LineChart/LineChart.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -722,8 +722,9 @@ export const LineChart: React.FunctionComponent<LineChartProps> = React.forwardR
722722
stroke={lineColor}
723723
strokeWidth={strokeWidth}
724724
strokeLinecap={_points[i].lineOptions?.strokeLinecap ?? 'round'}
725-
onMouseMove={event => _onMouseOverLargeDataset.bind(i, verticaLineHeight, event, yScale)}
726-
onMouseOver={event => _onMouseOverLargeDataset.bind(i, verticaLineHeight, event, yScale)}
725+
strokeDasharray={_points[i].lineOptions?.strokeDasharray}
726+
onMouseMove={event => _onMouseOverLargeDataset(i, verticaLineHeight, event, yScale)}
727+
onMouseOver={event => _onMouseOverLargeDataset(i, verticaLineHeight, event, yScale)}
727728
onMouseOut={_handleMouseOut}
728729
{..._getClickHandler(_points[i].onLineClick)}
729730
opacity={1}
@@ -741,11 +742,11 @@ export const LineChart: React.FunctionComponent<LineChartProps> = React.forwardR
741742
stroke={lineColor}
742743
strokeWidth={strokeWidth}
743744
strokeLinecap={_points[i].lineOptions?.strokeLinecap ?? 'round'}
745+
strokeDasharray={_points[i].lineOptions?.strokeDasharray}
744746
opacity={0.1}
745747
/>,
746748
);
747749
}
748-
749750
pointsForLine.push(
750751
<circle
751752
id={`${_staticHighlightCircle}_${i}`}
@@ -757,8 +758,8 @@ export const LineChart: React.FunctionComponent<LineChartProps> = React.forwardR
757758
strokeWidth={DEFAULT_LINE_STROKE_SIZE}
758759
stroke={lineColor}
759760
visibility={'hidden'}
760-
onMouseMove={event => _onMouseOverLargeDataset.bind(i, verticaLineHeight, event, yScale)}
761-
onMouseOver={event => _onMouseOverLargeDataset.bind(i, verticaLineHeight, event, yScale)}
761+
onMouseMove={event => _onMouseOverLargeDataset(i, verticaLineHeight, event, yScale)}
762+
onMouseOver={event => _onMouseOverLargeDataset(i, verticaLineHeight, event, yScale)}
762763
onMouseOut={_handleMouseOut}
763764
/>,
764765
);

0 commit comments

Comments
 (0)