gerbilcharts 0.5.9 → 0.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. data/{License.txt → LICENSE.txt} +0 -0
  2. data/{README.txt → README.rdoc} +0 -0
  3. data/lib/gerbilcharts/charts.rb +2 -0
  4. data/lib/gerbilcharts/charts/chart_base.rb +1 -1
  5. data/lib/gerbilcharts/charts/line_chart_table.rb +38 -0
  6. data/lib/gerbilcharts/charts/stacked_area_chart_table.rb +31 -0
  7. data/lib/gerbilcharts/models/bucketized_timeseries_graph_model.rb +10 -7
  8. data/lib/gerbilcharts/models/graph_model_group.rb +1 -1
  9. data/lib/gerbilcharts/models/presets.rb +2 -2
  10. data/lib/gerbilcharts/models/raw_range.rb +1 -0
  11. data/lib/gerbilcharts/surfaces/area_surface.rb +46 -39
  12. data/lib/gerbilcharts/surfaces/conversation_ring.rb +7 -3
  13. data/lib/gerbilcharts/surfaces/detailed_legend.rb +15 -4
  14. data/lib/gerbilcharts/surfaces/impulse_surface.rb +10 -4
  15. data/lib/gerbilcharts/surfaces/line_surface.rb +31 -34
  16. data/lib/gerbilcharts/surfaces/square_line_surface.rb +27 -30
  17. data/lib/gerbilcharts/surfaces/surface.rb +27 -1
  18. data/lib/gerbilcharts/svgdc/svg_polygon.rb +14 -7
  19. data/lib/gerbilcharts/svgdc/svg_polyline.rb +8 -2
  20. data/lib/gerbilcharts/svgdc/svgdc.rb +8 -0
  21. data/lib/gerbilcharts/version.rb +2 -2
  22. metadata +118 -97
  23. data/History.txt +0 -105
  24. data/Manifest.txt +0 -92
  25. data/PostInstall.txt +0 -2
  26. data/Rakefile +0 -4
  27. data/lib/gerbilcharts/public/brushmetal.css +0 -284
  28. data/lib/gerbilcharts/public/gerbil.js +0 -421
  29. data/setup.rb +0 -1585
  30. data/test/test_Scratch.rb +0 -21
  31. data/test/test_bar.rb +0 -39
  32. data/test/test_bubble.rb +0 -52
  33. data/test/test_charts.rb +0 -122
  34. data/test/test_conversation.rb +0 -34
  35. data/test/test_embed_styles.rb +0 -35
  36. data/test/test_gerbilcharts.rb +0 -11
  37. data/test/test_helper.rb +0 -2
  38. data/test/test_lines.rb +0 -46
  39. data/test/test_matrix.rb +0 -34
  40. data/test/test_models.rb +0 -118
  41. data/test/test_negatives.rb +0 -39
  42. data/test/test_noob.rb +0 -86
  43. data/test/test_pie.rb +0 -43
  44. data/test/test_ranges.rb +0 -169
  45. data/test/test_render_string.rb +0 -38
  46. data/test/test_sa.rb +0 -88
  47. data/test/test_scaling.rb +0 -57
  48. data/test/test_svgdc.rb +0 -221
  49. data/test/trafgen.rb +0 -25
@@ -1,21 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
-
3
- class TestScratch < Test::Unit::TestCase
4
-
5
- def setup
6
- end
7
-
8
- def teardown
9
- end
10
-
11
-
12
- def test_1
13
-
14
- g=GerbilCharts::SVGDC::SVGDC.new(300,200)
15
- g.circle(40,50,20, :id => "What" )
16
- g.render( :file => "/tmp/Scratch1.svg")
17
-
18
- end
19
-
20
- end
21
-
@@ -1,39 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
-
3
- require 'trafgen'
4
-
5
- # test pie chart
6
- class TestBar < Test::Unit::TestCase
7
-
8
-
9
- # test sales figures of 3 sales people
10
- # show in a pie chart
11
- def test_monthly_sales
12
- modelgroup = GerbilCharts::Models::SimpleTimeSeriesModelGroup.new(
13
- :title => "Sales figures",
14
- :timeseries => (1..6).collect { |month| Time.local(2008,month) },
15
- :models => [ ["Bruce", 1, 10, 18, 28, 80, 140],
16
- ["Rex" , 112,22, 45, 70, 218, 309],
17
- ["Sharmila", 112,22, 45, 70, 218, 245],
18
- ["Wasim", 112,22, 45, 70, 218, 145],
19
- ["Buzo" , 0, 23, 25, 40, 18, 59],
20
- ["Vipin", 145,112, 22, 45, 18, 70],
21
- ["covad11.covad.nc.us", 145,112, 22, 45, 18, 240],
22
- ["very very very long name 9th item ", 145,112, 22, 45, 18, 45],
23
- ["192.168.201.200 ", 145,112, 22, 45, 18, 15],
24
- ["192.168.201.200 ", 145,112, 22, 45, 18, 15],
25
- ["Others ", 145,112, 22, 45, 18, 15],
26
- ["VIVEK", 145,112, 22, 45, 18, 170]
27
- ]
28
- )
29
- mychart = GerbilCharts::Charts::BarChart.new( :width => 300, :height => 200,
30
- :style => 'inline:brushmetal.css', :auto_tooltips => true ,
31
- :javascripts => ['/tmp/gerbil.js', '/tmp/prototype.js'],
32
- :filter => 'LikeButton'
33
- )
34
- mychart.modelgroup=modelgroup
35
- mychart.render('/tmp/bar_monthly_sales.svg')
36
- end
37
- end
38
-
39
-
@@ -1,52 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
-
3
- require 'trafgen'
4
-
5
- # tests some easy to use mods
6
- # newbies enter here
7
- class TestChartsNoob < Test::Unit::TestCase
8
-
9
-
10
- # alerts
11
- def test_alerts
12
-
13
- mychart = GerbilCharts::Charts::BubbleChart.new( :width => 650, :height => 200,
14
- :style => 'inline:brushmetal.css',
15
- :javascripts => ['inline:/tmp/gerbil.js','inline:/tmp/prototype.js'] )
16
-
17
-
18
- tend = Time.now
19
- tbegin = tend - 3600*24
20
-
21
- model1 = GerbilCharts::Models::BucketizedTimeSeriesGraphModel.new( "eth0", 3600 )
22
- TimeSeriesDataGenerator.new(tbegin,tend,300,1000, 5000 ).each_tuple do |t,v|
23
- model1.add(t,v)
24
- end
25
-
26
- model2 = GerbilCharts::Models::BucketizedTimeSeriesGraphModel.new( "wan1", 3600 )
27
- TimeSeriesDataGenerator.new(tbegin,tend,300,2, 20).each_tuple do |t,v|
28
- model2.add(t,v)
29
- end
30
-
31
- model3 = GerbilCharts::Models::BucketizedTimeSeriesGraphModel.new( "fiber0", 3600 )
32
- TimeSeriesDataGenerator.new(tbegin,tend,1800,0, 10).each_tuple do |t,v|
33
- model3.add(t,v)
34
- end
35
-
36
- modelgroup = GerbilCharts::Models::GraphModelGroup.new( "External Traffic")
37
- modelgroup.add model2
38
- modelgroup.add model1
39
- modelgroup.add model3
40
-
41
-
42
- mychart.modelgroup=modelgroup
43
-
44
- mychart.render('/tmp/n_bubble.svg')
45
-
46
- end
47
-
48
-
49
-
50
- end
51
-
52
-
@@ -1,122 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
-
3
- class TestCharts < 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_tm1 = []
11
- @test_vector_tm2 = []
12
- @test_vector_tm3 = []
13
- tbeg = Time.local( 1978, "jun", 5, 9, 10, 0, 0)
14
- sbeg = tbeg
15
- sec_inc = 1000
16
-
17
- for i in (0..20)
18
- @test_vector_tm1 << [sbeg + i*sec_inc, i*sec_inc*1000 ]
19
- @test_vector_tm2 << [sbeg + i*sec_inc, i*sec_inc*1200 ]
20
- @test_vector_tm3 << [sbeg + i*sec_inc, i*sec_inc*1000*rand() ]
21
- end
22
-
23
- @mod1 = GerbilCharts::Models::TimeSeriesGraphModel.new("External Gateway")
24
- @mod1.add_tuples @test_vector_tm1
25
-
26
- @mod2 = GerbilCharts::Models::TimeSeriesGraphModel.new("209.216.22.220")
27
- @mod2.add_tuples @test_vector_tm2
28
-
29
- @mod3 = GerbilCharts::Models::TimeSeriesGraphModel.new("udldev Print Server")
30
- @mod3.add_tuples @test_vector_tm3
31
-
32
- @modgroup = GerbilCharts::Models::GraphModelGroup.new("Hosts")
33
- @modgroup.add(@mod1)
34
- @modgroup.add(@mod2)
35
- @modgroup.add(@mod3)
36
-
37
- setup_bucketized_models()
38
-
39
- end
40
-
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
-
91
- # test a line chart
92
- def test_line_1
93
-
94
- mychart = GerbilCharts::Charts::LineChart.new( :width => 350, :height => 200, :style => 'brushmetal.css')
95
- mychart.setmodelgroup(@modgroup)
96
- mychart.render('/tmp/c_linechart1.svg')
97
-
98
- end
99
-
100
- # test a bar chart
101
- def test_bar_1
102
-
103
- mychart = GerbilCharts::Charts::BarChart.new( :width => 300, :height => 150, :style => 'brushmetal.css')
104
- mychart.setmodelgroup(@modgroup)
105
- mychart.render('/tmp/c_barchart1.svg')
106
-
107
- end
108
-
109
- # test a area chart
110
- def test_stacked_area_1
111
-
112
- mychart = GerbilCharts::Charts::StackedAreaChart.new( :width => 350, :height => 200,
113
- :style => 'brushmetal.css', :auto_tooltips=> true,
114
- :javascripts => {'/tmp/gerbil.js' => false, '/tmp/prototype.js' => false , '/tmp/scriptaculous.js' => false}
115
- )
116
- mychart.setmodelgroup(@modgroupbucketized)
117
- mychart.render('/tmp/c_sachart1.svg')
118
-
119
- end
120
-
121
- end
122
-
@@ -1,34 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
-
3
- require 'trafgen'
4
-
5
- # test conversation bar chart
6
- class TestConversation < Test::Unit::TestCase
7
-
8
- def test_monthly_sales
9
- modelgroup = GerbilCharts::Models::MatrixModel.new("Conversation Ring Chart")
10
-
11
- modelgroup.add("192.168.1.25","192.168.1.20",500)
12
- modelgroup.add("192.168.1.25","192.168.1.21",7500)
13
- modelgroup.add("192.168.1.25","192.168.1.22",6500)
14
- modelgroup.add("192.168.1.25","192.168.1.23",5500)
15
- modelgroup.add("192.168.1.25","192.168.1.24",4500)
16
- modelgroup.add("192.168.1.25","192.168.1.26",10500)
17
- modelgroup.add("192.168.1.25","192.168.1.27",500)
18
- modelgroup.add("192.168.1.25","192.168.1.28",2500)
19
- modelgroup.add("192.168.1.25","192.168.1.29",3500)
20
- modelgroup.add("192.168.1.25","192.168.1.30",500)
21
-
22
- modelgroup.calc_matrix
23
-
24
- mychart = GerbilCharts::Charts::ConversationRing.new( :width => 450, :height => 250,
25
- :style => 'inline:brushmetal.css', :auto_tooltips => true ,
26
- :javascripts => ['/tmp/gerbil.js', '/tmp/prototype.js'],
27
- :filter => 'LikeButton'
28
- )
29
-
30
- mychart.modelgroup = modelgroup
31
- mychart.render('/tmp/con_monthly_sales.svg')
32
-
33
- end
34
- end
@@ -1,35 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
-
3
- class TestLines < Test::Unit::TestCase
4
-
5
- attr_reader :mod1, :mod2, :modbucket1
6
-
7
- def setup
8
- @test_vector_tm1 = []
9
- tbeg = Time.local( 1978, "jun", 5, 9, 10, 0, 0)
10
- sbeg = tbeg
11
- sec_inc = 50
12
-
13
- for i in (0..20)
14
- @test_vector_tm1 << [sbeg + i*sec_inc, i*sec_inc*250*rand() ]
15
- end
16
-
17
- @mod1 = GerbilCharts::Models::TimeSeriesGraphModel.new("External Gateway")
18
- @mod1.add_tuples @test_vector_tm1
19
-
20
- @modgroup = GerbilCharts::Models::GraphModelGroup.new("Hosts")
21
- @modgroup.add(@mod1)
22
-
23
- end
24
-
25
-
26
- # test a line chart
27
- def test_line_1
28
-
29
- mychart = GerbilCharts::Charts::AreaChart.new( :width => 450, :height => 250, :style => 'embed:brushmetal.css')
30
- mychart.setmodelgroup(@modgroup)
31
- mychart.render('/tmp/embed_style.svg')
32
-
33
- end
34
-
35
- end
@@ -1,11 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
-
3
- class TestGerbilcharts < Test::Unit::TestCase
4
-
5
- def setup
6
- end
7
-
8
- def test_truth
9
- assert true
10
- end
11
- end
@@ -1,2 +0,0 @@
1
- require 'test/unit'
2
- require File.dirname(__FILE__) + '/../lib/gerbilcharts'
@@ -1,46 +0,0 @@
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_tm1 = []
11
- @test_vector_tm3 = []
12
- tbeg = Time.local( 1978, "jun", 5, 9, 10, 0, 0)
13
- sbeg = tbeg
14
- sec_inc = 50
15
-
16
- for i in (0..20)
17
- @test_vector_tm1 << [sbeg + i*sec_inc, i*sec_inc*250*rand() ]
18
- @test_vector_tm3 << [sbeg + i*sec_inc, i*sec_inc*1000*rand() ]
19
- end
20
-
21
- @mod1 = GerbilCharts::Models::TimeSeriesGraphModel.new("External Gateway")
22
- @mod1.add_tuples @test_vector_tm1
23
-
24
- @mod3 = GerbilCharts::Models::TimeSeriesGraphModel.new("udldev Print Server")
25
- @mod3.add_tuples @test_vector_tm3
26
-
27
- @modgroup = GerbilCharts::Models::GraphModelGroup.new("Hosts")
28
- @modgroup.add(@mod3)
29
- @modgroup.add(@mod1)
30
-
31
-
32
- end
33
-
34
-
35
- # test a line chart
36
- def test_line_1
37
-
38
- mychart = GerbilCharts::Charts::AreaChart.new( :width => 750, :height => 250,
39
- :javascripts => ['inline:gerbil.js' ],
40
- :auto_tooltips => false, :style => 'inline:brushmetal.css' )
41
- mychart.setmodelgroup(@modgroup)
42
- mychart.render('/tmp/sq_linechart1.svg')
43
-
44
- end
45
-
46
- end
@@ -1,34 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
-
3
- require 'trafgen'
4
-
5
- # test conversation bar chart
6
- class TestMatrix < Test::Unit::TestCase
7
-
8
- def test_monthly_sales
9
- modelgroup = GerbilCharts::Models::MatrixModel.new("Traffic Matrix")
10
-
11
- modelgroup.add("192.168.1.25","192.168.1.20",12500)
12
- modelgroup.add("192.168.1.26","192.168.1.21",7500)
13
- modelgroup.add("192.168.1.25","192.168.1.22",6500)
14
- modelgroup.add("192.168.1.27","192.168.1.23",5500)
15
- modelgroup.add("192.168.1.28","192.168.1.24",4500)
16
- modelgroup.add("192.168.1.29","192.168.1.26",10500)
17
- modelgroup.add("192.168.1.25","192.168.1.27",500)
18
- modelgroup.add("192.168.1.25","192.168.1.28",2500)
19
- modelgroup.add("192.168.1.30","192.168.1.29",3500)
20
- modelgroup.add("192.168.1.52","192.168.1.30",500)
21
-
22
- modelgroup.calc_matrix
23
-
24
- mychart = GerbilCharts::Charts::MatrixChart.new( :width => 1000, :height => 400,
25
- :style => 'inline:brushmetal.css', :auto_tooltips => true ,
26
- :javascripts => ['/tmp/gerbil.js', '/tmp/prototype.js'],
27
- :filter => 'LikeButton'
28
- )
29
-
30
- mychart.modelgroup = modelgroup
31
- mychart.render('/tmp/matrix_monthly_sales.svg')
32
-
33
- end
34
- end
@@ -1,118 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
-
3
- class TestModels < Test::Unit::TestCase
4
-
5
- def setup
6
- # test vector
7
- @tvector = []
8
- @tvector << [ Time.local(1973,"Apr",2,8,30,0), 0 ]
9
- @tvector << [ Time.local(1973,"Apr",2,8,30,10), 0.5 ]
10
- @tvector << [ Time.local(1973,"Apr",2,8,30,11), 18 ]
11
- @tvector << [ Time.local(1973,"Apr",2,8,30,15), 911 ]
12
- @tvector << [ Time.local(1973,"Apr",2,8,30,18), 100 ]
13
- @tvector << [ Time.local(1973,"Apr",2,8,30,19), 80 ]
14
- @tvector << [ Time.local(1973,"Apr",2,8,30,20), 98 ]
15
- @tvector << [ Time.local(1973,"Apr",2,8,30,45), 1002 ]
16
- @tvector << [ Time.local(1973,"Apr",2,8,30,58), 3014 ]
17
- @tvector << [ Time.local(1973,"Apr",2,8,31,0), 1002 ]
18
- @tvector << [ Time.local(1973,"Apr",2,8,32,0), 88 ]
19
- @tvector << [ Time.local(1973,"Apr",2,8,32,20), 882]
20
- @tvector << [ Time.local(1973,"Apr",2,8,32,21), 3015 ]
21
- @tvector << [ Time.local(1973,"Apr",2,8,36,0), 10 ]
22
- @tvector << [ Time.local(1973,"Apr",2,8,46,0), 1 ]
23
- @tvector << [ Time.local(1973,"Apr",2,8,47,0), 2 ]
24
- @tvector << [ Time.local(1973,"Apr",2,8,47,1), 3 ]
25
- @tvector << [ Time.local(1973,"Apr",2,8,47,5), 4 ]
26
- @tvector << [ Time.local(1973,"Apr",2,8,50,0), 59 ]
27
- @tvector << [ Time.local(1973,"Apr",2,8,58,0), 188 ]
28
- @tvector << [ Time.local(1973,"Apr",2,9,00,17), 4017 ]
29
- @tvector << [ Time.local(1973,"Apr",2,9,20,18), 18 ]
30
- @tvector << [ Time.local(1973,"Apr",2,9,40,20), 10 ]
31
- @tvector << [ Time.local(1973,"Apr",2,10,13,7), 100 ]
32
- @tvector << [ Time.local(1973,"Apr",2,10,14,7), 100 ]
33
- @tvector << [ Time.local(1973,"Apr",2,10,15,7), 100 ]
34
- @tvector << [ Time.local(1973,"Apr",2,10,17,7), 100 ]
35
-
36
-
37
- end
38
-
39
- # Test model simple
40
- def test_model_simple
41
- m = GerbilCharts::Models::GraphModel.new("TestModelName")
42
- assert m.name == "TestModelName"
43
- end
44
-
45
-
46
- # Test timeseries graph model
47
- def test_timeseries_1
48
- p "--- Testing basic timeseries model --- "
49
-
50
- # load this into a timeseries model
51
- mod = GerbilCharts::Models::TimeSeriesGraphModel.new("TestModel1")
52
- @tvector.each do |tpl|
53
- mod.add (tpl[0],tpl[1])
54
- end
55
-
56
- #dbg_print_model(mod)
57
-
58
- # crop over than 9:00 AM
59
- mod.crop_older(Time.local(1973,"Apr",2,9,00,00))
60
-
61
- #dbg_print_model(mod)
62
- end
63
-
64
- def dbg_print_model(mod)
65
-
66
- # test various things about the model
67
- rx,ry = mod.ranges
68
- p "range x = #{rx} y = #{ry}"
69
-
70
- # round ranges
71
- rx,ry = mod.round_ranges
72
- p "round range x = #{rx} y = #{ry}"
73
-
74
- # labels
75
- p "Labels are :"
76
- p "First = #{rx.format_min_value}"
77
- rx.each_label do |v,s|
78
- p "v = #{v} s=#{s}"
79
- end
80
- end
81
-
82
- # testing the bucketized timeseries
83
- # with bucket size 5 mins
84
- def test_bucketized_1
85
- p "--- Testing bucketized model --- "
86
-
87
- # bucketized with sec buckets
88
- mod = GerbilCharts::Models::BucketizedTimeSeriesGraphModel.new("TestModel2",5 * 60)
89
- @tvector.each do |tpl|
90
- mod.add (tpl[0],tpl[1])
91
- end
92
-
93
- dbg_print_model(mod)
94
-
95
- # print data points
96
- mod.each_tuple do |x,y|
97
- p "bkt #{Time.at(x)} = #{y}"
98
- end
99
- end
100
-
101
- # test simple timeseries
102
- def test_simple_group_1
103
-
104
- p "Testing simple timeseries model group helper"
105
-
106
- modelgroup = GerbilCharts::Models::SimpleTimeSeriesModelGroup.new( :title => "Sales figures",
107
- :timeseries => (1..6).collect { |month| Time.local(2008,month) },
108
- :models => [ ["Bruce", 1, 10, 18, 28, 80, 122],
109
- ["Rex" , 12,22, 45, 70, 218, 109],
110
- ["Buzo" , 0, 23, 25, 40, 18, 59]
111
- ]
112
- )
113
- modelgroup.each_model { |mod| dbg_print_model(mod) }
114
-
115
- end
116
-
117
-
118
- end