# How to graph a table with date label

**URL:** <https://discourse.nodered.org/t/how-to-graph-a-table-with-date-label/59400>\
**Category:** Dashboard\
**Created:** [5 March 2022 16:14 UTC](https://discourse.nodered.org/t/how-to-graph-a-table-with-date-label/59400 "2022-03-05T16:14:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![solarflor](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@solarflor](https://discourse.nodered.org/u/solarflor)\
**Post date:** [5 March 2022 16:14 UTC](https://discourse.nodered.org/t/how-to-graph-a-table-with-date-label/59400/1 "2022-03-05T16:14:46Z")

</div>

Hi,  
sorry, I'm new in Node-Red and to be honest I'm also new in Javascript but ....  
... I want to learn.

I would like to display in a dashboard some power values vs time.  
I have cretare a MariaDB table like the one below:

 ![Image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/a/5a3ef4d1bf9d25528119657ce3cedbc2c71c46dc.jpeg)

I'm able to see the Y values but not the X (date) ones.

It seems I cannot upload the flow but below the function I create to do that:

```auto
var data = [];
var label = [];
msg.payload.forEach(function(value) {
    data.push(value['Power']);
    label.push(value['Time']);
});
msg.payload = [{
    series: "",
    data: [data],
    labels: [label]
}];
return msg;

```

but the result is very disappointing.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/5/85042349112be181d5ad07fe8d89a62536d462fc.png)

If I replace labels with

labels: [1,2,3,4,5,6,7,8,9,10,11,12,13,14]

the results is much e better but I would like to see the time in X and not some fixed values

Any support is welcome.  
Grazie

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [6 March 2022 08:52 UTC](https://discourse.nodered.org/t/how-to-graph-a-table-with-date-label/59400/2 "2022-03-06T08:52:57Z")

</div>

See the [chart documentation](https://github.com/node-red/node-red-dashboard/blob/master/Charts.md) it requires a specific format for x,y.

---

<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:** [5 April 2022 08:53 UTC](https://discourse.nodered.org/t/how-to-graph-a-table-with-date-label/59400/3 "2022-04-05T08:53:27Z")

</div>

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