Filled series dependent on gradient

37 views
Skip to first unread message

Richard Fairhurst

unread,
Sep 17, 2015, 10:59:27 AM9/17/15
to Flot graphs
Hi,

Slightly obscure request, but I'm posting in case someone has a pointer as to the best way to start.

I have a filled graph that represents the elevation profile of a bike ride.

I'd like to have the fill colour-coded by the gradient of the line. So, flat sections would be coloured in a neutral section, steep uphills would be coloured in red, steep downhills coloured in green, and so on. A bit like this:


I can do the code to assign a colour to each section, that's no problem. Where I'd appreciate hints is how best to hook this into Flot - any ideas?

All the best
Richard

Tim Schneider

unread,
Sep 18, 2015, 10:20:52 AM9/18/15
to flot-...@googlegroups.com
Hi,

I would propose to generate one series for each color and then insert null values in between to data points where you don't want the points to be connected.
Like this you should be able to generate the desired output.

Tim

--

---
You received this message because you are subscribed to the Google Groups "Flot graphs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flot-graphs...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

signature.asc

Richard Fairhurst

unread,
Sep 28, 2015, 10:45:01 AM9/28/15
to Flot graphs
On Friday, September 18, 2015 at 3:20:52 PM UTC+1, Tim wrote:
Hi,

I would propose to generate one series for each color and then insert null values in between to data points where you don't want the points to be connected.

That's a really good idea - hadn't thought of that. Thank you, I'll give it a go.

All the best
Richard
Reply all
Reply to author
Forward
0 new messages