# Gruff Stacked Bar order of data

**URL:** <https://www.ruby-forum.com/t/gruff-stacked-bar-order-of-data/106048>\
**Category:** Rails\
**Created:** [June 5, 2007, 10:22pm UTC](https://www.ruby-forum.com/t/gruff-stacked-bar-order-of-data/106048 "2007-06-05T22:22:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![catalleres](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ee59a6/32.png) [@catalleres](https://www.ruby-forum.com/u/catalleres)\
**Post date:** [June 5, 2007, 10:22pm UTC](https://www.ruby-forum.com/t/gruff-stacked-bar-order-of-data/106048/1 "2007-06-05T22:22:06Z")

</div>

I am making a stacked bar graph in Gruff. Could anyone help me by  
telling me how I can change the order in which the data is stacked. No  
matter what order I put the data in, I get the same result on the png  
picure. Any help would be much appreciated.  
Thanks.

---

<div class="post-metadata">

**Author:** ![catalleres](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ee59a6/32.png) [@catalleres](https://www.ruby-forum.com/u/catalleres)\
**Post date:** [September 9, 2010, 4:55pm UTC](https://www.ruby-forum.com/t/gruff-stacked-bar-order-of-data/106048/2 "2010-09-09T16:55:54Z")

</div>

Jorge Rodriguez wrote:

> I am making a stacked bar graph in Gruff. Could anyone help me by  
> telling me how I can change the order in which the data is stacked. No  
> matter what order I put the data in, I get the same result on the png  
> picure. Any help would be much appreciated.  
> Thanks.

Too late to help the original poster, but might be helpful for anyone  
else like me who only finds this post when searching on this problem:

Gruff automatically sorts bars with largest average value in the back.  
You can turn this off by specifying sort = false when setting up the  
graph. ie

g = Gruff::StackedBar.new(800)  
g.data(‘Data Type 1’, values1)  
g.data(‘Data Type 2’, values2)  
g.sort = false

-1R
