Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PieChart centerSpace disapearing #1617

Open
Priyantha-Kingslake opened this issue Mar 26, 2024 · 5 comments
Open

PieChart centerSpace disapearing #1617

Priyantha-Kingslake opened this issue Mar 26, 2024 · 5 comments

Comments

@Priyantha-Kingslake
Copy link

I have a pieChart with only 2 sections where the section values are calculated dynamically.
I saw that the innerCircle disappears when the first section's value is 0.
I tested with switching the values, i.e. first section has a value and second section value = 0, then the bug is not there, the innerCircle is drawn as normal.
(PieChartSectionData radius and PieChartData centerSpaceRadius is been given explicitly in all instances)

Steps to Reproduce
create a PieChart with 2 PieChartSectionData( ) in sections parameter.
provide value = 0 to first section and any value to 2nd section

Screenshots
When values provided to both sections
image

value = 0, in 1st section (value > 0 given to 2nd section)
image

value = 0, in 2nd section (value > 0 given to 1st section)
image

Versions

flutter version
Flutter 3.19.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision ba39319843 (3 weeks ago) • 2024-03-07 15:22:21 -0600
Engine • revision 2e4ba9c6fb
Tools • Dart 3.3.1 • DevTools 2.31.1

fl_chart version
fl_chart: ^0.66.2

FYI: I didn't check behavior with any other number of sections

@Priyantha-Kingslake
Copy link
Author

Expected output can be taken by providing a veeery small value for the 1st section (0.000001)
image

    [
      PieChartSectionData(
        showTitle: false,
        value: totalHours == 0 ? 0.000001 : totalHours,
        color: MyColors.kBlue,
        radius: radius,
      ),
      PieChartSectionData(
        showTitle: false,
        value: remaining,
        color: MyColors.kBlue.withOpacity(0.2),
        radius: radius,
      ),
    ]

@imaNNeo
Copy link
Owner

imaNNeo commented May 8, 2024

Can you please provide a reproducible code? (a simple main.dart file content)

@Priyantha-Kingslake
Copy link
Author

Tried with minimum possible and the bug didn't occur.
Issue's still there in the original.
Will try to find cause
Bit busy these days though...
Will update here when I get some time.

@soraef
Copy link
Contributor

soraef commented Jun 17, 2024

This problem occurred when --web-renderer html was specified in Flutter web.
If --web-renderer html is not shown, there seems to be no problem.

@marcosgcd
Copy link

The issue only occurs with PieChartSectionData is 100% of The Pie and the Color has opacity.

PieChart(
    PieChartData(
        sectionsSpace: 0,
        centerSpaceRadius: 18,
        sections: [
              PieChartSectionData(
                color: Theme.of(context).colorScheme.primary.withOpacity(0.5),
                radius: 4,
                value: 50,
                showTitle: false,
              ),
            ],
          ),
);

Result:
Bildschirmfoto 2024-07-17 um 04 09 28

Result with Theme.of(context).colorScheme.primary.withOpacity(1),:
Bildschirmfoto 2024-07-17 um 04 09 06

Without opacity the result is as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants