Chart timestamp

hello , i'm posting data from a csv file into chart with timestamp for X-axis and data values for Y-axis
everything went well after i discovered that when the date of the new data value is far from the date of the previous data X-axis shows 00:00:00 for the rest of the next data
help !
image
image

Are you sending all the data to the chart in one message? If so you need to format the data as described in the docs under the section Stored Data. Alternatively you can split the data into single messages, one for each timestamp, and send the data to the chart in the form (also described in the docs)
{topic:"temperature", payload:43.9, timestamp:1520527095000}
where the timestamp is the javascript timestamp representing the date/time from your data.

yes sir i did all that that's not the problem
image
the problem is when there is a range of time between the 5th and 6th lines
image
then it will not show timestamp anymore and becomes 00:00:00
image

You need to show us the data you are sending to the chart, not what is coming out of the database, or wherever it comes from.

function toTimestamp(strDate){
    var datum = Date.parse(strDate);
    return datum;
    }
var payload=msg.payload;
var data_out=[];
var a1=[];
for(let i=0;i<payload.length;i++)
{
    var Dates= payload[i].Dates;
    var timestamp=toTimestamp(Dates+" "+payload[i]["Time"]);
    var temp1={ "x": timestamp, "y": payload[i]["Temperature"] };
    a1.push(temp1);
}
data_out= [a1] ;
msg.payload=[{

    "series": ["Temperature"],
    "data":data_out,
    "labels": ["Temperature"]    
}];

return msg;
    

    
    
}
    

Add a debug node showing what is going to the chart please and expand enough so we can see what is there in the area that fails.

Are you using the latest version of node-red-dashboard? Check in Manage Palette to find out.

image
yes it's the latest version

Do you realise that all those timestamps are in the future (30th May) and the last three in the table you posted at the start are a month in the future (30th June)? The reason it is showing timestamps of 00:00:00 is that they are midnight and each division is a day.

i understand but why it keeps showing 00:00:00(mid-night) in each division even after passing that time, i want the data time back

Because you have a months worth of data on the chart, it can only show a few timestamps across the chart and can only show one time scale every ten days or so.

How are you getting temperature readings for a month in the future? Do you have a time machine?

it's just an example i'm not trying to get data from the future i just wanna save data in the csv file when ever i want and not have this timestamp 00:00:00 problem
for example i'm saving data in the csv file today but i'm gonna save the next data 2 days later and when i'm posting data in the chart this probleme came in

so can i change the division of the chart the same as the date of the data ?

I don't understand what you mean. You are giving the chart data where the last point is more than a month later than the first. Can you sketch an example of what you want the chart to look like?

[Edit] If you only want the chart to show the last day's data (for example) then only give it the last day's values.

It's going to depend on the range of times or dates you're expecting the chart to cover. If you are sending data covering many days then the chart won't be able to show divisions down to hours or minutes. If you are only sending a few hours of data you'll get much finer time divisions. It wouldn't make sense, or be practical, to show hours and minutes in one part and dates in another.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.