Guest User

Untitled

a guest
Feb 20th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #!/usr/bin/ruby
  2.  
  3. require 'rubygems'
  4. require 'gruff'
  5.  
  6. # With more options now
  7. g = Gruff::Bar.new('800x500') # Define a custom size
  8.  
  9. g.sort = false # Do NOT sort data based on values
  10. g.maximum_value = 50 # Declare a max value for the Y axis
  11. g.minimum_value = 0 # Declare a min value for the Y axis
  12.  
  13. g.theme_37signals # Declare a theme from the presets available
  14.  
  15. g.title = 'A more advanced bar chart'
  16.  
  17. g.data('Foo', [5, 10, 24])
  18. g.data('Bar', [15, 3, 10])
  19. g.data('Else', [38, 15, 32])
  20.  
  21. g.labels = {0 => 'Last year', 1 => 'This year', 2 => 'Next year'} # Define labels for each of the "columns" in data
  22.  
  23. g.write('a_more_advanced_graph.png')
Add Comment
Please, Sign In to add comment