Comments (5)
hey @Mattasher,
Thanks for pointing this out! Hadn't run into this bug yet.
So, I don't really like the idea of adding another prop that's so specific to this problem. One thing I've been thinking about, though, is to provide min
and max
props.
Sometimes, for example, you have several trends side-by-side, and you want them to all share the same data scale.
It would also solve this problem; If your data was [5, 5, 5, 5, 5]
, and you provided a min
of 0 and a max
of 10, your data would be a flat line along the middle. If the data was [0, 0, 0, 0, 0]
, it would run along the bottom.
(of course, a potential problem with that approach is if you provide data outside the supplied range... but maybe I can just clamp it to the range provided, and add a console warning).
from react-trend.
Published a basic fix, where lines will run along the baseline when all values are the same.
In the future, a minor version bump will allow the min
/max
props I described above (or something similar).
from react-trend.
Excellent! Thanks. If you want to see it in action I've added trendlines to http://growhive.io/ in the upper left corner you'll have to leave "The Nursery" and go to other Sectors to accumulate Score & Nectar.
from react-trend.
@Mattasher this is awesome!! Thanks so much for sharing, love seeing where things get used :)
I do see the issue, where once the trend fills up with the same value (eg. my score of 3 has been static the whole while), the line jumps back down to baseline. Min/max will fix that, hopefully I can make some time for it soon.
from react-trend.
(sadly, min/max is not something we need at Unsplash yet, so it's hard to justify the time for it - if you'd like to work on it, though, I'd gladly accept PRs!)
from react-trend.
Related Issues (13)
- React Native compatibility HOT 1
- Errors when data array contains single value HOT 5
- How to set the background fill along with the stroke? HOT 2
- Events HOT 2
- Error when using with SSR HOT 1
- Add Typescript typings HOT 3
- [Feature Request] Support angle in gradient HOT 1
- Dot on the graph HOT 1
- React dependency warning? HOT 1
- Getting an error while using React Trend with React Starter Kit HOT 2
- unsplash link not working HOT 2
- Gradient props overwritten HOT 1
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 react-trend.