Comments (10)
I'm waiting for the correction of this bug ... can you correct this ?
from flutter_sparkline.
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));
from flutter_sparkline.
If you set a fixed _max and _min, this gets fixed.
from flutter_sparkline.
Same issues please find a solution... I just want a flat line if all my data are [0.0]. Thank you
from flutter_sparkline.
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.
from flutter_sparkline.
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?
from flutter_sparkline.
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?
from flutter_sparkline.
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.
from flutter_sparkline.
No worries. Looks like we implemented similar solutions and I expect I will be expanding the functionality for my application.
Thanks again!
from flutter_sparkline.
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!
from flutter_sparkline.
Related Issues (17)
- Support for gradient in color HOT 4
- [Regression] Line does not end at the end of the chart
- [GridLines] Fill does not fill properly HOT 1
- [Feature Request] similar data should come with y-axis greater than zero
- [Feature Request] Allow to set fixed boundaries for data parameters HOT 1
- [Feature Request] Allow nulls in the data, for showing discontinuous lines
- Update Value
- Any news from de maintainer?
- how to show a text above the line? HOT 1
- How can I create a Sparkling inside an Scrollview to show a data set too big? HOT 1
- Request: Labeled Grid Lines HOT 10
- Need null safety version HOT 1
- Request: Label data points
- Unable to install on flutter dev channel project HOT 1
- when support >dart 2.0 HOT 1
- [Feature Request] Smoothed curve HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_sparkline.