morrisjs / morris.js

Pretty time-series line graphs
http://morrisjs.github.com/morris.js/
6.91k stars 1.23k forks source link

Can you do regions with line charts? #723

Open cyphix333 opened 7 years ago

cyphix333 commented 7 years ago

I like morris.js but I'm wondering if it is capable of doing regions with the line charts, something similar to this:

untitled-2

I don't care about the different shading, I'm talking about the green/red background colors in the chart from top to bottom.

pierresh commented 6 years ago

Hello,

Yes, this is possible by settings an array in the options events, have a look to the example in the file events.html :

Morris.Line({
  element: 'graph',
  data: week_data,
  xkey: 'period',
  ykeys: ['licensed', 'sorned'],
  labels: ['Licensed', 'SORN'],
  events: [
    '2011-04',
    ['2011-05', '2011-06'],
    '2011-08'
  ]
});
cyphix333 commented 6 years ago

Bit late now, but thanks haha.... good to know for next time :)