Patches: Browse | Submit New | Admin

[#4073] Legend wrap for large datasets and resolution of issues 3589, 4027, 3945, and 3490

2006-04-12 21:24
Submitted By:
Stephen Lombardo (sjlombardo)
Assigned To:
Nobody (None)
Legend wrap for large datasets and resolution of issues 3589, 4027, 3945, and 3490

Detailed description

Gruff is an excellent tool and I've found it very useful. Thank you for the valuable open source contribution.

In the current version of Gruff the legend will spill off the screen and be cut off in the final image when there are
a large number of datasets. Please find a patch attached that fixes this issue by allowing the legend to wrap to an
arbitrary number of lines. This patch changes the base logic to first calculate the size of the legend, and if it would
exceed the bounds of the image it will simply wrap the legend items onto subsequent lines. It also takes care of scaling
the graph itself so that the legend and chart don't overrun.

While working on this functionality I made some changes to the way pie charts are drawn that allow them to scale properly
to different graph heights when the legend wraps. These changes resolved RubyForge bug # 3945 (wide pie charts clutter).

I also put in a quick fix to bug # 3589 (Gruff hangs when trying to write diagram) and # 4027 (gruff hangs with [1,1]
as the data set) which caused ImageMagick to hang when only one value was present in the data set and min would equal
max. While making this fix I added an attr_accessor to allow external manipulation of min and max values to force specific
scaling to resolve RubyForge feature request #3490 (Allow setting max and min values)

I've included unit tests, and I've personally tested the changes fairly extensively with different data sets in a rails

Please let me know if you have any questions or comments. I'd love to see these fixes make their way into the official
version, so you are free to include them under the terms of the Ruby license.

Stephen Lombardo

Add A Comment: Notepad

Please login


No Followups Have Been Posted

Attached Files:

Name Description Download
gruff-0.1.1.patch Patch against Gruff 0.1.1 Download


Field Old Value Date By
File Added540: gruff-0.1.1.patch2006-04-12 21:24sjlombardo