gerbilcharts 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -0
- data/lib/gerbilcharts/charts/area_chart.rb +1 -1
- data/lib/gerbilcharts/charts/chart_base.rb +4 -0
- data/lib/gerbilcharts/models/presets.rb +1 -1
- data/lib/gerbilcharts/models/round_range.rb +15 -5
- data/lib/gerbilcharts/public/brushmetal.css +11 -8
- data/lib/gerbilcharts/public/gerbil.js +334 -327
- data/lib/gerbilcharts/surfaces/area_surface.rb +11 -9
- data/lib/gerbilcharts/surfaces/bar_surface.rb +3 -1
- data/lib/gerbilcharts/surfaces/chart.rb +1 -1
- data/lib/gerbilcharts/surfaces/graph_element.rb +4 -10
- data/lib/gerbilcharts/surfaces/grid.rb +28 -20
- data/lib/gerbilcharts/surfaces/legend.rb +2 -8
- data/lib/gerbilcharts/surfaces/line_surface.rb +7 -2
- data/lib/gerbilcharts/surfaces/pie_surface.rb +1 -0
- data/lib/gerbilcharts/surfaces/stacked_area_surface.rb +17 -7
- data/lib/gerbilcharts/surfaces/surface.rb +1 -1
- data/lib/gerbilcharts/surfaces/tracker.rb +10 -6
- data/lib/gerbilcharts/surfaces/vertical_axis.rb +4 -1
- data/lib/gerbilcharts/svgdc/svgdc.rb +41 -19
- data/lib/gerbilcharts/version.rb +1 -1
- data/test/test_lines.rb +3 -59
- data/test/test_negatives.rb +39 -0
- data/test/test_ranges.rb +21 -0
- metadata +3 -2
data/lib/gerbilcharts/version.rb
CHANGED
data/test/test_lines.rb
CHANGED
@@ -8,90 +8,34 @@ class TestLines < Test::Unit::TestCase
|
|
8
8
|
|
9
9
|
def setup
|
10
10
|
@test_vector_tm1 = []
|
11
|
-
@test_vector_tm2 = []
|
12
11
|
@test_vector_tm3 = []
|
13
12
|
tbeg = Time.local( 1978, "jun", 5, 9, 10, 0, 0)
|
14
13
|
sbeg = tbeg
|
15
14
|
sec_inc = 50
|
16
15
|
|
17
16
|
for i in (0..20)
|
18
|
-
@test_vector_tm1 << [sbeg + i*sec_inc, i*sec_inc*
|
19
|
-
@test_vector_tm2 << [sbeg + i*sec_inc, i*sec_inc*1200 ]
|
17
|
+
@test_vector_tm1 << [sbeg + i*sec_inc, i*sec_inc*250*rand() ]
|
20
18
|
@test_vector_tm3 << [sbeg + i*sec_inc, i*sec_inc*1000*rand() ]
|
21
19
|
end
|
22
20
|
|
23
21
|
@mod1 = GerbilCharts::Models::TimeSeriesGraphModel.new("External Gateway")
|
24
22
|
@mod1.add_tuples @test_vector_tm1
|
25
23
|
|
26
|
-
@mod2 = GerbilCharts::Models::TimeSeriesGraphModel.new("209.216.22.220")
|
27
|
-
@mod2.add_tuples @test_vector_tm2
|
28
|
-
|
29
24
|
@mod3 = GerbilCharts::Models::TimeSeriesGraphModel.new("udldev Print Server")
|
30
25
|
@mod3.add_tuples @test_vector_tm3
|
31
26
|
|
32
27
|
@modgroup = GerbilCharts::Models::GraphModelGroup.new("Hosts")
|
33
|
-
@modgroup.add(@mod1)
|
34
|
-
@modgroup.add(@mod2)
|
35
28
|
@modgroup.add(@mod3)
|
29
|
+
@modgroup.add(@mod1)
|
36
30
|
|
37
|
-
setup_bucketized_models()
|
38
31
|
|
39
32
|
end
|
40
33
|
|
41
|
-
def setup_bucketized_models
|
42
|
-
# bucketized models
|
43
|
-
modbucket1 = GerbilCharts::Models::BucketizedTimeSeriesGraphModel.new("Out Bw",60)
|
44
|
-
tbeg = Time.local( 1978, "jun", 5, 9, 10, 0, 0)
|
45
|
-
sbeg = tbeg
|
46
|
-
|
47
|
-
#second with some gaps
|
48
|
-
sbeg = tbeg
|
49
|
-
test_vector_bucket_1 = []
|
50
|
-
test_vector_bucket_1 << [sbeg + 60, 1000 ]
|
51
|
-
test_vector_bucket_1 << [sbeg + 120, 1000 ]
|
52
|
-
test_vector_bucket_1 << [sbeg + 180, 1000 ]
|
53
|
-
test_vector_bucket_1 << [sbeg + 239, 1000 ]
|
54
|
-
test_vector_bucket_1 << [sbeg + 295, 1000 ]
|
55
|
-
test_vector_bucket_1 << [sbeg + 296, 1000 ]
|
56
|
-
test_vector_bucket_1 << [sbeg + 297, 5000 ]
|
57
|
-
test_vector_bucket_1 << [sbeg + 298, 1000 ]
|
58
|
-
test_vector_bucket_1 << [sbeg + 360, 1000 ]
|
59
|
-
test_vector_bucket_1 << [sbeg + 420, 1000 ]
|
60
|
-
test_vector_bucket_1 << [sbeg + 480, 1000 ]
|
61
|
-
test_vector_bucket_1 << [sbeg + 530, 1000 ]
|
62
|
-
test_vector_bucket_1 << [sbeg + 604, 1000 ]
|
63
|
-
test_vector_bucket_1 << [sbeg + 800, 1000 ]
|
64
|
-
modbucket1.add_tuples(test_vector_bucket_1)
|
65
|
-
|
66
|
-
#second with some gaps
|
67
|
-
modbucket2 = GerbilCharts::Models::BucketizedTimeSeriesGraphModel.new("In Bw",60)
|
68
|
-
sbeg = tbeg
|
69
|
-
test_vector_bucket_2 = []
|
70
|
-
test_vector_bucket_2 << [sbeg + 10, 1800 ]
|
71
|
-
test_vector_bucket_2 << [sbeg + 20, 2600 ]
|
72
|
-
test_vector_bucket_2 << [sbeg + 22, 1000 ]
|
73
|
-
test_vector_bucket_2 << [sbeg + 60, 1000 ]
|
74
|
-
test_vector_bucket_2 << [sbeg + 120, 1900 ]
|
75
|
-
test_vector_bucket_2 << [sbeg + 180, 700 ]
|
76
|
-
test_vector_bucket_2 << [sbeg + 240, 5000 ]
|
77
|
-
test_vector_bucket_2 << [sbeg + 301, 1000 ]
|
78
|
-
test_vector_bucket_2 << [sbeg + 350, 1000 ]
|
79
|
-
test_vector_bucket_2 << [sbeg + 420, 100 ]
|
80
|
-
test_vector_bucket_2 << [sbeg + 470, 500 ]
|
81
|
-
test_vector_bucket_2 << [sbeg + 540, 1000 ]
|
82
|
-
modbucket2.add_tuples(test_vector_bucket_2)
|
83
|
-
|
84
|
-
@modgroupbucketized = GerbilCharts::Models::GraphModelGroup.new("Bandwidth")
|
85
|
-
@modgroupbucketized .add(modbucket1)
|
86
|
-
@modgroupbucketized .add(modbucket2)
|
87
|
-
|
88
|
-
end
|
89
|
-
|
90
34
|
|
91
35
|
# test a line chart
|
92
36
|
def test_line_1
|
93
37
|
|
94
|
-
mychart = GerbilCharts::Charts::AreaChart.new( :width =>
|
38
|
+
mychart = GerbilCharts::Charts::AreaChart.new( :width => 450, :height => 250, :style => 'inline:brushmetal.css')
|
95
39
|
mychart.setmodelgroup(@modgroup)
|
96
40
|
mychart.render('/tmp/sq_linechart1.svg')
|
97
41
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestLines < Test::Unit::TestCase
|
4
|
+
|
5
|
+
attr_reader :test_vector_tm1
|
6
|
+
attr_reader :test_vector_tm2
|
7
|
+
attr_reader :mod1, :mod2, :modbucket1
|
8
|
+
|
9
|
+
def setup
|
10
|
+
@test_vector_tm3 = []
|
11
|
+
tbeg = Time.local( 1978, "jun", 5, 9, 10, 0, 0)
|
12
|
+
sbeg = tbeg
|
13
|
+
sec_inc = 50
|
14
|
+
|
15
|
+
range = (-7000..+4000)
|
16
|
+
for i in (0..20)
|
17
|
+
@test_vector_tm3 << [sbeg + i*sec_inc, range.min + range.count * rand() ]
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
@mod3 = GerbilCharts::Models::TimeSeriesGraphModel.new("udldev Print Server")
|
22
|
+
@mod3.add_tuples @test_vector_tm3
|
23
|
+
|
24
|
+
@modgroup = GerbilCharts::Models::GraphModelGroup.new("Hosts")
|
25
|
+
@modgroup.add(@mod3)
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
# test a line chart
|
30
|
+
def test_line_1
|
31
|
+
|
32
|
+
mychart = GerbilCharts::Charts::AreaChart.new( :width => 350, :height => 200, :style => 'inline:brushmetal.css',
|
33
|
+
:enabletimetracker => true )
|
34
|
+
mychart.setmodelgroup(@modgroup)
|
35
|
+
mychart.render('/tmp/neg_linechart1.svg')
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
data/test/test_ranges.rb
CHANGED
@@ -132,4 +132,25 @@ class TestRanges < Test::Unit::TestCase
|
|
132
132
|
assert_equal(rr.ldelta,10800)
|
133
133
|
end
|
134
134
|
|
135
|
+
def test_negative_range
|
136
|
+
|
137
|
+
debugger
|
138
|
+
|
139
|
+
r = GerbilCharts::Models::RawRange.new
|
140
|
+
[-11000,19920,20001].each do |v|
|
141
|
+
r.update v
|
142
|
+
end
|
143
|
+
|
144
|
+
rr = GerbilCharts::Models::RoundRange.new(r)
|
145
|
+
assert_equal(rr.rmax,50000)
|
146
|
+
assert_equal(rr.rmin,-20000)
|
147
|
+
assert_equal(rr.lmax,25000,"checking ideal label interval")
|
148
|
+
|
149
|
+
r.update(-18000)
|
150
|
+
rr = GerbilCharts::Models::RoundRange.new(r)
|
151
|
+
assert_equal(rr.lmax,25000,"checking ideal label interval for a 100K interval")
|
152
|
+
|
153
|
+
end
|
154
|
+
|
155
|
+
|
135
156
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gerbilcharts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vivek Rajagopalan
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-27 00:00:00 +05:30
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -160,5 +160,6 @@ test_files:
|
|
160
160
|
- test/test_bar.rb
|
161
161
|
- test/test_models.rb
|
162
162
|
- test/test_charts.rb
|
163
|
+
- test/test_negatives.rb
|
163
164
|
- test/test_scaling.rb
|
164
165
|
- test/test_Scratch.rb
|