imaNNeo / imaNNeo/fl_chart

[Feature Request]: PieChart with exploding sections

Open
#2,091 1 comment 0 reactions 0 assignees View on GitHub
enhancement Pie Chart
Dominant language
Dart
Stars
7.6k
Forks
2k
Avg merge
9d 1h
Merged PRs (30d)
2

Description

# Description

Highlighting a section by "exploding" it (or in other words sliding it outwards from the center) with smooth animations could add to the UX and add a new level of design possibilities for PieCharts.

# Example

Image


Image

# Proposed Solution

```dart
class PieChartSectionData {
// ...
final double sectionOffset;
// ...
}

class PieChartPainter {
// ...
void drawSections(...) {
final section = data.sections[i];
if (section.value == 0) {
continue;
}
final sectionDegree = sectionsAngle[i];

// Compute offset for "exploded" sections
final sectionCenterAngle = tempAngle + (sectionDegree / 2);
final sectionOffset = section.sectionOffset;
final offsetDx =
math.cos(Utils().radians(sectionCenterAngle)) * sectionOffset;
final offsetDy =
math.sin(Utils().radians(sectionCenterAngle)) * sectionOffset;
final sectionCenter = center.translate(offsetDx, offsetDy);
// ...
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start by locating PieChartSectionData and PieChartPainter.drawSections, then read how section angles and centers are currently calculated. Implement the proposed section offset behavior and smooth animations for exploded sections, and verify that PieChart examples or existing chart tests show sections moving outward without disrupting other sections.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
data-visualization, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.