MrMufflon / Leaflet.Elevation

Leaflet plugin to view height profile of GeoJSON- and GPX polylines using d3
http://mrmufflon.github.io/Leaflet.Elevation
MIT License
276 stars 83 forks source link

Fill chart with different colors based on intervals #56

Open corinat opened 8 years ago

corinat commented 8 years ago

Hello,

Has anyone tried to fill the chart with different colors based on some values? Something like this? http://plnkr.co/edit/73RgBkbrml6CBA143FCf?p=preview If anyone could give some hints where I should do some changes, it would be much appreciated.

MrMufflon commented 8 years ago

I think the graph would need to be rendered in pieces, for each color. This would be mayor changes to the code.

HugoHeneault commented 5 years ago

I might try something here if one of my clients confirms he's wanting it. Might take awhile but here's what I would do :

Calculate intervals (might be forced if needed, then fill the background with a linear gradient, as seen on: https://stackoverflow.com/questions/17053043/create-a-svg-rectangle-filled-with-different-background-color-by-percentage-or-p