statsample 0.6.5 → 0.6.7
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +15 -0
- data/Manifest.txt +6 -0
- data/README.txt +30 -12
- data/Rakefile +91 -0
- data/demo/levene.rb +9 -0
- data/demo/multiple_regression.rb +1 -7
- data/demo/polychoric.rb +1 -0
- data/demo/principal_axis.rb +8 -0
- data/lib/distribution/f.rb +22 -22
- data/lib/spss.rb +99 -99
- data/lib/statsample/bivariate/polychoric.rb +32 -22
- data/lib/statsample/bivariate/tetrachoric.rb +212 -207
- data/lib/statsample/bivariate.rb +6 -6
- data/lib/statsample/codification.rb +65 -65
- data/lib/statsample/combination.rb +60 -59
- data/lib/statsample/converter/csv19.rb +12 -12
- data/lib/statsample/converters.rb +1 -1
- data/lib/statsample/dataset.rb +93 -36
- data/lib/statsample/dominanceanalysis/bootstrap.rb +66 -3
- data/lib/statsample/dominanceanalysis.rb +5 -6
- data/lib/statsample/factor/pca.rb +41 -11
- data/lib/statsample/factor/principalaxis.rb +105 -29
- data/lib/statsample/factor/rotation.rb +20 -3
- data/lib/statsample/factor.rb +1 -1
- data/lib/statsample/graph/gdchart.rb +13 -13
- data/lib/statsample/graph/svggraph.rb +166 -167
- data/lib/statsample/matrix.rb +22 -12
- data/lib/statsample/mle/logit.rb +3 -2
- data/lib/statsample/mle/probit.rb +7 -5
- data/lib/statsample/mle.rb +4 -2
- data/lib/statsample/multiset.rb +125 -124
- data/lib/statsample/permutation.rb +2 -1
- data/lib/statsample/regression/binomial/logit.rb +4 -3
- data/lib/statsample/regression/binomial/probit.rb +2 -1
- data/lib/statsample/regression/binomial.rb +62 -81
- data/lib/statsample/regression/multiple/baseengine.rb +1 -1
- data/lib/statsample/regression/multiple/gslengine.rb +1 -1
- data/lib/statsample/regression/multiple/matrixengine.rb +12 -6
- data/lib/statsample/regression/multiple.rb +15 -42
- data/lib/statsample/regression/simple.rb +93 -78
- data/lib/statsample/regression.rb +74 -2
- data/lib/statsample/reliability.rb +117 -120
- data/lib/statsample/srs.rb +156 -153
- data/lib/statsample/test/levene.rb +90 -0
- data/lib/statsample/test/umannwhitney.rb +25 -9
- data/lib/statsample/test.rb +2 -0
- data/lib/statsample/vector.rb +388 -413
- data/lib/statsample.rb +74 -30
- data/po/es/statsample.mo +0 -0
- data/test/test_bivariate.rb +5 -4
- data/test/test_combination.rb +1 -1
- data/test/test_dataset.rb +2 -2
- data/test/test_factor.rb +53 -6
- data/test/test_gsl.rb +1 -1
- data/test/test_mle.rb +1 -1
- data/test/test_regression.rb +18 -33
- data/test/test_statistics.rb +15 -33
- data/test/test_stest.rb +35 -0
- data/test/test_svg_graph.rb +2 -2
- data/test/test_vector.rb +331 -333
- metadata +38 -11
@@ -1,59 +1,128 @@
|
|
1
1
|
module Statsample
|
2
2
|
module Factor
|
3
|
+
# Principal Axis Analysis for a covariance or correlation matrix.
|
4
|
+
#
|
5
|
+
# For PCA, use Statsample::Factor::PCA
|
6
|
+
#
|
7
|
+
# == Usage:
|
8
|
+
# require 'statsample'
|
9
|
+
# a=[2.5, 0.5, 2.2, 1.9, 3.1, 2.3, 2.0, 1.0, 1.5, 1.1].to_scale
|
10
|
+
# b=[2.4,0.7,2.9,2.2,3.0,2.7,1.6,1.1,1.6,0.9].to_scale
|
11
|
+
# ds={'a'=>a,'b'=>b}.to_dataset
|
12
|
+
# cor_matrix=Statsample::Bivariate.correlation_matrix(ds)
|
13
|
+
# pa=Statsample::Factor::PrincipalAxis.new(cor_matrix)
|
14
|
+
# pa.iterate(1)
|
15
|
+
# pa.m
|
16
|
+
# => 1
|
17
|
+
# pca.component_matrix
|
18
|
+
# => GSL::Matrix
|
19
|
+
# [ 9.622e-01
|
20
|
+
# 9.622e-01 ]
|
21
|
+
# pca.communalities
|
22
|
+
# => [0.962964636346122, 0.962964636346122]
|
23
|
+
#
|
24
|
+
# == References:
|
25
|
+
#
|
26
|
+
# * SPSS manual
|
27
|
+
# * Smith, L. (2002). A tutorial on Principal Component Analysis. Available on http://courses.eas.ualberta.ca/eas570/pca_tutorial.pdf
|
28
|
+
#
|
3
29
|
class PrincipalAxis
|
4
|
-
|
30
|
+
# Minimum difference between succesive iterations on sum of communalities
|
31
|
+
DELTA=1e-3
|
32
|
+
# Maximum number of iterations
|
33
|
+
MAX_ITERATIONS=50
|
5
34
|
include GetText
|
6
35
|
bindtextdomain("statsample")
|
7
|
-
|
36
|
+
# Number of factors. Set by default to the number of factors
|
37
|
+
# with eigen values > 1 on PCA over data
|
38
|
+
attr_accessor :m
|
8
39
|
|
9
|
-
|
10
|
-
|
40
|
+
# Name of analysis
|
41
|
+
attr_accessor :name
|
42
|
+
|
43
|
+
# Number of iterations required to converge
|
44
|
+
attr_reader :iterations
|
45
|
+
# Initial eigenvalues
|
46
|
+
attr_reader :initial_eigenvalues
|
47
|
+
# Tolerance for iteratios.
|
48
|
+
attr_accessor :epsilon
|
49
|
+
# Use SMC(squared multiple correlations) as diagonal. If false, use 1
|
50
|
+
attr_accessor :smc
|
51
|
+
# Maximum number of iterations
|
52
|
+
attr_accessor :max_iterations
|
53
|
+
# Eigenvalues of factor analysis
|
54
|
+
attr_accessor :eigenvalues
|
55
|
+
|
56
|
+
def initialize(matrix, opts=Hash.new)
|
11
57
|
@matrix=matrix
|
12
58
|
@name=""
|
13
59
|
@m=nil
|
60
|
+
@initial_eigenvalues=nil
|
61
|
+
@initial_communalities=nil
|
62
|
+
@component_matrix=nil
|
63
|
+
@delta=DELTA
|
64
|
+
@smc=true
|
65
|
+
@max_iterations=MAX_ITERATIONS
|
14
66
|
opts.each{|k,v|
|
15
67
|
self.send("#{k}=",v) if self.respond_to? k
|
16
68
|
}
|
69
|
+
|
70
|
+
if @m.nil?
|
71
|
+
pca=PCA.new(::Matrix.rows(@matrix.to_a))
|
72
|
+
@m=pca.m
|
73
|
+
end
|
74
|
+
|
17
75
|
@clean=true
|
18
76
|
end
|
19
|
-
|
77
|
+
# Communality for all variables given m factors
|
78
|
+
def communalities(m=nil)
|
20
79
|
if m!=@m or @clean
|
21
80
|
iterate(m)
|
22
|
-
raise "Can't calculate
|
81
|
+
raise "Can't calculate comunality" if @communalities.nil?
|
23
82
|
end
|
24
|
-
@
|
83
|
+
@communalities
|
25
84
|
end
|
26
|
-
|
85
|
+
# Component matrix for m factors
|
86
|
+
def component_matrix(m=nil)
|
27
87
|
if m!=@m or @clean
|
28
88
|
iterate(m)
|
29
89
|
end
|
30
90
|
@component_matrix
|
31
91
|
end
|
32
|
-
|
33
|
-
|
92
|
+
# Iterate to find the factors
|
93
|
+
# Parameters
|
94
|
+
# * m: Number of factors
|
95
|
+
def iterate(m=nil)
|
34
96
|
@clean=false
|
97
|
+
m||=@m
|
35
98
|
@m=m
|
99
|
+
t = @max_iterations
|
36
100
|
work_matrix=@matrix.to_a
|
101
|
+
|
37
102
|
prev_com=initial_communalities
|
103
|
+
|
38
104
|
pca=PCA.new(::Matrix.rows(work_matrix))
|
39
105
|
@initial_eigenvalues=pca.eigenvalues
|
106
|
+
prev_sum=prev_com.inject(0) {|ac,v| ac+v}
|
40
107
|
@iterations=0
|
41
108
|
t.times do |i|
|
42
109
|
@iterations+=1
|
43
110
|
prev_com.each_with_index{|v,it|
|
44
111
|
work_matrix[it][it]=v
|
45
112
|
}
|
46
|
-
pca=
|
47
|
-
|
48
|
-
@
|
113
|
+
pca=PCA.new(::Matrix.rows(work_matrix))
|
114
|
+
@communalities=pca.communalities(m)
|
115
|
+
@eigenvalues=pca.eigenvalues
|
116
|
+
com_sum=@communalities.inject(0) {|ac,v| ac+v}
|
49
117
|
jump=true
|
50
|
-
|
118
|
+
|
119
|
+
break if (com_sum-prev_sum).abs<@delta
|
120
|
+
@communalities.each_with_index do |v2,i2|
|
51
121
|
raise "Variable #{i2} with communality > 1" if v2>1.0
|
52
|
-
#p (v2-prev_com[i2]).abs
|
53
|
-
jump=false if (v2-prev_com[i2]).abs>=MIN_CHANGE_ESTIMATE
|
54
122
|
end
|
55
|
-
|
56
|
-
prev_com=@
|
123
|
+
prev_sum=com_sum
|
124
|
+
prev_com=@communalities
|
125
|
+
|
57
126
|
end
|
58
127
|
@component_matrix=pca.component_matrix(m)
|
59
128
|
end
|
@@ -61,14 +130,20 @@ module Factor
|
|
61
130
|
|
62
131
|
def initial_communalities
|
63
132
|
if @initial_communalities.nil?
|
133
|
+
if @smc
|
64
134
|
@initial_communalities=@matrix.column_size.times.collect {|i|
|
65
|
-
rxx , rxy =
|
135
|
+
rxx , rxy = PrincipalAxis.separate_matrices(@matrix,i)
|
66
136
|
matrix=(rxy.t*rxx.inverse*rxy)
|
67
137
|
matrix[0,0]
|
68
138
|
}
|
139
|
+
else
|
140
|
+
@initial_communalities=[1.0]*@matrix.column_size
|
141
|
+
end
|
69
142
|
end
|
70
143
|
@initial_communalities
|
71
144
|
end
|
145
|
+
|
146
|
+
|
72
147
|
# Returns two matrixes from a correlation matrix
|
73
148
|
# with regressors correlation matrix and criteria xy
|
74
149
|
# matrix.
|
@@ -91,21 +166,22 @@ module Factor
|
|
91
166
|
rxx=Matrix.rows(rows)
|
92
167
|
[rxx,rxy]
|
93
168
|
end
|
94
|
-
|
95
|
-
|
169
|
+
def summary
|
170
|
+
rp=ReportBuilder.new()
|
171
|
+
rp.add(self)
|
172
|
+
rp.to_text
|
173
|
+
end
|
96
174
|
def to_reportbuilder(generator)
|
175
|
+
iterate if @clean
|
97
176
|
anchor=generator.add_toc_entry(_("Factor Analysis: ")+name)
|
98
177
|
generator.add_html "<div class='pca'>"+_("Factor Analysis")+" #{@name}<a name='#{anchor}'></a>"
|
99
|
-
|
100
|
-
# Set number of factors with eigenvalues > 1
|
101
|
-
m=@eigenpairs.find_all {|v| v[0]>=1.0}.size
|
102
|
-
else
|
103
|
-
m=@m
|
104
|
-
end
|
178
|
+
|
105
179
|
generator.add_text "Number of factors: #{m}"
|
180
|
+
generator.add_text "Iterations: #{@iterations}"
|
181
|
+
|
106
182
|
t=ReportBuilder::Table.new(:name=>_("Communalities"), :header=>["Variable","Initial","Extraction"])
|
107
|
-
|
108
|
-
t.add_row([i, sprintf("%0.
|
183
|
+
communalities(m).each_with_index {|com,i|
|
184
|
+
t.add_row([i, sprintf("%0.4f", initial_communalities[i]), sprintf("%0.3f", com)])
|
109
185
|
}
|
110
186
|
generator.parse_element(t)
|
111
187
|
|
@@ -16,19 +16,36 @@ module Factor
|
|
16
16
|
# p rotation.component_transformation_matrix
|
17
17
|
#
|
18
18
|
class Rotation
|
19
|
-
|
19
|
+
EPSILON=1e-15
|
20
|
+
MAX_ITERATIONS=25
|
21
|
+
|
20
22
|
attr_reader :iterations, :rotated, :component_transformation_matrix, :h2
|
23
|
+
# Maximum number of iterations
|
24
|
+
attr_accessor :max_iterations
|
25
|
+
# Maximum precision
|
26
|
+
attr_accessor :epsilon
|
27
|
+
|
28
|
+
|
21
29
|
def initialize(matrix, opts=Hash.new)
|
22
30
|
@matrix=matrix
|
23
31
|
@n=@matrix.row_size # Variables, p on original
|
24
32
|
@m=@matrix.column_size # Factors, r on original
|
25
33
|
@component_transformation_matrix=nil
|
34
|
+
@max_iterations=MAX_ITERATIONS
|
35
|
+
@epsilon=EPSILON
|
26
36
|
@h2=(@matrix.collect {|c| c**2} * Matrix.column_vector([1]*@m)).column(0).to_a
|
37
|
+
opts.each{|k,v|
|
38
|
+
self.send("#{k}=",v) if self.respond_to? k
|
39
|
+
}
|
40
|
+
|
41
|
+
|
27
42
|
end
|
28
43
|
alias_method :communalities, :h2
|
29
44
|
alias_method :rotated_component_matrix, :rotated
|
30
45
|
# Start iteration of
|
31
|
-
def iterate(max_i=
|
46
|
+
def iterate(max_i=nil)
|
47
|
+
max_i||=@max_iterations
|
48
|
+
@max_iterations=max_i
|
32
49
|
t=Matrix.identity(@m)
|
33
50
|
b=@matrix.dup
|
34
51
|
h=Matrix.diagonal(*@h2).collect {|c| Math::sqrt(c)}
|
@@ -61,7 +78,7 @@ module Factor
|
|
61
78
|
phi=Math::atan2(num,den) / 4.0
|
62
79
|
# puts "#{i}-#{j}: #{phi}"
|
63
80
|
|
64
|
-
if(Math::sin(phi.abs) >=
|
81
|
+
if(Math::sin(phi.abs) >= @epsilon)
|
65
82
|
xx_rot=( Math::cos(phi)*xx)+(Math::sin(phi)*yy)
|
66
83
|
yy_rot=((-Math::sin(phi))*xx)+(Math::cos(phi)*yy)
|
67
84
|
|
data/lib/statsample/factor.rb
CHANGED
@@ -3,7 +3,7 @@ require 'statsample/factor/principalaxis'
|
|
3
3
|
require 'statsample/factor/rotation'
|
4
4
|
|
5
5
|
module Statsample
|
6
|
-
#
|
6
|
+
# Factor Analysis toolbox.
|
7
7
|
# * Classes for Extraction of factors:
|
8
8
|
# * Statsample::Factor::PCA
|
9
9
|
# * Statsample::Factor::PrincipalAxis
|
@@ -18,9 +18,9 @@ module Statsample
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
21
|
-
class Vector
|
21
|
+
class Vector
|
22
22
|
# Creates a barchart using ruby-gdchart
|
23
|
-
def gdchart_frequencies(file, width=300, height=150, chart_type=GDChart::BAR, options={})
|
23
|
+
def gdchart_frequencies(file, width=300, height=150, chart_type=GDChart::BAR, options={}) # :nodoc:
|
24
24
|
labels,data=[],[]
|
25
25
|
self.frequencies.sort.each{|k,v|
|
26
26
|
labels.push(k.to_s)
|
@@ -29,17 +29,17 @@ module Statsample
|
|
29
29
|
options['ext_color']=[0xFF3399,0xFF9933,0xFFEE33,0x33FF33, 0x9966FF]
|
30
30
|
Statsample::Util.chart_gdchart(file,width,height,chart_type, labels,options,1,data)
|
31
31
|
end
|
32
|
-
def gdchart_histogram(bins,file, width=300, height=150, chart_type=GDChart::BAR, options={})
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
32
|
+
def gdchart_histogram(bins,file, width=300, height=150, chart_type=GDChart::BAR, options={}) # :nodoc:
|
33
|
+
check_type :scale
|
34
|
+
labels=[]
|
35
|
+
h=histogram(bins)
|
36
|
+
data=[]
|
37
|
+
(0...bins).each{|bin|
|
38
|
+
data.push(h[bin])
|
39
|
+
range=h.get_range(bin)
|
40
|
+
labels.push(((range[0]+range[1]) / 2.to_f).to_s)
|
41
|
+
}
|
42
|
+
Statsample::Util.chart_gdchart(file, width, height, chart_type, labels,options, 1,data)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -6,178 +6,177 @@ require 'SVG/Graph/Plot'
|
|
6
6
|
require 'statsample/graph/svghistogram'
|
7
7
|
|
8
8
|
module Statsample
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
end
|
9
|
+
class Vector
|
10
|
+
# Creates a barchart using ruby-gdchart
|
11
|
+
def svggraph_frequencies(file, width=600, height=300, chart_type=SVG::Graph::BarNoOp, options={})
|
12
|
+
labels, data1=[],[]
|
13
|
+
self.frequencies.sort.each{|k,v|
|
14
|
+
labels.push(k.to_s)
|
15
|
+
data1.push(v)
|
16
|
+
}
|
17
|
+
options[:height]=height
|
18
|
+
options[:width]=width
|
19
|
+
options[:fields]=labels
|
20
|
+
graph = chart_type.new(options)
|
21
|
+
graph.add_data(
|
22
|
+
:data => data1,
|
23
|
+
:title => "Frequencies"
|
24
|
+
)
|
25
|
+
|
26
|
+
File.open(file,"w") {|f|
|
27
|
+
f.puts(graph.burn)
|
28
|
+
}
|
29
|
+
end
|
30
|
+
def svggraph_histogram(bins, options={})
|
31
|
+
check_type :scale
|
32
|
+
options={:graph_title=>"Histogram", :show_graph_title=>true,:show_normal=>true, :mean=>self.mean, :sigma=>sdp }.merge! options
|
33
|
+
graph = Statsample::Graph::SvgHistogram.new(options)
|
34
|
+
graph.histogram=histogram(bins)
|
35
|
+
graph
|
36
|
+
end
|
37
|
+
# Returns a Run-Sequence Plot
|
38
|
+
# Reference: http://www.itl.nist.gov/div898/handbook/eda/section3/runseqpl.htm
|
39
|
+
def svggraph_runsequence_plot(options={})
|
40
|
+
check_type :scale
|
41
|
+
options={:graph_title=>"Run-Sequence Plot", :show_graph_title=>true, :scale_x_integers => true, :add_popups=>true }.merge! options
|
42
|
+
vx=(1..@data.size).to_a.to_vector(:scale)
|
43
|
+
vy=@data.to_vector(:scale)
|
44
|
+
ds={'index'=>vx,'value'=>vy}.to_dataset
|
45
|
+
graph = Statsample::Graph::SvgScatterplot.new(ds,options)
|
46
|
+
graph.set_x('index')
|
47
|
+
graph.parse
|
48
|
+
graph
|
49
|
+
end
|
50
|
+
def svggraph_boxplot(options={})
|
51
|
+
check_type :scale
|
52
|
+
options={:graph_title=>"Boxplot", :fields=>['vector'], :show_graph_title=>true}.merge! options
|
53
|
+
vx=@valid_data.to_a.to_vector(:scale)
|
54
|
+
graph = Statsample::Graph::SvgBoxplot.new(options)
|
55
|
+
graph.add_data(:title=>"vector", :data=>@data.to_a)
|
56
|
+
graph
|
57
|
+
end
|
58
|
+
|
59
|
+
def svggraph_lag_plot(options={})
|
60
|
+
check_type :scale
|
61
|
+
options={:graph_title=>"Lag Plot", :show_graph_title=>true}.merge! options
|
62
|
+
vx=@valid_data[0...(@valid_data.size-1)].to_vector(:scale)
|
63
|
+
vy=@valid_data[1...@valid_data.size].to_vector(:scale)
|
64
|
+
ds={'x_minus_1'=>vx,'x'=>vy}.to_dataset
|
65
|
+
graph = Statsample::Graph::SvgScatterplot.new(ds,options)
|
66
|
+
graph.set_x('x_minus_1')
|
67
|
+
graph.parse
|
68
|
+
graph
|
69
|
+
end
|
70
|
+
# Returns a Normal Probability Plot
|
71
|
+
# Reference: http://www.itl.nist.gov/div898/handbook/eda/section3/normprpl.htm
|
72
|
+
def svggraph_normalprobability_plot(options={})
|
73
|
+
extend Statsample::Util
|
74
|
+
check_type :scale
|
75
|
+
options={:graph_title=>"Normal Probability Plot", :show_graph_title=>true}.merge! options
|
76
|
+
n=@valid_data.size
|
77
|
+
vx=(1..@valid_data.size).to_a.collect{|i|
|
78
|
+
Distribution::Normal.p_value(normal_order_statistic_medians(i,n))
|
79
|
+
}.to_vector(:scale)
|
80
|
+
vy=@valid_data.sort.to_vector(:scale)
|
81
|
+
ds={'normal_order_statistics_medians'=>vx, 'ordered_response'=>vy}.to_dataset
|
82
|
+
graph = Statsample::Graph::SvgScatterplot.new(ds,options)
|
83
|
+
graph.set_x('normal_order_statistics_medians')
|
84
|
+
graph.parse
|
85
|
+
graph
|
86
|
+
end
|
87
|
+
end
|
89
88
|
end
|
90
89
|
|
91
90
|
# replaces all key and fill classes with similar ones, without opacity
|
92
91
|
# this allows rendering of svg and png on rox and gqview without problems
|
93
92
|
module SVG #:nodoc:
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
return
|
116
|
-
/* default fill styles for multiple datasets (probably only use a single dataset on this graph though) */
|
117
|
-
.key1,.fill1{
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
}
|
122
|
-
.key2,.fill2{
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
}
|
127
|
-
.key3,.fill3{
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
}
|
132
|
-
.key4,.fill4{
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
}
|
137
|
-
.key5,.fill5{
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
}
|
142
|
-
.key6,.fill6{
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
}
|
147
|
-
.key7,.fill7{
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
}
|
152
|
-
.key8,.fill8{
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
}
|
157
|
-
.key9,.fill9{
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
}
|
162
|
-
.key10,.fill10{
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
}
|
167
|
-
.key11,.fill11{
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
}
|
172
|
-
.key12,.fill12{
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
}
|
177
|
-
EOL
|
178
|
-
|
179
|
-
|
180
|
-
|
93
|
+
module Graph
|
94
|
+
class BarNoOp < Bar # :nodoc:
|
95
|
+
def get_css; SVG::Graph.get_css_standard; end
|
96
|
+
end
|
97
|
+
class BarHorizontalNoOp < BarHorizontal
|
98
|
+
def get_css; SVG::Graph.get_css_standard; end
|
99
|
+
end
|
100
|
+
|
101
|
+
class LineNoOp < Line
|
102
|
+
def get_css; SVG::Graph.get_css_standard; end
|
103
|
+
|
104
|
+
end
|
105
|
+
class PlotNoOp < Plot
|
106
|
+
def get_css; SVG::Graph.get_css_standard; end
|
107
|
+
end
|
108
|
+
class PieNoOp < Pie
|
109
|
+
def get_css; SVG::Graph.get_css_standard; end
|
110
|
+
|
111
|
+
end
|
112
|
+
class << self
|
113
|
+
def get_css_standard
|
114
|
+
return <<-EOL
|
115
|
+
/* default fill styles for multiple datasets (probably only use a single dataset on this graph though) */
|
116
|
+
.key1,.fill1{
|
117
|
+
fill: #ff0000;
|
118
|
+
stroke: none;
|
119
|
+
stroke-width: 0.5px;
|
120
|
+
}
|
121
|
+
.key2,.fill2{
|
122
|
+
fill: #0000ff;
|
123
|
+
stroke: none;
|
124
|
+
stroke-width: 1px;
|
125
|
+
}
|
126
|
+
.key3,.fill3{
|
127
|
+
fill: #00ff00;
|
128
|
+
stroke: none;
|
129
|
+
stroke-width: 1px;
|
130
|
+
}
|
131
|
+
.key4,.fill4{
|
132
|
+
fill: #ffcc00;
|
133
|
+
stroke: none;
|
134
|
+
stroke-width: 1px;
|
135
|
+
}
|
136
|
+
.key5,.fill5{
|
137
|
+
fill: #00ccff;
|
138
|
+
stroke: none;
|
139
|
+
stroke-width: 1px;
|
140
|
+
}
|
141
|
+
.key6,.fill6{
|
142
|
+
fill: #ff00ff;
|
143
|
+
stroke: none;
|
144
|
+
stroke-width: 1px;
|
145
|
+
}
|
146
|
+
.key7,.fill7{
|
147
|
+
fill: #00ffff;
|
148
|
+
stroke: none;
|
149
|
+
stroke-width: 1px;
|
150
|
+
}
|
151
|
+
.key8,.fill8{
|
152
|
+
fill: #ffff00;
|
153
|
+
stroke: none;
|
154
|
+
stroke-width: 1px;
|
155
|
+
}
|
156
|
+
.key9,.fill9{
|
157
|
+
fill: #cc6666;
|
158
|
+
stroke: none;
|
159
|
+
stroke-width: 1px;
|
160
|
+
}
|
161
|
+
.key10,.fill10{
|
162
|
+
fill: #663399;
|
163
|
+
stroke: none;
|
164
|
+
stroke-width: 1px;
|
165
|
+
}
|
166
|
+
.key11,.fill11{
|
167
|
+
fill: #339900;
|
168
|
+
stroke: none;
|
169
|
+
stroke-width: 1px;
|
170
|
+
}
|
171
|
+
.key12,.fill12{
|
172
|
+
fill: #9966FF;
|
173
|
+
stroke: none;
|
174
|
+
stroke-width: 1px;
|
175
|
+
}
|
176
|
+
EOL
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
181
180
|
end
|
182
181
|
|
183
182
|
require 'statsample/graph/svgscatterplot'
|