gruff 0.2.9 → 0.3.0
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 +1 -1
- data/README.txt +16 -0
- data/Rakefile +1 -1
- data/lib/gruff.rb +1 -0
- data/lib/gruff/bar.rb +0 -1
- data/lib/gruff/base.rb +4 -1
- data/lib/gruff/pie.rb +5 -3
- data/test/test_bar.rb +0 -1
- data/test/test_bullet.rb +26 -0
- metadata +56 -47
data/{CHANGELOG → History.txt}
RENAMED
data/Manifest.txt
CHANGED
data/README.txt
CHANGED
|
@@ -13,3 +13,19 @@ Most of the documentation is in the Gruff::Base class.
|
|
|
13
13
|
== WARNING
|
|
14
14
|
|
|
15
15
|
This is beta-quality software. It works well according to my tests, but the API may change and other features will be added.
|
|
16
|
+
|
|
17
|
+
== Source
|
|
18
|
+
|
|
19
|
+
The source for this project is now kept at GitHub:
|
|
20
|
+
|
|
21
|
+
http://github.com/topfunky/gruff/tree/master
|
|
22
|
+
|
|
23
|
+
== CONTRIBUTE
|
|
24
|
+
|
|
25
|
+
Patches appreciated, especially if they are in Git format (with metadata so your name shows up in the commit logs).
|
|
26
|
+
|
|
27
|
+
Use these instructions:
|
|
28
|
+
|
|
29
|
+
http://gweezlebur.com/2008/2/1/so-you-want-to-contribute-to-merb-core-part-1
|
|
30
|
+
|
|
31
|
+
http://gweezlebur.com/2008/2/9/contributing-to-merb-part-2
|
data/Rakefile
CHANGED
|
@@ -11,7 +11,7 @@ Hoe.new('Gruff', Gruff::VERSION) do |p|
|
|
|
11
11
|
p.summary = "Beautiful graphs for one or multiple datasets."
|
|
12
12
|
p.url = "http://nubyonrails.com/pages/gruff"
|
|
13
13
|
p.clean_globs = ['test/output/*.png']
|
|
14
|
-
p.changes = p.paragraphs_of('
|
|
14
|
+
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
|
|
15
15
|
p.remote_rdoc_dir = '' # Release to root
|
|
16
16
|
end
|
|
17
17
|
|
data/lib/gruff.rb
CHANGED
data/lib/gruff/bar.rb
CHANGED
data/lib/gruff/base.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require 'rubygems'
|
|
2
2
|
require 'RMagick'
|
|
3
|
+
|
|
3
4
|
require File.dirname(__FILE__) + '/deprecated'
|
|
4
5
|
|
|
5
6
|
# = Gruff. Graphs.
|
|
@@ -17,7 +18,7 @@ require File.dirname(__FILE__) + '/deprecated'
|
|
|
17
18
|
module Gruff
|
|
18
19
|
|
|
19
20
|
# This is the version of Gruff you are using.
|
|
20
|
-
VERSION = '0.
|
|
21
|
+
VERSION = '0.3.0'
|
|
21
22
|
|
|
22
23
|
class Base
|
|
23
24
|
|
|
@@ -472,6 +473,8 @@ module Gruff
|
|
|
472
473
|
end
|
|
473
474
|
end
|
|
474
475
|
|
|
476
|
+
|
|
477
|
+
|
|
475
478
|
protected
|
|
476
479
|
|
|
477
480
|
# Overridden by subclasses to do the actual plotting of the graph.
|
data/lib/gruff/pie.rb
CHANGED
|
@@ -57,8 +57,10 @@ class Gruff::Pie < Gruff::Base
|
|
|
57
57
|
prev_degrees, prev_degrees + current_degrees + 0.5) # <= +0.5 'fudge factor' gets rid of the ugly gaps
|
|
58
58
|
|
|
59
59
|
half_angle = prev_degrees + ((prev_degrees + current_degrees) - prev_degrees) / 2
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
|
|
61
|
+
# Following line is commented to allow display of the percentiles
|
|
62
|
+
# bug appeared between r90 and r92
|
|
63
|
+
# unless @hide_line_markers then
|
|
62
64
|
# End the string with %% to escape the single %.
|
|
63
65
|
# RMagick must use sprintf with the string and % has special significance.
|
|
64
66
|
label_string = ((data_row[DATA_VALUES_INDEX][0] / total_sum) *
|
|
@@ -66,7 +68,7 @@ class Gruff::Pie < Gruff::Base
|
|
|
66
68
|
@d = draw_label(center_x,center_y, half_angle,
|
|
67
69
|
radius + (radius * TEXT_OFFSET_PERCENTAGE),
|
|
68
70
|
label_string)
|
|
69
|
-
end
|
|
71
|
+
# end
|
|
70
72
|
|
|
71
73
|
prev_degrees += current_degrees
|
|
72
74
|
end
|
data/test/test_bar.rb
CHANGED
data/test/test_bullet.rb
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
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
|
metadata
CHANGED
|
@@ -1,35 +1,38 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
|
-
rubygems_version: 0.9.0
|
|
3
|
-
specification_version: 1
|
|
4
2
|
name: gruff
|
|
5
3
|
version: !ruby/object:Gem::Version
|
|
6
|
-
version: 0.
|
|
7
|
-
date: 2007-11-07 00:00:00 -08:00
|
|
8
|
-
summary: Beautiful graphs for one or multiple datasets.
|
|
9
|
-
require_paths:
|
|
10
|
-
- lib
|
|
11
|
-
email: boss@topfunky.com
|
|
12
|
-
homepage: http://nubyonrails.com/pages/gruff
|
|
13
|
-
rubyforge_project: gruff
|
|
14
|
-
description: Beautiful graphs for one or multiple datasets. Can be used on websites or in documents.
|
|
15
|
-
autorequire:
|
|
16
|
-
default_executable:
|
|
17
|
-
bindir: bin
|
|
18
|
-
has_rdoc: true
|
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
|
20
|
-
requirements:
|
|
21
|
-
- - ">"
|
|
22
|
-
- !ruby/object:Gem::Version
|
|
23
|
-
version: 0.0.0
|
|
24
|
-
version:
|
|
4
|
+
version: 0.3.0
|
|
25
5
|
platform: ruby
|
|
26
|
-
signing_key:
|
|
27
|
-
cert_chain:
|
|
28
|
-
post_install_message:
|
|
29
6
|
authors:
|
|
30
7
|
- Geoffrey Grosenbach
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
|
|
12
|
+
date: 2008-03-11 00:00:00 -07:00
|
|
13
|
+
default_executable:
|
|
14
|
+
dependencies:
|
|
15
|
+
- !ruby/object:Gem::Dependency
|
|
16
|
+
name: hoe
|
|
17
|
+
version_requirement:
|
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
19
|
+
requirements:
|
|
20
|
+
- - ">="
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: 1.5.0
|
|
23
|
+
version:
|
|
24
|
+
description: Beautiful graphs for one or multiple datasets. Can be used on websites or in documents.
|
|
25
|
+
email: boss@topfunky.com
|
|
26
|
+
executables: []
|
|
27
|
+
|
|
28
|
+
extensions: []
|
|
29
|
+
|
|
30
|
+
extra_rdoc_files:
|
|
31
|
+
- History.txt
|
|
32
|
+
- Manifest.txt
|
|
33
|
+
- README.txt
|
|
31
34
|
files:
|
|
32
|
-
-
|
|
35
|
+
- History.txt
|
|
33
36
|
- MIT-LICENSE
|
|
34
37
|
- Manifest.txt
|
|
35
38
|
- README.txt
|
|
@@ -101,11 +104,39 @@ files:
|
|
|
101
104
|
- test/test_sidestacked_bar.rb
|
|
102
105
|
- test/test_spider.rb
|
|
103
106
|
- test/test_stacked_bar.rb
|
|
107
|
+
has_rdoc: true
|
|
108
|
+
homepage: http://nubyonrails.com/pages/gruff
|
|
109
|
+
post_install_message:
|
|
110
|
+
rdoc_options:
|
|
111
|
+
- --main
|
|
112
|
+
- README.txt
|
|
113
|
+
require_paths:
|
|
114
|
+
- lib
|
|
115
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
116
|
+
requirements:
|
|
117
|
+
- - ">="
|
|
118
|
+
- !ruby/object:Gem::Version
|
|
119
|
+
version: "0"
|
|
120
|
+
version:
|
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
|
+
requirements:
|
|
123
|
+
- - ">="
|
|
124
|
+
- !ruby/object:Gem::Version
|
|
125
|
+
version: "0"
|
|
126
|
+
version:
|
|
127
|
+
requirements: []
|
|
128
|
+
|
|
129
|
+
rubyforge_project: gruff
|
|
130
|
+
rubygems_version: 1.0.1
|
|
131
|
+
signing_key:
|
|
132
|
+
specification_version: 2
|
|
133
|
+
summary: Beautiful graphs for one or multiple datasets.
|
|
104
134
|
test_files:
|
|
105
135
|
- test/test_accumulator_bar.rb
|
|
106
136
|
- test/test_area.rb
|
|
107
137
|
- test/test_bar.rb
|
|
108
138
|
- test/test_base.rb
|
|
139
|
+
- test/test_bullet.rb
|
|
109
140
|
- test/test_legend.rb
|
|
110
141
|
- test/test_line.rb
|
|
111
142
|
- test/test_mini_bar.rb
|
|
@@ -119,25 +150,3 @@ test_files:
|
|
|
119
150
|
- test/test_sidestacked_bar.rb
|
|
120
151
|
- test/test_spider.rb
|
|
121
152
|
- test/test_stacked_bar.rb
|
|
122
|
-
rdoc_options:
|
|
123
|
-
- --main
|
|
124
|
-
- README.txt
|
|
125
|
-
extra_rdoc_files:
|
|
126
|
-
- Manifest.txt
|
|
127
|
-
- README.txt
|
|
128
|
-
executables: []
|
|
129
|
-
|
|
130
|
-
extensions: []
|
|
131
|
-
|
|
132
|
-
requirements: []
|
|
133
|
-
|
|
134
|
-
dependencies:
|
|
135
|
-
- !ruby/object:Gem::Dependency
|
|
136
|
-
name: hoe
|
|
137
|
-
version_requirement:
|
|
138
|
-
version_requirements: !ruby/object:Gem::Version::Requirement
|
|
139
|
-
requirements:
|
|
140
|
-
- - ">="
|
|
141
|
-
- !ruby/object:Gem::Version
|
|
142
|
-
version: 1.3.0
|
|
143
|
-
version:
|