gruff 0.11.0-java → 0.12.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/gruff.gemspec +7 -3
  4. data/lib/gruff.rb +8 -3
  5. data/lib/gruff/accumulator_bar.rb +0 -2
  6. data/lib/gruff/area.rb +0 -4
  7. data/lib/gruff/bar.rb +18 -5
  8. data/lib/gruff/base.rb +78 -41
  9. data/lib/gruff/bezier.rb +0 -4
  10. data/lib/gruff/bullet.rb +2 -9
  11. data/lib/gruff/dot.rb +1 -5
  12. data/lib/gruff/helper/bar_conversion.rb +1 -1
  13. data/lib/gruff/helper/bar_value_label_mixin.rb +3 -0
  14. data/lib/gruff/histogram.rb +0 -1
  15. data/lib/gruff/line.rb +5 -11
  16. data/lib/gruff/mini/bar.rb +1 -1
  17. data/lib/gruff/mini/legend.rb +9 -4
  18. data/lib/gruff/mini/pie.rb +1 -2
  19. data/lib/gruff/mini/side_bar.rb +1 -2
  20. data/lib/gruff/net.rb +5 -6
  21. data/lib/gruff/patch/rmagick.rb +22 -24
  22. data/lib/gruff/patch/string.rb +7 -4
  23. data/lib/gruff/photo_bar.rb +0 -4
  24. data/lib/gruff/pie.rb +1 -5
  25. data/lib/gruff/renderer/bezier.rb +4 -3
  26. data/lib/gruff/renderer/circle.rb +4 -3
  27. data/lib/gruff/renderer/dash_line.rb +4 -3
  28. data/lib/gruff/renderer/dot.rb +4 -3
  29. data/lib/gruff/renderer/ellipse.rb +4 -3
  30. data/lib/gruff/renderer/line.rb +5 -4
  31. data/lib/gruff/renderer/polygon.rb +5 -4
  32. data/lib/gruff/renderer/polyline.rb +4 -3
  33. data/lib/gruff/renderer/rectangle.rb +3 -2
  34. data/lib/gruff/renderer/renderer.rb +31 -43
  35. data/lib/gruff/renderer/text.rb +10 -6
  36. data/lib/gruff/scatter.rb +1 -5
  37. data/lib/gruff/scene.rb +0 -1
  38. data/lib/gruff/side_bar.rb +22 -6
  39. data/lib/gruff/side_stacked_bar.rb +19 -6
  40. data/lib/gruff/spider.rb +2 -6
  41. data/lib/gruff/stacked_area.rb +0 -5
  42. data/lib/gruff/stacked_bar.rb +17 -5
  43. data/lib/gruff/store/{base_data.rb → basic_data.rb} +5 -7
  44. data/lib/gruff/store/custom_data.rb +4 -6
  45. data/lib/gruff/store/store.rb +5 -4
  46. data/lib/gruff/store/xy_data.rb +6 -7
  47. data/lib/gruff/version.rb +1 -1
  48. metadata +18 -15
  49. data/.editorconfig +0 -14
  50. data/.github/ISSUE_TEMPLATE.md +0 -18
  51. data/.gitignore +0 -10
  52. data/.rubocop.yml +0 -109
  53. data/.rubocop_todo.yml +0 -112
  54. data/.travis.yml +0 -26
  55. data/.yardopts +0 -1
  56. data/Rakefile +0 -47
  57. data/docker/Dockerfile +0 -14
  58. data/docker/build.sh +0 -4
  59. data/docker/launch.sh +0 -4
@@ -2,12 +2,10 @@
2
2
 
3
3
  module Gruff
4
4
  class Store
5
+ # @private
5
6
  class CustomData < Struct.new(:label, :points, :color, :custom)
6
7
  def initialize(label, points, color, custom = nil)
7
- self.label = label.to_s
8
- self.points = Array(points)
9
- self.color = color
10
- self.custom = custom
8
+ super(label.to_s, Array(points), color, custom)
11
9
  end
12
10
 
13
11
  def empty?
@@ -26,9 +24,9 @@ module Gruff
26
24
  points.compact.max
27
25
  end
28
26
 
29
- def normalize(args = {})
27
+ def normalize(minimum:, spread:)
30
28
  norm_points = points.map do |point|
31
- point.nil? ? nil : (point.to_f - args[:minimum].to_f) / args[:spread]
29
+ point.nil? ? nil : (point.to_f - minimum.to_f) / spread
32
30
  end
33
31
 
34
32
  self.class.new(label, norm_points, color, custom)
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gruff
4
+ # @private
4
5
  class Store
5
6
  attr_reader :data, :norm_data
6
7
 
@@ -15,10 +16,10 @@ module Gruff
15
16
  @data << @data_class.new(*args)
16
17
  end
17
18
 
18
- def normalize(args = {})
19
+ def normalize(**keywords)
19
20
  unless @normalized
20
21
  @data.each do |data_row|
21
- @norm_data << data_row.normalize(args)
22
+ @norm_data << data_row.normalize(**keywords)
22
23
  end
23
24
 
24
25
  @normalized = true
@@ -56,11 +57,11 @@ module Gruff
56
57
  end
57
58
 
58
59
  def sort_data!
59
- @data = @data.sort_by { |a| -a.points.reduce(0) { |acc, elem| acc + elem.to_f } }
60
+ @data = @data.sort_by { |a| -a.points.sum(&:to_f) }
60
61
  end
61
62
 
62
63
  def sort_norm_data!
63
- @norm_data = @norm_data.sort_by { |a| -a.points.reduce(0) { |acc, elem| acc + elem.to_f } }
64
+ @norm_data = @norm_data.sort_by { |a| -a.points.sum(&:to_f) }
64
65
  end
65
66
 
66
67
  def reverse!
@@ -2,12 +2,11 @@
2
2
 
3
3
  module Gruff
4
4
  class Store
5
+ # @private
5
6
  class XYData < Struct.new(:label, :y_points, :color, :x_points)
6
7
  def initialize(label, y_points, color, x_points = nil)
7
- self.label = label.to_s
8
- self.y_points = Array(y_points)
9
- self.color = color
10
- self.x_points = Array(x_points) if x_points
8
+ x_points = Array(x_points) if x_points
9
+ super(label.to_s, Array(y_points), color, x_points)
11
10
  end
12
11
 
13
12
  def x_points
@@ -44,12 +43,12 @@ module Gruff
44
43
  x_points.compact.max
45
44
  end
46
45
 
47
- def normalize(args = {})
46
+ def normalize(minimum_x:, minimum_y:, spread_x:, spread_y:)
48
47
  norm_x_points = x_points.map do |x|
49
- x.nil? ? nil : (x.to_f - args[:minimum_x].to_f) / args[:spread_x]
48
+ x.nil? ? nil : (x.to_f - minimum_x.to_f) / spread_x
50
49
  end
51
50
  norm_y_points = y_points.map do |y|
52
- y.nil? ? nil : (y.to_f - args[:minimum_y].to_f) / args[:spread_y]
51
+ y.nil? ? nil : (y.to_f - minimum_y.to_f) / spread_y
53
52
  end
54
53
 
55
54
  self.class.new(label, norm_y_points, color, norm_x_points)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gruff
4
- VERSION = '0.11.0'
4
+ VERSION = '0.12.0'
5
5
  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.11.0
4
+ version: 0.12.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: 2020-09-12 00:00:00.000000000 Z
12
+ date: 2020-10-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: !ruby/object:Gem::Requirement
@@ -53,6 +53,20 @@ dependencies:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ name: parallel
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
56
70
  - !ruby/object:Gem::Dependency
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
@@ -88,24 +102,13 @@ executables: []
88
102
  extensions: []
89
103
  extra_rdoc_files: []
90
104
  files:
91
- - ".editorconfig"
92
- - ".github/ISSUE_TEMPLATE.md"
93
- - ".gitignore"
94
- - ".rubocop.yml"
95
- - ".rubocop_todo.yml"
96
- - ".travis.yml"
97
- - ".yardopts"
98
105
  - CHANGELOG.md
99
106
  - Gemfile
100
107
  - MIT-LICENSE
101
108
  - README.md
102
- - Rakefile
103
109
  - assets/plastik/blue.png
104
110
  - assets/plastik/green.png
105
111
  - assets/plastik/red.png
106
- - docker/Dockerfile
107
- - docker/build.sh
108
- - docker/launch.sh
109
112
  - gruff.gemspec
110
113
  - init.rb
111
114
  - lib/gruff.rb
@@ -148,7 +151,7 @@ files:
148
151
  - lib/gruff/spider.rb
149
152
  - lib/gruff/stacked_area.rb
150
153
  - lib/gruff/stacked_bar.rb
151
- - lib/gruff/store/base_data.rb
154
+ - lib/gruff/store/basic_data.rb
152
155
  - lib/gruff/store/custom_data.rb
153
156
  - lib/gruff/store/store.rb
154
157
  - lib/gruff/store/xy_data.rb
@@ -169,7 +172,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
169
172
  requirements:
170
173
  - - ">="
171
174
  - !ruby/object:Gem::Version
172
- version: 1.9.3
175
+ version: 2.4.0
173
176
  required_rubygems_version: !ruby/object:Gem::Requirement
174
177
  requirements:
175
178
  - - ">="
@@ -1,14 +0,0 @@
1
- # EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs
2
- # @see http://editorconfig.org
3
- root = true
4
-
5
- [*]
6
- end_of_line = lf
7
- charset = utf-8
8
- trim_trailing_whitespace = true
9
- insert_final_newline = true
10
- indent_style = spaces
11
- tab_width = 2
12
-
13
- [{*.{rb,yml,md}]
14
- indent_size = 2
@@ -1,18 +0,0 @@
1
- ### Description
2
- <!-- A description of the bug or feature -->
3
-
4
- ### Steps to Reproduce
5
- <!-- List of steps, sample code, failing test or link to a project that reproduces the behavior.
6
- Make sure you place a stack trace inside a code (```) block to avoid linking unrelated issues -->
7
-
8
- ### System Configuration
9
- <!-- Tell us about the environment where you are experiencing the bug -->
10
-
11
- - ImageMagick version:
12
- - RMagick version:
13
- - Gruff version:
14
- - Ruby version:
15
- - Environment (Operating system, version and so on):
16
- - Additional information:
17
-
18
- <!-- Thanks for reporting the issue to Gruff! -->
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- *~
2
- /.idea/
3
- /pkg/
4
- /vendor/
5
- /test/output/
6
- /test/output_java/
7
- .DS_Store
8
- .bundle
9
- .yardoc
10
- Gemfile.lock
@@ -1,109 +0,0 @@
1
- inherit_from: .rubocop_todo.yml
2
-
3
- AllCops:
4
- EnabledByDefault: true
5
- Exclude:
6
- - 'vendor/bundle/**/*'
7
- - 'rails_generators/gruff/**/*'
8
-
9
- Gemspec/OrderedDependencies:
10
- Enabled: false
11
-
12
- Gemspec/RequiredRubyVersion:
13
- Enabled: false
14
-
15
- Layout/AccessModifierIndentation:
16
- EnforcedStyle: outdent
17
-
18
- Layout/ClassStructure:
19
- Enabled: false
20
-
21
- Layout/FirstMethodArgumentLineBreak:
22
- Enabled: false
23
-
24
- Layout/LeadingCommentSpace:
25
- Enabled: false
26
-
27
- Layout/MultilineMethodArgumentLineBreaks:
28
- Enabled: false
29
-
30
- Layout/MultilineAssignmentLayout:
31
- EnforcedStyle: same_line
32
-
33
- Lint/AssignmentInCondition:
34
- Enabled: false
35
-
36
- Lint/NumberConversion:
37
- Enabled: false
38
-
39
- Style/ClassAndModuleChildren:
40
- Enabled: false
41
-
42
- Style/ConditionalAssignment:
43
- Enabled: false
44
-
45
- Style/ConstantVisibility:
46
- Enabled: false
47
-
48
- Style/Copyright:
49
- Enabled: false
50
-
51
- Style/Encoding:
52
- Enabled: false
53
-
54
- Style/FormatString:
55
- EnforcedStyle: sprintf
56
-
57
- Style/FormatStringToken:
58
- Enabled: false
59
-
60
- Style/GuardClause:
61
- Enabled: false
62
-
63
- Style/HashSyntax:
64
- EnforcedStyle: ruby19_no_mixed_keys
65
-
66
- Style/IfUnlessModifier:
67
- Enabled: false
68
-
69
- Style/InlineComment:
70
- Enabled: false
71
-
72
- Style/ImplicitRuntimeError:
73
- Enabled: false
74
-
75
- Style/MethodCallWithArgsParentheses:
76
- Enabled: false
77
-
78
- Style/MissingElse:
79
- Enabled: false
80
-
81
- Style/MutableConstant:
82
- Enabled: false
83
-
84
- Style/Next:
85
- Enabled: false
86
-
87
- Style/NumericLiterals:
88
- Enabled: false
89
-
90
- Style/NumericPredicate:
91
- Enabled: false
92
-
93
- Style/OptionHash:
94
- Enabled: false
95
-
96
- Style/SingleLineBlockParams:
97
- Enabled: false
98
-
99
- Style/SpecialGlobalVars:
100
- Enabled: false
101
-
102
- Style/StructInheritance:
103
- Enabled: false
104
-
105
- Style/SymbolArray:
106
- Enabled: false
107
-
108
- Style/TernaryParentheses:
109
- Enabled: false
@@ -1,112 +0,0 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2020-05-24 08:35:04 +0000 using RuboCop version 0.81.0.
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: 1
10
- Lint/DuplicateMethods:
11
- Exclude:
12
- - 'lib/gruff/photo_bar.rb'
13
-
14
- # Offense count: 1
15
- Lint/UnreachableCode:
16
- Exclude:
17
- - 'lib/gruff/photo_bar.rb'
18
-
19
- # Offense count: 1
20
- Lint/UselessAssignment:
21
- Exclude:
22
- - 'lib/gruff/photo_bar.rb'
23
-
24
- # Offense count: 1
25
- # Configuration parameters: CheckForMethodsWithNoSideEffects.
26
- Lint/Void:
27
- Exclude:
28
- - 'lib/gruff/patch/rmagick.rb'
29
-
30
- # Offense count: 49
31
- # Configuration parameters: IgnoredMethods.
32
- Metrics/AbcSize:
33
- Max: 78
34
-
35
- # Offense count: 1
36
- # Configuration parameters: CountComments, ExcludedMethods.
37
- # ExcludedMethods: refine
38
- Metrics/BlockLength:
39
- Max: 29
40
-
41
- # Offense count: 12
42
- # Configuration parameters: CountComments.
43
- Metrics/ClassLength:
44
- Max: 637
45
-
46
- # Offense count: 12
47
- # Configuration parameters: IgnoredMethods.
48
- Metrics/CyclomaticComplexity:
49
- Max: 17
50
-
51
- # Offense count: 126
52
- # Configuration parameters: CountComments, ExcludedMethods.
53
- Metrics/MethodLength:
54
- Max: 81
55
-
56
- # Offense count: 2
57
- # Configuration parameters: CountKeywordArgs.
58
- Metrics/ParameterLists:
59
- Max: 7
60
-
61
- # Offense count: 9
62
- # Configuration parameters: IgnoredMethods.
63
- Metrics/PerceivedComplexity:
64
- Max: 20
65
-
66
- # Offense count: 1
67
- # Configuration parameters: EnforcedStyleForLeadingUnderscores.
68
- # SupportedStylesForLeadingUnderscores: disallowed, required, optional
69
- Naming/MemoizedInstanceVariableName:
70
- Exclude:
71
- - 'lib/gruff/scene.rb'
72
-
73
- # Offense count: 7
74
- # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
75
- # AllowedNames: io, id, to, by, on, in, at, ip, db, os, pp
76
- Naming/MethodParameterName:
77
- Exclude:
78
- - 'lib/gruff/base.rb'
79
- - 'lib/gruff/patch/rmagick.rb'
80
- - 'lib/gruff/pie.rb'
81
- - 'lib/gruff/renderer/text.rb'
82
-
83
- # Offense count: 2
84
- Security/Eval:
85
- Exclude:
86
- - 'test/gruff_test_case.rb'
87
-
88
- # Offense count: 39
89
- Style/Documentation:
90
- Enabled: false
91
-
92
- # Offense count: 134
93
- # Configuration parameters: RequireForNonPublicMethods.
94
- Style/DocumentationMethod:
95
- Enabled: false
96
-
97
- # Offense count: 3
98
- Style/EvalWithLocation:
99
- Exclude:
100
- - 'test/gruff_test_case.rb'
101
-
102
- # Offense count: 1
103
- Style/MissingRespondToMissing:
104
- Exclude:
105
- - 'lib/gruff/scene.rb'
106
-
107
- # Offense count: 406
108
- # Cop supports --auto-correct.
109
- # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
110
- # URISchemes: http, https
111
- Layout/LineLength:
112
- Max: 164