sparklines 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/{CHANGELOG → History.txt} +4 -0
- data/Manifest.txt +2 -1
- data/README.txt +4 -4
- data/Rakefile +13 -3
- data/lib/sparklines.rb +7 -3
- data/test/expected/zeros.png +0 -0
- data/test/test_all.rb +11 -1
- metadata +8 -5
data/{CHANGELOG → History.txt}
RENAMED
data/Manifest.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
History.txt
|
2
2
|
MIT-LICENSE
|
3
3
|
Manifest.txt
|
4
4
|
README.txt
|
@@ -61,4 +61,5 @@ test/expected/whisker.png
|
|
61
61
|
test/expected/whisker_junk.png
|
62
62
|
test/expected/whisker_non_exceptional.png
|
63
63
|
test/expected/whisker_with_step.png
|
64
|
+
test/expected/zeros.png
|
64
65
|
test/test_all.rb
|
data/README.txt
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
A library for generating small sparkline graphs from Ruby. Use it in desktop apps or with Ruby on Rails.
|
4
4
|
|
5
|
-
==
|
5
|
+
== Source
|
6
6
|
|
7
|
-
http://
|
7
|
+
http://github.com/topfunky/sparklines
|
8
8
|
|
9
|
-
==
|
9
|
+
== Other info
|
10
10
|
|
11
|
-
http://
|
11
|
+
http://nubyonrails.com/pages/sparklines
|
12
12
|
|
13
13
|
== Authors
|
14
14
|
|
data/Rakefile
CHANGED
@@ -11,12 +11,22 @@ Hoe.new('Sparklines', Sparklines::VERSION) do |p|
|
|
11
11
|
p.email = 'boss@topfunky.com'
|
12
12
|
p.summary = "Tiny graphs."
|
13
13
|
p.url = "http://nubyonrails.com/pages/sparklines"
|
14
|
-
p.clean_globs = ['test/actual'] # Remove this directory on "rake clean"
|
14
|
+
p.clean_globs = ['test/actual', 'email.txt'] # Remove this directory on "rake clean"
|
15
15
|
p.remote_rdoc_dir = '' # Release to root
|
16
|
-
p.changes = p.paragraphs_of('
|
16
|
+
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
|
17
17
|
# * extra_deps - An array of rubygem dependencies.
|
18
18
|
end
|
19
19
|
|
20
|
-
|
21
20
|
desc "Release and publish documentation"
|
22
21
|
task :repubdoc => [:release, :publish_docs]
|
22
|
+
|
23
|
+
|
24
|
+
desc "Simple require on packaged files to make sure they are all there"
|
25
|
+
task :verify => :package do
|
26
|
+
# An error message will be displayed if files are missing
|
27
|
+
if system %(ruby -e "require 'pkg/sparklines-#{Sparklines::VERSION}/lib/sparklines'")
|
28
|
+
puts "\nThe library files are present"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
task :release => :verify
|
data/lib/sparklines.rb
CHANGED
@@ -75,7 +75,7 @@ Licensed under the MIT license.
|
|
75
75
|
=end
|
76
76
|
class Sparklines
|
77
77
|
|
78
|
-
VERSION = '0.5.
|
78
|
+
VERSION = '0.5.2'
|
79
79
|
|
80
80
|
@@label_margin = 5.0
|
81
81
|
@@pointsize = 10.0
|
@@ -634,7 +634,7 @@ class Sparklines
|
|
634
634
|
end
|
635
635
|
|
636
636
|
@maximum_value = @data.max
|
637
|
-
|
637
|
+
|
638
638
|
case @options[:type].to_s
|
639
639
|
when 'pie'
|
640
640
|
@norm_data = @data
|
@@ -642,7 +642,11 @@ class Sparklines
|
|
642
642
|
@norm_data = @data
|
643
643
|
else
|
644
644
|
@norm_data = @data.map do |value|
|
645
|
-
|
645
|
+
if @maximum_value == @minimum_value
|
646
|
+
value = @maximum_value
|
647
|
+
else
|
648
|
+
value = ((value.to_f - @minimum_value)/(@maximum_value - @minimum_value)) * 100.0
|
649
|
+
end
|
646
650
|
end
|
647
651
|
end
|
648
652
|
end
|
Binary file
|
data/test/test_all.rb
CHANGED
@@ -267,6 +267,13 @@ class SparklinesTest < Test::Unit::TestCase
|
|
267
267
|
})
|
268
268
|
end
|
269
269
|
|
270
|
+
def test_zeros
|
271
|
+
@data = [0,0,0,0]
|
272
|
+
quick_graph('zeros', {
|
273
|
+
:type => 'smooth',
|
274
|
+
})
|
275
|
+
end
|
276
|
+
|
270
277
|
private
|
271
278
|
|
272
279
|
def quick_graph(name, options)
|
@@ -286,7 +293,7 @@ END {
|
|
286
293
|
[image_tag("../../" + record), image_tag("../../" + record.gsub('expected', 'actual'))]
|
287
294
|
end
|
288
295
|
FileUtils.mkdir_p("test/actual")
|
289
|
-
File.open("test/actual/
|
296
|
+
File.open("test/actual/index.html", "w") do |f|
|
290
297
|
f.write <<-EOL
|
291
298
|
<style>
|
292
299
|
.first_column {
|
@@ -295,6 +302,9 @@ END {
|
|
295
302
|
.last_column {
|
296
303
|
text-align: left;
|
297
304
|
}
|
305
|
+
img {
|
306
|
+
border: 1px solid #e0e0e0;
|
307
|
+
}
|
298
308
|
</style>
|
299
309
|
EOL
|
300
310
|
f.write output
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sparklines
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geoffrey Grosenbach
|
@@ -9,17 +9,18 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-08-20 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: hoe
|
17
|
+
type: :development
|
17
18
|
version_requirement:
|
18
19
|
version_requirements: !ruby/object:Gem::Requirement
|
19
20
|
requirements:
|
20
21
|
- - ">="
|
21
22
|
- !ruby/object:Gem::Version
|
22
|
-
version: 1.
|
23
|
+
version: 1.7.0
|
23
24
|
version:
|
24
25
|
description: Tiny graphs.
|
25
26
|
email: boss@topfunky.com
|
@@ -28,10 +29,11 @@ executables: []
|
|
28
29
|
extensions: []
|
29
30
|
|
30
31
|
extra_rdoc_files:
|
32
|
+
- History.txt
|
31
33
|
- Manifest.txt
|
32
34
|
- README.txt
|
33
35
|
files:
|
34
|
-
-
|
36
|
+
- History.txt
|
35
37
|
- MIT-LICENSE
|
36
38
|
- Manifest.txt
|
37
39
|
- README.txt
|
@@ -94,6 +96,7 @@ files:
|
|
94
96
|
- test/expected/whisker_junk.png
|
95
97
|
- test/expected/whisker_non_exceptional.png
|
96
98
|
- test/expected/whisker_with_step.png
|
99
|
+
- test/expected/zeros.png
|
97
100
|
- test/test_all.rb
|
98
101
|
has_rdoc: true
|
99
102
|
homepage: http://nubyonrails.com/pages/sparklines
|
@@ -118,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
121
|
requirements: []
|
119
122
|
|
120
123
|
rubyforge_project: sparklines
|
121
|
-
rubygems_version: 1.
|
124
|
+
rubygems_version: 1.2.0
|
122
125
|
signing_key:
|
123
126
|
specification_version: 2
|
124
127
|
summary: Tiny graphs.
|