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
Proposed Solution
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);
// ...
}
}
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
Proposed Solution