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.
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