Hi
I'm trying to complete my weather station dashboard and have the need to insert historic data from mySQL database.
I'm able to connect to the database and to pull out the required data. I then convert it to JSON format. The problem is my chart stays empty!!
Could anyone please assist before my remaining hair is lost.
My flow is:
[{"id":"cbcd6bd7.5b7e38","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"6653620d.75d75c","type":"inject","z":"cbcd6bd7.5b7e38","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":110,"y":140,"wires":[["8dcc9414.24e258"]]},{"id":"e246e357.08c1e","type":"mysql","z":"cbcd6bd7.5b7e38","mydb":"5e0f3b48.32ae84","name":"","x":420,"y":100,"wires":[["759b2a9d.32e384"]]},{"id":"8dcc9414.24e258","type":"function","z":"cbcd6bd7.5b7e38","name":"BETWEEN DATE QUERY","func":"msg.topic = \"SELECT CREATED,AMB_TEMP FROM WEATHER_MEASUREMENT WHERE CREATED BETWEEN '2019-04-01' AND '2019-06-30'\"\nreturn msg;","outputs":1,"noerr":0,"x":150,"y":240,"wires":[["e246e357.08c1e"]]},{"id":"b26cc359.9c772","type":"debug","z":"cbcd6bd7.5b7e38","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":490,"y":240,"wires":[]},{"id":"7a52b4b6.f84a5c","type":"ui_chart","z":"cbcd6bd7.5b7e38","name":"3 Months temperature","group":"a7449be3.fd8418","order":0,"width":"21","height":"6","label":"chart","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"13","removeOlderPoints":"14000","removeOlderUnit":"604800","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":480,"y":380,"wires":[[]]},{"id":"759b2a9d.32e384","type":"change","z":"cbcd6bd7.5b7e38","name":"Format data","rules":[{"t":"set","p":"payload","pt":"msg","to":"(\t $series := [\t {\t \"field\": \"AMB_TEMP\",\t \"label\": \"Temperature\" \t }\t ];\t $xaxis := \"CREATED\";\t [\t {\t \"series\": $series.label,\t \"data\": $series.[\t (\t $yaxis := $.field;\t $$.payload.{\t \"x\": $lookup($, $xaxis),\t \"y\": $lookup($, $yaxis)\t } \t ) \t ] \t } \t ]\t)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":320,"wires":[["7a52b4b6.f84a5c","b26cc359.9c772"]]},{"id":"5e0f3b48.32ae84","type":"MySQLdatabase","z":"","name":"","host":"192.168.1.155","port":"3306","db":"weather_station","tz":""},{"id":"a7449be3.fd8418","type":"ui_group","z":"","name":"Default","tab":"b6c1bcde.cfe6d","order":1,"disp":false,"width":"21","collapse":false},{"id":"b6c1bcde.cfe6d","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":1,"disabled":false,"hidden":false}]