gruff 0.13.0-java → 0.16.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 (61) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +79 -0
  3. data/.rubocop.yml +29 -31
  4. data/CHANGELOG.md +43 -0
  5. data/README.md +11 -5
  6. data/gruff.gemspec +8 -10
  7. data/lib/gruff/accumulator_bar.rb +4 -2
  8. data/lib/gruff/area.rb +9 -12
  9. data/lib/gruff/bar.rb +46 -31
  10. data/lib/gruff/base.rb +236 -207
  11. data/lib/gruff/bezier.rb +6 -8
  12. data/lib/gruff/box_plot.rb +174 -0
  13. data/lib/gruff/bullet.rb +17 -16
  14. data/lib/gruff/candlestick.rb +112 -0
  15. data/lib/gruff/dot.rb +14 -14
  16. data/lib/gruff/font.rb +42 -0
  17. data/lib/gruff/helper/bar_conversion.rb +5 -5
  18. data/lib/gruff/helper/bar_value_label.rb +26 -20
  19. data/lib/gruff/helper/stacked_mixin.rb +4 -3
  20. data/lib/gruff/histogram.rb +9 -7
  21. data/lib/gruff/line.rb +96 -83
  22. data/lib/gruff/mini/bar.rb +9 -6
  23. data/lib/gruff/mini/legend.rb +16 -12
  24. data/lib/gruff/mini/pie.rb +9 -6
  25. data/lib/gruff/mini/side_bar.rb +9 -6
  26. data/lib/gruff/net.rb +16 -22
  27. data/lib/gruff/patch/rmagick.rb +0 -1
  28. data/lib/gruff/patch/string.rb +2 -1
  29. data/lib/gruff/pie.rb +42 -75
  30. data/lib/gruff/renderer/bezier.rb +8 -9
  31. data/lib/gruff/renderer/circle.rb +8 -9
  32. data/lib/gruff/renderer/dash_line.rb +10 -10
  33. data/lib/gruff/renderer/dot.rb +15 -14
  34. data/lib/gruff/renderer/ellipse.rb +8 -9
  35. data/lib/gruff/renderer/line.rb +8 -11
  36. data/lib/gruff/renderer/polygon.rb +9 -10
  37. data/lib/gruff/renderer/polyline.rb +8 -9
  38. data/lib/gruff/renderer/rectangle.rb +11 -8
  39. data/lib/gruff/renderer/renderer.rb +25 -40
  40. data/lib/gruff/renderer/text.rb +21 -37
  41. data/lib/gruff/scatter.rb +86 -85
  42. data/lib/gruff/side_bar.rb +50 -37
  43. data/lib/gruff/side_stacked_bar.rb +26 -35
  44. data/lib/gruff/spider.rb +52 -28
  45. data/lib/gruff/stacked_area.rb +20 -16
  46. data/lib/gruff/stacked_bar.rb +44 -22
  47. data/lib/gruff/store/store.rb +6 -10
  48. data/lib/gruff/store/xy_data.rb +2 -0
  49. data/lib/gruff/themes.rb +6 -6
  50. data/lib/gruff/version.rb +1 -1
  51. data/lib/gruff.rb +70 -57
  52. data/rails_generators/gruff/templates/controller.rb +1 -1
  53. metadata +15 -32
  54. data/.rubocop_todo.yml +0 -182
  55. data/.travis.yml +0 -23
  56. data/assets/plastik/blue.png +0 -0
  57. data/assets/plastik/green.png +0 -0
  58. data/assets/plastik/red.png +0 -0
  59. data/lib/gruff/photo_bar.rb +0 -93
  60. data/lib/gruff/scene.rb +0 -198
  61. data/lib/gruff/store/custom_data.rb +0 -36
data/lib/gruff/spider.rb CHANGED
@@ -19,35 +19,52 @@ class Gruff::Spider < Gruff::Base
19
19
  attr_writer :hide_axes
20
20
  attr_writer :rotation
21
21
 
22
+ def initialize(max_value, target_width = 800)
23
+ super(target_width)
24
+ @max_value = max_value
25
+ end
26
+
22
27
  def transparent_background=(value)
23
- Gruff::Renderer.setup_transparent_background(@columns, @rows) if value
28
+ renderer.transparent_background(@columns, @rows) if value
24
29
  end
25
30
 
26
31
  def hide_text=(value)
27
32
  @hide_title = @hide_text = value
28
33
  end
29
34
 
30
- def initialize(max_value, target_width = 800)
31
- super(target_width)
32
- @max_value = max_value
33
- end
35
+ private
34
36
 
35
- def initialize_ivars
37
+ def initialize_attributes
36
38
  super
37
39
  @hide_legend = true
38
40
  @hide_axes = false
39
41
  @hide_text = false
40
42
  @rotation = 0
41
- end
42
- private :initialize_ivars
43
+ @marker_font.bold = true
43
44
 
44
- def draw
45
45
  @hide_line_markers = true
46
+ @hide_line_markers.freeze
47
+ end
46
48
 
49
+ def setup_graph_measurements
47
50
  super
48
51
 
49
- return unless data_given?
52
+ @graph_left += LABEL_MARGIN
53
+ @graph_top += LABEL_MARGIN
54
+ @graph_right -= LABEL_MARGIN
55
+ @graph_bottom -= LABEL_MARGIN
50
56
 
57
+ @graph_width = @graph_right - @graph_left
58
+ @graph_height = @graph_bottom - @graph_top
59
+ end
60
+
61
+ def setup_data
62
+ raise(Gruff::IncorrectNumberOfDatasetsException, 'Requires 3 or more data sets') if store.length < 3
63
+
64
+ super
65
+ end
66
+
67
+ def draw_graph
51
68
  # Setup basic positioning
52
69
  radius = @graph_height / 2.0
53
70
  center_x = @graph_left + (@graph_width / 2.0)
@@ -64,34 +81,45 @@ class Gruff::Spider < Gruff::Base
64
81
  draw_polygon(center_x, center_y, additive_angle)
65
82
  end
66
83
 
67
- private
68
-
69
84
  def normalize_points(value)
70
85
  value * @unit_length
71
86
  end
72
87
 
73
88
  def draw_label(center_x, center_y, angle, radius, amount)
74
- r_offset = 50 # The distance out from the center of the pie to get point
75
- x_offset = center_x # The label points need to be tweaked slightly
76
- y_offset = center_y + 0 # This one doesn't though
89
+ degree = rad2deg(angle)
90
+ metrics = text_metrics(@marker_font, amount)
91
+
92
+ r_offset = LABEL_MARGIN # The distance out from the center of the pie to get point
93
+ x_offset = center_x # The label points need to be tweaked slightly
94
+
95
+ x_offset -= begin
96
+ case degree
97
+ when 0..45, 315..360
98
+ 0
99
+ when 135..225
100
+ metrics.width
101
+ else
102
+ metrics.width / 2
103
+ end
104
+ end
105
+
106
+ y_offset = center_y - (metrics.height / 2.0) # This one doesn't though
77
107
  x = x_offset + ((radius + r_offset) * Math.cos(angle))
78
108
  y = y_offset + ((radius + r_offset) * Math.sin(angle))
79
109
 
80
- # Draw label
81
- text_renderer = Gruff::Renderer::Text.new(amount, font: @font, size: @legend_font_size, color: @marker_color, weight: Magick::BoldWeight)
82
- text_renderer.add_to_render_queue(0, 0, x, y, Magick::CenterGravity)
110
+ draw_label_at(metrics.width, metrics.height, x, y, amount, Magick::CenterGravity)
83
111
  end
84
112
 
85
113
  def draw_axes(center_x, center_y, radius, additive_angle, line_color = nil)
86
114
  return if @hide_axes
87
115
 
88
- current_angle = @rotation * Math::PI / 180.0
116
+ current_angle = deg2rad(@rotation)
89
117
 
90
118
  store.data.each do |data_row|
91
119
  x_offset = radius * Math.cos(current_angle)
92
120
  y_offset = radius * Math.sin(current_angle)
93
121
 
94
- Gruff::Renderer::Line.new(color: line_color || data_row.color, width: 5.0)
122
+ Gruff::Renderer::Line.new(renderer, color: line_color || data_row.color, width: 5.0)
95
123
  .render(center_x, center_y, center_x + x_offset, center_y + y_offset)
96
124
 
97
125
  draw_label(center_x, center_y, current_angle, radius, data_row.label.to_s) unless @hide_text
@@ -102,18 +130,14 @@ private
102
130
 
103
131
  def draw_polygon(center_x, center_y, additive_angle, color = nil)
104
132
  points = []
105
- current_angle = @rotation * Math::PI / 180.0
133
+ current_angle = deg2rad(@rotation)
106
134
 
107
135
  store.data.each do |data_row|
108
- points << center_x + normalize_points(data_row.points.first) * Math.cos(current_angle)
109
- points << center_y + normalize_points(data_row.points.first) * Math.sin(current_angle)
136
+ points << (center_x + (normalize_points(data_row.points.first) * Math.cos(current_angle)))
137
+ points << (center_y + (normalize_points(data_row.points.first) * Math.sin(current_angle)))
110
138
  current_angle += additive_angle
111
139
  end
112
140
 
113
- Gruff::Renderer::Polygon.new(color: color || @marker_color, opacity: 0.4).render(points)
114
- end
115
-
116
- def sums_for_spider
117
- store.data.sum { |data_row| data_row.points.first }
141
+ Gruff::Renderer::Polygon.new(renderer, color: color || @marker_color, opacity: 0.4).render(points)
118
142
  end
119
143
  end
@@ -12,34 +12,38 @@
12
12
  #
13
13
  class Gruff::StackedArea < Gruff::Base
14
14
  include StackedMixin
15
- attr_writer :last_series_goes_on_bottom
16
15
 
17
- def initialize_ivars
16
+ # @deprecated
17
+ def last_series_goes_on_bottom=(_value)
18
+ warn '#last_series_goes_on_bottom is deprecated. It is no longer effective.'
19
+ end
20
+
21
+ private
22
+
23
+ def initialize_attributes
18
24
  super
19
- @last_series_goes_on_bottom = false
25
+ @minimum_value = 0.0
20
26
  end
21
- private :initialize_ivars
22
27
 
23
- def draw
28
+ def setup_data
24
29
  calculate_maximum_by_stack
25
30
  super
31
+ end
26
32
 
27
- return unless data_given?
28
-
29
- x_increment = @graph_width / (column_count - 1).to_f
33
+ def draw_graph
34
+ x_increment = @graph_width / (column_count - 1)
30
35
 
31
36
  height = Array.new(column_count, 0)
32
37
 
33
38
  data_points = nil
34
- iterator = @last_series_goes_on_bottom ? :reverse_each : :each
35
- store.norm_data.public_send(iterator) do |data_row|
39
+ store.norm_data.each do |data_row|
36
40
  prev_data_points = data_points
37
41
  data_points = []
38
42
 
39
43
  data_row.points.each_with_index do |data_point, index|
40
44
  # Use incremented x and scaled y
41
45
  new_x = @graph_left + (x_increment * index)
42
- new_y = @graph_top + (@graph_height - data_point * @graph_height - height[index])
46
+ new_y = @graph_top + (@graph_height - (data_point * @graph_height) - height[index])
43
47
 
44
48
  height[index] += (data_point * @graph_height)
45
49
 
@@ -51,20 +55,20 @@ class Gruff::StackedArea < Gruff::Base
51
55
 
52
56
  poly_points = data_points.dup
53
57
  if prev_data_points
54
- (prev_data_points.length / 2 - 1).downto(0) do |i|
58
+ ((prev_data_points.length / 2) - 1).downto(0) do |i|
55
59
  poly_points << prev_data_points[2 * i]
56
- poly_points << prev_data_points[2 * i + 1]
60
+ poly_points << prev_data_points[(2 * i) + 1]
57
61
  end
58
62
  else
59
63
  poly_points << @graph_right
60
- poly_points << @graph_bottom - 1
64
+ poly_points << (@graph_bottom - 1)
61
65
  poly_points << @graph_left
62
- poly_points << @graph_bottom - 1
66
+ poly_points << (@graph_bottom - 1)
63
67
  end
64
68
  poly_points << data_points[0]
65
69
  poly_points << data_points[1]
66
70
 
67
- Gruff::Renderer::Polygon.new(color: data_row.color).render(poly_points)
71
+ Gruff::Renderer::Polygon.new(renderer, color: data_row.color).render(poly_points)
68
72
  end
69
73
  end
70
74
  end
@@ -30,76 +30,98 @@ class Gruff::StackedBar < Gruff::Base
30
30
  # Prevent drawing of column labels below a stacked bar graph. Default is +false+.
31
31
  attr_writer :hide_labels
32
32
 
33
- def initialize_ivars
33
+ private
34
+
35
+ def initialize_attributes
34
36
  super
35
37
  @bar_spacing = 0.9
36
38
  @segment_spacing = 2
37
39
  @label_formatting = nil
38
40
  @show_labels_for_bar_values = false
39
41
  @hide_labels = false
42
+ @minimum_value = 0.0
40
43
  end
41
- private :initialize_ivars
42
44
 
43
- # Draws a bar graph, but multiple sets are stacked on top of each other.
44
- def draw
45
+ def setup_data
45
46
  calculate_maximum_by_stack
46
47
  super
47
- return unless data_given?
48
+ end
49
+
50
+ def setup_graph_measurements
51
+ super
52
+ return if @hide_line_markers
53
+
54
+ if @show_labels_for_bar_values
55
+ proc_text_metrics = ->(text) { text_metrics(@marker_font, text) }
48
56
 
57
+ if maximum_value >= 0
58
+ _, metrics = Gruff::BarValueLabel.metrics(maximum_value, @label_formatting, proc_text_metrics)
59
+ @graph_top += metrics.height
60
+ end
61
+
62
+ @graph_height = @graph_bottom - @graph_top
63
+ end
64
+ end
65
+
66
+ # Draws a bar graph, but multiple sets are stacked on top of each other.
67
+ def draw_graph
49
68
  # Setup spacing.
50
69
  #
51
70
  # Columns sit stacked.
52
- bar_width = @graph_width / column_count.to_f
71
+ bar_width = @graph_width / column_count
53
72
  padding = (bar_width * (1 - @bar_spacing)) / 2
54
73
 
55
74
  height = Array.new(column_count, 0)
56
- stack_bar_value_label = Gruff::BarValueLabel::StackedBar.new
75
+ length = Array.new(column_count, @graph_bottom)
76
+ stack_bar_value_labels = Gruff::BarValueLabel::StackedBar.new
57
77
 
58
78
  store.norm_data.each_with_index do |data_row, row_index|
59
79
  data_row.points.each_with_index do |data_point, point_index|
60
- next if data_point == 0
80
+ temp1 = @graph_top + (@graph_height - (data_point * @graph_height) - height[point_index])
81
+ temp2 = @graph_top + @graph_height - height[point_index]
82
+ difference = temp2 - temp1
83
+ difference = 0 if difference < 0
61
84
 
62
85
  # Use incremented x and scaled y
63
86
  left_x = @graph_left + (bar_width * point_index) + padding
64
- left_y = @graph_top + (@graph_height -
65
- data_point * @graph_height -
66
- height[point_index]) + @segment_spacing
67
- right_x = left_x + bar_width * @bar_spacing
68
- right_y = @graph_top + @graph_height - height[point_index]
87
+ left_y = length[point_index] - difference
88
+ right_x = left_x + (bar_width * @bar_spacing)
89
+ right_y = length[point_index]
90
+ right_y -= @segment_spacing if row_index != store.columns - 1
69
91
 
70
92
  # update the total height of the current stacked bar
93
+ length[point_index] -= difference
71
94
  height[point_index] += (data_point * @graph_height)
72
95
 
73
- rect_renderer = Gruff::Renderer::Rectangle.new(color: data_row.color)
96
+ rect_renderer = Gruff::Renderer::Rectangle.new(renderer, color: data_row.color)
74
97
  rect_renderer.render(left_x, left_y, right_x, right_y)
75
98
 
76
99
  # Calculate center based on bar_width and current row
77
- label_center = left_x + bar_width * @bar_spacing / 2.0
100
+ label_center = left_x + (bar_width * @bar_spacing / 2.0)
78
101
  draw_label(label_center, point_index)
79
102
 
80
103
  bar_value_label = Gruff::BarValueLabel::Bar.new([left_x, left_y, right_x, right_y], store.data[row_index].points[point_index])
81
- stack_bar_value_label.add(bar_value_label, point_index)
104
+ stack_bar_value_labels.add(bar_value_label, point_index)
82
105
  end
83
106
  end
84
107
 
85
108
  if @show_labels_for_bar_values
86
- stack_bar_value_label.prepare_rendering(@label_formatting, bar_width) do |x, y, text|
87
- draw_value_label(x, y, text, true)
109
+ proc_text_metrics = ->(text) { text_metrics(@marker_font, text) }
110
+ stack_bar_value_labels.prepare_rendering(@label_formatting, proc_text_metrics) do |x, y, text, _text_width, text_height|
111
+ draw_value_label(bar_width * @bar_spacing, text_height, x, y, text)
88
112
  end
89
113
  end
90
114
  end
91
115
 
92
- protected
93
-
94
116
  def hide_labels?
95
117
  @hide_labels
96
118
  end
97
119
 
98
120
  def hide_left_label_area?
99
- @hide_line_markers
121
+ @hide_line_markers && @y_axis_label.nil?
100
122
  end
101
123
 
102
124
  def hide_bottom_label_area?
103
- hide_labels?
125
+ hide_labels? && @x_axis_label.nil? && @legend_at_bottom == false
104
126
  end
105
127
  end
@@ -3,27 +3,23 @@
3
3
  module Gruff
4
4
  # @private
5
5
  class Store
6
- attr_reader :data, :norm_data
6
+ attr_reader :data
7
7
 
8
8
  def initialize(data_class)
9
9
  @data_class = data_class
10
10
  @data = []
11
- @norm_data = []
12
- @normalized = false
13
11
  end
14
12
 
15
13
  def add(*args)
16
14
  @data << @data_class.new(*args)
17
15
  end
18
16
 
19
- def normalize(**keywords)
20
- unless @normalized
21
- @data.each do |data_row|
22
- @norm_data << data_row.normalize(**keywords)
23
- end
17
+ def norm_data
18
+ @norm_data || []
19
+ end
24
20
 
25
- @normalized = true
26
- end
21
+ def normalize(**keywords)
22
+ @norm_data = @data.map { |data_row| data_row.normalize(**keywords) }
27
23
  end
28
24
 
29
25
  def empty?
@@ -9,6 +9,8 @@ module Gruff
9
9
  super(label.to_s, Array(y_points), color, x_points)
10
10
  end
11
11
 
12
+ alias points y_points
13
+
12
14
  def x_points
13
15
  self[:x_points] || Array.new(y_points.length)
14
16
  end
data/lib/gruff/themes.rb CHANGED
@@ -16,7 +16,7 @@ module Gruff
16
16
  marker_color: 'white',
17
17
  font_color: 'white',
18
18
  background_colors: %w[black #4a465a]
19
- }
19
+ }.freeze
20
20
 
21
21
  # A color scheme plucked from the colors on the popular usability blog.
22
22
  THIRTYSEVEN_SIGNALS = {
@@ -32,7 +32,7 @@ module Gruff
32
32
  marker_color: 'black',
33
33
  font_color: 'black',
34
34
  background_colors: %w[#d1edf5 white]
35
- }
35
+ }.freeze
36
36
 
37
37
  # A color scheme from the colors used on the 2005 Rails keynote
38
38
  # presentation at RubyConf.
@@ -49,7 +49,7 @@ module Gruff
49
49
  marker_color: 'white',
50
50
  font_color: 'white',
51
51
  background_colors: %w[#0083a3 #0083a3]
52
- }
52
+ }.freeze
53
53
 
54
54
  # A color scheme similar to that used on the popular podcast site.
55
55
  ODEO = {
@@ -65,7 +65,7 @@ module Gruff
65
65
  marker_color: 'white',
66
66
  font_color: 'white',
67
67
  background_colors: %w[#ff47a4 #ff1f81]
68
- }
68
+ }.freeze
69
69
 
70
70
  # A pastel theme
71
71
  PASTEL = {
@@ -81,7 +81,7 @@ module Gruff
81
81
  marker_color: '#aea9a9', # Grey
82
82
  font_color: 'black',
83
83
  background_colors: 'white'
84
- }
84
+ }.freeze
85
85
 
86
86
  # A greyscale theme
87
87
  GREYSCALE = {
@@ -96,6 +96,6 @@ module Gruff
96
96
  marker_color: '#aea9a9', # Grey
97
97
  font_color: 'black',
98
98
  background_colors: 'white'
99
- }
99
+ }.freeze
100
100
  end
101
101
  end
data/lib/gruff/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gruff
4
- VERSION = '0.13.0'
4
+ VERSION = '0.16.0'
5
5
  end
data/lib/gruff.rb CHANGED
@@ -1,61 +1,74 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'rmagick'
4
- require 'gruff/version'
5
-
6
- # Extra full path added to fix loading errors on some installations.
7
-
8
- %w[
9
- patch/rmagick
10
- patch/string
11
-
12
- base
13
-
14
- helper/bar_conversion.rb
15
- helper/stacked_mixin
16
- helper/bar_value_label
17
-
18
- themes
19
- area
20
- bar
21
- bezier
22
- bullet
23
- dot
24
- histogram
25
- line
26
- net
27
- pie
28
- scatter
29
- spider
30
- side_bar
31
- stacked_area
32
- stacked_bar
33
- side_stacked_bar
34
- accumulator_bar
35
-
36
- scene
37
-
38
- renderer/renderer
39
- renderer/rectangle
40
- renderer/circle
41
- renderer/dash_line
42
- renderer/line
43
- renderer/polyline
44
- renderer/polygon
45
- renderer/bezier
46
- renderer/ellipse
47
- renderer/dot
48
- renderer/text
49
-
50
- store/store
51
- store/basic_data
52
- store/custom_data
53
- store/xy_data
54
-
55
- mini/legend
56
- mini/bar
57
- mini/pie
58
- mini/side_bar
59
- ].each do |filename|
60
- require "gruff/#{filename}"
4
+
5
+ require_relative 'gruff/patch/rmagick'
6
+ require_relative 'gruff/patch/string'
7
+ require_relative 'gruff/renderer/renderer'
8
+ require_relative 'gruff/store/store'
9
+ require_relative 'gruff/font'
10
+ require_relative 'gruff/base'
11
+ require_relative 'gruff/version'
12
+
13
+ ##
14
+ # = Gruff. Graphs.
15
+ #
16
+ module Gruff
17
+ # @private
18
+ def self.libpath(path)
19
+ File.join(__dir__, 'gruff', path)
20
+ end
21
+
22
+ autoload :BarConversion, Gruff.libpath('helper/bar_conversion')
23
+ autoload :BarValueLabel, Gruff.libpath('helper/bar_value_label')
24
+ class Base
25
+ autoload :StackedMixin, Gruff.libpath('helper/stacked_mixin')
26
+ end
27
+
28
+ autoload :AccumulatorBar, Gruff.libpath('accumulator_bar')
29
+ autoload :Area, Gruff.libpath('area')
30
+ autoload :Bar, Gruff.libpath('bar')
31
+ autoload :Bezier, Gruff.libpath('bezier')
32
+ autoload :BoxPlot, Gruff.libpath('box_plot')
33
+ autoload :Bullet, Gruff.libpath('bullet')
34
+ autoload :Candlestick, Gruff.libpath('candlestick')
35
+ autoload :Dot, Gruff.libpath('dot')
36
+ autoload :Histogram, Gruff.libpath('histogram')
37
+ autoload :Line, Gruff.libpath('line')
38
+ autoload :Net, Gruff.libpath('net')
39
+ autoload :Pie, Gruff.libpath('pie')
40
+ autoload :Scatter, Gruff.libpath('scatter')
41
+ autoload :SideBar, Gruff.libpath('side_bar')
42
+ autoload :SideStackedBar, Gruff.libpath('side_stacked_bar')
43
+ autoload :Spider, Gruff.libpath('spider')
44
+ autoload :StackedArea, Gruff.libpath('stacked_area')
45
+ autoload :StackedBar, Gruff.libpath('stacked_bar')
46
+
47
+ autoload :Layer, Gruff.libpath('scene')
48
+ autoload :Themes, Gruff.libpath('themes')
49
+
50
+ class Renderer
51
+ autoload :Bezier, Gruff.libpath('renderer/bezier')
52
+ autoload :Circle, Gruff.libpath('renderer/circle')
53
+ autoload :DashLine, Gruff.libpath('renderer/dash_line')
54
+ autoload :Dot, Gruff.libpath('renderer/dot')
55
+ autoload :Ellipse, Gruff.libpath('renderer/ellipse')
56
+ autoload :Line, Gruff.libpath('renderer/line')
57
+ autoload :Polygon, Gruff.libpath('renderer/polygon')
58
+ autoload :Polyline, Gruff.libpath('renderer/polyline')
59
+ autoload :Rectangle, Gruff.libpath('renderer/rectangle')
60
+ autoload :Text, Gruff.libpath('renderer/text')
61
+ end
62
+
63
+ class Store
64
+ autoload :BasicData, Gruff.libpath('store/basic_data')
65
+ autoload :XYData, Gruff.libpath('store/xy_data')
66
+ end
67
+
68
+ module Mini
69
+ autoload :Bar, Gruff.libpath('mini/bar')
70
+ autoload :Legend, Gruff.libpath('mini/legend')
71
+ autoload :Pie, Gruff.libpath('mini/pie')
72
+ autoload :SideBar, Gruff.libpath('mini/side_bar')
73
+ end
61
74
  end
@@ -26,7 +26,7 @@ class <%= controller_class_name %>Controller < ApplicationController
26
26
 
27
27
  g.labels = {0 => '2004', 2 => '2005', 4 => '2006'}
28
28
 
29
- send_data(g.to_blob, :disposition => 'inline', :type => 'image/png', :filename => "gruff.png")
29
+ send_data(g.to_image.to_blob, :disposition => 'inline', :type => 'image/png', :filename => "gruff.png")
30
30
  end
31
31
 
32
32
  end