Support for real-time graphs; patch by rore.

This was adapted from pull request #7, unbitrotted and with a few
formatting and other minor fixes.