Scruffy is outputting 4x2 blank images

J

Jay Mendoza

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.
 
7

7stud --

Jay said:
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?
 
J

Jay Mendoza

Stephen said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top