gruff 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +5 -5
  2. data/.editorconfig +14 -0
  3. data/.rubocop.yml +16 -0
  4. data/.rubocop_todo.yml +923 -0
  5. data/.travis.yml +21 -14
  6. data/{History.txt → CHANGELOG.md} +32 -25
  7. data/README.md +3 -2
  8. data/Rakefile +27 -18
  9. data/assets/bubble.png +0 -0
  10. data/assets/city_scene/background/0000.png +0 -0
  11. data/assets/city_scene/background/0600.png +0 -0
  12. data/assets/city_scene/background/2000.png +0 -0
  13. data/assets/city_scene/clouds/cloudy.png +0 -0
  14. data/assets/city_scene/clouds/partly_cloudy.png +0 -0
  15. data/assets/city_scene/clouds/stormy.png +0 -0
  16. data/assets/city_scene/grass/default.png +0 -0
  17. data/assets/city_scene/haze/true.png +0 -0
  18. data/assets/city_scene/number_sample/1.png +0 -0
  19. data/assets/city_scene/number_sample/2.png +0 -0
  20. data/assets/city_scene/number_sample/default.png +0 -0
  21. data/assets/city_scene/sky/0000.png +0 -0
  22. data/assets/city_scene/sky/0200.png +0 -0
  23. data/assets/city_scene/sky/0400.png +0 -0
  24. data/assets/city_scene/sky/0600.png +0 -0
  25. data/assets/city_scene/sky/0800.png +0 -0
  26. data/assets/city_scene/sky/1000.png +0 -0
  27. data/assets/city_scene/sky/1200.png +0 -0
  28. data/assets/city_scene/sky/1400.png +0 -0
  29. data/assets/city_scene/sky/1500.png +0 -0
  30. data/assets/city_scene/sky/1700.png +0 -0
  31. data/assets/city_scene/sky/2000.png +0 -0
  32. data/assets/pc306715.jpg +0 -0
  33. data/assets/plastik/blue.png +0 -0
  34. data/assets/plastik/green.png +0 -0
  35. data/assets/plastik/red.png +0 -0
  36. data/gruff.gemspec +12 -10
  37. data/lib/gruff.rb +2 -2
  38. data/lib/gruff/accumulator_bar.rb +2 -2
  39. data/lib/gruff/area.rb +1 -4
  40. data/lib/gruff/bar.rb +12 -13
  41. data/lib/gruff/bar_conversion.rb +11 -11
  42. data/lib/gruff/base.rb +36 -36
  43. data/lib/gruff/bezier.rb +1 -2
  44. data/lib/gruff/bullet.rb +7 -10
  45. data/lib/gruff/deprecated.rb +10 -11
  46. data/lib/gruff/dot.rb +3 -4
  47. data/lib/gruff/line.rb +13 -14
  48. data/lib/gruff/mini/bar.rb +3 -3
  49. data/lib/gruff/mini/legend.rb +7 -8
  50. data/lib/gruff/mini/pie.rb +6 -6
  51. data/lib/gruff/mini/side_bar.rb +7 -7
  52. data/lib/gruff/net.rb +2 -8
  53. data/lib/gruff/photo_bar.rb +9 -12
  54. data/lib/gruff/pie.rb +6 -6
  55. data/lib/gruff/scatter.rb +47 -51
  56. data/lib/gruff/scene.rb +17 -19
  57. data/lib/gruff/side_bar.rb +5 -8
  58. data/lib/gruff/side_stacked_bar.rb +24 -26
  59. data/lib/gruff/spider.rb +14 -15
  60. data/lib/gruff/stacked_area.rb +12 -16
  61. data/lib/gruff/stacked_bar.rb +50 -52
  62. data/lib/gruff/stacked_mixin.rb +2 -3
  63. data/lib/gruff/themes.rb +32 -33
  64. data/lib/gruff/version.rb +1 -1
  65. metadata +23 -67
  66. data/RELEASE.md +0 -30
  67. data/test/gruff_test_case.rb +0 -152
  68. data/test/image_compare.rb +0 -58
  69. data/test/test_accumulator_bar.rb +0 -51
  70. data/test/test_area.rb +0 -134
  71. data/test/test_bar.rb +0 -505
  72. data/test/test_base.rb +0 -33
  73. data/test/test_bezier.rb +0 -33
  74. data/test/test_bullet.rb +0 -26
  75. data/test/test_dot.rb +0 -263
  76. data/test/test_labels_for_null_data.rb +0 -27
  77. data/test/test_legend.rb +0 -68
  78. data/test/test_line.rb +0 -674
  79. data/test/test_mini_bar.rb +0 -33
  80. data/test/test_mini_pie.rb +0 -25
  81. data/test/test_mini_side_bar.rb +0 -36
  82. data/test/test_net.rb +0 -231
  83. data/test/test_photo.rb +0 -41
  84. data/test/test_pie.rb +0 -194
  85. data/test/test_scatter.rb +0 -270
  86. data/test/test_scene.rb +0 -100
  87. data/test/test_side_bar.rb +0 -56
  88. data/test/test_sidestacked_bar.rb +0 -105
  89. data/test/test_spider.rb +0 -226
  90. data/test/test_stacked_area.rb +0 -52
  91. data/test/test_stacked_bar.rb +0 -68
@@ -1,19 +1,26 @@
1
1
  language: ruby
2
2
  sudo: false
3
+ cache: bundler
4
+
3
5
  rvm:
4
- - "1.9.3"
5
- - "2.0.0"
6
- - "2.1"
7
- - "2.2"
8
- - "2.3.1"
9
- - jruby-1.7.25
6
+ - 2.3
7
+ - 2.4
8
+ - 2.5
9
+ - 2.6
10
+ - 2.7
11
+ - jruby-1.7.26
10
12
  - jruby-9.0.5.0
11
- - jruby-9.1.2.0
13
+ - jruby-9.1.9.0
12
14
  - jruby-head
13
- - rbx
14
- - rbx-2
15
- before_install:
16
- - gem query -i -n ^bundler$ > /dev/null || gem install --no-ri --no-rdoc bundler
17
- notifications:
18
- email:
19
- - uwe@kubosch.no
15
+
16
+ jobs:
17
+ include:
18
+ - name: 'Lint'
19
+ rvm: 2.3
20
+ script: bundle exec rubocop
21
+
22
+ addons:
23
+ apt:
24
+ packages:
25
+ - gsfonts
26
+ - ghostscript
@@ -1,4 +1,11 @@
1
- == 0.5.1
1
+ # Change Log
2
+
3
+ ## 0.8.0
4
+
5
+ * Remove version restriction in RMagick (#186)
6
+ * Remove the upper limit (< Ruby 3.0) from the required Ruby version (#207)
7
+
8
+ ## 0.5.1
2
9
 
3
10
  Skip packaging the test images. This reduces the gem from 20MB+ to
4
11
  300KB+.
@@ -8,7 +15,7 @@ Bugfixes:
8
15
  * Issue #92 Reduce the gem size by not shipping the test images.
9
16
 
10
17
 
11
- == 0.5.0
18
+ ## 0.5.0
12
19
 
13
20
  We have added a couple of cosmetic changes: Multiple marker lines both
14
21
  vertically and horizontally, and multi-line titles, or no title at all if
@@ -29,7 +36,7 @@ Pull requests:
29
36
  * Issue #90 Added missing parenthesis in base.rb
30
37
 
31
38
 
32
- == 0.4.0
39
+ ## 0.4.0
33
40
 
34
41
  All old branches and pull requests have been merged or deleted. Over 40
35
42
  issues have been resolved! Ruby 2.0 compatibility has been confirmed.
@@ -101,55 +108,55 @@ Internal:
101
108
  * Issue #80 Remove the .rmvrc file from the project
102
109
 
103
110
 
104
- == 0.3.7
111
+ ## 0.3.7
105
112
 
106
113
  * ???
107
114
 
108
- == 0.3.6
115
+ ## 0.3.6
109
116
 
110
117
  * Fixed manifest to list dot graph [theirishpenguin]
111
118
  * Fixed color cycling error [Gunnar Wolf]
112
119
  * Handle case where a line graph data set only has one value [Ron Colwill]
113
120
 
114
- == 0.3.5
121
+ ## 0.3.5
115
122
 
116
123
  * Added dot graph from Erik Andrejko
117
124
 
118
- == 0.3.4
125
+ ## 0.3.4
119
126
 
120
127
  * Reverted DEBUG=true. Will add a check in the release process so this doesn't happen again.
121
128
  * Future releases will end in an odd number for development (topfunky-gruff on GitHub) or even for production releases.
122
129
 
123
- == 0.3.3
130
+ ## 0.3.3
124
131
 
125
132
  * Legend line wrapping [Mat Schaffer]
126
133
  * Stacked area graph fixes [James Coglan]
127
134
 
128
- == 0.3.2
135
+ ## 0.3.2
129
136
 
130
137
  * Include init.rb for use as a Rails plugin.
131
138
 
132
- == 0.3.1
139
+ ## 0.3.1
133
140
 
134
141
  * Fixed missing bullet graph bug (experimental, will be in a future release).
135
142
 
136
- == 0.3.0
143
+ ## 0.3.0
137
144
 
138
145
  * Fixed bug where pie graphs weren't drawing their label correctly.
139
146
 
140
- == 0.2.9
147
+ ## 0.2.9
141
148
 
142
149
  * Patch to make SideBar accurate instead of stacked [Marik]
143
150
  * Will be extracting net, pie, stacked, and side-stacked to separate gem
144
151
  in next release.
145
152
 
146
- == 0.2.8
153
+ ## 0.2.8
147
154
 
148
155
  * New accumulator bar graph (experimental)
149
156
  * Better mini graphs
150
157
  * Bug fixes
151
158
 
152
- == 0.2.7
159
+ ## 0.2.7
153
160
 
154
161
  * Regenerated Manifest.txt
155
162
  * Added scene sample to package
@@ -158,27 +165,27 @@ Internal:
158
165
  * Increased size of numbers in Gruff::Mini::Pie
159
166
  * Added legend_box_size accessor
160
167
 
161
- == 0.2.6
168
+ ## 0.2.6
162
169
 
163
170
  * Fixed missing side_bar.rb in Manifest.txt
164
171
 
165
- == 0.2.5
172
+ ## 0.2.5
166
173
 
167
174
  * New mini graph types (Experimental)
168
175
  * Marker lines can be different color than text labels
169
176
  * Theme definition cleanup
170
177
 
171
- == 0.2.4
178
+ ## 0.2.4
172
179
 
173
180
  * Added option to hide line numbers
174
181
  * Fixed code that was causing warnings
175
182
 
176
- == 0.2.3
183
+ ## 0.2.3
177
184
 
178
185
  * Cleaned up measurements so the graph expands to fill the available space
179
186
  * Added x-axis and y-axis label options
180
187
 
181
- == 0.1.2
188
+ ## 0.1.2
182
189
 
183
190
  * minimum_value and maximum_value can be set after data() to manually scale the graph
184
191
  * Fixed infinite loop bug when values are all equal
@@ -187,17 +194,17 @@ Internal:
187
194
  * Initial refactoring of tests
188
195
  * A host of other bug fixes
189
196
 
190
- == 0.0.8
197
+ ## 0.0.8
191
198
 
192
199
  * NEW Sidestacked Bar Graphs. [Alun Eyre]
193
200
  * baseline_value larger than data will now show correctly. [Mike Perham]
194
201
  * hide_dots and hide_lines are now options for line graphs.
195
202
 
196
- == 0.0.6
203
+ ## 0.0.6
197
204
 
198
205
  * Fixed hang when no data is passed.
199
206
 
200
- == 0.0.4
207
+ ## 0.0.4
201
208
 
202
209
  * Added bar graphs
203
210
  * Added area graphs
@@ -207,18 +214,18 @@ Internal:
207
214
  * Added initial line marker rounding to significant digits (Christian Winkler)
208
215
  * Line graphs line width is scaled with number of points being drawn (Christian Winkler)
209
216
 
210
- == 0.0.3
217
+ ## 0.0.3
211
218
 
212
219
  * Added option to draw line graphs without the lines (points only), thanks to Eric Hodel
213
220
  * Removed font-minimum check so graphs look better at 300px width
214
221
 
215
- == 0.0.2
222
+ ## 0.0.2
216
223
 
217
224
  * Fixed to_blob (thanks to Carlos Villela)
218
225
  * Added bar graphs (initial functionality...will be enhanced)
219
226
  * Removed rendered test output from gem
220
227
 
221
- == 0.0.1
228
+ ## 0.0.1
222
229
 
223
230
  * Initial release.
224
231
  * Line graphs only. Other graph styles coming soon.
data/README.md CHANGED
@@ -5,6 +5,9 @@
5
5
 
6
6
  A library for making beautiful graphs.
7
7
 
8
+ Built on top of [rmagick](https://github.com/rmagick/rmagick); see its web page
9
+ for a list of the system-level prerequisities (ImageMagick etc) and how to install them.
10
+
8
11
  ## Installation
9
12
 
10
13
  Add this line to your application's Gemfile:
@@ -42,8 +45,6 @@ You can find many examples in the [test](https://github.com/topfunky/gruff/tree/
42
45
  directory along with their resulting charts in the
43
46
  [output](https://github.com/topfunky/gruff/tree/master/test/output) directory.
44
47
 
45
- You can find older examples here: http://nubyonrails.com/pages/gruff
46
-
47
48
  ### Accumulator bar chart
48
49
 
49
50
  ![Accumulator bar chart](https://raw.github.com/topfunky/gruff/master/test/output/accum_bar.png)
data/Rakefile CHANGED
@@ -3,18 +3,18 @@ require 'bundler/gem_tasks'
3
3
  require 'rake/testtask'
4
4
  require 'rake/clean'
5
5
 
6
- CLEAN.concat %w(pkg test/output/*)
6
+ CLEAN.concat %w[pkg test/output/*]
7
7
 
8
8
  desc 'Run tests'
9
- task :default => :test
9
+ task default: :test
10
10
 
11
- task :gem => :build
11
+ task gem: :build
12
12
 
13
13
  Rake::TestTask.new
14
14
 
15
15
  namespace :test do
16
16
  desc 'Run mini tests'
17
- task :mini => :clean do
17
+ task mini: :clean do
18
18
  Dir['test/test_mini*'].each do |file|
19
19
  system "ruby #{file}"
20
20
  end
@@ -24,6 +24,7 @@ end
24
24
  desc 'Generate release docs for a given milestone'
25
25
  task :release_docs do
26
26
  raise "\n This task requires Ruby 1.9 or newer to parse JSON as YAML.\n\n" if RUBY_VERSION == '1.8.7'
27
+
27
28
  categories, grouped_issues, milestone, milestone_description, milestone_name = get_github_issues
28
29
 
29
30
  puts '=' * 80
@@ -39,7 +40,7 @@ New in version #{milestone_name}:
39
40
 
40
41
  #{(categories.keys & grouped_issues.keys).map do |cat|
41
42
  "#{cat}:\n
42
- #{grouped_issues[cat].map { |i| wrap(%Q{* Issue ##{i['number']} #{i['title']}},2) }.join("\n")}
43
+ #{grouped_issues[cat].map { |i| wrap(%Q(* Issue ##{i['number']} #{i['title']}), 2) }.join("\n")}
43
44
  "
44
45
  end.join("\n")}
45
46
  You can find a complete list of issues here:
@@ -89,7 +90,7 @@ task :stats do
89
90
  counts_per_month = Hash.new { |h, k| h[k] = Hash.new { |mh, mk| mh[mk] = 0 } }
90
91
  total = 0
91
92
 
92
- %w{gruff}.each do |gem|
93
+ %w[gruff].each do |gem|
93
94
  versions_uri = URI("#{base_uri}/versions/#{gem}.yaml")
94
95
  req = Net::HTTP::Get.new(versions_uri.request_uri)
95
96
  res = https.start { |http| http.request(req) }
@@ -107,7 +108,8 @@ task :stats do
107
108
  counts_per_month[date.year][date.month] += count
108
109
  total += count
109
110
  end
110
- print '.'; STDOUT.flush
111
+ print '.'
112
+ STDOUT.flush
111
113
  end
112
114
  puts
113
115
  end
@@ -130,14 +132,14 @@ task :stats do
130
132
  years = counts_per_month.keys
131
133
  puts ' ' + years.map { |year| '%-12s' % year }.join
132
134
  (0..20).each do |l|
133
- print (l % 10 == 0) ? '%4d' % ((20-l) * 100) : ' '
135
+ print (l % 10 == 0) ? '%4d' % ((20 - l) * 100) : ' '
134
136
  years.each do |year|
135
137
  (1..12).each do |month|
136
138
  count = counts_per_month[year][month]
137
139
  if [year, month] == [Date.today.year, Date.today.month]
138
140
  count *= (Date.new(Date.today.year, Date.today.month, -1).day.to_f / Date.today.day).to_i
139
141
  end
140
- print count > ((20-l) * 100) ? '*' : ' '
142
+ print count > ((20 - l) * 100) ? '*' : ' '
141
143
  end
142
144
  end
143
145
  puts
@@ -147,7 +149,6 @@ task :stats do
147
149
  puts "\nTotal: #{total}\n\n"
148
150
  end
149
151
 
150
-
151
152
  def get_github_issues
152
153
  puts 'GitHub login:'
153
154
  begin
@@ -156,8 +157,11 @@ def get_github_issues
156
157
  user = ask('login : ') { |q| q.echo = true }
157
158
  pass = ask('password: ') { |q| q.echo = '*' }
158
159
  rescue Exception
159
- print 'user name: '; user = STDIN.gets.chomp
160
- print ' password: '; pass = STDIN.gets.chomp
160
+ print 'user name: '
161
+ user = STDIN.gets.chomp
162
+
163
+ print ' password: '
164
+ pass = STDIN.gets.chomp
161
165
  end
162
166
  require 'uri'
163
167
  require 'net/http'
@@ -180,7 +184,8 @@ def get_github_issues
180
184
  if defined? ask
181
185
  milestone = ask('milestone: ', Integer) { |q| q.echo = true }
182
186
  else
183
- print 'milestone: '; milestone = STDIN.gets.chomp
187
+ print 'milestone: '
188
+ milestone = STDIN.gets.chomp
184
189
  end
185
190
 
186
191
  uri = URI("#{base_uri}/issues?milestone=#{milestone}&state=closed&per_page=1000")
@@ -190,11 +195,16 @@ def get_github_issues
190
195
  issues = YAML.load(res.body).sort_by { |i| i['number'] }
191
196
  milestone_name = issues[0] ? issues[0]['milestone']['title'] : "No issues for milestone #{milestone}"
192
197
  milestone_description = issues[0] ? issues[0]['milestone']['description'] : "No issues for milestone #{milestone}"
193
- milestone_description = milestone_description.split("\r\n").map{|l|wrap l}.join("\r\n")
198
+ milestone_description = milestone_description.split("\r\n").map { |l| wrap l }.join("\r\n")
194
199
  categories = {
195
- 'Features' => 'feature', 'Bugfixes' => 'bug', 'Support' => 'support',
196
- 'Documentation' => 'documentation', 'Pull requests' => nil,
197
- 'Internal' => 'internal', 'Rejected' => 'rejected', 'Other' => nil
200
+ 'Features' => 'feature',
201
+ 'Bugfixes' => 'bug',
202
+ 'Support' => 'support',
203
+ 'Documentation' => 'documentation',
204
+ 'Pull requests' => nil,
205
+ 'Internal' => 'internal',
206
+ 'Rejected' => 'rejected',
207
+ 'Other' => nil
198
208
  }
199
209
  grouped_issues = issues.group_by do |i|
200
210
  labels = i['labels'].map { |l| l['name'] }
@@ -215,4 +225,3 @@ end
215
225
  def wrap(string, indent = 0)
216
226
  string.scan(/\S.{0,72}\S(?=\s|$)|\S+/).join("\n" + ' ' * indent)
217
227
  end
218
-
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -5,28 +5,30 @@ require 'date'
5
5
  require 'gruff/version'
6
6
 
7
7
  Gem::Specification.new do |s|
8
- s.name = %q{gruff}
8
+ s.name = %q(gruff)
9
9
  s.version = Gruff::VERSION
10
10
  s.authors = ['Geoffrey Grosenbach', 'Uwe Kubosch']
11
11
  s.date = Date.today.to_s
12
- s.description = %q{Beautiful graphs for one or multiple datasets. Can be used on websites or in documents.}
13
- s.email = %q{boss@topfunky.com}
14
- s.files = `git ls-files`.split($/).reject{|f| f =~ /^test#{File::ALT_SEPARATOR || File::SEPARATOR}output/}
15
- s.homepage = %q{https://github.com/topfunky/gruff}
16
- s.require_paths = %w(lib)
17
- s.summary = %q{Beautiful graphs for one or multiple datasets.}
12
+ s.description = %q(Beautiful graphs for one or multiple datasets. Can be used on websites or in documents.)
13
+ s.email = %q(boss@topfunky.com)
14
+ s.files = `git ls-files`.split($/).reject { |f| f =~ /^test/ }
15
+ s.homepage = %q(https://github.com/topfunky/gruff)
16
+ s.require_paths = %w[lib]
17
+ s.summary = %q(Beautiful graphs for one or multiple datasets.)
18
18
  s.license = 'MIT'
19
19
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
20
20
  s.executables = s.files.grep(%r{^bin/}).map { |f| File.basename(f) }
21
21
  s.specification_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
22
- s.required_ruby_version = ['>= 1.9.3', '< 3']
23
22
 
24
23
  if defined? JRUBY_VERSION
25
24
  s.platform = 'java'
26
- s.add_dependency 'rmagick4j', '~> 0.3', '>= 0.3.9'
25
+ s.add_dependency 'rmagick4j'
27
26
  else
28
- s.add_dependency 'rmagick', '~> 2.13', '>= 2.13.4'
27
+ s.add_dependency 'rmagick'
28
+ s.add_development_dependency 'rubocop', '~> 0.81.0'
29
29
  end
30
+ s.required_ruby_version = '>= 1.9.3'
31
+
30
32
  s.add_development_dependency('rake')
31
33
  s.add_development_dependency('minitest-reporters')
32
34
  end