gruff 0.13.0-java → 0.14.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +66 -0
  3. data/.rubocop.yml +6 -10
  4. data/.rubocop_todo.yml +19 -85
  5. data/CHANGELOG.md +10 -0
  6. data/README.md +6 -7
  7. data/gruff.gemspec +2 -4
  8. data/lib/gruff.rb +1 -0
  9. data/lib/gruff/accumulator_bar.rb +3 -1
  10. data/lib/gruff/area.rb +5 -8
  11. data/lib/gruff/bar.rb +19 -23
  12. data/lib/gruff/base.rb +134 -96
  13. data/lib/gruff/bezier.rb +4 -6
  14. data/lib/gruff/bullet.rb +11 -10
  15. data/lib/gruff/dot.rb +10 -10
  16. data/lib/gruff/font.rb +39 -0
  17. data/lib/gruff/helper/stacked_mixin.rb +1 -2
  18. data/lib/gruff/histogram.rb +9 -7
  19. data/lib/gruff/line.rb +55 -46
  20. data/lib/gruff/mini/bar.rb +9 -6
  21. data/lib/gruff/mini/legend.rb +12 -8
  22. data/lib/gruff/mini/pie.rb +9 -6
  23. data/lib/gruff/mini/side_bar.rb +9 -6
  24. data/lib/gruff/net.rb +9 -15
  25. data/lib/gruff/patch/string.rb +1 -1
  26. data/lib/gruff/pie.rb +23 -65
  27. data/lib/gruff/renderer/bezier.rb +8 -9
  28. data/lib/gruff/renderer/circle.rb +8 -9
  29. data/lib/gruff/renderer/dash_line.rb +9 -10
  30. data/lib/gruff/renderer/dot.rb +13 -14
  31. data/lib/gruff/renderer/ellipse.rb +8 -9
  32. data/lib/gruff/renderer/line.rb +8 -9
  33. data/lib/gruff/renderer/polygon.rb +9 -10
  34. data/lib/gruff/renderer/polyline.rb +8 -9
  35. data/lib/gruff/renderer/rectangle.rb +7 -8
  36. data/lib/gruff/renderer/renderer.rb +21 -36
  37. data/lib/gruff/renderer/text.rb +21 -37
  38. data/lib/gruff/scatter.rb +41 -46
  39. data/lib/gruff/scene.rb +15 -13
  40. data/lib/gruff/side_bar.rb +14 -30
  41. data/lib/gruff/side_stacked_bar.rb +8 -11
  42. data/lib/gruff/spider.rb +11 -16
  43. data/lib/gruff/stacked_area.rb +10 -11
  44. data/lib/gruff/stacked_bar.rb +9 -9
  45. data/lib/gruff/store/store.rb +6 -10
  46. data/lib/gruff/themes.rb +6 -6
  47. data/lib/gruff/version.rb +1 -1
  48. data/rails_generators/gruff/templates/controller.rb +1 -1
  49. metadata +4 -21
  50. data/.travis.yml +0 -23
  51. data/assets/plastik/blue.png +0 -0
  52. data/assets/plastik/green.png +0 -0
  53. data/assets/plastik/red.png +0 -0
  54. data/lib/gruff/photo_bar.rb +0 -93
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46eb3259410a2c7b797d4482f37db956ee9f7b69ab00770d9980522666e58f38
4
- data.tar.gz: 3ddd8e3ecf26ecf8315173e1c6afc18b37cb6d0d9d487b3ff24a3a4623184e05
3
+ metadata.gz: 49e695ac5551cf4ec68c09c9d272219433df913f0871cf108373fabffc73492f
4
+ data.tar.gz: 7724a089b1d53c511511301cb184af87a2fbe6ce92a9836fc053df5e7c39005a
5
5
  SHA512:
6
- metadata.gz: 4792f0f6dc06df61238e6312988bb0ac41994cca4b30feffbda7253fb51d26c7cbbecb8152760a7eef1881e089b83a1976a333e9f1f80e8a1f5377f0155dfe3c
7
- data.tar.gz: 24f43e7dd7f304fe2a3e44afe56d1f235ba205495de69f7b25fba74280b730619f60af3d51ee854b89ad00a73e9509a3052c514dd4adce56e00bff16c4233a1e
6
+ metadata.gz: ba0f075b7a210e181b7a503bc1701cd43b618ba043dc44d2ef9c24d7db212687a840b8e92083c9e92d9d69d50f83d34d7b02ea4d2d0c33d1705abca2a18566d9
7
+ data.tar.gz: ce4e553a52dd6a1c85bf5fbcca5f37bebe4c9961627c213f96c10be08e611551a7c2927f3422a733208fd33363cd2767b8b0eab042d9de4707e2b4e8d82644d4
@@ -0,0 +1,66 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ lint:
11
+ runs-on: ubuntu-18.04
12
+ timeout-minutes: 20
13
+ name: Lint
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+ with:
17
+ ref: ${{ github.event.pull_request.head.sha }}
18
+ - name: Set up Ruby 2.4
19
+ uses: ruby/setup-ruby@master
20
+ with:
21
+ ruby-version: '2.4'
22
+ bundler-cache: true
23
+ - name: Install dependencies
24
+ run: bundle install --path=vendor/bundle --jobs 4 --retry 3
25
+ - name: RuboCop Problem Matchers
26
+ uses: r7kamura/rubocop-problem-matchers-action@v1.1.0
27
+ - name: Run tests
28
+ run: bundle exec rubocop
29
+
30
+ test-ruby:
31
+ runs-on: ubuntu-18.04
32
+ timeout-minutes: 20
33
+ strategy:
34
+ matrix:
35
+ ruby-version: ['2.4', '2.5', '2.6', '2.7', '3.0']
36
+ name: Ruby ${{ matrix.ruby-version }}
37
+ steps:
38
+ - uses: actions/checkout@v2
39
+ - name: Set up Ruby
40
+ uses: ruby/setup-ruby@master
41
+ with:
42
+ ruby-version: ${{ matrix.ruby-version }}
43
+ bundler-cache: true
44
+ - name: Install dependencies
45
+ run: bundle install --path=vendor/bundle --jobs 4 --retry 3
46
+ - name: Run tests
47
+ run: bundle exec rake
48
+
49
+ test-jruby:
50
+ runs-on: ubuntu-18.04
51
+ timeout-minutes: 20
52
+ strategy:
53
+ matrix:
54
+ ruby-version: ['9.2.19.0']
55
+ name: JRuby ${{ matrix.ruby-version }}
56
+ steps:
57
+ - uses: actions/checkout@v2
58
+ - name: Set up Ruby
59
+ uses: ruby/setup-ruby@master
60
+ with:
61
+ ruby-version: jruby-${{ matrix.ruby-version }}
62
+ bundler-cache: true
63
+ - name: Install dependencies
64
+ run: bundle install --path=vendor/bundle --jobs 4 --retry 3
65
+ - name: Run tests
66
+ run: bundle exec rake
data/.rubocop.yml CHANGED
@@ -1,5 +1,7 @@
1
1
  inherit_from: .rubocop_todo.yml
2
- require: rubocop-performance
2
+ require:
3
+ - rubocop-performance
4
+ - rubocop-rake
3
5
 
4
6
  AllCops:
5
7
  EnabledByDefault: true
@@ -23,9 +25,6 @@ Layout/ClassStructure:
23
25
  Layout/FirstMethodArgumentLineBreak:
24
26
  Enabled: false
25
27
 
26
- Layout/LeadingCommentSpace:
27
- Enabled: false
28
-
29
28
  Layout/LineLength:
30
29
  Max: 150
31
30
 
@@ -44,6 +43,9 @@ Lint/ConstantResolution:
44
43
  Lint/NumberConversion:
45
44
  Enabled: false
46
45
 
46
+ Naming/MethodParameterName:
47
+ Enabled: false
48
+
47
49
  Style/AccessorGrouping:
48
50
  Enabled: false
49
51
 
@@ -62,9 +64,6 @@ Style/Copyright:
62
64
  Style/Documentation:
63
65
  Enabled: true
64
66
 
65
- Style/Encoding:
66
- Enabled: false
67
-
68
67
  Style/FormatString:
69
68
  EnforcedStyle: sprintf
70
69
 
@@ -92,9 +91,6 @@ Style/MethodCallWithArgsParentheses:
92
91
  Style/MissingElse:
93
92
  Enabled: false
94
93
 
95
- Style/MutableConstant:
96
- Enabled: false
97
-
98
94
  Style/Next:
99
95
  Enabled: false
100
96
 
data/.rubocop_todo.yml CHANGED
@@ -1,30 +1,11 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2021-05-07 13:38:24 UTC using RuboCop version 1.12.1.
3
+ # on 2021-07-11 06:52:14 UTC using RuboCop version 1.12.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 1
10
- # Cop supports --auto-correct.
11
- # Configuration parameters: Include.
12
- # Include: **/*.gemspec
13
- Gemspec/DateAssignment:
14
- Exclude:
15
- - 'gruff.gemspec'
16
-
17
- # Offense count: 1
18
- # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches.
19
- Lint/DuplicateBranch:
20
- Exclude:
21
- - 'test/gruff_test_case.rb'
22
-
23
- # Offense count: 1
24
- Lint/DuplicateMethods:
25
- Exclude:
26
- - 'lib/gruff/photo_bar.rb'
27
-
28
9
  # Offense count: 13
29
10
  Lint/FloatComparison:
30
11
  Exclude:
@@ -33,44 +14,34 @@ Lint/FloatComparison:
33
14
  - 'lib/gruff/renderer/renderer.rb'
34
15
  - 'lib/gruff/scatter.rb'
35
16
 
36
- # Offense count: 1
37
- Lint/UnreachableCode:
38
- Exclude:
39
- - 'lib/gruff/photo_bar.rb'
40
-
41
- # Offense count: 1
42
- Lint/UselessAssignment:
43
- Exclude:
44
- - 'lib/gruff/photo_bar.rb'
45
-
46
17
  # Offense count: 1
47
18
  # Configuration parameters: CheckForMethodsWithNoSideEffects.
48
19
  Lint/Void:
49
20
  Exclude:
50
21
  - 'lib/gruff/patch/rmagick.rb'
51
22
 
52
- # Offense count: 56
23
+ # Offense count: 57
53
24
  # Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
54
25
  Metrics/AbcSize:
55
- Max: 75
26
+ Max: 66
56
27
 
57
- # Offense count: 1
28
+ # Offense count: 3
58
29
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
59
30
  # IgnoredMethods: refine
60
31
  Metrics/BlockLength:
61
- Max: 29
32
+ Max: 32
62
33
 
63
34
  # Offense count: 14
64
35
  # Configuration parameters: CountComments, CountAsOne.
65
36
  Metrics/ClassLength:
66
- Max: 669
37
+ Max: 683
67
38
 
68
39
  # Offense count: 8
69
40
  # Configuration parameters: IgnoredMethods.
70
41
  Metrics/CyclomaticComplexity:
71
- Max: 21
42
+ Max: 17
72
43
 
73
- # Offense count: 126
44
+ # Offense count: 134
74
45
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
75
46
  Metrics/MethodLength:
76
47
  Max: 81
@@ -80,10 +51,10 @@ Metrics/MethodLength:
80
51
  Metrics/ParameterLists:
81
52
  Max: 7
82
53
 
83
- # Offense count: 7
54
+ # Offense count: 6
84
55
  # Configuration parameters: IgnoredMethods.
85
56
  Metrics/PerceivedComplexity:
86
- Max: 22
57
+ Max: 19
87
58
 
88
59
  # Offense count: 1
89
60
  # Configuration parameters: EnforcedStyleForLeadingUnderscores.
@@ -92,16 +63,6 @@ Naming/MemoizedInstanceVariableName:
92
63
  Exclude:
93
64
  - 'lib/gruff/scene.rb'
94
65
 
95
- # Offense count: 9
96
- # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
97
- # AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to
98
- Naming/MethodParameterName:
99
- Exclude:
100
- - 'lib/gruff/base.rb'
101
- - 'lib/gruff/patch/rmagick.rb'
102
- - 'lib/gruff/pie.rb'
103
- - 'lib/gruff/renderer/text.rb'
104
-
105
66
  # Offense count: 6
106
67
  # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers.
107
68
  # SupportedStyles: snake_case, normalcase, non_integer
@@ -112,31 +73,18 @@ Naming/VariableNumber:
112
73
  - 'test/test_bezier.rb'
113
74
  - 'test/test_line.rb'
114
75
 
115
- # Offense count: 1
116
- # Configuration parameters: MinSize.
117
- Performance/CollectionLiteralInLoop:
118
- Exclude:
119
- - 'test/test_legend.rb'
120
-
121
- # Offense count: 1
122
- # Cop supports --auto-correct.
123
- Performance/RedundantMatch:
124
- Exclude:
125
- - 'lib/gruff/photo_bar.rb'
126
-
127
- # Offense count: 1
128
- # Cop supports --auto-correct.
129
- Performance/RegexpMatch:
130
- Exclude:
131
- - 'lib/gruff/photo_bar.rb'
132
-
133
76
  # Offense count: 2
134
77
  # Cop supports --auto-correct.
135
78
  Performance/StringReplacement:
136
79
  Exclude:
137
80
  - 'lib/gruff/scene.rb'
138
81
 
139
- # Offense count: 2
82
+ # Offense count: 1
83
+ Rake/Desc:
84
+ Exclude:
85
+ - 'Rakefile'
86
+
87
+ # Offense count: 1
140
88
  Security/Eval:
141
89
  Exclude:
142
90
  - 'test/gruff_test_case.rb'
@@ -146,37 +94,23 @@ Style/CombinableLoops:
146
94
  Exclude:
147
95
  - 'test/test_line.rb'
148
96
 
149
- # Offense count: 3
97
+ # Offense count: 2
150
98
  Style/DocumentDynamicEvalDefinition:
151
99
  Exclude:
152
100
  - 'test/gruff_test_case.rb'
153
101
 
154
- # Offense count: 137
102
+ # Offense count: 97
155
103
  # Configuration parameters: RequireForNonPublicMethods.
156
104
  Style/DocumentationMethod:
157
105
  Enabled: false
158
106
 
159
- # Offense count: 3
160
- # Cop supports --auto-correct.
161
- Style/EvalWithLocation:
162
- Exclude:
163
- - 'test/gruff_test_case.rb'
164
-
165
107
  # Offense count: 1
166
108
  Style/MissingRespondToMissing:
167
109
  Exclude:
168
110
  - 'lib/gruff/scene.rb'
169
111
 
170
- # Offense count: 1
171
- # Configuration parameters: AllowedMethods.
172
- # AllowedMethods: respond_to_missing?
173
- Style/OptionalBooleanParameter:
174
- Exclude:
175
- - 'lib/gruff/base.rb'
176
-
177
- # Offense count: 3
112
+ # Offense count: 2
178
113
  # Cop supports --auto-correct.
179
114
  Style/StringConcatenation:
180
115
  Exclude:
181
- - 'lib/gruff/photo_bar.rb'
182
116
  - 'test/gruff_test_case.rb'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.14.0
4
+ - Update rails template (#547)
5
+ - Remove singleton in order to support multi-thread processing (#546)
6
+ - Fix bug in Gruff::Scatter that X coordinate value is wrong if set value in x_axis_increment (#534)
7
+ - Add marker_x_count attribute in Gruff::Line (#532)
8
+ - Add label_formatting attribute in Gruff::Pie (#531)
9
+ - Removed the ability to inject custom PieSlice classes from the outside (#530)
10
+ - Remove Gruff::PhotoBar (#513)
11
+ - Deprecate last_series_goes_on_bottom attribute in Gruff::StackedArea (#512)
12
+
3
13
  ## 0.13.0
4
14
  - Allow to customize label value with lambda (#510)
5
15
  - Rename enable_vertical_line_markers attribute to show_vertical_markers (#509)
data/README.md CHANGED
@@ -133,30 +133,29 @@ http://www.rubydoc.info/github/topfunky/gruff/frames
133
133
 
134
134
  ## Supported Ruby Versions
135
135
 
136
- We aim to support all Ruby implementations supporting Ruby language level 1.9.3
137
- or later. Currently we are running CI for MRI, JRuby, and Rubinius.
136
+ - Ruby 2.4 or later
137
+ - JRuby 9.2.x or later
138
138
 
139
139
  ## Development
140
140
  1. Build docker image
141
141
  ```sh
142
- $ ./docker/build.sh
142
+ $ ./docker-build.sh
143
143
  ```
144
144
 
145
145
  2. Launch docker image
146
146
  ```sh
147
- $ ./docker/launch.sh
147
+ $ ./docker-launch.sh
148
148
  ```
149
149
 
150
150
  3. Run tests
151
151
  ```sh
152
- $ bundle install
153
- $ bundle exec rake
152
+ $ rake
154
153
  ```
155
154
 
156
155
  If you have made changes that involve updating the expected image, you need to update the image with the following command after running tests.
157
156
 
158
157
  ```sh
159
- $ bundle exec rake test:image:update
158
+ $ rake test:image:update
160
159
  ```
161
160
 
162
161
  ## Contributing
data/gruff.gemspec CHANGED
@@ -1,4 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
1
  # frozen_string_literal: true
3
2
 
4
3
  lib = File.expand_path('lib')
@@ -10,11 +9,10 @@ Gem::Specification.new do |s|
10
9
  s.name = 'gruff'
11
10
  s.version = Gruff::VERSION
12
11
  s.authors = ['Geoffrey Grosenbach', 'Uwe Kubosch']
13
- s.date = Date.today.to_s
14
12
  s.description = 'Beautiful graphs for one or multiple datasets. Can be used on websites or in documents.'
15
13
  s.email = 'boss@topfunky.com'
16
14
  s.files = `git ls-files`.split.reject do |f|
17
- f =~ /^test|^docker|^Rakefile/
15
+ f =~ /^test|^docker|^Rakefile/i
18
16
  end
19
17
  s.homepage = 'https://github.com/topfunky/gruff'
20
18
  s.require_paths = %w[lib]
@@ -31,12 +29,12 @@ Gem::Specification.new do |s|
31
29
  s.add_dependency 'rmagick'
32
30
  s.add_development_dependency 'rubocop', '~> 1.12.1'
33
31
  s.add_development_dependency 'rubocop-performance', '~> 1.10.2'
32
+ s.add_development_dependency 'rubocop-rake', '~> 0.5.1'
34
33
  end
35
34
  s.add_dependency 'histogram'
36
35
  s.required_ruby_version = '>= 2.4.0'
37
36
 
38
37
  s.add_development_dependency 'rake'
39
- s.add_development_dependency 'parallel'
40
38
  s.add_development_dependency 'minitest-reporters'
41
39
  s.add_development_dependency 'simplecov'
42
40
  s.add_development_dependency 'yard', '~> 0.9.25'
data/lib/gruff.rb CHANGED
@@ -9,6 +9,7 @@ require 'gruff/version'
9
9
  patch/rmagick
10
10
  patch/string
11
11
 
12
+ font
12
13
  base
13
14
 
14
15
  helper/bar_conversion.rb
@@ -14,7 +14,9 @@
14
14
  # g.write('accumulator_bar.png')
15
15
  #
16
16
  class Gruff::AccumulatorBar < Gruff::StackedBar
17
- def draw
17
+ private
18
+
19
+ def setup_data
18
20
  raise(Gruff::IncorrectNumberOfDatasetsException) unless store.length == 1
19
21
 
20
22
  accum_array = store.data.first.points[0..-2].reduce([0]) { |a, v| a << a.last + v }
data/lib/gruff/area.rb CHANGED
@@ -20,19 +20,16 @@ class Gruff::Area < Gruff::Base
20
20
  # Specifies the stroke width in line around area graph. Default is +2.0+.
21
21
  attr_writer :stroke_width
22
22
 
23
- def initialize_ivars
23
+ private
24
+
25
+ def initialize_attributes
24
26
  super
25
27
  @sorted_drawing = true
26
28
  @fill_opacity = 0.85
27
29
  @stroke_width = 2.0
28
30
  end
29
- private :initialize_ivars
30
-
31
- def draw
32
- super
33
-
34
- return unless data_given?
35
31
 
32
+ def draw_graph
36
33
  x_increment = @graph_width / (column_count - 1).to_f
37
34
 
38
35
  store.norm_data.each do |data_row|
@@ -55,7 +52,7 @@ class Gruff::Area < Gruff::Base
55
52
  poly_points << @graph_left
56
53
  poly_points << @graph_bottom - 1
57
54
 
58
- Gruff::Renderer::Polygon.new(color: data_row.color, width: @stroke_width, opacity: @fill_opacity).render(poly_points)
55
+ Gruff::Renderer::Polygon.new(renderer, color: data_row.color, width: @stroke_width, opacity: @fill_opacity).render(poly_points)
59
56
  end
60
57
  end
61
58
  end