Scruffy is outputting 4x2 blank images

I’m having some difficult getting Scruffy to render properly. I don’t
seem to have any gem issues, and the example code:

require ‘rubygems’
require ‘scruffy’

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, :to => ‘test.jpg’, :as => ‘JPG’)

runs without error. But test.jpg ends up as a 325 byte file:

test.jpg JPEG 4x2 4x2+0+0 8-bit DirectClass 325b

I’ve tried other Scruffy examples and the same thing happens.

Gruff renders fine, and a simple RMagick example worked as well. I’ve
upgraded my ImageMagick installation, tried the example script with
ruby19 but nothing has worked so far.

Is there something I’m missing here? Is this a known issue? I’m not
really sure where to look next.

Jay Mendoza wrote:

Gruff renders fine, and a simple RMagick example worked as well. I’ve
upgraded my ImageMagick installation, tried the example script with
ruby19 but nothing has worked so far.

Whoa. Does your code work in ruby 1.8.x?

On Aug 25, 7:59 am, 7stud – [email protected] wrote:

Jay Mendoza wrote:

Gruff renders fine, and a simple RMagick example worked as well. I’ve
upgraded my ImageMagick installation, tried the example script with
ruby19 but nothing has worked so far.

Whoa. Does your code work in ruby 1.8.x?


Posted viahttp://www.ruby-forum.com/.

I was having the same problem. The issue is a “viewPort” declaration
in renderers/base.rb

The patch is to change line 35 to

svg.svg(:xmlns => “http://www.w3.org/2000/svg”, ‘xmlns:xlink’ =>
http://www.w3.org/1999/xlink”,
:viewBox => “0 0 #{options[:size].first} #{options[:size].last}”)

See my discussion on

http://rubyforge.org/tracker/index.php?func=detail&aid=27102&group_id=2030&atid=7929

Stephen Edwards wrote:

I was having the same problem. The issue is a “viewPort” declaration
in renderers/base.rb

The patch is to change line 35 to

svg.svg(:xmlns => “http://www.w3.org/2000/svg”, ‘xmlns:xlink’ =>
http://www.w3.org/1999/xlink”,
:viewBox => “0 0 #{options[:size].first} #{options[:size].last}”)

See my discussion on

http://rubyforge.org/tracker/index.php?func=detail&aid=27102&group_id=2030&atid=7929

Ah, interesting.

I have since moved on to a flash solution, but this is good to know. I
appreciate your response.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs