Morris axis of the year

http://jsfiddle.net/wb6jz/

I have a problem with the x axis, I want to display dates, not the year, where can I find this?

Morris.Area({ element: 'area-example', data: [ { y: '1.1.', a: 100, b: 90 }, { y: '2.1.', a: 75, b: 65 }, { y: '3.1.', a: 50, b: 40 }, { y: '4.1.', a: 75, b: 65 }, { y: '5.1.', a: 50, b: 40 }, { y: '6.1.', a: 75, b: 65 }, { y: '7.1.', a: 100, b: 90 } ], xkey: 'y', ykeys: ['a', 'b'], labels: ['Series A', 'Series B'] }); 
+6
source share
2 answers

I don't think your y formed correctly, but if you want to see dates instead of years, add xLabels: "day"

See http://jsfiddle.net/wb6jz/1/

Documentation: http://www.oesmith.co.uk/morris.js/lines.html

0
source

First, you correct the date form to Y. Then add xLabels: "day",

Here is an example

 Morris.Line({ element: 'line-example', data: [ { y: '2015-01-01', a: 100, b: 90 }, { y: '2015-02-01', a: 75, b: 65 }, { y: '2015-03-01', a: 50, b: 40 }, { y: '2015-04-01', a: 75, b: 65 }, { y: '2015-05-01', a: 50, b: 40 }, { y: '2015-06-01', a: 75, b: 65 }, { y: '2015-07-01', a: 100, b: 90 } ], xkey: 'y', ykeys: ['a', 'b'], xLabels: "day", labels: ['Series A', 'Series B'] }); 
0
source

Source: https://habr.com/ru/post/953183/


All Articles