# How to chart two series in one graph

**URL:** <https://discourse.nodered.org/t/how-to-chart-two-series-in-one-graph/52824>\
**Category:** General\
**Created:** [27 October 2021 10:41 UTC](https://discourse.nodered.org/t/how-to-chart-two-series-in-one-graph/52824 "2021-10-27T10:41:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [27 October 2021 10:41 UTC](https://discourse.nodered.org/t/how-to-chart-two-series-in-one-graph/52824/1 "2021-10-27T10:41:45Z")

</div>

@zenofmud Hi, now I got it going for one series. how to use the jsonata expression for two series ?  
I am able to successfully plot the chart _individually_ once i press the individual button in Fig 1.  
I want to chart both the series in same chart by pressing one button in Fig 2

 ![2series](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/7/071dc48bc5607344a8bb5e2835c5b5a04d9cc389.png)

also attached the debug output from _ **prepare chart data -M05** _ change node ![debug1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/8/b8e2ed5fb3234bd76a0a79b1eb9134e4133ad6e8.jpeg)

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [27 October 2021 12:10 UTC](https://discourse.nodered.org/t/how-to-chart-two-series-in-one-graph/52824/2 "2021-10-27T12:10:36Z")

</div>

[note: moved to new topic since the prior one was over two years old]

Have you searched the forum on how to plot two series in one graph?

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [27 October 2021 12:29 UTC](https://discourse.nodered.org/t/how-to-chart-two-series-in-one-graph/52824/3 "2021-10-27T12:29:17Z")

</div>

Yes Indeed, several threads, but all solutions are showing for either real time data, (Which i have already used in my flows elsewhere with two different topics feeding into one chart) or hard coded data in msg.payload. Nowhere could i find for charting 2 series in a single chart from a database. after studying the debug output from a live chart output which is plotting a 2 series chart, i now know how the formatted data should look like. The trouble for me is I don't know how to syntax the Jsonata expression to give output as I desire....

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [27 October 2021 12:40 UTC](https://discourse.nodered.org/t/how-to-chart-two-series-in-one-graph/52824/4 "2021-10-27T12:40:33Z")

</div>

![one](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/9/99f4862770a519664c2533e23429251e4ff27095.jpeg)

I need _data:_ array to be [2 objects] like shown above

but I am getting _single array_ as shown below

![two](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/4/74437bbdeb12d666f77990769bc773757e6bdfdc.jpeg)

all i need is how to put the right syntax in Jsonata expression below to get the required syntax like high above (2 objects in 1 data: array)

![three](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/4/f4148a47725c4f16d2adb457257a78803f1ce1ab.jpeg)

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [27 October 2021 12:53 UTC](https://discourse.nodered.org/t/how-to-chart-two-series-in-one-graph/52824/5 "2021-10-27T12:53:08Z")

</div>

_ **GOT IT!!** _

I absolutely don't know the logic, but kept moving square brackets, flower brackets and comma here and there, and got it to work in one of the iteration.

![four](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/c/cc27cc0e355fb8e9430ee32e9f9c634da3104cb0.jpeg)

---

<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:** [10 November 2021 12:54 UTC](https://discourse.nodered.org/t/how-to-chart-two-series-in-one-graph/52824/6 "2021-11-10T12:54:05Z")

</div>

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