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

Doesn't work on web #95

Closed
andermoran opened this issue Oct 28, 2019 · 26 comments
Closed

Doesn't work on web #95

andermoran opened this issue Oct 28, 2019 · 26 comments
Labels
bug Something isn't working Web

Comments

@andermoran
Copy link

andermoran commented Oct 28, 2019

It does not render correctly on the web. I know the web is only in technical preview so I didn't expect it to work but it would be nice if it did.

Render on mobile (good)
image

Render on web (bad)
Screen Shot 2019-10-28 at 11 01 46 AM

@imaNNeo
Copy link
Owner

imaNNeo commented Oct 28, 2019

Hi dude, great to see it on the web,
We are not going to focus on the web,
but may I ask you what is your problem with that (the second image)?

@andermoran
Copy link
Author

Yes, I get that the web isn't a priority. I was just letting you know how it works on the web. The data for the charts is the exact same. It paints the lines correctly on the top graph but on the bottom graph the lines go crazy

@imaNNeo
Copy link
Owner

imaNNeo commented Oct 29, 2019

Got it,
Thanks!

@imaNNeo imaNNeo added the enhancement New feature or request label Oct 29, 2019
@andymillernz
Copy link

There is a bug in the Path.from function in the web engine - it effectively creates a pointer to the path instead of a deep copy.

Fix is to change the 2 occurrences of Path.from to 'shift' in line_chart_painter.dart (I'm sure there are other/better fixes, this happens to be the one that works for me).

// final belowBarPath = Path.from(barPath);
    final belowBarPath = barPath.shift(Offset(0, 0));
...

@ChenYunerer
Copy link

andymillernz`s method is worked

@imaNNeo
Copy link
Owner

imaNNeo commented Dec 13, 2019

Did you test in the new flutter veraion?

@ChenYunerer
Copy link

my flutter version is Flutter 1.10.16 • channel master

@imaNNeo
Copy link
Owner

imaNNeo commented Dec 13, 2019

May I ask you to check it in 0.12?

@andymillernz
Copy link

May I ask you to check it in 0.12?

I've created a bug report with the flutter team re: the issue with Path.from...

@imaNNeo
Copy link
Owner

imaNNeo commented Dec 14, 2019

Well done,
Thanks!

@fsteenkamp
Copy link

@imaNNeoFighT my proposed workaround for web is very simple:
final belowBarPath = kIsWeb ? barPath.shift(const Offset(0, 0)) : Path.from(barPath);

Not sure how to test packages locally in my application, any advice on how to do that? :)

@imaNNeo imaNNeo added bug Something isn't working and removed enhancement New feature or request labels Jan 7, 2020
@abc873693
Copy link

It work in flutter v1.13.9-pre.59. fl_chart 0.6.3

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, v1.13.9-pre.59, on Mac OS X 10.15.2 19C57, locale zh-Hant-TW)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.41.1)
[✓] Connected device (3 available)

@andymillernz
Copy link

For best results (at this point in time) you need to run in release mode with SKIA enabled..

I assume (hope?) that this will become the default at some point..

flutter run -d chrome --dart-define=FLUTTER_WEB_USE_SKIA=true --release

@Dimarv135
Copy link

For me only Pie chart doesn't show up on web.Same code/data that runs fine on mobile doesn't show anything on web. My app has also line chart, bar chart, stacked- bar chart which all work fine on Web.
Release mode didn't help. SKIA fixes the problem with the pie chart but the rest of my app doesn't support it.

@Mecil9
Copy link

Mecil9 commented Mar 12, 2020

For me only Pie chart doesn't show up on web.Same code/data that runs fine on mobile doesn't show anything on web. My app has also line chart, bar chart, stacked- bar chart which all work fine on Web.
Release mode didn't help. SKIA fixes the problem with the pie chart but the rest of my app doesn't support it.

me to0..........
Pie chart can't display the circle draw....only show the Indicator's data....

did u fix it?

@imaNNeo
Copy link
Owner

imaNNeo commented May 1, 2020

I think it has been fixed (at least I see it is fixed in beta channel)
Am I correct?

@darrillaga
Copy link

darrillaga commented May 4, 2020

Line chart still not working in web, I tried switch Path.from with shift and didn't work, version 0.9.4

@imaNNeo
Copy link
Owner

imaNNeo commented May 4, 2020

Okay tnx

@darrillaga
Copy link

Sorry for the message with lack of content, the following are iOS vs Chrome.
If I enable SKIA I just get only the solid lines. Let me know if I can help you with something to get this fixed.

iOS:
image

Chrome:
image

@andymillernz
Copy link

There are still some limitations in the 'painting/blend/path' functions for the web flutter implementation.

In this case the issue relates to using a dash line.. And it looks reasonably correct if you comment out the dashArray in line_chart_sample8.dart

            FlSpot(8, 1),
            FlSpot(9.5, 2),
            FlSpot(11, 4),
          ],
          // dashArray: [2, 4],
          isCurved: true,

If you want the pie chart to work you need to patch lib/src/pie_chart/pie_chart_painter.dart and remove or change the blendMode in sectionsSpaceClearPaint - this does impact the pie chart functionality. however at least gets things to work..

sectionsSpaceClearPaint = Paint()
      ..style = PaintingStyle.fill
      ..color = const Color(0x000000000)
      // ..blendMode = BlendMode.srcOut;
      ..blendMode = BlendMode.color;

@darrillaga
Copy link

it worked without dash array, great thanks!

@imaNNeo
Copy link
Owner

imaNNeo commented Mar 18, 2021

I think it doesn't exist anymore.
Can somebody check it and let me know?

@OlegNovosad
Copy link

@imaNNeoFighT checked and was not able to reproduce it. We can close it I think.

@imaNNeo
Copy link
Owner

imaNNeo commented Apr 1, 2021

Congrats! :))

@santro93
Copy link

santro93 commented Sep 1, 2023

For deploying web package what should i use?

@OlegNovosad
Copy link

For deploying web package what should i use?

What do you mean? This package supports web.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Web
Projects
None yet
Development

No branches or pull requests