refactored line chart to be more efficient

This commit is contained in:
jamespcole 2015-04-04 17:55:30 +11:00
parent 2576659923
commit a86c53236d

View File

@ -180,12 +180,16 @@
var currentDate = new Date(prevDate); var currentDate = new Date(prevDate);
currentDate.setMinutes(prevDate.getMinutes() + 1); currentDate.setMinutes(prevDate.getMinutes() + 1);
if(currentDate >= times[timeIndex] && timeIndex < times.length) { if(currentDate >= times[timeIndex] && timeIndex < times.length) {
//this is so we don't get jumps in the graph
var beforePoint = new Date(times[timeIndex]);
beforePoint.setSeconds(times[timeIndex].getSeconds() - 1)
data.push([beforePoint].concat(empty));
data.push([times[timeIndex]].concat(empty)); data.push([times[timeIndex]].concat(empty));
timeIndex++; timeIndex++;
} }
else { //else {
data.push([currentDate].concat(empty)); //data.push([currentDate].concat(empty));
} //}
prevDate = currentDate; prevDate = currentDate;
} }