# Node red with MariaDB RPI formatting issues

**URL:** <https://discourse.nodered.org/t/node-red-with-mariadb-rpi-formatting-issues/71413>\
**Category:** General\
**Created:** [29 November 2022 02:09 UTC](https://discourse.nodered.org/t/node-red-with-mariadb-rpi-formatting-issues/71413 "2022-11-29T02:09:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![HobbyFarmer](https://avatars.discourse-cdn.com/v4/letter/h/779978/32.png) [@HobbyFarmer](https://discourse.nodered.org/u/HobbyFarmer)\
**Post date:** [29 November 2022 02:09 UTC](https://discourse.nodered.org/t/node-red-with-mariadb-rpi-formatting-issues/71413/1 "2022-11-29T02:09:02Z")

</div>

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.

```auto
{"id":1,"ts":"2022-11-28T04:10:20.000Z","masterTemp":"23.4","masterHum":"41","dateInt":null}

```

This displays only the time see screen shot.  
 ![Capture](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/b/1bfbaa5216ebc3a18d499a48c1c38b1ef89be4e7.png)

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.

```auto
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

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

```

but that doesn't work.

---

<div class="post-metadata">

**Author:** ![HobbyFarmer](https://avatars.discourse-cdn.com/v4/letter/h/779978/32.png) [@HobbyFarmer](https://discourse.nodered.org/u/HobbyFarmer)\
**Post date:** [29 November 2022 05:16 UTC](https://discourse.nodered.org/t/node-red-with-mariadb-rpi-formatting-issues/71413/2 "2022-11-29T05:16:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [29 November 2022 07:56 UTC](https://discourse.nodered.org/t/node-red-with-mariadb-rpi-formatting-issues/71413/3 "2022-11-29T07:56:15Z")

</div>

Welcome back ! Indeed been a long while

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [13 December 2022 07:57 UTC](https://discourse.nodered.org/t/node-red-with-mariadb-rpi-formatting-issues/71413/4 "2022-12-13T07:57:07Z")

</div>

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