teejayvanslyke-gruff 0.3.8 → 0.4.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/.gitignore +2 -1
- data/VERSION +1 -1
- data/lib/gruff/base.rb +1 -2
- data/lib/gruff/side_stacked_bar.rb +1 -2
- data/teejayvanslyke-gruff.gemspec +5 -3
- data/test/test_sidestacked_bar_with_superimposed_labels.rb +30 -0
- metadata +4 -2
data/.gitignore
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/lib/gruff/base.rb
CHANGED
@@ -900,10 +900,9 @@ module Gruff
|
|
900
900
|
# area of the graph. This is used to superimpose text
|
901
901
|
# atop each chart region.
|
902
902
|
def draw_overlay(left_x, left_y, right_x, right_y, text)
|
903
|
-
puts "left_x: #{left_x}; left_y: #{left_y}; right_x: #{right_x}; right_y: #{right_y}"
|
904
903
|
@d.fill = @font_color
|
905
904
|
@d.font = @font if @font
|
906
|
-
@d.pointsize = scale_fontsize(@marker_font_size)
|
905
|
+
@d.pointsize = scale_fontsize(@marker_font_size)
|
907
906
|
@d.font_weight = BoldWeight
|
908
907
|
@d.stroke = 'black'
|
909
908
|
#@d.pointsize = scale_fontsize(@marker_font_size)
|
@@ -82,8 +82,7 @@ class Gruff::SideStackedBar < Gruff::SideBar
|
|
82
82
|
length[point_index] += difference
|
83
83
|
height[point_index] += (data_point * @graph_width - 2)
|
84
84
|
|
85
|
-
|
86
|
-
overlay = data_row[DATA_OVERLAY_INDEX]
|
85
|
+
overlay = data_row[DATA_OVERLAY_INDEX][point_index]
|
87
86
|
|
88
87
|
draw_overlay(left_x, left_y, right_x, right_y, overlay.to_s) if overlay
|
89
88
|
end
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{teejayvanslyke-gruff}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Geoffrey Grosenbach", "T.J. VanSlyke"]
|
12
|
-
s.date = %q{2009-10-
|
12
|
+
s.date = %q{2009-10-22}
|
13
13
|
s.description = %q{Beautiful graphs for one or multiple datasets. Can be used on websites or in documents.}
|
14
14
|
s.email = %q{teejay.vanslyke@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -98,6 +98,7 @@ Gem::Specification.new do |s|
|
|
98
98
|
"test/test_side_bar.rb",
|
99
99
|
"test/test_sidestacked_bar.rb",
|
100
100
|
"test/test_sidestacked_bar_percentile.rb",
|
101
|
+
"test/test_sidestacked_bar_with_superimposed_labels.rb",
|
101
102
|
"test/test_spider.rb",
|
102
103
|
"test/test_stacked_area.rb",
|
103
104
|
"test/test_stacked_bar.rb"
|
@@ -105,7 +106,7 @@ Gem::Specification.new do |s|
|
|
105
106
|
s.homepage = %q{http://github.com/teejayvanslyke/gruff.git}
|
106
107
|
s.rdoc_options = ["--charset=UTF-8"]
|
107
108
|
s.require_paths = ["lib"]
|
108
|
-
s.rubygems_version = %q{1.3.
|
109
|
+
s.rubygems_version = %q{1.3.5}
|
109
110
|
s.summary = %q{Fork of Geoffrey Grosenbach's Gruff gem with some customizations and fixes}
|
110
111
|
s.test_files = [
|
111
112
|
"test/gruff_test_case.rb",
|
@@ -127,6 +128,7 @@ Gem::Specification.new do |s|
|
|
127
128
|
"test/test_side_bar.rb",
|
128
129
|
"test/test_sidestacked_bar.rb",
|
129
130
|
"test/test_sidestacked_bar_percentile.rb",
|
131
|
+
"test/test_sidestacked_bar_with_superimposed_labels.rb",
|
130
132
|
"test/test_spider.rb",
|
131
133
|
"test/test_stacked_area.rb",
|
132
134
|
"test/test_stacked_bar.rb"
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
require File.dirname(__FILE__) + "/gruff_test_case"
|
3
|
+
|
4
|
+
class TestGruffSideStackedBarWithSuperimposedLabels < GruffTestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@datasets = [
|
8
|
+
[:Jimmy, [25, 36, 86, 39]],
|
9
|
+
[:Charles, [80, 54, 67, 54]],
|
10
|
+
[:Julie, [22, 29, 35, 38]]
|
11
|
+
]
|
12
|
+
@sample_labels = {
|
13
|
+
0 => '5/6',
|
14
|
+
1 => '5/15',
|
15
|
+
2 => '5/24'
|
16
|
+
}
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_bar_graph
|
21
|
+
g = Gruff::SideStackedBar.new
|
22
|
+
g.title = "Stacked Bar With Superimposed Labels"
|
23
|
+
g.labels = @sample_labels
|
24
|
+
@datasets.each do |data|
|
25
|
+
g.data(data[0], data[1], :overlay => data[1].map {|d| "#{d}%"})
|
26
|
+
end
|
27
|
+
g.write "test/output/side_stacked_with_superimposed_labels.png"
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teejayvanslyke-gruff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geoffrey Grosenbach
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-10-
|
13
|
+
date: 2009-10-22 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|
@@ -105,6 +105,7 @@ files:
|
|
105
105
|
- test/test_side_bar.rb
|
106
106
|
- test/test_sidestacked_bar.rb
|
107
107
|
- test/test_sidestacked_bar_percentile.rb
|
108
|
+
- test/test_sidestacked_bar_with_superimposed_labels.rb
|
108
109
|
- test/test_spider.rb
|
109
110
|
- test/test_stacked_area.rb
|
110
111
|
- test/test_stacked_bar.rb
|
@@ -156,6 +157,7 @@ test_files:
|
|
156
157
|
- test/test_side_bar.rb
|
157
158
|
- test/test_sidestacked_bar.rb
|
158
159
|
- test/test_sidestacked_bar_percentile.rb
|
160
|
+
- test/test_sidestacked_bar_with_superimposed_labels.rb
|
159
161
|
- test/test_spider.rb
|
160
162
|
- test/test_stacked_area.rb
|
161
163
|
- test/test_stacked_bar.rb
|