Updated function for new charts and parameters.

Now supports pies and donuts.