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,16 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Generates necessary xml for pie chart
3
+ #
4
+ # Author: Fernand
5
+ # -----------------------------------------------------------------------------
6
+ module Ziya::Charts
7
+ class Pie < Base
8
+ # Creates a pie chart
9
+ # <tt>:license</tt>:: the XML/SWF charts license
10
+ # <tt>:chart_id</tt>:: the name of the chart style sheet.
11
+ def initialize( license=nil, chart_id=nil )
12
+ super( license, chart_id )
13
+ @type = "pie"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Generates necessary xml for 3D pie chart
3
+ #
4
+ # Author: Fernand
5
+ # -----------------------------------------------------------------------------
6
+ module Ziya::Charts
7
+ class PieThreed < Base
8
+ # Creates a 3D pie chart
9
+ # <tt>:license</tt>:: the XML/SWF charts license
10
+ # <tt>:chart_id</tt>:: the name of the chart style sheet.
11
+ def initialize( license=nil, chart_id=nil )
12
+ super( license, chart_id )
13
+ @type = "3d pie"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Generates necessary xml for polar chart
3
+ #
4
+ # Author: Fernand
5
+ # -----------------------------------------------------------------------------
6
+ module Ziya::Charts
7
+ class Polar < Base
8
+ # Creates a polar chart
9
+ # <tt>:license</tt>:: the XML/SWF charts license
10
+ # <tt>:chart_id</tt>:: the name of the chart style sheet.
11
+ def initialize( license=nil, chart_id=nil)
12
+ super( license, chart_id )
13
+ @type = "polar"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Generates necessary xml for scatter chart
3
+ #
4
+ # Author: Fernand
5
+ # -----------------------------------------------------------------------------
6
+ module Ziya::Charts
7
+ class Scatter < Base
8
+ # Creates a scatter chart
9
+ # <tt>:license</tt>:: the XML/SWF charts license
10
+ # <tt>:chart_id</tt>:: the name of the chart style sheet.
11
+ def initialize( license=nil, chart_id=nil )
12
+ super( license, chart_id )
13
+ @type = "scatter"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Generates necessary xml for stacked area chart
3
+ #
4
+ # Author: Fernand
5
+ # -----------------------------------------------------------------------------
6
+ module Ziya::Charts
7
+ class StackedArea < Base
8
+ # Creates a stacked area chart
9
+ # <tt>:license</tt>:: the XML/SWF charts license
10
+ # <tt>:chart_id</tt>:: the name of the chart style sheet.
11
+ def initialize( license=nil, chart_id=nil)
12
+ super( license, chart_id )
13
+ @type = "stacked area"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Generates necessary xml for a stacked bar chart
3
+ #
4
+ # Author: Fernand
5
+ # -----------------------------------------------------------------------------
6
+ module Ziya::Charts
7
+ class StackedBar < Base
8
+ # Creates a stacked bar chart
9
+ # <tt>:license</tt>:: the XML/SWF charts license
10
+ # <tt>:chart_id</tt>:: the name of the chart style sheet.
11
+ def initialize( license=nil, chart_id=nil)
12
+ super( license, chart_id )
13
+ @type = "stacked bar"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Generates necessary xml for a stacked column chart
3
+ #
4
+ # Author: Fernand
5
+ # -----------------------------------------------------------------------------
6
+ module Ziya::Charts
7
+ class StackedColumn < Base
8
+ # Creates a stacked column chart
9
+ # <tt>:license</tt>:: the XML/SWF charts license
10
+ # <tt>:chart_id</tt>:: the name of the chart style sheet.
11
+ def initialize( license=nil, chart_id=nil )
12
+ super( license, chart_id )
13
+ @type = "stacked column"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Generates necessary xml for a stacked 3d area chart
3
+ #
4
+ # Author: Fernand
5
+ # -----------------------------------------------------------------------------
6
+ module Ziya::Charts
7
+ class StackedThreedArea < Base
8
+ # Creates a stacked 3d area chart
9
+ # <tt>:license</tt>:: the XML/SWF charts license
10
+ # <tt>:chart_id</tt>:: the name of the chart style sheet.
11
+ def initialize( license=nil, chart_id=nil )
12
+ super( license, chart_id )
13
+ @type = "3d area"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Generates necessary xml for a stacked 3d column chart
3
+ #
4
+ # Author: Fernand
5
+ # -----------------------------------------------------------------------------
6
+ module Ziya::Charts
7
+ class StackedThreedColumn < Base
8
+ # Creates a stacked 3d column chart
9
+ # <tt>:license</tt>:: the XML/SWF charts license
10
+ # <tt>:chart_id</tt>:: the name of the chart style sheet.
11
+ def initialize( license=nil, chart_id=nil )
12
+ super( license, chart_id )
13
+ @type = "stacked 3d column"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,17 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Defines an area on a chart. Typically used to embed links and buttons
3
+ #
4
+ # Author:: Fernand Galiana
5
+ # -----------------------------------------------------------------------------
6
+ require 'ziya/components/base'
7
+
8
+ module Ziya::Components
9
+ # Creates a linkable area on the chart to use with the link component.
10
+ # See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=link
11
+ # for additional documentation, examples and futher detail.
12
+ class Area < Base
13
+ has_attribute :x, :y, :width, :height, :url, :priority, :target, :text,
14
+ :font, :bold, :size, :color, :background_color, :alpha,
15
+ :timeout, :retry, :spinning_wheel
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Sets the label attributes for the category-axis.
3
+ #
4
+ # Author:: Fernand
5
+ # -----------------------------------------------------------------------------
6
+ module Ziya::Components
7
+ # Specifies the label attributes on the x or y axis depending on the chart type.
8
+ # See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=axis_category
9
+ # for additional documentation, examples and futher detail.
10
+ class AxisCategory < Base
11
+ has_attribute :skip, :font, :bold, :size, :color, :alpha, :orientation,
12
+ :margin,
13
+ :min, :max, :steps, :mode, :prefix, :suffix, :decimals,
14
+ :decimal_char, :separator,
15
+ :bevel, :glow, :shadow, :blur
16
+ end
17
+ end
@@ -0,0 +1,35 @@
1
+ # ------------------------------------------------------------------------------
2
+ # Describe the ticks configuration of the chart axis
3
+ #
4
+ # Author:: Fernand
5
+ # ------------------------------------------------------------------------------
6
+ module Ziya::Components
7
+ # Sets the tick marks on the chart axes.
8
+ #
9
+ # <tt>value_ticks</tt>: A boolean value that indicates whether the ticks on the value axis are visible or not.
10
+ # The default is false.
11
+ # <tt>category_ticks</tt>: A boolean value that indicates whether the ticks on the category axis are visible or not.
12
+ # The default is true.
13
+ # <tt>position</tt>: A string that determines where on the axis to display the ticks. Valid values are "outside",
14
+ # "inside", and "centered".
15
+ # The default is "outside".
16
+ # <tt>major_thickness</tt>: The thickness of major ticks. Major ticks are those appearing with the axis labels.
17
+ # The default is 2 pixels.
18
+ # <tt>major_color</tt>: The color of major ticks. This must be a string holding triple hexadecimal values representing
19
+ # the red, green, and blue components for a color.
20
+ # The default is "000000" (black).
21
+ # <tt>minor_thickness</tt>: The thickness of minor ticks. Minor ticks are those appearing between major ticks.
22
+ # The default is 1 pixel.
23
+ # <tt>minor_color</tt>: The color of minor ticks. This must be a string holding triple hexadecimal values representing
24
+ # the red, green, and blue components for a color.
25
+ # The default is "000000" (black).
26
+ # <tt>minor_count</tt>: This applies to the value axis only. It sets the number of minor ticks between every 2 major ticks.
27
+ # The default is 4. The category axis displays minor ticks only where its labels get skipped.
28
+ #
29
+ # See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=axis_ticks
30
+ # for additional documentation, examples and futher detail.
31
+ class AxisTicks < Base
32
+ has_attribute :value_ticks, :category_ticks, :position, :major_thickness,
33
+ :major_color, :minor_thickness, :minor_color, :minor_count
34
+ end
35
+ end
@@ -0,0 +1,16 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Setup configuration on the chart value axis
3
+ #
4
+ # Author:: Fernand Galiana
5
+ # -----------------------------------------------------------------------------
6
+ module Ziya::Components
7
+ # Specifies the label attribute on the x or y axis depending on the chart type.
8
+ # See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=axis_value
9
+ # for additional documentation, examples and futher detail.
10
+ class AxisValue < Base
11
+ has_attribute :min, :max, :steps, :prefix, :suffix, :decimals,
12
+ :decimal_char, :separator, :show_min, :font, :bold,
13
+ :size, :color, :background_color, :alpha, :orientation,
14
+ :shadow, :bevel, :glow, :blur
15
+ end
16
+ end
@@ -0,0 +1,142 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Abstract class representing the base class for all chart preferences
3
+ # TODO Not getting parents inherited properties if defined as defaults
4
+ #
5
+ # TODO: Change attributes to be per class instance
6
+ #
7
+ # Author:: Fernand Galiana
8
+ # Date:: Dec 15th, 2006
9
+ # -----------------------------------------------------------------------------
10
+ module Ziya::Components
11
+ class Base # :nodoc:
12
+ include Ziya::Utils::Text
13
+
14
+ # class methods...
15
+ class << self
16
+ # -----------------------------------------------------------------------
17
+ # defines attribute accessors for a given component
18
+ def has_attribute(*args) # :nodoc:
19
+ class_name = self.to_s
20
+ args.each do |attribute|
21
+ # add the attribute to the collection making sure to create a new array if one doesn't exist
22
+ attributes[class_name] = [] if attributes[class_name].nil?
23
+ attributes[class_name] << attribute
24
+ # create the accessor methods for the attribute
25
+ unless self.instance_methods.include?(attribute.to_s) && self.instance_methods.include?("#{attribute.to_s}=")
26
+ self.module_eval "attr_accessor :#{attribute}"
27
+ end
28
+ end
29
+ end
30
+
31
+ # -----------------------------------------------------------------------
32
+ # Class accessor. Retrieve class level preferences
33
+ def attributes # :nodoc:
34
+ @attributes ||= {}
35
+ end
36
+ end
37
+
38
+ # -------------------------------------------------------------------------
39
+ # initializes component from hash
40
+ def initialize( opts={} )
41
+ opts.each_pair do |k,v|
42
+ self.send( "#{k}=", v )
43
+ end
44
+ end
45
+
46
+ def ==( other )
47
+ self.options.each_pair do |k,v|
48
+ return false unless other.send( k ) == v
49
+ end
50
+ end
51
+
52
+ # -------------------------------------------------------------------------
53
+ # merge attributes with overriden component
54
+ def merge( parent_attributes, force=false )
55
+ attributes_for(self).each do |attr|
56
+ unless parent_attributes.send(attr).nil?
57
+ send("#{attr}=", parent_attributes.send(attr))
58
+ end
59
+ end
60
+ end
61
+
62
+ def flatten( xml )
63
+ hash = has_sub_components
64
+ clazz = demodulize( self.class.name )
65
+ pref = underscore( clazz )
66
+ if hash and ! hash.empty?
67
+ self.class.module_eval <<-XML
68
+ xml.#{pref}( #{options_as_string} ) do
69
+ hash.each{ |k,v| v.flatten( xml ) }
70
+ end
71
+ XML
72
+ else
73
+ self.class.module_eval "xml.#{pref}( #{options_as_string} )"
74
+ end
75
+ end
76
+
77
+ # -------------------------------------------------------------------------
78
+ # handles simple flatten operation
79
+ # def method_missing(method, *args)
80
+ # case method
81
+ # when :flatten
82
+ # xml = args.first
83
+ # clazz = demodulize( self.class.name )
84
+ # pref = underscore( clazz )
85
+ # self.class.module_eval "xml.#{pref}( #{options_as_string} )"
86
+ # else
87
+ # super.method_missing(method, *args)
88
+ # end
89
+ # end
90
+
91
+ # -------------------------------------------------------------------------
92
+ # checks if a give component properties have been set.
93
+ # return true if one or more props have been set. False otherwise...
94
+ def configured?
95
+ !options.empty?
96
+ end
97
+
98
+ # -------------------------------------------------------------------------
99
+ # Checks if one of the options is an array
100
+ def has_sub_components
101
+ options.each_pair do |k, v|
102
+ return v if v.is_a? YAML::Omap
103
+ end
104
+ nil
105
+ end
106
+
107
+ # -------------------------------------------------------------------------
108
+ # calls all attribute methods and gather the various props into a hash
109
+ def options
110
+ options = {}
111
+ attributes_for(self).each do |p|
112
+ option = self.send(p.to_sym)
113
+ options[p] = option unless option.nil?
114
+ end
115
+ options
116
+ end
117
+
118
+ # -------------------------------------------------------------------------
119
+ # Turns options hash into string representation
120
+ def options_as_string
121
+ buff = []
122
+ opts = options
123
+ opts.keys.sort{ |a,b| a.to_s <=> b.to_s }.each do |k|
124
+ value = opts[k]
125
+ buff << sprintf( ":%s => '%s'", k, value.to_s ) if !value.nil? and !value.is_a? YAML::Omap
126
+ end
127
+ buff.join( "," )
128
+ end
129
+
130
+ # -------------------------------------------------------------------------
131
+ # fetch attributes for a give component
132
+ def attributes_for( an_instance )
133
+ attrs = self.class.attributes[an_instance.class.name]
134
+ raise "Unable to get attributes for #{an_instance}" unless attrs
135
+ attrs
136
+ end
137
+
138
+ # =========================================================================
139
+ private
140
+
141
+ end
142
+ end
@@ -0,0 +1,15 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Create a bevel filter
3
+ #
4
+ # Author:: Fernand
5
+ # -----------------------------------------------------------------------------
6
+ module Ziya::Components
7
+ # Specifies the bevel filter to be applied to some component ie chart_rect, axis_value, etc...
8
+ # See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=filter
9
+ # for additional documentation, examples and futher detail.
10
+ class Bevel < Base
11
+ has_attribute :id, :distance, :angle, :highlightColor, :highlightAlpha,
12
+ :shadowColor, :shadowAlpha, :blurX, :blurY, :strength,
13
+ :quality, :type, :knockout
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Create a blur filter
3
+ #
4
+ # Author:: Fernand Galiana
5
+ # -----------------------------------------------------------------------------
6
+ module Ziya::Components
7
+ # Specifies the blur filter to be applied to some component ie chart_rect, axis_value, etc...
8
+ # See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=filter
9
+ # for additional documentation, examples and futher detail.
10
+ class Blur < Base
11
+ has_attribute :id, :blurX, :blurY, :quality
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Sets up chart border configuration
3
+ #
4
+ # Author:: Fernand
5
+ # -----------------------------------------------------------------------------
6
+ module Ziya::Components
7
+ # Specifies how to render a chart border
8
+ # See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=chart_border
9
+ # for additional documentation, examples and futher detail.
10
+ class ChartBorder < Base
11
+ has_attribute :top_thickness, :bottom_thickness, :left_thickness,
12
+ :right_thickness, :color
13
+ end
14
+ end
@@ -0,0 +1,26 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Sets up chart horizontal grid configuration
3
+ #
4
+ # Author:: Fernand
5
+ # -----------------------------------------------------------------------------
6
+ module Ziya::Components
7
+ # Sets the chart's horizontal grid attributes.
8
+ #
9
+ # <tt>thickness</tt>: The thickness of the grid's horizontal lines. Valid values are zero and above.
10
+ # Zero makes the horizontal lines invisible.
11
+ # The default is 1.
12
+ # <tt>color</tt>: The grid's horizontal color. This must be a string holding triple hexadecimal
13
+ # values representing the red, green, and blue components for a color.
14
+ # The default is "000000" (black).
15
+ # <tt>alpha</tt>: The grid's horizontal transparency value. Valid values are 0 (fully transparent)
16
+ # to 100 (fully opaque).
17
+ # The default is 20.
18
+ # <tt>type</tt>: The grid's horizontal line type. Valid values are solid, dotted, and dashed.
19
+ # The default is solid.
20
+ #
21
+ # See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=chart_grid_h
22
+ # for additional documentation, examples and futher detail.
23
+ class ChartGridH < Base
24
+ has_attribute :thickness, :color, :alpha, :type
25
+ end
26
+ end
@@ -0,0 +1,27 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Sets up chart vertical grid configuration
3
+ #
4
+ # Author:: Fernand
5
+ # -----------------------------------------------------------------------------
6
+ module Ziya::Components
7
+ # Sets the chart's vertical grid attributes.
8
+ #
9
+ # <tt>thickness</tt>: The thickness of the grid's vertical lines. Valid values are zero and above.
10
+ # Zero makes the vertical lines invisible.
11
+ # The default is zero.
12
+ # <tt>color</tt>: The grid's vertical color. This must be a string holding triple hexadecimal values
13
+ # representing the red, green, and blue components for a color.
14
+ # The default is "000000" (black).
15
+ # <tt>alpha</tt>: The grid's vertical transparency value. Valid values are 0 (fully transparent)
16
+ # to 100 (fully opaque).
17
+ # The default is 20.
18
+ # <tt>type</tt>: The grid's vertical line type. Valid values are solid, dotted, and dashed.
19
+ # The default is solid.
20
+ #
21
+ # See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=chart_grid_v
22
+ # for additional documentation, examples and futher detail.
23
+ #
24
+ class ChartGridV < Base
25
+ has_attribute :thickness, :color, :alpha, :type
26
+ end
27
+ end
@@ -0,0 +1,16 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Sets up a guide lines configuration for a chart
3
+ #
4
+ # Author:: Fernand Galiana
5
+ # -----------------------------------------------------------------------------
6
+ module Ziya::Components
7
+ # Specifies how to configure a guide for either axis on a chart
8
+ # See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=chart_guide
9
+ # for additional documentation, examples and futher detail.
10
+ class ChartGuide < Base
11
+ has_attribute :horizontal, :vertical, :thickness, :color, :alpha, :type,
12
+ :snap_h, :snap_v, :radius, :fill_color, :line_color, :line_alpha, :line_thickness,
13
+ :text_h_alpha, :text_v_alpha, :prefix_h, :prefix_v, :suffix_h, :suffix_v,
14
+ :decimals, :decimal_char, :separator, :font, :bold, :size, :text_color, :background_color
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Sets up chart labels configuration. These are the labels on top on the chart.
3
+ #
4
+ # Author:: Fernand Galiana
5
+ # -----------------------------------------------------------------------------
6
+ module Ziya::Components
7
+ # Specifies the label for the chart element actual value. This can be setup to
8
+ # be fixed or as a tooltip
9
+ # See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=chart_label
10
+ # for additional documentation, examples and futher detail.
11
+ class ChartLabel < Base
12
+ has_attribute :prefix, :suffix, :decimals, :decimal_char, :separator, :position,
13
+ :hide_zero, :as_percentage, :font, :bold, :size, :color,
14
+ :background_color, :alpha, :shadow, :bevel, :glow, :blur
15
+ end
16
+ end
@@ -0,0 +1,22 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Sets up various preferences available on a given chart type
3
+ #
4
+ # Author:: Fernand Galiana
5
+ # -----------------------------------------------------------------------------
6
+ module Ziya::Components
7
+ # Sets the preferences for some chart types. Each chart type has different preferences,
8
+ # or no preferences at all.
9
+ #
10
+ # <tt></tt>:
11
+ #
12
+ # See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=chart_pref
13
+ # for additional documentation, examples and futher detail.
14
+ #
15
+ class ChartPref < Base
16
+ has_attribute :line_thickness, :point_shape, :point_size, :fill_shape,
17
+ :type, :bull_color, :bear_color,
18
+ :reverse, :drag, :min_x, :min_y, :max_x, :max_y,
19
+ :trend_thickness, :trend_alpha, :line_alpha, :rotation_x,
20
+ :rotation_y, :grid, :select, :empty_center
21
+ end
22
+ end
@@ -0,0 +1,37 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Sets up the content area the chart occupies
3
+ #
4
+ # Author:: Fernand Galiana
5
+ # -----------------------------------------------------------------------------
6
+ module Ziya::Components
7
+ # Sets the chart's rectangle
8
+ #
9
+ # <tt>x</tt>: The horizontal position of the rectangle's upper left corner relative to the upper
10
+ # left corner of the canvas (0, 0).
11
+ # <tt>y</tt>: The vertical position of the rectangle's upper left corner relative to the upper
12
+ # left corner of the canvas (0, 0).
13
+ # <tt>width</tt>: The rectangle's width.
14
+ # <tt>height</tt>: The rectangle's height.
15
+ # <tt>positive_color</tt>: The chart's background color above the zero line. This must be a string holding triple
16
+ # hexadecimal values representing the red, green, and blue components for a color.
17
+ # The default is "FFFFFF" (white).
18
+ # <tt>negative_color</tt>: The chart's background color below the zero line. This must be a string holding triple
19
+ # hexadecimal values representing the red, green, and blue components for a color.
20
+ # The default is "000000" (black).
21
+ # <tt>positive_alpha</tt>: The transparency value of the background color above the zero line. Valid values are 0
22
+ # (fully transparent) to 100 (fully opaque).
23
+ # The default is 75.
24
+ # <tt>negative_alpha</tt>: The transparency value of the background color below the zero line. Valid values are 0
25
+ # (fully transparent) to 100 (fully opaque).
26
+ # The default is 20.
27
+ #
28
+ # See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=chart_rect
29
+ # for additional documentation, examples and futher detail.
30
+ #
31
+ class ChartRect < Base
32
+ has_attribute :x, :y, :width, :height, :positive_color, :negative_color,
33
+ :positive_alpha, :negative_alpha,
34
+ :shadow, :bevel, :blur, :glow,
35
+ :corner_tl, :corner_tr, :corner_bl, :corner_br
36
+ end
37
+ end
@@ -0,0 +1,25 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Sets up a transition when the chart first renders
3
+ #
4
+ # Author:: Fernand Galiana
5
+ # -----------------------------------------------------------------------------
6
+ module Ziya::Components
7
+ # Sets the transition attributes for the chart elements.
8
+ #
9
+ # <tt>type</tt>: The type of the transition. Valid values are dissolve, drop, spin, scale, zoom,
10
+ # blink, slide_right, slide_left, slide_up, slide_down, and none.
11
+ # The default is none, which draws the chart immediately without a transition.
12
+ # <tt>delay</tt>: The delay in seconds before starting the transition.
13
+ # The default is zero.
14
+ # <tt>duration</tt>: The transition's duration in seconds.
15
+ # The default is 1.
16
+ # <tt>order</tt>: The order in which to transition the chart's parts. Valid values are series,
17
+ # category, and all.
18
+ # The default is all.
19
+ #
20
+ # See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=chart_transition
21
+ # for additional documentation, examples and futher detail.
22
+ class ChartTransition < Base
23
+ has_attribute :type, :delay, :duration, :order
24
+ end
25
+ end
@@ -0,0 +1,16 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Draws a circle
3
+ #
4
+ # Author:: Fernand Galiana
5
+ # -----------------------------------------------------------------------------
6
+ module Ziya::Components
7
+ # Circle component to draw a circle on the chart. Must be set up within the draw
8
+ # component.
9
+ # See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=draw
10
+ # for additional documentation, examples and futher detail.
11
+ class Circle < Base
12
+ has_attribute :layer, :transition, :delay, :duration, :x, :y, :radius,
13
+ :fill_color, :fill_alpha, :line_color, :line_alpha,
14
+ :line_thickness, :shadow, :bevel, :glow, :blur
15
+ end
16
+ end
@@ -0,0 +1,15 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Defines an area on a chart. Typically used to embed links and buttons
3
+ #
4
+ # Author:: Fernand Galiana
5
+ # -----------------------------------------------------------------------------
6
+ require 'ziya/components/base'
7
+
8
+ module Ziya::Components
9
+ # Refines the default context menu by adding or removing default options
10
+ # See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=context_menu
11
+ # for additional documentation, examples and futher detail.
12
+ class ContextMenu < Base
13
+ has_attribute :about, :print, :full_screen, :quality, :jpeg_url
14
+ end
15
+ end