glennr-seer 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CONTRIBUTORS +6 -0
- data/LICENSE +20 -0
- data/README.rdoc +51 -0
- data/Rakefile +65 -0
- data/init.rb +1 -0
- data/lib/seer.rb +73 -0
- data/lib/seer/area_chart.rb +139 -0
- data/lib/seer/bar_chart.rb +124 -0
- data/lib/seer/chart.rb +68 -0
- data/lib/seer/column_chart.rb +124 -0
- data/lib/seer/gauge.rb +119 -0
- data/lib/seer/geomap.rb +166 -0
- data/lib/seer/line_chart.rb +143 -0
- data/lib/seer/pie_chart.rb +128 -0
- data/spec/area_chart_spec.rb +108 -0
- data/spec/bar_chart_spec.rb +51 -0
- data/spec/chart_spec.rb +62 -0
- data/spec/column_chart_spec.rb +51 -0
- data/spec/custom_matchers.rb +23 -0
- data/spec/gauge_spec.rb +59 -0
- data/spec/geomap_spec.rb +67 -0
- data/spec/helpers.rb +37 -0
- data/spec/line_chart_spec.rb +86 -0
- data/spec/pie_chart_spec.rb +51 -0
- data/spec/seer_spec.rb +134 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +13 -0
- metadata +121 -0
@@ -0,0 +1,51 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Seer::ColumnChart" do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
@chart = Seer::ColumnChart.new(
|
7
|
+
:data => [0,1,2,3],
|
8
|
+
:label_method => 'to_s',
|
9
|
+
:data_method => 'size',
|
10
|
+
:chart_options => {},
|
11
|
+
:chart_element => 'chart'
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
describe 'defaults' do
|
16
|
+
it_should_behave_like 'it sets default values'
|
17
|
+
end
|
18
|
+
|
19
|
+
describe 'graph options' do
|
20
|
+
|
21
|
+
[:axis_color, :axis_background_color, :axis_font_size, :background_color, :border_color, :enable_tooltip, :focus_border_color, :height, :is_3_d, :is_stacked, :legend, :legend_background_color, :legend_font_size, :legend_text_color, :log_scale, :max, :min, :reverse_axis, :show_categories, :title, :title_x, :title_y, :title_color, :title_font_size, :tooltip_font_size, :tooltip_height, :tooltip_width, :width].each do |accessor|
|
22
|
+
it "sets its #{accessor} value" do
|
23
|
+
@chart.send("#{accessor}=", 'foo')
|
24
|
+
@chart.send(accessor).should == 'foo'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
it_should_behave_like 'it has colors attribute'
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'renders as JavaScript' do
|
32
|
+
(@chart.to_js =~ /javascript/).should be_true
|
33
|
+
(@chart.to_js =~ /columnchart/).should be_true
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'sets its data columns' do
|
37
|
+
@chart.data_columns.should =~ /addRows\(4\)/
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'sets its data table' do
|
41
|
+
@chart.data_table.to_s.should set_value(0, 0,'0')
|
42
|
+
@chart.data_table.to_s.should set_value(0, 1, 8)
|
43
|
+
@chart.data_table.to_s.should set_value(1, 0,'1')
|
44
|
+
@chart.data_table.to_s.should set_value(1, 1, 8)
|
45
|
+
@chart.data_table.to_s.should set_value(2, 0,'2')
|
46
|
+
@chart.data_table.to_s.should set_value(2, 1, 8)
|
47
|
+
@chart.data_table.to_s.should set_value(3, 0,'3')
|
48
|
+
@chart.data_table.to_s.should set_value(3, 1, 8)
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module CustomMatcher
|
2
|
+
def set_cell(row, column, value)
|
3
|
+
value = "'#{value}'" if value.is_a?(String)
|
4
|
+
|
5
|
+
simple_matcher("setCell(#{row}, #{column}, #{value})") do |actual|
|
6
|
+
actual =~ /data\.setCell\(#{row},\s*#{column},\s*#{value}\)/
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def set_value(row, column, value)
|
11
|
+
value = "'#{value}'" if value.is_a?(String)
|
12
|
+
|
13
|
+
simple_matcher("setValue(#{row}, #{column}, #{value})") do |actual|
|
14
|
+
actual =~ /data\.setValue\(#{row},\s*#{column},\s*#{value}\)/
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def add_column(column_type, value)
|
19
|
+
simple_matcher("addColumn('#{column_type}', '#{value}')") do |actual|
|
20
|
+
actual =~ /data\.addColumn\('#{column_type}',\s*'#{value}'\)/
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/spec/gauge_spec.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Seer::Gauge" do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
@chart = Seer::Gauge.new(
|
7
|
+
:data => [0,1,2,3],
|
8
|
+
:label_method => 'to_s',
|
9
|
+
:data_method => 'size',
|
10
|
+
:chart_options => {},
|
11
|
+
:chart_element => 'chart'
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
describe 'defaults' do
|
16
|
+
|
17
|
+
it 'height' do
|
18
|
+
@chart.height.should == Seer::Chart::DEFAULT_HEIGHT
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'width' do
|
22
|
+
@chart.width.should == Seer::Chart::DEFAULT_WIDTH
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
describe 'graph options' do
|
28
|
+
|
29
|
+
[:green_from, :green_to, :height, :major_ticks, :max, :min, :minor_ticks, :red_from, :red_to, :width, :yellow_from, :yellow_to].each do |accessor|
|
30
|
+
it "sets its #{accessor} value" do
|
31
|
+
@chart.send("#{accessor}=", 'foo')
|
32
|
+
@chart.send(accessor).should == 'foo'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
it_should_behave_like 'it has colors attribute'
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'renders as JavaScript' do
|
40
|
+
(@chart.to_js =~ /javascript/).should be_true
|
41
|
+
(@chart.to_js =~ /gauge/).should be_true
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'sets its data columns' do
|
45
|
+
@chart.data_columns.should =~ /addRows\(4\)/
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'sets its data table' do
|
49
|
+
@chart.data_table.to_s.should set_value(0, 0,'0')
|
50
|
+
@chart.data_table.to_s.should set_value(0, 1, 8)
|
51
|
+
@chart.data_table.to_s.should set_value(1, 0,'1')
|
52
|
+
@chart.data_table.to_s.should set_value(1, 1, 8)
|
53
|
+
@chart.data_table.to_s.should set_value(2, 0,'2')
|
54
|
+
@chart.data_table.to_s.should set_value(2, 1, 8)
|
55
|
+
@chart.data_table.to_s.should set_value(3, 0,'3')
|
56
|
+
@chart.data_table.to_s.should set_value(3, 1, 8)
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
data/spec/geomap_spec.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Seer::Geomap" do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
|
7
|
+
class GeoThing
|
8
|
+
def initialize; end
|
9
|
+
def name; 'foo'; end
|
10
|
+
def latitude; -90; end
|
11
|
+
def longitude; -90; end
|
12
|
+
def count; 8; end
|
13
|
+
def geocoded?; true; end
|
14
|
+
end
|
15
|
+
|
16
|
+
@chart = Seer::Geomap.new(
|
17
|
+
:data => [GeoThing.new, GeoThing.new, GeoThing.new],
|
18
|
+
:label_method => 'name',
|
19
|
+
:data_method => 'count',
|
20
|
+
:chart_options => {},
|
21
|
+
:chart_element => 'geochart'
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
describe 'defaults' do
|
26
|
+
|
27
|
+
it 'height' do
|
28
|
+
@chart.height.should == Seer::Chart::DEFAULT_HEIGHT
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'width' do
|
32
|
+
@chart.width.should == Seer::Chart::DEFAULT_WIDTH
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
describe 'graph options' do
|
38
|
+
|
39
|
+
[:show_zoom_out, :zoom_out_label].each do |accessor|
|
40
|
+
it "sets its #{accessor} value" do
|
41
|
+
@chart.send("#{accessor}=", 'foo')
|
42
|
+
@chart.send(accessor).should == 'foo'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
it_should_behave_like 'it has colors attribute'
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'renders as JavaScript' do
|
50
|
+
(@chart.to_js =~ /javascript/).should be_true
|
51
|
+
(@chart.to_js =~ /geomap/).should be_true
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'sets its data columns' do
|
55
|
+
@chart.data_columns.should =~ /addRows\(3\)/
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'sets its data table' do
|
59
|
+
@chart.data_table.to_s.should set_value(0, 0,'foo')
|
60
|
+
@chart.data_table.to_s.should set_value(0, 1, 8)
|
61
|
+
@chart.data_table.to_s.should set_value(1, 0,'foo')
|
62
|
+
@chart.data_table.to_s.should set_value(1, 1, 8)
|
63
|
+
@chart.data_table.to_s.should set_value(2, 0,'foo')
|
64
|
+
@chart.data_table.to_s.should set_value(2, 1, 8)
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
data/spec/helpers.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
describe "it has colors attribute", :shared => true do
|
2
|
+
it 'sets its colors value' do
|
3
|
+
color_list = ['#7e7587','#990000','#009900', '#3e5643', '#660000', '#003300']
|
4
|
+
@chart.colors = color_list
|
5
|
+
@chart.colors.should == color_list
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'colors should be an array' do
|
9
|
+
lambda {
|
10
|
+
@chart.colors = '#000000'
|
11
|
+
}.should raise_error(ArgumentError)
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'colors should be valid hex values' do
|
15
|
+
lambda {
|
16
|
+
@chart.colors = ['#000000', 'NOTHEX']
|
17
|
+
}.should raise_error(ArgumentError)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "it sets default values", :shared => true do
|
22
|
+
it 'colors' do
|
23
|
+
@chart.colors.should == Seer::Chart::DEFAULT_COLORS
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'legend' do
|
27
|
+
@chart.legend.should == Seer::Chart::DEFAULT_LEGEND_LOCATION
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'height' do
|
31
|
+
@chart.height.should == Seer::Chart::DEFAULT_HEIGHT
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'width' do
|
35
|
+
@chart.width.should == Seer::Chart::DEFAULT_WIDTH
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Seer::LineChart" do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
@chart = Seer::LineChart.new(
|
7
|
+
:data => [0,1,2,3],
|
8
|
+
:series_label => 'to_s',
|
9
|
+
:data_series => [[1,2,3],[3,4,5]],
|
10
|
+
:data_label => 'to_s',
|
11
|
+
:data_method => 'size',
|
12
|
+
:chart_options => {},
|
13
|
+
:chart_element => 'chart'
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
describe 'defaults' do
|
18
|
+
it_should_behave_like 'it sets default values'
|
19
|
+
end
|
20
|
+
|
21
|
+
describe 'graph options' do
|
22
|
+
|
23
|
+
[:axis_color, :axis_background_color, :axis_font_size, :background_color, :border_color, :enable_tooltip, :focus_border_color, :height, :legend, :legend_background_color, :legend_font_size, :legend_text_color, :line_size, :log_scale, :max, :min, :point_size, :reverse_axis, :show_categories, :smooth_line, :title, :title_x, :title_y, :title_color, :title_font_size, :tooltip_font_size, :tooltip_height, :number, :tooltip_width, :width].each do |accessor|
|
24
|
+
it "sets its #{accessor} value" do
|
25
|
+
@chart.send("#{accessor}=", 'foo')
|
26
|
+
@chart.send(accessor).should == 'foo'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
it_should_behave_like 'it has colors attribute'
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'renders as JavaScript' do
|
34
|
+
(@chart.to_js =~ /javascript/).should be_true
|
35
|
+
(@chart.to_js =~ /linechart/).should be_true
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'sets its data columns' do
|
39
|
+
@chart.data_columns.should =~ /addRows\(5\)/
|
40
|
+
@chart.data_columns.should add_column('string', 'Date')
|
41
|
+
@chart.data_columns.should add_column('number', '0')
|
42
|
+
@chart.data_columns.should add_column('number', '1')
|
43
|
+
@chart.data_columns.should add_column('number', '2')
|
44
|
+
@chart.data_columns.should add_column('number', '3')
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'sets its data table' do
|
48
|
+
@chart.data_table.to_s.should set_cell(0, 0,'1')
|
49
|
+
@chart.data_table.to_s.should set_cell(1, 0,'2')
|
50
|
+
@chart.data_table.to_s.should set_cell(2, 0,'3')
|
51
|
+
@chart.data_table.to_s.should set_cell(3, 0,'4')
|
52
|
+
@chart.data_table.to_s.should set_cell(4, 0,'5')
|
53
|
+
@chart.data_table.to_s.should set_cell(0,1,8)
|
54
|
+
@chart.data_table.to_s.should set_cell(2,1,8)
|
55
|
+
@chart.data_table.to_s.should set_cell(0,2,8)
|
56
|
+
@chart.data_table.to_s.should set_cell(1,2,8)
|
57
|
+
@chart.data_table.to_s.should set_cell(2,2,8)
|
58
|
+
end
|
59
|
+
|
60
|
+
describe 'when data_series is an array of arrays of arrays/hashes' do
|
61
|
+
before(:each) do
|
62
|
+
data_series = Array.new(3) {|i| [[i, i+1], [i+1, i+2]]}
|
63
|
+
@chart = Seer::LineChart.new(
|
64
|
+
:data => [0,1,2,3],
|
65
|
+
:series_label => 'to_s',
|
66
|
+
:data_series => data_series,
|
67
|
+
:data_label => 'first',
|
68
|
+
:data_method => 'size',
|
69
|
+
:chart_options => {},
|
70
|
+
:chart_element => 'chart'
|
71
|
+
)
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'calculates number of rows' do
|
75
|
+
@chart.data_columns.should =~ /addRows\(4\)/
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'sets its data table' do
|
79
|
+
@chart.data_table.to_s.should set_cell(0, 0,'0')
|
80
|
+
@chart.data_table.to_s.should set_cell(1, 0,'1')
|
81
|
+
@chart.data_table.to_s.should set_cell(2, 0,'2')
|
82
|
+
@chart.data_table.to_s.should set_cell(3, 0,'3')
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Seer::PieChart" do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
@chart = Seer::PieChart.new(
|
7
|
+
:data => [0,1,2,3],
|
8
|
+
:label_method => 'to_s',
|
9
|
+
:data_method => 'size',
|
10
|
+
:chart_options => {},
|
11
|
+
:chart_element => 'chart'
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
describe 'defaults' do
|
16
|
+
it_should_behave_like 'it sets default values'
|
17
|
+
end
|
18
|
+
|
19
|
+
describe 'graph options' do
|
20
|
+
|
21
|
+
[:background_color, :border_color, :enable_tooltip, :focus_border_color, :height, :is_3_d, :legend, :legend_background_color, :legend_font_size, :legend_text_color, :pie_join_angle, :pie_minimal_angle, :title, :title_x, :title_y, :title_color, :title_font_size, :tooltip_font_size, :tooltip_height, :tooltip_width, :width].each do |accessor|
|
22
|
+
it "sets its #{accessor} value" do
|
23
|
+
@chart.send("#{accessor}=", 'foo')
|
24
|
+
@chart.send(accessor).should == 'foo'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
it_should_behave_like 'it has colors attribute'
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'renders as JavaScript' do
|
32
|
+
(@chart.to_js =~ /javascript/).should be_true
|
33
|
+
(@chart.to_js =~ /piechart/).should be_true
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'sets its data columns' do
|
37
|
+
@chart.data_columns.should =~ /addRows\(4\)/
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'sets its data table' do
|
41
|
+
@chart.data_table.to_s.should set_value(0, 0,'0')
|
42
|
+
@chart.data_table.to_s.should set_value(0, 1, 8)
|
43
|
+
@chart.data_table.to_s.should set_value(1, 0,'1')
|
44
|
+
@chart.data_table.to_s.should set_value(1, 1, 8)
|
45
|
+
@chart.data_table.to_s.should set_value(2, 0,'2')
|
46
|
+
@chart.data_table.to_s.should set_value(2, 1, 8)
|
47
|
+
@chart.data_table.to_s.should set_value(3, 0,'3')
|
48
|
+
@chart.data_table.to_s.should set_value(3, 1, 8)
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
data/spec/seer_spec.rb
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Seer" do
|
4
|
+
|
5
|
+
require 'rubygems'
|
6
|
+
|
7
|
+
it 'validates hexadecimal numbers' do
|
8
|
+
invalid = [nil, '', 'food', 'bdadce', 123456]
|
9
|
+
valid = ['#000000','#ffffff']
|
10
|
+
invalid.each{ |e| Seer.valid_hex_number?(e).should be_false }
|
11
|
+
valid.each { |e| Seer.valid_hex_number?(e).should be_true }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'visualize' do
|
15
|
+
|
16
|
+
it 'raises an error for invalid visualizaters' do
|
17
|
+
invalid = [:random, 'something']
|
18
|
+
invalid.each do |e|
|
19
|
+
lambda do
|
20
|
+
Seer.visualize([1,2,3], :as => e)
|
21
|
+
end.should raise_error(ArgumentError)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'raises an error for missing data' do
|
26
|
+
_data = []
|
27
|
+
lambda do
|
28
|
+
Seer.visualize(_data, :as => :bar_chart)
|
29
|
+
end.should raise_error(ArgumentError)
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'accepts valid visualizers' do
|
33
|
+
Seer::VISUALIZERS.each do |v|
|
34
|
+
lambda do
|
35
|
+
Seer::visualize(
|
36
|
+
[0,1,2,3],
|
37
|
+
:as => v,
|
38
|
+
:in_element => 'chart',
|
39
|
+
:series => {:label => 'to_s', :data => 'size'},
|
40
|
+
:chart_options => {}
|
41
|
+
)
|
42
|
+
end.should_not raise_error(ArgumentError)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
describe 'private chart methods' do
|
49
|
+
|
50
|
+
it 'renders an area chart' do
|
51
|
+
(Seer.send(:area_chart,
|
52
|
+
[0,1,2,3],
|
53
|
+
:as => :area_chart,
|
54
|
+
:in_element => 'chart',
|
55
|
+
:series => {
|
56
|
+
:series_label => 'to_s',
|
57
|
+
:data_label => 'to_s',
|
58
|
+
:data_method => 'size',
|
59
|
+
:data_series => [[1,2,3],[3,4,5]]
|
60
|
+
},
|
61
|
+
:chart_options => {}
|
62
|
+
) =~ /areachart/).should be_true
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'renders a bar chart' do
|
66
|
+
(Seer.send(:bar_chart,
|
67
|
+
[0,1,2,3],
|
68
|
+
:as => :bar_chart,
|
69
|
+
:in_element => 'chart',
|
70
|
+
:series => {
|
71
|
+
:series_label => 'to_s',
|
72
|
+
:data_method => 'size'
|
73
|
+
},
|
74
|
+
:chart_options => {}
|
75
|
+
) =~ /barchart/).should be_true
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'renders a column chart' do
|
79
|
+
(Seer.send(:column_chart,
|
80
|
+
[0,1,2,3],
|
81
|
+
:as => :column_chart,
|
82
|
+
:in_element => 'chart',
|
83
|
+
:series => {
|
84
|
+
:series_label => 'to_s',
|
85
|
+
:data_method => 'size'
|
86
|
+
},
|
87
|
+
:chart_options => {}
|
88
|
+
) =~ /columnchart/).should be_true
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'renders a gauge' do
|
92
|
+
(Seer.send(:gauge,
|
93
|
+
[0,1,2,3],
|
94
|
+
:as => :gauge,
|
95
|
+
:in_element => 'chart',
|
96
|
+
:series => {
|
97
|
+
:series_label => 'to_s',
|
98
|
+
:data_method => 'size'
|
99
|
+
},
|
100
|
+
:chart_options => {}
|
101
|
+
) =~ /gauge/).should be_true
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'renders a line chart' do
|
105
|
+
(Seer.send(:line_chart,
|
106
|
+
[0,1,2,3],
|
107
|
+
:as => :line_chart,
|
108
|
+
:in_element => 'chart',
|
109
|
+
:series => {
|
110
|
+
:series_label => 'to_s',
|
111
|
+
:data_label => 'to_s',
|
112
|
+
:data_method => 'size',
|
113
|
+
:data_series => [[1,2,3],[3,4,5]]
|
114
|
+
},
|
115
|
+
:chart_options => {}
|
116
|
+
) =~ /linechart/).inspect #should be_true
|
117
|
+
end
|
118
|
+
|
119
|
+
it 'renders a pie chart' do
|
120
|
+
(Seer.send(:pie_chart,
|
121
|
+
[0,1,2,3],
|
122
|
+
:as => :pie_chart,
|
123
|
+
:in_element => 'chart',
|
124
|
+
:series => {
|
125
|
+
:series_label => 'to_s',
|
126
|
+
:data_method => 'size'
|
127
|
+
},
|
128
|
+
:chart_options => {}
|
129
|
+
) =~ /piechart/).should be_true
|
130
|
+
end
|
131
|
+
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|