Added the Gruff library to the lib/ directory of the the rails folder, and the
[selectricity] / lib / gruff-0.2.8 / test / test_stacked_bar.rb
1 #!/usr/bin/ruby
2
3 require File.dirname(__FILE__) + "/gruff_test_case"
4
5 class TestGruffStackedBar < GruffTestCase
6
7   def setup
8     @datasets = [
9       [:Jimmy, [25, 36, 86, 39]],
10       [:Charles, [80, 54, 67, 54]],
11       [:Julie, [22, 29, 35, 38]],
12       ]
13     @sample_labels = {
14         0 => '5/6', 
15         1 => '5/15', 
16         2 => '5/24'
17       }      
18
19   end
20
21   def test_bar_graph
22     g = Gruff::StackedBar.new
23     g.title = "Visual Stacked Bar Graph Test"
24     g.labels = {
25       0 => '5/6', 
26       1 => '5/15', 
27       2 => '5/24', 
28       3 => '5/30', 
29     }
30     @datasets.each do |data|
31       g.data(data[0], data[1])
32     end
33     g.write "test/output/stacked_bar_keynote.png"
34   end
35
36
37   def test_bar_graph_small
38     g = Gruff::StackedBar.new(400)
39     g.title = "Visual Stacked Bar Graph Test"
40     g.labels = {
41       0 => '5/6', 
42       1 => '5/15', 
43       2 => '5/24', 
44       3 => '5/30', 
45     }
46     @datasets.each do |data|
47       g.data(data[0], data[1])
48     end
49     g.write "test/output/stacked_bar_keynote_small.png"
50   end
51   
52 end

Benjamin Mako Hill || Want to submit a patch?