Node red with MariaDB RPI formatting issues

Hi it's been awhile since I haunted this forum... been busy I guess. I am working with an IOT device sending temp and humidity to NR through an MQTT server on my Raspberry Pi. I am using Node red to put this into a table on a MariaDB on the Pi from there I am trying to bring that info back to a graph in NR. I have gotten most of it working as I like except the graph when I bring it back from MariaDB. The data comes back like this.


This displays only the time see screen shot.

I think this is due to the "T" and the "Z" in the string but I'm not sure and I am stumped with removing it.

This is the code that is looping through the data and prepping it for the chart input.

var series1 = [];
var series2 = [];

//loop each row and build an array in the required format
for (let index = 0; index < msg.payload.length; index++) {
    const e = msg.payload[index];
    //var t = new Date(e.ts).valueOf()
    var t = new Date(e.ts).valueOf();
    series1.push({ "x": t, "y": e.masterTemp });
    series2.push({ "x": t, "y": e.masterHum });

msg.payload = [
        "series": ["temp", "humidity"],
        "data":   [series1,series2],
        "labels": [""]

return msg;

EDIT: I tried something like

var t = e.ts.replace(/T/, ' ');

but that doesn't work.

1 Like

SOOOO it was a graph setting to Auto scale :roll_eyes: howw dumb is that!


Welcome back ! Indeed been a long while

1 Like

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