I am using morris line chart i want to show 7 days clients registration in chart but MON and Tue is not displaying in my chart. Please let know how can i fix this.
I want to show weekdays like this chart.
Morris.Line({
element: 'myfirstchart',
data: [{
"period": "2018-02-26",
"total": 4
},
{
"period": "2018-02-27",
"total": 2
},
{
"period": "2018-02-28",
"total": 5
},
{
"period": "2018-03-01",
"total": 9
},
{
"period": "2018-03-02",
"total": 15
},
{
"period": "2018-03-03",
"total": 12
}
],
lineColors: ['#f5901a', '#fc8710', '#FF6541', '#A4ADD3', '#766B56'],
xkey: 'period',
ykeys: ['total'],
labels: ['Total'],
xLabels: 'day',
xLabelAngle: 90,
xLabelFormat: function(d) {
var weekdays = new Array(7);
weekdays[0] = "MON";
weekdays[1] = "TUE";
weekdays[2] = "WED";
weekdays[3] = "THU";
weekdays[4] = "FRI";
weekdays[5] = "SAT";
weekdays[6] = "SUN";
return weekdays[d.getDay() - 1] + '-' +
("0" + (d.getMonth() + 1)).slice(-2) + '-' +
("0" + (d.getDate())).slice(-2);
},
resize: true
});
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.min.js"></script>
<div id="chart_div" style="width: 100%; height: 300px;">
<div class="chart-title">Client Registrations</div>
<div id="myfirstchart" style="height: 250px;"></div>
</div>