scruffy 0.2.4 → 0.2.5

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.
@@ -71,7 +71,6 @@ tasks/environment.rake
71
71
  tasks/website.rake
72
72
  test/graph_creation_test.rb
73
73
  test/test_helper.rb
74
- test/test_scruffy.rb
75
74
  website/images/blank.gif.html
76
75
  website/images/graphs/all_smiles.png
77
76
  website/images/graphs/bar_test.png
@@ -9,10 +9,13 @@ module Scruffy
9
9
 
10
10
  (0...options[:point_markers].size).map do |idx|
11
11
  x_coord = point_distance * idx
12
- svg.text(options[:point_markers][idx], :x => x_coord, :y => bounds[:height],
13
- 'font-size' => relative(90),
14
- :fill => (options[:theme].marker || 'white').to_s,
15
- 'text-anchor' => 'middle') unless options[:point_markers][idx].nil?
12
+ svg.text(options[:point_markers][idx],
13
+ :x => x_coord,
14
+ :y => bounds[:height],
15
+ 'font-size' => relative(90),
16
+ 'font-family' => options[:theme].font_family,
17
+ :fill => (options[:theme].marker || 'white').to_s,
18
+ 'text-anchor' => 'middle') unless options[:point_markers][idx].nil?
16
19
  end
17
20
  end
18
21
  end # draw
@@ -2,9 +2,15 @@ module Scruffy
2
2
  module Components
3
3
  class Label < Base
4
4
  def draw(svg, bounds, options={})
5
- svg.text(@options[:text], :class => 'text', :x => (bounds[:width] / 2), :y => bounds[:height],
6
- 'font-size' => relative(100), :fill => options[:theme].marker, :stroke => 'none', 'stroke-width' => '0',
7
- 'text-anchor' => (@options[:text_anchor] || 'middle'))
5
+ svg.text(@options[:text],
6
+ :class => 'text',
7
+ :x => (bounds[:width] / 2),
8
+ :y => bounds[:height],
9
+ 'font-size' => relative(100),
10
+ 'font-family' => options[:theme].font_family,
11
+ :fill => options[:theme].marker,
12
+ :stroke => 'none', 'stroke-width' => '0',
13
+ 'text-anchor' => (@options[:text_anchor] || 'middle'))
8
14
  end
9
15
  end
10
16
  end
@@ -42,11 +42,12 @@ module Scruffy::Components
42
42
  :width => size,
43
43
  :height => size,
44
44
  :fill => legend_info[idx][:color])
45
-
45
+
46
46
  svg.text(legend_info[idx][:title],
47
47
  :x => x + @line_height,
48
48
  :y => y + text_height * 0.75,
49
49
  'font-size' => text_height,
50
+ 'font-family' => options[:theme].font_family,
50
51
  :style => "color: #{options[:theme].marker || 'white'}",
51
52
  :fill => (options[:theme].marker || 'white'))
52
53
  end
@@ -2,9 +2,17 @@ module Scruffy
2
2
  module Components
3
3
  class Title < Base
4
4
  def draw(svg, bounds, options={})
5
- svg.text(options[:title], :class => 'title', :x => (bounds[:width] / 2), :y => bounds[:height],
6
- 'font-size' => relative(100), :fill => options[:theme].marker, :stroke => 'none', 'stroke-width' => '0',
7
- 'text-anchor' => (@options[:text_anchor] || 'middle'))
5
+ if options[:title]
6
+ svg.text(options[:title],
7
+ :class => 'title',
8
+ :x => (bounds[:width] / 2),
9
+ :y => bounds[:height],
10
+ 'font-size' => relative(100),
11
+ 'font-family' => options[:theme].font_family,
12
+ :fill => options[:theme].marker,
13
+ :stroke => 'none', 'stroke-width' => '0',
14
+ 'text-anchor' => (@options[:text_anchor] || 'middle'))
15
+ end
8
16
  end
9
17
  end
10
18
  end
@@ -18,11 +18,12 @@ module Scruffy
18
18
  marker_value = options[:value_formatter].route_format(marker_value, idx, options.merge({:all_values => all_values})) if options[:value_formatter]
19
19
 
20
20
  svg.text( marker_value.to_s,
21
- :x => bounds[:width],
22
- :y => (bounds[:height] - marker),
23
- 'font-size' => relative(8),
24
- :fill => ((options.delete(:marker_color_override) || options[:theme].marker) || 'white').to_s,
25
- 'text-anchor' => 'end')
21
+ :x => bounds[:width],
22
+ :y => (bounds[:height] - marker),
23
+ 'font-size' => relative(8),
24
+ 'font-family' => options[:theme].font_family,
25
+ :fill => ((options.delete(:marker_color_override) || options[:theme].marker) || 'white').to_s,
26
+ 'text-anchor' => 'end')
26
27
  end
27
28
 
28
29
  end
@@ -1,9 +1,9 @@
1
1
  module Scruffy::Layers
2
2
  # ==Scruffy::Layers::PieSlice
3
- #
3
+ #
4
4
  # Author:: A.J. Ostman
5
5
  # Date:: August 14th, 2006
6
- #
6
+ #
7
7
  # Basic Pie Chart Slice..
8
8
 
9
9
  class PieSlice < Base
@@ -20,10 +20,12 @@ module Scruffy::Layers
20
20
  attr_accessor :center_x, :center_y
21
21
 
22
22
  def draw(svg, coords, options = {})
23
- # Scaler is the multiplier to normalize the values to a percentage across the Pie Chart
23
+ # Scaler is the multiplier to normalize the values to a percentage across
24
+ # the Pie Chart
24
25
  @scaler = options[:scaler] || 1
25
26
 
26
- # Degree Offset is degrees by which the pie chart is twisted when it begins
27
+ # Degree Offset is degrees by which the pie chart is twisted when it
28
+ # begins
27
29
  @degree_offset = options[:degree_offset] || @options[:degree_offset] || 0
28
30
 
29
31
  # Percent Used keeps track of where in the pie chart we are
@@ -42,13 +44,13 @@ module Scruffy::Layers
42
44
  shadow_color = options[:shadow_color] || @options[:shadow_color] || "white"
43
45
  shadow_opacity = options[:shadow_opacity] || @options[:shadow_opacity] || 0.06
44
46
 
45
- # Coordinates for the center of the pie chart.
47
+ # Coordinates for the center of the pie chart.
46
48
  @center_x = relative_width(options[:center_x]) || relative_width(@options[:center_x]) || relative_width(50)
47
49
  @center_y = relative_height(options[:center_y]) || relative_height(@options[:center_y]) || relative_height(50)
48
50
  radius = @diameter / 2.0
49
51
 
50
- # Graphing calculated using percent of graph.
51
- # We later multiply by 3.6 to convert to 360 degree system.
52
+ # Graphing calculated using percent of graph. We later multiply by 3.6 to
53
+ # convert to 360 degree system.
52
54
  percent = @scaler * sum_values
53
55
 
54
56
 
@@ -60,8 +62,8 @@ module Scruffy::Layers
60
62
  radians_mid_point = radians_start + ((radians_end - radians_start) / 2)
61
63
 
62
64
  if options[:explode]
63
- @center_x = @center_x + (Math.sin(radians_mid_point) * relative(options[:explode]))
64
- @center_y = @center_y - (Math.cos(radians_mid_point) * relative(options[:explode]))
65
+ @center_x = @center_x + (Math.sin(radians_mid_point) * relative(options[:explode]))
66
+ @center_y = @center_y - (Math.cos(radians_mid_point) * relative(options[:explode]))
65
67
  end
66
68
 
67
69
 
@@ -80,7 +82,7 @@ module Scruffy::Layers
80
82
 
81
83
  if shadow
82
84
  svg.circle(:cx => "#{@center_x + shadow_x}", :cy => "#{@center_y + shadow_y}", :r=>"#{radius}",:stroke => "none",
83
- :fill => shadow_color.to_s, :style => "fill-opacity: #{shadow_opacity.to_s};")
85
+ :fill => shadow_color.to_s, :style => "fill-opacity: #{shadow_opacity.to_s};")
84
86
  end
85
87
 
86
88
  svg.circle(:cx => "#{@center_x}", :cy => "#{@center_y}", :r=>"#{radius}",:stroke => stroke, :fill => color.to_s)
@@ -88,27 +90,30 @@ module Scruffy::Layers
88
90
  else
89
91
  if shadow
90
92
  svg.path(:d => "M#{@center_x + shadow_x},#{@center_y + shadow_y} L#{x_start + shadow_x},#{y_start + shadow_y} A#{radius},#{radius} 0, #{percent >= 50 ? '1' : '0'}, 1, #{x_end + shadow_x} #{y_end + shadow_y} Z",
91
- :fill => shadow_color.to_s, :style => "fill-opacity: #{shadow_opacity.to_s};")
93
+ :fill => shadow_color.to_s, :style => "fill-opacity: #{shadow_opacity.to_s};")
92
94
  end
93
95
 
94
96
  svg.path(:d => "M#{@center_x},#{@center_y} L#{x_start},#{y_start} A#{radius},#{radius} 0, #{percent >= 50 ? '1' : '0'}, 1, #{x_end} #{y_end} Z",
95
- :stroke => stroke, :fill => color.to_s)
97
+ :stroke => stroke, :fill => color.to_s)
96
98
  end
97
99
 
98
100
  text_x = @center_x + (Math.sin(radians_mid_point) * radius * MARKER_OFFSET_RATIO)
99
101
  text_y = @center_y - (Math.cos(radians_mid_point) * radius * MARKER_OFFSET_RATIO)
100
102
 
101
- svg.text("#{sprintf('%d', percent)}%", :x => text_x, :y => text_y + relative(MARKER_FONT_SIZE / 2),
102
- 'font-size' => relative(MARKER_FONT_SIZE),
103
- :fill => (options[:theme].marker || 'black').to_s,
104
- 'text-anchor' => 'middle')
103
+ svg.text("#{sprintf('%d', percent)}%",
104
+ :x => text_x,
105
+ :y => text_y + relative(MARKER_FONT_SIZE / 2),
106
+ 'font-size' => relative(MARKER_FONT_SIZE),
107
+ 'font-family' => options[:theme].font_family,
108
+ :fill => (options[:theme].marker || 'black').to_s,
109
+ 'text-anchor' => 'middle')
105
110
  end
106
111
 
107
- protected
108
- def generate_coordinates(options = {})
109
- # Coordinate Generation didn't make much sense here.
110
- # Overridden just because Brasten said this would be overridden.
111
- end
112
+ protected
113
+ def generate_coordinates(options = {})
114
+ # Coordinate Generation didn't make much sense here. Overridden just
115
+ # because Brasten said this would be overridden.
112
116
  end
117
+ end
113
118
 
114
119
  end
@@ -2,7 +2,7 @@ module Scruffy
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- TINY = 4
5
+ TINY = 5
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -33,7 +33,7 @@
33
33
  <h1></h1>
34
34
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/scruffy"; return false'>
35
35
  <p>Get Version</p>
36
- <a href="http://rubyforge.org/projects/scruffy" class="numbers">0.2.4</a>
36
+ <a href="http://rubyforge.org/projects/scruffy" class="numbers">0.2.5</a>
37
37
  </div>
38
38
  <p><a href="index.html">Home</a>
39
39
  <a href="doc">Documentation</a>
@@ -246,12 +246,17 @@ Scruffy is designed to be extremely extendible. Adding new graph types or themes
246
246
 
247
247
  <h2>News
248
248
  <ul>
249
- <li><strong>2008-08-22, Scruffy 0.2.4</strong> &#8211; Bug fixes:
250
- #21517, legend text missing, fixed.
251
- #21604, Fails to properly require RMagick, fixed.</li>
249
+ <li><strong>2008-10-13, Scruffy 0.2.5</strong> &#8211; Fixed font_family settings from theme.</li>
252
250
  </ul></h2>
253
251
 
254
252
 
253
+ <ul>
254
+ <li><strong>2008-08-22, Scruffy 0.2.4</strong> &#8211; Bug fixes:
255
+ Bug 21517, legend text missing, fixed.
256
+ Bug 21604, Fails to properly require RMagick, fixed.</li>
257
+ </ul>
258
+
259
+
255
260
  <ul>
256
261
  <li><strong>July 8th, 2008, Scruffy 0.2.3</strong> &#8211; Pie Charts added.</li>
257
262
  </ul>
@@ -289,7 +294,7 @@ Check out more examples at <a href="http://www.ibrasten.com/articles/tag/scruffy
289
294
  urchinTracker();
290
295
  </script>
291
296
  <p class="coda">
292
- 22nd August 2008<br>
297
+ 13th October 2008<br>
293
298
  </p>
294
299
  </div>
295
300
 
@@ -173,9 +173,11 @@ The trunk repository is <code>svn://rubyforge.org/var/svn/scruffy/trunk</code> f
173
173
  Rubyforge Project is <a href="http://rubyforge.org/projects/scruffy/" class="major">here</a>
174
174
 
175
175
  h2. News
176
+ * *2008-10-13, Scruffy 0.2.5* - Fixed font_family settings from theme.
177
+
176
178
  * *2008-08-22, Scruffy 0.2.4* - Bug fixes:
177
- #21517, legend text missing, fixed.
178
- #21604, Fails to properly require RMagick, fixed.
179
+ Bug 21517, legend text missing, fixed.
180
+ Bug 21604, Fails to properly require RMagick, fixed.
179
181
 
180
182
  * *July 8th, 2008, Scruffy 0.2.3* - Pie Charts added.
181
183
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scruffy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brasten Sager
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-08-22 00:00:00 +10:00
12
+ date: 2008-10-13 00:00:00 +11:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -111,7 +111,6 @@ files:
111
111
  - tasks/website.rake
112
112
  - test/graph_creation_test.rb
113
113
  - test/test_helper.rb
114
- - test/test_scruffy.rb
115
114
  - website/images/blank.gif.html
116
115
  - website/images/graphs/all_smiles.png
117
116
  - website/images/graphs/bar_test.png
@@ -178,4 +177,3 @@ specification_version: 2
178
177
  summary: A powerful, clean graphing library for Ruby.
179
178
  test_files:
180
179
  - test/test_helper.rb
181
- - test/test_scruffy.rb
@@ -1,11 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
-
3
- class TestScruffy < Test::Unit::TestCase
4
-
5
- def setup
6
- end
7
-
8
- def test_truth
9
- assert true
10
- end
11
- end