Thanks for the reply. That is certainly one way to go about it. I was
able to write a file and read it properly.
Some issues with this approach: I have put this image into a a
periodic update section. Write it then read it make the refresh rather
obvious. I was hoping send_data will make it visually a little better,
but then I guess this might not be the "rails" way of doing this kind
of update ... So far, I think I didn't really find a GOOD way to give
you live update charting with gruff ...
Thanks - by coincidence, I also stumble onto this way of calling ...
I believe this will work under normal circumstances ... what if I am
calling it this way to update only this <div> section? ... I am not
so sure anymore
respond_to do |format|
format.html
format.png do
send_data(g.to_blob,
:disposition => 'inline',
:type => 'image/png',
:filename => "gruff.png")
end
then the route needs to have :controller/:action/:id.:format
then controller/action/id will give you the html (probably a page with
an img tag to the actual chart), and controller/action/id.png will
return the actual image.
Presuming the 'gruff_report' action renders the correct html to fill the
'show_graph' element, you should be fine. Bear in mind that gruff graphs can
be a chunky download, so refreshing them every 5 seconds might be hard on
the server.