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

Bar graphs draw below the bottom axis when minY is set #404

Closed
blough opened this issue Jul 29, 2020 · 7 comments
Closed

Bar graphs draw below the bottom axis when minY is set #404

blough opened this issue Jul 29, 2020 · 7 comments
Labels
Bar Chart bug Something isn't working

Comments

@blough
Copy link

blough commented Jul 29, 2020

When using a bar graph, if the minY value is set on the BarGraphData then the bars draw below the bottom axis covering the titles.

The can be reproduced with the example application. Open the file bar_chart_sample3.dart and add minY: 5 at line 21 (just above the line maxY: 20).

Here is how it looks without a maxY value set
no minY

Here is how it looks with a maxY set to 5
minY set to 5

Flutter 1.17.5
FlChart 0.11.0

Thank you for a great library!

@blough
Copy link
Author

blough commented Aug 3, 2020

Would it work to change lines 209 and 237 of bar_chart_painter.dart (https://github.com/imaNNeoFighT/fl_chart/blob/master/lib/src/chart/bar_chart/bar_chart_painter.dart#L237) from

final bottom = getPixelY(0, drawSize);
to
final bottom = getPixelY(max(data.minY ?? 0, 0), drawSize);

to fix the issue?

@imaNNeo
Copy link
Owner

imaNNeo commented Aug 10, 2020

Hi, sorry for the late answer,
you are exactly correct, and you got it.
Make a PR and fix it by yourself :)
Also, you should fix this issue for the negative values too (check line 247 too)
Thanks for reporting and contributing.
Cheers!

@imaNNeo imaNNeo added Bar Chart bug Something isn't working labels Aug 10, 2020
@imaNNeo
Copy link
Owner

imaNNeo commented Aug 10, 2020

And thanks for your great explanation.

@ulusoyca
Copy link

@imaNNeoFighT Thanks for the answer. Looks like our project is blocked by this issue. Do you have any updates?

@imaNNeo
Copy link
Owner

imaNNeo commented Aug 29, 2020

Okay,
I'm on it :)

@imaNNeo
Copy link
Owner

imaNNeo commented Aug 29, 2020

Sorry for the delay, fixed in 0.11.1,
check it out.

Thanks for reporting and contributing.

@imaNNeo imaNNeo closed this as completed Aug 29, 2020
@ulusoyca
Copy link

@imaNNeoFighT Thanks for the effort. Much appreciated!

ezmegy pushed a commit to ezmegy/fl_chart that referenced this issue Nov 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bar Chart bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants