gruff 0.12.2 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +66 -0
  3. data/.gitignore +1 -0
  4. data/.rubocop.yml +34 -27
  5. data/CHANGELOG.md +29 -0
  6. data/README.md +15 -7
  7. data/assets/fonts/LICENSE.txt +202 -0
  8. data/assets/fonts/Roboto-Bold.ttf +0 -0
  9. data/assets/fonts/Roboto-Regular.ttf +0 -0
  10. data/gruff.gemspec +9 -10
  11. data/lib/gruff/accumulator_bar.rb +3 -1
  12. data/lib/gruff/area.rb +5 -8
  13. data/lib/gruff/bar.rb +32 -49
  14. data/lib/gruff/base.rb +199 -115
  15. data/lib/gruff/bezier.rb +4 -6
  16. data/lib/gruff/bullet.rb +12 -11
  17. data/lib/gruff/dot.rb +13 -14
  18. data/lib/gruff/font.rb +39 -0
  19. data/lib/gruff/helper/bar_conversion.rb +27 -12
  20. data/lib/gruff/helper/bar_value_label.rb +71 -0
  21. data/lib/gruff/helper/stacked_mixin.rb +1 -2
  22. data/lib/gruff/histogram.rb +9 -7
  23. data/lib/gruff/line.rb +57 -50
  24. data/lib/gruff/mini/bar.rb +9 -6
  25. data/lib/gruff/mini/legend.rb +12 -8
  26. data/lib/gruff/mini/pie.rb +9 -6
  27. data/lib/gruff/mini/side_bar.rb +9 -6
  28. data/lib/gruff/net.rb +9 -15
  29. data/lib/gruff/patch/rmagick.rb +0 -1
  30. data/lib/gruff/patch/string.rb +1 -1
  31. data/lib/gruff/pie.rb +23 -65
  32. data/lib/gruff/renderer/bezier.rb +8 -9
  33. data/lib/gruff/renderer/circle.rb +8 -9
  34. data/lib/gruff/renderer/dash_line.rb +9 -10
  35. data/lib/gruff/renderer/dot.rb +13 -14
  36. data/lib/gruff/renderer/ellipse.rb +8 -9
  37. data/lib/gruff/renderer/line.rb +8 -9
  38. data/lib/gruff/renderer/polygon.rb +9 -10
  39. data/lib/gruff/renderer/polyline.rb +8 -9
  40. data/lib/gruff/renderer/rectangle.rb +7 -8
  41. data/lib/gruff/renderer/renderer.rb +25 -40
  42. data/lib/gruff/renderer/text.rb +21 -29
  43. data/lib/gruff/scatter.rb +55 -75
  44. data/lib/gruff/scene.rb +28 -18
  45. data/lib/gruff/side_bar.rb +35 -54
  46. data/lib/gruff/side_stacked_bar.rb +14 -17
  47. data/lib/gruff/spider.rb +11 -20
  48. data/lib/gruff/stacked_area.rb +10 -11
  49. data/lib/gruff/stacked_bar.rb +14 -15
  50. data/lib/gruff/store/store.rb +6 -10
  51. data/lib/gruff/store/xy_data.rb +2 -0
  52. data/lib/gruff/themes.rb +6 -6
  53. data/lib/gruff/version.rb +1 -1
  54. data/lib/gruff.rb +68 -55
  55. data/rails_generators/gruff/templates/controller.rb +1 -1
  56. metadata +34 -20
  57. data/.rubocop_todo.yml +0 -190
  58. data/.travis.yml +0 -23
  59. data/assets/plastik/blue.png +0 -0
  60. data/assets/plastik/green.png +0 -0
  61. data/assets/plastik/red.png +0 -0
  62. data/lib/gruff/helper/bar_value_label_mixin.rb +0 -33
  63. data/lib/gruff/photo_bar.rb +0 -93
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea00c2968e40f335c5505b4ce5461fb9b5ec6488bfe48293829848fd2c57e2fc
4
- data.tar.gz: 860569d2e37c2b14aee89671d2bd4e76b409221a8e54712008009000c054a144
3
+ metadata.gz: c6b8682f3d05aa7d0a91ea58fbe907aa581f9a2ed7549f28376390fc0f2101ec
4
+ data.tar.gz: 31dc3d1b680b887405a66d8c1d14a2baea76b549958f4cd92bf3d2a6adae8ba3
5
5
  SHA512:
6
- metadata.gz: ec50aef23be4941687dc0822b02aec8daf083f1986f50054cae56562937c1788c4e6ff4f03bff6689732b3e88787fbbf42ea3bc6324d89f4b47dddfed23bbcb3
7
- data.tar.gz: 87d063e7f87081ad123e47610d173dc62e4f3c6200887021af40d389b39892b20b34d73757989eae383447308e34598198e47af33a48d1a184738c4a275361b9
6
+ metadata.gz: 5b5e6a29b5acf50408dd03a75f7acaa8830d96cf23bc02d6ac7a5ef9d713afcc41157fc2e94be8ab1611c624bc36398ba0e6793228f9ce75be009f59a9ac9f7c
7
+ data.tar.gz: 15766e34990536075a856d716d75f5e6d940f7bcb5d4dc9074040c82a8d418f95c0e3780bdbe36821a1c2aca66a07eaeaa11ff10622da7e29faf6347cac303af
@@ -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@v3
16
+ with:
17
+ ref: ${{ github.event.pull_request.head.sha }}
18
+ - name: Set up Ruby 2.5
19
+ uses: ruby/setup-ruby@master
20
+ with:
21
+ ruby-version: '2.5'
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.5', '2.6', '2.7', '3.0', '3.1']
36
+ name: Ruby ${{ matrix.ruby-version }}
37
+ steps:
38
+ - uses: actions/checkout@v3
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.20.1', '9.3.4.0']
55
+ name: JRuby ${{ matrix.ruby-version }}
56
+ steps:
57
+ - uses: actions/checkout@v3
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/.gitignore CHANGED
@@ -1,6 +1,7 @@
1
1
  *~
2
2
  /.idea/
3
3
  /pkg/
4
+ /coverage/
4
5
  /vendor/
5
6
  /test/output/
6
7
  /test/output_java/
data/.rubocop.yml CHANGED
@@ -1,13 +1,17 @@
1
- inherit_from: .rubocop_todo.yml
2
- require: rubocop-performance
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-rake
3
4
 
4
5
  AllCops:
5
6
  EnabledByDefault: true
6
- TargetRubyVersion: 2.4
7
+ TargetRubyVersion: 2.5
7
8
  Exclude:
8
9
  - 'vendor/bundle/**/*'
9
10
  - 'rails_generators/gruff/**/*'
10
11
 
12
+ Metrics:
13
+ Enabled: false
14
+
11
15
  Gemspec/OrderedDependencies:
12
16
  Enabled: false
13
17
 
@@ -23,9 +27,6 @@ Layout/ClassStructure:
23
27
  Layout/FirstMethodArgumentLineBreak:
24
28
  Enabled: false
25
29
 
26
- Layout/LeadingCommentSpace:
27
- Enabled: false
28
-
29
30
  Layout/LineLength:
30
31
  Max: 150
31
32
 
@@ -35,22 +36,37 @@ Layout/MultilineMethodArgumentLineBreaks:
35
36
  Layout/MultilineAssignmentLayout:
36
37
  EnforcedStyle: same_line
37
38
 
38
- Lint/AssignmentInCondition:
39
+ Layout/RedundantLineBreak:
40
+ Enabled: false
41
+
42
+ Layout/SingleLineBlockChain:
43
+ Enabled: false
44
+
45
+ Lint/AmbiguousOperatorPrecedence:
39
46
  Enabled: false
40
47
 
41
48
  Lint/ConstantResolution:
42
49
  Enabled: false
43
50
 
51
+ Lint/FloatComparison:
52
+ Enabled: false
53
+
44
54
  Lint/NumberConversion:
45
55
  Enabled: false
46
56
 
47
- Style/AccessorGrouping:
57
+ Naming/MemoizedInstanceVariableName:
48
58
  Enabled: false
49
59
 
50
- Style/ClassAndModuleChildren:
60
+ Naming/MethodParameterName:
61
+ Enabled: false
62
+
63
+ Naming/VariableNumber:
64
+ Enabled: false
65
+
66
+ Style/AccessorGrouping:
51
67
  Enabled: false
52
68
 
53
- Style/ConditionalAssignment:
69
+ Style/ClassAndModuleChildren:
54
70
  Enabled: false
55
71
 
56
72
  Style/ConstantVisibility:
@@ -62,15 +78,15 @@ Style/Copyright:
62
78
  Style/Documentation:
63
79
  Enabled: true
64
80
 
65
- Style/Encoding:
81
+ Style/DocumentationMethod:
82
+ Enabled: false
83
+
84
+ Style/DocumentDynamicEvalDefinition:
66
85
  Enabled: false
67
86
 
68
87
  Style/FormatString:
69
88
  EnforcedStyle: sprintf
70
89
 
71
- Style/FormatStringToken:
72
- Enabled: false
73
-
74
90
  Style/GuardClause:
75
91
  Enabled: false
76
92
 
@@ -92,35 +108,26 @@ Style/MethodCallWithArgsParentheses:
92
108
  Style/MissingElse:
93
109
  Enabled: false
94
110
 
95
- Style/MutableConstant:
96
- Enabled: false
97
-
98
111
  Style/Next:
99
112
  Enabled: false
100
113
 
101
- Style/NumericLiterals:
102
- Enabled: false
103
-
104
114
  Style/NumericPredicate:
105
115
  Enabled: false
106
116
 
107
117
  Style/OptionHash:
108
118
  Enabled: false
109
119
 
110
- Style/SingleLineBlockParams:
120
+ Style/RedundantBegin:
111
121
  Enabled: false
112
122
 
113
- Style/SpecialGlobalVars:
123
+ Style/SingleLineBlockParams:
114
124
  Enabled: false
115
125
 
116
126
  Style/StructInheritance:
117
127
  Enabled: false
118
128
 
119
- Style/SymbolArray:
120
- Enabled: false
121
-
122
- Style/TernaryParentheses:
129
+ Performance/ChainArrayAllocation:
123
130
  Enabled: false
124
131
 
125
- Performance/ChainArrayAllocation:
132
+ Performance/StringReplacement:
126
133
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
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
+
10
+ ## 0.14.0
11
+ - Update rails template (#547)
12
+ - Remove singleton in order to support multi-thread processing (#546)
13
+ - Fix bug in Gruff::Scatter that X coordinate value is wrong if set value in x_axis_increment (#534)
14
+ - Add marker_x_count attribute in Gruff::Line (#532)
15
+ - Add label_formatting attribute in Gruff::Pie (#531)
16
+ - Removed the ability to inject custom PieSlice classes from the outside (#530)
17
+ - Remove Gruff::PhotoBar (#513)
18
+ - Deprecate last_series_goes_on_bottom attribute in Gruff::StackedArea (#512)
19
+
20
+ ## 0.13.0
21
+ - Allow to customize label value with lambda (#510)
22
+ - Rename enable_vertical_line_markers attribute to show_vertical_markers (#509)
23
+ - Fix error that cause ArgumentError with x_axis_increment in Gruff::Scatter (#506)
24
+ - Fix draw_label that it should follow label_truncation_style setting (#505)
25
+ - Deprecate use_data_label attribute from SideBar (#504)
26
+ - Add negative values graph support in Gruff::SideBar (#499)
27
+ - Add margin of axis in order to avoid overwriting the coordinate axes (#497)
28
+ - Fix get_type_metrics error (#496)
29
+ - Embed Roboto as default font (#495)
30
+ - Fix legend rendering position when it enable legend_at_bottom (#492)
31
+
3
32
  ## 0.12.2
4
33
  - Avoid SEGV caused with '%S' in Draw#get_type_metrics by old ImageMagick (6.9.9 or below) (#490)
5
34
 
data/README.md CHANGED
@@ -28,6 +28,9 @@ Or install it yourself as:
28
28
  $ gem install gruff
29
29
  ```
30
30
 
31
+ ## Font
32
+ Gruff uses [Roboto](https://fonts.google.com/specimen/Roboto) font as default font which is licensed under the Apache License, Version 2.0.
33
+
31
34
  ## Usage
32
35
 
33
36
  ```ruby
@@ -130,24 +133,29 @@ http://www.rubydoc.info/github/topfunky/gruff/frames
130
133
 
131
134
  ## Supported Ruby Versions
132
135
 
133
- We aim to support all Ruby implementations supporting Ruby language level 1.9.3
134
- 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
135
138
 
136
- ## Development Setup
139
+ ## Development
137
140
  1. Build docker image
138
141
  ```sh
139
- $ ./docker/build.sh
142
+ $ ./docker-build.sh
140
143
  ```
141
144
 
142
145
  2. Launch docker image
143
146
  ```sh
144
- $ ./docker/launch.sh
147
+ $ ./docker-launch.sh
145
148
  ```
146
149
 
147
150
  3. Run tests
148
151
  ```sh
149
- $ bundle install
150
- $ bundle exec rake
152
+ $ rake
153
+ ```
154
+
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.
156
+
157
+ ```sh
158
+ $ rake test:image:update
151
159
  ```
152
160
 
153
161
  ## Contributing
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
Binary file
Binary file
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,12 +9,9 @@ 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
- s.files = `git ls-files`.split.reject do |f|
17
- f =~ /^test|^docker|^Rakefile/
18
- end
14
+ s.files = `git ls-files`.split.grep_v(/^test|^docker|^Rakefile/i)
19
15
  s.homepage = 'https://github.com/topfunky/gruff'
20
16
  s.require_paths = %w[lib]
21
17
  s.summary = 'Beautiful graphs for one or multiple datasets.'
@@ -28,15 +24,18 @@ Gem::Specification.new do |s|
28
24
  s.platform = 'java'
29
25
  s.add_dependency 'rmagick4j'
30
26
  else
31
- s.add_dependency 'rmagick'
32
- s.add_development_dependency 'rubocop', '~> 1.11.0'
33
- s.add_development_dependency 'rubocop-performance', '~> 1.10.1'
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'
34
31
  end
35
32
  s.add_dependency 'histogram'
36
- s.required_ruby_version = '>= 2.4.0'
33
+ s.required_ruby_version = '>= 2.5.0'
37
34
 
38
35
  s.add_development_dependency 'rake'
39
- s.add_development_dependency 'parallel'
40
36
  s.add_development_dependency 'minitest-reporters'
37
+ s.add_development_dependency 'simplecov'
41
38
  s.add_development_dependency 'yard', '~> 0.9.25'
39
+
40
+ s.metadata['rubygems_mfa_required'] = 'true'
42
41
  end
@@ -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