# Gruff & legend problems

**URL:** <https://www.ruby-forum.com/t/gruff-legend-problems/91010>\
**Category:** Rails\
**Created:** [April 3, 2007, 8:48pm UTC](https://www.ruby-forum.com/t/gruff-legend-problems/91010 "2007-04-03T20:48:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pierre-Alexandre\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c4cdca/32.png) [@Pierre-Alexandre\_M](https://www.ruby-forum.com/u/Pierre-Alexandre_M)\
**Post date:** [April 3, 2007, 8:48pm UTC](https://www.ruby-forum.com/t/gruff-legend-problems/91010/1 "2007-04-03T20:48:56Z")

</div>

Hi,

I have some problems with Gruff & legends. How do you handle many datas?  
When you have to many labels, the list doesn’t fit in the image.

Looking at the source code, the draw\_legend() just calculate the width  
of the legend (sum of the labels size) and append the labels to the  
current\_x\_offset. This is really painful for long legends…

Is there a way to change this behavior naturally or do I have to patch  
it? If someone has already geeked it, I don’t want to reinvent the  
wheel… 😉

++

–  
,========================.  
| Pierre-Alexandre M. |  
| email : removed\_email\_address@domain.invalid |  
`========================’

---

<div class="post-metadata">

**Author:** ![Pierre-Alexandre\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c4cdca/32.png) [@Pierre-Alexandre\_M](https://www.ruby-forum.com/u/Pierre-Alexandre_M)\
**Post date:** [April 4, 2007, 12:21pm UTC](https://www.ruby-forum.com/t/gruff-legend-problems/91010/2 "2007-04-04T12:21:18Z")

</div>

On Tue, Apr 03, 2007 at 08:47:14PM +0200, Pierre-Alexandre M. wrote :

> Is there a way to change this behavior naturally or do I have to patch  
> it? If someone has already geeked it, I don’t want to reinvent the  
> wheel… 😉

[http://mouraf.org/documents/rails/gruff-0.2.8.patch](http://mouraf.org/documents/rails/gruff-0.2.8.patch)

–  
,========================.  
| Pierre-Alexandre M. |  
| email : removed\_email\_address@domain.invalid |  
`========================’

---

<div class="post-metadata">

**Author:** ![Pierre-Alexandre\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c4cdca/32.png) [@Pierre-Alexandre\_M](https://www.ruby-forum.com/u/Pierre-Alexandre_M)\
**Post date:** [April 4, 2007, 5:43pm UTC](https://www.ruby-forum.com/t/gruff-legend-problems/91010/3 "2007-04-04T17:43:26Z")

</div>

On Wed, Apr 04, 2007 at 02:05:03PM +0200, Jonathan W. wrote :

> Have you submitted it to the author? Looks good to me.

Actually, there are lots of patch in the trac which are not  
included in the core or revised by the author. Maybe he hasn’t much time  
to work on this project.

Besides, look at my little post [http://mouraf.org/blog/show/14](http://mouraf.org/blog/show/14).  
The lines are not centered and the final legend is not really pretty. I  
really don’t know what to do : center each lines, justify legend, … I  
think the best issue would be to draw a vertical legend on several  
columns.

Moreover, I haven’t provide tests so it’s not submittable 😉

–  
,========================.  
| Pierre-Alexandre M. |  
| email : removed\_email\_address@domain.invalid |  
`========================’

---

<div class="post-metadata">

**Author:** ![Pierre-Alexandre\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c4cdca/32.png) [@Pierre-Alexandre\_M](https://www.ruby-forum.com/u/Pierre-Alexandre_M)\
**Post date:** [April 4, 2007, 2:07pm UTC](https://www.ruby-forum.com/t/gruff-legend-problems/91010/4 "2007-04-04T14:07:17Z")

</div>

Pierre-Alexandre M. wrote:

> On Tue, Apr 03, 2007 at 08:47:14PM +0200, Pierre-Alexandre M. wrote :
> 
> > Is there a way to change this behavior naturally or do I have to patch  
> > it? If someone has already geeked it, I don’t want to reinvent the  
> > wheel… 😉
> 
> [http://mouraf.org/documents/rails/gruff-0.2.8.patch](http://mouraf.org/documents/rails/gruff-0.2.8.patch)

Have you submitted it to the author? Looks good to me.

Jonathan

–  
Jonathan W.  
[http://blog.innerewut.de](http://blog.innerewut.de)

---

<div class="post-metadata">

**Author:** ![Pierre-Alexandre\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c4cdca/32.png) [@Pierre-Alexandre\_M](https://www.ruby-forum.com/u/Pierre-Alexandre_M)\
**Post date:** [April 4, 2007, 5:52pm UTC](https://www.ruby-forum.com/t/gruff-legend-problems/91010/5 "2007-04-04T17:52:27Z")

</div>

On Wed, Apr 04, 2007 at 05:42:29PM +0200, Pierre-Alexandre M. wrote :

> Besides, look at my little post [http://mouraf.org/blog/show/14](http://mouraf.org/blog/show/14).  
> The lines are not centered and the final legend is not really pretty. I  
> really don’t know what to do : center each lines, justify legend, … I  
> think the best issue would be to draw a vertical legend on several  
> columns.

Sucks with several lines:  
[http://mouraf.org/documents/rails/sucks.png](http://mouraf.org/documents/rails/sucks.png)

But rocks with single line:  
[http://mouraf.org/documents/rails/rocks.png](http://mouraf.org/documents/rails/rocks.png)

–  
,========================.  
| Pierre-Alexandre M. |  
| email : removed\_email\_address@domain.invalid |  
`========================’
