I'm trying to make a statistics page where it will show several data and charts.
The charts need to be pictures so that the user can save it/drag-and-drop to his/her personal reports.
I'm using Gruff Graphs for Ruby to produce the charts but I don't know the best way to display the results safe and protected.
Some of my ideas/tries are:
save the chart to a file (jpg, png)? problem: data is available to anyone (don't have access to cron, to delete data from time to time)
render in the browser (has to work on IE)?
Use javascript (Raphaël—JavaScript Library) or Google API and output a PDF report (need plugin or gem, right)?
use send_data? i've tried to output other way than inline, because I needs to show other data, is it possible?
Thanks for any help.
Although it's annoying, you can always prune off old entries as part of your generation procedure. This is really only something you need to do if you don't have a background job facility of some sort such as cron. Checking based on file "modification time" is usually the best way to go, but this also has the effect of breaking old links to images.
A canvas-based approach is significantly better than server-generated images. For example, using something like Flot to build canvas-based graphs and include explorercanvas where required for IE compatibility.