svg-graph 1.0.5 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/History.txt +18 -0
  3. data/README.markdown +90 -6
  4. data/Rakefile +26 -14
  5. data/lib/SVG/Graph/Bar.rb +2 -2
  6. data/lib/SVG/Graph/BarBase.rb +25 -24
  7. data/lib/SVG/Graph/BarHorizontal.rb +1 -1
  8. data/lib/SVG/Graph/ErrBar.rb +189 -0
  9. data/lib/SVG/Graph/Graph.rb +141 -64
  10. data/lib/SVG/Graph/Line.rb +1 -1
  11. data/lib/SVG/Graph/Pie.rb +76 -49
  12. data/lib/SVG/Graph/Plot.rb +2 -2
  13. data/lib/SVG/Graph/Schedule.rb +18 -19
  14. data/lib/SVG/Graph/TimeSeries.rb +26 -22
  15. data/lib/svggraph.rb +12 -10
  16. data/test/test_svg_graph.rb +48 -6
  17. metadata +41 -136
  18. data.tar.gz.sig +0 -2
  19. data/Manifest.txt +0 -56
  20. data/build.xml +0 -143
  21. data/dist.xml.in +0 -46
  22. data/images/bar.png +0 -0
  23. data/images/bar.svg +0 -76
  24. data/images/bar.svgz +0 -0
  25. data/images/barhorizontal.png +0 -0
  26. data/images/barhorizontal.svg +0 -76
  27. data/images/barhorizontal.svgz +0 -0
  28. data/images/line.png +0 -0
  29. data/images/line.svg +0 -80
  30. data/images/line.svgz +0 -0
  31. data/images/pie.png +0 -0
  32. data/images/pie.svg +0 -70
  33. data/images/pie.svgz +0 -0
  34. data/images/plot.png +0 -0
  35. data/images/plot.svg +0 -131
  36. data/images/plot.svgz +0 -0
  37. data/images/schedule.png +0 -0
  38. data/images/schedule.svg +0 -67
  39. data/images/timeseries.png +0 -0
  40. data/images/timeseries.svg +0 -179
  41. data/images/timeseries.svgz +0 -0
  42. data/index.xml +0 -281
  43. data/install.rb +0 -161
  44. data/screenshots.xml +0 -148
  45. data/style/common.xsl +0 -37
  46. data/style/release_html.xsl +0 -169
  47. data/style/release_txt.xsl +0 -25
  48. data/svg-graph.gemspec +0 -58
  49. data/test/data.txt +0 -4
  50. data/test/plot.rb +0 -51
  51. data/test/schedule.rb +0 -43
  52. data/test/single.rb +0 -33
  53. data/test/test.rb +0 -54
  54. data/test/test_data_point.rb +0 -67
  55. data/test/test_plot.rb +0 -282
  56. data/test/timeseries.rb +0 -58
  57. metadata.gz.sig +0 -1
data/style/common.xsl DELETED
@@ -1,37 +0,0 @@
1
- <?xml version='1.0' encoding='UTF-8'?>
2
-
3
- <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
5
- <xsl:stylesheet
6
- xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
7
-
8
- <xsl:template name='get-announce'>
9
- <xsl:param name='text'/>
10
- <xsl:if test='contains( $text, "@@" )'>
11
- <xsl:call-template name='announce-callback'>
12
- <xsl:with-param name='announcement'><xsl:value-of
13
- select='substring-before(
14
- substring-after( $text, "@@" ), "@@" )'/></xsl:with-param>
15
- </xsl:call-template>
16
- <xsl:call-template name='get-announce'>
17
- <xsl:with-param name='text' select='substring-after(
18
- substring-after( $text, "@@" ), "@@" )'/>
19
- </xsl:call-template>
20
- </xsl:if>
21
- </xsl:template>
22
-
23
- <xsl:template name='strip-announcements'>
24
- <xsl:param name='text'/>
25
- <xsl:choose>
26
- <xsl:when test='contains( $text, "@@" )'><xsl:value-of
27
- select='substring-before( $text, "@@" )'/><xsl:call-template
28
- name='strip-announcements'><xsl:with-param
29
- name='text'><xsl:value-of
30
- select='substring-after( substring-after( $text, "@@" ), "@@" )'
31
- /></xsl:with-param></xsl:call-template></xsl:when>
32
- <xsl:otherwise>
33
- <xsl:value-of select='$text'/>
34
- </xsl:otherwise>
35
- </xsl:choose>
36
- </xsl:template>
37
- </xsl:stylesheet>
@@ -1,169 +0,0 @@
1
- <?xml version='1.0' encoding='UTF-8'?>
2
-
3
- <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
5
- <xsl:stylesheet
6
- xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
7
-
8
- <xsl:output indent="yes" method="html"/>
9
-
10
- <xsl:include href='common.xsl'/>
11
-
12
- <xsl:param name='version'/>
13
- <xsl:param name='release'/>
14
- <xsl:param name='previous'/>
15
- <xsl:param name='last'/>
16
-
17
- <xsl:template match='/log'>
18
- <HTML>
19
- <HEAD><TITLE>FormsTK Change Log</TITLE></HEAD>
20
- <BODY>
21
- <H1 ALIGN='center'>FormsTK Change Log</H1>
22
- <H2 ALIGN='center'><xsl:value-of select='$release'/> (<xsl:value-of
23
- select='$version'/>)</H2>
24
- <H3 ALIGN='center'>Since previous minor release
25
- (<xsl:value-of select='$previous'/>)
26
- </H3>
27
-
28
- <xsl:call-template name='do-executive-summary'>
29
- <xsl:with-param name='nodeset' select='previous'/>
30
- </xsl:call-template>
31
-
32
- <xsl:apply-templates select='previous/logentry[string-length(normalize-space(msg/text())) > 0]'/>
33
-
34
- <H3 ALIGN='center'>Since last major release
35
- (<xsl:value-of select='$last'/>)
36
- </H3>
37
-
38
- <xsl:call-template name='do-executive-summary'>
39
- <xsl:with-param name='nodeset' select='last'/>
40
- </xsl:call-template>
41
-
42
- <xsl:apply-templates select='last/logentry[string-length(normalize-space(msg/text())) > 0]'/>
43
- </BODY>
44
- </HTML>
45
- </xsl:template>
46
-
47
- <xsl:template match='versioninfo'>
48
- <xsl:value-of select='@release'/> (<xsl:value-of select='normalize-space( substring-after( @version, ":" ))'/>)
49
- <xsl:value-of select='@date'/>
50
- </xsl:template>
51
-
52
- <xsl:template match='logentry'>
53
- <xsl:param name='message'><xsl:call-template
54
- name='strip-announcements'><xsl:with-param name='text'
55
- select='msg/text()'/></xsl:call-template></xsl:param>
56
-
57
- <DIV STYLE='display: block;
58
- border: 2px solid #444;
59
- background-color: #ddf;
60
- margin-bottom: 10px;'>
61
-
62
- <DIV STYLE='display: block;
63
- float: right;
64
- background-color: #DfD;
65
- margin: 0px;
66
- padding: 2px;'><xsl:value-of select='date/text()'/></DIV>
67
- <DIV STYLE='display: block;
68
- background-color: #DfD;
69
- margin: 0px;
70
- padding: 2px;'><xsl:value-of select='@revision'/></DIV>
71
-
72
- <PRE><xsl:call-template name='word-wrap'><xsl:with-param
73
- name='T' select='$message'/></xsl:call-template></PRE>
74
-
75
- <DIV STYLE='display: block;
76
- background-color: #DfD;
77
- margin: 0px;
78
- padding: 2px;'><xsl:value-of select='author/text()'/></DIV>
79
- </DIV>
80
- </xsl:template>
81
-
82
-
83
- <xsl:template name='word-wrap'>
84
- <xsl:param name='L'/>
85
- <xsl:param name='T'/>
86
- <xsl:param name='LL'>80</xsl:param>
87
- <xsl:variable name="cr" select="'&#xa;'"/>
88
-
89
- <xsl:variable name='NT' select='normalize-space($T)'/>
90
- <xsl:variable name='NL' select='normalize-space($L)'/>
91
- <xsl:variable name='LT' select='concat( $NL, " ", $NT )'/>
92
-
93
- <xsl:choose>
94
- <xsl:when test='contains( $L, $cr )'>
95
- <xsl:value-of
96
- select='normalize-space(substring-before( $L, $cr ))'/><xsl:text>
97
- </xsl:text><xsl:call-template name='word-wrap'><xsl:with-param name='T'
98
- select='concat( substring-after( $L, $cr ), " ",
99
- $T)'/></xsl:call-template>
100
- </xsl:when>
101
- <xsl:otherwise>
102
- <xsl:choose>
103
- <xsl:when test='string-length( $NT ) = 0'>
104
- <xsl:value-of select='normalize-space($L)'/>
105
- </xsl:when>
106
- <xsl:when test='string-length(normalize-space(concat( $L, " ",
107
- substring-before($NT, " ")))) &lt;= $LL'>
108
- <xsl:choose>
109
- <xsl:when test='substring-before($T, $cr) =
110
- substring-before($NT, " ")'>
111
- <xsl:value-of select='concat($NL, " ",
112
- substring-before($T, $cr))'/><xsl:text>
113
- </xsl:text><xsl:call-template name='word-wrap'><xsl:with-param name='T'
114
- select='substring-after($T, $cr)'/></xsl:call-template>
115
- </xsl:when>
116
- <xsl:when test='not( contains( $NT, " " ) )'>
117
- <xsl:value-of select='normalize-space($LT)'/>
118
- </xsl:when>
119
- <xsl:otherwise>
120
- <xsl:call-template name='word-wrap'><xsl:with-param name='L'
121
- select='concat($L, " ",
122
- substring-before($T, " "))'/><xsl:with-param
123
- name='T' select='substring-after($T, " ")'/></xsl:call-template>
124
- </xsl:otherwise>
125
- </xsl:choose>
126
- </xsl:when>
127
- <xsl:when test='string-length(normalize-space(concat(
128
- $L, " ", $NT))) &lt;= $LL'>
129
- <xsl:value-of select='$LT'/>
130
- </xsl:when>
131
- <xsl:otherwise>
132
- <xsl:value-of select='$NL'/><xsl:text>
133
- </xsl:text><xsl:call-template name='word-wrap'><xsl:with-param name='T'
134
- select='$T'/></xsl:call-template>
135
- </xsl:otherwise>
136
- </xsl:choose>
137
- </xsl:otherwise>
138
- </xsl:choose>
139
- </xsl:template>
140
-
141
-
142
- <xsl:template name='announce-callback'>
143
- <xsl:param name='announcement'/>
144
- <LI><xsl:value-of select='$announcement'/></LI>
145
- </xsl:template>
146
-
147
- <xsl:template name='do-executive-summary'>
148
- <xsl:param name='nodeset'/>
149
-
150
- <DIV STYLE='display: block;
151
- border: 2px solid #444;
152
- background-color: #EEF;
153
- margin-bottom: 10px;'>
154
-
155
- <DIV STYLE='display: block;
156
- background-color: #ADA;
157
- margin: 0px;
158
- padding: 2px;'>Executive Summary</DIV>
159
-
160
- <UL>
161
- <xsl:for-each select='$nodeset/logentry[contains(msg/text(), "@@")]'>
162
- <xsl:call-template name='get-announce'>
163
- <xsl:with-param name='text' select='msg/text()'/>
164
- </xsl:call-template>
165
- </xsl:for-each>
166
- </UL>
167
- </DIV>
168
- </xsl:template>
169
- </xsl:stylesheet>
@@ -1,25 +0,0 @@
1
- <?xml version='1.0' encoding='UTF-8'?>
2
-
3
- <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
5
- <xsl:stylesheet
6
- xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
7
-
8
- <xsl:output indent="yes" method="text"/>
9
-
10
- <xsl:template match='/log'>
11
- FormsTK Change Log
12
- <xsl:apply-templates select='logentry[string-length(normalize-space(msg/text())) > 0]'/>
13
- </xsl:template>
14
-
15
- <xsl:template match='logentry'>
16
- <xsl:text>============================================================
17
- </xsl:text>
18
- <xsl:value-of select='normalize-space(@revision)'/> (<xsl:value-of select='date/text()'/>) <xsl:value-of select='author/text()'/>
19
- <xsl:text>
20
- </xsl:text>
21
- <xsl:value-of select='msg/text()'/>
22
- <xsl:text>
23
- </xsl:text>
24
- </xsl:template>
25
- </xsl:stylesheet>
data/svg-graph.gemspec DELETED
@@ -1,58 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{svg-graph}
8
- s.version = "1.0.2"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = [%q{Sean Russell}, %q{Claudio Bustos}, %q{Liehann Loots}, %q{Piergiuliano Bossi}]
12
- s.date = %q{2011-08-05}
13
- s.description = %q{Gem version of SVG:::Graph. 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.
14
- }
15
- s.email = [%q{ser_AT_germane-software.com}, %q{clbustos_AT_gmail.com}, %q{liehannl_AT_gmail_DOT_com}, %q{pgbossi_AT_gmail_DOT_com}]
16
- s.extra_rdoc_files = [
17
- "LICENSE.txt",
18
- "README.markdown",
19
- "README.txt"
20
- ]
21
- s.files = [
22
- "GPL.txt",
23
- "History.txt",
24
- "LICENSE.txt",
25
- "README.txt",
26
- "Rakefile",
27
- "lib/SVG/Graph/Bar.rb",
28
- "lib/SVG/Graph/BarBase.rb",
29
- "lib/SVG/Graph/BarHorizontal.rb",
30
- "lib/SVG/Graph/Graph.rb",
31
- "lib/SVG/Graph/Line.rb",
32
- "lib/SVG/Graph/Pie.rb",
33
- "lib/SVG/Graph/Plot.rb",
34
- "lib/SVG/Graph/Schedule.rb",
35
- "lib/SVG/Graph/TimeSeries.rb",
36
- "lib/svggraph.rb",
37
- "test/test_svg_graph.rb"
38
- ]
39
- s.homepage = %q{http://www.germane-software.com/software/SVG/SVG::Graph/}
40
- s.licenses = [%q{GPL}]
41
- s.require_paths = [%q{lib}]
42
- s.rubyforge_project = %q{ruby-statsample}
43
- s.rubygems_version = %q{1.8.6}
44
- s.summary = %q{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.}
45
-
46
- if s.respond_to? :specification_version then
47
- s.specification_version = 3
48
-
49
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
50
- s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
51
- else
52
- s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
53
- end
54
- else
55
- s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
56
- end
57
- end
58
-
data/test/data.txt DELETED
@@ -1,4 +0,0 @@
1
- Question 7
2
- Internet,TV,Newspaper,Magazine,Radio
3
- -2 3 1 3 1
4
- 0 2 1 5 4
data/test/plot.rb DELETED
@@ -1,51 +0,0 @@
1
- $: << File.dirname(__FILE__) + '/../lib'
2
- require 'SVG/Graph/Plot'
3
-
4
-
5
- title = "Plot"
6
- #data1 = []
7
- #(rand(10)+5).times{
8
- # data1 << rand(20)
9
- # data1 << rand(20)
10
- #}
11
- data1 = [6.1, 11.2, 0.3, 5.4, 18.5, 7.6, 1.7, 11.8, 13.9, 9.11, 11.22, 2.33, 19.44, 0.555, 3.6666, 13.77777, 7.888888, 9.9999999]
12
- #data2 = []
13
- #(rand(10)+5).times{
14
- # data2 << rand(20)
15
- # data2 << rand(20)
16
- #}
17
- data2 = [0, 18, 8, 15, 9, 4, 18, 14, 10, 2, 11, 6, 14, 12, 15, 6, 4, 17, 2, 12]
18
-
19
-
20
- graph = SVG::Graph::Plot.new( {
21
- :width => 640,
22
- :height => 480,
23
- :graph_title => title,
24
- :show_graph_title => true,
25
- :no_css => true,
26
- :key => true,
27
- :scale_x_integers => true,
28
- :scale_y_integers => false,
29
- :min_x_value => 0,
30
- :min_y_value => 0,
31
- :show_data_labels => true,
32
- :show_x_guidelines => true,
33
- :show_x_title => true,
34
- :x_title => "Time",
35
- :show_y_title => true,
36
- :y_title => "Ice Cream Cones",
37
- :y_title_text_direction => :bt,
38
- :show_lines => false,
39
- :add_popups => true,
40
- :round_popups => false
41
- })
42
- graph.add_data(
43
- :data => data1,
44
- :title => "Dataset 1"
45
- )
46
- graph.add_data(
47
- :data => data2,
48
- :title => "Dataset 2"
49
- )
50
- puts graph.burn
51
-
data/test/schedule.rb DELETED
@@ -1,43 +0,0 @@
1
- require 'SVG/Graph/Schedule'
2
-
3
-
4
- title = "Billy's Schedule"
5
- data1 = [
6
- "History 107", "5/19/04", "6/30/04",
7
- "Algebra 011", "6/2/04", "8/11/04",
8
- "Psychology 101", "6/28/04", "8/9/04",
9
- "Acting 105", "7/7/04", "8/16/04"
10
- ]
11
-
12
- graph = SVG::Graph::Schedule.new( {
13
- :width => 640,
14
- :height => 480,
15
- :graph_title => title,
16
- :show_graph_title => true,
17
- :no_css => true,
18
- :key => false,
19
- :scale_x_integers => true,
20
- :scale_y_integers => true,
21
- :show_data_labels => true,
22
- :show_y_guidelines => false,
23
- :show_x_guidelines => true,
24
- :show_x_title => true,
25
- :x_title => "Time",
26
- :show_y_title => false,
27
- :rotate_x_labels => true,
28
- :rotate_y_labels => false,
29
- :x_label_format => "%m/%d",
30
- :timescale_divisions => "1 weeks",
31
- :add_popups => true,
32
- :popup_format => "%m/%d/%y",
33
- :area_fill => true,
34
- :min_y_value => 0,
35
- })
36
-
37
- graph.add_data(
38
- :data => data1,
39
- :title => "Data"
40
- )
41
-
42
- puts graph.burn
43
-
data/test/single.rb DELETED
@@ -1,33 +0,0 @@
1
- require 'SVG/Graph/BarHorizontal'
2
- require 'SVG/Graph/Bar'
3
- require 'SVG/Graph/Line'
4
- require 'SVG/Graph/Pie'
5
-
6
-
7
- File.open( "data.txt" ) { |fin|
8
- title = fin.readline
9
- fields = fin.readline.split( /,/ )
10
- female_data = fin.readline.split( " " ).collect{|x| x.to_i}
11
- male_data = fin.readline.split( " " ).collect{|x| x.to_i}
12
-
13
- graph = SVG::Graph::Pie.new( {
14
- :width => 640,
15
- :height => 480,
16
- :fields => fields,
17
- :graph_title => title,
18
- :show_graph_title => true,
19
- :no_css => true,
20
- :expanded => true,
21
- :show_data_labels => true
22
- })
23
- graph.add_data( {
24
- :data => female_data,
25
- :title => "Female"
26
- })
27
- graph.add_data( {
28
- :data => male_data,
29
- :title => "Male"
30
- })
31
- puts graph.burn
32
- }
33
-
data/test/test.rb DELETED
@@ -1,54 +0,0 @@
1
- require 'SVG/Graph/BarHorizontal'
2
- require 'SVG/Graph/Bar'
3
- require 'SVG/Graph/Line'
4
- require 'SVG/Graph/Pie'
5
-
6
- def gen klass, args, title, fields, female_data, male_data
7
- args[ :width ] = 640
8
- args[ :height ] = 480
9
- #args[ :compress ] = true
10
- args[ :fields ] = fields
11
- args[ :graph_title ] = title
12
- args[ :show_graph_title ] = true
13
- args[ :no_css ] = true
14
- puts klass.name
15
- graph = klass.new( args )
16
- graph.add_data( {
17
- :data => female_data,
18
- :title => "Female"
19
- })
20
- graph.add_data( {
21
- :data => male_data,
22
- :title => "Male"
23
- })
24
- return graph.burn
25
- end
26
-
27
- File.open( "data.txt" ) { |fin|
28
- title = fin.readline
29
- fields = fin.readline.split( /,/ )
30
- female_data = fin.readline.split( " " ).collect{|x| x.to_i}
31
- male_data = fin.readline.split( " " ).collect{|x| x.to_i}
32
-
33
- for file, klass, args in [
34
- [ "bar", SVG::Graph::Bar,
35
- { :scale_integers => true,
36
- :stack => :side } ],
37
- [ "barhorizontal",SVG::Graph::BarHorizontal,
38
- {:scale_integers=> true,
39
- :stack=>:side,
40
- :rotate_x_labels => true
41
- }],
42
- [ "line", SVG::Graph::Line,
43
- { :scale_integers => true,
44
- :area_fill => true, } ],
45
- [ "pie", SVG::Graph::Pie,
46
- { :expand_greatest => true,
47
- :show_data_labels => true, } ],
48
- ]
49
- File.open("#{file}.svg", "w") {|fout|
50
- fout.print( gen(klass, args, title, fields, female_data, male_data ) )
51
- }
52
- end
53
- }
54
-