I have a partial that I am rendering that contains several graphs generated by gruff. These graphs are displaying data points pulled from my database, and I want to allow the user to change the datapoints (filter based on criteria). I have the graphs being written into a directory and I have the filter actions set up to redraw the graphs which is getting done (if I look at the directory the graphs are put into the files are being replaced with the new graphs) but the browser is not redrawing the partial after I update the graphs. I am calling the graphs via an image tag. The filter is being set by a form_remote_tag. My question really is how do I force a partial to redraw everything no matter what. Andrew
on 2005-12-05 20:09
on 2005-12-05 20:21
generating a new, unique graph file name everytime the data is changed should do it.
on 2005-12-06 04:05
Lou Vanek <vanek@...> writes: > > generating a new, unique graph file name everytime the data is changed should do it. > > is not redrawing the partial after I update the graphs. I am calling > > the graphs via an image tag. The filter is being set by a > > form_remote_tag. My question really is how do I force a partial to > > redraw everything no matter what. > > > > Andrew Another option is to send the graph data to the browser directly rather than writing it to disk. Not the most efficient practice but not necessarily bad if your data source changes constantly. def make_graph g = Gruff::Line.new ... send_data(g.to_blob, :filename => "ck.png", :type => 'image/png', :disposition => 'inline') end Then you can just invoke the controller method directly in your image source: <img src="/controller/make_graph" />
on 2005-12-06 20:53
On Dec 5, 2005, at 9:56 PM, Tyler Kovacs wrote: > ... > send_data(g.to_blob, :filename => "ck.png", :type => 'image/ > png', :disposition > => 'inline') > end > > Then you can just invoke the controller method directly in your > image source: > > <img src="/controller/make_graph" /> hm, I tried this before I asked the question but perhaps I did something wrong. I am writing multiple graphs to the page and kept getting a multiple render error which made me go the route of writing the graphs to disk. Andrew
on 2005-12-06 21:09
there's also the 'no-cache' header directive, http://www.htmlgoodies.com/beyond/reference/articl...
on 2007-04-03 17:42
Sorry to bump such an old topic, but I've run in to much the same problem. I'm rendering a partial which is re-rendered every so often using AJAX. Both suggestions mentioned above don't appear to work (changing the filename sent with each request and calling the controller directly). I've also used a simple method to alter HTTP headers with pragma and no-cache, all to no avail. Does anyone have any other suggestions? For reference, here's some snippets: Gruff controller: send_data(g.to_blob, :disposition => 'inline', :type => 'image/png') View: <img src="<%= url_for(:controller => 'graphs', :action => 'show') %>" />