# CSV to graph issues

**URL:** <https://discourse.nodered.org/t/csv-to-graph-issues/88574>\
**Category:** General\
**Created:** [9 June 2024 10:38 UTC](https://discourse.nodered.org/t/csv-to-graph-issues/88574 "2024-06-09T10:38:03Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tomtom](https://avatars.discourse-cdn.com/v4/letter/t/a9a28c/32.png) [@Tomtom](https://discourse.nodered.org/u/Tomtom)\
**Post date:** [9 June 2024 10:38 UTC](https://discourse.nodered.org/t/csv-to-graph-issues/88574/1 "2024-06-09T10:38:03Z")

</div>

Hi everyone;  
I'm struggling to convert my CSV into a graph.

**My CSV contains:**  
01-06-2024;evt r�elle;9;18�785;0;18�432  
02-06-2024;evt r�elle;9;18�785;0;18�432

**After passing to a CSV output I am getting an array:**  
[{"Date":"01-06-2024","EStimation":"evt r�elle","HC":9,"index":"18�432","HP":0},{"Date":"02-06-2024","EStimation":"evt r�elle","HC":9,"index":"18�432","HP":0}]

**Then I am sending the ouput to a function found on this forum:**

```auto
var payload=msg.payload;
var data_out=[];
var a1=[];

for(let i=0;i<payload.length;i++)
{
var temp1={ "Date":( payload[i]["Date"]), "HC":( payload[i]["HC"]) };
a1.push(temp1);
}

data_out=[a1];
msg.payload=[{
"series": ["esp"],
"data":data_out,
"labels": ["01"]
}];

```

return msg;

This is however not working; what am I doing wrong?  
Thanks a lot

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [9 June 2024 10:53 UTC](https://discourse.nodered.org/t/csv-to-graph-issues/88574/2 "2024-06-09T10:53:02Z")

</div>

What does the output of the function look like in a debug node?

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [9 June 2024 11:28 UTC](https://discourse.nodered.org/t/csv-to-graph-issues/88574/3 "2024-06-09T11:28:03Z")

</div>

You are not really clear as to what graph you are using. I am going to assume a line chart is node-red-dashboard.

Here is an example of how to output data from csv node as required to use in chart data object.

```auto
[{"id":"9e7d7547ede9f79c","type":"function","z":"d1395164b4eec73e","name":"function 157","func":"msg.payload = [\n {\n \"series\": [\"esp\"],\n \"data\": [msg.payload],\n \"labels\": [\"01\"]\n }\n];\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":490,"y":4820,"wires":[["7abd2edc6b1e2666","66d463c2776d4ca1"]]},{"id":"88d137de0e5d533c","type":"csv","z":"d1395164b4eec73e","name":"","sep":";","hdrin":"","hdrout":"none","multi":"mult","ret":"\\n","temp":"x,,y","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":350,"y":4820,"wires":[["9e7d7547ede9f79c"]]},{"id":"7abd2edc6b1e2666","type":"debug","z":"d1395164b4eec73e","name":"debug 2557","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":4820,"wires":[]},{"id":"b445649bd2f367fc","type":"template","z":"d1395164b4eec73e","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"01-06-2024;evt r�elle;9;18�785;0;18�432\n02-06-2024;evt r�elle;9;18�785;0;18�432\n","output":"str","x":220,"y":4820,"wires":[["88d137de0e5d533c"]]},{"id":"cee711f66e85316a","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":80,"y":4820,"wires":[["b445649bd2f367fc"]]}]

```

[How to import/export a flow](https://nodered.org/docs/user-guide/editor/workspace/import-export)

---

<div class="post-metadata">

**Author:** ![Tomtom](https://avatars.discourse-cdn.com/v4/letter/t/a9a28c/32.png) [@Tomtom](https://discourse.nodered.org/u/Tomtom)\
**Post date:** [9 June 2024 13:18 UTC](https://discourse.nodered.org/t/csv-to-graph-issues/88574/4 "2024-06-09T13:18:08Z")

</div>

Thank you to both of you, I'm expecting to create a line chart with the following structure:

[{"labels":["01-06-2024","02-06-2024","..."],"series":["HP","HC"],"data":[[9,0],[9,0],[...,...]]}]  
where Date equal the first data in the CSV, HP being the 3rd and HC being the 5th.

How should I update the function to achieve this?  
Thx

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [9 June 2024 13:27 UTC](https://discourse.nodered.org/t/csv-to-graph-issues/88574/5 "2024-06-09T13:27:34Z")

</div>

Show us what it looks like at the moment, coming out of the function node, as I asked. So can see what is wrong with it.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [9 June 2024 13:32 UTC](https://discourse.nodered.org/t/csv-to-graph-issues/88574/6 "2024-06-09T13:32:57Z")

</div>

> [@Tomtom](#):
>
> [{"labels":["01-06-2024","02-06-2024","..."],"series":["HP","HC"],"data":[[9,0],[9,0],[...,...]]}]

That does not seem to be what is specified in the section Line Charts in the docs [node-red-dashboard/Charts.md at master · node-red/node-red-dashboard · GitHub](https://github.com/node-red/node-red-dashboard/blob/master/Charts.md)

---

<div class="post-metadata">

**Author:** ![Tomtom](https://avatars.discourse-cdn.com/v4/letter/t/a9a28c/32.png) [@Tomtom](https://discourse.nodered.org/u/Tomtom)\
**Post date:** [9 June 2024 13:35 UTC](https://discourse.nodered.org/t/csv-to-graph-issues/88574/7 "2024-06-09T13:35:34Z")

</div>

Sure, here is the node:

```auto
> [
> {
> "id": "9e7d7547ede9f79c",
> "type": "function",
> "z": "7f455c807e8e067e",
> "name": "function 157",
> "func": "msg.payload = [\n {\n \"series\": [\"serieA\", \"serieB\"],\n \"data\": [msg.payload],\n \"labels\": [\"01-06-2024\", \"02-06-2024\"]\n }\n];\nreturn msg;",
> "outputs": 1,
> "timeout": 0,
> "noerr": 0,
> "initialize": "",
> "finalize": "",
> "libs": [],
> "x": 590,
> "y": 1640,
> "wires": [
> [
> "7abd2edc6b1e2666",
> "4a9c7322d3ec95db"
> ]
> ]
> },
> {
> "id": "88d137de0e5d533c",
> "type": "csv",
> "z": "7f455c807e8e067e",
> "name": "",
> "sep": ";",
> "hdrin": "",
> "hdrout": "none",
> "multi": "mult",
> "ret": "\\n",
> "temp": ",,0,,1",
> "skip": "0",
> "strings": true,
> "include_empty_strings": "",
> "include_null_values": "",
> "x": 450,
> "y": 1640,
> "wires": [
> [
> "9e7d7547ede9f79c"
> ]
> ]
> },
> {
> "id": "7abd2edc6b1e2666",
> "type": "debug",
> "z": "7f455c807e8e067e",
> "name": "debug 2557",
> "active": true,
> "tosidebar": true,
> "console": false,
> "tostatus": false,
> "complete": "false",
> "statusVal": "",
> "statusType": "auto",
> "x": 750,
> "y": 1640,
> "wires": []
> },
> {
> "id": "b445649bd2f367fc",
> "type": "template",
> "z": "7f455c807e8e067e",
> "name": "",
> "field": "payload",
> "fieldType": "msg",
> "format": "handlebars",
> "syntax": "mustache",
> "template": "01-06-2024;evt r�elle;9;18�785;0;18�432\n02-06-2024;evt r�elle;11;18�785;0;18�432\n",
> "output": "str",
> "x": 320,
> "y": 1640,
> "wires": [
> [
> "88d137de0e5d533c"
> ]
> ]
> },
> {
> "id": "cee711f66e85316a",
> "type": "inject",
> "z": "7f455c807e8e067e",
> "name": "",
> "props": [
> {
> "p": "payload"
> },
> {
> "p": "topic",
> "vt": "str"
> }
> ],
> "repeat": "",
> "crontab": "",
> "once": false,
> "onceDelay": 0.1,
> "topic": "",
> "payload": "",
> "payloadType": "date",
> "x": 180,
> "y": 1640,
> "wires": [
> [
> "b445649bd2f367fc"
> ]
> ]
> },
> {
> "id": "4a9c7322d3ec95db",
> "type": "ui_chart",
> "z": "7f455c807e8e067e",
> "name": "",
> "group": "cc53c59073725950",
> "order": 3,
> "width": 0,
> "height": 0,
> "label": "chart",
> "chartType": "line",
> "legend": "false",
> "xformat": "Date-Month-Year",
> "interpolate": "linear",
> "nodata": "",
> "dot": false,
> "ymin": "",
> "ymax": "",
> "removeOlder": 1,
> "removeOlderPoints": "",
> "removeOlderUnit": "86400",
> "cutout": 0,
> "useOneColor": false,
> "useUTC": false,
> "colors": [
> "#1f77b4",
> "#aec7e8",
> "#ff7f0e",
> "#2ca02c",
> "#98df8a",
> "#d62728",
> "#ff9896",
> "#9467bd",
> "#c5b0d5"
> ],
> "outputs": 1,
> "useDifferentColor": false,
> "className": "",
> "x": 750,
> "y": 1700,
> "wires": [
> []
> ]
> },
> {
> "id": "cc53c59073725950",
> "type": "ui_group",
> "name": "Forecast de demain",
> "tab": "10b4df16bc5e110d",
> "order": 1,
> "disp": true,
> "width": "6",
> "collapse": false,
> "className": ""
> },
> {
> "id": "10b4df16bc5e110d",
> "type": "ui_tab",
> "name": "Remote App",
> "icon": "dashboard",
> "order": 1,
> "disabled": false,
> "hidden": false
> }
> ]

```

and here the outcomes of the debug:  
[{"series":["serieA","serieB"],"data":[[{"0":9,"1":0},{"0":11,"1":0}]],"labels":["01-06-2024","02-06-2024"]}]

but I had to put series and labels hard coded on the function, and not dynamic

---

<div class="post-metadata">

**Author:** ![Tomtom](https://avatars.discourse-cdn.com/v4/letter/t/a9a28c/32.png) [@Tomtom](https://discourse.nodered.org/u/Tomtom)\
**Post date:** [9 June 2024 13:52 UTC](https://discourse.nodered.org/t/csv-to-graph-issues/88574/8 "2024-06-09T13:52:19Z")

</div>

Here is the perfect debug node outcomes that I should be able to generate, unfortunately for the moment manually only:  
`[{"series":["HP","HC"],"data":[[9,10],[0,1]],"labels":["01-06-2024","02-06-2024"]}]`

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [9 June 2024 13:53 UTC](https://discourse.nodered.org/t/csv-to-graph-issues/88574/9 "2024-06-09T13:53:33Z")

</div>

> [@Colin](#):
>
> That does not seem to be what is specified in the section Line Charts in the docs

It is the non time series format Colin.

@Tomtom  
here is an example

```auto
[{"id":"cee711f66e85316a","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":5740,"wires":[["b445649bd2f367fc"]]},{"id":"b445649bd2f367fc","type":"template","z":"d1395164b4eec73e","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"01-06-2024;evt r�elle;9;18�785;0;18�432\n02-06-2024;evt r�elle;9;18�785;0;18�432\n","output":"str","x":240,"y":5740,"wires":[["88d137de0e5d533c"]]},{"id":"88d137de0e5d533c","type":"csv","z":"d1395164b4eec73e","name":"","sep":";","hdrin":"","hdrout":"none","multi":"mult","ret":"\\n","temp":"date,,HP,,HC","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":370,"y":5740,"wires":[["4674bc640d900596"]]},{"id":"4674bc640d900596","type":"function","z":"d1395164b4eec73e","name":"function 157","func":"msg.payload = [\n {\n \"labels\": msg.payload.map(obj => obj.date),\n \"series\": Object.keys(msg.payload[0]).slice(1),\n \"data\":msg.payload.map(obj => [obj.HC,obj.HP])\n }\n]\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":510,"y":5740,"wires":[["7abd2edc6b1e2666"]]},{"id":"7abd2edc6b1e2666","type":"debug","z":"d1395164b4eec73e","name":"debug 2557","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":710,"y":5740,"wires":[]}]

```

The csv node does some of the work cleaning up the output array.  
Then the function does the rest

```auto
msg.payload = [
       {
       "labels": msg.payload.map(obj => obj.date),
       "series": Object.keys(msg.payload[0]).slice(1),
       "data": msg.payload.map(obj => [obj.HC,obj.HP])
   }
]
return msg;

```

---

<div class="post-metadata">

**Author:** ![Tomtom](https://avatars.discourse-cdn.com/v4/letter/t/a9a28c/32.png) [@Tomtom](https://discourse.nodered.org/u/Tomtom)\
**Post date:** [9 June 2024 14:01 UTC](https://discourse.nodered.org/t/csv-to-graph-issues/88574/10 "2024-06-09T14:01:10Z")

</div>

Thanks E1cid !  
I am getting:  
`[{"labels":["01-06-2024","02-06-2024"],"series":["HP","HC"],"data":[[0,9],[1,9]]}]`

and would need 2 data to invert to get the chart display the 2 series in one set:  
`[{"labels":["01-06-2024","02-06-2024"],"series":["HP","HC"],"data":[[9,9],[0,0]]}]`

I shall invert some data in the function or os this requiring a new code?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [9 June 2024 14:01 UTC](https://discourse.nodered.org/t/csv-to-graph-issues/88574/11 "2024-06-09T14:01:15Z")

</div>

> [@E1cid](#):
>
> It is the non time series format Colin.

Can you have a non time series line chart?

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [9 June 2024 14:03 UTC](https://discourse.nodered.org/t/csv-to-graph-issues/88574/12 "2024-06-09T14:03:20Z")

</div>

> [@E1cid](#):
>
> `[obj.HC,obj.HP]`

THen reverse this section of code.  
Or supply an example flow with the data you feed it, as all your example formats are different, which causes confusion.

@colin, yes, according to the link you posted  
For non-timeseries data - for example data in labelled categories, rather than use x and y, the format should be as follows:

```auto
[{
    "series": ["X", "Y", "Z"],
    "data": [[5,6,9,10], [3,8,5,10], [6,7,2,10] ],
    "labels": ["Jan", "Feb", "Mar", "Apr"]
}]

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [9 June 2024 14:06 UTC](https://discourse.nodered.org/t/csv-to-graph-issues/88574/13 "2024-06-09T14:06:53Z")

</div>

Oh yes, I must be going blind.

---

<div class="post-metadata">

**Author:** ![Tomtom](https://avatars.discourse-cdn.com/v4/letter/t/a9a28c/32.png) [@Tomtom](https://discourse.nodered.org/u/Tomtom)\
**Post date:** [9 June 2024 14:10 UTC](https://discourse.nodered.org/t/csv-to-graph-issues/88574/14 "2024-06-09T14:10:06Z")

</div>

The function displays this yet  
 ![Capture d’écran 2024-06-09 160732](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/8/e830c40b797289843662c1433d05a4f08114b0ad.png)

I would like to transform it to this  
 ![Capture d’écran 2024-06-09 160836](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/c/0c25dd671312f997fb640ffbdc69739451d010e6.png)

Sorry if It created confusion, my experience in function is very limited ☹  
I tried to revert but than it just turns the problem the other way around

Shall I post the code of the first chart?

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [9 June 2024 14:10 UTC](https://discourse.nodered.org/t/csv-to-graph-issues/88574/15 "2024-06-09T14:10:58Z")

</div>

> [@Tomtom](#):
>
> I'm expecting to create a line chart

You said line chart, you must of selected bar chart in chart node config.  
Again please supply flow with csv data added and your desired output array for the supplied csv data.

---

<div class="post-metadata">

**Author:** ![Tomtom](https://avatars.discourse-cdn.com/v4/letter/t/a9a28c/32.png) [@Tomtom](https://discourse.nodered.org/u/Tomtom)\
**Post date:** [9 June 2024 14:26 UTC](https://discourse.nodered.org/t/csv-to-graph-issues/88574/16 "2024-06-09T14:26:31Z")

</div>

Yes I made it wrong, it is bar chart and not line sorry.

The CSV is  
01-06-2024;evt r�elle;9;18�785;1;18�432  
02-06-2024;evt r�elle;11;18�785;2;18�432

CSV column as you proposed  
date,,HP,,HC

and the expected output (but that I am not able to code completely), this is static data only.  
Your last flow was very close, it just need to make all HP data in the first array, and all HC in the second array

```auto
msg.payload = [
    {
        "series": ["HP", "HC"],
        "data": [[9,11],[1,2]],
        "labels": ["01-06-2024", "02-06-2024"]
    }
];
return msg;

```

```auto

[
    {
        "id": "83c3799b1c851f40",
        "type": "inject",
        "z": "7f455c807e8e067e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 170,
        "y": 1760,
        "wires": [
            [
                "7d785165f1c9eb88"
            ]
        ]
    },
    {
        "id": "7d785165f1c9eb88",
        "type": "template",
        "z": "7f455c807e8e067e",
        "name": "",
        "field": "payload",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "01-06-2024;evt r�elle;9;18�785;0;18�432\n02-06-2024;evt r�elle;9;18�785;1;18�432\n",
        "output": "str",
        "x": 310,
        "y": 1760,
        "wires": [
            [
                "08072baccbcad56b"
            ]
        ]
    },
    {
        "id": "08072baccbcad56b",
        "type": "csv",
        "z": "7f455c807e8e067e",
        "name": "",
        "sep": ";",
        "hdrin": "",
        "hdrout": "none",
        "multi": "mult",
        "ret": "\\n",
        "temp": "date,,HP,,HC",
        "skip": "0",
        "strings": true,
        "include_empty_strings": "",
        "include_null_values": "",
        "x": 440,
        "y": 1760,
        "wires": [
            [
                "9295367f0335e171"
            ]
        ]
    },
    {
        "id": "9295367f0335e171",
        "type": "function",
        "z": "7f455c807e8e067e",
        "name": "function 157",
        "func": "//msg.payload =Object.keys(msg.payload[0]);\n//return msg;\n\nmsg.payload = [\n {\n \"labels\": msg.payload.map(obj => obj.date),\n \"series\": Object.keys(msg.payload[0]).slice(1),\n \"data\":msg.payload.map(obj => [obj.HP,obj.HC])\n }\n]\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 580,
        "y": 1760,
        "wires": [
            [
                "907aea81164f131f",
                "e1a8b48642b5c44e"
            ]
        ]
    },
    {
        "id": "907aea81164f131f",
        "type": "debug",
        "z": "7f455c807e8e067e",
        "name": "debug 2557",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 780,
        "y": 1760,
        "wires": []
    },
    {
        "id": "e1a8b48642b5c44e",
        "type": "ui_chart",
        "z": "7f455c807e8e067e",
        "name": "",
        "group": "cc53c59073725950",
        "order": 3,
        "width": 0,
        "height": 0,
        "label": "chart",
        "chartType": "bar",
        "legend": "false",
        "xformat": "Date-Month-Year",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "",
        "ymax": "",
        "removeOlder": 1,
        "removeOlderPoints": "",
        "removeOlderUnit": "86400",
        "cutout": 0,
        "useOneColor": false,
        "useUTC": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "outputs": 1,
        "useDifferentColor": false,
        "className": "",
        "x": 750,
        "y": 1820,
        "wires": [
            []
        ]
    },
    {
        "id": "cc53c59073725950",
        "type": "ui_group",
        "name": "Forecast de demain",
        "tab": "10b4df16bc5e110d",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "10b4df16bc5e110d",
        "type": "ui_tab",
        "name": "Remote App",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

```

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [9 June 2024 14:34 UTC](https://discourse.nodered.org/t/csv-to-graph-issues/88574/17 "2024-06-09T14:34:34Z")

</div>

The output you have shown is impossible as the input does not match, all your example are different, which leads to confusion

But this may be it, reading between the lines.

```auto
[{"id":"83c3799b1c851f40","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":80,"y":5880,"wires":[["7d785165f1c9eb88"]]},{"id":"7d785165f1c9eb88","type":"template","z":"d1395164b4eec73e","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"01-06-2024;evt r�elle;9;18�785;1;18�432\n02-06-2024;evt r�elle;10;18�785;2;18�432\n","output":"str","x":220,"y":5880,"wires":[["08072baccbcad56b"]]},{"id":"08072baccbcad56b","type":"csv","z":"d1395164b4eec73e","name":"","sep":";","hdrin":"","hdrout":"none","multi":"mult","ret":"\\n","temp":"date,,HP,,HC","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":350,"y":5880,"wires":[["9295367f0335e171"]]},{"id":"9295367f0335e171","type":"function","z":"d1395164b4eec73e","name":"function 157","func":"//msg.payload =Object.keys(msg.payload[0]);\n//return msg;\n\nmsg.payload = [\n {\n \"labels\": msg.payload.map(obj => obj.date),\n \"series\": Object.keys(msg.payload[0]).slice(1),\n \"data\":[msg.payload.map(obj => obj.HP),msg.payload.map(obj => obj.HC)]\n }\n]\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":490,"y":5880,"wires":[["907aea81164f131f"]]},{"id":"907aea81164f131f","type":"debug","z":"d1395164b4eec73e","name":"debug 2557","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":690,"y":5880,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![Tomtom](https://avatars.discourse-cdn.com/v4/letter/t/a9a28c/32.png) [@Tomtom](https://discourse.nodered.org/u/Tomtom)\
**Post date:** [9 June 2024 14:44 UTC](https://discourse.nodered.org/t/csv-to-graph-issues/88574/18 "2024-06-09T14:44:32Z")

</div>

🙏 YESSSS !!!  
Many thanks, this is exactly what I needed.  
Sorry for my confusing explanations and thank you for your patience !!  
All the best

---

<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:** [7 September 2024 14:44 UTC](https://discourse.nodered.org/t/csv-to-graph-issues/88574/19 "2024-09-07T14:44:46Z")

</div>

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