feat: Add stroke support for LineChartBarData#2076
feat: Add stroke support for LineChartBarData#2076patilrahu wants to merge 1 commit intoimaNNeo:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2076 +/- ##
==========================================
- Coverage 93.00% 92.79% -0.22%
==========================================
Files 50 50
Lines 3917 3927 +10
==========================================
+ Hits 3643 3644 +1
- Misses 274 283 +9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
||
| /// Optional border color for the line. | ||
| /// Useful for improving visibility when lines overlap. | ||
| final Color? strokeColor; |
There was a problem hiding this comment.
Can we use the BorderSide class instead of defining strokeColor and strokeWidth here?
Because all other chart types in fl_chart use BorderSide for borders (e.g., BarChartRodData.borderSide, PieChartSectionData.borderSide).
Let's keep the API consistent:
final BorderSide borderSide; // default: BorderSide.none| ..strokeJoin = | ||
| barData.isStrokeJoinRound ? StrokeJoin.round : StrokeJoin.miter; | ||
|
|
||
| canvasWrapper.canvas.drawPath(barPath, borderPaint); |
There was a problem hiding this comment.
This line bypasses the canvas wrapper. All drawing must go through canvasWrapper.drawPath(...)
So please use .drawPath() directly on the canvasWrapper
| ); | ||
| drawBarShadow(canvasWrapper, barPath, barData); | ||
| if (barData.strokeColor != null && barData.strokeWidth > 0) { | ||
| final borderPaint = Paint() |
There was a problem hiding this comment.
There's a performance issue with creating the Paint() object in every frame.
Please create the Paint instance once (in the constructor, just like other Paint() objects) and reuse it here.
|
And there are two things to mention:
Thanks! |
Description
This PR adds optional stroke

support for LineChartBarData.
Changes
strokeColorandstrokeWidthpropertiesThis feature improves line visibility, especially when multiple lines overlap or when used on complex backgrounds.
Closes Outline the graph line #517