gruff 0.14.0 → 0.15.0
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 +7 -7
- data/.rubocop.yml +28 -20
- data/CHANGELOG.md +7 -0
- data/gruff.gemspec +8 -8
- data/lib/gruff/base.rb +7 -7
- data/lib/gruff/bullet.rb +1 -1
- data/lib/gruff/helper/bar_value_label.rb +12 -9
- data/lib/gruff/line.rb +4 -6
- data/lib/gruff/patch/rmagick.rb +0 -1
- data/lib/gruff/renderer/renderer.rb +4 -4
- data/lib/gruff/scatter.rb +4 -4
- data/lib/gruff/scene.rb +13 -5
- data/lib/gruff/side_stacked_bar.rb +1 -0
- data/lib/gruff/spider.rb +0 -4
- data/lib/gruff/store/xy_data.rb +2 -0
- data/lib/gruff/version.rb +1 -1
- data/lib/gruff.rb +68 -56
- metadata +14 -14
- data/.rubocop_todo.yml +0 -116
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6b8682f3d05aa7d0a91ea58fbe907aa581f9a2ed7549f28376390fc0f2101ec
|
4
|
+
data.tar.gz: 31dc3d1b680b887405a66d8c1d14a2baea76b549958f4cd92bf3d2a6adae8ba3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b5e6a29b5acf50408dd03a75f7acaa8830d96cf23bc02d6ac7a5ef9d713afcc41157fc2e94be8ab1611c624bc36398ba0e6793228f9ce75be009f59a9ac9f7c
|
7
|
+
data.tar.gz: 15766e34990536075a856d716d75f5e6d940f7bcb5d4dc9074040c82a8d418f95c0e3780bdbe36821a1c2aca66a07eaeaa11ff10622da7e29faf6347cac303af
|
data/.github/workflows/ci.yml
CHANGED
@@ -12,13 +12,13 @@ jobs:
|
|
12
12
|
timeout-minutes: 20
|
13
13
|
name: Lint
|
14
14
|
steps:
|
15
|
-
- uses: actions/checkout@
|
15
|
+
- uses: actions/checkout@v3
|
16
16
|
with:
|
17
17
|
ref: ${{ github.event.pull_request.head.sha }}
|
18
|
-
- name: Set up Ruby 2.
|
18
|
+
- name: Set up Ruby 2.5
|
19
19
|
uses: ruby/setup-ruby@master
|
20
20
|
with:
|
21
|
-
ruby-version: '2.
|
21
|
+
ruby-version: '2.5'
|
22
22
|
bundler-cache: true
|
23
23
|
- name: Install dependencies
|
24
24
|
run: bundle install --path=vendor/bundle --jobs 4 --retry 3
|
@@ -32,10 +32,10 @@ jobs:
|
|
32
32
|
timeout-minutes: 20
|
33
33
|
strategy:
|
34
34
|
matrix:
|
35
|
-
ruby-version: ['2.
|
35
|
+
ruby-version: ['2.5', '2.6', '2.7', '3.0', '3.1']
|
36
36
|
name: Ruby ${{ matrix.ruby-version }}
|
37
37
|
steps:
|
38
|
-
- uses: actions/checkout@
|
38
|
+
- uses: actions/checkout@v3
|
39
39
|
- name: Set up Ruby
|
40
40
|
uses: ruby/setup-ruby@master
|
41
41
|
with:
|
@@ -51,10 +51,10 @@ jobs:
|
|
51
51
|
timeout-minutes: 20
|
52
52
|
strategy:
|
53
53
|
matrix:
|
54
|
-
ruby-version: ['9.2.
|
54
|
+
ruby-version: ['9.2.20.1', '9.3.4.0']
|
55
55
|
name: JRuby ${{ matrix.ruby-version }}
|
56
56
|
steps:
|
57
|
-
- uses: actions/checkout@
|
57
|
+
- uses: actions/checkout@v3
|
58
58
|
- name: Set up Ruby
|
59
59
|
uses: ruby/setup-ruby@master
|
60
60
|
with:
|
data/.rubocop.yml
CHANGED
@@ -1,15 +1,17 @@
|
|
1
|
-
inherit_from: .rubocop_todo.yml
|
2
1
|
require:
|
3
2
|
- rubocop-performance
|
4
3
|
- rubocop-rake
|
5
4
|
|
6
5
|
AllCops:
|
7
6
|
EnabledByDefault: true
|
8
|
-
TargetRubyVersion: 2.
|
7
|
+
TargetRubyVersion: 2.5
|
9
8
|
Exclude:
|
10
9
|
- 'vendor/bundle/**/*'
|
11
10
|
- 'rails_generators/gruff/**/*'
|
12
11
|
|
12
|
+
Metrics:
|
13
|
+
Enabled: false
|
14
|
+
|
13
15
|
Gemspec/OrderedDependencies:
|
14
16
|
Enabled: false
|
15
17
|
|
@@ -34,25 +36,37 @@ Layout/MultilineMethodArgumentLineBreaks:
|
|
34
36
|
Layout/MultilineAssignmentLayout:
|
35
37
|
EnforcedStyle: same_line
|
36
38
|
|
37
|
-
|
39
|
+
Layout/RedundantLineBreak:
|
40
|
+
Enabled: false
|
41
|
+
|
42
|
+
Layout/SingleLineBlockChain:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
Lint/AmbiguousOperatorPrecedence:
|
38
46
|
Enabled: false
|
39
47
|
|
40
48
|
Lint/ConstantResolution:
|
41
49
|
Enabled: false
|
42
50
|
|
51
|
+
Lint/FloatComparison:
|
52
|
+
Enabled: false
|
53
|
+
|
43
54
|
Lint/NumberConversion:
|
44
55
|
Enabled: false
|
45
56
|
|
57
|
+
Naming/MemoizedInstanceVariableName:
|
58
|
+
Enabled: false
|
59
|
+
|
46
60
|
Naming/MethodParameterName:
|
47
61
|
Enabled: false
|
48
62
|
|
49
|
-
|
63
|
+
Naming/VariableNumber:
|
50
64
|
Enabled: false
|
51
65
|
|
52
|
-
Style/
|
66
|
+
Style/AccessorGrouping:
|
53
67
|
Enabled: false
|
54
68
|
|
55
|
-
Style/
|
69
|
+
Style/ClassAndModuleChildren:
|
56
70
|
Enabled: false
|
57
71
|
|
58
72
|
Style/ConstantVisibility:
|
@@ -64,12 +78,15 @@ Style/Copyright:
|
|
64
78
|
Style/Documentation:
|
65
79
|
Enabled: true
|
66
80
|
|
67
|
-
Style/
|
68
|
-
|
81
|
+
Style/DocumentationMethod:
|
82
|
+
Enabled: false
|
69
83
|
|
70
|
-
Style/
|
84
|
+
Style/DocumentDynamicEvalDefinition:
|
71
85
|
Enabled: false
|
72
86
|
|
87
|
+
Style/FormatString:
|
88
|
+
EnforcedStyle: sprintf
|
89
|
+
|
73
90
|
Style/GuardClause:
|
74
91
|
Enabled: false
|
75
92
|
|
@@ -94,9 +111,6 @@ Style/MissingElse:
|
|
94
111
|
Style/Next:
|
95
112
|
Enabled: false
|
96
113
|
|
97
|
-
Style/NumericLiterals:
|
98
|
-
Enabled: false
|
99
|
-
|
100
114
|
Style/NumericPredicate:
|
101
115
|
Enabled: false
|
102
116
|
|
@@ -109,17 +123,11 @@ Style/RedundantBegin:
|
|
109
123
|
Style/SingleLineBlockParams:
|
110
124
|
Enabled: false
|
111
125
|
|
112
|
-
Style/SpecialGlobalVars:
|
113
|
-
Enabled: false
|
114
|
-
|
115
126
|
Style/StructInheritance:
|
116
127
|
Enabled: false
|
117
128
|
|
118
|
-
|
119
|
-
Enabled: false
|
120
|
-
|
121
|
-
Style/TernaryParentheses:
|
129
|
+
Performance/ChainArrayAllocation:
|
122
130
|
Enabled: false
|
123
131
|
|
124
|
-
Performance/
|
132
|
+
Performance/StringReplacement:
|
125
133
|
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.15.0
|
4
|
+
- Fix SideStackedBar which bars overlap on the coordinate axes if data contains 0 (#558)
|
5
|
+
- Lazy loading library to reduce memory usage (#556)
|
6
|
+
- Drop Ruby 2.4 support (#554)
|
7
|
+
- Fix sort drawing in Gruff::Line (#553)
|
8
|
+
- Fix color value handling in Line#dataxy method (#552)
|
9
|
+
|
3
10
|
## 0.14.0
|
4
11
|
- Update rails template (#547)
|
5
12
|
- Remove singleton in order to support multi-thread processing (#546)
|
data/gruff.gemspec
CHANGED
@@ -11,9 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.authors = ['Geoffrey Grosenbach', 'Uwe Kubosch']
|
12
12
|
s.description = 'Beautiful graphs for one or multiple datasets. Can be used on websites or in documents.'
|
13
13
|
s.email = 'boss@topfunky.com'
|
14
|
-
s.files = `git ls-files`.split.
|
15
|
-
f =~ /^test|^docker|^Rakefile/i
|
16
|
-
end
|
14
|
+
s.files = `git ls-files`.split.grep_v(/^test|^docker|^Rakefile/i)
|
17
15
|
s.homepage = 'https://github.com/topfunky/gruff'
|
18
16
|
s.require_paths = %w[lib]
|
19
17
|
s.summary = 'Beautiful graphs for one or multiple datasets.'
|
@@ -26,16 +24,18 @@ Gem::Specification.new do |s|
|
|
26
24
|
s.platform = 'java'
|
27
25
|
s.add_dependency 'rmagick4j'
|
28
26
|
else
|
29
|
-
s.add_dependency 'rmagick'
|
30
|
-
s.add_development_dependency 'rubocop', '~> 1.
|
31
|
-
s.add_development_dependency 'rubocop-performance', '~> 1.
|
32
|
-
s.add_development_dependency 'rubocop-rake', '~> 0.
|
27
|
+
s.add_dependency 'rmagick', '>= 4.2'
|
28
|
+
s.add_development_dependency 'rubocop', '~> 1.27.0'
|
29
|
+
s.add_development_dependency 'rubocop-performance', '~> 1.13.3'
|
30
|
+
s.add_development_dependency 'rubocop-rake', '~> 0.6.0'
|
33
31
|
end
|
34
32
|
s.add_dependency 'histogram'
|
35
|
-
s.required_ruby_version = '>= 2.
|
33
|
+
s.required_ruby_version = '>= 2.5.0'
|
36
34
|
|
37
35
|
s.add_development_dependency 'rake'
|
38
36
|
s.add_development_dependency 'minitest-reporters'
|
39
37
|
s.add_development_dependency 'simplecov'
|
40
38
|
s.add_development_dependency 'yard', '~> 0.9.25'
|
39
|
+
|
40
|
+
s.metadata['rubygems_mfa_required'] = 'true'
|
41
41
|
end
|
data/lib/gruff/base.rb
CHANGED
@@ -722,7 +722,7 @@ module Gruff
|
|
722
722
|
|
723
723
|
# TESTME
|
724
724
|
# FIXME: Consider chart types other than bar
|
725
|
-
# TODO: See if index.odd? is the best
|
725
|
+
# TODO: See if index.odd? is the best strategy
|
726
726
|
y_offset += @label_stagger_height if index.odd?
|
727
727
|
|
728
728
|
if x_offset >= @graph_left && x_offset <= @graph_right
|
@@ -783,7 +783,7 @@ module Gruff
|
|
783
783
|
end
|
784
784
|
|
785
785
|
def clip_value_if_greater_than(value, max_value) # :nodoc:
|
786
|
-
|
786
|
+
value > max_value ? max_value : value
|
787
787
|
end
|
788
788
|
|
789
789
|
def significant(i) # :nodoc:
|
@@ -849,7 +849,7 @@ module Gruff
|
|
849
849
|
# Make space for half the width of the rightmost column label.
|
850
850
|
# Might be greater than the number of columns if between-style bar markers are used.
|
851
851
|
last_label = @labels.keys.max.to_i
|
852
|
-
|
852
|
+
last_label >= (column_count - 1) && @center_labels_over_point ? calculate_width(@marker_font, @labels[last_label]) / 2.0 : 0
|
853
853
|
end
|
854
854
|
|
855
855
|
def setup_left_margin
|
@@ -857,7 +857,7 @@ module Gruff
|
|
857
857
|
|
858
858
|
text = begin
|
859
859
|
if @has_left_labels
|
860
|
-
@labels.values.reduce('') { |value, memo|
|
860
|
+
@labels.values.reduce('') { |value, memo| value.to_s.length > memo.to_s.length ? value : memo }
|
861
861
|
else
|
862
862
|
y_axis_label(maximum_value.to_f, @increment)
|
863
863
|
end
|
@@ -876,7 +876,7 @@ module Gruff
|
|
876
876
|
# Same with @hide_legend
|
877
877
|
@top_margin +
|
878
878
|
(hide_title? ? @title_margin : @title_caps_height + @title_margin) +
|
879
|
-
(
|
879
|
+
(@hide_legend || @legend_at_bottom ? @legend_margin : calculate_legend_height + @legend_margin)
|
880
880
|
end
|
881
881
|
|
882
882
|
def setup_bottom_margin
|
@@ -914,7 +914,7 @@ module Gruff
|
|
914
914
|
sprintf('%0.2f', value)
|
915
915
|
elsif increment >= 0.01 || (increment * 1000) == (increment * 1000).to_i.to_f
|
916
916
|
sprintf('%0.3f', value)
|
917
|
-
elsif increment >= 0.001 || (increment *
|
917
|
+
elsif increment >= 0.001 || (increment * 10_000) == (increment * 10_000).to_i.to_f
|
918
918
|
sprintf('%0.4f', value)
|
919
919
|
else
|
920
920
|
value.to_s
|
@@ -1019,7 +1019,7 @@ module Gruff
|
|
1019
1019
|
# Try to use a number of horizontal lines that will come out even.
|
1020
1020
|
#
|
1021
1021
|
# TODO Do the same for larger numbers...100, 75, 50, 25
|
1022
|
-
@increment =
|
1022
|
+
@increment = @spread > 0 && marker_count > 0 ? significant(@spread / marker_count) : 1
|
1023
1023
|
else
|
1024
1024
|
# TODO: Make this work for negative values
|
1025
1025
|
self.marker_count = (@spread / @y_axis_increment).to_i
|
data/lib/gruff/bullet.rb
CHANGED
@@ -64,7 +64,7 @@ class Gruff::Bullet < Gruff::Base
|
|
64
64
|
rect_renderer = Gruff::Renderer::Rectangle.new(renderer, color: @colors[0])
|
65
65
|
rect_renderer.render(graph_left, 0, graph_left + graph_width, graph_height)
|
66
66
|
|
67
|
-
[
|
67
|
+
%i[high low].each_with_index do |indicator, index|
|
68
68
|
next unless @options.key?(indicator)
|
69
69
|
|
70
70
|
indicator_width_x = graph_left + graph_width * (@options[indicator] / maximum_value)
|
@@ -18,10 +18,12 @@ module Gruff::BarValueLabel
|
|
18
18
|
class Bar < Base
|
19
19
|
def prepare_rendering(format, _bar_width = 0)
|
20
20
|
left_x, left_y, right_x, _right_y = @coordinate
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
val = begin
|
22
|
+
if format.is_a?(Proc)
|
23
|
+
format.call(@value)
|
24
|
+
else
|
25
|
+
sprintf(format || '%.2f', @value).commify
|
26
|
+
end
|
25
27
|
end
|
26
28
|
|
27
29
|
y = @value >= 0 ? left_y - 30 : left_y + 12
|
@@ -33,12 +35,13 @@ module Gruff::BarValueLabel
|
|
33
35
|
class SideBar < Base
|
34
36
|
def prepare_rendering(format, bar_width = 0)
|
35
37
|
left_x, _left_y, right_x, right_y = @coordinate
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
38
|
+
val = begin
|
39
|
+
if format.is_a?(Proc)
|
40
|
+
format.call(@value)
|
41
|
+
else
|
42
|
+
sprintf(format || '%.2f', @value).commify
|
43
|
+
end
|
40
44
|
end
|
41
|
-
|
42
45
|
x = @value >= 0 ? right_x + 40 : left_x - 40
|
43
46
|
yield x, right_y - bar_width / 2, val
|
44
47
|
end
|
data/lib/gruff/line.rb
CHANGED
@@ -118,12 +118,14 @@ class Gruff::Line < Gruff::Base
|
|
118
118
|
def dataxy(name, x_data_points = [], y_data_points = [], color = nil)
|
119
119
|
# make sure it's an array
|
120
120
|
x_data_points = Array(x_data_points)
|
121
|
-
y_data_points = Array(y_data_points)
|
122
121
|
|
123
122
|
raise ArgumentError, 'x_data_points is nil!' if x_data_points.empty?
|
124
123
|
|
125
124
|
if x_data_points.all? { |p| p.is_a?(Array) && p.size == 2 }
|
125
|
+
color = y_data_points if y_data_points.is_a?(String)
|
126
126
|
x_data_points, y_data_points = x_data_points.transpose
|
127
|
+
else
|
128
|
+
y_data_points = Array(y_data_points)
|
127
129
|
end
|
128
130
|
|
129
131
|
raise ArgumentError, 'x_data_points.length != y_data_points.length!' if x_data_points.length != y_data_points.length
|
@@ -174,7 +176,7 @@ private
|
|
174
176
|
|
175
177
|
def draw_graph
|
176
178
|
# Check to see if more than one datapoint was given. NaN can result otherwise.
|
177
|
-
@x_increment =
|
179
|
+
@x_increment = column_count > 1 ? (@graph_width / (column_count - 1).to_f) : @graph_width
|
178
180
|
|
179
181
|
@reference_lines.each_value do |curr_reference_line|
|
180
182
|
draw_horizontal_reference_line(curr_reference_line) if curr_reference_line.key?(:norm_value)
|
@@ -264,10 +266,6 @@ private
|
|
264
266
|
end
|
265
267
|
end
|
266
268
|
|
267
|
-
def sort_norm_data
|
268
|
-
super unless store.data.any?(&:x_points)
|
269
|
-
end
|
270
|
-
|
271
269
|
def draw_line_markers
|
272
270
|
# do all of the stuff for the horizontal lines on the y-axis
|
273
271
|
super
|
data/lib/gruff/patch/rmagick.rb
CHANGED
@@ -44,8 +44,8 @@ module Gruff
|
|
44
44
|
|
45
45
|
# Make a new image at the current size with a solid +color+.
|
46
46
|
def solid_background(columns, rows, color)
|
47
|
-
Magick::Image.new(columns, rows) do
|
48
|
-
|
47
|
+
Magick::Image.new(columns, rows) do |img|
|
48
|
+
img.background_color = color
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -97,8 +97,8 @@ module Gruff
|
|
97
97
|
|
98
98
|
# Use with a theme to make a transparent background
|
99
99
|
def render_transparent_background(columns, rows)
|
100
|
-
Magick::Image.new(columns, rows) do
|
101
|
-
|
100
|
+
Magick::Image.new(columns, rows) do |img|
|
101
|
+
img.background_color = 'transparent'
|
102
102
|
end
|
103
103
|
end
|
104
104
|
end
|
data/lib/gruff/scatter.rb
CHANGED
@@ -116,7 +116,7 @@ private
|
|
116
116
|
|
117
117
|
def draw_graph
|
118
118
|
# Check to see if more than one datapoint was given. NaN can result otherwise.
|
119
|
-
@x_increment =
|
119
|
+
@x_increment = @x_spread > 1 ? (@graph_width / (@x_spread - 1).to_f) : @graph_width
|
120
120
|
|
121
121
|
store.norm_data.each do |data_row|
|
122
122
|
data_row.coordinates.each do |x_value, y_value|
|
@@ -148,7 +148,7 @@ private
|
|
148
148
|
super
|
149
149
|
end
|
150
150
|
|
151
|
-
def calculate_spread
|
151
|
+
def calculate_spread
|
152
152
|
super
|
153
153
|
@x_spread = @maximum_x_value.to_f - @minimum_x_value.to_f
|
154
154
|
@x_spread = @x_spread > 0 ? @x_spread : 1
|
@@ -176,7 +176,7 @@ private
|
|
176
176
|
end
|
177
177
|
@marker_x_count ||= 4
|
178
178
|
end
|
179
|
-
@x_increment =
|
179
|
+
@x_increment = @x_spread > 0 ? (@x_spread / @marker_x_count) : 1
|
180
180
|
unless @disable_significant_rounding_x_axis
|
181
181
|
@x_increment = significant(@x_increment)
|
182
182
|
end
|
@@ -215,7 +215,7 @@ private
|
|
215
215
|
end
|
216
216
|
end
|
217
217
|
|
218
|
-
def get_x_coord(x_data_point, width, offset)
|
218
|
+
def get_x_coord(x_data_point, width, offset)
|
219
219
|
x_data_point * width + offset
|
220
220
|
end
|
221
221
|
end
|
data/lib/gruff/scene.rb
CHANGED
@@ -73,12 +73,20 @@ class Gruff::Scene < Gruff::Base
|
|
73
73
|
case method_name.to_s
|
74
74
|
when /^(\w+)_group=$/
|
75
75
|
add_group Regexp.last_match(1), *args
|
76
|
-
return
|
77
76
|
when /^(\w+)=$/
|
78
77
|
set_input Regexp.last_match(1), args.first
|
79
|
-
|
78
|
+
else
|
79
|
+
super
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def respond_to_missing?(method_sym, include_private)
|
84
|
+
case method_sym.to_s
|
85
|
+
when /^(\w+)_group=$/, /^(\w+)=$/
|
86
|
+
true
|
87
|
+
else
|
88
|
+
super
|
80
89
|
end
|
81
|
-
super
|
82
90
|
end
|
83
91
|
|
84
92
|
private
|
@@ -90,7 +98,7 @@ private
|
|
90
98
|
def set_input(input_name, input_value)
|
91
99
|
if !@groups[input_name].nil?
|
92
100
|
@groups[input_name].send_updates(input_value)
|
93
|
-
elsif chosen_layer = @layers.find { |layer| layer.name == input_name }
|
101
|
+
elsif (chosen_layer = @layers.find { |layer| layer.name == input_name })
|
94
102
|
chosen_layer.update input_value
|
95
103
|
end
|
96
104
|
end
|
@@ -121,7 +129,7 @@ class Gruff::Layer
|
|
121
129
|
def initialize(base_dir, folder_name)
|
122
130
|
@base_dir = base_dir.to_s
|
123
131
|
@name = folder_name.to_s
|
124
|
-
@filenames = Dir.open(File.join(base_dir, folder_name)).entries.
|
132
|
+
@filenames = Dir.open(File.join(base_dir, folder_name)).entries.grep(/^[^.]+\.png$/).sort
|
125
133
|
@selected_filename = select_default
|
126
134
|
end
|
127
135
|
|
@@ -87,6 +87,7 @@ private
|
|
87
87
|
height[point_index]) + 1
|
88
88
|
temp2 = @graph_left + @graph_width - height[point_index] - 1
|
89
89
|
difference = temp2 - temp1
|
90
|
+
difference = 0 if row_index == 0 && difference < 0
|
90
91
|
|
91
92
|
left_x = length[point_index]
|
92
93
|
left_y = @graph_top + (bar_width * point_index) + padding
|
data/lib/gruff/spider.rb
CHANGED
data/lib/gruff/store/xy_data.rb
CHANGED
data/lib/gruff/version.rb
CHANGED
data/lib/gruff.rb
CHANGED
@@ -1,62 +1,74 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'rmagick'
|
4
|
+
|
5
|
+
require 'gruff/patch/rmagick'
|
6
|
+
require 'gruff/patch/string'
|
7
|
+
require 'gruff/renderer/renderer'
|
8
|
+
require 'gruff/store/store'
|
9
|
+
require 'gruff/font'
|
10
|
+
require 'gruff/base'
|
4
11
|
require 'gruff/version'
|
5
12
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
helper/bar_conversion
|
16
|
-
helper/
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
side_stacked_bar
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
13
|
+
##
|
14
|
+
# = Gruff. Graphs.
|
15
|
+
#
|
16
|
+
module Gruff
|
17
|
+
# @private
|
18
|
+
def self.libpath(path)
|
19
|
+
File.join(__dir__, 'gruff', path)
|
20
|
+
end
|
21
|
+
|
22
|
+
autoload :BarConversion, Gruff.libpath('helper/bar_conversion')
|
23
|
+
autoload :BarValueLabel, Gruff.libpath('helper/bar_value_label')
|
24
|
+
class Base
|
25
|
+
autoload :StackedMixin, Gruff.libpath('helper/stacked_mixin')
|
26
|
+
end
|
27
|
+
|
28
|
+
autoload :AccumulatorBar, Gruff.libpath('accumulator_bar')
|
29
|
+
autoload :Area, Gruff.libpath('area')
|
30
|
+
autoload :Bar, Gruff.libpath('bar')
|
31
|
+
autoload :Bezier, Gruff.libpath('bezier')
|
32
|
+
autoload :Bullet, Gruff.libpath('bullet')
|
33
|
+
autoload :Dot, Gruff.libpath('dot')
|
34
|
+
autoload :Histogram, Gruff.libpath('histogram')
|
35
|
+
autoload :Line, Gruff.libpath('line')
|
36
|
+
autoload :Net, Gruff.libpath('net')
|
37
|
+
autoload :Pie, Gruff.libpath('pie')
|
38
|
+
autoload :Scatter, Gruff.libpath('scatter')
|
39
|
+
autoload :Scene, Gruff.libpath('scene')
|
40
|
+
autoload :SideBar, Gruff.libpath('side_bar')
|
41
|
+
autoload :SideStackedBar, Gruff.libpath('side_stacked_bar')
|
42
|
+
autoload :Spider, Gruff.libpath('spider')
|
43
|
+
autoload :StackedArea, Gruff.libpath('stacked_area')
|
44
|
+
autoload :StackedBar, Gruff.libpath('stacked_bar')
|
45
|
+
|
46
|
+
autoload :Layer, Gruff.libpath('scene')
|
47
|
+
autoload :Themes, Gruff.libpath('themes')
|
48
|
+
|
49
|
+
class Renderer
|
50
|
+
autoload :Bezier, Gruff.libpath('renderer/bezier')
|
51
|
+
autoload :Circle, Gruff.libpath('renderer/circle')
|
52
|
+
autoload :DashLine, Gruff.libpath('renderer/dash_line')
|
53
|
+
autoload :Dot, Gruff.libpath('renderer/dot')
|
54
|
+
autoload :Ellipse, Gruff.libpath('renderer/ellipse')
|
55
|
+
autoload :Line, Gruff.libpath('renderer/line')
|
56
|
+
autoload :Polygon, Gruff.libpath('renderer/polygon')
|
57
|
+
autoload :Polyline, Gruff.libpath('renderer/polyline')
|
58
|
+
autoload :Rectangle, Gruff.libpath('renderer/rectangle')
|
59
|
+
autoload :Text, Gruff.libpath('renderer/text')
|
60
|
+
end
|
61
|
+
|
62
|
+
class Store
|
63
|
+
autoload :BasicData, Gruff.libpath('store/basic_data')
|
64
|
+
autoload :CustomData, Gruff.libpath('store/custom_data')
|
65
|
+
autoload :XYData, Gruff.libpath('store/xy_data')
|
66
|
+
end
|
67
|
+
|
68
|
+
module Mini
|
69
|
+
autoload :Bar, Gruff.libpath('mini/bar')
|
70
|
+
autoload :Legend, Gruff.libpath('mini/legend')
|
71
|
+
autoload :Pie, Gruff.libpath('mini/pie')
|
72
|
+
autoload :SideBar, Gruff.libpath('mini/side_bar')
|
73
|
+
end
|
62
74
|
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.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
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: 2022-04-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rmagick
|
@@ -17,56 +17,56 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '4.2'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
27
|
+
version: '4.2'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rubocop
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 1.
|
34
|
+
version: 1.27.0
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 1.
|
41
|
+
version: 1.27.0
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rubocop-performance
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: 1.
|
48
|
+
version: 1.13.3
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 1.
|
55
|
+
version: 1.13.3
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: rubocop-rake
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 0.
|
62
|
+
version: 0.6.0
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0.
|
69
|
+
version: 0.6.0
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: histogram
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -149,7 +149,6 @@ files:
|
|
149
149
|
- ".github/workflows/ci.yml"
|
150
150
|
- ".gitignore"
|
151
151
|
- ".rubocop.yml"
|
152
|
-
- ".rubocop_todo.yml"
|
153
152
|
- ".yardopts"
|
154
153
|
- CHANGELOG.md
|
155
154
|
- Gemfile
|
@@ -212,7 +211,8 @@ files:
|
|
212
211
|
homepage: https://github.com/topfunky/gruff
|
213
212
|
licenses:
|
214
213
|
- MIT
|
215
|
-
metadata:
|
214
|
+
metadata:
|
215
|
+
rubygems_mfa_required: 'true'
|
216
216
|
post_install_message:
|
217
217
|
rdoc_options: []
|
218
218
|
require_paths:
|
@@ -221,14 +221,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
221
221
|
requirements:
|
222
222
|
- - ">="
|
223
223
|
- !ruby/object:Gem::Version
|
224
|
-
version: 2.
|
224
|
+
version: 2.5.0
|
225
225
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
226
226
|
requirements:
|
227
227
|
- - ">="
|
228
228
|
- !ruby/object:Gem::Version
|
229
229
|
version: '0'
|
230
230
|
requirements: []
|
231
|
-
rubygems_version: 3.
|
231
|
+
rubygems_version: 3.3.7
|
232
232
|
signing_key:
|
233
233
|
specification_version: 4
|
234
234
|
summary: Beautiful graphs for one or multiple datasets.
|
data/.rubocop_todo.yml
DELETED
@@ -1,116 +0,0 @@
|
|
1
|
-
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config`
|
3
|
-
# on 2021-07-11 06:52:14 UTC using RuboCop version 1.12.1.
|
4
|
-
# The point is for the user to remove these configuration records
|
5
|
-
# one by one as the offenses are removed from the code base.
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
8
|
-
|
9
|
-
# Offense count: 13
|
10
|
-
Lint/FloatComparison:
|
11
|
-
Exclude:
|
12
|
-
- 'Rakefile'
|
13
|
-
- 'lib/gruff/base.rb'
|
14
|
-
- 'lib/gruff/renderer/renderer.rb'
|
15
|
-
- 'lib/gruff/scatter.rb'
|
16
|
-
|
17
|
-
# Offense count: 1
|
18
|
-
# Configuration parameters: CheckForMethodsWithNoSideEffects.
|
19
|
-
Lint/Void:
|
20
|
-
Exclude:
|
21
|
-
- 'lib/gruff/patch/rmagick.rb'
|
22
|
-
|
23
|
-
# Offense count: 57
|
24
|
-
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
25
|
-
Metrics/AbcSize:
|
26
|
-
Max: 66
|
27
|
-
|
28
|
-
# Offense count: 3
|
29
|
-
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
30
|
-
# IgnoredMethods: refine
|
31
|
-
Metrics/BlockLength:
|
32
|
-
Max: 32
|
33
|
-
|
34
|
-
# Offense count: 14
|
35
|
-
# Configuration parameters: CountComments, CountAsOne.
|
36
|
-
Metrics/ClassLength:
|
37
|
-
Max: 683
|
38
|
-
|
39
|
-
# Offense count: 8
|
40
|
-
# Configuration parameters: IgnoredMethods.
|
41
|
-
Metrics/CyclomaticComplexity:
|
42
|
-
Max: 17
|
43
|
-
|
44
|
-
# Offense count: 134
|
45
|
-
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
46
|
-
Metrics/MethodLength:
|
47
|
-
Max: 81
|
48
|
-
|
49
|
-
# Offense count: 3
|
50
|
-
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
|
51
|
-
Metrics/ParameterLists:
|
52
|
-
Max: 7
|
53
|
-
|
54
|
-
# Offense count: 6
|
55
|
-
# Configuration parameters: IgnoredMethods.
|
56
|
-
Metrics/PerceivedComplexity:
|
57
|
-
Max: 19
|
58
|
-
|
59
|
-
# Offense count: 1
|
60
|
-
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
|
61
|
-
# SupportedStylesForLeadingUnderscores: disallowed, required, optional
|
62
|
-
Naming/MemoizedInstanceVariableName:
|
63
|
-
Exclude:
|
64
|
-
- 'lib/gruff/scene.rb'
|
65
|
-
|
66
|
-
# Offense count: 6
|
67
|
-
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers.
|
68
|
-
# SupportedStyles: snake_case, normalcase, non_integer
|
69
|
-
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339
|
70
|
-
Naming/VariableNumber:
|
71
|
-
Exclude:
|
72
|
-
- 'test/test_bar.rb'
|
73
|
-
- 'test/test_bezier.rb'
|
74
|
-
- 'test/test_line.rb'
|
75
|
-
|
76
|
-
# Offense count: 2
|
77
|
-
# Cop supports --auto-correct.
|
78
|
-
Performance/StringReplacement:
|
79
|
-
Exclude:
|
80
|
-
- 'lib/gruff/scene.rb'
|
81
|
-
|
82
|
-
# Offense count: 1
|
83
|
-
Rake/Desc:
|
84
|
-
Exclude:
|
85
|
-
- 'Rakefile'
|
86
|
-
|
87
|
-
# Offense count: 1
|
88
|
-
Security/Eval:
|
89
|
-
Exclude:
|
90
|
-
- 'test/gruff_test_case.rb'
|
91
|
-
|
92
|
-
# Offense count: 1
|
93
|
-
Style/CombinableLoops:
|
94
|
-
Exclude:
|
95
|
-
- 'test/test_line.rb'
|
96
|
-
|
97
|
-
# Offense count: 2
|
98
|
-
Style/DocumentDynamicEvalDefinition:
|
99
|
-
Exclude:
|
100
|
-
- 'test/gruff_test_case.rb'
|
101
|
-
|
102
|
-
# Offense count: 97
|
103
|
-
# Configuration parameters: RequireForNonPublicMethods.
|
104
|
-
Style/DocumentationMethod:
|
105
|
-
Enabled: false
|
106
|
-
|
107
|
-
# Offense count: 1
|
108
|
-
Style/MissingRespondToMissing:
|
109
|
-
Exclude:
|
110
|
-
- 'lib/gruff/scene.rb'
|
111
|
-
|
112
|
-
# Offense count: 2
|
113
|
-
# Cop supports --auto-correct.
|
114
|
-
Style/StringConcatenation:
|
115
|
-
Exclude:
|
116
|
-
- 'test/gruff_test_case.rb'
|