derailed-ziya 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +0 -0
- data/Manifest.txt +405 -0
- data/README.txt +232 -0
- data/Rakefile +44 -0
- data/bin/ziyafy +53 -0
- data/charts/AC_RunActiveContent.js +292 -0
- data/charts/charts.swf +0 -0
- data/charts/charts_library/ar3d.swf +0 -0
- data/charts/charts_library/arno.swf +0 -0
- data/charts/charts_library/ars3.swf +0 -0
- data/charts/charts_library/arst.swf +0 -0
- data/charts/charts_library/brfl.swf +0 -0
- data/charts/charts_library/brno.swf +0 -0
- data/charts/charts_library/brst.swf +0 -0
- data/charts/charts_library/buno.swf +0 -0
- data/charts/charts_library/cl3d.swf +0 -0
- data/charts/charts_library/clfl.swf +0 -0
- data/charts/charts_library/clno.swf +0 -0
- data/charts/charts_library/clp3.swf +0 -0
- data/charts/charts_library/cls3.swf +0 -0
- data/charts/charts_library/clst.swf +0 -0
- data/charts/charts_library/cnno.swf +0 -0
- data/charts/charts_library/dono.swf +0 -0
- data/charts/charts_library/lnno.swf +0 -0
- data/charts/charts_library/mxno.swf +0 -0
- data/charts/charts_library/pi3d.swf +0 -0
- data/charts/charts_library/pino.swf +0 -0
- data/charts/charts_library/pono.swf +0 -0
- data/charts/charts_library/scno.swf +0 -0
- data/charts/full_screen.swf +0 -0
- data/charts/scripts/output_jpg.php +23 -0
- data/charts/sliders/black.swf +0 -0
- data/charts/sliders/preview_handle_1.swf +0 -0
- data/charts/sliders/preview_handle_2.swf +0 -0
- data/gauges/designs/circle.yml +18 -0
- data/gauges/designs/signal.yml +14 -0
- data/gauges/designs/thermo.yml +119 -0
- data/gauges/designs/title.yml +11 -0
- data/gauges/gauge.swf +0 -0
- data/lib/ziya/charts/area.rb +18 -0
- data/lib/ziya/charts/area_threed.rb +16 -0
- data/lib/ziya/charts/bar.rb +16 -0
- data/lib/ziya/charts/base.rb +510 -0
- data/lib/ziya/charts/bubble.rb +18 -0
- data/lib/ziya/charts/candle_stick.rb +16 -0
- data/lib/ziya/charts/column.rb +16 -0
- data/lib/ziya/charts/column_threed.rb +16 -0
- data/lib/ziya/charts/donut.rb +18 -0
- data/lib/ziya/charts/floating_bar.rb +16 -0
- data/lib/ziya/charts/floating_column.rb +16 -0
- data/lib/ziya/charts/line.rb +16 -0
- data/lib/ziya/charts/mixed.rb +16 -0
- data/lib/ziya/charts/parallel_threed_column.rb +16 -0
- data/lib/ziya/charts/pie.rb +16 -0
- data/lib/ziya/charts/pie_threed.rb +16 -0
- data/lib/ziya/charts/polar.rb +16 -0
- data/lib/ziya/charts/scatter.rb +16 -0
- data/lib/ziya/charts/stacked_area.rb +16 -0
- data/lib/ziya/charts/stacked_bar.rb +16 -0
- data/lib/ziya/charts/stacked_column.rb +16 -0
- data/lib/ziya/charts/stacked_threed_area.rb +16 -0
- data/lib/ziya/charts/stacked_threed_column.rb +16 -0
- data/lib/ziya/components/area.rb +17 -0
- data/lib/ziya/components/axis_category.rb +17 -0
- data/lib/ziya/components/axis_ticks.rb +35 -0
- data/lib/ziya/components/axis_value.rb +16 -0
- data/lib/ziya/components/base.rb +142 -0
- data/lib/ziya/components/bevel.rb +15 -0
- data/lib/ziya/components/blur.rb +13 -0
- data/lib/ziya/components/chart_border.rb +14 -0
- data/lib/ziya/components/chart_grid_h.rb +26 -0
- data/lib/ziya/components/chart_grid_v.rb +27 -0
- data/lib/ziya/components/chart_guide.rb +16 -0
- data/lib/ziya/components/chart_label.rb +16 -0
- data/lib/ziya/components/chart_pref.rb +22 -0
- data/lib/ziya/components/chart_rect.rb +37 -0
- data/lib/ziya/components/chart_transition.rb +25 -0
- data/lib/ziya/components/circle.rb +16 -0
- data/lib/ziya/components/context_menu.rb +15 -0
- data/lib/ziya/components/draw.rb +47 -0
- data/lib/ziya/components/draw_base.rb +10 -0
- data/lib/ziya/components/filter.rb +26 -0
- data/lib/ziya/components/glow.rb +14 -0
- data/lib/ziya/components/image.rb +17 -0
- data/lib/ziya/components/legend.rb +18 -0
- data/lib/ziya/components/line.rb +16 -0
- data/lib/ziya/components/link.rb +29 -0
- data/lib/ziya/components/link_data.rb +18 -0
- data/lib/ziya/components/rect.rb +18 -0
- data/lib/ziya/components/scroll.rb +26 -0
- data/lib/ziya/components/series.rb +16 -0
- data/lib/ziya/components/series_color.rb +35 -0
- data/lib/ziya/components/series_explode.rb +38 -0
- data/lib/ziya/components/shadow.rb +14 -0
- data/lib/ziya/components/text.rb +17 -0
- data/lib/ziya/components/update.rb +19 -0
- data/lib/ziya/gauges/base.rb +172 -0
- data/lib/ziya/gauges/radial.rb +18 -0
- data/lib/ziya/gauges/signal.rb +138 -0
- data/lib/ziya/gauges/support/area.rb +13 -0
- data/lib/ziya/gauges/support/base.rb +33 -0
- data/lib/ziya/gauges/support/circle.rb +14 -0
- data/lib/ziya/gauges/support/design.rb +5 -0
- data/lib/ziya/gauges/support/image.rb +12 -0
- data/lib/ziya/gauges/support/line.rb +12 -0
- data/lib/ziya/gauges/support/link.rb +24 -0
- data/lib/ziya/gauges/support/move.rb +15 -0
- data/lib/ziya/gauges/support/point.rb +12 -0
- data/lib/ziya/gauges/support/polygon.rb +13 -0
- data/lib/ziya/gauges/support/radial_base.rb +21 -0
- data/lib/ziya/gauges/support/radial_numbers.rb +41 -0
- data/lib/ziya/gauges/support/radial_ticks.rb +29 -0
- data/lib/ziya/gauges/support/rect.rb +14 -0
- data/lib/ziya/gauges/support/rotate.rb +15 -0
- data/lib/ziya/gauges/support/scale.rb +15 -0
- data/lib/ziya/gauges/support/text.rb +21 -0
- data/lib/ziya/gauges/support/update.rb +12 -0
- data/lib/ziya/gauges/thermo.rb +121 -0
- data/lib/ziya/helpers/base_helper.rb +70 -0
- data/lib/ziya/utils/logger.rb +125 -0
- data/lib/ziya/utils/text.rb +39 -0
- data/lib/ziya/version.rb +15 -0
- data/lib/ziya/ziya_helper.rb +374 -0
- data/lib/ziya.rb +112 -0
- data/spec/charts/base_spec.rb +134 -0
- data/spec/charts/chart_type_spec.rb +63 -0
- data/spec/components/area_spec.rb +67 -0
- data/spec/components/draw_spec.rb +32 -0
- data/spec/components/filter_spec.rb +27 -0
- data/spec/components/link_spec.rb +22 -0
- data/spec/components/series.rb +18 -0
- data/spec/components/series_color_spec.rb +39 -0
- data/spec/components/series_explode.rb +39 -0
- data/spec/components/series_explode_spec.rb +39 -0
- data/spec/designs/circle.yml +7 -0
- data/spec/designs/crapping_out.yml +8 -0
- data/spec/designs/gauge_1.yml +43 -0
- data/spec/designs/gauge_2.yml +11 -0
- data/spec/designs/gauge_no_name.yml +43 -0
- data/spec/designs/gauge_raw.yml +5 -0
- data/spec/designs/thermo.yml +13 -0
- data/spec/gauges/base_spec.rb +90 -0
- data/spec/gauges/signal_spec.rb +36 -0
- data/spec/gauges/support/area_spec.rb +40 -0
- data/spec/gauges/support/circle_spec.rb +78 -0
- data/spec/gauges/support/image_spec.rb +35 -0
- data/spec/gauges/support/line_spec.rb +34 -0
- data/spec/gauges/support/link_spec.rb +35 -0
- data/spec/gauges/support/move_spec.rb +45 -0
- data/spec/gauges/support/polygon_spec.rb +36 -0
- data/spec/gauges/support/radial_numbers_spec.rb +35 -0
- data/spec/gauges/support/radial_ticks_spec.rb +30 -0
- data/spec/gauges/support/rotate_spec.rb +45 -0
- data/spec/gauges/support/scale_spec.rb +46 -0
- data/spec/gauges/support/text_spec.rb +40 -0
- data/spec/gauges/thermo_spec.rb +49 -0
- data/spec/helpers/base_helper_spec.rb +36 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/test_helpers/gauge_2_helper.rb +17 -0
- data/spec/themes/default/fred.yml +6 -0
- data/spec/themes/default/line_chart.yml +6 -0
- data/spec/utils/logger_spec.rb +55 -0
- data/spec/utils/text_spec.rb +33 -0
- data/spec/ziya_helper_spec.rb +117 -0
- data/spec/ziya_spec.rb +19 -0
- data/tasks/ann.rake +76 -0
- data/tasks/annotations.rake +22 -0
- data/tasks/doc.rake +48 -0
- data/tasks/gem.rake +110 -0
- data/tasks/manifest.rake +49 -0
- data/tasks/post_load.rake +26 -0
- data/tasks/rubyforge.rake +57 -0
- data/tasks/setup.rb +227 -0
- data/tasks/spec.rake +61 -0
- data/tasks/svn.rake +44 -0
- data/tasks/test.rake +38 -0
- metadata +468 -0
@@ -0,0 +1,134 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), %w[.. spec_helper]))
|
2
|
+
|
3
|
+
describe Ziya::Charts::Base do
|
4
|
+
before( :each ) do
|
5
|
+
@chart = Ziya::Charts::Base.new
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "#initialize" do
|
9
|
+
before( :each ) do
|
10
|
+
@chart = Ziya::Charts::Base.new( "test_license", "test_id" )
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should create a chart with the correct license" do
|
14
|
+
@chart.license.should == "test_license"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should create a chart with the correct id" do
|
18
|
+
@chart.id.should == "test_id"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "it should produce the correct xml for a basic chart" do
|
23
|
+
chart = Ziya::Charts::Base.new( "aaa" )
|
24
|
+
chart.add( :axis_category_text, %w[fox dog] )
|
25
|
+
chart.add( :series, "test", [10, 20] )
|
26
|
+
chart.to_xml.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?><chart><license>aaa</license><chart_data><row><null/><string>fox</string><string>dog</string></row><row><string>test</string><number>10</number><number>20</number></row></chart_data></chart>"
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "#add" do
|
30
|
+
before( :each ) do
|
31
|
+
@chart = Ziya::Charts::Base.new
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should support setting an axis category" do
|
35
|
+
@chart.add( :axis_category_text, %w[fox cat dog] )
|
36
|
+
@chart.to_xml.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?><chart><chart_data><row><null/><string>fox</string><string>cat</string><string>dog</string></row></chart_data></chart>"
|
37
|
+
end
|
38
|
+
it "should error if the axis category is not an array" do
|
39
|
+
lambda { @chart.add( :axis_category_text, "") }.should raise_error( ArgumentError, /array of categories/i )
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should support setting a composite chart urls" do
|
43
|
+
@chart.add( :composites, %w[url1 url2] )
|
44
|
+
@chart.to_xml.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?><chart></chart>"
|
45
|
+
end
|
46
|
+
it "should error if the composite url arg is not an array" do
|
47
|
+
lambda { @chart.add( :composites, "") }.should raise_error( ArgumentError, /array of urls/i )
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should support setting the axis_value label" do
|
51
|
+
@chart.add( :axis_category_text, %w[dog cat] )
|
52
|
+
@chart.add( :axis_value_label, %w[blee duh] )
|
53
|
+
@chart.to_xml.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?><chart><chart_data><row><null/><string>dog</string><string>cat</string></row></chart_data><axis_value_label><string>blee</string><string>duh</string></axis_value_label></chart>"
|
54
|
+
end
|
55
|
+
it "should error if the axis value label arg is not an array" do
|
56
|
+
lambda { @chart.add( :axis_value_label, "") }.should raise_error( ArgumentError, /array of values/i )
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should support setting the axis category label" do
|
60
|
+
@chart.add( :axis_category_text, %w[dog cat] )
|
61
|
+
@chart.add( :axis_category_label, %w[blee duh] )
|
62
|
+
@chart.to_xml.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?><chart><chart_data><row><null/><string>dog</string><string>cat</string></row></chart_data><axis_category_label><string>blee</string><string>duh</string></axis_category_label></chart>"
|
63
|
+
end
|
64
|
+
it "should error if the axis category label arg is not an array" do
|
65
|
+
lambda { @chart.add( :axis_category_label, "") }.should raise_error( ArgumentError, /array of category/i )
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should support adding series" do
|
69
|
+
@chart.add( :axis_category_text, %w[dog cat] )
|
70
|
+
@chart.add( :series, "test", %w[10 20] )
|
71
|
+
@chart.to_xml.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?><chart><chart_data><row><null/><string>dog</string><string>cat</string></row><row><string>test</string><string>10</string><string>20</string></row></chart_data></chart>"
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should support adding labels to series" do
|
75
|
+
@chart.add( :axis_category_text, %w[dog cat] )
|
76
|
+
@chart.add( :series, "test", [ {:value => 10, :label => "label1" }, { :value => 20, :label => "label2" } ] )
|
77
|
+
@chart.to_xml.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?><chart><chart_data><row><null/><string>dog</string><string>cat</string></row><row><string>test</string><number label=\"label1\">10</number><number label=\"label2\">20</number></row></chart_data></chart>"
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should support adding filters to series" do
|
81
|
+
@chart.add( :axis_category_text, %w[dog cat] )
|
82
|
+
@chart.add( :series, "test", [ {:value => 10, :glow => "glow1" }, { :value => 20, :blur => "blur2" } ] )
|
83
|
+
@chart.to_xml.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?><chart><chart_data><row><null/><string>dog</string><string>cat</string></row><row><string>test</string><number glow=\"glow1\">10</number><number blur=\"blur2\">20</number></row></chart_data></chart>"
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should error if a series is defined but no axis_category is specified" do
|
87
|
+
@chart.add( :series, "test", [10,20] )
|
88
|
+
lambda { @chart.to_xml }.should raise_error( RuntimeError, /axis_category_text/i )
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should accept a series with no name" do
|
92
|
+
lambda { @chart.add( :series, "", [10,20]) }.should_not raise_error
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should error if the series is not an array" do
|
96
|
+
lambda { @chart.add( :series, "test", nil) }.should raise_error( ArgumentError, /data points/i )
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should error if the user data has no key" do
|
100
|
+
lambda { @chart.add( :user_data, nil) }.should raise_error( ArgumentError, /specify a key/i )
|
101
|
+
end
|
102
|
+
it "should error if the user data has no key" do
|
103
|
+
lambda { @chart.add( :user_data, :fred, "blee") }.should_not raise_error( ArgumentError, /specify a key/i )
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should support setting yaml styles directly" do
|
107
|
+
@chart.add( :styles, "--- !ruby/object:Ziya::Charts::Base\n" )
|
108
|
+
@chart.to_xml.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?><chart></chart>"
|
109
|
+
end
|
110
|
+
it "should error if no style is specified" do
|
111
|
+
lambda { @chart.add( :styles, "") }.should raise_error( ArgumentError, /set of styles/i )
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should support mixed charts" do
|
115
|
+
@chart.add( :chart_types, %w[line bar] )
|
116
|
+
@chart.to_xml.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?><chart><chart_type><string>line</string><string>bar</string></chart_type></chart>"
|
117
|
+
end
|
118
|
+
it "should error if no chart types are specified" do
|
119
|
+
lambda { @chart.add( :chart_types, "") }.should raise_error( ArgumentError, /set of chart types/i )
|
120
|
+
end
|
121
|
+
|
122
|
+
it "should support setting a themes" do
|
123
|
+
@chart.add( :theme, "blee" )
|
124
|
+
@chart.to_xml.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?><chart></chart>"
|
125
|
+
end
|
126
|
+
it "should error if no chart types are specified" do
|
127
|
+
lambda { @chart.add( :theme, "") }.should raise_error( ArgumentError, /theme name/i )
|
128
|
+
end
|
129
|
+
|
130
|
+
it "should error if an invalid option is specified" do
|
131
|
+
lambda { @chart.add( :fred, "") }.should raise_error( ArgumentError, /invalid directive/i )
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), %w[.. spec_helper]))
|
2
|
+
|
3
|
+
describe Ziya::Charts::Base do
|
4
|
+
include Ziya::Utils::Text
|
5
|
+
|
6
|
+
before( :all ) do
|
7
|
+
@types = %w[
|
8
|
+
Area
|
9
|
+
Bar
|
10
|
+
Bubble
|
11
|
+
CandleStick
|
12
|
+
Column
|
13
|
+
ColumnThreed
|
14
|
+
FloatingBar
|
15
|
+
FloatingColumn
|
16
|
+
Line
|
17
|
+
Mixed
|
18
|
+
ParallelThreedColumn
|
19
|
+
Pie
|
20
|
+
PieThreed
|
21
|
+
Polar
|
22
|
+
Scatter
|
23
|
+
StackedArea
|
24
|
+
StackedBar
|
25
|
+
StackedArea
|
26
|
+
StackedBar
|
27
|
+
StackedColumn
|
28
|
+
StackedThreedColumn
|
29
|
+
]
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "#initialize" do
|
33
|
+
it "should create a set of charts correctly" do
|
34
|
+
@types.each do |type|
|
35
|
+
chart = Ziya::Charts.const_get( classify(type) ).new
|
36
|
+
if type.index( /Threed/ )
|
37
|
+
match = type.match( /(.*)Threed(.*)/ )
|
38
|
+
if match[2] and !match[2].empty?
|
39
|
+
chart.type.gsub(/ /, '' ).should == match[1].downcase + "3d" + match[2].downcase
|
40
|
+
else
|
41
|
+
chart.type.gsub(/ /, '' ).should == "3d" + match[1].downcase
|
42
|
+
end
|
43
|
+
else
|
44
|
+
chart.type.gsub(/ /, '' ).should == type.downcase unless type == "Mixed"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should produce the correct xml for a line chart with styles" do
|
50
|
+
chart = Ziya::Charts::Line.new( "aaa" )
|
51
|
+
chart.add( :axis_category_text, %w[fox dog] )
|
52
|
+
chart.add( :series, "test", [10, 20], %w[label1 label2] )
|
53
|
+
chart.to_xml.index( "color=\"0\"" ).should_not be_nil
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should overide styles for a line chart with an id defined" do
|
57
|
+
chart = Ziya::Charts::Line.new( "aaa", "fred" )
|
58
|
+
chart.add( :axis_category_text, %w[fox dog] )
|
59
|
+
chart.add( :series, "test", [10, 20], %w[label1 label2] )
|
60
|
+
chart.to_xml.index( "color=\"ffffff\"" ).should_not be_nil
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), %w[.. spec_helper]))
|
2
|
+
|
3
|
+
describe Ziya::Components::Area do
|
4
|
+
before( :each ) do
|
5
|
+
@comp = Ziya::Components::Area.new
|
6
|
+
@comp.x = 1
|
7
|
+
@comp.y = 2
|
8
|
+
@comp.width = 100
|
9
|
+
@comp.height = 200
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should have some options" do
|
13
|
+
@comp.options.should == { :height => 200, :x => 1, :width => 100, :y => 2 }
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should construct an area correctly" do
|
17
|
+
area = Ziya::Components::Area.new( :height => 200, :width => 100, :x => 0, :y => 1 )
|
18
|
+
area.height.should == 200
|
19
|
+
area.width.should == 100
|
20
|
+
area.x.should == 0
|
21
|
+
area.y.should == 1
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should have no options as string" do
|
25
|
+
@comp.options_as_string.should == ":height => '200',:width => '100',:x => '1',:y => '2'"
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should define the correct attribute methods" do
|
29
|
+
lambda{ Ziya::Components::Area.attributes[@comp.class.name].each {
|
30
|
+
|m| @comp.send( m ) } }.should_not raise_error
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should check that a component is not empty correctly" do
|
34
|
+
@comp.should be_configured
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should check that no properties are set correctly" do
|
38
|
+
@comp = Ziya::Components::Area.new
|
39
|
+
@comp.should_not be_configured
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should merge attributes correctly" do
|
43
|
+
parent = Ziya::Components::Area.new
|
44
|
+
parent.x = 20
|
45
|
+
parent.y = 50
|
46
|
+
@comp.merge( parent, false )
|
47
|
+
parent.options_as_string.should == ":x => '20',:y => '50'"
|
48
|
+
@comp.options_as_string.should == ":height => '200',:width => '100',:x => '20',:y => '50'"
|
49
|
+
end
|
50
|
+
|
51
|
+
describe "#flatten" do
|
52
|
+
it "should flatten component correctly" do
|
53
|
+
xml = Builder::XmlMarkup.new
|
54
|
+
# BOZO !! Doh !! that would have been nice but the attrs order is unspecified in builder...
|
55
|
+
# @comp.flatten( xml ).should == "<area width=\"100\" x=\"1\" y=\"2\" height=\"200\"/>"
|
56
|
+
@comp.flatten( xml ).size.should == 44
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should flatten simple component correctly" do
|
60
|
+
xml = Builder::XmlMarkup.new
|
61
|
+
comp = Ziya::Components::Area.new
|
62
|
+
comp.x = 10
|
63
|
+
comp.flatten( xml ).should == "<area x=\"10\"/>"
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), %w[.. spec_helper]))
|
2
|
+
|
3
|
+
describe Ziya::Components::Draw do
|
4
|
+
before( :each ) do
|
5
|
+
@comp = Ziya::Components::Draw.new
|
6
|
+
circle = Ziya::Components::Circle.new
|
7
|
+
circle.radius = 10
|
8
|
+
image = Ziya::Components::Image.new
|
9
|
+
image.x = 10
|
10
|
+
@comp.components = [circle, image]
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should define the correct attribute methods" do
|
14
|
+
lambda{ Ziya::Components::Draw.attributes[@comp.class.name].each {
|
15
|
+
|m| @comp.send( m ) } }.should_not raise_error
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#flatten" do
|
19
|
+
before( :each ) do
|
20
|
+
@xml = Builder::XmlMarkup.new
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should flatten component correctly" do
|
24
|
+
@comp.flatten( @xml ).should == "<draw><circle radius=\"10\"/><image x=\"10\"/></draw>"
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should support composite charts" do
|
28
|
+
urls = [ "/fred", "/blee" ]
|
29
|
+
@comp.flatten( @xml, urls ).should == "<draw><circle radius=\"10\"/><image x=\"10\"/><image url=\"/charts/charts.swf?library_path=/charts/charts_library&xml_source=%2Ffred\"/><image url=\"/charts/charts.swf?library_path=/charts/charts_library&xml_source=%2Fblee\"/></draw>"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), %w[.. spec_helper]))
|
2
|
+
|
3
|
+
describe Ziya::Components::Filter do
|
4
|
+
before( :each ) do
|
5
|
+
@comp = Ziya::Components::Filter.new
|
6
|
+
blur = Ziya::Components::Blur.new
|
7
|
+
blur.blurX = 10
|
8
|
+
glow = Ziya::Components::Glow.new
|
9
|
+
glow.alpha = 50
|
10
|
+
@comp.filters = [blur, glow]
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should define the correct attribute methods" do
|
14
|
+
lambda{ Ziya::Components::Filter.attributes[@comp.class.name].each {
|
15
|
+
|m| @comp.send( m ) } }.should_not raise_error
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#flatten" do
|
19
|
+
before( :each ) do
|
20
|
+
@xml = Builder::XmlMarkup.new
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should flatten component correctly" do
|
24
|
+
@comp.flatten( @xml ).should == "<filter><blur blurX=\"10\"/><glow alpha=\"50\"/></filter>"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), %w[.. spec_helper]))
|
2
|
+
|
3
|
+
describe Ziya::Components::Link do
|
4
|
+
before( :each ) do
|
5
|
+
@comp = Ziya::Components::Link.new
|
6
|
+
area1 = Ziya::Components::Area.new
|
7
|
+
area1.x = 10
|
8
|
+
area2 = Ziya::Components::Area.new
|
9
|
+
area2.x = 20
|
10
|
+
@comp.areas = [area1, area2]
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should define the correct attribute methods" do
|
14
|
+
lambda{ Ziya::Components::Link.attributes[@comp.class.name].each {
|
15
|
+
|m| @comp.send( m ) } }.should_not raise_error
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should flatten component correctly" do
|
19
|
+
xml = Builder::XmlMarkup.new
|
20
|
+
@comp.flatten( xml ).should == "<link><area x=\"10\"/><area x=\"20\"/></link>"
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), %w[.. spec_helper]))
|
2
|
+
|
3
|
+
describe Ziya::Components::Series do
|
4
|
+
before( :each ) do
|
5
|
+
@comp = Ziya::Components::Series.new
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should define the correct attribute methods" do
|
9
|
+
lambda{ Ziya::Components::Series.attributes[@comp.class.name].each {
|
10
|
+
|m| @comp.send( m ) } }.should_not raise_error
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should flatten component correctly" do
|
14
|
+
xml = Builder::XmlMarkup.new
|
15
|
+
@comp.switch = false
|
16
|
+
@comp.flatten( xml ).should == "<series>false</series>"
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), %w[.. spec_helper]))
|
2
|
+
|
3
|
+
describe Ziya::Components::SeriesColor do
|
4
|
+
before( :each ) do
|
5
|
+
@comp = Ziya::Components::SeriesColor.new
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should define the correct attribute methods" do
|
9
|
+
lambda{ Ziya::Components::SeriesColor.attributes[@comp.class.name].each {
|
10
|
+
|m| @comp.send( m ) } }.should_not raise_error
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#flatten" do
|
14
|
+
before( :each ) do
|
15
|
+
@xml = Builder::XmlMarkup.new
|
16
|
+
@results = "<series_color><color>10</color><color>20</color><color>30</color></series_color>"
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should flatten string explode version correctly" do
|
20
|
+
@comp.colors = "10,20,30"
|
21
|
+
@comp.flatten( @xml ).should == @results
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should flatten string numbers with spaces explode version correctly" do
|
25
|
+
@comp.colors = "10 , 20 , 30"
|
26
|
+
@comp.flatten( @xml ).should == @results
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should flatten single string explode version correctly" do
|
30
|
+
@comp.colors = 10
|
31
|
+
@comp.flatten( @xml ).should == "<series_color><color>10</color></series_color>"
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should flatten array explode version correctly" do
|
35
|
+
@comp.colors = %w[10 20 30]
|
36
|
+
@comp.flatten( @xml ).should == @results
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), %w[.. spec_helper]))
|
2
|
+
|
3
|
+
describe Ziya::Components::SeriesExplode do
|
4
|
+
before( :each ) do
|
5
|
+
@comp = Ziya::Components::SeriesExplode.new
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should define the correct attribute methods" do
|
9
|
+
lambda{ Ziya::Components::SeriesExplode.attributes[@comp.class.name].each {
|
10
|
+
|m| @comp.send( m ) } }.should_not raise_error
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#flatten" do
|
14
|
+
before( :each ) do
|
15
|
+
@xml = Builder::XmlMarkup.new
|
16
|
+
@results = "<series_explode><number>10</number><number>20</number><number>30</number></series_explode>"
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should flatten string explode version correctly" do
|
20
|
+
@comp.numbers = "10,20,30"
|
21
|
+
@comp.flatten( @xml ).should == @results
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should flatten string numbers with spaces explode version correctly" do
|
25
|
+
@comp.numbers = "10 , 20 , 30"
|
26
|
+
@comp.flatten( @xml ).should == @results
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should flatten single string explode version correctly" do
|
30
|
+
@comp.numbers = 10
|
31
|
+
@comp.flatten( @xml ).should == "<series_explode><number>10</number></series_explode>"
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should flatten array explode version correctly" do
|
35
|
+
@comp.numbers = %w[10 20 30]
|
36
|
+
@comp.flatten( @xml ).should == @results
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), %w[.. spec_helper]))
|
2
|
+
|
3
|
+
describe Ziya::Components::SeriesExplode do
|
4
|
+
before( :each ) do
|
5
|
+
@comp = Ziya::Components::SeriesExplode.new
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should define the correct attribute methods" do
|
9
|
+
lambda{ Ziya::Components::SeriesExplode.attributes[@comp.class.name].each {
|
10
|
+
|m| @comp.send( m ) } }.should_not raise_error
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#flatten" do
|
14
|
+
before( :each ) do
|
15
|
+
@xml = Builder::XmlMarkup.new
|
16
|
+
@results = "<series_explode><number>10</number><number>20</number><number>30</number></series_explode>"
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should flatten string explode version correctly" do
|
20
|
+
@comp.numbers = "10,20,30"
|
21
|
+
@comp.flatten( @xml ).should == @results
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should flatten string numbers with spaces explode version correctly" do
|
25
|
+
@comp.numbers = "10 , 20 , 30"
|
26
|
+
@comp.flatten( @xml ).should == @results
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should flatten single string explode version correctly" do
|
30
|
+
@comp.numbers = 10
|
31
|
+
@comp.flatten( @xml ).should == "<series_explode><number>10</number></series_explode>"
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should flatten array explode version correctly" do
|
35
|
+
@comp.numbers = %w[10 20 30]
|
36
|
+
@comp.flatten( @xml ).should == @results
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<%= gauge :base %>
|
2
|
+
<%= dial :circle, :circle_2 %>
|
3
|
+
x: 200
|
4
|
+
y: 75
|
5
|
+
radius: 30
|
6
|
+
start: 0
|
7
|
+
end: 90
|
8
|
+
|
9
|
+
<%= dial :circle, :circle_1 %>
|
10
|
+
x: 200
|
11
|
+
y: 75
|
12
|
+
radius: 30
|
13
|
+
fill_alpha: 0
|
14
|
+
line_thickness: 5
|
15
|
+
|
16
|
+
<%= dial :radial_ticks, :ticks %>
|
17
|
+
x: 200
|
18
|
+
y: 75
|
19
|
+
radius: 27
|
20
|
+
length: 10
|
21
|
+
start_angle: 0
|
22
|
+
end_angle: 90
|
23
|
+
ticks: 10
|
24
|
+
thickness: 2
|
25
|
+
color: 555555
|
26
|
+
|
27
|
+
<%= dial :rotate, :rotation %>
|
28
|
+
x: 200
|
29
|
+
y: 75
|
30
|
+
start: 230
|
31
|
+
span: 160
|
32
|
+
step: 5
|
33
|
+
shadow_alpha: 20
|
34
|
+
shadow_x_offset: 3
|
35
|
+
shadow_y_offset: 3
|
36
|
+
<%= dials %>
|
37
|
+
<%= dial :line, :line %>
|
38
|
+
x1: 200
|
39
|
+
y1: 45
|
40
|
+
x2: 200
|
41
|
+
y2: 52
|
42
|
+
color: ff3300
|
43
|
+
thickness: 4
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<%= gauge :base %>
|
2
|
+
<%= dial :circle %>
|
3
|
+
x: 200
|
4
|
+
y: 75
|
5
|
+
radius: 30
|
6
|
+
start: 0
|
7
|
+
end: 90
|
8
|
+
|
9
|
+
<%= dial :circle %>
|
10
|
+
x: 200
|
11
|
+
y: 75
|
12
|
+
radius: 30
|
13
|
+
fill_alpha: 0
|
14
|
+
line_thickness: 5
|
15
|
+
|
16
|
+
<%= dial :radial_ticks %>
|
17
|
+
x: 200
|
18
|
+
y: 75
|
19
|
+
radius: 27
|
20
|
+
length: 10
|
21
|
+
start_angle: 0
|
22
|
+
end_angle: 90
|
23
|
+
ticks: 10
|
24
|
+
thickness: 2
|
25
|
+
color: 555555
|
26
|
+
|
27
|
+
<%= dial :rotate %>
|
28
|
+
x: 200
|
29
|
+
y: 75
|
30
|
+
start: 230
|
31
|
+
span: 160
|
32
|
+
step: 5
|
33
|
+
shadow_alpha: 20
|
34
|
+
shadow_x_offset: 3
|
35
|
+
shadow_y_offset: 3
|
36
|
+
<%= dials %>
|
37
|
+
<%= dial :line %>
|
38
|
+
x1: 200
|
39
|
+
y1: 45
|
40
|
+
x2: 200
|
41
|
+
y2: 52
|
42
|
+
color: ff3300
|
43
|
+
thickness: 4
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# -----------------------------------------------------------------------------
|
2
|
+
# Thermometer design ( Override )
|
3
|
+
# -----------------------------------------------------------------------------
|
4
|
+
<%= gauge :thermo %>
|
5
|
+
# -----------------------------------------------------------------------------
|
6
|
+
# Thermo tube
|
7
|
+
<%= dial :rect, :thermo_tube %>
|
8
|
+
x: 999
|
9
|
+
y: 999
|
10
|
+
height: 150
|
11
|
+
width: 40
|
12
|
+
fill_color: 880000
|
13
|
+
line_thickness: 8
|