gruff 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -66,7 +66,7 @@ spec = Gem::Specification.new do |s|
66
66
  s.require_path = 'lib'
67
67
  s.autorequire = 'gruff'
68
68
 
69
- s.files = [ "rakefile", "README", "CHANGELOG", "MIT-LICENSE" ]
69
+ s.files = [ "Rakefile", "README", "CHANGELOG", "MIT-LICENSE" ]
70
70
  s.files = s.files + Dir.glob( "lib/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
71
71
  s.files = s.files + Dir.glob( "assets/*" ).delete_if { |item| item.include?( "\.svn" ) }
72
72
  s.files = s.files + Dir.glob( "test/**/*" ).delete_if { |item| item.include?( "\.svn" ) || item.include?("\.png") }
data/lib/gruff.rb CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  # Extra full path added to fix some require errors on some installations.
3
2
 
4
3
  require File.dirname(__FILE__) + '/gruff/base'
@@ -10,4 +9,3 @@ require File.dirname(__FILE__) + '/gruff/pie'
10
9
  require File.dirname(__FILE__) + '/gruff/stacked_bar'
11
10
  require File.dirname(__FILE__) + '/gruff/side_stacked_bar'
12
11
  require File.dirname(__FILE__) + '/gruff/photo_bar'
13
-
@@ -10,14 +10,6 @@
10
10
  #
11
11
  # $Log: bar_conversion.rb $
12
12
  # $Log: Added comments $
13
- # ------------------------------------------------------------------------
14
- # This program was written by David Stokar is
15
- # licensed under the GNU GPL license. Please see below for details. This
16
- # header contains information regarding licensing terms under the GPL, and
17
- # information regarding obtaining source code from the Author. Consequently,
18
- # pursuant to section 3(c) of the GPL, you must accompany the information
19
- # found in this header with any distribution you make of this Program.
20
- # ------------------------------------------------------------------------
21
13
  ##############################################################################
22
14
 
23
15
  #
data/lib/gruff/base.rb CHANGED
@@ -3,21 +3,21 @@
3
3
  #
4
4
  # Author:: Geoffrey Grosenbach boss@topfunky.com
5
5
  #
6
- # Date Created:: October 23, 2005
6
+ # Originally Created:: October 23, 2005
7
7
  #
8
- #
9
- # Other contributors:
10
- #
11
- # Jarkko Laine, Mike Perham, Andreas Schwarz, Alun Eyre, Guillaume Theoret, David Stokar, and others.
8
+ # Extra thanks to Tim Hunter for writing RMagick,
9
+ # and also contributions by
10
+ # Jarkko Laine, Mike Perham, Andreas Schwarz,
11
+ # Alun Eyre, Guillaume Theoret, David Stokar,
12
+ # Paul Rogers, Dave Woodward, Frank Oxener,
13
+ # and a cast of thousands.
12
14
  #
13
15
 
14
16
  require 'RMagick'
15
17
 
16
- #require 'yaml'
17
-
18
18
  module Gruff
19
19
 
20
- VERSION = '0.1.0'
20
+ VERSION = '0.1.1'
21
21
 
22
22
  class Base
23
23
 
@@ -42,6 +42,9 @@ module Gruff
42
42
 
43
43
  # Font used for titles, labels, etc. Works best if you provide the full path to the TTF font file.
44
44
  # RMagick must be built with the Freetype libraries for this to work properly.
45
+ #
46
+ # Tries to find Bitstream Vera (Vera.ttf) in the location specified by
47
+ # ENV['MAGICK_FONT_PATH']. Uses default RMagick font otherwise.
45
48
  attr_accessor :font
46
49
 
47
50
  # Hide various elements
@@ -50,15 +53,20 @@ module Gruff
50
53
  # Message shown when there is no data. Fits up to 20 characters. Defaults to "No Data."
51
54
  attr_accessor :no_data_message
52
55
 
53
- # Optionally set the size of the legend font. Based on an 800x600px graph. Default is 20.
56
+ # Optionally set the size of the font. Based on an 800x600px graph. Default is 20.
54
57
  #
55
58
  # Will be scaled down if graph is smaller than 800px wide.
56
59
  attr_accessor :legend_font_size
57
60
 
58
- # Graph is drawn at 4/3 ratio (800x600, 400x300, etc.).
61
+ attr_accessor :marker_font_size
62
+
63
+ attr_accessor :title_font_size
64
+
65
+ # If one numerical argument is given, the graph is drawn at 4/3 ratio according to the given width (800 results in 800x600, 400 gives 400x300, etc.).
59
66
  #
60
- # Looks for Bitstream Vera as the default font. Expects an environment var of MAGICK_FONT_PATH to be set.
61
- # (Uses RMagick's default font otherwise.)
67
+ # Or, send a geometry string for other ratios ('800x400', '400x225').
68
+ #
69
+ # Looks for Bitstream Vera as the default font. Expects an environment var of MAGICK_FONT_PATH to be set. (Uses RMagick's default font otherwise.)
62
70
  def initialize(target_width=800)
63
71
 
64
72
  if not Numeric === target_width
@@ -71,19 +79,22 @@ module Gruff
71
79
  end
72
80
 
73
81
  # Internal for calculations
74
- @font = File.expand_path('Vera.ttf', ENV['MAGICK_FONT_PATH'])
75
- @marker_pointsize = 21.0
76
82
  @raw_columns = 800.0
77
83
  @raw_rows = 800.0 * (@rows/@columns)
78
84
  @column_count = 0
79
- @maximum_value = 0
80
- @minimum_value = 0
85
+ @maximum_value = @minimum_value = nil
81
86
  @has_data = false
82
87
  @data = Array.new
83
88
  @labels = Hash.new
84
89
  @labels_seen = Hash.new
85
90
  @scale = @columns / @raw_columns
86
- @legend_font_size = 20
91
+
92
+ vera_font_path = File.expand_path('Vera.ttf', ENV['MAGICK_FONT_PATH'])
93
+ @font = File.exists?(vera_font_path) ? vera_font_path : nil
94
+
95
+ @marker_font_size = 21.0
96
+ @legend_font_size = 20.0
97
+ @title_font_size = 36.0
87
98
 
88
99
  @no_data_message = "No Data"
89
100
 
@@ -204,16 +215,18 @@ module Gruff
204
215
  data_points.each_with_index do |data_point, index|
205
216
  next if data_point.nil?
206
217
 
207
- # Setup max/min so spread starts at the low end of the data points (instead of 0)
208
- if @maximum_value == 0 && @minimum_value == 0 && data_point != 0
218
+ # Setup max/min so spread starts at the low end of the data points
219
+ if @maximum_value.nil? && @minimum_value.nil?
209
220
  @maximum_value = @minimum_value = data_point
210
221
  end
211
-
212
- @maximum_value = larger_than_max?(data_point, index) ? max(data_point, index) : @maximum_value
222
+
223
+ # TODO Doesn't work with stacked bar graphs
224
+ #Original: @maximum_value = larger_than_max?(data_point, index) ? max(data_point, index) : @maximum_value
225
+ @maximum_value = larger_than_max?(data_point) ? data_point : @maximum_value
213
226
  if @maximum_value > 0
214
227
  @has_data = true
215
228
  end
216
- @minimum_value = (data_point < @minimum_value) ? data_point : @minimum_value
229
+ @minimum_value = less_than_min?(data_point) ? data_point : @minimum_value
217
230
  if @minimum_value < 0
218
231
  @has_data = true
219
232
  end
@@ -334,13 +347,13 @@ protected
334
347
  marker_label = index * increment + @minimum_value.to_f
335
348
 
336
349
  @d.fill = @marker_color
337
- @d.font = @font
350
+ @d.font = @font if @font
338
351
  @d.stroke = 'transparent'
339
- @d.pointsize = scale_fontsize(@marker_pointsize)
352
+ @d.pointsize = scale_fontsize(@marker_font_size)
340
353
  @d.gravity = EastGravity
341
354
  @d = @d.annotate_scaled( @base_image,
342
355
  100, 20,
343
- -10, y - (@marker_pointsize/2.0),
356
+ -10, y - (@marker_font_size/2.0),
344
357
  marker_label.to_s, @scale)
345
358
  # "help", @scale)
346
359
  end
@@ -355,8 +368,8 @@ protected
355
368
  legend_square_width = 20 # small square with color of this item
356
369
 
357
370
  # May fix legend drawing problem at small sizes
358
- @d.font = @font
359
- @d.pointsize = legend_font_size
371
+ @d.font = @font if @font
372
+ @d.pointsize = @legend_font_size
360
373
 
361
374
  metrics = @d.get_type_metrics(@base_image, @legend_labels.join(''))
362
375
  legend_text_width = metrics.width
@@ -368,8 +381,8 @@ protected
368
381
  @legend_labels.each_with_index do |legend_label, index|
369
382
  # Draw label
370
383
  @d.fill = @marker_color
371
- @d.font = @font
372
- @d.pointsize = scale_fontsize(legend_font_size)
384
+ @d.font = @font if @font
385
+ @d.pointsize = scale_fontsize(@legend_font_size)
373
386
  @d.stroke = 'transparent'
374
387
  @d.font_weight = NormalWeight
375
388
  @d.gravity = WestGravity
@@ -385,7 +398,7 @@ protected
385
398
  @d = @d.rectangle(current_x_offset, 70 + legend_box_y_offset,
386
399
  current_x_offset + legend_square_width, 70 + legend_square_width + legend_box_y_offset)
387
400
 
388
- @d.pointsize = legend_font_size
401
+ @d.pointsize = @legend_font_size
389
402
  metrics = @d.get_type_metrics(@base_image, legend_label.to_s)
390
403
  current_string_offset = metrics.width + (legend_square_width * 2.7)
391
404
  current_x_offset += current_string_offset
@@ -397,9 +410,9 @@ protected
397
410
  return if (@hide_title || @title.nil?)
398
411
 
399
412
  @d.fill = @marker_color
400
- @d.font = @font
413
+ @d.font = @font if @font
401
414
  @d.stroke = 'transparent'
402
- @d.pointsize = scale_fontsize(36)
415
+ @d.pointsize = scale_fontsize(@title_font_size)
403
416
  @d.font_weight = BoldWeight
404
417
  @d.gravity = CenterGravity
405
418
  @d = @d.annotate_scaled( @base_image,
@@ -415,10 +428,10 @@ protected
415
428
 
416
429
  if !@labels[index].nil? && @labels_seen[index].nil?
417
430
  @d.fill = @marker_color
418
- @d.font = @font
431
+ @d.font = @font if @font
419
432
  @d.stroke = 'transparent'
420
433
  @d.font_weight = NormalWeight
421
- @d.pointsize = scale_fontsize(@marker_pointsize)
434
+ @d.pointsize = scale_fontsize(@marker_font_size)
422
435
  @d.gravity = CenterGravity
423
436
  @d = @d.annotate_scaled(@base_image,
424
437
  1, 1,
@@ -430,7 +443,7 @@ protected
430
443
 
431
444
  def draw_no_data
432
445
  @d.fill = @marker_color
433
- @d.font = @font
446
+ @d.font = @font if @font
434
447
  @d.stroke = 'transparent'
435
448
  @d.font_weight = NormalWeight
436
449
  @d.pointsize = scale_fontsize(80)
@@ -529,6 +542,24 @@ protected
529
542
  total_sum
530
543
  end
531
544
 
545
+ def get_maximum_by_stack
546
+ # Get sum of each stack
547
+ max_hash = {}
548
+ @data.each do |data_set|
549
+ data_set[DATA_VALUES_INDEX].each_with_index do |data_point, i|
550
+ max_hash[i] = 0.0 unless max_hash[i]
551
+ max_hash[i] += data_point.to_f
552
+ end
553
+ end
554
+
555
+ @maximum_value = 0
556
+ max_hash.keys.each do |key|
557
+ @maximum_value = max_hash[key] if max_hash[key] > @maximum_value
558
+ end
559
+ @minimum_value = 0
560
+ end
561
+
562
+
532
563
  private
533
564
 
534
565
  def increment_color
data/lib/gruff/pie.rb CHANGED
@@ -57,7 +57,7 @@ private
57
57
 
58
58
  # Draw label
59
59
  @d.fill = @marker_color
60
- @d.font = @font
60
+ @d.font = @font if @font
61
61
  @d.pointsize = scale_fontsize(20)
62
62
  @d.stroke = 'transparent'
63
63
  @d.font_weight = BoldWeight
@@ -1,4 +1,4 @@
1
- # new gruff graph type added to enable sideways stacking bar charts (basically looks like a x/y
1
+ # New gruff graph type added to enable sideways stacking bar charts (basically looks like a x/y
2
2
  # flip of a standard stacking bar chart)
3
3
  #
4
4
  # alun.eyre@googlemail.com
@@ -29,13 +29,13 @@ class Gruff::SideStackedBar < Gruff::Base
29
29
  marker_label = diff.abs * increment
30
30
 
31
31
  @d.fill = @marker_color
32
- @d.font = @font
32
+ @d.font = @font if @font
33
33
  @d.stroke = 'transparent'
34
- @d.pointsize = scale_fontsize(@marker_pointsize)
34
+ @d.pointsize = scale_fontsize(@marker_font_size)
35
35
  # @d.gravity = NorthGravity
36
36
  @d = @d.annotate_scaled( @base_image,
37
37
  100, 20,
38
- x - (@marker_pointsize/1.5), @graph_bottom + 40,
38
+ x - (@marker_font_size/1.5), @graph_bottom + 40,
39
39
  marker_label.to_s, @scale)
40
40
 
41
41
  end
@@ -45,10 +45,10 @@ class Gruff::SideStackedBar < Gruff::Base
45
45
  def draw_label(y_offset, index)
46
46
  if !@labels[index].nil? && @labels_seen[index].nil?
47
47
  @d.fill = @marker_color
48
- @d.font = @font
48
+ @d.font = @font if @font
49
49
  @d.stroke = 'transparent'
50
50
  @d.font_weight = NormalWeight
51
- @d.pointsize = scale_fontsize(@marker_pointsize)
51
+ @d.pointsize = scale_fontsize(@marker_font_size)
52
52
  @d.gravity = CenterGravity
53
53
  @d = @d.annotate_scaled(@base_image,
54
54
  1, 1,
@@ -59,6 +59,7 @@ class Gruff::SideStackedBar < Gruff::Base
59
59
  end
60
60
 
61
61
  def draw
62
+ get_maximum_by_stack
62
63
  super
63
64
 
64
65
  return unless @has_data
@@ -78,19 +79,19 @@ class Gruff::SideStackedBar < Gruff::Base
78
79
 
79
80
  data_row[1].each_with_index do |data_point, point_index|
80
81
 
81
- ## using the original calcs from the stacked bar chart to get the difference between
82
- ## part of the bart chart we wish to stack.
83
- temp1 = @graph_left + (@graph_width -
84
- data_point * @graph_width -
85
- height[point_index]) + 1
86
- temp2 = @graph_left + @graph_width - height[point_index] - 1
87
- difference = temp2 - temp1
88
-
89
- left_x = length[point_index] #+ 1
90
- left_y = @graph_top + (@bar_width * point_index)
91
- right_x = left_x + difference
92
- right_y = left_y + @bar_width * spacing_factor
93
- length[point_index] += difference
82
+ ## using the original calcs from the stacked bar chart to get the difference between
83
+ ## part of the bart chart we wish to stack.
84
+ temp1 = @graph_left + (@graph_width -
85
+ data_point * @graph_width -
86
+ height[point_index]) + 1
87
+ temp2 = @graph_left + @graph_width - height[point_index] - 1
88
+ difference = temp2 - temp1
89
+
90
+ left_x = length[point_index] #+ 1
91
+ left_y = @graph_top + (@bar_width * point_index)
92
+ right_x = left_x + difference
93
+ right_y = left_y + @bar_width * spacing_factor
94
+ length[point_index] += difference
94
95
  height[point_index] += (data_point * @graph_width - 2)
95
96
 
96
97
  @d = @d.rectangle(left_x, left_y, right_x, right_y)
@@ -5,8 +5,8 @@ class Gruff::StackedBar < Gruff::Base
5
5
 
6
6
  # Draws a bar graph, but multiple sets are stacked on top of each other.
7
7
  def draw
8
+ get_maximum_by_stack
8
9
  super
9
-
10
10
  return unless @has_data
11
11
 
12
12
  # Setup spacing.
@@ -45,15 +45,5 @@ class Gruff::StackedBar < Gruff::Base
45
45
 
46
46
  @d.draw(@base_image)
47
47
  end
48
-
49
- protected
50
-
51
- def larger_than_max?(data_point, index=0)
52
- max(data_point, index) > @maximum_value
53
- end
54
-
55
- def max(data_point, index)
56
- @data.inject(0) {|sum, item| sum + item[1][index]}
57
- end
58
48
 
59
49
  end
data/test/bar_test.rb CHANGED
@@ -113,6 +113,14 @@ class TestGruffBar < Test::Unit::TestCase
113
113
  g.write("test/output/bar_image_wide.png")
114
114
  end
115
115
 
116
+ def test_nil_font
117
+ g = setup_basic_graph 400
118
+ g.title = "Nil Font"
119
+ g.font = nil
120
+ g.write "test/output/bar_nil_font.png"
121
+ end
122
+
123
+
116
124
  def test_no_line_markers
117
125
  g = setup_basic_graph(400)
118
126
  g.title = "No Line Markers"
data/test/line_test.rb CHANGED
@@ -39,7 +39,7 @@ class TestGruffLine < Test::Unit::TestCase
39
39
 
40
40
  def test_line_small_values
41
41
  @datasets = [
42
- [:small, [0.25, 0.14356, 0.0, 0.5674839, 0.456]],
42
+ [:small, [0.1, 0.14356, 0.0, 0.5674839, 0.456]],
43
43
  [:small2, [0.2, 0.3, 0.1, 0.05, 0.9]]
44
44
  ]
45
45
 
@@ -57,6 +57,28 @@ class TestGruffLine < Test::Unit::TestCase
57
57
  end
58
58
  g.write("test/output/line_small_small.png")
59
59
  end
60
+
61
+ def test_line_starts_with_zero
62
+ @datasets = [
63
+ [:first0, [0, 5, 10, 8, 18]],
64
+ [:normal, [1, 2, 3, 4, 5]]
65
+ ]
66
+
67
+ g = Gruff::Line.new
68
+ g.title = "Small Values Line Graph Test"
69
+ @datasets.each do |data|
70
+ g.data(data[0], data[1])
71
+ end
72
+ g.write("test/output/line_small_zero.png")
73
+
74
+ g = Gruff::Line.new(400)
75
+ g.title = "Small Values Line Graph Test 400px"
76
+ @datasets.each do |data|
77
+ g.data(data[0], data[1])
78
+ end
79
+ g.write("test/output/line_small_small_zero.png")
80
+ end
81
+
60
82
 
61
83
  def test_line_large_values
62
84
  @datasets = [
@@ -118,26 +140,6 @@ class TestGruffLine < Test::Unit::TestCase
118
140
  g.write("test/output/line_similar_high_end_values.png")
119
141
  end
120
142
 
121
-
122
- # Requires the Creative Block font from http://www.blambot.com
123
- def test_font
124
- g = Gruff::Line.new
125
- g.title = "Font Test"
126
- g.labels = {
127
- 0 => '5/6',
128
- 2 => '5/15',
129
- 4 => '5/24',
130
- 6 => '5/30',
131
- 8 => '6/2',
132
- 10 => '6/4',
133
- }
134
- g.data('many points', (0..10).collect {|i| rand(100) })
135
- g.font = File.expand_path('CREABBRG.TTF', ENV['MAGICK_FONT_PATH'])
136
-
137
- # Default theme
138
- g.write("test/output/line_font.png")
139
- end
140
-
141
143
  def test_dots_graph
142
144
  g = Gruff::Line.new(false)
143
145
  g.title = "Dots Test 800px"
@@ -420,31 +422,47 @@ class TestGruffLine < Test::Unit::TestCase
420
422
 
421
423
  protected
422
424
 
425
+ # TODO Reset data after each theme
423
426
  def line_graph_with_themes(size=nil)
424
- if !size.nil?
425
- g = Gruff::Line.new(size)
426
- else
427
- g = Gruff::Line.new
428
- end
429
-
427
+ g = Gruff::Line.new(size)
430
428
  g.title = "Multi-Line Graph Test #{size}"
431
429
  g.labels = @sample_labels
430
+ g.baseline_value = 90
432
431
  @datasets.each do |data|
433
432
  g.data(data[0], data[1])
434
433
  end
435
-
436
- g.baseline_value = 90
437
-
438
434
  # Default theme
439
435
  g.write("test/output/line_theme_keynote_#{size}.png")
440
436
 
437
+ g = Gruff::Line.new(size)
438
+ g.title = "Multi-Line Graph Test #{size}"
439
+ g.labels = @sample_labels
440
+ g.baseline_value = 90
441
441
  g.theme_37signals
442
+ @datasets.each do |data|
443
+ g.data(data[0], data[1])
444
+ end
442
445
  g.write("test/output/line_theme_37signals_#{size}.png")
443
446
 
447
+
448
+ g = Gruff::Line.new(size)
449
+ g.title = "Multi-Line Graph Test #{size}"
450
+ g.labels = @sample_labels
451
+ g.baseline_value = 90
444
452
  g.theme_rails_keynote
453
+ @datasets.each do |data|
454
+ g.data(data[0], data[1])
455
+ end
445
456
  g.write("test/output/line_theme_rails_keynote_#{size}.png")
446
457
 
458
+ g = Gruff::Line.new(size)
459
+ g.title = "Multi-Line Graph Test #{size}"
460
+ g.labels = @sample_labels
461
+ g.baseline_value = 90
447
462
  g.theme_odeo
463
+ @datasets.each do |data|
464
+ g.data(data[0], data[1])
465
+ end
448
466
  g.write("test/output/line_theme_odeo_#{size}.png")
449
467
  end
450
468
 
@@ -483,9 +501,7 @@ protected
483
501
  }
484
502
  g.data(:apples, [-1, -5, -20, -4])
485
503
  g.data(:peaches, [-10, -8, -6, -3])
486
- return g
504
+ g
487
505
  end
488
-
489
506
 
490
507
  end
491
-
@@ -39,14 +39,7 @@ class TestGruffSideSideStackedBar < Test::Unit::TestCase
39
39
  @datasets.each do |data|
40
40
  g.data(data[0], data[1])
41
41
  end
42
-
43
- g.write("test/output/side_stacked_bar_keynote.png")
44
-
45
- g.theme_rails_keynote
46
- g.write("test/output/side_stacked_bar_rails_keynote.png")
47
-
48
- g.theme_odeo
49
- g.write("test/output/side_stacked_bar_odeo.png")
42
+ g.write "test/output/side_stacked_bar_keynote.png"
50
43
  end
51
44
 
52
45
 
@@ -62,14 +55,13 @@ class TestGruffSideSideStackedBar < Test::Unit::TestCase
62
55
  @datasets.each do |data|
63
56
  g.data(data[0], data[1])
64
57
  end
65
-
66
- g.write("test/output/side_stacked_bar_keynote_small.png")
58
+ g.write "test/output/side_stacked_bar_keynote_small.png"
67
59
  end
68
60
 
69
61
  def test_wide
70
62
  g = setup_basic_graph('800x400')
71
63
  g.title = "Wide SSBar"
72
- g.write("test/output/side_stacked_bar_wide.png")
64
+ g.write "test/output/side_stacked_bar_wide.png"
73
65
  end
74
66
 
75
67
  protected
@@ -13,9 +13,6 @@ class TestGruffStackedBar < Test::Unit::TestCase
13
13
  [:Jimmy, [25, 36, 86, 39]],
14
14
  [:Charles, [80, 54, 67, 54]],
15
15
  [:Julie, [22, 29, 35, 38]],
16
- #[:Jane, [95, 95, 95, 90, 85, 80, 88, 100]],
17
- #[:Philip, [90, 34, 23, 12, 78, 89, 98, 88]],
18
- #["Arthur", [5, 10, 13, 11, 6, 16, 22, 32]],
19
16
  ]
20
17
  @sample_labels = {
21
18
  0 => '5/6',
@@ -37,14 +34,7 @@ class TestGruffStackedBar < Test::Unit::TestCase
37
34
  @datasets.each do |data|
38
35
  g.data(data[0], data[1])
39
36
  end
40
-
41
- g.write("test/output/stacked_bar_keynote.png")
42
-
43
- g.theme_rails_keynote
44
- g.write("test/output/stacked_bar_rails_keynote.png")
45
-
46
- g.theme_odeo
47
- g.write("test/output/stacked_bar_odeo.png")
37
+ g.write "test/output/stacked_bar_keynote.png"
48
38
  end
49
39
 
50
40
 
@@ -60,42 +50,7 @@ class TestGruffStackedBar < Test::Unit::TestCase
60
50
  @datasets.each do |data|
61
51
  g.data(data[0], data[1])
62
52
  end
63
-
64
- g.write("test/output/stacked_bar_keynote_small.png")
53
+ g.write "test/output/stacked_bar_keynote_small.png"
65
54
  end
66
-
67
- def test_bar_image_bg
68
- g = Gruff::StackedBar.new
69
- g.title = "Stacked Bar Graph With Image Background"
70
- g.labels = {
71
- 0 => '5/6',
72
- 1 => '5/15',
73
- 2 => '5/24',
74
- 3 => '5/30',
75
- }
76
- @datasets.each do |data|
77
- g.data(data[0], data[1])
78
- end
79
-
80
- g.theme_image_based
81
- g.write("test/output/stacked_bar_image.png")
82
-
83
- g = Gruff::StackedBar.new(400)
84
- g.title = "Stacked Bar Graph With Image Background Small"
85
- g.labels = {
86
- 0 => '5/6',
87
- 1 => '5/15',
88
- 2 => '5/24',
89
- 3 => '5/30',
90
- }
91
- @datasets.each do |data|
92
- g.data(data[0], data[1])
93
- end
94
-
95
- g.theme_image_based
96
- g.write("test/output/stacked_bar_image_small.png")
97
-
98
- end
99
-
100
55
 
101
56
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.10
3
3
  specification_version: 1
4
4
  name: gruff
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.0
7
- date: 2006-02-03
6
+ version: 0.1.1
7
+ date: 2006-02-14
8
8
  summary: Beautiful graphs for one or multiple datasets.
9
9
  require_paths:
10
10
  - lib
@@ -27,7 +27,7 @@ platform: ruby
27
27
  authors:
28
28
  - Geoffrey Grosenbach
29
29
  files:
30
- - rakefile
30
+ - Rakefile
31
31
  - README
32
32
  - CHANGELOG
33
33
  - MIT-LICENSE