# MYSQL database to chart

**URL:** <https://discourse.nodered.org/t/mysql-database-to-chart/42973>\
**Category:** Dashboard\
**Created:** [21 March 2021 21:50 UTC](https://discourse.nodered.org/t/mysql-database-to-chart/42973 "2021-03-21T21:50:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![victorramos99](https://avatars.discourse-cdn.com/v4/letter/v/e36b37/32.png) [@victorramos99](https://discourse.nodered.org/u/victorramos99)\
**Post date:** [21 March 2021 21:50 UTC](https://discourse.nodered.org/t/mysql-database-to-chart/42973/1 "2021-03-21T21:50:15Z")

</div>

Hi everyone,

I'm tryign to make a chart with the data in a mysql database. The database name is "prueba" and the table name is "prueba" too. When I deploy the flow the chart is blank and I don't know whats wrong.

This is the flow:  
`[{"id":"42ac8bd2.5ce6d4","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"a65cd334.88fbc","type":"mysql","z":"42ac8bd2.5ce6d4","mydb":"6b117fd6.12162","name":"","x":300,"y":200,"wires":[["93262868.006e78"]]},{"id":"f05703c7.1631c","type":"ui_chart","z":"42ac8bd2.5ce6d4","name":"","group":"ca30b7ae.d36008","order":1,"width":0,"height":0,"label":"chart","chartType":"line","legend":"false","xformat":"auto","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"604800","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"x":550,"y":200,"wires":[["e2ec0bee.b98938"]]},{"id":"e2ec0bee.b98938","type":"debug","z":"42ac8bd2.5ce6d4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":730,"y":140,"wires":[]},{"id":"93262868.006e78","type":"change","z":"42ac8bd2.5ce6d4","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"[{ \"key\": \"AMB_T\", \"values\": msg.payload.[epoch, AMB_T] } ]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":140,"wires":[["f05703c7.1631c"]]},{"id":"bab911cb.28d1b","type":"inject","z":"42ac8bd2.5ce6d4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"select * from prueba","payload":"","payloadType":"date","x":130,"y":180,"wires":[["a65cd334.88fbc"]]},{"id":"6b117fd6.12162","type":"MySQLdatabase","name":"","host":"127.0.0.1","port":"3306","db":"prueba","tz":"","charset":"UTF8"},{"id":"ca30b7ae.d36008","type":"ui_group","name":"Informe","tab":"e69e034.ca863","order":1,"disp":true,"width":"6","collapse":false},{"id":"e69e034.ca863","type":"ui_tab","name":"Grafico","icon":"dashboard","disabled":false,"hidden":false}]`

I will Include also a photo of the database. I want to make a line chart with the values in AMB\_T column.

 ![Captura](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/c/5c0d60c53fb2da7b5f32dedb70077f0f6c885c28.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:** [21 March 2021 22:08 UTC](https://discourse.nodered.org/t/mysql-database-to-chart/42973/2 "2021-03-21T22:08:25Z")

</div>

Welcome to the forum @victorramos99

In order to make code more readable and importable it is important to surround your code with three backticks  
`````  
`like this`  
`````

You can edit and correct your post by clicking the pencil icon.

See this post for more details - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

Feed the data that you are giving to the database into a debug node and compare it with the required format described in [node-red-dashboard/Charts.md at master · node-red/node-red-dashboard · GitHub](https://github.com/node-red/node-red-dashboard/blob/master/Charts.md)

If you are a complete beginner with node-red then I recommend 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.

If you search the forum for the title of your question it will find a number of hits that may be helpful.

If you are still stuck after that then come back and tell us which bit you have having difficulty with.

---

<div class="post-metadata">

**Author:** ![victorramos99](https://avatars.discourse-cdn.com/v4/letter/v/e36b37/32.png) [@victorramos99](https://discourse.nodered.org/u/victorramos99)\
**Post date:** [22 March 2021 16:11 UTC](https://discourse.nodered.org/t/mysql-database-to-chart/42973/3 "2021-03-22T16:11:21Z")

</div>

I have compared my data with the required format that shows in the links and I could solve the problem.

Thank you for your time Colin! 🙂

---

<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:** [21 April 2021 16:11 UTC](https://discourse.nodered.org/t/mysql-database-to-chart/42973/4 "2021-04-21T16:11:47Z")

</div>

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