gruff 0.7.0-java → 0.8.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. checksums.yaml +5 -5
  2. data/.editorconfig +14 -0
  3. data/.rubocop.yml +16 -0
  4. data/.rubocop_todo.yml +923 -0
  5. data/.travis.yml +21 -14
  6. data/{History.txt → CHANGELOG.md} +32 -25
  7. data/README.md +3 -2
  8. data/Rakefile +27 -18
  9. data/assets/bubble.png +0 -0
  10. data/assets/city_scene/background/0000.png +0 -0
  11. data/assets/city_scene/background/0600.png +0 -0
  12. data/assets/city_scene/background/2000.png +0 -0
  13. data/assets/city_scene/clouds/cloudy.png +0 -0
  14. data/assets/city_scene/clouds/partly_cloudy.png +0 -0
  15. data/assets/city_scene/clouds/stormy.png +0 -0
  16. data/assets/city_scene/grass/default.png +0 -0
  17. data/assets/city_scene/haze/true.png +0 -0
  18. data/assets/city_scene/number_sample/1.png +0 -0
  19. data/assets/city_scene/number_sample/2.png +0 -0
  20. data/assets/city_scene/number_sample/default.png +0 -0
  21. data/assets/city_scene/sky/0000.png +0 -0
  22. data/assets/city_scene/sky/0200.png +0 -0
  23. data/assets/city_scene/sky/0400.png +0 -0
  24. data/assets/city_scene/sky/0600.png +0 -0
  25. data/assets/city_scene/sky/0800.png +0 -0
  26. data/assets/city_scene/sky/1000.png +0 -0
  27. data/assets/city_scene/sky/1200.png +0 -0
  28. data/assets/city_scene/sky/1400.png +0 -0
  29. data/assets/city_scene/sky/1500.png +0 -0
  30. data/assets/city_scene/sky/1700.png +0 -0
  31. data/assets/city_scene/sky/2000.png +0 -0
  32. data/assets/pc306715.jpg +0 -0
  33. data/assets/plastik/blue.png +0 -0
  34. data/assets/plastik/green.png +0 -0
  35. data/assets/plastik/red.png +0 -0
  36. data/gruff.gemspec +12 -10
  37. data/lib/gruff.rb +2 -2
  38. data/lib/gruff/accumulator_bar.rb +2 -2
  39. data/lib/gruff/area.rb +1 -4
  40. data/lib/gruff/bar.rb +12 -13
  41. data/lib/gruff/bar_conversion.rb +11 -11
  42. data/lib/gruff/base.rb +36 -36
  43. data/lib/gruff/bezier.rb +1 -2
  44. data/lib/gruff/bullet.rb +7 -10
  45. data/lib/gruff/deprecated.rb +10 -11
  46. data/lib/gruff/dot.rb +3 -4
  47. data/lib/gruff/line.rb +13 -14
  48. data/lib/gruff/mini/bar.rb +3 -3
  49. data/lib/gruff/mini/legend.rb +7 -8
  50. data/lib/gruff/mini/pie.rb +6 -6
  51. data/lib/gruff/mini/side_bar.rb +7 -7
  52. data/lib/gruff/net.rb +2 -8
  53. data/lib/gruff/photo_bar.rb +9 -12
  54. data/lib/gruff/pie.rb +6 -6
  55. data/lib/gruff/scatter.rb +47 -51
  56. data/lib/gruff/scene.rb +17 -19
  57. data/lib/gruff/side_bar.rb +5 -8
  58. data/lib/gruff/side_stacked_bar.rb +24 -26
  59. data/lib/gruff/spider.rb +14 -15
  60. data/lib/gruff/stacked_area.rb +12 -16
  61. data/lib/gruff/stacked_bar.rb +50 -52
  62. data/lib/gruff/stacked_mixin.rb +2 -3
  63. data/lib/gruff/themes.rb +32 -33
  64. data/lib/gruff/version.rb +1 -1
  65. metadata +15 -72
  66. data/RELEASE.md +0 -30
  67. data/test/gruff_test_case.rb +0 -152
  68. data/test/image_compare.rb +0 -58
  69. data/test/test_accumulator_bar.rb +0 -51
  70. data/test/test_area.rb +0 -134
  71. data/test/test_bar.rb +0 -505
  72. data/test/test_base.rb +0 -33
  73. data/test/test_bezier.rb +0 -33
  74. data/test/test_bullet.rb +0 -26
  75. data/test/test_dot.rb +0 -263
  76. data/test/test_labels_for_null_data.rb +0 -27
  77. data/test/test_legend.rb +0 -68
  78. data/test/test_line.rb +0 -674
  79. data/test/test_mini_bar.rb +0 -33
  80. data/test/test_mini_pie.rb +0 -25
  81. data/test/test_mini_side_bar.rb +0 -36
  82. data/test/test_net.rb +0 -231
  83. data/test/test_photo.rb +0 -41
  84. data/test/test_pie.rb +0 -194
  85. data/test/test_scatter.rb +0 -270
  86. data/test/test_scene.rb +0 -100
  87. data/test/test_side_bar.rb +0 -56
  88. data/test/test_sidestacked_bar.rb +0 -105
  89. data/test/test_spider.rb +0 -226
  90. data/test/test_stacked_area.rb +0 -52
  91. data/test/test_stacked_bar.rb +0 -68
@@ -2,7 +2,7 @@ require 'gruff/version'
2
2
 
3
3
  # Extra full path added to fix loading errors on some installations.
4
4
 
5
- %w(
5
+ %w[
6
6
  themes
7
7
  base
8
8
  area
@@ -27,6 +27,6 @@ require 'gruff/version'
27
27
  mini/bar
28
28
  mini/pie
29
29
  mini/side_bar
30
- ).each do |filename|
30
+ ].each do |filename|
31
31
  require "gruff/#{filename}"
32
32
  end
@@ -2,14 +2,14 @@ require File.dirname(__FILE__) + '/base'
2
2
 
3
3
  ##
4
4
  # A special bar graph that shows a single dataset as a set of
5
- # stacked bars. The bottom bar shows the running total and
5
+ # stacked bars. The bottom bar shows the running total and
6
6
  # the top bar shows the new value being added to the array.
7
7
 
8
8
  class Gruff::AccumulatorBar < Gruff::StackedBar
9
9
  def draw
10
10
  raise(Gruff::IncorrectNumberOfDatasetsException) unless @data.length == 1
11
11
 
12
- accum_array = @data.first[DATA_VALUES_INDEX][0..-2].inject([0]) { |a, v| a << a.last + v}
12
+ accum_array = @data.first[DATA_VALUES_INDEX][0..-2].inject([0]) { |a, v| a << a.last + v }
13
13
  data 'Accumulator', accum_array
14
14
  set_colors
15
15
  @data.reverse!
@@ -1,4 +1,3 @@
1
-
2
1
  require File.dirname(__FILE__) + '/base'
3
2
 
4
3
  class Gruff::Area < Gruff::Base
@@ -41,11 +40,9 @@ class Gruff::Area < Gruff::Base
41
40
  poly_points << @graph_bottom - 1
42
41
 
43
42
  @d = @d.polyline(*poly_points)
44
-
45
43
  end
46
44
 
47
45
  @d.draw(@base_image)
48
46
  end
49
-
50
-
47
+
51
48
  end
@@ -13,10 +13,10 @@ class Gruff::Bar < Gruff::Base
13
13
 
14
14
  def draw
15
15
  # Labels will be centered over the left of the bar if
16
- # there are more labels than columns. This is basically the same
16
+ # there are more labels than columns. This is basically the same
17
17
  # as where it would be for a line graph.
18
- @center_labels_over_point = (@labels.keys.length > @column_count ? true : false)
19
-
18
+ @center_labels_over_point = (@labels.keys.length > @column_count)
19
+
20
20
  super
21
21
  return unless @has_data
22
22
 
@@ -30,7 +30,8 @@ class Gruff::Bar < Gruff::Base
30
30
  #
31
31
  # Default value is 0.9.
32
32
  def spacing_factor=(space_percent)
33
- raise ArgumentError, 'spacing_factor must be between 0.00 and 1.00' unless (space_percent >= 0 and space_percent <= 1)
33
+ raise ArgumentError, 'spacing_factor must be between 0.00 and 1.00' unless space_percent >= 0 and space_percent <= 1
34
+
34
35
  @spacing_factor = (1 - space_percent)
35
36
  end
36
37
 
@@ -52,25 +53,24 @@ protected
52
53
  conversion.graph_top = @graph_top
53
54
 
54
55
  # Set up the right mode [1,2,3] see BarConversion for further explanation
55
- if @minimum_value >= 0 then
56
+ if @minimum_value >= 0
56
57
  # all bars go from zero to positiv
57
58
  conversion.mode = 1
58
59
  else
59
60
  # all bars go from 0 to negativ
60
- if @maximum_value <= 0 then
61
+ if @maximum_value <= 0
61
62
  conversion.mode = 2
62
63
  else
63
64
  # bars either go from zero to negativ or to positiv
64
65
  conversion.mode = 3
65
66
  conversion.spread = @spread
66
67
  conversion.minimum_value = @minimum_value
67
- conversion.zero = -@minimum_value/@spread
68
+ conversion.zero = -@minimum_value / @spread
68
69
  end
69
70
  end
70
71
 
71
72
  # iterate over all normalised data
72
73
  @norm_data.each_with_index do |data_row, row_index|
73
-
74
74
  data_row[DATA_VALUES_INDEX].each_with_index do |data_point, point_index|
75
75
  # Use incremented x and scaled y
76
76
  # x
@@ -78,25 +78,24 @@ protected
78
78
  right_x = left_x + @bar_width * @bar_spacing
79
79
  # y
80
80
  conv = []
81
- conversion.get_left_y_right_y_scaled( data_point, conv )
81
+ conversion.get_left_y_right_y_scaled(data_point, conv)
82
82
 
83
83
  # create new bar
84
84
  @d = @d.fill data_row[DATA_COLOR_INDEX]
85
85
  @d = @d.rectangle(left_x, conv[0], right_x, conv[1])
86
86
 
87
87
  # Calculate center based on bar_width and current row
88
- label_center = @graph_left +
89
- (@data.length * @bar_width * point_index) +
88
+ label_center = @graph_left +
89
+ (@data.length * @bar_width * point_index) +
90
90
  (@data.length * @bar_width / 2.0)
91
91
 
92
92
  # Subtract half a bar width to center left if requested
93
93
  draw_label(label_center - (@center_labels_over_point ? @bar_width / 2.0 : 0.0), point_index)
94
94
  if @show_labels_for_bar_values
95
95
  val = (@label_formatting || '%.2f') % @norm_data[row_index][3][point_index]
96
- draw_value_label(left_x + (right_x - left_x)/2, conv[0]-30, val.commify, true)
96
+ draw_value_label(left_x + (right_x - left_x) / 2, conv[0] - 30, val.commify, true)
97
97
  end
98
98
  end
99
-
100
99
  end
101
100
 
102
101
  # Draw the last label if requested
@@ -1,13 +1,13 @@
1
1
  ##
2
2
  # Original Author: David Stokar
3
3
  #
4
- # This class perfoms the y coordinats conversion for the bar class.
4
+ # This class perfoms the y coordinats conversion for the bar class.
5
5
  #
6
- # There are three cases:
6
+ # There are three cases:
7
7
  #
8
8
  # 1. Bars all go from zero in positive direction
9
- # 2. Bars all go from zero to negative direction
10
- # 3. Bars either go from zero to positive or from zero to negative
9
+ # 2. Bars all go from zero to negative direction
10
+ # 3. Bars either go from zero to positive or from zero to negative
11
11
  #
12
12
  class Gruff::BarConversion
13
13
  attr_writer :mode
@@ -21,21 +21,21 @@ class Gruff::BarConversion
21
21
  case @mode
22
22
  when 1 then # Case one
23
23
  # minimum value >= 0 ( only positiv values )
24
- result[0] = @graph_top + @graph_height*(1 - data_point) + 1
24
+ result[0] = @graph_top + @graph_height * (1 - data_point) + 1
25
25
  result[1] = @graph_top + @graph_height - 1
26
26
  when 2 then # Case two
27
27
  # only negativ values
28
28
  result[0] = @graph_top + 1
29
- result[1] = @graph_top + @graph_height*(1 - data_point) - 1
29
+ result[1] = @graph_top + @graph_height * (1 - data_point) - 1
30
30
  when 3 then # Case three
31
31
  # positiv and negativ values
32
- val = data_point-@minimum_value/@spread
32
+ val = data_point - @minimum_value / @spread
33
33
  if data_point >= @zero
34
- result[0] = @graph_top + @graph_height*(1 - (val-@zero)) + 1
35
- result[1] = @graph_top + @graph_height*(1 - @zero) - 1
34
+ result[0] = @graph_top + @graph_height * (1 - (val - @zero)) + 1
35
+ result[1] = @graph_top + @graph_height * (1 - @zero) - 1
36
36
  else
37
- result[0] = @graph_top + @graph_height*(1 - (val-@zero)) + 1
38
- result[1] = @graph_top + @graph_height*(1 - @zero) - 1
37
+ result[0] = @graph_top + @graph_height * (1 - (val - @zero)) + 1
38
+ result[1] = @graph_top + @graph_height * (1 - @zero) - 1
39
39
  end
40
40
  else
41
41
  result[0] = 0.0
@@ -120,7 +120,7 @@ module Gruff
120
120
 
121
121
  # Same as font but for the title.
122
122
  attr_accessor :title_font
123
-
123
+
124
124
  # Specifies whether to draw the title bolded or not.
125
125
  attr_accessor :bold_title
126
126
 
@@ -216,7 +216,7 @@ module Gruff
216
216
  #
217
217
  # Looks for Bitstream Vera as the default font. Expects an environment var
218
218
  # of MAGICK_FONT_PATH to be set. (Uses RMagick's default font otherwise.)
219
- def initialize(target_width=DEFAULT_TARGET_WIDTH)
219
+ def initialize(target_width = DEFAULT_TARGET_WIDTH)
220
220
  if Numeric === target_width
221
221
  @columns = target_width.to_f
222
222
  @rows = target_width.to_f * 0.75
@@ -241,7 +241,7 @@ module Gruff
241
241
  def initialize_ivars
242
242
  # Internal for calculations
243
243
  @raw_columns = 800.0
244
- @raw_rows = 800.0 * (@rows/@columns)
244
+ @raw_rows = 800.0 * (@rows / @columns)
245
245
  @column_count = 0
246
246
  @data = Array.new
247
247
  @marker_count = nil
@@ -326,7 +326,7 @@ module Gruff
326
326
  #
327
327
  # Example:
328
328
  # replace_colors ['#cc99cc', '#d9e043', '#34d8a2']
329
- def replace_colors(color_list=[])
329
+ def replace_colors(color_list = [])
330
330
  @colors = color_list
331
331
  @color_index = 0
332
332
  end
@@ -348,13 +348,13 @@ module Gruff
348
348
  reset_themes
349
349
 
350
350
  defaults = {
351
- :colors => %w(black white),
352
- :additional_line_colors => [],
353
- :marker_color => 'white',
354
- :marker_shadow_color => nil,
355
- :font_color => 'black',
356
- :background_colors => nil,
357
- :background_image => nil
351
+ colors: %w[black white],
352
+ additional_line_colors: [],
353
+ marker_color: 'white',
354
+ marker_shadow_color: nil,
355
+ font_color: 'black',
356
+ background_colors: nil,
357
+ background_image: nil
358
358
  }
359
359
  @theme_options = defaults.merge options
360
360
 
@@ -405,7 +405,7 @@ module Gruff
405
405
  #
406
406
  # Example:
407
407
  # data("Bart S.", [95, 45, 78, 89, 88, 76], '#ffcc00')
408
- def data(name, data_points=[], color=nil)
408
+ def data(name, data_points = [], color = nil)
409
409
  data_points = Array(data_points) # make sure it's an array
410
410
  @data << [name, data_points, color]
411
411
  # Set column count if this is larger than previous counts
@@ -434,21 +434,20 @@ module Gruff
434
434
  #
435
435
  # Example:
436
436
  # write('graphs/my_pretty_graph.png')
437
- def write(filename='graph.png')
437
+ def write(filename = 'graph.png')
438
438
  draw
439
439
  @base_image.write(filename)
440
440
  end
441
441
 
442
442
  # Return the graph as a rendered binary blob.
443
- def to_blob(fileformat='PNG')
443
+ def to_blob(fileformat = 'PNG')
444
444
  draw
445
445
  @base_image.to_blob do
446
446
  self.format = fileformat
447
447
  end
448
448
  end
449
449
 
450
-
451
- protected
450
+ protected
452
451
 
453
452
  # Overridden by subclasses to do the actual plotting of the graph.
454
453
  #
@@ -501,7 +500,7 @@ module Gruff
501
500
  end
502
501
 
503
502
  # Make copy of data with values scaled between 0-100
504
- def normalize(force=false)
503
+ def normalize(force = false)
505
504
  if @norm_data.nil? || force
506
505
  @norm_data = []
507
506
  return unless @has_data
@@ -541,9 +540,9 @@ module Gruff
541
540
  calculate_caps_height(@legend_font_size)
542
541
 
543
542
  if @hide_line_markers
544
- (@graph_left,
545
- @graph_right_margin,
546
- @graph_bottom_margin) = [@left_margin, @right_margin, @bottom_margin]
543
+ @graph_left = @left_margin
544
+ @graph_right_margin = @right_margin
545
+ @graph_bottom_margin = @bottom_margin
547
546
  else
548
547
  if @has_left_labels
549
548
  longest_left_label_width = calculate_width(@marker_font_size,
@@ -565,7 +564,7 @@ module Gruff
565
564
  # Make space for half the width of the rightmost column label.
566
565
  # Might be greater than the number of columns if between-style bar markers are used.
567
566
  last_label = @labels.keys.sort.last.to_i
568
- extra_room_for_long_label = (last_label >= (@column_count-1) && @center_labels_over_point) ?
567
+ extra_room_for_long_label = (last_label >= (@column_count - 1) && @center_labels_over_point) ?
569
568
  calculate_width(@marker_font_size, @labels[last_label]) / 2.0 :
570
569
  0
571
570
  @graph_right_margin = @right_margin + extra_room_for_long_label
@@ -762,7 +761,6 @@ module Gruff
762
761
  @top_margin + title_margin + @title_caps_height)
763
762
 
764
763
  @legend_labels.each_with_index do |legend_label, index|
765
-
766
764
  # Draw label
767
765
  @d.fill = @font_color
768
766
  @d.font = @font if @font
@@ -810,13 +808,13 @@ module Gruff
810
808
 
811
809
  # Draws a title on the graph.
812
810
  def draw_title
813
- return if (@hide_title || @title.nil?)
811
+ return if @hide_title || @title.nil?
814
812
 
815
813
  @d.fill = @font_color
816
814
  @d.font = @title_font || @font if @title_font || @font
817
815
  @d.stroke('transparent')
818
816
  @d.pointsize = scale_fontsize(@title_font_size)
819
- @d.font_weight = if @bold_title then BoldWeight else NormalWeight end
817
+ @d.font_weight = @bold_title ? BoldWeight : NormalWeight
820
818
  @d.gravity = NorthGravity
821
819
  @d = @d.annotate_scaled(@base_image,
822
820
  @raw_columns, 1.0,
@@ -846,10 +844,10 @@ module Gruff
846
844
  if @label_truncation_style == :trailing_dots
847
845
  if @label_max_size > 3
848
846
  # 4 because '...' takes up 3 chars
849
- label_text = "#{label_text[0 .. (@label_max_size - 4)]}..."
847
+ label_text = "#{label_text[0..(@label_max_size - 4)]}..."
850
848
  end
851
849
  else # @label_truncation_style is :absolute (default)
852
- label_text = label_text[0 .. (@label_max_size - 1)]
850
+ label_text = label_text[0..(@label_max_size - 1)]
853
851
  end
854
852
 
855
853
  end
@@ -872,7 +870,7 @@ module Gruff
872
870
  end
873
871
 
874
872
  # Draws the data value over the data point in bar graphs
875
- def draw_value_label(x_offset, y_offset, data_point, bar_value=false)
873
+ def draw_value_label(x_offset, y_offset, data_point, bar_value = false)
876
874
  return if @hide_line_markers && !bar_value
877
875
 
878
876
  #y_offset = @graph_bottom + LABEL_MARGIN
@@ -900,7 +898,7 @@ module Gruff
900
898
  @d.pointsize = scale_fontsize(80)
901
899
  @d.gravity = CenterGravity
902
900
  @d = @d.annotate_scaled(@base_image,
903
- @raw_columns, @raw_rows/2.0,
901
+ @raw_columns, @raw_rows / 2.0,
904
902
  0, 10,
905
903
  @no_data_message, @scale)
906
904
  end
@@ -996,6 +994,7 @@ module Gruff
996
994
 
997
995
  def significant(i) # :nodoc:
998
996
  return 1.0 if i == 0 # Keep from going into infinite loop
997
+
999
998
  inc = BigDecimal(i.to_s)
1000
999
  factor = BigDecimal('1.0')
1001
1000
  while inc < 10
@@ -1030,7 +1029,7 @@ module Gruff
1030
1029
  # correctly in the drawn graph.
1031
1030
  def sort_norm_data
1032
1031
  @norm_data =
1033
- @norm_data.sort_by { |a| -a[DATA_VALUES_INDEX].inject(0) { |sum, num| sum + num.to_f } }
1032
+ @norm_data.sort_by { |a| -a[DATA_VALUES_INDEX].inject(0) { |sum, num| sum + num.to_f } }
1034
1033
  end
1035
1034
 
1036
1035
  # Used by StackedBar and child classes.
@@ -1047,7 +1046,7 @@ module Gruff
1047
1046
  end
1048
1047
 
1049
1048
  # @maximum_value = 0
1050
- max_hash.keys.each do |key|
1049
+ max_hash.each_key do |key|
1051
1050
  @maximum_value = max_hash[key] if max_hash[key] > @maximum_value
1052
1051
  end
1053
1052
  @minimum_value = 0
@@ -1063,7 +1062,7 @@ module Gruff
1063
1062
  end
1064
1063
  end
1065
1064
 
1066
- private
1065
+ private
1067
1066
 
1068
1067
  # Takes a block and draws it if DEBUG is true.
1069
1068
  #
@@ -1100,7 +1099,7 @@ module Gruff
1100
1099
  else
1101
1100
  value.to_s
1102
1101
  end
1103
- elsif (@spread.to_f % (@marker_count.to_f==0 ? 1 : @marker_count.to_f) == 0) || !@y_axis_increment.nil?
1102
+ elsif (@spread.to_f % (@marker_count.to_f == 0 ? 1 : @marker_count.to_f) == 0) || !@y_axis_increment.nil?
1104
1103
  value.to_i.to_s
1105
1104
  elsif @spread > 10.0
1106
1105
  sprintf('%0i', value)
@@ -1132,6 +1131,7 @@ module Gruff
1132
1131
  # scaling will handle.
1133
1132
  def calculate_width(font_size, text)
1134
1133
  return 0 if text.nil?
1134
+
1135
1135
  @d.pointsize = font_size
1136
1136
  @d.font = @font if @font
1137
1137
  @d.get_type_metrics(@base_image, text.to_s).width
@@ -1139,12 +1139,12 @@ module Gruff
1139
1139
 
1140
1140
  # Used for degree => radian conversions
1141
1141
  def deg2rad(angle)
1142
- angle * (Math::PI/180.0)
1142
+ angle * (Math::PI / 180.0)
1143
1143
  end
1144
1144
 
1145
1145
  end # Gruff::Base
1146
1146
 
1147
- class IncorrectNumberOfDatasetsException < StandardError;
1147
+ class IncorrectNumberOfDatasetsException < StandardError
1148
1148
  end
1149
1149
 
1150
1150
  end # Gruff
@@ -1169,7 +1169,7 @@ module Magick
1169
1169
  # Remove this method as soon as RMagick4J Issue #16 is fixed.
1170
1170
  # https://github.com/Serabe/RMagick4J/issues/16
1171
1171
  def fill=(fill)
1172
- fill = {:white => '#FFFFFF'}[fill.to_sym] || fill
1172
+ fill = { white: '#FFFFFF' }[fill.to_sym] || fill
1173
1173
  @draw.fill = Magick4J.ColorDatabase.query_default(fill)
1174
1174
  self
1175
1175
  end
@@ -1182,7 +1182,7 @@ end # Magick
1182
1182
 
1183
1183
  class String
1184
1184
  #Taken from http://codesnippets.joyent.com/posts/show/330
1185
- def commify(delimiter=',')
1185
+ def commify(delimiter = ',')
1186
1186
  self.gsub(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1#{delimiter}")
1187
1187
  end
1188
1188
  end
@@ -27,7 +27,7 @@ class Gruff::Bezier < Gruff::Base
27
27
 
28
28
  draw_label(new_x, index)
29
29
  end
30
-
30
+
31
31
  @d = @d.fill_opacity 0.0
32
32
  @d = @d.stroke data_row[DATA_COLOR_INDEX]
33
33
  @d = @d.stroke_width clip_value_if_greater_than(@columns / (@norm_data.first[1].size * 4), 5.0)
@@ -41,6 +41,5 @@ class Gruff::Bezier < Gruff::Base
41
41
 
42
42
  @d.draw(@base_image)
43
43
  end
44
-
45
44
 
46
45
  end
@@ -4,7 +4,7 @@ require 'gruff/themes'
4
4
  # http://en.wikipedia.org/wiki/Bullet_graph
5
5
  class Gruff::Bullet < Gruff::Base
6
6
 
7
- def initialize(target_width="400x40")
7
+ def initialize(target_width = "400x40")
8
8
  if not Numeric === target_width
9
9
  geometric_width, geometric_height = target_width.split('x')
10
10
  @columns = geometric_width.to_f
@@ -21,7 +21,7 @@ class Gruff::Bullet < Gruff::Base
21
21
  @title_font_size = 20
22
22
  end
23
23
 
24
- def data(value, maximum_value, options={})
24
+ def data(value, maximum_value, options = {})
25
25
  @value = value.to_f
26
26
  @maximum_value = maximum_value.to_f
27
27
  @options = options
@@ -68,8 +68,9 @@ class Gruff::Bullet < Gruff::Base
68
68
 
69
69
  [:high, :low].each_with_index do |indicator, index|
70
70
  next unless @options.has_key?(indicator)
71
+
71
72
  @d = @d.fill @colors[index + 1]
72
- indicator_width_x = @graph_left + @graph_width * (@options[indicator] / @maximum_value)
73
+ indicator_width_x = @graph_left + @graph_width * (@options[indicator] / @maximum_value)
73
74
  @d = @d.rectangle(@graph_left, 0, indicator_width_x, @graph_height)
74
75
  end
75
76
 
@@ -99,13 +100,9 @@ class Gruff::Bullet < Gruff::Base
99
100
  @d.font_weight = NormalWeight
100
101
  @d.pointsize = scale_fontsize(@title_font_size)
101
102
  @d.gravity = NorthWestGravity
102
- @d = @d.annotate_scaled(*[
103
- @base_image,
104
- 1.0, 1.0,
105
- @font_height/2, @font_height/2,
106
- @title,
107
- @scale
108
- ])
103
+ @d = @d.annotate_scaled(
104
+ @base_image, 1.0, 1.0, @font_height / 2, @font_height / 2, @title, @scale
105
+ )
109
106
  end
110
107
 
111
108
  end