It usually should reconnect if the router goes down and comes back up, at least it is supposed to. The drivers for the wifi are all closed source blobs so if it doesn't work it just doesn't work and there's not much we can do about it. Usually when it stops working, the device is completely hosed and needs a reboot (starting and stopping the network does nothing).
I'd also see if you're getting some other issue causing the history to not save. HeaterMeter should store a backup of the history every 5 (?) minutes when it is running, and restore that backup when it comes back up and sees it can continue the graph (based on the current time vs the time in the database). Make sure the clocks are right and leave your HeaterMeter time zone to UTC (+0) since the time is adjusted to local time in the browser, not at the server. Also check the system / kernel logs to make sure the SD card isn't going read-only due to errors, which would prevent us from saving the backup.