Skip to content

Conversation

@jay-k98
Copy link

@jay-k98 jay-k98 commented Sep 22, 2025

As described in #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]

@jay-k98 jay-k98 force-pushed the feature/stacked-pie-chart branch from 378932b to 6a9aec1 Compare September 22, 2025 12:41
@jay-k98 jay-k98 force-pushed the feature/stacked-pie-chart branch 2 times, most recently from d04f72f to 2ecef63 Compare September 30, 2025 08:21
Signed-off-by: Jonas Klock <jonas.klock@exxeta.com>
Signed-off-by: Jonas Klock <jonas.klock@exxeta.com>
Signed-off-by: Jonas Klock <jonas.klock@exxeta.com>
Signed-off-by: Jonas Klock <jonas.klock@exxeta.com>
Signed-off-by: Jonas Klock <jonas.klock@exxeta.com>
@jay-k98 jay-k98 force-pushed the feature/stacked-pie-chart branch from 2ecef63 to b88f01f Compare October 6, 2025 11:43
@codecov
Copy link

codecov bot commented Oct 26, 2025

Codecov Report

❌ Patch coverage is 0% with 479 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.97%. Comparing base (32e75f5) to head (b88f01f).

Files with missing lines Patch % Lines
...t/stacked_pie_chart/stacked_pie_chart_painter.dart 0.00% 262 Missing ⚠️
...hart/stacked_pie_chart/stacked_pie_chart_data.dart 0.00% 111 Missing ⚠️
.../stacked_pie_chart/stacked_pie_chart_renderer.dart 0.00% 74 Missing ⚠️
...src/chart/stacked_pie_chart/stacked_pie_chart.dart 0.00% 20 Missing ⚠️
...rt/stacked_pie_chart/stacked_pie_chart_helper.dart 0.00% 8 Missing ⚠️
lib/src/utils/lerp.dart 0.00% 4 Missing ⚠️
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%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@imaNNeo
Copy link
Owner

imaNNeo commented Oct 26, 2025

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.

@jay-k98
Copy link
Author

jay-k98 commented Oct 26, 2025

Hi, yeah thank you for responding! I wanted to hear your opinion about that. I'll implement analogous to #112 and add tests :)

@imaNNeo
Copy link
Owner

imaNNeo commented Oct 26, 2025

I appreciate it!
Thanks in advance.

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