Closed dkitchel closed 14 years ago
Interesting, I haven't tried that before. The packages for each specific graph type have to be loaded first, which is done as part of the render_visualizations call. Are you calling this from your rjs partial? What does the code look like that you're using?
Cheers, Jeremy
Here's the full circle.
<% form_remote_tag :url=>'/admin/athletes/charts/gvmaps/', :method =>"post" do -%> Days ago: <%= text_field_tag(:days, value='all') %> Type: <%= text_field_tag(:type, value='all') %> <%= submit_tag("Report") %> <% end -%>
page.replace_html 'maps_gv', :partial => 'maps_gv', :params => {:days => params[:days], :type => params[:type]}
<% @riders = AdminReportsData.ridersGV(params[:days],params[:type]) %>
<% visualization "rider_map", "GeoMap", :width => 800, :height => 400, :region => "'US'", :colors =>"[0xE0FFD4, 0xc06000]" do |chart| %> <% chart.string "State" %> <% chart.number "Recruits" %> <% loopcount = 0 @riders.each do chart.add_row([@riders[loopcount][:state].to_s,@riders[loopcount][:num].to_i]) loopcount += 1 end %>
<% end %>
Anything else I put on the partial is rendered fine, but no geomap.
Thanks for your help on this!
Try putting the <%= include_visualization_api %> <%= render_visualizations %> calls after the chart. It relies on visualization having already been called first. When it's in the layout and the visualization call is in a view the view gets rendered before the layout I'm pretty sure.
closing old issue
I'm trying to use geomaps which render perfectly fine on the page, but I'm trying to pass a parameters to an rjs page which does a page replace to swap the old geomap for a new one from a partial. The partial works perfectly fine if I render it on the first page call, but if I render it via rjs with a form_remote_tag, it doesn't work. Any ideas?