Question

Bar Chart Example

Morris.Bar({
  element: 'bar-example',
  data: [
    { y: 'dddd', a: 100, b: 90 },
    { y: '2007', a: 75,  b: 65 },
    { y: '2008', a: 50,  b: 40 },
    { y: '2009', a: 75,  b: 65 },
    { y: '2010', a: 50,  b: 40 },
    { y: '2011', a: 75,  b: 65 },
    { y: '2012', a: 100, b: 90 }
  ],
  xkey: 'y',
  ykeys: ['a', 'b'],
  labels: ['Series A', 'Series B']
});

Area Chart Example

Morris.Area({
  element: 'area-example',
  data: [
    { y: 'dddd', a: 100, b: 90 },
    { y: '2007', a: 75,  b: 65 },
    { y: '2008', a: 50,  b: 40 },
    { y: '2009', a: 75,  b: 65 },
    { y: '2010', a: 50,  b: 40 },
    { y: '2011', a: 75,  b: 65 },
    { y: '2012', a: 100, b: 90 }
  ],
  xkey: 'y',
  ykeys: ['a', 'b'],
  labels: ['Series A', 'Series B']
});

In Morris Chart library Bar charts accepts strings for Y-AXIS but Area one doesn't.I can't understand why ?

THIS IS THE MORRIS LIBRARY

Was it helpful?

Solution

Morris.js is trying to parse x-values as timestamp. But 'dddd' has invalid format. You can skip date parsing by using parseTime: false option (jsbin). In this case X values will be treated as an equally-spaced series. See docs

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