gruff 0.3.1 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +3 -0
- data/History.txt +9 -0
- data/MIT-LICENSE +1 -1
- data/Manifest.txt +7 -0
- data/README.txt +12 -3
- data/Rakefile +3 -1
- data/init.rb +2 -0
- data/lib/gruff/area.rb +1 -1
- data/lib/gruff/bar.rb +1 -1
- data/lib/gruff/base.rb +186 -147
- data/lib/gruff/bullet.rb +109 -0
- data/lib/gruff/line.rb +3 -3
- data/lib/gruff/net.rb +5 -5
- data/lib/gruff/photo_bar.rb +1 -1
- data/lib/gruff/pie.rb +5 -5
- data/lib/gruff/side_bar.rb +1 -1
- data/lib/gruff/side_stacked_bar.rb +2 -2
- data/lib/gruff/spider.rb +4 -4
- data/lib/gruff/stacked_area.rb +2 -1
- data/lib/gruff/stacked_bar.rb +4 -4
- data/rails_generators/gruff/gruff_generator.rb +63 -0
- data/rails_generators/gruff/templates/controller.rb +32 -0
- data/rails_generators/gruff/templates/functional_test.rb +24 -0
- data/test/gruff_test_case.rb +5 -1
- data/test/test_bar.rb +2 -2
- data/test/test_bullet.rb +26 -26
- data/test/test_legend.rb +37 -40
- data/test/test_line.rb +36 -16
- data/test/test_stacked_area.rb +52 -0
- metadata +35 -5
- metadata.gz.sig +2 -0
data/test/test_bar.rb
CHANGED
@@ -114,12 +114,12 @@ class TestGruffBar < GruffTestCase
|
|
114
114
|
|
115
115
|
def test_set_legend_box_size
|
116
116
|
g = setup_basic_graph(400)
|
117
|
-
g.title = "Set Legend Box Size"
|
117
|
+
g.title = "Set Small Legend Box Size"
|
118
118
|
g.legend_box_size = 10.0
|
119
119
|
g.write("test/output/bar_set_legend_box_size_sm.png")
|
120
120
|
|
121
121
|
g = setup_basic_graph(400)
|
122
|
-
g.title = "Set Legend Box Size"
|
122
|
+
g.title = "Set Large Legend Box Size"
|
123
123
|
g.legend_box_size = 50.0
|
124
124
|
g.write("test/output/bar_set_legend_box_size_lg.png")
|
125
125
|
end
|
data/test/test_bullet.rb
CHANGED
@@ -1,26 +1,26 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/gruff_test_case"
|
2
|
-
|
3
|
-
class TestGruffBullet < GruffTestCase
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
1
|
+
# require File.dirname(__FILE__) + "/gruff_test_case"
|
2
|
+
#
|
3
|
+
# class TestGruffBullet < GruffTestCase
|
4
|
+
#
|
5
|
+
# def setup
|
6
|
+
# @data_args = [75, 100, {
|
7
|
+
# :target => 80,
|
8
|
+
# :low => 50,
|
9
|
+
# :high => 90
|
10
|
+
# }]
|
11
|
+
# end
|
12
|
+
#
|
13
|
+
# def test_bullet_graph
|
14
|
+
# g = Gruff::Bullet.new
|
15
|
+
# g.title = "Monthly Revenue"
|
16
|
+
# g.data *@data_args
|
17
|
+
# g.write("test/output/bullet_greyscale.png")
|
18
|
+
# end
|
19
|
+
#
|
20
|
+
# def test_no_options
|
21
|
+
# g = Gruff::Bullet.new
|
22
|
+
# g.data 127, 150
|
23
|
+
# g.write("test/output/bullet_no_options.png")
|
24
|
+
# end
|
25
|
+
#
|
26
|
+
# end
|
data/test/test_legend.rb
CHANGED
@@ -27,45 +27,42 @@ class TestGruffLegend < GruffTestCase
|
|
27
27
|
}
|
28
28
|
end
|
29
29
|
|
30
|
-
|
30
|
+
def full_suite_for(name, type)
|
31
|
+
[800, 400].each do |width|
|
32
|
+
[nil, 4, 16, 30].each do |font_size|
|
33
|
+
g = type.new(width)
|
34
|
+
g.title = "Wrapped Legend Bar Test #{font_size}pts #{width}px"
|
35
|
+
g.labels = @sample_labels
|
36
|
+
0xEFD250.step(0xFF0000, 60) do |num|
|
37
|
+
g.colors << "#%x" % num
|
38
|
+
end
|
39
|
+
|
40
|
+
@datasets.each do |data|
|
41
|
+
g.data(data[0], data[1])
|
42
|
+
end
|
43
|
+
|
44
|
+
g.legend_font_size = font_size unless font_size.nil?
|
45
|
+
g.write("test/output/#{name}_wrapped_legend_#{font_size}_#{width}.png")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
31
49
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
# end
|
51
|
-
#
|
52
|
-
# def test_pie_legend_wrap
|
53
|
-
# [800, 400].each do |width|
|
54
|
-
# [nil, 4, 16, 30].each do |font_size|
|
55
|
-
# g = Gruff::Pie.new(width)
|
56
|
-
# g.title = "Wrapped Legend Pie Test #{font_size}pts #{width}px"
|
57
|
-
# g.labels = @sample_labels
|
58
|
-
# 0xEFD250.step(0xFF0000, 60) do |num|
|
59
|
-
# g.colors << "#%x" % num
|
60
|
-
# end
|
61
|
-
#
|
62
|
-
# @datasets.each do |data|
|
63
|
-
# g.data(data[0], data[1])
|
64
|
-
# end
|
65
|
-
#
|
66
|
-
# g.legend_font_size = font_size unless font_size.nil?
|
67
|
-
# g.write("test/output/pie_wrapped_legend_#{font_size}_#{width}.png")
|
68
|
-
# end
|
69
|
-
# end
|
70
|
-
# end
|
50
|
+
def test_bar_legend_wrap
|
51
|
+
full_suite_for(:bar, Gruff::Bar)
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_pie_legend_wrap
|
55
|
+
full_suite_for(:pie, Gruff::Pie)
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_more_than_two_lines_of_legends
|
59
|
+
@datasets = @datasets + [[:Julie2, [22, 29, 35, 38, 36, 40, 46, 57]],
|
60
|
+
[:Jane2, [95, 95, 95, 90, 85, 80, 88, 100]],
|
61
|
+
[:Philip2, [90, 34, 23, 12, 78, 89, 98, 88]],
|
62
|
+
["Arthur2", [5, 10, 13, 11, 6, 16, 22, 32]],
|
63
|
+
["Vincent2", [5, 10, 13, 11, 6, 16, 22, 32]],
|
64
|
+
["Jake2", [5, 10, 13, 11, 6, 16, 22, 32]],
|
65
|
+
["Stephen2", [5, 10, 13, 11, 6, 16, 22, 32]]]
|
66
|
+
full_suite_for(:bar2, Gruff::Bar)
|
67
|
+
end
|
71
68
|
end
|
data/test/test_line.rb
CHANGED
@@ -5,6 +5,27 @@ require File.dirname(__FILE__) + "/gruff_test_case"
|
|
5
5
|
class TestGruffLine < GruffTestCase
|
6
6
|
|
7
7
|
# TODO Delete old output files once when starting tests
|
8
|
+
|
9
|
+
def test_should_render_with_transparent_theme
|
10
|
+
g = Gruff::Line.new(400)
|
11
|
+
g.title = "Transparent Background"
|
12
|
+
g.theme = {
|
13
|
+
:colors => ['black', 'grey'],
|
14
|
+
:marker_color => 'grey',
|
15
|
+
:font_color => 'black',
|
16
|
+
:background_colors => 'transparent'
|
17
|
+
}
|
18
|
+
|
19
|
+
g.labels = {
|
20
|
+
0 => '5/6',
|
21
|
+
1 => '5/15',
|
22
|
+
2 => '5/24',
|
23
|
+
3 => '5/30',
|
24
|
+
}
|
25
|
+
g.data(:apples, [-1, 0, 4, -4])
|
26
|
+
g.data(:peaches, [10, 8, 6, 3])
|
27
|
+
g.write("test/output/line_transparent.png")
|
28
|
+
end
|
8
29
|
|
9
30
|
def test_line_graph_with_themes
|
10
31
|
line_graph_with_themes()
|
@@ -118,21 +139,21 @@ class TestGruffLine < GruffTestCase
|
|
118
139
|
g.write("test/output/line_large.png")
|
119
140
|
end
|
120
141
|
|
121
|
-
def test_long_title
|
122
|
-
|
123
|
-
end
|
124
|
-
|
125
|
-
def test_add_colors
|
126
|
-
|
127
|
-
end
|
128
|
-
|
129
|
-
def test_request_too_many_colors
|
130
|
-
|
131
|
-
end
|
132
|
-
|
133
|
-
def test_add_data
|
134
|
-
|
135
|
-
end
|
142
|
+
# def test_long_title
|
143
|
+
#
|
144
|
+
# end
|
145
|
+
#
|
146
|
+
# def test_add_colors
|
147
|
+
#
|
148
|
+
# end
|
149
|
+
#
|
150
|
+
# def test_request_too_many_colors
|
151
|
+
#
|
152
|
+
# end
|
153
|
+
#
|
154
|
+
# def test_add_data
|
155
|
+
#
|
156
|
+
# end
|
136
157
|
|
137
158
|
def test_many_datapoints
|
138
159
|
g = Gruff::Line.new
|
@@ -439,7 +460,6 @@ protected
|
|
439
460
|
end
|
440
461
|
g.write("test/output/line_theme_37signals_#{size}.png")
|
441
462
|
|
442
|
-
|
443
463
|
g = Gruff::Line.new(size)
|
444
464
|
g.title = "Multi-Line Graph Test #{size}"
|
445
465
|
g.labels = @labels
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require File.dirname(__FILE__) + "/gruff_test_case"
|
4
|
+
|
5
|
+
class TestGruffStackedArea < GruffTestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@datasets = [
|
9
|
+
[:Jimmy, [25, 36, 86, 39]],
|
10
|
+
[:Charles, [80, 54, 67, 54]],
|
11
|
+
[:Julie, [22, 29, 35, 38]],
|
12
|
+
]
|
13
|
+
@sample_labels = {
|
14
|
+
0 => '5/6',
|
15
|
+
1 => '5/15',
|
16
|
+
2 => '5/24'
|
17
|
+
}
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_area_graph
|
22
|
+
g = Gruff::StackedArea.new
|
23
|
+
g.title = "Visual Stacked Area Graph Test"
|
24
|
+
g.labels = {
|
25
|
+
0 => '5/6',
|
26
|
+
1 => '5/15',
|
27
|
+
2 => '5/24',
|
28
|
+
3 => '5/30',
|
29
|
+
}
|
30
|
+
@datasets.each do |data|
|
31
|
+
g.data(data[0], data[1])
|
32
|
+
end
|
33
|
+
g.write "test/output/stacked_area_keynote.png"
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
def test_area_graph_small
|
38
|
+
g = Gruff::StackedArea.new(400)
|
39
|
+
g.title = "Visual Stacked Area Graph Test"
|
40
|
+
g.labels = {
|
41
|
+
0 => '5/6',
|
42
|
+
1 => '5/15',
|
43
|
+
2 => '5/24',
|
44
|
+
3 => '5/30',
|
45
|
+
}
|
46
|
+
@datasets.each do |data|
|
47
|
+
g.data(data[0], data[1])
|
48
|
+
end
|
49
|
+
g.write "test/output/stacked_area_keynote_small.png"
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
metadata
CHANGED
@@ -1,25 +1,47 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gruff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geoffrey Grosenbach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDMDCCAhigAwIBAgIBADANBgkqhkiG9w0BAQUFADA+MQ0wCwYDVQQDDARib3Nz
|
14
|
+
MRgwFgYKCZImiZPyLGQBGRYIdG9wZnVua3kxEzARBgoJkiaJk/IsZAEZFgNjb20w
|
15
|
+
HhcNMDgwODE3MDMzMDU0WhcNMDkwODE3MDMzMDU0WjA+MQ0wCwYDVQQDDARib3Nz
|
16
|
+
MRgwFgYKCZImiZPyLGQBGRYIdG9wZnVua3kxEzARBgoJkiaJk/IsZAEZFgNjb20w
|
17
|
+
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDbK8upez9nu5OgXmxYSQAL
|
18
|
+
eVNN0pe2B/enJhbOlzRPCl8Dw/IPYjLk0PllcoM93K8lwLwLy69A2YnPfA0sjcbG
|
19
|
+
tdFRLjh68NrnO/dGoEhOIVK0uIf5COsNypEJK8j+EWM1S9vCAP+l7CaSQheGDRyI
|
20
|
+
5qBCDZUdLGa/XnVCeLgoKSpwTGfNEsmNznxgo3l5h/NkF9RHJFudrTyZKhgIYxp+
|
21
|
+
5vpBPz0uGYyX2iYJqRuzDNIgzhkFZytRmJVtWViepMG2IBsbfnUbT1/vYpmonm0d
|
22
|
+
rrpxKm0puIogUmDEHz3tlBYvQS00kIe6KuNzuN+xij4tEt9438YLmrTJjpndzD5b
|
23
|
+
AgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBQRSeOh
|
24
|
+
z8QL4WWpJG+14yMjFRLNzTANBgkqhkiG9w0BAQUFAAOCAQEAkvmcKlYmyYySNMQI
|
25
|
+
KfK0mHc5VAvoCTro5xXjfsnNXKAnKc2UVQOICNCFgJXHofEqtnNi7PwCjZQt9LHY
|
26
|
+
owZgHpKoUOlYDAdfgboUdJHap4m4O+0DJrlQo1mthEW1b6MxZKSH/tKO08cHBD0t
|
27
|
+
Z6yIZmqmG4NOXjpCXboJL7ByS+gRhOW4ZZWW1USRQ9/PUzKVCAXfZdEMZ/c1ZlIq
|
28
|
+
Y+JC82qzSnYyYIgDys2ouhsTUfJiHbI/eTYbYlkcTmlmEom6ZvvDx/Y8D42PvnJa
|
29
|
+
2LzG5Vh+QRrt8ygeYtgbtw2PhenSQ4yU0M/9rC2DMyAZJnggcbFrIQE9m7RETI6x
|
30
|
+
FC7aiw==
|
31
|
+
-----END CERTIFICATE-----
|
11
32
|
|
12
|
-
date: 2008-
|
33
|
+
date: 2008-08-16 00:00:00 -07:00
|
13
34
|
default_executable:
|
14
35
|
dependencies:
|
15
36
|
- !ruby/object:Gem::Dependency
|
16
37
|
name: hoe
|
38
|
+
type: :development
|
17
39
|
version_requirement:
|
18
40
|
version_requirements: !ruby/object:Gem::Requirement
|
19
41
|
requirements:
|
20
42
|
- - ">="
|
21
43
|
- !ruby/object:Gem::Version
|
22
|
-
version: 1.
|
44
|
+
version: 1.7.0
|
23
45
|
version:
|
24
46
|
description: Beautiful graphs for one or multiple datasets. Can be used on websites or in documents.
|
25
47
|
email: boss@topfunky.com
|
@@ -64,12 +86,14 @@ files:
|
|
64
86
|
- assets/plastik/blue.png
|
65
87
|
- assets/plastik/green.png
|
66
88
|
- assets/plastik/red.png
|
89
|
+
- init.rb
|
67
90
|
- lib/gruff.rb
|
68
91
|
- lib/gruff/accumulator_bar.rb
|
69
92
|
- lib/gruff/area.rb
|
70
93
|
- lib/gruff/bar.rb
|
71
94
|
- lib/gruff/bar_conversion.rb
|
72
95
|
- lib/gruff/base.rb
|
96
|
+
- lib/gruff/bullet.rb
|
73
97
|
- lib/gruff/deprecated.rb
|
74
98
|
- lib/gruff/line.rb
|
75
99
|
- lib/gruff/mini/bar.rb
|
@@ -86,11 +110,15 @@ files:
|
|
86
110
|
- lib/gruff/stacked_area.rb
|
87
111
|
- lib/gruff/stacked_bar.rb
|
88
112
|
- lib/gruff/stacked_mixin.rb
|
113
|
+
- rails_generators/gruff/gruff_generator.rb
|
114
|
+
- rails_generators/gruff/templates/controller.rb
|
115
|
+
- rails_generators/gruff/templates/functional_test.rb
|
89
116
|
- test/gruff_test_case.rb
|
90
117
|
- test/test_accumulator_bar.rb
|
91
118
|
- test/test_area.rb
|
92
119
|
- test/test_bar.rb
|
93
120
|
- test/test_base.rb
|
121
|
+
- test/test_bullet.rb
|
94
122
|
- test/test_legend.rb
|
95
123
|
- test/test_line.rb
|
96
124
|
- test/test_mini_bar.rb
|
@@ -103,6 +131,7 @@ files:
|
|
103
131
|
- test/test_side_bar.rb
|
104
132
|
- test/test_sidestacked_bar.rb
|
105
133
|
- test/test_spider.rb
|
134
|
+
- test/test_stacked_area.rb
|
106
135
|
- test/test_stacked_bar.rb
|
107
136
|
has_rdoc: true
|
108
137
|
homepage: http://nubyonrails.com/pages/gruff
|
@@ -127,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
156
|
requirements: []
|
128
157
|
|
129
158
|
rubyforge_project: gruff
|
130
|
-
rubygems_version: 1.0
|
159
|
+
rubygems_version: 1.2.0
|
131
160
|
signing_key:
|
132
161
|
specification_version: 2
|
133
162
|
summary: Beautiful graphs for one or multiple datasets.
|
@@ -149,4 +178,5 @@ test_files:
|
|
149
178
|
- test/test_side_bar.rb
|
150
179
|
- test/test_sidestacked_bar.rb
|
151
180
|
- test/test_spider.rb
|
181
|
+
- test/test_stacked_area.rb
|
152
182
|
- test/test_stacked_bar.rb
|
metadata.gz.sig
ADDED