I'm planning on adding some flot charts to my site, and i'm wondering are there any recommendations on the best approach for handling this. I have existing model and controller classes that query the DB, and a simple .phtml to render this data as a table.
One approach is to add a new flot.phtml file, and have this class handle the creation of data as required by the flot chart API. The controller would then be updated to pass the queried DB data, to the 'index.phtml' and 'flot.pthml' view files. Its quick and simple, but I'm not sure i'll get much reuse from the logic within the flot.phtml file.
The second option would be to write some class, that would have methods to set the x/y axis, the line types and the add the various datasets. This would basically dump back a content of the 'source' script element, and the final phtml file would just look after the chart size and positioning on the page. Should this component be a controller, should it be a actionhelper? Since it will create source code that will be included in the final html file, are there existing components within Zend that i should extend from or reuse?
Basically, i'm looking for any points that people might want to suggest. If i get something working i'll post it here later?