Question

I'm using morris.js to draw a graph, but it draws the wrong value on the line graph. The popup shows 3, but the line reads 4

enter image description here

Code to draw graph:

var overviewChart = Morris.Area({
element: 'overviewChart',
  data: $.parseJSON($('#userBlocks').html()),
  xkey: 'y',
  ykeys: ['Blocks', 'Scans'],
  labels: ['Blocks', 'Scans'],
  lineColors: ['#A5C3F7', '#999']
});

Text parsed for JSON data:

 [{"y":"2014-02-07","Blocks":0,"Scans":0},{"y":"2014-02-08","Blocks":0,"Scans":0},{"y":"2014-02-09","Blocks":0,"Scans":0},{"y":"2014-02-10","Blocks":0,"Scans":0},{"y":"2014-02-11","Blocks":0,"Scans":0},{"y":"2014-02-12","Blocks":0,"Scans":0},{"y":"2014-02-13","Blocks":0,"Scans":0},{"y":"2014-02-14","Blocks":0,"Scans":0},{"y":"2014-02-15","Blocks":0,"Scans":0},{"y":"2014-02-16","Blocks":0,"Scans":0},{"y":"2014-02-17","Blocks":0,"Scans":0},{"y":"2014-02-18","Blocks":0,"Scans":0},{"y":"2014-02-19","Blocks":0,"Scans":0},{"y":"2014-02-20","Blocks":0,"Scans":0},{"y":"2014-02-21","Blocks":0,"Scans":0},{"y":"2014-02-22","Blocks":0,"Scans":0},{"y":"2014-02-23","Blocks":0,"Scans":0},{"y":"2014-02-24","Blocks":0,"Scans":0},{"y":"2014-02-25","Blocks":0,"Scans":0},{"y":"2014-02-26","Blocks":0,"Scans":0},{"y":"2014-02-27","Blocks":0,"Scans":0},{"y":"2014-02-28","Blocks":0,"Scans":0},{"y":"2014-03-01","Blocks":0,"Scans":0},{"y":"2014-03-02","Blocks":0,"Scans":0},{"y":"2014-03-03","Blocks":0,"Scans":0},{"y":"2014-03-04","Blocks":0,"Scans":0},{"y":"2014-03-05","Blocks":0,"Scans":0},{"y":"2014-03-06","Blocks":0,"Scans":0},{"y":"2014-03-07","Blocks":1,"Scans":3}]

It seems as if the grey line is adding 3+1 =4 instead of just 3. Is there a way to make it just 3?

Was it helpful?

Solution

My fault. Just change Morris.Area to Morris.Line

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top