Hello!
I am having the an issue, if I turn off my computer or power goes off every data my chart collected just disapears, is there a way to store the values and not lose it?
Can anyone help me with that?
I save sensor data in a database as I receive it & use SQL to extract and format it for the chart.
No doubt you could save it into persistent context variables if you don't want the faff of a database.
Stored data sent to a chart needs to be in a rather different format than live data, see the chart node's help for examples.
You save the data out of the chart node to a file, and on startup read that file back in.
An example flow would be something like this:
[{"id":"9b4ec05b1a202367","type":"ui_chart","z":"7aea2353258f6a1c","name":"Graph","group":"226d5b24d8765c69","order":2,"width":"7","height":4,"label":"Graph 1","chartType":"line","legend":"true","xformat":"dd HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"100","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"86400","cutout":"","useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":710,"y":340,"wires":[["09a617226726e186"]]},{"id":"09a617226726e186","type":"file","z":"7aea2353258f6a1c","name":"Save Data","filename":"GRAPH_FILENAME.json","filenameType":"str","appendNewline":false,"createDir":true,"overwriteFile":"true","encoding":"utf8","x":870,"y":340,"wires":[[]]},{"id":"1ef4be40878d02f7","type":"json","z":"7aea2353258f6a1c","name":"","x":550,"y":360,"wires":[["9b4ec05b1a202367"]]},{"id":"7ef0deab71278d45","type":"file in","z":"7aea2353258f6a1c","name":"Load Data","filename":"GRAPH_FILENAME.json","filenameType":"str","format":"utf8","allProps":false,"x":390,"y":360,"wires":[["1ef4be40878d02f7"]]},{"id":"090327694cb33811","type":"inject","z":"7aea2353258f6a1c","name":"Restore","props":[],"repeat":"","crontab":"","once":true,"onceDelay":"","topic":"","x":220,"y":360,"wires":[["7ef0deab71278d45"]]},{"id":"8d030db1d1475ee7","type":"link in","z":"7aea2353258f6a1c","name":"INPUT DATA","links":[],"x":530,"y":320,"wires":[["9b4ec05b1a202367"]],"l":true},{"id":"226d5b24d8765c69","type":"ui_group","name":"Testing Group","tab":"8aa1072b76950fed","order":1,"disp":true,"width":7,"collapse":false,"className":""},{"id":"8aa1072b76950fed","type":"ui_tab","name":"TESTING","icon":"build","order":2,"disabled":false,"hidden":false}]
Feed your chart data in to the INPUT DATA
Link In node, and make sure you put in a valid path for both the Save and Load data nodes. I have used this many times to reload graph information.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.