Home » Php » Can not display xlabel in morris.js

Can not display xlabel in morris.js

Posted by: admin October 26, 2017 Leave a comment

Questions:

I have problem in displaying line graph data using morris.js php. xlabel on the line chart diagram does not want to display label_jam as I want. how to handle it?

Below is an error image of the line chart view

enter image description here

This is my code

Morris.Line({
    element: 'bar-jam',
    data: <?php echo $data_per15menit; ?>,
    xkey: 'label_jam',
    ykeys: ['value_jml'],
    labels: ['Jumlah'],
    hideHover: 'auto',
    resize: false,
    lineColors: ['#0b62a4'],
    smooth: true
});
Answers:

Set the parseTime parameter to false:

parseTime: false

Full Morris code:

Morris.Line({
    element: 'bar-jam',
    data: <?php echo $data_per15menit; ?>,
    xkey: 'label_jam',
    ykeys: ['value_jml'],
    labels: ['Jumlah'],
    hideHover: 'auto',
    resize: false,
    lineColors: ['#0b62a4'],
    smooth: true,
    parseTime: false
});