# How to populate multiple values in a graph?

**URL:** <https://discourse.nodered.org/t/how-to-populate-multiple-values-in-a-graph/29302>\
**Category:** Dashboard\
**Created:** [1 July 2020 11:25 UTC](https://discourse.nodered.org/t/how-to-populate-multiple-values-in-a-graph/29302 "2020-07-01T11:25:38Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![Henke82](https://avatars.discourse-cdn.com/v4/letter/h/58f4c7/32.png) [@Henke82](https://discourse.nodered.org/u/Henke82)\
**Post date:** [8 July 2020 08:34 UTC](https://discourse.nodered.org/t/how-to-populate-multiple-values-in-a-graph/29302/21 "2020-07-08T08:34:49Z")

</div>

> [@E1cid](#):
>

Yes, now we are talking:

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

However, I am not sure what I should inject if I want to retrieve the actual prices of today instead of the "old" prices that I use in the injector of this example?  
The Tibber query node just establish connection to the Tibber service, I need to inject a good json line. I did some trying on my own but I dont get good data (rather a error message, TypeError: Cannot read property 'homes' of undefined).

This is probably the last piece of the puzzle. Sorry guys!

```auto
[{"id":"f19ab0f8.b0a42","type":"inject","z":"9af8501c.86c62","name":"Inject \"fixed\" fixed input","topic":"","payload":"{\"viewer\":{\"homes\":[{\"currentSubscription\":{\"priceInfo\":{\"today\":[{\"total\":0.1624,\"energy\":0.1104,\"tax\":0.052,\"startsAt\":\"2020-07-02T00:00:00+02:00\"},{\"total\":0.1299,\"energy\":0.0844,\"tax\":0.0455,\"startsAt\":\"2020-07-02T01:00:00+02:00\"},{\"total\":0.111,\"energy\":0.0693,\"tax\":0.0417,\"startsAt\":\"2020-07-02T02:00:00+02:00\"},{\"total\":0.1072,\"energy\":0.0662,\"tax\":0.041,\"startsAt\":\"2020-07-02T03:00:00+02:00\"},{\"total\":0.1213,\"energy\":0.0776,\"tax\":0.0437,\"startsAt\":\"2020-07-02T04:00:00+02:00\"},{\"total\":0.1466,\"energy\":0.0978,\"tax\":0.0488,\"startsAt\":\"2020-07-02T05:00:00+02:00\"},{\"total\":0.1867,\"energy\":0.1299,\"tax\":0.0568,\"startsAt\":\"2020-07-02T06:00:00+02:00\"},{\"total\":0.2217,\"energy\":0.1579,\"tax\":0.0638,\"startsAt\":\"2020-07-02T07:00:00+02:00\"},{\"total\":0.2606,\"energy\":0.189,\"tax\":0.0716,\"startsAt\":\"2020-07-02T08:00:00+02:00\"},{\"total\":0.2571,\"energy\":0.1862,\"tax\":0.0709,\"startsAt\":\"2020-07-02T09:00:00+02:00\"},{\"total\":0.2783,\"energy\":0.2032,\"tax\":0.0751,\"startsAt\":\"2020-07-02T10:00:00+02:00\"},{\"total\":0.2592,\"energy\":0.1879,\"tax\":0.0713,\"startsAt\":\"2020-07-02T11:00:00+02:00\"},{\"total\":0.2445,\"energy\":0.1761,\"tax\":0.0684,\"startsAt\":\"2020-07-02T12:00:00+02:00\"},{\"total\":0.2288,\"energy\":0.1635,\"tax\":0.0653,\"startsAt\":\"2020-07-02T13:00:00+02:00\"},{\"total\":0.2234,\"energy\":0.1592,\"tax\":0.0642,\"startsAt\":\"2020-07-02T14:00:00+02:00\"},{\"total\":0.215,\"energy\":0.1525,\"tax\":0.0625,\"startsAt\":\"2020-07-02T15:00:00+02:00\"},{\"total\":0.2103,\"energy\":0.1488,\"tax\":0.0615,\"startsAt\":\"2020-07-02T16:00:00+02:00\"},{\"total\":0.2082,\"energy\":0.1471,\"tax\":0.0611,\"startsAt\":\"2020-07-02T17:00:00+02:00\"},{\"total\":0.2047,\"energy\":0.1442,\"tax\":0.0605,\"startsAt\":\"2020-07-02T18:00:00+02:00\"},{\"total\":0.199,\"energy\":0.1397,\"tax\":0.0593,\"startsAt\":\"2020-07-02T19:00:00+02:00\"},{\"total\":0.193,\"energy\":0.1349,\"tax\":0.0581,\"startsAt\":\"2020-07-02T20:00:00+02:00\"},{\"total\":0.1867,\"energy\":0.1299,\"tax\":0.0568,\"startsAt\":\"2020-07-02T21:00:00+02:00\"},{\"total\":0.1743,\"energy\":0.1199,\"tax\":0.0544,\"startsAt\":\"2020-07-02T22:00:00+02:00\"},{\"total\":0.1579,\"energy\":0.1068,\"tax\":0.0511,\"startsAt\":\"2020-07-02T23:00:00+02:00\"}]}}}]}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":280,"wires":[["bfcb622b.401e4"]]},{"id":"bfcb622b.401e4","type":"function","z":"9af8501c.86c62","name":"","func":"msg.topic = msg.payload.viewer.homes[0].currentSubscription.priceInfo.today[0].startsAt.split(\":00+\")[0].split(\"T\")[0];\nmsg.payloadorg = msg.payload;\nmsg.payload = [{\"series\":[\"Totals\"], \"data\": [[]], \"labels\": []}];\nfor ( var i in msg.payloadorg.viewer.homes[0].currentSubscription.priceInfo.today){\n msg.payload[0].data[0][i] = msg.payloadorg.viewer.homes[0].currentSubscription.priceInfo.today[i].total;\n msg.payload[0].labels[i] = msg.payloadorg.viewer.homes[0].currentSubscription.priceInfo.today[i].startsAt.split(\":00+\")[0].split(\"T\")[1];\n}\nreturn msg;","outputs":1,"noerr":0,"x":370,"y":280,"wires":[["f0a3077d.f54248"]]},{"id":"f0a3077d.f54248","type":"ui_chart","z":"9af8501c.86c62","name":"elpriser idag","group":"f92abb1b.7c98d8","order":2,"width":"15","height":"9","label":"{{msg.topic}}","chartType":"bar","legend":"false","xformat":"HH","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":530,"y":280,"wires":[["8a09938b.39991"]]},{"id":"8a09938b.39991","type":"debug","z":"9af8501c.86c62","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":710,"y":280,"wires":[]},{"id":"ec4b43bc.29acf","type":"inject","z":"9af8501c.86c62","name":"Inject real prices","topic":"","payload":"{\"viewer\":{\"homes\":[{\"currentSubscription\":{\"priceInfo\":{\"today\":[{\"total\":0.1624,\"energy\":0.1104,\"tax\":0.052,\"startsAt\":\"2020-07-02T00:00:00+02:00\"},{\"total\":0.1299,\"energy\":0.0844,\"tax\":0.0455,\"startsAt\":\"2020-07-02T01:00:00+02:00\"},{\"total\":0.111,\"energy\":0.0693,\"tax\":0.0417,\"startsAt\":\"2020-07-02T02:00:00+02:00\"},{\"total\":0.1072,\"energy\":0.0662,\"tax\":0.041,\"startsAt\":\"2020-07-02T03:00:00+02:00\"},{\"total\":0.1213,\"energy\":0.0776,\"tax\":0.0437,\"startsAt\":\"2020-07-02T04:00:00+02:00\"},{\"total\":0.1466,\"energy\":0.0978,\"tax\":0.0488,\"startsAt\":\"2020-07-02T05:00:00+02:00\"},{\"total\":0.1867,\"energy\":0.1299,\"tax\":0.0568,\"startsAt\":\"2020-07-02T06:00:00+02:00\"},{\"total\":0.2217,\"energy\":0.1579,\"tax\":0.0638,\"startsAt\":\"2020-07-02T07:00:00+02:00\"},{\"total\":0.2606,\"energy\":0.189,\"tax\":0.0716,\"startsAt\":\"2020-07-02T08:00:00+02:00\"},{\"total\":0.2571,\"energy\":0.1862,\"tax\":0.0709,\"startsAt\":\"2020-07-02T09:00:00+02:00\"},{\"total\":0.2783,\"energy\":0.2032,\"tax\":0.0751,\"startsAt\":\"2020-07-02T10:00:00+02:00\"},{\"total\":0.2592,\"energy\":0.1879,\"tax\":0.0713,\"startsAt\":\"2020-07-02T11:00:00+02:00\"},{\"total\":0.2445,\"energy\":0.1761,\"tax\":0.0684,\"startsAt\":\"2020-07-02T12:00:00+02:00\"},{\"total\":0.2288,\"energy\":0.1635,\"tax\":0.0653,\"startsAt\":\"2020-07-02T13:00:00+02:00\"},{\"total\":0.2234,\"energy\":0.1592,\"tax\":0.0642,\"startsAt\":\"2020-07-02T14:00:00+02:00\"},{\"total\":0.215,\"energy\":0.1525,\"tax\":0.0625,\"startsAt\":\"2020-07-02T15:00:00+02:00\"},{\"total\":0.2103,\"energy\":0.1488,\"tax\":0.0615,\"startsAt\":\"2020-07-02T16:00:00+02:00\"},{\"total\":0.2082,\"energy\":0.1471,\"tax\":0.0611,\"startsAt\":\"2020-07-02T17:00:00+02:00\"},{\"total\":0.2047,\"energy\":0.1442,\"tax\":0.0605,\"startsAt\":\"2020-07-02T18:00:00+02:00\"},{\"total\":0.199,\"energy\":0.1397,\"tax\":0.0593,\"startsAt\":\"2020-07-02T19:00:00+02:00\"},{\"total\":0.193,\"energy\":0.1349,\"tax\":0.0581,\"startsAt\":\"2020-07-02T20:00:00+02:00\"},{\"total\":0.1867,\"energy\":0.1299,\"tax\":0.0568,\"startsAt\":\"2020-07-02T21:00:00+02:00\"},{\"total\":0.1743,\"energy\":0.1199,\"tax\":0.0544,\"startsAt\":\"2020-07-02T22:00:00+02:00\"},{\"total\":0.1579,\"energy\":0.1068,\"tax\":0.0511,\"startsAt\":\"2020-07-02T23:00:00+02:00\"}]}}}]}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":220,"wires":[["734da5d0.4f332c"]]},{"id":"734da5d0.4f332c","type":"tibber-query","z":"9af8501c.86c62","name":"","active":true,"apiEndpointRef":"f93f16b5.d5efb8","x":330,"y":200,"wires":[["bfcb622b.401e4"]]},{"id":"f92abb1b.7c98d8","type":"ui_group","z":"","name":"Elpris idag","tab":"69a5e334.ac1d1c","order":4,"disp":true,"width":"15","collapse":false},{"id":"f93f16b5.d5efb8","type":"tibber-api-endpoint","z":"","feedUrl":"wss://api.tibber.com/v1-beta/gql/subscriptions","queryUrl":"https://api.tibber.com/v1-beta/gql","name":"Älgstigen 47"},{"id":"69a5e334.ac1d1c","type":"ui_tab","z":"","name":"Hem","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:** [8 July 2020 08:38 UTC](https://discourse.nodered.org/t/how-to-populate-multiple-values-in-a-graph/29302/22 "2020-07-08T08:38:19Z")

</div>

Give us a link to the tibber node info page.

---

<div class="post-metadata">

**Author:** ![Henke82](https://avatars.discourse-cdn.com/v4/letter/h/58f4c7/32.png) [@Henke82](https://discourse.nodered.org/u/Henke82)\
**Post date:** [8 July 2020 12:23 UTC](https://discourse.nodered.org/t/how-to-populate-multiple-values-in-a-graph/29302/23 "2020-07-08T12:23:16Z")

</div>

Certainly!  
Here is [Github info](https://flows.nodered.org/node/node-red-contrib-tibber-api), but there is also a nice [API explorer](https://developer.tibber.com/explorer) for Tibber where you can use a demo api key.

---

<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:** [8 July 2020 12:52 UTC](https://discourse.nodered.org/t/how-to-populate-multiple-values-in-a-graph/29302/24 "2020-07-08T12:52:16Z")

</div>

```auto
[{"id":"2fec14a5.0f6f9c","type":"inject","z":"1b984839.9b39d","name":"Inject real prices","topic":"","payload":"{ viewer { homes { currentSubscription { priceInfo { today { total energy tax startsAt } } } } }}","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":160,"wires":[["32475926.9c831e"]]}]

```

you have to inject the graphiQL as a string to payload.

---

<div class="post-metadata">

**Author:** ![Henke82](https://avatars.discourse-cdn.com/v4/letter/h/58f4c7/32.png) [@Henke82](https://discourse.nodered.org/u/Henke82)\
**Post date:** [8 July 2020 18:20 UTC](https://discourse.nodered.org/t/how-to-populate-multiple-values-in-a-graph/29302/25 "2020-07-08T18:20:48Z")

</div>

> [@E1cid](#):
>
> node.send({"payload": });

Works like a charm, and easy to apply to tomorrw's prices too.  
Thanks a million to everyone. Hopefully I will learn a lot from this!!!

---

<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 August 2020 18:20 UTC](https://discourse.nodered.org/t/how-to-populate-multiple-values-in-a-graph/29302/26 "2020-08-07T18:20:55Z")

</div>

Closed on 7 August 2020 18:20 UTC

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

[Previous page](https://discourse.nodered.org/t/how-to-populate-multiple-values-in-a-graph/29302.md?page=1)
