fl_chart
fl_chart copied to clipboard
[Feature Request]: StackedPieChart (or radial stacked bar chart)
Description
It would be very useful to extend the current PieChart with support for stacked slices. Instead of each slice containing a single value, a slice could contain a list of values (segments). These segments would be rendered as concentric radial bands inside the slice, similar to a stacked bar chart but in polar coordinates.
Example
Proposed Solution
class StackedPieChartData extends BaseChartData {
final List<StackedPieSectionData> sections;
// ... other than that just the same props like in [PieChartData]
}
class StackedPieSectionData {
final double weight;
final double radius;
final List<StackedPieSegmentData> segments;
// ... other than that just the same props like in [PieChartSectionData]
}
class StackedPieSegmentData {
final double value;
final Color color;
final Gradient? gradient;
}
Alternatives
I have considered Alternatives within and outside of fl_chart:
- fl_chart: Put two or more [PieChart] inside a [Stack] -> Problem: Need to sync touch interactions and animations, which is tedious
- Other packages: I tried using graphic, but the API is not convenient and features such as animations when selecting a slice was not possible
Hi @imaNNeo :) I hope you like this feature. I already created a PR: https://github.com/imaNNeo/fl_chart/pull/2004 looking forward to your feedback!