3 require File.dirname(__FILE__) + "/gruff_test_case"
5 class TestGruffArea < GruffTestCase
9 [:Jimmy, [25, 36, 86, 39, 25, 31, 79, 88]],
10 [:Charles, [80, 54, 67, 54, 68, 70, 90, 95]],
11 [:Julie, [22, 29, 35, 38, 36, 40, 46, 57]],
12 [:Jane, [95, 95, 95, 90, 85, 80, 88, 100]],
13 [:Philip, [90, 34, 23, 12, 78, 89, 98, 88]],
14 ["Arthur", [5, 10, 13, 11, 6, 16, 22, 32]],
31 g.title = "Visual Multi-Area Graph Test"
38 @datasets.each do |data|
39 g.data(data[0], data[1])
43 g.write("test/output/area_keynote.png")
47 g = Gruff::Area.new(400)
48 g.title = "Small Size Multi-Area Graph Test"
55 @datasets.each do |data|
56 g.data(data[0], data[1])
60 g.write("test/output/area_keynote_small.png")
63 def test_many_datapoints
65 g.title = "Many Multi-Area Graph Test"
72 g.data('many points', (0..50).collect {|i| rand(100) })
75 g.write("test/output/area_many.png")
78 def test_many_areas_graph_small
79 g = Gruff::Area.new(400)
80 g.title = "Many Values Area Test 400px"
89 %w{jimmy jane philip arthur julie bert}.each do |student_name|
90 g.data(student_name, (0..50).collect { |i| rand 100 })
94 g.write("test/output/area_many_areas_small.png")
97 def test_area_graph_tiny
98 g = Gruff::Area.new(300)
99 g.title = "Area Test 300px"
108 %w{jimmy jane philip arthur julie bert}.each do |student_name|
109 g.data(student_name, (0..50).collect { |i| rand 100 })
113 g.write("test/output/area_tiny.png")
117 g = setup_basic_graph('800x400')
118 g.title = "Area Wide"
119 g.write("test/output/area_wide.png")
124 def setup_basic_graph(size=800)
125 g = Gruff::Area.new(size)
126 g.title = "My Graph Title"
127 g.labels = @sample_labels
128 @datasets.each do |data|
129 g.data(data[0], data[1])