# Multiple line chart instructions

**URL:** https://discourse.nodered.org/t/multiple-line-chart-instructions/75932
**Category:** Dashboard
**Tags:** chart
**Created:** [1 March 2023 12:24 UTC](https://discourse.nodered.org/t/multiple-line-chart-instructions/75932 "2023-03-01T12:24:19Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Sekuti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sekuti/32/107159_2.png) [@Sekuti](https://discourse.nodered.org/u/Sekuti)
#### Post date: [1 March 2023 12:24 UTC](https://discourse.nodered.org/t/multiple-line-chart-instructions/75932/1 "2023-03-01T12:24:19Z")

</div>

Hello,  
I am new to node red and I have problems creating simple multiple line chart. I red many examples and watch a lot of videos and I still dont know what I am doing wrong. I came so far that I am getting data to chart but only as a point. There is no real time x axis.

My code:

```auto
var l1 = msg.payload.L1; //get payload
var l2 = msg.payload.L2;
var l3 = msg.payload.L3;

var Napetost1 = [{
   "series": ["L1"],
    "data": [l1],
    "labels": [""],
}];
var Napetost2 = [{
    "series": ["L2"],
    "data": [l2],
    "labels": [""],
}];
var Napetost2 = [{
    "series": ["L3"],
    "data": [l3],
    "labels": [""],
}];
msg.payload = [{
    "series": ["L1", "L2", "L3"], 
    "data": [[l1], [l2], [l3]], 
    "labels": [""] }]
return msg;

```

Please if any one can tell me what I missed in all instructions I read.

br  
Aleksander

---

<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: [1 March 2023 12:30 UTC](https://discourse.nodered.org/t/multiple-line-chart-instructions/75932/2 "2023-03-01T12:30:36Z")

</div>

Is this a live chart or historical data?  
What is the contents of msg.payload?

---

<div class="post-metadata">

### Author: ![Sekuti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sekuti/32/107159_2.png) [@Sekuti](https://discourse.nodered.org/u/Sekuti)
#### Post date: [1 March 2023 12:32 UTC](https://discourse.nodered.org/t/multiple-line-chart-instructions/75932/3 "2023-03-01T12:32:25Z")

</div>

...It is a live chart. Data is from S7 node.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/7/77f125f1c122c13bde657cb007a035b0106e2539.png)

---

<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: [1 March 2023 12:33 UTC](https://discourse.nodered.org/t/multiple-line-chart-instructions/75932/4 "2023-03-01T12:33:05Z")

</div>

Is there a reason you only answered one question?

---

<div class="post-metadata">

### Author: ![Sekuti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sekuti/32/107159_2.png) [@Sekuti](https://discourse.nodered.org/u/Sekuti)
#### Post date: [1 March 2023 12:36 UTC](https://discourse.nodered.org/t/multiple-line-chart-instructions/75932/5 "2023-03-01T12:36:48Z")

</div>

... sorry, but I am not sure what you mean. I collect data from siemens PLC and I am trying to show them in chart. Data from PLC are

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/9/f95d6f866eff865442f0718c381ea27f6829d71b.png)

---

<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: [1 March 2023 12:37 UTC](https://discourse.nodered.org/t/multiple-line-chart-instructions/75932/6 "2023-03-01T12:37:47Z")

</div>

> [@Sekuti](#):
>
> ```auto
> var l1 = msg.payload.L1; //get payload
> var l2 = msg.payload.L2;
> var l3 = msg.payload.L3;
> 
> ```

I mean the payload going into the function node as above.

---

<div class="post-metadata">

### Author: ![Sekuti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sekuti/32/107159_2.png) [@Sekuti](https://discourse.nodered.org/u/Sekuti)
#### Post date: [1 March 2023 12:39 UTC](https://discourse.nodered.org/t/multiple-line-chart-instructions/75932/7 "2023-03-01T12:39:51Z")

</div>

... so payload datas are variables of type "Real", I get them from S7 PLC. ?

---

<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: [1 March 2023 12:40 UTC](https://discourse.nodered.org/t/multiple-line-chart-instructions/75932/8 "2023-03-01T12:40:35Z")

</div>

If you do not give the contents of msg.payload I can not help.

---

<div class="post-metadata">

### Author: ![Sekuti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sekuti/32/107159_2.png) [@Sekuti](https://discourse.nodered.org/u/Sekuti)
#### Post date: [1 March 2023 12:42 UTC](https://discourse.nodered.org/t/multiple-line-chart-instructions/75932/9 "2023-03-01T12:42:46Z")

</div>

... I realy dont understant what you need, can you show me example, or tell me what to copy?

---

<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: [1 March 2023 12:45 UTC](https://discourse.nodered.org/t/multiple-line-chart-instructions/75932/10 "2023-03-01T12:45:27Z")

</div>

I require the contents of msg.payload, stick a debug on the s7 node and copy the contents using the copy value button,. Read [here](https://nodered.org/docs/user-guide/messages#understanding-the-structure-of-a-message) for more info on copying values

Please help us help you by reading the documentation and getting a basic understanding of how node-red works.

---

<div class="post-metadata">

### Author: ![Sekuti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sekuti/32/107159_2.png) [@Sekuti](https://discourse.nodered.org/u/Sekuti)
#### Post date: [1 March 2023 12:47 UTC](https://discourse.nodered.org/t/multiple-line-chart-instructions/75932/11 "2023-03-01T12:47:17Z")

</div>

...  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/7/0795ccf6cafeb9431f7f086d5d44a6a4d604c337.png)

---

<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: [1 March 2023 12:48 UTC](https://discourse.nodered.org/t/multiple-line-chart-instructions/75932/12 "2023-03-01T12:48:45Z")

</div>

Help us help you and provide what i asked for in the format i ask. I need you to use the copy value icon, read what i asked you to read, and provide the data as text.

---

<div class="post-metadata">

### Author: ![Sekuti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sekuti/32/107159_2.png) [@Sekuti](https://discourse.nodered.org/u/Sekuti)
#### Post date: [1 March 2023 12:51 UTC](https://discourse.nodered.org/t/multiple-line-chart-instructions/75932/13 "2023-03-01T12:51:16Z")

</div>

...following payload from function to chart  
[{"series":["L1","L2","L3"],"data":[225,235,229],"labels":[""]}]  
...folowing payload from s7 to function  
{"I1":1,"I2":2,"I3":3,"L1":225,"L2":235,"L3":232}

---

<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: [1 March 2023 12:54 UTC](https://discourse.nodered.org/t/multiple-line-chart-instructions/75932/14 "2023-03-01T12:54:57Z")

</div>

example with your incoming payload.

```auto
[{"id":"79e0b5a157701d91","type":"inject","z":"65617ffeb779f51c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"I1\":1,\"I2\":2,\"I3\":3,\"L1\":225,\"L2\":235,\"L3\":232}","payloadType":"json","x":110,"y":540,"wires":[["92ce61da44348d5e"]]},{"id":"92ce61da44348d5e","type":"change","z":"65617ffeb779f51c","name":"","rules":[{"t":"delete","p":"payload.I1","pt":"msg"},{"t":"delete","p":"payload.I2","pt":"msg"},{"t":"delete","p":"payload.I3","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":580,"wires":[["d4e7fd40495eac8b"]]},{"id":"d4e7fd40495eac8b","type":"split","z":"65617ffeb779f51c","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"topic","x":450,"y":580,"wires":[["c1b0021ca796317f"]]},{"id":"c1b0021ca796317f","type":"debug","z":"65617ffeb779f51c","name":"chart","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":596,"y":688,"wires":[]}]

```

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

---

<div class="post-metadata">

### Author: ![Sekuti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sekuti/32/107159_2.png) [@Sekuti](https://discourse.nodered.org/u/Sekuti)
#### Post date: [1 March 2023 13:03 UTC](https://discourse.nodered.org/t/multiple-line-chart-instructions/75932/15 "2023-03-01T13:03:34Z")

</div>

... sorry but can you explain what did you sent and where I should copy this?

---

<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: [1 March 2023 13:05 UTC](https://discourse.nodered.org/t/multiple-line-chart-instructions/75932/16 "2023-03-01T13:05:03Z")

</div>

See link provided.

Again please read the documentation and watch the videos, it will make using node-red and asking for help much easier.

---

<div class="post-metadata">

### Author: ![Sekuti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sekuti/32/107159_2.png) [@Sekuti](https://discourse.nodered.org/u/Sekuti)
#### Post date: [1 March 2023 13:13 UTC](https://discourse.nodered.org/t/multiple-line-chart-instructions/75932/17 "2023-03-01T13:13:16Z")

</div>

...like I said I am a beginer in node red. I read I lot about it but one is theory and other is practical usage. I manage to import your flow. Thank you. I will test it.  
Thank you again.

---

<div class="post-metadata">

### Author: ![Sekuti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sekuti/32/107159_2.png) [@Sekuti](https://discourse.nodered.org/u/Sekuti)
#### Post date: [1 March 2023 13:22 UTC](https://discourse.nodered.org/t/multiple-line-chart-instructions/75932/18 "2023-03-01T13:22:22Z")

</div>

... tested. Working!

Thank you again.

---

<div class="post-metadata">

### Author: ![mudwalker](https://avatars.discourse-cdn.com/v4/letter/m/47e85d/32.png) [@mudwalker](https://discourse.nodered.org/u/mudwalker)
#### Post date: [1 March 2023 16:19 UTC](https://discourse.nodered.org/t/multiple-line-chart-instructions/75932/19 "2023-03-01T16:19:08Z")

</div>

As a 'Beginner' it would be well worth you watching this playlist: [Node-RED Essentials](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6). The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

---

<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: [31 March 2023 16:19 UTC](https://discourse.nodered.org/t/multiple-line-chart-instructions/75932/20 "2023-03-31T16:19:28Z")

</div>

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