since I have scruffy up and running now IÂ´d like to integrate the
desired images on some of my rails views. But neither scruffy nor rails
docs say something about this and I cannot find examples or help on
this. So I hope somebody on this forum has experiences in integrating
scruffy images on rails views.
I find out how to go the easy and obvious way: Export image to a file
and then bind the exported file on the view template. But I wonder if I
cannot get scruffy images directly on my rails pages without exporting
it to disk first.
My approach with a simple example from Brastens page:
I created this method in my views helper class:
graph = Scruffy::Graph.new
graph.title = "Comparative Agent Performance" graph.value_formatter =
Scruffy::Formatters::Percentage.new(:precision => 0)
graph.add :stacked do |stacked| stacked.add :bar, 'Jack', [30, 60, 49, 29, 100, 120] stacked.add :bar, 'Jill', [120, 240, 0, 100, 140, 20] stacked.add :bar, 'Hill', [10, 10, 90, 20, 40, 10] end graph.point_markers = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'] graph.render(:width => 800, :as => 'JPG')
And in my views rhtml page I put this:
<%= generate_img %>
Unfortunately it display rubbish instead of the expected image.
The encapsulation with the tag is also not working.
Can anyone point me to the right direction?
Thanks & Regards,