svg-graph 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/GPL.txt +340 -0
- data/History.txt +6 -0
- data/LICENSE.txt +57 -0
- data/Manifest.txt +17 -0
- data/README.txt +76 -0
- data/Rakefile +15 -0
- data/lib/SVG/Graph/Bar.rb +148 -0
- data/lib/SVG/Graph/BarBase.rb +139 -0
- data/lib/SVG/Graph/BarHorizontal.rb +149 -0
- data/lib/SVG/Graph/Graph.rb +977 -0
- data/lib/SVG/Graph/Line.rb +444 -0
- data/lib/SVG/Graph/Pie.rb +395 -0
- data/lib/SVG/Graph/Plot.rb +501 -0
- data/lib/SVG/Graph/Schedule.rb +373 -0
- data/lib/SVG/Graph/TimeSeries.rb +241 -0
- data/lib/svggraph.rb +14 -0
- data/test/test_svg_graph.rb +55 -0
- metadata +86 -0
data/lib/svggraph.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
module SVG
|
2
|
+
module Graph
|
3
|
+
VERSION = '1.0.0'
|
4
|
+
ORIGINAL_VERSION='0.6.1'
|
5
|
+
autoload(:Bar, 'SVG/Graph/Bar')
|
6
|
+
autoload(:BarBase, 'SVG/Graph/BarBase')
|
7
|
+
autoload(:BarHorizontal, 'SVG/Graph/BarHorizontal')
|
8
|
+
autoload(:Line, 'SVG/Graph/Line')
|
9
|
+
autoload(:Pie, 'SVG/Graph/Pie')
|
10
|
+
autoload(:Plot, 'SVG/Graph/Plot')
|
11
|
+
autoload(:Schedule, 'SVG/Graph/Schedule')
|
12
|
+
autoload(:TimeSeries, 'SVG/Graph/TimeSeries')
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require "test/unit"
|
2
|
+
require "svggraph"
|
3
|
+
|
4
|
+
class TestSvgGraph < Test::Unit::TestCase
|
5
|
+
def test_bar_line_and_pie
|
6
|
+
fields = %w(Jan Feb Mar);
|
7
|
+
data_sales_02 = [12, 45, 21]
|
8
|
+
[SVG::Graph::Bar, SVG::Graph::BarHorizontal, SVG::Graph::Line, SVG::Graph::Pie].each do
|
9
|
+
|klass|
|
10
|
+
graph = klass.new(
|
11
|
+
:height => 500,
|
12
|
+
:width => 300,
|
13
|
+
:fields => fields
|
14
|
+
)
|
15
|
+
graph.add_data(
|
16
|
+
:data => data_sales_02,
|
17
|
+
:title => 'Sales 2002'
|
18
|
+
)
|
19
|
+
out=graph.burn
|
20
|
+
assert(out=~/Created with SVG::Graph/)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
def test_plot
|
24
|
+
|
25
|
+
projection = [
|
26
|
+
6, 11, 0, 5, 18, 7, 1, 11, 13, 9, 1, 2, 19, 0, 3, 13,
|
27
|
+
7, 9
|
28
|
+
]
|
29
|
+
actual = [
|
30
|
+
0, 18, 8, 15, 9, 4, 18, 14, 10, 2, 11, 6, 14, 12,
|
31
|
+
15, 6, 4, 17, 2, 12
|
32
|
+
]
|
33
|
+
|
34
|
+
graph = SVG::Graph::Plot.new({
|
35
|
+
:height => 500,
|
36
|
+
:width => 300,
|
37
|
+
:key => true,
|
38
|
+
:scale_x_integers => true,
|
39
|
+
:scale_y_integerrs => true,
|
40
|
+
})
|
41
|
+
|
42
|
+
graph.add_data({
|
43
|
+
:data => projection,
|
44
|
+
:title => 'Projected',
|
45
|
+
})
|
46
|
+
|
47
|
+
graph.add_data({
|
48
|
+
:data => actual,
|
49
|
+
:title => 'Actual',
|
50
|
+
})
|
51
|
+
|
52
|
+
out=graph.burn()
|
53
|
+
assert(out=~/Created with SVG::Graph/)
|
54
|
+
end
|
55
|
+
end
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: svg-graph
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sean Russell
|
8
|
+
- Claudio Bustos
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2009-08-01 00:00:00 -04:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: hoe
|
18
|
+
type: :development
|
19
|
+
version_requirement:
|
20
|
+
version_requirements: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 2.3.2
|
25
|
+
version:
|
26
|
+
description: SVG:::Graph is a pure Ruby library for generating charts, which are a type of graph where the values of one axis are not scalar. SVG::Graph has a verry similar API to the Perl library SVG::TT::Graph, and the resulting charts also look the same. This isn't surprising, because SVG::Graph started as a loose port of SVG::TT::Graph, although the internal code no longer resembles the Perl original at all.
|
27
|
+
email:
|
28
|
+
- ser_AT_germane-software.com
|
29
|
+
- clbustos_AT_gmail.com
|
30
|
+
executables: []
|
31
|
+
|
32
|
+
extensions: []
|
33
|
+
|
34
|
+
extra_rdoc_files:
|
35
|
+
- GPL.txt
|
36
|
+
- History.txt
|
37
|
+
- LICENSE.txt
|
38
|
+
- Manifest.txt
|
39
|
+
- README.txt
|
40
|
+
files:
|
41
|
+
- GPL.txt
|
42
|
+
- History.txt
|
43
|
+
- LICENSE.txt
|
44
|
+
- Manifest.txt
|
45
|
+
- README.txt
|
46
|
+
- Rakefile
|
47
|
+
- lib/svggraph.rb
|
48
|
+
- lib/SVG/Graph/Bar.rb
|
49
|
+
- lib/SVG/Graph/BarBase.rb
|
50
|
+
- lib/SVG/Graph/BarHorizontal.rb
|
51
|
+
- lib/SVG/Graph/Graph.rb
|
52
|
+
- lib/SVG/Graph/Line.rb
|
53
|
+
- lib/SVG/Graph/Pie.rb
|
54
|
+
- lib/SVG/Graph/Plot.rb
|
55
|
+
- lib/SVG/Graph/Schedule.rb
|
56
|
+
- lib/SVG/Graph/TimeSeries.rb
|
57
|
+
- test/test_svg_graph.rb
|
58
|
+
has_rdoc: true
|
59
|
+
homepage: Gem version of SVG::Graph, available on http://www.germane-software.com/software/SVG/SVG::Graph/
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options:
|
62
|
+
- --main
|
63
|
+
- README.txt
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: "0"
|
71
|
+
version:
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: "0"
|
77
|
+
version:
|
78
|
+
requirements: []
|
79
|
+
|
80
|
+
rubyforge_project: ruby-statsample
|
81
|
+
rubygems_version: 1.3.1
|
82
|
+
signing_key:
|
83
|
+
specification_version: 2
|
84
|
+
summary: SVG:::Graph is a pure Ruby library for generating charts, which are a type of graph where the values of one axis are not scalar
|
85
|
+
test_files:
|
86
|
+
- test/test_svg_graph.rb
|