gruff 0.19.0-java → 0.20.0-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa39c23fc44be66931c2b7f05ad88021b82a8a900ce7894eb962ddaf9ba895f3
4
- data.tar.gz: c1bbf2d54c4ad2760e66352626fc07b7b3f89ee4c8d9edcaa87270c173572c4d
3
+ metadata.gz: 0470a845dea66723f512a991696cefcec76110bc625720c9de2e06b248968dfb
4
+ data.tar.gz: d6d93d5ac547d1b588e8b936b8faf1bdbdd86b1f6b05859c62569dcc2096ddf0
5
5
  SHA512:
6
- metadata.gz: d82e25b5eefc2e5c8ead58a5e3968b5df4952066032d5fa7c80dd69516b726644c76e91d7e136389cc5c0a6899291b2ac6a4a57548116fd8c53ced4bf347d3b8
7
- data.tar.gz: 0d9e8d013c78269a606c85fbf3313302dd9048b37c3fd3eeae55894823a1754fc389073aa4381a4598511fbb31bdc1c2d56b565bc1bc2fac922b3a38261540e8
6
+ metadata.gz: d57209f9c7dc7d3739feea9d1d1cfb41afd85db57d3723a768c17f37413f689becaabba7a119f33a97ed7e4fab7a4906c8a334a8d230cee537fa164d62cd3f01
7
+ data.tar.gz: 697e7f71c16e5c8d5351144b5cd9fff0bef80a7d9f2dee100dd5e6f90daf712ca041cf8acd581830de8763b697a9c8b66b7b3ddd51df7cd40ece16fac0bc37f7
@@ -18,10 +18,10 @@ jobs:
18
18
  - uses: actions/checkout@v3
19
19
  with:
20
20
  ref: ${{ github.event.pull_request.head.sha }}
21
- - name: Set up Ruby 2.5
21
+ - name: Set up Ruby 2.6
22
22
  uses: ruby/setup-ruby@master
23
23
  with:
24
- ruby-version: '2.5'
24
+ ruby-version: '2.6'
25
25
  bundler-cache: true
26
26
  - name: Install dependencies
27
27
  run: bundle install --path=vendor/bundle --jobs 4 --retry 3
@@ -35,9 +35,9 @@ jobs:
35
35
  timeout-minutes: 20
36
36
  strategy:
37
37
  matrix:
38
- ruby-version: ['2.5', '2.6', '2.7', '3.0', '3.1']
38
+ ruby-version: ['2.6', '2.7', '3.0', '3.1', '3.2']
39
39
  imagemagick-version:
40
- - { full: 7.1.0-45, major-minor: '7.0' }
40
+ - { full: 7.1.0-55, major-minor: '7.1' }
41
41
  name: Ruby ${{ matrix.ruby-version }}
42
42
  steps:
43
43
  - uses: actions/checkout@v3
@@ -67,7 +67,7 @@ jobs:
67
67
  timeout-minutes: 20
68
68
  strategy:
69
69
  matrix:
70
- ruby-version: ['9.2.21.0', '9.3.7.0']
70
+ ruby-version: ['9.3.10.0', '9.4.2.0']
71
71
  name: JRuby ${{ matrix.ruby-version }}
72
72
  steps:
73
73
  - uses: actions/checkout@v3
data/.rubocop.yml CHANGED
@@ -1,10 +1,11 @@
1
1
  require:
2
+ - rubocop-minitest
2
3
  - rubocop-performance
3
4
  - rubocop-rake
4
5
 
5
6
  AllCops:
6
7
  EnabledByDefault: true
7
- TargetRubyVersion: 2.5
8
+ TargetRubyVersion: 2.6
8
9
  Exclude:
9
10
  - 'vendor/bundle/**/*'
10
11
  - 'rails_generators/gruff/**/*'
@@ -12,6 +13,12 @@ AllCops:
12
13
  Metrics:
13
14
  Enabled: false
14
15
 
16
+ Gemspec/DependencyVersion:
17
+ Enabled: false
18
+
19
+ Gemspec/DevelopmentDependencies:
20
+ Enabled: false
21
+
15
22
  Gemspec/OrderedDependencies:
16
23
  Enabled: false
17
24
 
@@ -21,6 +28,9 @@ Gemspec/RequiredRubyVersion:
21
28
  Layout/AccessModifierIndentation:
22
29
  EnforcedStyle: outdent
23
30
 
31
+ Layout/ClassStructure:
32
+ Enabled: false
33
+
24
34
  Layout/FirstMethodArgumentLineBreak:
25
35
  Enabled: false
26
36
 
@@ -111,11 +121,17 @@ Style/OptionHash:
111
121
  Style/RedundantBegin:
112
122
  Enabled: false
113
123
 
124
+ Style/RequireOrder:
125
+ Enabled: false
126
+
114
127
  Style/SingleLineBlockParams:
115
128
  Enabled: false
116
129
 
117
130
  Style/StructInheritance:
118
131
  Enabled: false
119
132
 
133
+ Style/YodaExpression:
134
+ Enabled: false
135
+
120
136
  Performance/ChainArrayAllocation:
121
137
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.20.0
4
+ - Fix legend position when blank labels present (#614)
5
+ - Fixed NoMethodError (undefined method `format=' for Gruff::Line (#612)
6
+ - Drop Ruby 2.5 support (#611)
7
+ - Fix deprecation warning for Base#to_blob (#610)
8
+
3
9
  ## 0.19.0
4
10
  - Draw the graph starting from zero point by default (#609)
5
11
  - Improve joints in Gruff::Net using polyline method (#608)
data/gruff.gemspec CHANGED
@@ -23,12 +23,13 @@ Gem::Specification.new do |s|
23
23
  s.add_dependency 'rmagick4j'
24
24
  else
25
25
  s.add_dependency 'rmagick', '>= 4.2'
26
- s.add_development_dependency 'rubocop', '~> 1.28.2'
27
- s.add_development_dependency 'rubocop-performance', '~> 1.13.3'
26
+ s.add_development_dependency 'rubocop', '~> 1.50.2'
27
+ s.add_development_dependency 'rubocop-minitest', '~> 0.30.0'
28
+ s.add_development_dependency 'rubocop-performance', '~> 1.17.1'
28
29
  s.add_development_dependency 'rubocop-rake', '~> 0.6.0'
29
30
  end
30
31
  s.add_dependency 'histogram'
31
- s.required_ruby_version = '>= 2.5.0'
32
+ s.required_ruby_version = '>= 2.6.0'
32
33
 
33
34
  s.add_development_dependency 'rake'
34
35
  s.add_development_dependency 'minitest-reporters'
data/lib/gruff/bar.rb CHANGED
@@ -48,7 +48,7 @@ class Gruff::Bar < Gruff::Base
48
48
  #
49
49
  # Default value is +0.9+.
50
50
  def spacing_factor=(space_percent)
51
- raise ArgumentError, 'spacing_factor must be between 0.00 and 1.00' unless (space_percent >= 0) && (space_percent <= 1)
51
+ raise ArgumentError, 'spacing_factor must be between 0.00 and 1.00' if (space_percent < 0) || (space_percent > 1)
52
52
 
53
53
  @spacing_factor = (1 - space_percent)
54
54
  end
data/lib/gruff/base.rb CHANGED
@@ -218,7 +218,7 @@ module Gruff
218
218
  # g.labels = ['2005', nil, nil, '2006', nil, nil, '2007', nil, nil, '2008'] # same labels for columns
219
219
  def labels=(labels)
220
220
  if labels.is_a?(Array)
221
- labels = labels.each_with_index.each_with_object({}) do |(label, index), hash|
221
+ labels = labels.each_with_index.with_object({}) do |(label, index), hash|
222
222
  hash[index] = label
223
223
  end
224
224
  end
@@ -522,9 +522,8 @@ module Gruff
522
522
  # @deprecated Please use +to_image.to_blob+ instead.
523
523
  def to_blob(image_format = 'PNG')
524
524
  warn '#to_blob is deprecated. Please use `to_image.to_blob` instead'
525
- to_image.to_blob do
526
- self.format = image_format
527
- end
525
+ to_image.format = image_format
526
+ to_image.to_blob
528
527
  end
529
528
 
530
529
  # Draw a graph.
@@ -822,7 +821,7 @@ module Gruff
822
821
  end
823
822
 
824
823
  def clip_value_if_greater_than(value, max_value)
825
- value > max_value ? max_value : value
824
+ [value, max_value].min
826
825
  end
827
826
 
828
827
  def significant(i)
@@ -908,7 +907,7 @@ module Gruff
908
907
  bottom_label_width = extra_left_room_for_long_label
909
908
 
910
909
  margin = line_number_width + y_axis_label_width
911
- @left_margin + (margin > bottom_label_width ? margin : bottom_label_width)
910
+ @left_margin + [margin, bottom_label_width].max
912
911
  end
913
912
 
914
913
  def setup_right_margin
@@ -1036,7 +1035,7 @@ module Gruff
1036
1035
  def calculate_legend_label_widths_for_each_line(legend_labels, legend_square_width)
1037
1036
  label_widths = [[]]
1038
1037
  label_lines = [[]]
1039
- legend_labels.each do |label|
1038
+ legend_labels.reject(&:empty?).each do |label|
1040
1039
  width = calculate_width(@legend_font, label)
1041
1040
  label_width = width + (legend_square_width * 2.7)
1042
1041
  label_widths.last.push label_width
@@ -1130,7 +1129,7 @@ module Gruff
1130
1129
  -(width / 2.0)
1131
1130
  end
1132
1131
  end
1133
- y_offset = (height / 2.0) > margin ? (height / 2.0) : margin
1132
+ y_offset = [(height / 2.0), margin].max
1134
1133
 
1135
1134
  [x_offset, y_offset]
1136
1135
  end
data/lib/gruff/box.rb CHANGED
@@ -23,7 +23,7 @@ class Gruff::Box < Gruff::Base
23
23
  #
24
24
  # Default value is +0.8+.
25
25
  def spacing_factor=(space_percent)
26
- raise ArgumentError, 'spacing_factor must be between 0.00 and 1.00' unless (space_percent >= 0) && (space_percent <= 1)
26
+ raise ArgumentError, 'spacing_factor must be between 0.00 and 1.00' if (space_percent < 0) || (space_percent > 1)
27
27
 
28
28
  @spacing_factor = (1 - space_percent)
29
29
  end
@@ -134,7 +134,7 @@ private
134
134
  end
135
135
 
136
136
  def median
137
- if points.size.zero?
137
+ if points.empty?
138
138
  0
139
139
  elsif points.size.odd?
140
140
  points[points.size / 2]
@@ -144,7 +144,7 @@ private
144
144
  end
145
145
 
146
146
  def first_quartile
147
- if points.size.zero?
147
+ if points.empty?
148
148
  0
149
149
  elsif points.size.odd?
150
150
  points[points.size / 4]
@@ -154,7 +154,7 @@ private
154
154
  end
155
155
 
156
156
  def third_quartile
157
- if points.size.zero?
157
+ if points.empty?
158
158
  0
159
159
  elsif points.size.odd?
160
160
  points[(points.size * 3) / 4]
@@ -33,7 +33,7 @@ class Gruff::Candlestick < Gruff::Base
33
33
  #
34
34
  # Default value is +0.9+.
35
35
  def spacing_factor=(space_percent)
36
- raise ArgumentError, 'spacing_factor must be between 0.00 and 1.00' unless (space_percent >= 0) && (space_percent <= 1)
36
+ raise ArgumentError, 'spacing_factor must be between 0.00 and 1.00' if (space_percent < 0) || (space_percent > 1)
37
37
 
38
38
  @spacing_factor = (1 - space_percent)
39
39
  end
@@ -90,10 +90,10 @@ private
90
90
  Gruff::Renderer::Rectangle.new(renderer, color: color, opacity: @fill_opacity, width: @stroke_width).render(left_x, open_y, right_x, close_y)
91
91
 
92
92
  low_y, = conversion.get_top_bottom_scaled(candlestick.low)
93
- y = open_y < close_y ? close_y : open_y
93
+ y = [open_y, close_y].max
94
94
  Gruff::Renderer::Line.new(renderer, color: color, width: @stroke_width).render(center_x, low_y, center_x, y)
95
95
  high_y, = conversion.get_top_bottom_scaled(candlestick.high)
96
- y = open_y > close_y ? close_y : open_y
96
+ y = [open_y, close_y].min
97
97
  Gruff::Renderer::Line.new(renderer, color: color, width: @stroke_width).render(center_x, y, center_x, high_y)
98
98
  end
99
99
  end
@@ -12,36 +12,31 @@
12
12
  # g.data :Science, [2, 15, 8, 11]
13
13
  # g.write('mini_bar.png')
14
14
  #
15
- module Gruff
16
- module Mini
17
- # A class for drawing a small bar graph.
18
- class Bar < Gruff::Bar
19
- private
15
+ class Gruff::Mini::Bar < Gruff::Bar
16
+ private
20
17
 
21
- include Gruff::Mini::Legend
18
+ include Gruff::Mini::Legend
22
19
 
23
- def initialize_attributes
24
- super
20
+ def initialize_attributes
21
+ super
25
22
 
26
- @hide_legend = true
27
- @hide_title = true
28
- @hide_line_numbers = true
23
+ @hide_legend = true
24
+ @hide_title = true
25
+ @hide_line_numbers = true
29
26
 
30
- @marker_font.size = 50.0
31
- @legend_font.size = 50.0
27
+ @marker_font.size = 50.0
28
+ @legend_font.size = 50.0
32
29
 
33
- @minimum_value = 0.0
34
- end
30
+ @minimum_value = 0.0
31
+ end
35
32
 
36
- def setup_data
37
- expand_canvas_for_vertical_legend
38
- super
39
- end
33
+ def setup_data
34
+ expand_canvas_for_vertical_legend
35
+ super
36
+ end
40
37
 
41
- def draw_graph
42
- super
43
- draw_vertical_legend
44
- end
45
- end
38
+ def draw_graph
39
+ super
40
+ draw_vertical_legend
46
41
  end
47
42
  end
@@ -1,110 +1,98 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Gruff
4
- module Mini
5
- # A module to handle the small legend.
6
- # @private
7
- module Legend
8
- attr_accessor :hide_mini_legend, :legend_position
9
-
10
- def initialize(*)
11
- @hide_mini_legend = false
12
- @legend_position = nil
13
- super
14
- end
15
-
16
- ##
17
- # The canvas needs to be bigger so we can put the legend beneath it.
18
-
19
- def expand_canvas_for_vertical_legend
20
- return if @hide_mini_legend
21
-
22
- @legend_labels = store.data.map(&:label)
23
-
24
- legend_height = scale((store.length * calculate_line_height) + @top_margin + @bottom_margin)
25
-
26
- @original_rows = @raw_rows
27
- @original_columns = @raw_columns
28
-
29
- case @legend_position
30
- when :right
31
- @rows = [@rows, legend_height].max
32
- @columns += calculate_legend_width + @left_margin
33
- else
34
- font = @legend_font.dup
35
- font.size = scale(font.size)
36
- @rows += store.length * calculate_caps_height(font) * 1.7
37
- end
38
-
39
- @renderer = Gruff::Renderer.new(@columns, @rows, @scale, @theme_options)
40
- end
41
-
42
- def calculate_line_height
43
- calculate_caps_height(@legend_font) * 1.7
44
- end
45
-
46
- def calculate_legend_width
47
- width = @legend_labels.map { |label| calculate_width(@legend_font, label) }.max
48
- scale(width + (40 * 1.7))
49
- end
50
-
51
- ##
52
- # Draw the legend beneath the existing graph.
53
-
54
- def draw_vertical_legend
55
- return if @hide_mini_legend
56
-
57
- legend_square_width = 40.0 # small square with color of this item
58
- @legend_left_margin = 100.0
59
- legend_top_margin = 40.0
60
-
61
- case @legend_position
62
- when :right
63
- current_x_offset = @original_columns + @left_margin
64
- current_y_offset = @top_margin + legend_top_margin
65
- else
66
- current_x_offset = @legend_left_margin
67
- current_y_offset = @original_rows + legend_top_margin
68
- end
69
-
70
- @legend_labels.each_with_index do |legend_label, index|
71
- # Draw label
72
- x_offset = current_x_offset + (legend_square_width * 1.7)
73
- label = truncate_legend_label(legend_label, x_offset)
74
- text_renderer = Gruff::Renderer::Text.new(renderer, label, font: @legend_font)
75
- text_renderer.add_to_render_queue(@raw_columns, 1.0, x_offset, current_y_offset, Magick::WestGravity)
76
-
77
- # Now draw box with color of this dataset
78
- rect_renderer = Gruff::Renderer::Rectangle.new(renderer, color: store.data[index].color)
79
- rect_renderer.render(current_x_offset,
80
- current_y_offset - (legend_square_width / 2.0),
81
- current_x_offset + legend_square_width,
82
- current_y_offset + (legend_square_width / 2.0))
83
-
84
- current_y_offset += calculate_line_height
85
- end
86
- end
87
-
88
- ##
89
- # Shorten long labels so they will fit on the canvas.
90
- #
91
- # Department of Hu...
92
-
93
- def truncate_legend_label(label, x_offset)
94
- truncated_label = label.to_s
95
-
96
- font = @legend_font.dup
97
- font.size = scale(font.size)
98
- max_width = @columns - scale(x_offset) - @right_margin
99
- while calculate_width(font, "#{truncated_label}...") > max_width && truncated_label.length > 1
100
- truncated_label = truncated_label[0..truncated_label.length - 2]
101
- end
102
- truncated_label + (truncated_label.length < label.to_s.length ? '...' : '')
103
- end
104
-
105
- def scale(value)
106
- value * @scale
107
- end
3
+ # A module to handle the small legend.
4
+ # @private
5
+ module Gruff::Mini::Legend
6
+ attr_accessor :hide_mini_legend, :legend_position
7
+
8
+ def initialize(*)
9
+ @hide_mini_legend = false
10
+ @legend_position = nil
11
+ super
12
+ end
13
+
14
+ # The canvas needs to be bigger so we can put the legend beneath it.
15
+ def expand_canvas_for_vertical_legend
16
+ return if @hide_mini_legend
17
+
18
+ @legend_labels = store.data.map(&:label)
19
+
20
+ legend_height = scale((store.length * calculate_line_height) + @top_margin + @bottom_margin)
21
+
22
+ @original_rows = @raw_rows
23
+ @original_columns = @raw_columns
24
+
25
+ case @legend_position
26
+ when :right
27
+ @rows = [@rows, legend_height].max
28
+ @columns += calculate_legend_width + @left_margin
29
+ else
30
+ font = @legend_font.dup
31
+ font.size = scale(font.size)
32
+ @rows += store.length * calculate_caps_height(font) * 1.7
33
+ end
34
+
35
+ @renderer = Gruff::Renderer.new(@columns, @rows, @scale, @theme_options)
36
+ end
37
+
38
+ def calculate_line_height
39
+ calculate_caps_height(@legend_font) * 1.7
40
+ end
41
+
42
+ def calculate_legend_width
43
+ width = @legend_labels.map { |label| calculate_width(@legend_font, label) }.max
44
+ scale(width + (40 * 1.7))
45
+ end
46
+
47
+ # Draw the legend beneath the existing graph.
48
+ def draw_vertical_legend
49
+ return if @hide_mini_legend
50
+
51
+ legend_square_width = 40.0 # small square with color of this item
52
+ @legend_left_margin = 100.0
53
+ legend_top_margin = 40.0
54
+
55
+ case @legend_position
56
+ when :right
57
+ current_x_offset = @original_columns + @left_margin
58
+ current_y_offset = @top_margin + legend_top_margin
59
+ else
60
+ current_x_offset = @legend_left_margin
61
+ current_y_offset = @original_rows + legend_top_margin
108
62
  end
63
+
64
+ @legend_labels.each_with_index do |legend_label, index|
65
+ # Draw label
66
+ x_offset = current_x_offset + (legend_square_width * 1.7)
67
+ label = truncate_legend_label(legend_label, x_offset)
68
+ text_renderer = Gruff::Renderer::Text.new(renderer, label, font: @legend_font)
69
+ text_renderer.add_to_render_queue(@raw_columns, 1.0, x_offset, current_y_offset, Magick::WestGravity)
70
+
71
+ # Now draw box with color of this dataset
72
+ rect_renderer = Gruff::Renderer::Rectangle.new(renderer, color: store.data[index].color)
73
+ rect_renderer.render(current_x_offset,
74
+ current_y_offset - (legend_square_width / 2.0),
75
+ current_x_offset + legend_square_width,
76
+ current_y_offset + (legend_square_width / 2.0))
77
+
78
+ current_y_offset += calculate_line_height
79
+ end
80
+ end
81
+
82
+ # Shorten long labels so they will fit on the canvas.
83
+ def truncate_legend_label(label, x_offset)
84
+ truncated_label = label.to_s
85
+
86
+ font = @legend_font.dup
87
+ font.size = scale(font.size)
88
+ max_width = @columns - scale(x_offset) - @right_margin
89
+ while calculate_width(font, "#{truncated_label}...") > max_width && truncated_label.length > 1
90
+ truncated_label = truncated_label[0..truncated_label.length - 2]
91
+ end
92
+ truncated_label + (truncated_label.length < label.to_s.length ? '...' : '')
93
+ end
94
+
95
+ def scale(value)
96
+ value * @scale
109
97
  end
110
98
  end
@@ -11,34 +11,29 @@
11
11
  # g.data 'Hamburgers', 50
12
12
  # g.write("mini_pie_keynote.png")
13
13
  #
14
- module Gruff
15
- module Mini
16
- # A class for drawing a small pie graph.
17
- class Pie < Gruff::Pie
18
- private
14
+ class Gruff::Mini::Pie < Gruff::Pie
15
+ private
19
16
 
20
- include Gruff::Mini::Legend
17
+ include Gruff::Mini::Legend
21
18
 
22
- def initialize_attributes
23
- super
19
+ def initialize_attributes
20
+ super
24
21
 
25
- @hide_legend = true
26
- @hide_title = true
27
- @hide_line_numbers = true
22
+ @hide_legend = true
23
+ @hide_title = true
24
+ @hide_line_numbers = true
28
25
 
29
- @marker_font.size = 50.0
30
- @legend_font.size = 50.0
31
- end
26
+ @marker_font.size = 50.0
27
+ @legend_font.size = 50.0
28
+ end
32
29
 
33
- def setup_data
34
- expand_canvas_for_vertical_legend
35
- super
36
- end
30
+ def setup_data
31
+ expand_canvas_for_vertical_legend
32
+ super
33
+ end
37
34
 
38
- def draw_graph
39
- super
40
- draw_vertical_legend
41
- end
42
- end
35
+ def draw_graph
36
+ super
37
+ draw_vertical_legend
43
38
  end
44
39
  end
@@ -19,33 +19,28 @@
19
19
  # g.data :Science, [2, 15, 8, 11]
20
20
  # g.write('mini_sidebar.png')
21
21
  #
22
- module Gruff
23
- module Mini
24
- # A class for drawing a small side bar graph.
25
- class SideBar < Gruff::SideBar
26
- private
22
+ class Gruff::Mini::SideBar < Gruff::SideBar
23
+ private
27
24
 
28
- include Gruff::Mini::Legend
25
+ include Gruff::Mini::Legend
29
26
 
30
- def initialize_attributes
31
- super
32
- @hide_legend = true
33
- @hide_title = true
34
- @hide_line_numbers = true
27
+ def initialize_attributes
28
+ super
29
+ @hide_legend = true
30
+ @hide_title = true
31
+ @hide_line_numbers = true
35
32
 
36
- @marker_font.size = 50.0
37
- @legend_font.size = 50.0
38
- end
33
+ @marker_font.size = 50.0
34
+ @legend_font.size = 50.0
35
+ end
39
36
 
40
- def setup_data
41
- expand_canvas_for_vertical_legend
42
- super
43
- end
37
+ def setup_data
38
+ expand_canvas_for_vertical_legend
39
+ super
40
+ end
44
41
 
45
- def draw_graph
46
- super
47
- draw_vertical_legend
48
- end
49
- end
42
+ def draw_graph
43
+ super
44
+ draw_vertical_legend
50
45
  end
51
46
  end
@@ -7,8 +7,8 @@ module Magick
7
7
  refine Draw do
8
8
  # Additional method to scale annotation text since Draw.scale doesn't.
9
9
  def annotate_scaled(img, width, height, x, y, text, scale)
10
- scaled_width = (width * scale) >= 1 ? (width * scale) : 1
11
- scaled_height = (height * scale) >= 1 ? (height * scale) : 1
10
+ scaled_width = [(width * scale), 1].max
11
+ scaled_height = [(height * scale), 1].max
12
12
 
13
13
  annotate(img,
14
14
  scaled_width, scaled_height,
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.19.0'
4
+ VERSION = '0.20.0'
5
5
  end
data/lib/gruff.rb CHANGED
@@ -45,6 +45,7 @@ module Gruff
45
45
  autoload :Layer, Gruff.libpath('scene')
46
46
  autoload :Themes, Gruff.libpath('themes')
47
47
 
48
+ # @private
48
49
  class Renderer
49
50
  autoload :Bezier, Gruff.libpath('renderer/bezier')
50
51
  autoload :Circle, Gruff.libpath('renderer/circle')
@@ -58,12 +59,14 @@ module Gruff
58
59
  autoload :Text, Gruff.libpath('renderer/text')
59
60
  end
60
61
 
62
+ # @private
61
63
  class Store
62
64
  autoload :BasicData, Gruff.libpath('store/basic_data')
63
65
  autoload :XYData, Gruff.libpath('store/xy_data')
64
66
  autoload :XYPointsizeData, Gruff.libpath('store/xy_pointsizes_data')
65
67
  end
66
68
 
69
+ # A module for small graphs
67
70
  module Mini
68
71
  autoload :Bar, Gruff.libpath('mini/bar')
69
72
  autoload :Legend, Gruff.libpath('mini/legend')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gruff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.0
4
+ version: 0.20.0
5
5
  platform: java
6
6
  authors:
7
7
  - Geoffrey Grosenbach
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-08-21 00:00:00.000000000 Z
12
+ date: 2023-06-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: !ruby/object:Gem::Requirement
@@ -183,14 +183,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
183
183
  requirements:
184
184
  - - ">="
185
185
  - !ruby/object:Gem::Version
186
- version: 2.5.0
186
+ version: 2.6.0
187
187
  required_rubygems_version: !ruby/object:Gem::Requirement
188
188
  requirements:
189
189
  - - ">="
190
190
  - !ruby/object:Gem::Version
191
191
  version: '0'
192
192
  requirements: []
193
- rubygems_version: 3.2.29
193
+ rubygems_version: 3.3.25
194
194
  signing_key:
195
195
  specification_version: 4
196
196
  summary: Beautiful graphs for one or multiple datasets.