pfsc-gruff 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. data/History.txt +117 -0
  2. data/MIT-LICENSE +21 -0
  3. data/Manifest.txt +81 -0
  4. data/README.txt +40 -0
  5. data/Rakefile +55 -0
  6. data/assets/bubble.png +0 -0
  7. data/assets/city_scene/background/0000.png +0 -0
  8. data/assets/city_scene/background/0600.png +0 -0
  9. data/assets/city_scene/background/2000.png +0 -0
  10. data/assets/city_scene/clouds/cloudy.png +0 -0
  11. data/assets/city_scene/clouds/partly_cloudy.png +0 -0
  12. data/assets/city_scene/clouds/stormy.png +0 -0
  13. data/assets/city_scene/grass/default.png +0 -0
  14. data/assets/city_scene/haze/true.png +0 -0
  15. data/assets/city_scene/number_sample/1.png +0 -0
  16. data/assets/city_scene/number_sample/2.png +0 -0
  17. data/assets/city_scene/number_sample/default.png +0 -0
  18. data/assets/city_scene/sky/0000.png +0 -0
  19. data/assets/city_scene/sky/0200.png +0 -0
  20. data/assets/city_scene/sky/0400.png +0 -0
  21. data/assets/city_scene/sky/0600.png +0 -0
  22. data/assets/city_scene/sky/0800.png +0 -0
  23. data/assets/city_scene/sky/1000.png +0 -0
  24. data/assets/city_scene/sky/1200.png +0 -0
  25. data/assets/city_scene/sky/1400.png +0 -0
  26. data/assets/city_scene/sky/1500.png +0 -0
  27. data/assets/city_scene/sky/1700.png +0 -0
  28. data/assets/city_scene/sky/2000.png +0 -0
  29. data/assets/pc306715.jpg +0 -0
  30. data/assets/plastik/blue.png +0 -0
  31. data/assets/plastik/green.png +0 -0
  32. data/assets/plastik/red.png +0 -0
  33. data/init.rb +2 -0
  34. data/lib/gruff.rb +28 -0
  35. data/lib/gruff/accumulator_bar.rb +27 -0
  36. data/lib/gruff/area.rb +58 -0
  37. data/lib/gruff/bar.rb +87 -0
  38. data/lib/gruff/bar_conversion.rb +46 -0
  39. data/lib/gruff/base.rb +1123 -0
  40. data/lib/gruff/bullet.rb +109 -0
  41. data/lib/gruff/deprecated.rb +39 -0
  42. data/lib/gruff/dot.rb +113 -0
  43. data/lib/gruff/line.rb +135 -0
  44. data/lib/gruff/mini/bar.rb +37 -0
  45. data/lib/gruff/mini/legend.rb +109 -0
  46. data/lib/gruff/mini/pie.rb +36 -0
  47. data/lib/gruff/mini/side_bar.rb +35 -0
  48. data/lib/gruff/net.rb +140 -0
  49. data/lib/gruff/photo_bar.rb +100 -0
  50. data/lib/gruff/pie.rb +126 -0
  51. data/lib/gruff/scene.rb +209 -0
  52. data/lib/gruff/side_bar.rb +118 -0
  53. data/lib/gruff/side_stacked_bar.rb +77 -0
  54. data/lib/gruff/spider.rb +130 -0
  55. data/lib/gruff/stacked_area.rb +67 -0
  56. data/lib/gruff/stacked_bar.rb +57 -0
  57. data/lib/gruff/stacked_mixin.rb +23 -0
  58. data/rails_generators/gruff/gruff_generator.rb +63 -0
  59. data/rails_generators/gruff/templates/controller.rb +32 -0
  60. data/rails_generators/gruff/templates/functional_test.rb +24 -0
  61. data/test/gruff_test_case.rb +123 -0
  62. data/test/test_accumulator_bar.rb +50 -0
  63. data/test/test_area.rb +134 -0
  64. data/test/test_bar.rb +321 -0
  65. data/test/test_base.rb +8 -0
  66. data/test/test_bullet.rb +26 -0
  67. data/test/test_dot.rb +273 -0
  68. data/test/test_legend.rb +68 -0
  69. data/test/test_line.rb +556 -0
  70. data/test/test_mini_bar.rb +33 -0
  71. data/test/test_mini_pie.rb +26 -0
  72. data/test/test_mini_side_bar.rb +37 -0
  73. data/test/test_net.rb +230 -0
  74. data/test/test_photo.rb +41 -0
  75. data/test/test_pie.rb +154 -0
  76. data/test/test_scene.rb +100 -0
  77. data/test/test_side_bar.rb +29 -0
  78. data/test/test_sidestacked_bar.rb +89 -0
  79. data/test/test_spider.rb +216 -0
  80. data/test/test_stacked_area.rb +52 -0
  81. data/test/test_stacked_bar.rb +52 -0
  82. metadata +186 -0
@@ -0,0 +1,68 @@
1
+ require File.dirname(__FILE__) + "/gruff_test_case"
2
+
3
+ class TestGruffLegend < GruffTestCase
4
+
5
+ def setup
6
+ @datasets = [
7
+ [:Jimmy, [25, 36, 86, 39, 25, 31, 79, 88]],
8
+ [:Charles, [80, 54, 67, 54, 68, 70, 90, 95]],
9
+ [:Julie, [22, 29, 35, 38, 36, 40, 46, 57]],
10
+ [:Jane, [95, 95, 95, 90, 85, 80, 88, 100]],
11
+ [:Philip, [90, 34, 23, 12, 78, 89, 98, 88]],
12
+ ["Arthur", [5, 10, 13, 11, 6, 16, 22, 32]],
13
+ ["Vincent", [5, 10, 13, 11, 6, 16, 22, 32]],
14
+ ["Jake", [5, 10, 13, 11, 6, 16, 22, 32]],
15
+ ["Stephen", [5, 10, 13, 11, 6, 16, 22, 32]],
16
+ ]
17
+
18
+ @sample_labels = {
19
+ 0 => '5/6',
20
+ 1 => '5/15',
21
+ 2 => '5/24',
22
+ 3 => '5/30',
23
+ 4 => '6/4',
24
+ 5 => '6/12',
25
+ 6 => '6/21',
26
+ 7 => '6/28',
27
+ }
28
+ end
29
+
30
+ def full_suite_for(name, type)
31
+ [800, 400].each do |width|
32
+ [nil, 4, 16, 30].each do |font_size|
33
+ g = type.new(width)
34
+ g.title = "Wrapped Legend Bar Test #{font_size}pts #{width}px"
35
+ g.labels = @sample_labels
36
+ 0xEFD250.step(0xFF0000, 60) do |num|
37
+ g.colors << "#%x" % num
38
+ end
39
+
40
+ @datasets.each do |data|
41
+ g.data(data[0], data[1])
42
+ end
43
+
44
+ g.legend_font_size = font_size unless font_size.nil?
45
+ g.write("test/output/#{name}_wrapped_legend_#{font_size}_#{width}.png")
46
+ end
47
+ end
48
+ end
49
+
50
+ def test_bar_legend_wrap
51
+ full_suite_for(:bar, Gruff::Bar)
52
+ end
53
+
54
+ def test_pie_legend_wrap
55
+ full_suite_for(:pie, Gruff::Pie)
56
+ end
57
+
58
+ def test_more_than_two_lines_of_legends
59
+ @datasets = @datasets + [[:Julie2, [22, 29, 35, 38, 36, 40, 46, 57]],
60
+ [:Jane2, [95, 95, 95, 90, 85, 80, 88, 100]],
61
+ [:Philip2, [90, 34, 23, 12, 78, 89, 98, 88]],
62
+ ["Arthur2", [5, 10, 13, 11, 6, 16, 22, 32]],
63
+ ["Vincent2", [5, 10, 13, 11, 6, 16, 22, 32]],
64
+ ["Jake2", [5, 10, 13, 11, 6, 16, 22, 32]],
65
+ ["Stephen2", [5, 10, 13, 11, 6, 16, 22, 32]]]
66
+ full_suite_for(:bar2, Gruff::Bar)
67
+ end
68
+ end
@@ -0,0 +1,556 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require File.dirname(__FILE__) + "/gruff_test_case"
4
+
5
+ class TestGruffLine < GruffTestCase
6
+
7
+ # TODO Delete old output files once when starting tests
8
+
9
+ def test_should_render_with_transparent_theme
10
+ g = Gruff::Line.new(400)
11
+ g.title = "Transparent Background"
12
+ g.theme = {
13
+ :colors => ['black', 'grey'],
14
+ :marker_color => 'grey',
15
+ :font_color => 'black',
16
+ :background_colors => 'transparent'
17
+ }
18
+
19
+ g.labels = {
20
+ 0 => '5/6',
21
+ 1 => '5/15',
22
+ 2 => '5/24',
23
+ 3 => '5/30',
24
+ }
25
+ g.data(:apples, [-1, 0, 4, -4])
26
+ g.data(:peaches, [10, 8, 6, 3])
27
+ g.write("test/output/line_transparent.png")
28
+ end
29
+
30
+ def test_line_graph_with_themes
31
+ line_graph_with_themes()
32
+ line_graph_with_themes(400)
33
+ end
34
+
35
+ def test_one_value
36
+ g = Gruff::Line.new
37
+ g.title = "One Value"
38
+ g.labels = {
39
+ 0 => '1',
40
+ 1 => '2'
41
+ }
42
+ g.data('one', 1)
43
+
44
+ g.write("test/output/line_one_value.png")
45
+ end
46
+
47
+ def test_one_value_array
48
+ g = Gruff::Line.new
49
+ g.title = "One Value in an Array"
50
+ g.labels = {
51
+ 0 => '1',
52
+ 1 => '2'
53
+ }
54
+ g.data('one', [1])
55
+
56
+ g.write("test/output/line_one_value_array.png")
57
+ end
58
+
59
+
60
+ def test_should_not_hang_with_0_0_100
61
+ g = Gruff::Line.new(320)
62
+ g.title = "Hang Value Graph Test"
63
+ g.data('test', [0,0,100])
64
+
65
+ g.write("test/output/line_hang_value.png")
66
+ end
67
+
68
+ # TODO
69
+ # def test_fix_crash
70
+ # g = Gruff::Line.new(370)
71
+ # g.title = "Crash Test"
72
+ # g.data "ichi", [5]
73
+ # g.data "ni", [0]
74
+ # g.data "san", [0]
75
+ # g.data "shi", [0]
76
+ # g.write("test/output/line_crash_fix_test.png")
77
+ # end
78
+
79
+
80
+ def test_line_small_values
81
+ @datasets = [
82
+ [:small, [0.1, 0.14356, 0.0, 0.5674839, 0.456]],
83
+ [:small2, [0.2, 0.3, 0.1, 0.05, 0.9]]
84
+ ]
85
+
86
+ g = Gruff::Line.new
87
+ g.title = "Small Values Line Graph Test"
88
+ @datasets.each do |data|
89
+ g.data(data[0], data[1])
90
+ end
91
+ g.write("test/output/line_small.png")
92
+
93
+ g = Gruff::Line.new(400)
94
+ g.title = "Small Values Line Graph Test 400px"
95
+ @datasets.each do |data|
96
+ g.data(data[0], data[1])
97
+ end
98
+ g.write("test/output/line_small_small.png")
99
+ end
100
+
101
+ def test_line_starts_with_zero
102
+ @datasets = [
103
+ [:first0, [0, 5, 10, 8, 18]],
104
+ [:normal, [1, 2, 3, 4, 5]]
105
+ ]
106
+
107
+ g = Gruff::Line.new
108
+ g.title = "Small Values Line Graph Test"
109
+ @datasets.each do |data|
110
+ g.data(data[0], data[1])
111
+ end
112
+ g.write("test/output/line_small_zero.png")
113
+
114
+ g = Gruff::Line.new(400)
115
+ g.title = "Small Values Line Graph Test 400px"
116
+ @datasets.each do |data|
117
+ g.data(data[0], data[1])
118
+ end
119
+ g.write("test/output/line_small_small_zero.png")
120
+ end
121
+
122
+
123
+ def test_line_large_values
124
+ @datasets = [
125
+ [:large, [100_005, 35_000, 28_000, 27_000]],
126
+ [:large2, [35_000, 28_000, 27_000, 100_005]],
127
+ [:large3, [28_000, 27_000, 100_005, 35_000]],
128
+ [:large4, [1_238, 39_092, 27_938, 48_876]]
129
+ ]
130
+
131
+ g = Gruff::Line.new
132
+ g.title = "Very Large Values Line Graph Test"
133
+ g.baseline_value = 50_000
134
+ g.baseline_color = 'green'
135
+ g.dot_radius = 15
136
+ g.line_width = 3
137
+ @datasets.each do |data|
138
+ g.data(data[0], data[1])
139
+ end
140
+
141
+ g.write("test/output/line_large.png")
142
+ end
143
+
144
+ # def test_long_title
145
+ #
146
+ # end
147
+ #
148
+ # def test_add_colors
149
+ #
150
+ # end
151
+ #
152
+
153
+ def test_request_too_many_colors
154
+ g = Gruff::Line.new
155
+ g.title = "More Sets Than in Color Array"
156
+ # g.theme = {} # Sets theme with only black and white
157
+ @datasets.each do |data|
158
+ g.data(data[0], data[1])
159
+ end
160
+ @datasets.each do |data|
161
+ g.data("#{data[0]}-B", data[1].map {|d| d + 20})
162
+ end
163
+ g.write("test/output/line_more_sets_than_colors.png")
164
+ end
165
+
166
+ #
167
+ # def test_add_data
168
+ #
169
+ # end
170
+
171
+ def test_many_datapoints
172
+ g = Gruff::Line.new
173
+ g.title = "Many Multi-Line Graph Test"
174
+ g.labels = {
175
+ 0 => 'June',
176
+ 10 => 'July',
177
+ 30 => 'August',
178
+ 50 => 'September',
179
+ }
180
+ g.data('many points', (0..50).collect {|i| rand(100) })
181
+ g.x_axis_label = "Months"
182
+
183
+ # Default theme
184
+ g.write("test/output/line_many.png")
185
+ end
186
+
187
+
188
+ def test_similar_high_end_values
189
+ @dataset = %w(29.43 29.459 29.498 29.53 29.548 29.589 29.619 29.66 29.689 29.849 29.878 29.74 29.769 29.79 29.808 29.828).collect {|i| i.to_f}
190
+
191
+ g = Gruff::Line.new
192
+ g.title = "Similar High End Values Test"
193
+ g.data('similar points', @dataset )
194
+ g.write("test/output/line_similar_high_end_values.png")
195
+
196
+ g = Gruff::Line.new
197
+ g.title = "Similar High End Values With Floor"
198
+ g.data('similar points', @dataset )
199
+ g.minimum_value = 0
200
+ g.y_axis_label = "Barometric Pressure"
201
+ g.write("test/output/line_similar_high_end_values_with_floor.png")
202
+ end
203
+
204
+ def test_many_lines_graph_small
205
+ g = Gruff::Line.new(400)
206
+ g.title = "Many Values Line Test 400px"
207
+ g.labels = {
208
+ 0 => '5/6',
209
+ 10 => '5/15',
210
+ 20 => '5/24',
211
+ 30 => '5/30',
212
+ 40 => '6/4',
213
+ 50 => '6/16'
214
+ }
215
+ %w{jimmy jane philip arthur julie bert}.each do |student_name|
216
+ g.data(student_name, (0..50).collect { |i| rand 100 })
217
+ end
218
+
219
+ # Default theme
220
+ g.write("test/output/line_many_lines_small.png")
221
+ end
222
+
223
+ def test_graph_tiny
224
+ g = Gruff::Line.new(300)
225
+ g.title = "Tiny Test 300px"
226
+ g.labels = {
227
+ 0 => '5/6',
228
+ 10 => '5/15',
229
+ 20 => '5/24',
230
+ 30 => '5/30',
231
+ 40 => '6/4',
232
+ 50 => '6/16'
233
+ }
234
+ %w{jimmy jane philip arthur julie bert}.each do |student_name|
235
+ g.data(student_name, (0..50).collect { |i| rand 100 })
236
+ end
237
+
238
+ # Default theme
239
+ g.write("test/output/line_tiny.png")
240
+ end
241
+
242
+ def test_no_data
243
+ g = Gruff::Line.new(400)
244
+ g.title = "No Data"
245
+ # Default theme
246
+ g.write("test/output/line_no_data.png")
247
+
248
+ g = Gruff::Line.new(400)
249
+ g.title = "No Data Title"
250
+ g.no_data_message = 'There is no data'
251
+ g.write("test/output/line_no_data_msg.png")
252
+ end
253
+
254
+
255
+ def test_all_zeros
256
+ g = Gruff::Line.new(400)
257
+ g.title = "All Zeros"
258
+
259
+ g.data(:gus, [0,0,0,0])
260
+
261
+ # Default theme
262
+ g.write("test/output/line_no_data_other.png")
263
+ end
264
+
265
+
266
+ def test_some_nil_points
267
+ g = Gruff::Line.new
268
+ g.title = "Some Nil Points"
269
+
270
+ @datasets = [
271
+ [:data1, [1, 2, 3, nil, 3, 5, 6]],
272
+ [:data2, [5, nil, nil, nil, nil, nil, 5]],
273
+ [:data3, [4, nil, 2, 1, 0]],
274
+ [:data4, [nil, nil, 3, 1, 2]]
275
+ ]
276
+
277
+ @datasets.each do |data|
278
+ g.data(*data)
279
+ end
280
+
281
+ # Default theme
282
+ g.write("test/output/line_some_nil_points.png")
283
+ end
284
+
285
+ def test_no_title
286
+ g = Gruff::Line.new(400)
287
+ g.labels = @labels
288
+ @datasets.each do |data|
289
+ g.data(data[0], data[1])
290
+ end
291
+
292
+ g.write("test/output/line_no_title.png")
293
+ end
294
+
295
+ def test_no_line_markers
296
+ g = setup_basic_graph(400)
297
+ g.title = "No Line Markers"
298
+ g.hide_line_markers = true
299
+ g.write("test/output/line_no_line_markers.png")
300
+ end
301
+
302
+ def test_no_legend
303
+ g = setup_basic_graph(400)
304
+ g.title = "No Legend"
305
+ g.hide_legend = true
306
+ g.write("test/output/line_no_legend.png")
307
+ end
308
+
309
+ def test_nothing_but_the_graph
310
+ g = setup_basic_graph(400)
311
+ g.title = "THIS TITLE SHOULD NOT DISPLAY!!!"
312
+ g.hide_line_markers = true
313
+ g.hide_legend = true
314
+ g.hide_title = true
315
+ g.write("test/output/line_nothing_but_the_graph.png")
316
+ end
317
+
318
+ def test_baseline_larger_than_data
319
+ g = setup_basic_graph(400)
320
+ g.title = "Baseline Larger Than Data"
321
+ g.baseline_value = 150
322
+ g.write("test/output/line_large_baseline.png")
323
+ end
324
+
325
+
326
+ def test_hide_dots
327
+ g = setup_basic_graph(400)
328
+ g.title = "Hide Dots"
329
+ g.hide_dots = true
330
+ g.write("test/output/line_hide_dots.png")
331
+ end
332
+
333
+ def test_hide_lines
334
+ g = setup_basic_graph(400)
335
+ g.title = "Hide Lines"
336
+ g.hide_lines = true
337
+ g.write("test/output/line_hide_lines.png")
338
+ end
339
+
340
+ def test_wide_graph
341
+ g = setup_basic_graph('800x400')
342
+ g.title = "Wide Graph"
343
+ g.write("test/output/line_wide_graph.png")
344
+
345
+ g = setup_basic_graph('400x200')
346
+ g.title = "Wide Graph Small"
347
+ g.write("test/output/line_wide_graph_small.png")
348
+ end
349
+
350
+ def test_negative
351
+ g = setup_pos_neg(800)
352
+ g.write("test/output/line_pos_neg.png")
353
+
354
+ g = setup_pos_neg(400)
355
+ g.title = 'Pos/Neg Line Test Small'
356
+ g.write("test/output/line_pos_neg_400.png")
357
+ end
358
+
359
+ def test_all_negative
360
+ g = setup_all_neg(800)
361
+ g.write("test/output/line_all_neg.png")
362
+
363
+ g = setup_all_neg(400)
364
+ g.title = 'All Neg Line Test Small'
365
+ g.write("test/output/line_all_neg_400.png")
366
+ end
367
+
368
+ def test_many_numbers
369
+ g = Gruff::Line.new('400x170')
370
+ g.title = "Line Test, Many Numbers"
371
+
372
+ data = [
373
+ { :date => '01',
374
+ :wpm => 0,
375
+ :errors => 0,
376
+ :accuracy => 0 },
377
+ { :date => '02',
378
+ :wpm => 10,
379
+ :errors => 2,
380
+ :accuracy => 80 },
381
+ { :date => '03',
382
+ :wpm => 15,
383
+ :errors => 0,
384
+ :accuracy => 100 },
385
+ { :date => '04',
386
+ :wpm => 16,
387
+ :errors => 2,
388
+ :accuracy => 87 },
389
+ { :date => '05',
390
+ :wpm => nil,
391
+ :errors => nil,
392
+ :accuracy => nil },
393
+ { :date => '06',
394
+ :wpm => 18,
395
+ :errors => 1,
396
+ :accuracy => 94 },
397
+ { :date => '07'},
398
+ { :date => '08' },
399
+ { :date => '09',
400
+ :wpm => 21,
401
+ :errors => 1,
402
+ :accuracy => 95 },
403
+ { :date => '10'},
404
+ { :date => '11'},
405
+ { :date => '12'},
406
+ { :date => '13'},
407
+ { :date => '14'},
408
+ { :date => '15'},
409
+ { :date => '16'},
410
+ { :date => '17'},
411
+ { :date => '18'},
412
+ { :date => '19',
413
+ :wpm => 28,
414
+ :errors => 5,
415
+ :accuracy => 82 },
416
+ { :date => '20'},
417
+ { :date => '21'},
418
+ { :date => '22'},
419
+ { :date => '23'},
420
+ { :date => '24'},
421
+ { :date => '25'},
422
+ { :date => '26'},
423
+ { :date => '27',
424
+ :wpm => 37,
425
+ :errors => 3,
426
+ :accuracy => 92 },
427
+ ]
428
+
429
+ [:wpm, :errors, :accuracy].each do |field|
430
+ g.data(field.to_s, data.collect {|d| d[field] })
431
+ end
432
+
433
+ labels = Hash.new
434
+ data.each_with_index do |d, i|
435
+ labels[i] = d[:date]
436
+ end
437
+ g.labels = labels
438
+
439
+ g.write('test/output/line_many_numbers.png')
440
+ end
441
+
442
+ def test_no_hide_line_no_labels
443
+ g = Gruff::Line.new
444
+ g.title = "No Hide Line No Labels"
445
+ @datasets.each do |data|
446
+ g.data(data[0], data[1])
447
+ end
448
+ g.hide_line_markers = false
449
+ g.write('test/output/line_no_hide.png')
450
+ end
451
+
452
+
453
+ def test_jruby_error
454
+ g = Gruff::Line.new
455
+ g.theme = {
456
+ :colors => ['#7F0099', '#2F85ED', '#2FED09','#EC962F'],
457
+ :marker_color => '#aaa',
458
+ :background_colors => ['#E8E8E8','#B9FD6C']
459
+ }
460
+ g.hide_title = true
461
+
462
+ g.legend_font_size = 12
463
+ g.marker_font_size = 16
464
+ g.hide_dots = false
465
+ g.label_max_decimals = 1
466
+
467
+ g.write('test/output/line_jruby_error.png')
468
+ end
469
+
470
+ private
471
+
472
+ def bmi(params={})
473
+ g = basic_graph()
474
+
475
+ g.y_axis_label = 'BMI'
476
+
477
+ bmis = [24.3, 23.9, 23.7, 23.7, 23.6, 23.9, 23.6, 23.7, 23.4, 23.4, 23.4, 22.9]
478
+
479
+ g.data( 'BMI', bmis )
480
+ g.hide_legend = true
481
+ return g
482
+ end
483
+
484
+ # TODO Reset data after each theme
485
+ def line_graph_with_themes(size=nil)
486
+ g = Gruff::Line.new(size)
487
+ g.title = "Multi-Line Graph Test #{size}"
488
+ g.labels = @labels
489
+ g.baseline_value = 90
490
+ @datasets.each do |data|
491
+ g.data(data[0], data[1])
492
+ end
493
+ # Default theme
494
+ g.write("test/output/line_theme_keynote_#{size}.png")
495
+
496
+ g = Gruff::Line.new(size)
497
+ g.title = "Multi-Line Graph Test #{size}"
498
+ g.labels = @labels
499
+ g.baseline_value = 90
500
+ g.theme_37signals
501
+ @datasets.each do |data|
502
+ g.data(data[0], data[1])
503
+ end
504
+ g.write("test/output/line_theme_37signals_#{size}.png")
505
+
506
+ g = Gruff::Line.new(size)
507
+ g.title = "Multi-Line Graph Test #{size}"
508
+ g.labels = @labels
509
+ g.baseline_value = 90
510
+ g.theme_rails_keynote
511
+ @datasets.each do |data|
512
+ g.data(data[0], data[1])
513
+ end
514
+ g.write("test/output/line_theme_rails_keynote_#{size}.png")
515
+
516
+ g = Gruff::Line.new(size)
517
+ g.title = "Multi-Line Graph Test #{size}"
518
+ g.labels = @labels
519
+ g.baseline_value = 90
520
+ g.theme_odeo
521
+ @datasets.each do |data|
522
+ g.data(data[0], data[1])
523
+ end
524
+ g.write("test/output/line_theme_odeo_#{size}.png")
525
+ end
526
+
527
+ def setup_pos_neg(size=800)
528
+ g = Gruff::Line.new(size)
529
+ g.title = "Pos/Neg Line Graph Test"
530
+ g.labels = {
531
+ 0 => '5/6',
532
+ 1 => '5/15',
533
+ 2 => '5/24',
534
+ 3 => '5/30',
535
+ }
536
+ g.data(:apples, [-1, 0, 4, -4])
537
+ g.data(:peaches, [10, 8, 6, 3])
538
+ return g
539
+ end
540
+
541
+
542
+ def setup_all_neg(size=800)
543
+ g = Gruff::Line.new(size)
544
+ g.title = "All Neg Line Graph Test"
545
+ g.labels = {
546
+ 0 => '5/6',
547
+ 1 => '5/15',
548
+ 2 => '5/24',
549
+ 3 => '5/30',
550
+ }
551
+ g.data(:apples, [-1, -5, -20, -4])
552
+ g.data(:peaches, [-10, -8, -6, -3])
553
+ g
554
+ end
555
+
556
+ end