Here is a simple example of how to do it using context.
[{"id":"c1ed938e8444bfe2","type":"inject","z":"bdd7be38.d3b55","name":"This is generating data every 2 seconds","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"2","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":4360,"wires":[["1e612580123947b9"]]},{"id":"1e612580123947b9","type":"range","z":"bdd7be38.d3b55","minin":"0","maxin":"100000","minout":"0","maxout":"100","action":"roll","round":false,"property":"payload","name":"","x":490,"y":4360,"wires":[["486ae61e6c109681"]]},{"id":"5952b72423d4d17a","type":"debug","z":"bdd7be38.d3b55","name":"debug 2474","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":870,"y":4460,"wires":[]},{"id":"486ae61e6c109681","type":"ui_chart","z":"bdd7be38.d3b55","name":"","group":"903a6ab8.4f4ca8","order":4,"width":0,"height":0,"label":"chart","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"100","removeOlder":"10","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":690,"y":4360,"wires":[["5952b72423d4d17a","7e1c593288183a29"]]},{"id":"a428071d4c7e64b2","type":"change","z":"bdd7be38.d3b55","name":"Restore chart data","rules":[{"t":"set","p":"payload","pt":"msg","to":"#:(file)::chart_data","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":4460,"wires":[["486ae61e6c109681"]]},{"id":"ff5ac4baf6f7a589","type":"inject","z":"bdd7be38.d3b55","name":"This triggers on startup to restore chart data","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"#:(file)::chart_data","payloadType":"flow","x":210,"y":4460,"wires":[["a428071d4c7e64b2","e00fe342d5e1ac5f"]]},{"id":"7e1c593288183a29","type":"change","z":"bdd7be38.d3b55","name":"Save chart data","rules":[{"t":"set","p":"#:(file)::chart_data","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":4360,"wires":[[]]},{"id":"e00fe342d5e1ac5f","type":"debug","z":"bdd7be38.d3b55","name":"debug 2475","active":false,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":470,"y":4540,"wires":[]},{"id":"903a6ab8.4f4ca8","type":"ui_group","name":"Home","tab":"e2e6f4f5.56f91","order":1,"disp":false,"width":"6","collapse":false,"className":""},{"id":"e2e6f4f5.56f91","type":"ui_tab","name":"Home","icon":"dashboard","order":3,"disabled":false,"hidden":false}]