Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I fill color in between multiple stacked line graphs in Flot?

I want to fill the color between multiple stacked line graphs in Flot. I tried doing this for just two graphs and that works when I reverse the order of the coordinates in the second graph from max(X) to min(X). Any ideas on how I can do that for multiple graphs?

like image 291
Vijay Kotari Avatar asked Feb 24 '23 20:02

Vijay Kotari


1 Answers

$.plot($('#graph'),
[
 {data:d1, id:'foo'}, 
 {data:d2,id:'bar',fillBetween:'foo'}, 
 {data:d3,id:'baz',fillBetween:'bar'} 
], 
{
  series: {
      stack: true,
      lines: { show: lines, fill: true, steps: steps }
  }
});

Works well for me. Just make sure you include the stack and fillBetween plugins (in that order) in your includes.

like image 79
Ryley Avatar answered Apr 20 '23 00:04

Ryley