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 Chart - negative values go above #106

Closed
atreeon opened this issue Nov 11, 2019 · 11 comments
Closed

Bar Chart - negative values go above #106

atreeon opened this issue Nov 11, 2019 · 11 comments
Labels
Bar Chart bug Something isn't working

Comments

@atreeon
Copy link

atreeon commented Nov 11, 2019

I set the width of my bars. Some of the bars are shown correctly as negative values going below the 0 line but others, even though they have and display a negative value, show above the 0 line. If I reduce the width of the bars sometimes they behave correctly. Any ideas?

Screenshot 2019-11-11 at 02 35 41

Screenshot 2019-11-11 at 02 40 15

(and thank you again for the package, I like the way it is customisable, really good and the only one I could find that does most of what I want to do!)

@imaNNeo
Copy link
Owner

imaNNeo commented Nov 11, 2019

Do you have rounded corners with 0 radius?

@imaNNeo
Copy link
Owner

imaNNeo commented Nov 11, 2019

Pleasure that it fits your usage

@imaNNeo
Copy link
Owner

imaNNeo commented Nov 11, 2019

Do you have rounded corners with 0 radius?

?

@atreeon
Copy link
Author

atreeon commented Nov 12, 2019

Hello, you mean corners on the card like you have in the samples? I've tried with and without actually and unfortunately it doesn't make a difference to the negative values showing above the line.

    return Card(
      elevation: 0,
      shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(4)),

sorry I was away from my computer all yesterday.

@imaNNeo
Copy link
Owner

imaNNeo commented Nov 12, 2019

No,
do you set isRounded true, in your BarChartRodData?

@atreeon
Copy link
Author

atreeon commented Nov 12, 2019

I have it set to false but if I do set it to true then the negative values don't look very accurate.
(compare this image with the image above)
I think because I'm setting the width manually the calculation that determines if the chart should go up or down is wrong.

    BarChartRodData(
      isRound: true,
      y: value,
      width: width, //<--- different values on the same chart
      color: Colors.lightBlueAccent,
      title: title,

Screenshot 2019-11-12 at 09 21 41

@imaNNeo
Copy link
Owner

imaNNeo commented Nov 14, 2019

Let it be false, can you please provide me a code to reproduce it?

@imaNNeo imaNNeo added the bug Something isn't working label Nov 14, 2019
@atreeon
Copy link
Author

atreeon commented Nov 14, 2019

All it requires is the width to be different for different bars

@imaNNeo
Copy link
Owner

imaNNeo commented Mar 12, 2020

I need to a reproducible code, please make it, I don't have time to write the reproducible code,
write your scenario and put it here (including the main function), then I can copy-paste and run it, instead of writing them.
Regards!

@imaNNeo
Copy link
Owner

imaNNeo commented Apr 10, 2020

Implemented support for negative values for the BarChart, in 0.9.0
Check it out:

Sample 5 (Source Code)

@imaNNeo imaNNeo closed this as completed Apr 10, 2020
@mkprogrammer15
Copy link

Hello! Is there a solution to display negative values with a different color in line chart?

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