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

[Bug] Exact same data produces no graph #18

Open
TheNewJavaman opened this issue Jan 1, 2019 · 10 comments
Open

[Bug] Exact same data produces no graph #18

TheNewJavaman opened this issue Jan 1, 2019 · 10 comments

Comments

@TheNewJavaman
Copy link

If that data List is all the same value (ie [0.0, 0.0, 0.0], the graph doesn't show up instead of, say, having just a horizontal line.

@TheNewJavaman
Copy link
Author

If you set a fixed _max and _min, this gets fixed.

@sverdy
Copy link

sverdy commented May 19, 2019

I'm waiting for the correction of this bug ... can you correct this ?

@nitneuq33
Copy link

Same issues please find a solution... I just want a flat line if all my data are [0.0]. Thank you

@raphael-bmec-co
Copy link

raphael-bmec-co commented Jun 8, 2020

Hey, this is kinda a major issue :( Any timeline on a fix?

Issues is line 300 final double heightNormalizer = height / (_max - _min);

Can be fixed with a change to final double heightNormalizer = height / max(1,(_max - _min));

@TheNewJavaman
Copy link
Author

IIRC one of my repositories (pc-monitor) has a fixed version of this module. If you give me a day or two I can fork this repo and post the new source.

@raphael-bmec-co
Copy link

Thanks I actually saw that after posting. I have made some other changes to so that single value lines also plot to the center of the chart instead of the bottom.

    if(_min == _max){
      if(_min == 0){
        _min = -1;
        _max = 1;
      } else {
        _min = _max/2;
        _max = _max*2;
      }
    }

How does your fix handle that case?

@TheNewJavaman
Copy link
Author

For my project it actually made sense for the line to be at the bottom (null value from API => 0/bottom on graph). Not an issue if you want to start a pull request for the middle line, just maybe include it as a parameter for the graph?

Side note: my code was very hacky and poorly written; would you rather look over my repo and then write your own additional code?

@TheNewJavaman
Copy link
Author

Ah shit. I had a hard drive go bad about 8 months ago, and I seem to have lost the updated repository that contained my fixes; unfortunately, it looks like I also forgot to push my commits to the online repo. I don't remember how I fixed the problem, but here's some pseudo-code to describe what I may have done, based on my comment above:

if all_datapoints in line == 0.0:
    let min = 0
    let max = 1

or, more relevant to your solution:

if all_datapoints in line == 0.0:
    let min = -1
    let max = 1

and then update the graph with these new boundaries. Doesn't seem too complicated, it's pretty much the same solution you said earlier.

@raphael-bmec-co
Copy link

raphael-bmec-co commented Jun 9, 2020

No worries. Looks like we implemented similar solutions and I expect I will be expanding the functionality for my application.

Thanks again!

@martin4951
Copy link

martin4951 commented Jul 13, 2022

Hey, this is kinda a major issue :( Any timeline on a fix?

Issues is line 300 final double heightNormalizer = height / (_max - _min);

Can be fixed with a change to final double heightNormalizer = height / max(1,(_max - _min));

Hi, I tried this but it didn't work for me. Graph still doesn't plot.

Edit: Apologies it does work. Just forgot to import dart:math. Thanks for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants