Feature: Add StackedPieChart
As described in https://github.com/imaNNeo/fl_chart/issues/2003 a "Stacked Pie Chart" was requested. This Pull Request aims to add this feature.
Solution
The Implementation of [StackedPieChart] is very similar to [PieChart]. The biggest difference is drawing a Section with multiple Segments.
The radius of a segment is calculated like this:
SegmentRadius = SectionRadius * SegmentValue / TotalSectionValues
The sweep angles are then calculated like in [PieChart]
Todo's and Improvements
- Add drawing strokes
- Extend the Demo (add icon and more examples)
- Add tests
- Extract duplicate logic from [PieChart] and [StackedPieChart]
Codecov Report
:x: Patch coverage is 0% with 479 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 81.97%. Comparing base (32e75f5) to head (b88f01f).
Additional details and impacted files
@@ Coverage Diff @@
## main #2004 +/- ##
===========================================
- Coverage 92.49% 81.97% -10.53%
===========================================
Files 50 55 +5
Lines 3731 4210 +479
===========================================
Hits 3451 3451
- Misses 280 759 +479
| Flag | Coverage Δ | |
|---|---|---|
| flutter | 81.97% <0.00%> (-10.53%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Hi, thanks for your contribution. I think we can use the current implementation of the PieChart to just add the stacked logic into it. This way, we reuse a lot of code that we already wrote.
Just like what I did for the stacked bar chart here: #112
Please let me know your thoughts on it.
Hi, yeah thank you for responding! I wanted to hear your opinion about that. I'll implement analogous to #112 and add tests :)
I appreciate it! Thanks in advance.
Hi @imaNNeo i was on vacation but now I'm back and implemented the stacked logic for PieChart. I also updated tests and added a new sample for the example app. Looking forward to your feedback :)
Hey 👋, I think I commented at the wrong place the first time, sorry about that.
Thx for the work. I'm looking to do something like this:
Do you think I will be able to do it with your StackedPieChart?