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

Pie chart sections all black iff one sections was once 100% (360 degrees) #1538

Closed
buchen opened this issue Dec 28, 2023 · 4 comments
Closed
Labels
bug Something isn't working Pie Chart

Comments

@buchen
Copy link

buchen commented Dec 28, 2023

Problem

If the chart once contains one section that takes up 100%, then after an update, pie slices will all be black.

To Reproduce

  • Create a chart with one PieChartSectionData that represents 100 percent
  • Then update the chart with multiple pie charts (say: two sections with each 50 percent)
  • The color of the slices of the pie chart will be black

Version
0.66.0

Potential root cause

With change 68cf161, the blendMode is set to BlendMode.srcOut on the _sectionPaint if there is a slice that takes up 100%. Later, if there are multiple slices, the drawSection is using the same _sectionPaint with the altered blendMode.

I can confirm that the following code fixes the problem:

 void drawSection(
    PieChartSectionData section,
    Path sectionPath,
    CanvasWrapper canvasWrapper,
  ) {
    _sectionPaint
      ..setColorOrGradient(
        section.color,
        section.gradient,
        sectionPath.getBounds(),
      )
      ..blendMode = BlendMode.srcOver       <==== set blend mode to srcOver
      ..style = PaintingStyle.fill;
    canvasWrapper.drawPath(sectionPath, _sectionPaint);
  }
@shaynec25
Copy link

same issue here

1 similar comment
@tattuu
Copy link

tattuu commented Jan 5, 2024

same issue here

@imaNNeo imaNNeo added bug Something isn't working Pie Chart labels Jan 10, 2024
imaNNeo added a commit that referenced this issue Jan 10, 2024
imaNNeo added a commit that referenced this issue Jan 10, 2024
@imaNNeo
Copy link
Owner

imaNNeo commented Jan 10, 2024

Yes, it is related to the code that you mentioned.
Thanks for your detailed issue.

The hotfix is landed on the main branch.
Stay tuned for a hotfix

@imaNNeo
Copy link
Owner

imaNNeo commented Jan 22, 2024

Fixed in 0.66.1

@imaNNeo imaNNeo closed this as completed Jan 22, 2024
OlehSv pushed a commit to Oleh-Sv/fl_chart that referenced this issue May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Pie Chart
Projects
None yet
Development

No branches or pull requests

4 participants