morrisjs / morris.js

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

Drawing a sum of Items #799

Open DesRodman opened 4 years ago

DesRodman commented 4 years ago

Hello team.

I'm using the next line chart <script> $(function () { "use strict"; // AREA CHART var area = new Morris.Area({ element: 'revenue-chart' , resize: true , data: [{y:'2020-08-07 00:00:00',Item1:11654,Item2:10799},{y:'2020-08-07 01:00:00',Item1:2491,Item2:2222},{y:'2020-08-07 02:00:00',Item1:2120,Item2:1987},{y:'2020-08-07 03:00:00',Item1:14854,Item2:13175},{y:'2020-08-07 04:00:00',Item1:17369,Item2:15501},{y:'2020-08-07 05:00:00',Item1:1782,Item2:1611}] , xkey: 'y' , ykeys: ['Item1', 'Item2'] , labels: ['Sent', 'Delivered'] , lineColors: ['#17a317', '#1410b1'] , pointStrokeColors: ['#cff8cf', '#0b0bdc'] , hideHover: 'auto' }); }); </script>

For example we can see at first data {y:'2020-08-07 00:00:00',Item1:11654,Item2:10799} but on web, i can see the next chart https://prnt.sc/tvidjf, i mean max place is more then 20k, but in source data max is 11654. I can see in blue line a sum of this two items... but on view - we can see a correct signing - https://prnt.sc/tvie8h

How can i setup data - for get a real chart lines?

Thanks

pierresh commented 3 years ago

Hello, You should use set the option ChartAreaOptions to true, so that the lines would not be stacked. More info about this in the help: http://morrisjs.github.io/morris.js/lines.html