# Issue with Real-Time Data Reading from MQTT Node - Unable to Display Graph

**URL:** https://discourse.nodered.org/t/issue-with-real-time-data-reading-from-mqtt-node-unable-to-display-graph/80870
**Category:** Dashboard
**Tags:** node-red-dashboard
**Created:** [28 August 2023 19:15 UTC](https://discourse.nodered.org/t/issue-with-real-time-data-reading-from-mqtt-node-unable-to-display-graph/80870 "2023-08-28T19:15:03Z")
**Posts on this page:** 4
**Page:** 2

<div class="post-metadata">

### Author: ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)
#### Post date: [29 August 2023 07:46 UTC](https://discourse.nodered.org/t/issue-with-real-time-data-reading-from-mqtt-node-unable-to-display-graph/80870/21 "2023-08-29T07:46:01Z")

</div>

Tried to mimic your situation as well I could understand it. Maybe it helps.

```auto
[{"id":"aec6c2f63bad81ed","type":"inject","z":"f38eb79e0860f7ce","name":"Fake data income from MQTT ","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":".2","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":250,"y":960,"wires":[["581a6145ddd1ab51"]]},{"id":"0d74b16dedc8998a","type":"function","z":"f38eb79e0860f7ce","name":"convert for chart","func":"\nreturn {payload:msg.payload.D,timestamp:msg.payload.T};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":620,"y":960,"wires":[["e8aff754b68f42c4","5b019d48fb27ac8e"]]},{"id":"581a6145ddd1ab51","type":"function","z":"f38eb79e0860f7ce","name":"fake data","func":"let p = global.get('p') || {running:false}\n\nif(!p || !p.running){\n return\n}\nif(!p.t || p.t < 0){\n p.t = 0\n}\n\np.t = p.t + Math.floor(Math.random()*100)\n\nglobal.set('p',p)\n\nmsg.payload = { \"N\": 1, \"T\": p.t, \"D\": Math.random()+1 }\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":960,"wires":[["0d74b16dedc8998a","8915db4138ccec95"]]},{"id":"881a0535272ef8ba","type":"ui_button","z":"f38eb79e0860f7ce","name":"","group":"ecfba9d6f29c06b2","order":0,"width":0,"height":0,"passthru":false,"label":"RUN","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"true","payloadType":"bool","topic":"topic","topicType":"msg","x":310,"y":1180,"wires":[["10da04860cd8c83c","0758d86f1d9d48c8"]]},{"id":"86b6dfe7c311ae6a","type":"ui_button","z":"f38eb79e0860f7ce","name":"","group":"ecfba9d6f29c06b2","order":0,"width":0,"height":0,"passthru":false,"label":"STOP","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"false","payloadType":"bool","topic":"topic","topicType":"msg","x":310,"y":1100,"wires":[["0758d86f1d9d48c8","cf78fdf7d378aaf3"]]},{"id":"0758d86f1d9d48c8","type":"change","z":"f38eb79e0860f7ce","name":"start/stop process","rules":[{"t":"set","p":"p.running","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":1140,"wires":[[]]},{"id":"e8aff754b68f42c4","type":"ui_chart","z":"f38eb79e0860f7ce","name":"","group":"ecfba9d6f29c06b2","order":2,"width":"16","height":"3","label":"chart","chartType":"line","legend":"false","xformat":"xx","interpolate":"linear","nodata":"Process stopped","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"],"outputs":1,"useDifferentColor":false,"className":"","x":810,"y":1000,"wires":[[]]},{"id":"cf78fdf7d378aaf3","type":"change","z":"f38eb79e0860f7ce","name":"reset fake data","rules":[{"t":"set","p":"p.t","pt":"global","to":"-1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":1100,"wires":[[]]},{"id":"5b019d48fb27ac8e","type":"debug","z":"f38eb79e0860f7ce","name":"DATA TO CHART","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":890,"y":900,"wires":[]},{"id":"18ad919935c5fbb0","type":"function","z":"f38eb79e0860f7ce","name":"Chart options","func":"msg.ui_control = {\n options: { \n scales: {\n xAxes: [{\n type: 'linear',\n position: 'bottom',\n gridLines: {\n color: 'rgba(123, 113, 113, 0.25)',\n zeroLineColor: 'rgba(123, 113, 113, 0.25)',\n tickMarkLength: 7,\n drawTicks: false\n },\n ticks: {\n fontColor: \"#ccc\",\n min: 0,\n stepSize: 200\n\n }\n }],\n yAxes: [{\n gridLines: {\n color: 'rgba(123, 113, 113, 0.25)',\n zeroLineColor: 'rgba(123, 113, 113, 0.25)',\n tickMarkLength: 5,\n drawTicks: false\n },\n ticks: {\n fontColor: \"#ccc\",\n }\n }]\n }\n }\n}\ndelete msg.payload\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":630,"y":1020,"wires":[["e8aff754b68f42c4"]]},{"id":"291dfaa06a38b9bb","type":"inject","z":"f38eb79e0860f7ce","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":470,"y":1020,"wires":[["18ad919935c5fbb0"]]},{"id":"8915db4138ccec95","type":"debug","z":"f38eb79e0860f7ce","name":"DATA FROM MQTT","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":670,"y":860,"wires":[]},{"id":"10da04860cd8c83c","type":"change","z":"f38eb79e0860f7ce","name":"reset chart","rules":[{"t":"set","p":"payload","pt":"msg","to":"[]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":1180,"wires":[["e8aff754b68f42c4"]]},{"id":"ecfba9d6f29c06b2","type":"ui_group","name":"Default","tab":"54e197d8.7f7fe8","order":1,"disp":true,"width":"16","collapse":false,"className":""},{"id":"54e197d8.7f7fe8","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

### Author: ![Asiayqyyq](https://avatars.discourse-cdn.com/v4/letter/a/e68b1a/32.png) [@Asiayqyyq](https://discourse.nodered.org/u/Asiayqyyq)
#### Post date: [31 August 2023 18:21 UTC](https://discourse.nodered.org/t/issue-with-real-time-data-reading-from-mqtt-node-unable-to-display-graph/80870/22 "2023-08-31T18:21:19Z")

</div>

> [@hotNipi](#):
>
> Tried to mimic your situation as well I could understand it. Maybe it helps.

Is it possible to continuously save a batch of data to a CSV file until a stop button is pressed, treating each batch as a separate CSV file? Then, I would like the option to either append that file or discard the data if the measurement was unsuccessful.

---

<div class="post-metadata">

### Author: ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)
#### Post date: [31 August 2023 19:01 UTC](https://discourse.nodered.org/t/issue-with-real-time-data-reading-from-mqtt-node-unable-to-display-graph/80870/23 "2023-08-31T19:01:53Z")

</div>

This is definitely way out of this topic so I recommend to open new one with clear explanation and requirements.

---

<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: [14 September 2023 19:02 UTC](https://discourse.nodered.org/t/issue-with-real-time-data-reading-from-mqtt-node-unable-to-display-graph/80870/24 "2023-09-14T19:02:48Z")

</div>

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

[Previous page](https://discourse.nodered.org/t/issue-with-real-time-data-reading-from-mqtt-node-unable-to-display-graph/80870.md?page=1)
