Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Begarudev
Copy link

@Begarudev Begarudev commented Jun 27, 2024

enhacement asked in this issue #1700

@@ -31,6 +31,10 @@ class PieChartData extends BaseChartData with EquatableMixin {
PieTouchData? pieTouchData,
FlBorderData? borderData,
bool? titleSunbeamLayout,
CapStyle? capStyle,
bool? shadow,
Copy link
Owner

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:

/// Drops a shadow behind the bar line.
final Shadow shadow;

And this is how we paint it in the drawBarShadow() function:

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,
);
}

Copy link
Owner

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.

@imaNNeo
Copy link
Owner

imaNNeo commented Jul 20, 2024

As I see, it also tries to fix #1699.
But I think it would be better if you create separate PRs for this specific case to follow it up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants