timobaehr / fl_heatmap

A heatmap build for Flutter apps.
BSD 3-Clause "New" or "Revised" License
14 stars 5 forks source link

Values with the highest colors are displayed white #2

Open geisterdach opened 5 months ago

geisterdach commented 5 months ago

I have changed this:

for (int i = 1; i < numberOfColorClasses; i++) { if (value <= min + (i classSize)) { return colorPalette[i]; } else if (value > (classSize i) && i == numberOfColorClasses - 1) { return colorPalette.last; } }

to this:

for (int i = 1; i < numberOfColorClasses; i++) { if (value <= min + (i classSize)) { return colorPalette[i]; } else if (value > min + (classSize i) && i == numberOfColorClasses - 1) { return colorPalette.last; } }

I think this makes more sense. I think what you are trying to do is that if in the last iteration still nothing is returned, then you just return the last value. Probably you also just write ¨else if (i == numberOfColorClasses - 1) ¨ because the first condition must be true anyway, in case the previous IF does not catch
geisterdach commented 5 months ago

I am refering to heatmap_painter.dart line 200