scruffy 0.2.6 → 0.3.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. data/{History.txt → CHANGES.txt} +15 -12
  2. data/README.txt +25 -25
  3. data/lib/scruffy.rb +0 -5
  4. data/lib/scruffy/components.rb +1 -0
  5. data/lib/scruffy/components/axes.rb +23 -0
  6. data/lib/scruffy/components/background.rb +3 -3
  7. data/lib/scruffy/components/base.rb +3 -0
  8. data/lib/scruffy/components/data_markers.rb +23 -8
  9. data/lib/scruffy/components/graphs.rb +4 -0
  10. data/lib/scruffy/components/grid.rb +45 -4
  11. data/lib/scruffy/components/legend.rb +63 -21
  12. data/lib/scruffy/components/title.rb +1 -1
  13. data/lib/scruffy/components/value_markers.rb +9 -16
  14. data/lib/scruffy/formatters.rb +41 -3
  15. data/lib/scruffy/graph.rb +27 -11
  16. data/lib/scruffy/graph_state.rb +5 -0
  17. data/lib/scruffy/helpers.rb +1 -0
  18. data/lib/scruffy/helpers/layer_container.rb +28 -4
  19. data/lib/scruffy/helpers/marker_helper.rb +25 -0
  20. data/lib/scruffy/helpers/point_container.rb +46 -17
  21. data/lib/scruffy/layers.rb +6 -1
  22. data/lib/scruffy/layers/bar.rb +35 -14
  23. data/lib/scruffy/layers/base.rb +51 -21
  24. data/lib/scruffy/layers/box.rb +114 -0
  25. data/lib/scruffy/layers/line.rb +31 -14
  26. data/lib/scruffy/layers/multi.rb +74 -0
  27. data/lib/scruffy/layers/multi_area.rb +119 -0
  28. data/lib/scruffy/layers/multi_bar.rb +51 -0
  29. data/lib/scruffy/layers/scatter.rb +13 -5
  30. data/lib/scruffy/layers/stacked.rb +2 -1
  31. data/lib/scruffy/rasterizers.rb +1 -0
  32. data/lib/scruffy/rasterizers/mini_magick_rasterizer.rb +24 -0
  33. data/lib/scruffy/rasterizers/rmagick_rasterizer.rb +8 -2
  34. data/lib/scruffy/renderers.rb +2 -0
  35. data/lib/scruffy/renderers/axis_legend.rb +41 -0
  36. data/lib/scruffy/renderers/base.rb +6 -4
  37. data/lib/scruffy/renderers/basic.rb +20 -0
  38. data/lib/scruffy/renderers/standard.rb +7 -6
  39. data/lib/scruffy/themes.rb +37 -1
  40. data/lib/scruffy/version.rb +1 -7
  41. data/spec/output/array.svg +55 -0
  42. data/spec/output/hash.svg +55 -0
  43. data/spec/scruffy/graph_spec.rb +4 -4
  44. data/spec/scruffy/layers/base_spec.rb +15 -10
  45. metadata +84 -96
  46. data/CHANGES +0 -104
  47. data/License.txt +0 -20
  48. data/MIT-LICENSE +0 -20
  49. data/Manifest.txt +0 -104
  50. data/PostInstall.txt +0 -6
  51. data/README +0 -9
  52. data/Rakefile +0 -108
  53. data/config/hoe.rb +0 -78
  54. data/config/requirements.rb +0 -15
  55. data/script/console +0 -10
  56. data/script/destroy +0 -14
  57. data/script/generate +0 -14
  58. data/script/txt2html +0 -82
  59. data/setup.rb +0 -1585
  60. data/spec/scruffy/layers/line_spec.rb +0 -10
  61. data/tasks/deployment.rake +0 -34
  62. data/tasks/environment.rake +0 -7
  63. data/tasks/website.rake +0 -17
  64. data/test/graph_creation_test.rb +0 -101
  65. data/test/test_helper.rb +0 -2
  66. data/website/images/blank.gif.html +0 -7
  67. data/website/images/graphs/all_smiles.png +0 -0
  68. data/website/images/graphs/bar_test.png +0 -0
  69. data/website/images/graphs/bar_test.svg +0 -71
  70. data/website/images/graphs/line_test.png +0 -0
  71. data/website/images/graphs/line_test.svg +0 -60
  72. data/website/images/graphs/multi_test.png +0 -0
  73. data/website/images/graphs/multi_test.svg +0 -296
  74. data/website/images/graphs/pie_test.png +0 -0
  75. data/website/images/graphs/pie_test.svg +0 -40
  76. data/website/images/graphs/split_test.png +0 -0
  77. data/website/images/graphs/split_test.svg +0 -295
  78. data/website/images/graphs/stacking_test.png +0 -0
  79. data/website/images/graphs/stacking_test.svg +0 -146
  80. data/website/images/header.png +0 -0
  81. data/website/images/header_gradient.png +0 -0
  82. data/website/images/overlay.png +0 -0
  83. data/website/images/scruffy.png +0 -0
  84. data/website/index.html +0 -225
  85. data/website/index.txt +0 -204
  86. data/website/javascripts/application.js +0 -2
  87. data/website/javascripts/controls.js +0 -815
  88. data/website/javascripts/dragdrop.js +0 -913
  89. data/website/javascripts/effects.js +0 -958
  90. data/website/javascripts/lightbox.js +0 -437
  91. data/website/javascripts/prototype.js +0 -2006
  92. data/website/javascripts/rounded_corners_lite.inc.js +0 -285
  93. data/website/stylesheets/lightbox.css +0 -27
  94. data/website/stylesheets/screen.css +0 -147
  95. data/website/stylesheets/scruffy.css +0 -227
  96. data/website/template.html.erb +0 -47
@@ -16,7 +16,7 @@ end
16
16
  describe "A new Scruffy::Graph" do
17
17
  include CustomRenderers
18
18
 
19
- before(:each) do
19
+ before do
20
20
  @graph = Scruffy::Graph.new
21
21
  end
22
22
 
@@ -25,7 +25,7 @@ describe "A new Scruffy::Graph" do
25
25
  end
26
26
 
27
27
  it "should be set to the keynote theme" do
28
- @graph.theme.class.should equal(Scruffy::Themes::Keynote)
28
+ @graph.theme.class.should == Scruffy::Themes::Standard
29
29
  end
30
30
 
31
31
  it "should have zero layers" do
@@ -128,10 +128,10 @@ describe "A Scruffy::Graph's initialization block" do
128
128
  @graph.point_markers.should == options[:point_markers]
129
129
  end
130
130
  end
131
-
131
+ ''
132
132
 
133
133
  describe "A fully populated Graph" do
134
- before(:each) do
134
+ before do
135
135
  FileUtils.rm_f File.dirname(__FILE__) + '/*.png'
136
136
  FileUtils.rm_f File.dirname(__FILE__) + '/*.jpg'
137
137
 
@@ -1,17 +1,22 @@
1
1
  require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
2
2
  require 'scruffy'
3
3
 
4
- context "Any layer" do
5
- specify "should accept but ignore nil data" do
6
- render([100, nil, 300]).should eql([[0.0, 400], [400.0, 0.0]])
7
- end
4
+ describe "Any layer" do
5
+
6
+ # TODO these appear to be invalid tests due to changes made to coordinate
7
+ # generatation. Should be updated. [brasten]
8
+ #
9
+
10
+ # it "should accept but ignore nil data" do
11
+ # render([100, nil, 300]).should eql([[0.0, 400], [400.0, 0.0]])
12
+ # end
8
13
 
9
- specify "should accept hash data as sequentially-keyed data" do
10
- render([100, nil, 300]).should eql([[0.0, 400], [400.0, 0.0]])
11
- render({0 => 100, 2 => 300}).should eql([[0.0, 400], [400.0, 0.0]])
12
- end
14
+ # it "should accept hash data as sequentially-keyed data" do
15
+ # render([100, nil, 300]).should eql([[0.0, 400], [400.0, 0.0]])
16
+ # render({0 => 100, 2 => 300}).should eql([[0.0, 400], [400.0, 0.0]])
17
+ # end
13
18
 
14
- def render points
19
+ def render(points)
15
20
  layer = Scruffy::Layers::Base.new(:title => 'My base Layer', :points => points)
16
21
 
17
22
  #stub out draw to just return coords
@@ -22,7 +27,7 @@ context "Any layer" do
22
27
  lambda {
23
28
  size = [400,400]
24
29
  coords = layer.render(Scruffy::Renderers::Base.new.render(:layers => [layer], :size => size),
25
- :size => size, :min_value => 100, :max_value => 300)
30
+ :size => size, :min_value => 100, :max_value => 300, :min_key => 0, :max_key => 2)
26
31
  }.should_not raise_error
27
32
 
28
33
  coords
metadata CHANGED
@@ -1,56 +1,72 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scruffy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ prerelease: true
5
+ segments:
6
+ - 0
7
+ - 3
8
+ - 0
9
+ - beta1
10
+ version: 0.3.0.beta1
5
11
  platform: ruby
6
12
  authors:
7
- - Brasten Sager
13
+ - brasten
14
+ - Jeremy Green
15
+ - samhendley
16
+ - delano
17
+ - willbryant
18
+ - tlconner
19
+ - Jonas Nicklas
8
20
  autorequire:
9
21
  bindir: bin
10
22
  cert_chain: []
11
23
 
12
- date: 2009-08-23 00:00:00 -07:00
24
+ date: 2011-01-01 00:00:00 -08:00
13
25
  default_executable:
14
26
  dependencies:
15
27
  - !ruby/object:Gem::Dependency
16
- name: hoe
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
28
+ name: builder
29
+ prerelease: false
30
+ requirement: &id001 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ~>
34
+ - !ruby/object:Gem::Version
35
+ segments:
36
+ - 2
37
+ - 0
38
+ version: "2.0"
39
+ type: :runtime
40
+ version_requirements: *id001
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ prerelease: false
44
+ requirement: &id002 !ruby/object:Gem::Requirement
45
+ none: false
20
46
  requirements:
21
- - - ">="
47
+ - - ~>
22
48
  - !ruby/object:Gem::Version
23
- version: 2.3.3
24
- version:
25
- description: Scruffy is a Ruby library for generating high quality, good looking graphs. It is designed to be easy to use and highly customizable.
49
+ segments:
50
+ - 2
51
+ - 3
52
+ version: "2.3"
53
+ type: :development
54
+ version_requirements: *id002
55
+ description: Scruffy is a library for outputting graphs to image or SVG
26
56
  email:
27
- - - brasten@nagilum.com
28
- - david.parry@suranyami.com
57
+ - brasten@nagilum.com
58
+ - david.parry@suranyami.com
59
+ - jagthedrummer@gmail.com
60
+ - tim@connorsoftware.com
61
+ - jonas.nicklas@gmail.com
29
62
  executables: []
30
63
 
31
64
  extensions: []
32
65
 
33
- extra_rdoc_files:
34
- - History.txt
35
- - License.txt
36
- - Manifest.txt
37
- - PostInstall.txt
38
- - README.txt
39
- - website/index.txt
66
+ extra_rdoc_files: []
67
+
40
68
  files:
41
- - CHANGES
42
- - History.txt
43
- - License.txt
44
- - MIT-LICENSE
45
- - Manifest.txt
46
- - PostInstall.txt
47
- - README
48
- - README.txt
49
- - Rakefile
50
- - config/hoe.rb
51
- - config/requirements.rb
52
- - lib/scruffy.rb
53
- - lib/scruffy/components.rb
69
+ - lib/scruffy/components/axes.rb
54
70
  - lib/scruffy/components/background.rb
55
71
  - lib/scruffy/components/base.rb
56
72
  - lib/scruffy/components/data_markers.rb
@@ -62,31 +78,39 @@ files:
62
78
  - lib/scruffy/components/title.rb
63
79
  - lib/scruffy/components/value_markers.rb
64
80
  - lib/scruffy/components/viewport.rb
81
+ - lib/scruffy/components.rb
65
82
  - lib/scruffy/formatters.rb
66
83
  - lib/scruffy/graph.rb
67
84
  - lib/scruffy/graph_state.rb
68
- - lib/scruffy/helpers.rb
69
85
  - lib/scruffy/helpers/canvas.rb
70
86
  - lib/scruffy/helpers/layer_container.rb
87
+ - lib/scruffy/helpers/marker_helper.rb
71
88
  - lib/scruffy/helpers/meta.rb
72
89
  - lib/scruffy/helpers/point_container.rb
73
- - lib/scruffy/layers.rb
90
+ - lib/scruffy/helpers.rb
74
91
  - lib/scruffy/layers/all_smiles.rb
75
92
  - lib/scruffy/layers/area.rb
76
93
  - lib/scruffy/layers/average.rb
77
94
  - lib/scruffy/layers/bar.rb
78
95
  - lib/scruffy/layers/base.rb
96
+ - lib/scruffy/layers/box.rb
79
97
  - lib/scruffy/layers/line.rb
98
+ - lib/scruffy/layers/multi.rb
99
+ - lib/scruffy/layers/multi_area.rb
100
+ - lib/scruffy/layers/multi_bar.rb
80
101
  - lib/scruffy/layers/pie.rb
81
102
  - lib/scruffy/layers/pie_slice.rb
82
103
  - lib/scruffy/layers/scatter.rb
83
104
  - lib/scruffy/layers/sparkline_bar.rb
84
105
  - lib/scruffy/layers/stacked.rb
85
- - lib/scruffy/rasterizers.rb
106
+ - lib/scruffy/layers.rb
86
107
  - lib/scruffy/rasterizers/batik_rasterizer.rb
108
+ - lib/scruffy/rasterizers/mini_magick_rasterizer.rb
87
109
  - lib/scruffy/rasterizers/rmagick_rasterizer.rb
88
- - lib/scruffy/renderers.rb
110
+ - lib/scruffy/rasterizers.rb
111
+ - lib/scruffy/renderers/axis_legend.rb
89
112
  - lib/scruffy/renderers/base.rb
113
+ - lib/scruffy/renderers/basic.rb
90
114
  - lib/scruffy/renderers/cubed.rb
91
115
  - lib/scruffy/renderers/cubed3d.rb
92
116
  - lib/scruffy/renderers/empty.rb
@@ -95,87 +119,51 @@ files:
95
119
  - lib/scruffy/renderers/sparkline.rb
96
120
  - lib/scruffy/renderers/split.rb
97
121
  - lib/scruffy/renderers/standard.rb
122
+ - lib/scruffy/renderers.rb
98
123
  - lib/scruffy/themes.rb
99
124
  - lib/scruffy/version.rb
100
- - script/console
101
- - script/destroy
102
- - script/generate
103
- - script/txt2html
104
- - setup.rb
125
+ - lib/scruffy.rb
126
+ - spec/output/array.svg
127
+ - spec/output/hash.svg
105
128
  - spec/scruffy/graph_spec.rb
106
129
  - spec/scruffy/layers/base_spec.rb
107
- - spec/scruffy/layers/line_spec.rb
108
130
  - spec/spec_helper.rb
109
- - tasks/deployment.rake
110
- - tasks/environment.rake
111
- - tasks/website.rake
112
- - test/graph_creation_test.rb
113
- - test/test_helper.rb
114
- - website/images/blank.gif.html
115
- - website/images/graphs/all_smiles.png
116
- - website/images/graphs/bar_test.png
117
- - website/images/graphs/bar_test.svg
118
- - website/images/graphs/line_test.png
119
- - website/images/graphs/line_test.svg
120
- - website/images/graphs/multi_test.png
121
- - website/images/graphs/multi_test.svg
122
- - website/images/graphs/pie_test.png
123
- - website/images/graphs/pie_test.svg
124
- - website/images/graphs/split_test.png
125
- - website/images/graphs/split_test.svg
126
- - website/images/graphs/stacking_test.png
127
- - website/images/graphs/stacking_test.svg
128
- - website/images/header.png
129
- - website/images/header_gradient.png
130
- - website/images/overlay.png
131
- - website/images/scruffy.png
132
- - website/index.html
133
- - website/index.txt
134
- - website/javascripts/application.js
135
- - website/javascripts/controls.js
136
- - website/javascripts/dragdrop.js
137
- - website/javascripts/effects.js
138
- - website/javascripts/lightbox.js
139
- - website/javascripts/prototype.js
140
- - website/javascripts/rounded_corners_lite.inc.js
141
- - website/stylesheets/lightbox.css
142
- - website/stylesheets/screen.css
143
- - website/stylesheets/scruffy.css
144
- - website/template.html.erb
131
+ - README.txt
132
+ - CHANGES.txt
145
133
  has_rdoc: true
146
- homepage: http://scruffy.rubyforge.org
134
+ homepage: http://github.com/brasten/scruffy
147
135
  licenses: []
148
136
 
149
- post_install_message: |+
150
- For more information on scruffy, see http://scruffy.rubyforge.org
151
-
152
- NOTE: Change this information in PostInstall.txt
153
- You can also delete it if you don't want it.
154
-
155
-
137
+ post_install_message:
156
138
  rdoc_options:
157
139
  - --main
158
140
  - README.txt
159
141
  require_paths:
160
142
  - lib
161
143
  required_ruby_version: !ruby/object:Gem::Requirement
144
+ none: false
162
145
  requirements:
163
146
  - - ">="
164
147
  - !ruby/object:Gem::Version
148
+ segments:
149
+ - 0
165
150
  version: "0"
166
- version:
167
151
  required_rubygems_version: !ruby/object:Gem::Requirement
152
+ none: false
168
153
  requirements:
169
- - - ">="
154
+ - - ">"
170
155
  - !ruby/object:Gem::Version
171
- version: "0"
172
- version:
156
+ segments:
157
+ - 1
158
+ - 3
159
+ - 1
160
+ version: 1.3.1
173
161
  requirements: []
174
162
 
175
- rubyforge_project: scruffy
176
- rubygems_version: 1.3.4
163
+ rubyforge_project:
164
+ rubygems_version: 1.3.7
177
165
  signing_key:
178
166
  specification_version: 3
179
- summary: A powerful, clean graphing library for Ruby.
180
- test_files:
181
- - test/graph_creation_test.rb
167
+ summary: Scruffy is a library for outputting graphs to image or SVG
168
+ test_files: []
169
+
data/CHANGES DELETED
@@ -1,104 +0,0 @@
1
- = Scruffy Changelog
2
- == Version 0.2.3
3
- (July 4th, 2008)
4
- * Got pie charts working
5
- * Added rough capability for legend to run vertically (better for Pie chart)
6
- * Added some checks in the Pie initializer so that you simply pass a Hash of
7
- name => values, instead of adding PieSlices in a block.
8
- * Added a simplistic unit test that outputs a pie and line chart in PNG & SVG.
9
- * Quite a lot of hard-wired values in here. Whole thing needs a spring clean.
10
-
11
- == Version 0.2.2
12
- (August 19th, 2006)
13
-
14
- * Removed all font-family and text-rendering attributes from elements.
15
- - These were causing issues with Batik and Adobe Viewer. Horrible font problems.
16
- * Added require 'builder' to renderers/base.rb
17
- * Added minor shadows to most graph types. Adds some depth perception.
18
- * Added graph.layout as an alias of renderer. (graph.layout looks nicer).
19
- * Added markers, values, grid options.
20
-
21
- == Version 0.2.1
22
- (August 18th, 2006)
23
-
24
- * Mostly documentation.
25
- * Added Builder 2.0 dependency to gem spec.
26
- * Removed minimum size hack in RMagickRasterizer, for now.
27
-
28
-
29
- == Version 0.2.0
30
- (August 14th, 2006)
31
-
32
- - Lots of changes, hold on tight:
33
-
34
- * Redesigned rendering system to a component-based design.
35
- All objects on the canvas are components that can be re-arranged via renderers.
36
- * Created default renderer for basic Gruff-like layout.
37
- * Added Reversed and Cubed renderers to demonstrate the customization abilities (plus, they're cool).
38
- * Added Split renderer.
39
- * Created Viewport component to help with Cubed.
40
- - Viewport lets you scale it's inner components and move around the
41
- graph. Its components' sizes and positions are relative to the viewport,
42
- not the graph.
43
- * Set title to respect marker color if available.
44
- * Respects :to option in Graph#render for SVG output to file.
45
- * Stacked layer type -- accepts layers which it then uses to create a stacked graph. Such as Bar graphs
46
- and Area graphs.
47
- * Abstracted out layer_container functionality to helper module (for stacked graph)
48
- * Renamed value_transformers to value_formatters.
49
- * Refined Value Formatters.
50
- - Created default: Number.
51
- - Respects float precision
52
- - Allows for "auto-precision", which will use the largest precision (up to a customizable limit)
53
- necessary to portray the values correctly. ie: 5.1, 6.32, 7.142 becomes '5.100', '6.320', '7.142'
54
- * Modified Legend component, Layers, and Graph component to respect categories.
55
- - ie: Creating a Bar layer with :category => :sales and a Graph with :category => :qa will result in
56
- the Bay layer not being displayed. Allows for more than one Graph viewport on a screen with different
57
- layers.
58
- * Improved rasterizing at smaller sizes( < 300px) by rasterizing the image at a larger size first, then
59
- allowing RMagick to resize the image with specific filtering/blurring. Actually looks better than just
60
- rasterizing the SVG at the small size from the beginning.
61
- * Fixed Opacity on stacked graphs.
62
- * Added Style (invisible) components to allow for CSS styling. (Not recommended, however.)
63
- * Added Label component for arbitrary text.
64
- * Created Theme object in place of theme hash.
65
-
66
- == Version 0.1.0
67
- (August 11th, 2006)
68
-
69
- * First public release!
70
- * Legend rendering
71
- * Rasterizing graph to multiple image types (graph.render :as => 'PNG')
72
-
73
- == Version 0.0.12
74
- (August 10th, 2006)
75
- This is not a public release.
76
-
77
- * Rearranged Layers into a better class/module arrangement.
78
-
79
- == Version 0.0.11
80
- (August 10th, 2006)
81
- This is not a public release.
82
-
83
- * Fixed gem issue.
84
-
85
- == Version 0.0.10
86
- (August 10th, 2006)
87
-
88
- This is not a public release.
89
-
90
-
91
- * Removed bogus changelog.
92
-
93
-
94
- == Version 0.0.9
95
- (August 10th, 2006)
96
-
97
- This is not a public release.
98
-
99
- * Initial release.
100
- * Standard renderer.
101
- * Marker transformers: currency, percentages.
102
- * Basic Graphs: Area, Bar, Line.
103
- * Advanced Graphs: Average, AllSmiles.
104
- * Initial documentation.
@@ -1,20 +0,0 @@
1
- Copyright (c) 2006 Brasten Sager (brasten@nagilum.com)
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.