# Chart with multiple lines

**URL:** <https://discourse.nodered.org/t/chart-with-multiple-lines/35338>\
**Category:** Dashboard\
**Created:** [4 November 2020 18:50 UTC](https://discourse.nodered.org/t/chart-with-multiple-lines/35338 "2020-11-04T18:50:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![marwa4](https://avatars.discourse-cdn.com/v4/letter/m/7feea3/32.png) [@marwa4](https://discourse.nodered.org/u/marwa4)\
**Post date:** [4 November 2020 18:50 UTC](https://discourse.nodered.org/t/chart-with-multiple-lines/35338/1 "2020-11-04T18:50:12Z")

</div>

Hello everyone,  
I’m trying to show two graphs on one chart with data extracted from sqlite, it’s working with only one graph, but when I try to show both, nothing is showing! Any help

![Untitled](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/2/0244d4577a72c3ae8088a4e240d024f20be55dd5.png) ![Untitled1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/5/e5a429a4ea45925648c18cb892e7d9b2ad4eb0b6.png)

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [4 November 2020 19:07 UTC](https://discourse.nodered.org/t/chart-with-multiple-lines/35338/2 "2020-11-04T19:07:52Z")

</div>

Welcome to the forum

Try using different topics for each graph.

---

<div class="post-metadata">

**Author:** ![marwa4](https://avatars.discourse-cdn.com/v4/letter/m/7feea3/32.png) [@marwa4](https://discourse.nodered.org/u/marwa4)\
**Post date:** [4 November 2020 19:25 UTC](https://discourse.nodered.org/t/chart-with-multiple-lines/35338/3 "2020-11-04T19:25:55Z")

</div>

i tried, it shows only the first line

 ![Untitled3](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bd970f0c5a8f9131b501c6173706a9e4d2841749.png)

---

<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:** [4 November 2020 21:08 UTC](https://discourse.nodered.org/t/chart-with-multiple-lines/35338/4 "2020-11-04T21:08:43Z")

</div>

Are you trying to draw lines in real time or are you trying to fill a chart with historical data?  
If real time then all you need to is send messages with the value in the payload and the line label in the topic. So you might send these messages in sequence, with time gaps in between each pair

```auto
{topic: "line1", payload: 2}
{topic: "line2", payload: 7}

{topic: "line1", payload: 3}
{topic: "line2", payload: 7}

```

and it will draw the lines. In fact you don't even need to send them in pairs.

If you are trying to send historical data then you must send all the data for both lines in one message with the complete set of data series as described in the docs.

Note also that the line at the end of your function  
`return [msg1,msg2]`  
will send msg1 to output 1 and msg2 to output 2. If you want to send them both to output 1 then you need  
`return [[msg1,msg2]]`  
as described in the docs Writing Functions.

---

<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:** [4 December 2020 21:08 UTC](https://discourse.nodered.org/t/chart-with-multiple-lines/35338/5 "2020-12-04T21:08:44Z")

</div>

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