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

Negative BarChartRodStackItem are not drawn correctly in Flutter 3.10.5 (stable) #1347

Closed
large opened this issue May 22, 2023 · 10 comments
Closed

Comments

@large
Copy link

large commented May 22, 2023

Describe the bug
When using stacked bars the negative values are not shown correct on flutter v3.11.xx (master channel).
Same code compiled with Flutter v3.7.12 works as expected.

I have also created an issue within Flutter, but I just wanted you to have a heads up
flutter/flutter#123123 (comment)

To Reproduce
See this reproduction code: https://github.com/large/partlyflicker
(Little messy since I used code from a bigger app that had issues)

Screenshots
Flutter 3.10.5 stable & Flutter 3.11.xx-pre
Screenshot_1684783930

Flutter 3.7.12
image

Versions
Flutter 3.7.12 (as expected)
Flutter 3.10.5 stable & masterchannel 3.11.xx-pre channel (not as expected)
fl_chart v0.62.0

@imaNNeo
Copy link
Owner

imaNNeo commented Jun 7, 2023

we are not going to support the master channel. hopefully it will be fixed in the stable channel. Otherwise, we need to fix it.

@k0psutin
Copy link
Contributor

BarChartRodStackItem is also broken on Flutter 3.10.5 stable channel.

To Reproduce
Clone @large code: https://github.com/large/partlyflicker

Use Flutter 3.10.5 from stable.

Android:
5FA45E9A-2643-41C6-A38E-3D34357EB4AE_1_201_a

iOS:
2361F58F-4F09-4F5C-8D26-84AAF91F30F9

@large
Copy link
Author

large commented Jun 22, 2023

I am AFK and did not test it on stable channel lately. But this is probably an issue related to Impeller (new render engine).

It could be interesting if some could use the stable channel that fails and try to disable Impeller https://docs.flutter.dev/perf/impeller

@imaNNeo wanna give it a try, bugs from master are now included in stable? 😁

@k0psutin
Copy link
Contributor

Disabling the impeller didn't do anything. But it seems that the impeller is not activated at all?

I added:

  <meta-data
    android:name="io.flutter.embedding.android.EnableImpeller"
    android:value="true" />

To androidmanifest.xml and run @large example with flutter run --enable-impeller and the chart seemed to draw correctly:

7967B515-B0C2-4500-9213-1EE5A617AA0F

@large
Copy link
Author

large commented Jun 22, 2023

Disabling the impeller didn't do anything. But it seems that the impeller is not activated at all?

I used a mac to develop on and impeller is enabled by default there on iOS. Impeller back then had a lot of issues so almost every gfx-related issue pointed to Impeller 😁
(Impeller ate all the memory 256 GB too, so it was a mess).

So your testing shows that Android with stable 3.10.x impeller disabled = failed and enabled = ok?
How is the framerate though. It is probably slow...

@k0psutin
Copy link
Contributor

I used a mac to develop on and impeller is enabled by default there on iOS. Impeller back then had a lot of issues so almost every gfx-related issue pointed to Impeller 😁 (Impeller ate all the memory 256 GB too, so it was a mess).

So your testing shows that Android with stable 3.10.x impeller disabled = failed and enabled = ok? How is the framerate though. It is probably slow...

It is quite slow and jerky with the impeller enabled, and it seems that it is very volatile as my other project crashed a lot, when I enabled the impeller (to test it).

@large large changed the title Negative BarChartRodStackItem are not drawn correctly in Flutter 3.11.xx-pre (master channel) Negative BarChartRodStackItem are not drawn correctly in Flutter 3.10.5 (stable) Jun 28, 2023
@large
Copy link
Author

large commented Jun 29, 2023

I have tested stable 3.10.5 on a Android emulator with same results as @k0psutin.
Impeller off = bug showing
Impeller on = bug gone (performance is really bad)

iOS emulator:
Bug is not showing, emu is eating memory though (another impeller bug)...

Downgraded to Flutter 3.7.12; Android emu (performance good), impeller is not possible to enable here.

I find it hard to find the reason for why this happens, maybe a test could be written for the canvasroutine to test?

if (barRod.rodStackItems.isNotEmpty) {


After looking at the canvas code I wanted to test to start drawing from outer to inner on negative numbers to.
See example code here

    //Loop through all costs
    for (int stack = 0; stack < 4; stack++) {
      double startPoint = item.barRods.last.rodStackItems.isEmpty ? 0 : item.barRods.last.rodStackItems.last.toY;
      double add = i / 3;
      if(add>0)
        {
          item.barRods.last.rodStackItems.add(BarChartRodStackItem(startPoint,
              startPoint + add, stack.isEven ? Colors.cyan : Colors.red));
        }
      else //writing from outer point against zero
        {
          item.barRods.last.rodStackItems.add(BarChartRodStackItem(add * (4-stack),
              add * (3-stack), stack.isOdd ? Colors.cyan : Colors.red));
        }
    }

It would be best if fl_chart handled it though...

@imaNNeo
Copy link
Owner

imaNNeo commented Jul 11, 2023

I found the bug 🎉

@deverlex
Copy link

deverlex commented Sep 21, 2023

I have same issue in version ^0.63.0 and flutter 3.10.x

@imaNNeo
Copy link
Owner

imaNNeo commented Oct 7, 2023

Fixed in Check it out in 0.64.0

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