我试图用每日统计数据显示折线图。但X轴上的日期似乎在重复。
Link to image
以下是折线图的代码:
new Morris.Line({
element: 'chart',
data: [ @foreach($Data as $data)
{ date: '{{$data['date']}}', value: {{$data['diff']}}},
@endforeach
],
xkey: ['date'],
xLabelFormat: function(date) {
return date.getFullYear() + '/' + (date.getMonth()+1)+ '/' + date.getDate();
},
xLabelAngle : 50,
ykeys: ['value'],
labels: ['Value'],
resize: true,
smooth: true,
lineColors: ['#9ec628'],
dateFormat: function(date) {
date = new Date(date);
return date.getFullYear()+ '/' + (date.getMonth()+1)+ '/' + date.getDate();
},
});
I also tried parseTime: false but that's not helping.