LineChart with line color varying with absolute values
- Dominant language
- Dart
- Stars
- 7.6k
- Forks
- 2k
- Avg merge
- 9d 1h
- Merged PRs (30d)
- 2
Description
Is it possible to define the line chart bar color depending on absolute values?
E.g.
if FlSpot.y > 25-> yellow
else if FlSpot.y < 25-> green
But keep it like this all the time.
I tried to do it with the gradient but noticed that the stops value are a percentage of what is currently shown on the chart.
I wanted to show a "sliding live window" for a temperature chart, based on your example in line_chart_sample10
But the thing is the gradient applies to what is currently being displayed, so running a 5min window, if it happens to show temperatures between 20 and 25 and ones in the 25s will get the "hotter" colors, but moving along, and the temperature rises to something between 25 and 30, the 25s that previously got the hotter colors, will have the cooler colors as there are new maximums in the chart.
This is easily reproducible in that example if you reduce the limitCount to 20 and change the gradient to a vertical one.
I think that #285 was already requesting something like I want.
Don't know if there has been any changes to the situation.
Contributor guide
Research direction
Start with the line_chart_sample10 example, reducing limitCount to 20 and using a vertical gradient to reproduce the current behavior. Review the related request in #285 and determine how line colors should remain tied to absolute FlSpot.y thresholds as the live window moves; done means the same values keep the same colors despite changing visible ranges.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- data-visualization, frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100