Bugs: Browse | Submit New | Admin

[#9122] Spider does not scale correctly and partially draws outside image

Date:
2007-03-08 09:15
Priority:
3
Submitted By:
Hans de Graaff (graaff)
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
Spider does not scale correctly and partially draws outside image

Detailed description
With Gruff 0.2.8 a spider graph is not correctly scaled and draws a keyword at the bottom of the graph outside the image.
This is a regression from previous versions of gruff, which drew this graph correctly. The following code shows the
problem:

require 'gruff'

g = Gruff::Spider.new(4, '350x300')

1.upto(12) do |i|
  g.data("Keyword #{i}", [(i/4).floor])
end

g.write('test-image.png')

Add A Comment: Notepad

Please login


Followup

Message
Date: 2007-03-08 09:47
Sender: Hans de Graaff

I've added a simple patch which at least fixes the symptom
by taking a bit less space for the graph. It seems to me
that the diameter calculation doesn't take the offset into
account.

A better fix would be to take string length into account
when drawing the labels (e.g. only 20px for top and bottom
labels and more for the left and right labels, but my head
hurt when quickly thinking about the path involved. :-)

Attached Files:

Name Description Download
gruff-0.2.8-spider.patch Download

Changes:

Field Old Value Date By
File Added1551: gruff-0.2.8-spider.patch2007-03-08 09:47graaff