gruff 0.9.0-java → 0.12.2-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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +21 -4
  3. data/.rubocop_todo.yml +103 -49
  4. data/.travis.yml +3 -6
  5. data/CHANGELOG.md +30 -0
  6. data/README.md +4 -0
  7. data/gruff.gemspec +8 -3
  8. data/lib/gruff.rb +9 -3
  9. data/lib/gruff/accumulator_bar.rb +13 -5
  10. data/lib/gruff/area.rb +22 -5
  11. data/lib/gruff/bar.rb +38 -10
  12. data/lib/gruff/base.rb +325 -236
  13. data/lib/gruff/bezier.rb +18 -4
  14. data/lib/gruff/bullet.rb +22 -14
  15. data/lib/gruff/dot.rb +20 -33
  16. data/lib/gruff/helper/bar_conversion.rb +7 -7
  17. data/lib/gruff/helper/bar_value_label_mixin.rb +3 -0
  18. data/lib/gruff/helper/stacked_mixin.rb +1 -1
  19. data/lib/gruff/histogram.rb +59 -0
  20. data/lib/gruff/line.rb +33 -28
  21. data/lib/gruff/mini/bar.rb +10 -2
  22. data/lib/gruff/mini/legend.rb +9 -4
  23. data/lib/gruff/mini/pie.rb +9 -3
  24. data/lib/gruff/mini/side_bar.rb +18 -4
  25. data/lib/gruff/net.rb +41 -21
  26. data/lib/gruff/patch/rmagick.rb +22 -24
  27. data/lib/gruff/patch/string.rb +9 -4
  28. data/lib/gruff/photo_bar.rb +12 -16
  29. data/lib/gruff/pie.rb +24 -34
  30. data/lib/gruff/renderer/bezier.rb +4 -3
  31. data/lib/gruff/renderer/circle.rb +4 -3
  32. data/lib/gruff/renderer/dash_line.rb +4 -3
  33. data/lib/gruff/renderer/dot.rb +4 -3
  34. data/lib/gruff/renderer/ellipse.rb +4 -3
  35. data/lib/gruff/renderer/line.rb +14 -5
  36. data/lib/gruff/renderer/polygon.rb +5 -4
  37. data/lib/gruff/renderer/polyline.rb +4 -3
  38. data/lib/gruff/renderer/rectangle.rb +3 -2
  39. data/lib/gruff/renderer/renderer.rb +31 -38
  40. data/lib/gruff/renderer/text.rb +29 -7
  41. data/lib/gruff/scatter.rb +26 -24
  42. data/lib/gruff/scene.rb +0 -1
  43. data/lib/gruff/side_bar.rb +51 -20
  44. data/lib/gruff/side_stacked_bar.rb +42 -15
  45. data/lib/gruff/spider.rb +29 -17
  46. data/lib/gruff/stacked_area.rb +19 -8
  47. data/lib/gruff/stacked_bar.rb +34 -13
  48. data/lib/gruff/store/{base_data.rb → basic_data.rb} +9 -7
  49. data/lib/gruff/store/custom_data.rb +8 -6
  50. data/lib/gruff/store/store.rb +7 -6
  51. data/lib/gruff/store/xy_data.rb +10 -7
  52. data/lib/gruff/version.rb +1 -1
  53. metadata +33 -8
  54. data/Rakefile +0 -23
  55. data/docker/Dockerfile +0 -14
  56. data/docker/build.sh +0 -4
  57. data/docker/launch.sh +0 -4
@@ -1,10 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gruff
4
+ # @private
4
5
  class Renderer::Bezier
5
- def initialize(args = {})
6
- @color = args[:color]
7
- @width = args[:width] || 1.0
6
+ def initialize(color:, width: 1.0)
7
+ @color = color
8
+ @width = width
8
9
  end
9
10
 
10
11
  def render(points)
@@ -1,10 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gruff
4
+ # @private
4
5
  class Renderer::Circle
5
- def initialize(args = {})
6
- @color = args[:color]
7
- @width = args[:width] || 1.0
6
+ def initialize(color:, width: 1.0)
7
+ @color = color
8
+ @width = width
8
9
  end
9
10
 
10
11
  def render(origin_x, origin_y, perim_x, perim_y)
@@ -1,10 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gruff
4
+ # @private
4
5
  class Renderer::DashLine
5
- def initialize(args = {})
6
- @color = args[:color]
7
- @width = args[:width]
6
+ def initialize(color:, width:)
7
+ @color = color
8
+ @width = width
8
9
  end
9
10
 
10
11
  def render(start_x, start_y, end_x, end_y)
@@ -1,11 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gruff
4
+ # @private
4
5
  class Renderer::Dot
5
- def initialize(style, config)
6
+ def initialize(style, color:, width: 1.0)
6
7
  @style = style
7
- @color = config[:color]
8
- @width = config[:width] || 1.0
8
+ @color = color
9
+ @width = width
9
10
  end
10
11
 
11
12
  def render(new_x, new_y, circle_radius)
@@ -1,10 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gruff
4
+ # @private
4
5
  class Renderer::Ellipse
5
- def initialize(args = {})
6
- @color = args[:color]
7
- @width = args[:width] || 1.0
6
+ def initialize(color:, width: 1.0)
7
+ @color = color
8
+ @width = width
8
9
  end
9
10
 
10
11
  def render(origin_x, origin_y, width, height, arc_start, arc_end)
@@ -1,15 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gruff
4
+ # @private
4
5
  class Renderer::Line
5
6
  EPSILON = 0.001
6
7
 
7
- def initialize(args = {})
8
- @color = args[:color]
9
- @width = args[:width]
8
+ def initialize(color:, width: nil, shadow_color: nil)
9
+ @color = color
10
+ @width = width
11
+ @shadow_color = shadow_color
10
12
  end
11
13
 
12
14
  def render(start_x, start_y, end_x, end_y)
15
+ render_line(start_x, start_y, end_x, end_y, @color)
16
+ render_line(start_x, start_y + 1, end_x, end_y + 1, @shadow_color) if @shadow_color
17
+ end
18
+
19
+ private
20
+
21
+ def render_line(start_x, start_y, end_x, end_y, color)
13
22
  # FIXME(uwe): Workaround for Issue #66
14
23
  # https://github.com/topfunky/gruff/issues/66
15
24
  # https://github.com/rmagick/rmagick/issues/82
@@ -24,8 +33,8 @@ module Gruff
24
33
  draw = Renderer.instance.draw
25
34
 
26
35
  draw.push
27
- draw.stroke(@color)
28
- draw.fill(@color)
36
+ draw.stroke(color)
37
+ draw.fill(color)
29
38
  draw.stroke_width(@width) if @width
30
39
  draw.line(start_x, start_y, end_x, end_y)
31
40
  draw.pop
@@ -1,11 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gruff
4
+ # @private
4
5
  class Renderer::Polygon
5
- def initialize(args = {})
6
- @color = args[:color]
7
- @width = args[:width] || 1.0
8
- @opacity = args[:opacity] || 1.0
6
+ def initialize(color:, width: 1.0, opacity: 1.0)
7
+ @color = color
8
+ @width = width
9
+ @opacity = opacity
9
10
  end
10
11
 
11
12
  def render(points)
@@ -1,10 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gruff
4
+ # @private
4
5
  class Renderer::Polyline
5
- def initialize(args = {})
6
- @color = args[:color]
7
- @width = args[:width]
6
+ def initialize(color:, width:)
7
+ @color = color
8
+ @width = width
8
9
  end
9
10
 
10
11
  def render(points)
@@ -1,9 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gruff
4
+ # @private
4
5
  class Renderer::Rectangle
5
- def initialize(args = {})
6
- @color = args[:color]
6
+ def initialize(color: nil)
7
+ @color = color
7
8
  end
8
9
 
9
10
  def render(upper_left_x, upper_left_y, lower_right_x, lower_right_y)
@@ -7,58 +7,51 @@ module Gruff
7
7
  class Renderer
8
8
  include Singleton
9
9
 
10
- attr_accessor :draw, :image, :scale
10
+ attr_accessor :draw, :image, :scale, :text_renderers
11
11
 
12
- class << self
13
- def setup(columns, rows, font, scale, theme_options)
14
- draw = Magick::Draw.new
15
- draw.font = font if font
16
- # Scale down from 800x600 used to calculate drawing.
17
- draw.scale(scale, scale)
12
+ def self.setup(columns, rows, font, scale, theme_options)
13
+ draw = Magick::Draw.new
14
+ draw.font = font if font
15
+ # Scale down from 800x600 used to calculate drawing.
16
+ draw.scale(scale, scale)
18
17
 
19
- image = Renderer.instance.background(columns, rows, scale, theme_options)
18
+ image = Renderer.instance.background(columns, rows, scale, theme_options)
20
19
 
21
- Renderer.instance.draw = draw
22
- Renderer.instance.scale = scale
23
- Renderer.instance.image = image
24
- end
25
-
26
- def setup_transparent_background(columns, rows)
27
- image = Renderer.instance.render_transparent_background(columns, rows)
28
- Renderer.instance.image = image
29
- end
20
+ Renderer.instance.draw = draw
21
+ Renderer.instance.scale = scale
22
+ Renderer.instance.image = image
23
+ Renderer.instance.text_renderers = []
24
+ end
30
25
 
31
- def background_image=(image)
32
- Renderer.instance.image = image
33
- end
26
+ def self.setup_transparent_background(columns, rows)
27
+ image = Renderer.instance.render_transparent_background(columns, rows)
28
+ Renderer.instance.image = image
29
+ end
34
30
 
35
- def font=(font)
36
- draw = Renderer.instance.draw
37
- draw.font = font if font
38
- end
31
+ def self.background_image=(image)
32
+ Renderer.instance.image = image
33
+ end
39
34
 
40
- def finish
41
- draw = Renderer.instance.draw
42
- image = Renderer.instance.image
35
+ def self.font=(font)
36
+ draw = Renderer.instance.draw
37
+ draw.font = font if font
38
+ end
43
39
 
44
- draw.draw(image)
45
- end
40
+ def self.finish
41
+ draw = Renderer.instance.draw
42
+ image = Renderer.instance.image
46
43
 
47
- def write(file_name)
48
- Renderer.instance.image.write(file_name)
49
- end
44
+ draw.draw(image)
50
45
 
51
- def to_blob(file_format)
52
- Renderer.instance.image.to_blob do
53
- self.format = file_format
54
- end
46
+ Renderer.instance.text_renderers.each do |renderer|
47
+ renderer.render(renderer.width, renderer.height, renderer.x, renderer.y, renderer.gravity)
55
48
  end
56
49
  end
57
50
 
58
51
  def background(columns, rows, scale, theme_options)
59
52
  case theme_options[:background_colors]
60
53
  when Array
61
- gradated_background(columns, rows, theme_options[:background_colors][0], theme_options[:background_colors][1], theme_options[:background_direction])
54
+ gradated_background(columns, rows, *theme_options[:background_colors][0..1], theme_options[:background_direction])
62
55
  when String
63
56
  solid_background(columns, rows, theme_options[:background_colors])
64
57
  else
@@ -102,7 +95,7 @@ module Gruff
102
95
 
103
96
  if @gradated_background_retry_count < 3
104
97
  @gradated_background_retry_count += 1
105
- gradated_background(top_color, bottom_color, direct)
98
+ gradated_background(columns, rows, top_color, bottom_color, direct)
106
99
  else
107
100
  raise e
108
101
  end
@@ -1,14 +1,29 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gruff
4
+ # @private
4
5
  class Renderer::Text
5
- def initialize(text, args = {})
6
+ using Magick::GruffAnnotate
7
+
8
+ def initialize(text, font:, size:, color:, weight: Magick::NormalWeight, rotation: nil)
6
9
  @text = text.to_s
7
- @font = args[:font]
8
- @font_size = args[:size]
9
- @font_color = args[:color]
10
- @font_weight = args[:weight] || Magick::NormalWeight
11
- @rotation = args[:rotation]
10
+ @font = font
11
+ @font_size = size
12
+ @font_color = color
13
+ @font_weight = weight
14
+ @rotation = rotation
15
+ end
16
+
17
+ attr_reader :width, :height, :x, :y, :gravity
18
+
19
+ def add_to_render_queue(width, height, x, y, gravity = Magick::NorthGravity)
20
+ @width = width
21
+ @height = height
22
+ @x = x
23
+ @y = y
24
+ @gravity = gravity
25
+
26
+ Renderer.instance.text_renderers << self
12
27
  end
13
28
 
14
29
  def render(width, height, x, y, gravity = Magick::NorthGravity)
@@ -36,7 +51,14 @@ module Gruff
36
51
 
37
52
  draw.font_weight = font_weight
38
53
  draw.pointsize = size
39
- draw.get_type_metrics(image, text.to_s)
54
+
55
+ # The old ImageMagick causes SEGV with string which has '%' + alphabet (eg. '%S').
56
+ # This format is used to embed value into a string using image properties.
57
+ # However, gruff use plain image as canvas which does not have any property.
58
+ # So, in here, it just escape % in order to avoid SEGV.
59
+ text = text.to_s.gsub(/(%+)/) { ('%' * Regexp.last_match(1).size * 2).to_s }
60
+
61
+ draw.get_type_metrics(image, text)
40
62
  end
41
63
  end
42
64
  end
data/lib/gruff/scatter.rb CHANGED
@@ -1,44 +1,48 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'gruff/base'
4
-
5
- # Here's how to set up an XY Scatter Chart
3
+ #
4
+ # Here's how to set up a Gruff::Scatter.
6
5
  #
7
6
  # g = Gruff::Scatter.new(800)
8
- # g.data(:apples, [1,2,3,4], [4,3,2,1])
9
- # g.data('oranges', [5,7,8], [4,1,7])
10
- # g.write('test/output/scatter.png')
7
+ # g.data :apples, [1,2,3,4], [4,3,2,1]
8
+ # g.data 'oranges', [5,7,8], [4,1,7]
9
+ # g.write('scatter.png')
11
10
  #
12
11
  class Gruff::Scatter < Gruff::Base
13
12
  # Maximum X Value. The value will get overwritten by the max in the
14
13
  # datasets.
15
- attr_accessor :maximum_x_value
14
+ attr_writer :maximum_x_value
16
15
 
17
16
  # Minimum X Value. The value will get overwritten by the min in the
18
17
  # datasets.
19
- attr_accessor :minimum_x_value
18
+ attr_writer :minimum_x_value
20
19
 
21
20
  # The number of vertical lines shown for reference.
22
- attr_accessor :marker_x_count
21
+ attr_writer :marker_x_count
23
22
 
24
23
  # Attributes to allow customising the size of the points.
25
- attr_accessor :circle_radius
26
- attr_accessor :stroke_width
24
+ attr_writer :circle_radius
25
+ attr_writer :stroke_width
27
26
 
28
27
  # Allow disabling the significant rounding when labeling the X axis.
29
28
  # This is useful when working with a small range of high values (for example, a date range of months, while seconds as units).
30
- attr_accessor :disable_significant_rounding_x_axis
29
+ attr_writer :disable_significant_rounding_x_axis
31
30
 
32
31
  # Allow enabling vertical lines. When you have a lot of data, they can work great.
33
- attr_accessor :enable_vertical_line_markers
32
+ attr_writer :enable_vertical_line_markers
34
33
 
35
34
  # Allow using vertical labels in the X axis (and setting the label margin).
36
- attr_accessor :x_label_margin
37
- attr_accessor :use_vertical_x_labels
35
+ attr_writer :x_label_margin
36
+ attr_writer :use_vertical_x_labels
38
37
 
39
38
  # Allow passing lambdas to format labels.
40
- attr_accessor :y_axis_label_format
41
- attr_accessor :x_axis_label_format
39
+ attr_writer :y_axis_label_format
40
+ attr_writer :x_axis_label_format
41
+
42
+ def initialize_store
43
+ @store = Gruff::Store.new(Gruff::Store::XYData)
44
+ end
45
+ private :initialize_store
42
46
 
43
47
  def initialize_ivars
44
48
  super
@@ -55,8 +59,6 @@ class Gruff::Scatter < Gruff::Base
55
59
  @x_axis_label_format = nil
56
60
  @x_label_margin = nil
57
61
  @y_axis_label_format = nil
58
-
59
- @store = Gruff::Store.new(Gruff::Store::XYData)
60
62
  end
61
63
  private :initialize_ivars
62
64
 
@@ -80,8 +82,6 @@ class Gruff::Scatter < Gruff::Base
80
82
  Gruff::Renderer::Circle.new(color: data_row.color, width: stroke_width).render(new_x, new_y, new_x - circle_radius, new_y)
81
83
  end
82
84
  end
83
-
84
- Gruff::Renderer.finish
85
85
  end
86
86
 
87
87
  # The first parameter is the name of the dataset. The next two are the
@@ -191,7 +191,7 @@ private
191
191
  calculate_spread
192
192
  normalize
193
193
 
194
- @marker_count = (@x_spread / @x_axis_increment).to_i
194
+ self.marker_count = (@x_spread / @x_axis_increment).to_i
195
195
  @x_increment = @x_axis_increment
196
196
  end
197
197
  increment_x_scaled = @graph_width.to_f / (@x_spread / @x_increment)
@@ -201,7 +201,9 @@ private
201
201
  # TODO: Fix the vertical lines, and enable them by default. Not pretty when they don't match up with top y-axis line
202
202
  if @enable_vertical_line_markers
203
203
  x = @graph_left + @graph_width - index.to_f * increment_x_scaled
204
- Gruff::Renderer::Line.new(color: @marker_color).render(x, @graph_top, x, @graph_bottom)
204
+
205
+ line_renderer = Gruff::Renderer::Line.new(color: @marker_color, shadow_color: @marker_shadow_color)
206
+ line_renderer.render(x, @graph_top, x, @graph_bottom)
205
207
  end
206
208
 
207
209
  unless @hide_line_numbers
@@ -212,7 +214,7 @@ private
212
214
  label = vertical_label(marker_label, @x_increment)
213
215
  rotation = -90.0 if @use_vertical_x_labels
214
216
  text_renderer = Gruff::Renderer::Text.new(label, font: @font, size: @marker_font_size, color: @font_color, rotation: rotation)
215
- text_renderer.render(1.0, 1.0, x_offset, y_offset)
217
+ text_renderer.add_to_render_queue(1.0, 1.0, x_offset, y_offset)
216
218
  end
217
219
  end
218
220
  end
data/lib/gruff/scene.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'observer'
4
- require 'gruff/base'
5
4
 
6
5
  # A scene is a non-linear graph that assembles layers together to tell a story.
7
6
  # Layers are folders with appropriately named files (see below). You can group
@@ -1,27 +1,50 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'gruff/base'
4
-
5
3
  # Graph with individual horizontal bars instead of vertical bars.
4
+ #
5
+ # Here's how to set up a Gruff::SideBar.
6
+ #
7
+ # g = Gruff::SideBar.new
8
+ # g.title = 'SideBar Graph'
9
+ # g.labels = {
10
+ # 0 => '5/6',
11
+ # 1 => '5/15',
12
+ # 2 => '5/24',
13
+ # 3 => '5/30',
14
+ # }
15
+ # g.group_spacing = 20
16
+ # g.data :Art, [0, 5, 8, 15]
17
+ # g.data :Philosophy, [10, 3, 2, 8]
18
+ # g.data :Science, [2, 15, 8, 11]
19
+ # g.write('sidebar.png')
20
+ #
6
21
  class Gruff::SideBar < Gruff::Base
22
+ using String::GruffCommify
23
+
7
24
  # Spacing factor applied between bars.
8
- attr_accessor :bar_spacing
25
+ attr_writer :bar_spacing
9
26
 
10
27
  # Spacing factor applied between a group of bars belonging to the same label.
11
- attr_accessor :group_spacing
28
+ attr_writer :group_spacing
12
29
 
13
30
  # Set the number output format for labels using sprintf.
14
31
  # Default is +"%.2f"+.
15
- attr_accessor :label_formatting
32
+ attr_writer :label_formatting
16
33
 
17
34
  # Output the values for the bars on a bar graph.
18
35
  # Default is +false+.
19
- attr_accessor :show_labels_for_bar_values
36
+ attr_writer :show_labels_for_bar_values
37
+
38
+ # Prevent drawing of column labels left of a side bar graph. Default is +false+.
39
+ attr_writer :hide_labels
20
40
 
21
41
  def initialize_ivars
22
42
  super
43
+ @bar_spacing = 0.9
44
+ @group_spacing = 10
23
45
  @label_formatting = nil
24
46
  @show_labels_for_bar_values = false
47
+ @hide_labels = false
25
48
  end
26
49
  private :initialize_ivars
27
50
 
@@ -34,14 +57,25 @@ class Gruff::SideBar < Gruff::Base
34
57
  draw_bars
35
58
  end
36
59
 
60
+ protected
61
+
62
+ def hide_labels?
63
+ @hide_labels
64
+ end
65
+
66
+ def hide_left_label_area?
67
+ hide_labels?
68
+ end
69
+
70
+ def hide_bottom_label_area?
71
+ @hide_line_markers
72
+ end
73
+
37
74
  private
38
75
 
39
76
  def draw_bars
40
77
  # Setup spacing.
41
78
  #
42
- @bar_spacing ||= 0.9
43
- @group_spacing ||= 10
44
-
45
79
  bars_width = (@graph_height - calculate_spacing) / column_count.to_f
46
80
  bar_width = bars_width / store.length
47
81
  height = Array.new(column_count, 0)
@@ -57,7 +91,7 @@ private
57
91
  data_row.points.each_with_index do |data_point, point_index|
58
92
  group_spacing = @group_spacing * @scale * point_index
59
93
 
60
- # Using the original calcs from the stacked bar chart
94
+ # Using the original calculations from the stacked bar chart
61
95
  # to get the difference between
62
96
  # part of the bart chart we wish to stack.
63
97
  temp1 = @graph_left + (@graph_width - data_point * @graph_width - height[point_index])
@@ -89,8 +123,6 @@ private
89
123
  end
90
124
  end
91
125
  end
92
-
93
- Gruff::Renderer.finish
94
126
  end
95
127
 
96
128
  # Instead of base class version, draws vertical background lines and label
@@ -98,7 +130,7 @@ private
98
130
  return if @hide_line_markers
99
131
 
100
132
  # Draw horizontal line markers and annotate with numbers
101
- number_of_lines = @marker_count || 5
133
+ number_of_lines = marker_count
102
134
  number_of_lines = 1 if number_of_lines == 0
103
135
 
104
136
  # TODO: Round maximum marker value to a round number like 100, 0.1, 0.5, etc.
@@ -106,13 +138,16 @@ private
106
138
  (0..number_of_lines).each do |index|
107
139
  line_diff = (@graph_right - @graph_left) / number_of_lines
108
140
  x = @graph_right - (line_diff * index) - 1
109
- Gruff::Renderer::Line.new(color: @marker_color).render(x, @graph_bottom, x, @graph_top)
141
+
142
+ line_renderer = Gruff::Renderer::Line.new(color: @marker_color, shadow_color: @marker_shadow_color)
143
+ line_renderer.render(x, @graph_bottom, x, @graph_top)
144
+
110
145
  diff = index - number_of_lines
111
146
  marker_label = diff.abs * increment + minimum_value
112
147
 
113
148
  unless @hide_line_numbers
114
149
  text_renderer = Gruff::Renderer::Text.new(marker_label, font: @font, size: @marker_font_size, color: @font_color)
115
- text_renderer.render(0, 0, x, @graph_bottom + (LABEL_MARGIN * 2.0), Magick::CenterGravity)
150
+ text_renderer.add_to_render_queue(0, 0, x, @graph_bottom + LABEL_MARGIN, Magick::CenterGravity)
116
151
  end
117
152
  end
118
153
  end
@@ -125,11 +160,7 @@ private
125
160
  lbl = @use_data_label ? label : @labels[index]
126
161
 
127
162
  text_renderer = Gruff::Renderer::Text.new(lbl, font: @font, size: @marker_font_size, color: @font_color)
128
- if RUBY_PLATFORM == 'java'
129
- text_renderer.render(1, 1, @graph_left - LABEL_MARGIN * 2.0, y_offset, Magick::EastGravity)
130
- else
131
- text_renderer.render(1, 1, -@graph_left + LABEL_MARGIN * 2.0, y_offset, Magick::EastGravity)
132
- end
163
+ text_renderer.add_to_render_queue(@graph_left - LABEL_MARGIN, 1.0, 0.0, y_offset, Magick::EastGravity)
133
164
  end
134
165
  end
135
166