humangeo / leaflet-dvf

Leaflet Data Visualization Framework
MIT License
689 stars 153 forks source link

FlowLine, CustomColorFunction & min #54

Closed jack-r-abbit closed 9 years ago

jack-r-abbit commented 9 years ago

I created a CustomColorFunction and gave it min/max values and small set of colors (red, yellow, green). When used with a data set that contains values BELOW the min, those low values get assigned the color from the max end of the scale, not the min. I expected the numbers below the min would get the min end of the scale.

To illustrate, I've made this jsFiddle: http://jsfiddle.net/wzfp1mLh/1/ Notice my color function has a min of 35 and a max of 60. Notice the data starts out above 60 and gradually steps down to 34 and then back up 35. I expected the tail end of this FlowLine to be all red but the point that is 34 is green.

I'm not sure if this is "just the way it is" or a bug in one of those components.

sfairgrieve commented 9 years ago

Thanks for pointing this out. Let me look into this. You're understanding of how it should work sounds correct to me.

sfairgrieve commented 9 years ago

I see the problem. I'll push a fix soon.

sfairgrieve commented 9 years ago

Just pushed a fix to master. Let me know if this fixes your issue.

jack-r-abbit commented 9 years ago

That fixed the problem. Great plugin you have here. Thank you!