gruff 0.23.0-java → 0.24.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +8 -8
- data/CHANGELOG.md +6 -0
- data/lib/gruff/base.rb +20 -6
- data/lib/gruff/dot.rb +22 -1
- data/lib/gruff/renderer/renderer.rb +3 -1
- data/lib/gruff/side_bar.rb +2 -1
- data/lib/gruff/spider.rb +0 -4
- data/lib/gruff/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ef07020e21d2f77bf04e8c90d0990bbd00a64bb5e44fbceb8d485f255d8f3ce
|
4
|
+
data.tar.gz: e6073f86bff07eb0b02045ff8da1c2f5937efee11f6574667091cd8fc21f5767
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b919327dfe6fb6b1a7ab52a262b12768e7c759d3d73e1b58e25a580f3e19241f3e983fca931917950352a6bc53a2d45f53a0c9438ca7302794b6c389d481c961
|
7
|
+
data.tar.gz: 6d99017cb356942f66cae454d364ce059a2abc32e79ff7aba0ceb03e4f5335ce3b885188e4ee18cc26639ca409a049afc325e58469a47429656e0e6e18f876ec
|
data/.github/workflows/ci.yml
CHANGED
@@ -15,7 +15,7 @@ jobs:
|
|
15
15
|
timeout-minutes: 20
|
16
16
|
name: Lint
|
17
17
|
steps:
|
18
|
-
- uses: actions/checkout@
|
18
|
+
- uses: actions/checkout@v4
|
19
19
|
with:
|
20
20
|
ref: ${{ github.event.pull_request.head.sha }}
|
21
21
|
- name: Set up Ruby 2.6
|
@@ -26,7 +26,7 @@ jobs:
|
|
26
26
|
- name: Install dependencies
|
27
27
|
run: bundle install --path=vendor/bundle --jobs 4 --retry 3
|
28
28
|
- name: RuboCop Problem Matchers
|
29
|
-
uses: r7kamura/rubocop-problem-matchers-action@v1
|
29
|
+
uses: r7kamura/rubocop-problem-matchers-action@v1
|
30
30
|
- name: Run tests
|
31
31
|
run: bundle exec rubocop
|
32
32
|
|
@@ -35,14 +35,14 @@ jobs:
|
|
35
35
|
timeout-minutes: 20
|
36
36
|
strategy:
|
37
37
|
matrix:
|
38
|
-
ruby-version: ['2.6', '2.7', '3.0', '3.1', '3.2']
|
38
|
+
ruby-version: ['2.6', '2.7', '3.0', '3.1', '3.2', '3.3']
|
39
39
|
imagemagick-version:
|
40
|
-
- { full: 7.1.
|
40
|
+
- { full: 7.1.1-15, major-minor: '7.1' }
|
41
41
|
name: Ruby ${{ matrix.ruby-version }}
|
42
42
|
steps:
|
43
|
-
- uses: actions/checkout@
|
43
|
+
- uses: actions/checkout@v4
|
44
44
|
- name: Cache ImageMagick
|
45
|
-
uses: actions/cache@
|
45
|
+
uses: actions/cache@v4
|
46
46
|
with:
|
47
47
|
path: ./build-ImageMagick
|
48
48
|
key: v1-linux-imagemagick-${{ matrix.imagemagick-version.full }}
|
@@ -67,10 +67,10 @@ jobs:
|
|
67
67
|
timeout-minutes: 20
|
68
68
|
strategy:
|
69
69
|
matrix:
|
70
|
-
ruby-version: ['9.3.10.0', '9.4.
|
70
|
+
ruby-version: ['9.3.10.0', '9.4.3.0']
|
71
71
|
name: JRuby ${{ matrix.ruby-version }}
|
72
72
|
steps:
|
73
|
-
- uses: actions/checkout@
|
73
|
+
- uses: actions/checkout@v4
|
74
74
|
- name: Set up Ruby
|
75
75
|
uses: ruby/setup-ruby@master
|
76
76
|
with:
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.24.0
|
4
|
+
- Add the way to make background transparent (#631)
|
5
|
+
- Adjust line number position on side graph (#624)
|
6
|
+
- Add hide_labels attribute in Gruff::Dot (#623)
|
7
|
+
- Fix where SideBar's labels were sometimes missing by incorrect left margin
|
8
|
+
|
3
9
|
## 0.23.0
|
4
10
|
- Update dependent RMagick version to 5.3.0 or later (#622)
|
5
11
|
|
data/lib/gruff/base.rb
CHANGED
@@ -367,6 +367,14 @@ module Gruff
|
|
367
367
|
@colors = color_list
|
368
368
|
end
|
369
369
|
|
370
|
+
# Set whether to make background transparent.
|
371
|
+
#
|
372
|
+
# @param value [Boolean] Specify whether to make background transparent.
|
373
|
+
#
|
374
|
+
def transparent_background=(value)
|
375
|
+
@renderer.transparent_background(@columns, @rows) if value
|
376
|
+
end
|
377
|
+
|
370
378
|
# You can set a theme manually. Assign a hash to this method before you
|
371
379
|
# send your data.
|
372
380
|
#
|
@@ -378,7 +386,13 @@ module Gruff
|
|
378
386
|
# background_direction: :top_bottom
|
379
387
|
# }
|
380
388
|
#
|
381
|
-
# +
|
389
|
+
# +background_colors+
|
390
|
+
# - Array<String> format value - background has gradation. (ex. +background_colors: ['black', 'grey']+)
|
391
|
+
# - String value - background has solid color. (ex. +background_colors: 'orange'+)
|
392
|
+
# - nil - background has transparent. (ex. +background_colors: nil+)
|
393
|
+
#
|
394
|
+
# +background_image+:
|
395
|
+
# - Specify the path to image file when it draw the image as background.
|
382
396
|
#
|
383
397
|
# +background_direction+ accepts one of following parameters.
|
384
398
|
# - +:top_bottom+
|
@@ -400,7 +414,7 @@ module Gruff
|
|
400
414
|
marker_color: 'white',
|
401
415
|
marker_shadow_color: nil,
|
402
416
|
font_color: 'black',
|
403
|
-
background_colors:
|
417
|
+
background_colors: 'gray',
|
404
418
|
background_image: nil
|
405
419
|
}
|
406
420
|
@theme_options = defaults.merge options
|
@@ -894,14 +908,14 @@ module Gruff
|
|
894
908
|
def setup_left_margin
|
895
909
|
return @left_margin if hide_left_label_area?
|
896
910
|
|
897
|
-
|
911
|
+
longest_left_label_width = begin
|
898
912
|
if @has_left_labels
|
899
|
-
@labels.values.
|
913
|
+
@labels.values.map { |value| calculate_width(@marker_font, truncate_label_text(value.to_s)) }.max || 0
|
900
914
|
else
|
901
|
-
y_axis_label(maximum_value, @increment)
|
915
|
+
label = y_axis_label(maximum_value, @increment)
|
916
|
+
calculate_width(@marker_font, truncate_label_text(label))
|
902
917
|
end
|
903
918
|
end
|
904
|
-
longest_left_label_width = calculate_width(@marker_font, truncate_label_text(text))
|
905
919
|
|
906
920
|
line_number_width = begin
|
907
921
|
if !@has_left_labels && (@hide_line_markers || @hide_line_numbers)
|
data/lib/gruff/dot.rb
CHANGED
@@ -14,6 +14,9 @@
|
|
14
14
|
# g.write('dot.png')
|
15
15
|
#
|
16
16
|
class Gruff::Dot < Gruff::Base
|
17
|
+
# Prevent drawing of column labels below a stacked bar graph. Default is +false+.
|
18
|
+
attr_writer :hide_labels
|
19
|
+
|
17
20
|
def initialize(*)
|
18
21
|
super
|
19
22
|
@has_left_labels = true
|
@@ -22,6 +25,23 @@ class Gruff::Dot < Gruff::Base
|
|
22
25
|
|
23
26
|
private
|
24
27
|
|
28
|
+
def initialize_attributes
|
29
|
+
super
|
30
|
+
@hide_labels = false
|
31
|
+
end
|
32
|
+
|
33
|
+
def hide_labels?
|
34
|
+
@hide_labels
|
35
|
+
end
|
36
|
+
|
37
|
+
def hide_left_label_area?
|
38
|
+
hide_labels? && @y_axis_label.nil?
|
39
|
+
end
|
40
|
+
|
41
|
+
def hide_bottom_label_area?
|
42
|
+
@hide_line_markers && @x_axis_label.nil? && @legend_at_bottom == false
|
43
|
+
end
|
44
|
+
|
25
45
|
def draw_graph
|
26
46
|
# Setup spacing.
|
27
47
|
#
|
@@ -58,8 +78,9 @@ private
|
|
58
78
|
|
59
79
|
unless @hide_line_numbers
|
60
80
|
label = y_axis_label(marker_label, @increment)
|
81
|
+
y = @graph_bottom + @label_margin + (labels_caps_height / 2.0) + 5 # 5px offset for tick_mark_mode
|
61
82
|
text_renderer = Gruff::Renderer::Text.new(renderer, label, font: @marker_font)
|
62
|
-
text_renderer.add_to_render_queue(0, 0, x,
|
83
|
+
text_renderer.add_to_render_queue(0, 0, x, y, Magick::CenterGravity)
|
63
84
|
end
|
64
85
|
end
|
65
86
|
end
|
@@ -24,13 +24,15 @@ module Gruff
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def background(columns, rows, scale, theme_options)
|
27
|
+
return image_background(scale, *theme_options[:background_image]) if theme_options[:background_image]
|
28
|
+
|
27
29
|
case theme_options[:background_colors]
|
28
30
|
when Array
|
29
31
|
gradated_background(columns, rows, *theme_options[:background_colors][0..1], theme_options[:background_direction])
|
30
32
|
when String
|
31
33
|
solid_background(columns, rows, theme_options[:background_colors])
|
32
34
|
else
|
33
|
-
|
35
|
+
transparent_background(columns, rows)
|
34
36
|
end
|
35
37
|
end
|
36
38
|
|
data/lib/gruff/side_bar.rb
CHANGED
@@ -159,8 +159,9 @@ private
|
|
159
159
|
diff = index - number_of_lines
|
160
160
|
marker_label = (BigDecimal(diff.abs.to_s) * BigDecimal(increment.to_s)) + BigDecimal(minimum_value.to_s)
|
161
161
|
label = x_axis_label(marker_label, @increment)
|
162
|
+
y = @graph_bottom + @label_margin + (labels_caps_height / 2.0)
|
162
163
|
text_renderer = Gruff::Renderer::Text.new(renderer, label, font: @marker_font)
|
163
|
-
text_renderer.add_to_render_queue(0, 0, x,
|
164
|
+
text_renderer.add_to_render_queue(0, 0, x, y, Magick::CenterGravity)
|
164
165
|
end
|
165
166
|
end
|
166
167
|
end
|
data/lib/gruff/spider.rb
CHANGED
data/lib/gruff/version.rb
CHANGED
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.
|
4
|
+
version: 0.24.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:
|
12
|
+
date: 2024-03-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -190,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
190
|
- !ruby/object:Gem::Version
|
191
191
|
version: '0'
|
192
192
|
requirements: []
|
193
|
-
rubygems_version: 3.
|
193
|
+
rubygems_version: 3.2.33
|
194
194
|
signing_key:
|
195
195
|
specification_version: 4
|
196
196
|
summary: Beautiful graphs for one or multiple datasets.
|