gruff 0.27.1 → 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: 295e6f1b645cfad9f63a1cc0759f4ee57d84663c5d2317cfe2c5aba41e3bd6bc
4
- data.tar.gz: f3fc8b6c4a914c7a276aa0df08a90facf2be398ba0ac321d4c812ea4d7706f15
3
+ metadata.gz: 26b395dec8d012e9a7cee4013081d689b7decd86aeda0dc1ffd8fc66c6e71db6
4
+ data.tar.gz: 6cc57c03116dff4ba0a0c6e8adb0f36d247431bba05e292bb6d422a8b9d1b1c5
5
5
  SHA512:
6
- metadata.gz: c6763d1b4995818e9340c56a63fc5af6aa79c844b4d6518d61310095eed759ae4099dcf7538e88ec3ca0fc7ab4a32b1321b7425e692253e461b4076cb54af77c
7
- data.tar.gz: e87a0bf90f66eb77035f330df3f12d56d7d9bb393c1fe4fdf3a0745437e90e08752baa58a1170727b59a287c560d4dc03d18dc0db505d6987a5d7637dc15b5d6
6
+ metadata.gz: 7b155ccb54f177475c81c1176401fd95147152300e48da0c96951d8767bf8b861cbc7a4f2e27da32e727cb64e1f9fe31b5fa7a8bee49d2747e0a3e883a72a636
7
+ data.tar.gz: c2ec8dd6104836dfa234a8300c0e1ba40e212b2faac3c77ec504fd9db7d01408a75bbe486a487a3744965c54487c114961f5c58f79ca66c8e974b3dd4b135d05
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.28.0
4
+
5
+ - Fix Gruff::Line to prevent unknown lines drawing (#664)
6
+
3
7
  ## 0.27.1
4
8
 
5
9
  - RBS: Fix wrong type declarations (#662)
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/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
  # rbs_inline: enabled
4
4
 
5
5
  module Gruff
6
- VERSION = '0.27.1'
6
+ VERSION = '0.28.0'
7
7
  end
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.1
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: []