Third day I'm trying to get data from json without errors with google timeline chart. I thought it should worked, but i've got an error <text> attribute x: Expected length, "NaN".
There is a problem part <g><text text-anchor="middle" x="NaN" y="21.05" font-family="Arial" font-size="13" stroke="none" stroke-width="0" fill="#000000"> </text></g>
There is my chart with ajax-call to data:
var data = [];
$.ajax({
url: "/api/reports/6/linestatus",
dataType: "json",
success: function (jsonData) {
for (var i = 0; i < jsonData.length; i++) {
startTime = new Date(jsonData[i].dateStart);
startHours = startTime.getHours();
startMinutes = startTime.getMinutes();
startSeconds = startTime.getSeconds();
endTime = new Date(jsonData[i].dateEnd);
endHours = endTime.getHours();
endMinutes = endTime.getMinutes();
endSeconds = endTime.getSeconds();
console.log(data);
data.push(
[jsonData[i].lineName.toString(), jsonData[i].status.toString(), new Date(0, 0, 0, startHours, startMinutes, startSeconds), new Date(0, 0, 0, endHours, endMinutes, endSeconds)]
);
}
}
})
dataTable.addRows(data);
My JSON data:
[{
"lineId": 6,
"lineName": "Line 1",
"status": 2,
"dateStart": "2017-08-03T15:10:20.42",
"dateEnd": "2017-08-03T15:10:23.353"
}]
Sorry for much code. =\ Thank you.