I'm not sure from your question whether you are asking for something related to Template Toolkit .... but I use Chart::Clicker all the time to do graphs with multiple data sets. (I use Cairo back end fwiw.)
The way forward always starts with a minimal test.