derailed-ziya 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. data/History.txt +0 -0
  2. data/Manifest.txt +405 -0
  3. data/README.txt +232 -0
  4. data/Rakefile +44 -0
  5. data/bin/ziyafy +53 -0
  6. data/charts/AC_RunActiveContent.js +292 -0
  7. data/charts/charts.swf +0 -0
  8. data/charts/charts_library/ar3d.swf +0 -0
  9. data/charts/charts_library/arno.swf +0 -0
  10. data/charts/charts_library/ars3.swf +0 -0
  11. data/charts/charts_library/arst.swf +0 -0
  12. data/charts/charts_library/brfl.swf +0 -0
  13. data/charts/charts_library/brno.swf +0 -0
  14. data/charts/charts_library/brst.swf +0 -0
  15. data/charts/charts_library/buno.swf +0 -0
  16. data/charts/charts_library/cl3d.swf +0 -0
  17. data/charts/charts_library/clfl.swf +0 -0
  18. data/charts/charts_library/clno.swf +0 -0
  19. data/charts/charts_library/clp3.swf +0 -0
  20. data/charts/charts_library/cls3.swf +0 -0
  21. data/charts/charts_library/clst.swf +0 -0
  22. data/charts/charts_library/cnno.swf +0 -0
  23. data/charts/charts_library/dono.swf +0 -0
  24. data/charts/charts_library/lnno.swf +0 -0
  25. data/charts/charts_library/mxno.swf +0 -0
  26. data/charts/charts_library/pi3d.swf +0 -0
  27. data/charts/charts_library/pino.swf +0 -0
  28. data/charts/charts_library/pono.swf +0 -0
  29. data/charts/charts_library/scno.swf +0 -0
  30. data/charts/full_screen.swf +0 -0
  31. data/charts/scripts/output_jpg.php +23 -0
  32. data/charts/sliders/black.swf +0 -0
  33. data/charts/sliders/preview_handle_1.swf +0 -0
  34. data/charts/sliders/preview_handle_2.swf +0 -0
  35. data/gauges/designs/circle.yml +18 -0
  36. data/gauges/designs/signal.yml +14 -0
  37. data/gauges/designs/thermo.yml +119 -0
  38. data/gauges/designs/title.yml +11 -0
  39. data/gauges/gauge.swf +0 -0
  40. data/lib/ziya/charts/area.rb +18 -0
  41. data/lib/ziya/charts/area_threed.rb +16 -0
  42. data/lib/ziya/charts/bar.rb +16 -0
  43. data/lib/ziya/charts/base.rb +510 -0
  44. data/lib/ziya/charts/bubble.rb +18 -0
  45. data/lib/ziya/charts/candle_stick.rb +16 -0
  46. data/lib/ziya/charts/column.rb +16 -0
  47. data/lib/ziya/charts/column_threed.rb +16 -0
  48. data/lib/ziya/charts/donut.rb +18 -0
  49. data/lib/ziya/charts/floating_bar.rb +16 -0
  50. data/lib/ziya/charts/floating_column.rb +16 -0
  51. data/lib/ziya/charts/line.rb +16 -0
  52. data/lib/ziya/charts/mixed.rb +16 -0
  53. data/lib/ziya/charts/parallel_threed_column.rb +16 -0
  54. data/lib/ziya/charts/pie.rb +16 -0
  55. data/lib/ziya/charts/pie_threed.rb +16 -0
  56. data/lib/ziya/charts/polar.rb +16 -0
  57. data/lib/ziya/charts/scatter.rb +16 -0
  58. data/lib/ziya/charts/stacked_area.rb +16 -0
  59. data/lib/ziya/charts/stacked_bar.rb +16 -0
  60. data/lib/ziya/charts/stacked_column.rb +16 -0
  61. data/lib/ziya/charts/stacked_threed_area.rb +16 -0
  62. data/lib/ziya/charts/stacked_threed_column.rb +16 -0
  63. data/lib/ziya/components/area.rb +17 -0
  64. data/lib/ziya/components/axis_category.rb +17 -0
  65. data/lib/ziya/components/axis_ticks.rb +35 -0
  66. data/lib/ziya/components/axis_value.rb +16 -0
  67. data/lib/ziya/components/base.rb +142 -0
  68. data/lib/ziya/components/bevel.rb +15 -0
  69. data/lib/ziya/components/blur.rb +13 -0
  70. data/lib/ziya/components/chart_border.rb +14 -0
  71. data/lib/ziya/components/chart_grid_h.rb +26 -0
  72. data/lib/ziya/components/chart_grid_v.rb +27 -0
  73. data/lib/ziya/components/chart_guide.rb +16 -0
  74. data/lib/ziya/components/chart_label.rb +16 -0
  75. data/lib/ziya/components/chart_pref.rb +22 -0
  76. data/lib/ziya/components/chart_rect.rb +37 -0
  77. data/lib/ziya/components/chart_transition.rb +25 -0
  78. data/lib/ziya/components/circle.rb +16 -0
  79. data/lib/ziya/components/context_menu.rb +15 -0
  80. data/lib/ziya/components/draw.rb +47 -0
  81. data/lib/ziya/components/draw_base.rb +10 -0
  82. data/lib/ziya/components/filter.rb +26 -0
  83. data/lib/ziya/components/glow.rb +14 -0
  84. data/lib/ziya/components/image.rb +17 -0
  85. data/lib/ziya/components/legend.rb +18 -0
  86. data/lib/ziya/components/line.rb +16 -0
  87. data/lib/ziya/components/link.rb +29 -0
  88. data/lib/ziya/components/link_data.rb +18 -0
  89. data/lib/ziya/components/rect.rb +18 -0
  90. data/lib/ziya/components/scroll.rb +26 -0
  91. data/lib/ziya/components/series.rb +16 -0
  92. data/lib/ziya/components/series_color.rb +35 -0
  93. data/lib/ziya/components/series_explode.rb +38 -0
  94. data/lib/ziya/components/shadow.rb +14 -0
  95. data/lib/ziya/components/text.rb +17 -0
  96. data/lib/ziya/components/update.rb +19 -0
  97. data/lib/ziya/gauges/base.rb +172 -0
  98. data/lib/ziya/gauges/radial.rb +18 -0
  99. data/lib/ziya/gauges/signal.rb +138 -0
  100. data/lib/ziya/gauges/support/area.rb +13 -0
  101. data/lib/ziya/gauges/support/base.rb +33 -0
  102. data/lib/ziya/gauges/support/circle.rb +14 -0
  103. data/lib/ziya/gauges/support/design.rb +5 -0
  104. data/lib/ziya/gauges/support/image.rb +12 -0
  105. data/lib/ziya/gauges/support/line.rb +12 -0
  106. data/lib/ziya/gauges/support/link.rb +24 -0
  107. data/lib/ziya/gauges/support/move.rb +15 -0
  108. data/lib/ziya/gauges/support/point.rb +12 -0
  109. data/lib/ziya/gauges/support/polygon.rb +13 -0
  110. data/lib/ziya/gauges/support/radial_base.rb +21 -0
  111. data/lib/ziya/gauges/support/radial_numbers.rb +41 -0
  112. data/lib/ziya/gauges/support/radial_ticks.rb +29 -0
  113. data/lib/ziya/gauges/support/rect.rb +14 -0
  114. data/lib/ziya/gauges/support/rotate.rb +15 -0
  115. data/lib/ziya/gauges/support/scale.rb +15 -0
  116. data/lib/ziya/gauges/support/text.rb +21 -0
  117. data/lib/ziya/gauges/support/update.rb +12 -0
  118. data/lib/ziya/gauges/thermo.rb +121 -0
  119. data/lib/ziya/helpers/base_helper.rb +70 -0
  120. data/lib/ziya/utils/logger.rb +125 -0
  121. data/lib/ziya/utils/text.rb +39 -0
  122. data/lib/ziya/version.rb +15 -0
  123. data/lib/ziya/ziya_helper.rb +374 -0
  124. data/lib/ziya.rb +112 -0
  125. data/spec/charts/base_spec.rb +134 -0
  126. data/spec/charts/chart_type_spec.rb +63 -0
  127. data/spec/components/area_spec.rb +67 -0
  128. data/spec/components/draw_spec.rb +32 -0
  129. data/spec/components/filter_spec.rb +27 -0
  130. data/spec/components/link_spec.rb +22 -0
  131. data/spec/components/series.rb +18 -0
  132. data/spec/components/series_color_spec.rb +39 -0
  133. data/spec/components/series_explode.rb +39 -0
  134. data/spec/components/series_explode_spec.rb +39 -0
  135. data/spec/designs/circle.yml +7 -0
  136. data/spec/designs/crapping_out.yml +8 -0
  137. data/spec/designs/gauge_1.yml +43 -0
  138. data/spec/designs/gauge_2.yml +11 -0
  139. data/spec/designs/gauge_no_name.yml +43 -0
  140. data/spec/designs/gauge_raw.yml +5 -0
  141. data/spec/designs/thermo.yml +13 -0
  142. data/spec/gauges/base_spec.rb +90 -0
  143. data/spec/gauges/signal_spec.rb +36 -0
  144. data/spec/gauges/support/area_spec.rb +40 -0
  145. data/spec/gauges/support/circle_spec.rb +78 -0
  146. data/spec/gauges/support/image_spec.rb +35 -0
  147. data/spec/gauges/support/line_spec.rb +34 -0
  148. data/spec/gauges/support/link_spec.rb +35 -0
  149. data/spec/gauges/support/move_spec.rb +45 -0
  150. data/spec/gauges/support/polygon_spec.rb +36 -0
  151. data/spec/gauges/support/radial_numbers_spec.rb +35 -0
  152. data/spec/gauges/support/radial_ticks_spec.rb +30 -0
  153. data/spec/gauges/support/rotate_spec.rb +45 -0
  154. data/spec/gauges/support/scale_spec.rb +46 -0
  155. data/spec/gauges/support/text_spec.rb +40 -0
  156. data/spec/gauges/thermo_spec.rb +49 -0
  157. data/spec/helpers/base_helper_spec.rb +36 -0
  158. data/spec/spec_helper.rb +10 -0
  159. data/spec/test_helpers/gauge_2_helper.rb +17 -0
  160. data/spec/themes/default/fred.yml +6 -0
  161. data/spec/themes/default/line_chart.yml +6 -0
  162. data/spec/utils/logger_spec.rb +55 -0
  163. data/spec/utils/text_spec.rb +33 -0
  164. data/spec/ziya_helper_spec.rb +117 -0
  165. data/spec/ziya_spec.rb +19 -0
  166. data/tasks/ann.rake +76 -0
  167. data/tasks/annotations.rake +22 -0
  168. data/tasks/doc.rake +48 -0
  169. data/tasks/gem.rake +110 -0
  170. data/tasks/manifest.rake +49 -0
  171. data/tasks/post_load.rake +26 -0
  172. data/tasks/rubyforge.rake +57 -0
  173. data/tasks/setup.rb +227 -0
  174. data/tasks/spec.rake +61 -0
  175. data/tasks/svn.rake +44 -0
  176. data/tasks/test.rake +38 -0
  177. 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&amp;xml_source=%2Ffred\"/><image url=\"/charts/charts.swf?library_path=/charts/charts_library&amp;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,7 @@
1
+ <%= gauge :base %>
2
+ <%= dial :circle, :circle_1 %>
3
+ x: 999
4
+ y: 999
5
+ radius: 30
6
+ fill_alpha: 0
7
+ line_thickness: 5
@@ -0,0 +1,8 @@
1
+ <%= gauge :base %>
2
+
3
+ <%= dial :circle, :circle_1 %>
4
+ x: 999
5
+ y: 999
6
+ radius: 30
7
+ fill_alpha: 0
8
+ line_thickness: 5
@@ -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,11 @@
1
+ <%= gauge :base %>
2
+ <%= dial :circle, :circle %>
3
+ x: 200
4
+ y: 75
5
+ radius: 30
6
+ fill_alpha: 0
7
+ fill_color: <%= colorize %>
8
+ line_thickness: 5
9
+
10
+ # call up to helper to draw another circle
11
+ <%= make_circle( 10, 10, 200 ) %>
@@ -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,5 @@
1
+ --- !ruby/object:Ziya::Gauges::Base
2
+ components: !omap
3
+ - :circle_1: !ruby/object:Ziya::Gauges::Support::Circle
4
+ x: 200
5
+ y: 100
@@ -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