Home forums Feature Requests & Feedback Activity timeline chart Reply To: Activity timeline chart

#14465

isuru
Member

jQuery(document).ready(function () {

jQuery(“.btn-fleet-enq-view”).click(function () {
var fdate = jQuery(“#FrmDate”).val();
var todate = jQuery(‘#ToDate’).val();
jQuery.ajax({
type: “GET”,
url: “/FleetEnquiry/FleetAllocationDaily”,
data: { fdate: fdate ,todate: todate,},
contentType: “application/json;charset=utf-8”,
dataType: “json”,
success: function (result) {

if (result.login == true) {
if (result.success == true) {

loadFleedEnq(result.data);

} else {

}
} else {
Logout();
}
}
});
});

jQuery(‘#FrmDate’).datepicker({ maxDate: new Date(), dateFormat: “dd/M/yy” });
jQuery(‘#ToDate’).datepicker({ maxDate: new Date(), dateFormat: “dd/M/yy” });

jQuery(‘#FrmDate’).val(getFormatedDate(getMonthAgoMonth(new Date())));
jQuery(‘#ToDate’).val(getFormatedDate(new Date()));

});
function loadFleedEnq(data) {
////alert(data);
//if (data.length > 0) {
//for (i = 0; i < data.length; i++) {
// data[i].mfd_frm_dt ;

//}

var chart = new CanvasJS.Chart(“chartContainer”,
{
title: {
text: “Fleet Allocation”
},
axisY: {
minimum: (new Date(2016, 0, 28, 11, 30, 00)).getTime(),
interval: (1 * 60 * 60 * 1000),
labelFormatter: function (e) {
return CanvasJS.formatDate(e.value, “DD-MMM-YY h:mm:ss TT”);
},
gridThickness: 2

},
axisX: {

reversed: true
},

toolTip: {
contentFormatter: function (e) {

return “” + e.entries[0].dataPoint.label + “</br> Start: ” + CanvasJS.formatDate(e.entries[0].dataPoint.y[0], “DD-MMM-YY h:mm:ss TT”) + “</br>End : ” + CanvasJS.formatDate(e.entries[0].dataPoint.y[1], “DD-MMM-YY h:mm:ss TT”);
}
},

data: [
{
type: “rangeBar”,
dataPoints: [

{ label: “Walking”, y: [(new Date(2015, 0, 28, 12, 20, 00)).getTime(), (new Date(2016, 0, 28, 13, 00, 00)).getTime()] }

]
}
]
});
chart.render();

}

that’s my whole code and loadFleedEnq(data) that part I parse two dates for date range and one string for label

{ label: “Walking”, y: [(new Date(2015, 0, 28, 12, 20, 00)).getTime(), (new Date(2016, 0, 28, 13, 00, 00)).getTime()] }
but I can’t parse here to these data