@samira.2018
You can eliminate the past dataPoint values by comparing timestamps of individual dataPoints against the current time.
Kindly take a look at the code snippet below,
function addDps(chart){
var currentTime = new Date().getTime();
for (var i = 0; i < dps.length; i++) {
if((dps[i][4] >= 1527835332000)){
dataPoints1.push({
x: new Date(dps[i][4]),
y: parseFloat(dps[i][0])
});
dataPoints2.push({
x: new Date(dps[i][4]),
y: parseFloat(dps[i][1])
});
dataPoints3.push({
x: new Date(dps[i][4]),
y: parseFloat(dps[i][2])
});
dataPoints4.push({
x: new Date(dps[i][4]),
y: parseFloat(dps[i][3])
});
}
}
}
Please take a look at this JSfiddle for an example with complete code on displaying chart after removing all previous days data from current time.
__
Priyanka M S
Team CanvasJS