# Send csv to a line chart

**URL:** <https://discourse.nodered.org/t/send-csv-to-a-line-chart/87011>\
**Category:** General\
**Created:** [4 April 2024 12:39 UTC](https://discourse.nodered.org/t/send-csv-to-a-line-chart/87011 "2024-04-04T12:39:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AleksDeco](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@AleksDeco](https://discourse.nodered.org/u/AleksDeco)\
**Post date:** [4 April 2024 12:39 UTC](https://discourse.nodered.org/t/send-csv-to-a-line-chart/87011/1 "2024-04-04T12:39:22Z")

</div>

Can someone tell me how can I pass now that .csv file and make a line chart with those values? can't find what function has to be writen. I guess somehow I have to define what goes on Y and what on X axies?

---

<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:** [4 April 2024 20:30 UTC](https://discourse.nodered.org/t/send-csv-to-a-line-chart/87011/2 "2024-04-04T20:30:51Z")

</div>

You don't state where this chart should be displayed.  
I will assume the dashboard based on angular js.

if you read the help text for node-red-dashboard there is a link which explains the ui-chart node input data formats [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)

You can use the csv node to create the x,y data, and a change node to create the payload array required, You do not need to write a function.

Example

```auto
[{"id":"172551ac1ab40d8a","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":620,"y":6480,"wires":[["e85cbb7a796aa2ba"]]},{"id":"e85cbb7a796aa2ba","type":"template","z":"d1395164b4eec73e","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Time,Sensor\n1,16.259131946983107\n2,1.8228218735890755\n3,6.438627499528648\n4,25.768787339859813\n5,15.26994772882604\n6,39.88063722918977","output":"str","x":760,"y":6480,"wires":[["e0bbe0e97189e340"]]},{"id":"e0bbe0e97189e340","type":"csv","z":"d1395164b4eec73e","name":"","sep":",","hdrin":false,"hdrout":"none","multi":"mult","ret":"\\n","temp":"x,y","skip":"1","strings":true,"include_empty_strings":"","include_null_values":"","x":890,"y":6480,"wires":[["847ba43560e0c73c"]]},{"id":"847ba43560e0c73c","type":"change","z":"d1395164b4eec73e","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"temp","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"[{\"series\":[\"readings\"],\"data\":[]}]","tot":"json"},{"t":"move","p":"temp","pt":"msg","to":"payload[0].data[0]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1020,"y":6480,"wires":[["e6abb1e4cfa61499"]]},{"id":"e6abb1e4cfa61499","type":"debug","z":"d1395164b4eec73e","name":"debug 2488","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1170,"y":6480,"wires":[]}]

```

P.S I moved this to its own topic as it really is a different question

---

<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:** [3 July 2024 20:31 UTC](https://discourse.nodered.org/t/send-csv-to-a-line-chart/87011/3 "2024-07-03T20:31:12Z")

</div>

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