Where did you get the lifetime accumulated number of unexchanged and immature?
Cumulative balance = total paid out + current balance
Cumulative unexchanged = cumulative balance + current unexchanged
Cumulative immature = cumulative unexchanged + current unexchanged
Flot automatically stacks them up, using the stack plugin, so I just have to give it the current balances.

This is my script to check for updates:
https://gist.github.com/andrew12/35ab2c6eaa7ce8f8de60It runs every minute.