0

I need to generate a Stacked Bar Graph using Gruff. I have tried with the following code:

require 'rubygems'
require 'gruff'

g = Gruff::StackedBar.new('450x450') 

g.sort = false
g.maximum_value = 100 
g.minimum_value = 0 
g.y_axis_increment = 10

g.title = 'Quarterly Exams'

g.data('English',20,30,40)
g.data('Maths',10,20,30)
g.sort = false 

g.write('quarterly_progress.png')

But, this throws an error saying wrong number of arguments. I want a stacked bar graph with showing three values.

Andrew Marshall
  • 95,083
  • 20
  • 220
  • 214
verdure
  • 3,201
  • 6
  • 26
  • 27

1 Answers1

0

Just put values inside aray like this:

g.data('English',[20,30,40])                                   
g.data('Maths',  [10,20,30])

See gruff documentation on rubyforge: http://gruff.rubyforge.org/. Gruff::Base#data

XoR
  • 2,556
  • 4
  • 17
  • 15