-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added option to added Rounded Capped PieChart #1698
base: main
Are you sure you want to change the base?
Conversation
@@ -31,6 +31,10 @@ class PieChartData extends BaseChartData with EquatableMixin { | |||
PieTouchData? pieTouchData, | |||
FlBorderData? borderData, | |||
bool? titleSunbeamLayout, | |||
CapStyle? capStyle, | |||
bool? shadow, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it better to use the Shadow object?
Something like what we have in the LineChart:
fl_chart/lib/src/chart/line_chart/line_chart_data.dart
Lines 360 to 361 in 11d13a7
/// Drops a shadow behind the bar line. | |
final Shadow shadow; |
And this is how we paint it in the drawBarShadow()
function:
fl_chart/lib/src/chart/line_chart/line_chart_painter.dart
Lines 906 to 939 in 11d13a7
void drawBarShadow( | |
CanvasWrapper canvasWrapper, | |
Path barPath, | |
LineChartBarData barData, | |
) { | |
if (!barData.show || barData.shadow.color.opacity == 0.0) { | |
return; | |
} | |
if (barPath.computeMetrics().isEmpty) { | |
return; | |
} | |
_barPaint | |
..strokeCap = barData.isStrokeCapRound ? StrokeCap.round : StrokeCap.butt | |
..strokeJoin = | |
barData.isStrokeJoinRound ? StrokeJoin.round : StrokeJoin.miter | |
..color = barData.shadow.color | |
..shader = null | |
..strokeWidth = barData.barWidth | |
..color = barData.shadow.color | |
..maskFilter = MaskFilter.blur( | |
BlurStyle.normal, | |
Utils().convertRadiusToSigma(barData.shadow.blurRadius), | |
); | |
barPath = barPath.toDashedPath(barData.dashArray); | |
barPath = barPath.shift(barData.shadow.offset); | |
canvasWrapper.drawPath( | |
barPath, | |
_barPaint, | |
); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And if it is transparent (default value), we will not draw it.
As I see, it also tries to fix #1699. |
enhacement asked in this issue #1700