Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ruby
- require 'rubygems'
- require 'gruff'
- # With more options now
- g = Gruff::Bar.new('800x500') # Define a custom size
- g.sort = false # Do NOT sort data based on values
- g.maximum_value = 50 # Declare a max value for the Y axis
- g.minimum_value = 0 # Declare a min value for the Y axis
- g.theme_37signals # Declare a theme from the presets available
- g.title = 'A more advanced bar chart'
- g.data('Foo', [5, 10, 24])
- g.data('Bar', [15, 3, 10])
- g.data('Else', [38, 15, 32])
- g.labels = {0 => 'Last year', 1 => 'This year', 2 => 'Next year'} # Define labels for each of the "columns" in data
- g.write('a_more_advanced_graph.png')
Add Comment
Please, Sign In to add comment