gruff 0.27.0 → 0.28.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6da763173e4c2d9acfb25a240f68edc12c49bd2d35a835ea52b4306f727b5aa
4
- data.tar.gz: 7ce9635d6efacb40300c959db94f40fcd09205491c33e8bbac3269e64b1f9048
3
+ metadata.gz: 26b395dec8d012e9a7cee4013081d689b7decd86aeda0dc1ffd8fc66c6e71db6
4
+ data.tar.gz: 6cc57c03116dff4ba0a0c6e8adb0f36d247431bba05e292bb6d422a8b9d1b1c5
5
5
  SHA512:
6
- metadata.gz: 736e2cfb7ecadcd212a0ac92c78a84ff1e69184c440e2a5dc2b9b465f5bbbc25cd6f84215def0306e2b9d27039c939c6f54a3f6b302b7b164b4e48c03e3917b3
7
- data.tar.gz: 45a7508c2722f357b95578aa9a4b1d68576caa3c662b35c6cde983be258835d485ff5ee32f7f525a3791d6e3c3971e332eee9bbc0c79318f29b6ae92b866cfd9
6
+ metadata.gz: 7b155ccb54f177475c81c1176401fd95147152300e48da0c96951d8767bf8b861cbc7a4f2e27da32e727cb64e1f9fe31b5fa7a8bee49d2747e0a3e883a72a636
7
+ data.tar.gz: c2ec8dd6104836dfa234a8300c0e1ba40e212b2faac3c77ec504fd9db7d01408a75bbe486a487a3744965c54487c114961f5c58f79ca66c8e974b3dd4b135d05
@@ -15,7 +15,7 @@ jobs:
15
15
  timeout-minutes: 20
16
16
  strategy:
17
17
  matrix:
18
- ruby-version: ['3.0']
18
+ ruby-version: ['3.4']
19
19
  imagemagick-version:
20
20
  - { full: 7.1.1-33, major-minor: '7.1' }
21
21
  name: Lint (Ruby ${{ matrix.ruby-version }}, ImageMagick ${{ matrix.imagemagick-version.major-minor }})
data/.rubocop.yml CHANGED
@@ -2,6 +2,7 @@ plugins:
2
2
  - rubocop-minitest
3
3
  - rubocop-performance
4
4
  - rubocop-rake
5
+ - rubocop-rbs_inline
5
6
 
6
7
  AllCops:
7
8
  EnabledByDefault: true
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.28.0
4
+
5
+ - Fix Gruff::Line to prevent unknown lines drawing (#664)
6
+
7
+ ## 0.27.1
8
+
9
+ - RBS: Fix wrong type declarations (#662)
10
+
3
11
  ## 0.27.0
4
12
 
5
13
  - Add RBS signatures (#661)
data/Gemfile CHANGED
@@ -19,5 +19,6 @@ gem 'yard', '~> 0.9.28'
19
19
 
20
20
  if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1') && !RUBY_PLATFORM.include?('java')
21
21
  gem 'rbs-inline', '~> 0.11'
22
+ gem 'rubocop-rbs_inline', '~> 1.4'
22
23
  gem 'steep', '~> 1.10'
23
24
  end
data/lib/gruff/base.rb CHANGED
@@ -855,7 +855,7 @@ module Gruff
855
855
  end
856
856
 
857
857
  # @rbs index: Integer
858
- # @rbs &: () -> void
858
+ # @rbs yields: () -> void
859
859
  def draw_unique_label(index)
860
860
  return if hide_labels?
861
861
 
@@ -44,7 +44,7 @@ module Gruff::BarValueLabel
44
44
  class Bar < Base
45
45
  # @rbs format: nil | String | Proc
46
46
  # @rbs proc_text_metrics: Proc
47
- # @rbs &: (Float | Integer, Float | Integer, String, Float, Float) -> void
47
+ # @rbs yields: (Float | Integer, Float | Integer, String, Float, Float) -> void
48
48
  def prepare_rendering(format, proc_text_metrics)
49
49
  left_x, left_y, _right_x, _right_y = @coordinate
50
50
  val, metrics = Gruff::BarValueLabel.metrics(@value, format, proc_text_metrics)
@@ -58,7 +58,7 @@ module Gruff::BarValueLabel
58
58
  class SideBar < Base
59
59
  # @rbs format: nil | String | Proc
60
60
  # @rbs proc_text_metrics: Proc
61
- # @rbs &: (Float | Integer, Float | Integer, String, Float, Float) -> void
61
+ # @rbs yields: (Float | Integer, Float | Integer, String, Float, Float) -> void
62
62
  def prepare_rendering(format, proc_text_metrics)
63
63
  left_x, left_y, right_x, _right_y = @coordinate
64
64
  val, metrics = Gruff::BarValueLabel.metrics(@value, format, proc_text_metrics)
data/lib/gruff/line.rb CHANGED
@@ -229,13 +229,10 @@ private
229
229
 
230
230
  stroke_width = @line_width || clip_value_if_greater_than(@columns / (store.norm_data.first.y_points.size * 4.0), 5.0)
231
231
  circle_radius = @dot_radius || clip_value_if_greater_than(@columns / (store.norm_data.first.y_points.size * 2.5), 5.0)
232
+ prev_x = prev_y = nil
232
233
 
233
234
  store.norm_data.each do |data_row|
234
- poly_points_group = [[]]
235
-
236
235
  data_row.coordinates.each_with_index do |(x_data, y_data), index|
237
- poly_points = poly_points_group.last
238
-
239
236
  new_x = begin
240
237
  if x_data.nil?
241
238
  # use the old method: equally spaced points along the x-axis
@@ -249,24 +246,24 @@ private
249
246
  unless y_data
250
247
  # we can't draw a line for a null data point, we can still label the axis though.
251
248
  # Split the polygonal line into separate groups of points for polyline.
252
- poly_points_group << []
249
+ prev_x = prev_y = nil
253
250
  next
254
251
  end
255
252
 
256
253
  new_y = @graph_top + (@graph_height - (y_data * @graph_height))
257
254
 
258
- poly_points << new_x
259
- poly_points << new_y
260
-
261
255
  if contains_one_point_only?(data_row) || !@hide_dots
262
256
  Gruff::Renderer::Dot.new(renderer, @dot_style, color: data_row.color, width: stroke_width).render(new_x, new_y, circle_radius)
263
257
  end
264
- end
265
-
266
- unless @hide_lines
267
- poly_points_group.each do |poly_points|
268
- Gruff::Renderer::Polyline.new(renderer, color: data_row.color, width: stroke_width).render(poly_points) unless poly_points.empty?
258
+ if !@hide_lines && prev_x && prev_y
259
+ # Renderer::Polyline may cause unknown lines to be drawn with complex graphs.
260
+ # Probably it is related to ImageMagick behavior.
261
+ # To avoid this problem, we use the Renderer::Line instead.
262
+ Gruff::Renderer::Line.new(renderer, color: data_row.color, width: stroke_width)
263
+ .render(prev_x, prev_y, new_x, new_y)
269
264
  end
265
+ prev_x = new_x
266
+ prev_y = new_y
270
267
  end
271
268
  end
272
269
  end
data/lib/gruff/pie.rb CHANGED
@@ -92,7 +92,7 @@ private
92
92
 
93
93
  # General Helper Methods
94
94
 
95
- # @rbs degree: Float | Integer
95
+ # @rbs degrees: Float | Integer
96
96
  def update_chart_degrees_with(degrees)
97
97
  @chart_degrees = chart_degrees + degrees
98
98
  end
data/lib/gruff/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
  # rbs_inline: enabled
4
4
 
5
5
  module Gruff
6
- VERSION = '0.27.0'
6
+ VERSION = '0.28.0'
7
7
  end
@@ -492,8 +492,8 @@ module Gruff
492
492
  def draw_label: (Float | Integer x, Integer index, ?untyped gravity) { () -> void } -> untyped
493
493
 
494
494
  # @rbs index: Integer
495
- # @rbs &: () -> void
496
- def draw_unique_label: (Integer index) { () -> void } -> untyped
495
+ # @rbs yields: () -> void
496
+ def draw_unique_label: (Integer index) -> untyped
497
497
 
498
498
  # @rbs width: Float | Integer
499
499
  # @rbs height: Float | Integer
@@ -27,15 +27,15 @@ module Gruff::BarValueLabel
27
27
  class Bar < Base
28
28
  # @rbs format: nil | String | Proc
29
29
  # @rbs proc_text_metrics: Proc
30
- # @rbs &: (Float | Integer, Float | Integer, String, Float, Float) -> void
31
- def prepare_rendering: (nil | String | Proc format, Proc proc_text_metrics) { (Float | Integer, Float | Integer, String, Float, Float) -> void } -> untyped
30
+ # @rbs yields: (Float | Integer, Float | Integer, String, Float, Float) -> void
31
+ def prepare_rendering: (nil | String | Proc format, Proc proc_text_metrics) -> untyped
32
32
  end
33
33
 
34
34
  # @private
35
35
  class SideBar < Base
36
36
  # @rbs format: nil | String | Proc
37
37
  # @rbs proc_text_metrics: Proc
38
- # @rbs &: (Float | Integer, Float | Integer, String, Float, Float) -> void
39
- def prepare_rendering: (nil | String | Proc format, Proc proc_text_metrics) { (Float | Integer, Float | Integer, String, Float, Float) -> void } -> untyped
38
+ # @rbs yields: (Float | Integer, Float | Integer, String, Float, Float) -> void
39
+ def prepare_rendering: (nil | String | Proc format, Proc proc_text_metrics) -> untyped
40
40
  end
41
41
  end
@@ -50,8 +50,8 @@ class Gruff::Pie < Gruff::Base
50
50
 
51
51
  def slices: () -> untyped
52
52
 
53
- # @rbs degree: Float | Integer
54
- def update_chart_degrees_with: (untyped degrees) -> untyped
53
+ # @rbs degrees: Float | Integer
54
+ def update_chart_degrees_with: (Float | Integer degrees) -> untyped
55
55
 
56
56
  # @rbs return: Float | Integer
57
57
  def chart_degrees: () -> (Float | Integer)
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.27.0
4
+ version: 0.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geoffrey Grosenbach
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  - !ruby/object:Gem::Version
192
192
  version: '0'
193
193
  requirements: []
194
- rubygems_version: 3.6.7
194
+ rubygems_version: 3.7.0
195
195
  specification_version: 4
196
196
  summary: Beautiful graphs for one or multiple datasets.
197
197
  test_files: []