derailed-ziya 2.0.8 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (263) hide show
  1. data/Manifest.txt +240 -432
  2. data/README.txt +104 -97
  3. data/Rakefile +3 -2
  4. data/bin/ziyafy +33 -10
  5. data/examples/charts/basic_chart.rb +47 -0
  6. data/{charts → examples/charts/public/charts}/AC_RunActiveContent.js +0 -0
  7. data/{charts → examples/charts/public/charts}/charts.swf +0 -0
  8. data/{charts → examples/charts/public/charts}/charts_library/ar3d.swf +0 -0
  9. data/{charts → examples/charts/public/charts}/charts_library/arno.swf +0 -0
  10. data/{charts → examples/charts/public/charts}/charts_library/ars3.swf +0 -0
  11. data/{charts → examples/charts/public/charts}/charts_library/arst.swf +0 -0
  12. data/{charts → examples/charts/public/charts}/charts_library/brfl.swf +0 -0
  13. data/{charts → examples/charts/public/charts}/charts_library/brno.swf +0 -0
  14. data/{charts → examples/charts/public/charts}/charts_library/brst.swf +0 -0
  15. data/{charts → examples/charts/public/charts}/charts_library/buno.swf +0 -0
  16. data/{charts → examples/charts/public/charts}/charts_library/cl3d.swf +0 -0
  17. data/{charts → examples/charts/public/charts}/charts_library/clfl.swf +0 -0
  18. data/{charts → examples/charts/public/charts}/charts_library/clim.swf +0 -0
  19. data/{charts → examples/charts/public/charts}/charts_library/clno.swf +0 -0
  20. data/{charts → examples/charts/public/charts}/charts_library/clp3.swf +0 -0
  21. data/{charts → examples/charts/public/charts}/charts_library/cls3.swf +0 -0
  22. data/{charts → examples/charts/public/charts}/charts_library/clst.swf +0 -0
  23. data/{charts → examples/charts/public/charts}/charts_library/cnno.swf +0 -0
  24. data/{charts → examples/charts/public/charts}/charts_library/dono.swf +0 -0
  25. data/{charts → examples/charts/public/charts}/charts_library/lnno.swf +0 -0
  26. data/{charts → examples/charts/public/charts}/charts_library/mxno.swf +0 -0
  27. data/{charts → examples/charts/public/charts}/charts_library/pi3d.swf +0 -0
  28. data/{charts → examples/charts/public/charts}/charts_library/piim.swf +0 -0
  29. data/{charts → examples/charts/public/charts}/charts_library/pino.swf +0 -0
  30. data/{charts → examples/charts/public/charts}/charts_library/pono.swf +0 -0
  31. data/{charts → examples/charts/public/charts}/charts_library/scno.swf +0 -0
  32. data/{charts → examples/charts/public/charts}/full_screen.swf +0 -0
  33. data/{charts → examples/charts/public/charts}/scripts/output_jpg.php +0 -0
  34. data/{charts → examples/charts/public/charts}/sliders/black.swf +0 -0
  35. data/{charts → examples/charts/public/charts}/sliders/preview_handle_1.swf +0 -0
  36. data/{charts → examples/charts/public/charts}/sliders/preview_handle_2.swf +0 -0
  37. data/examples/charts/public/charts/themes/cool_theme/column_chart.yml +150 -0
  38. data/{charts → examples/charts/public/charts}/themes/readme.txt +0 -0
  39. data/examples/charts/views/index.erb +12 -0
  40. data/examples/maps/basic_map.rb +72 -0
  41. data/examples/maps/helpers/map_helper.rb +15 -0
  42. data/examples/maps/models/confidential_herpes_report.rb +78 -0
  43. data/examples/maps/public/javascripts/jquery-1.3.2.js +4376 -0
  44. data/examples/maps/public/map.xml +336 -0
  45. data/examples/maps/public/maps/js/Exception.js +45 -0
  46. data/examples/maps/public/maps/js/FlashProxy.js +72 -0
  47. data/examples/maps/public/maps/js/FlashSerializer.js +165 -0
  48. data/examples/maps/public/maps/js/FlashTag.js +111 -0
  49. data/examples/maps/public/maps/js/JavaScriptFlashGateway.js +455 -0
  50. data/examples/maps/public/maps/js/JavaScriptFlashGateway.swf +0 -0
  51. data/examples/maps/public/maps/map_library/australia.swf +0 -0
  52. data/examples/maps/public/maps/map_library/belgium.swf +0 -0
  53. data/examples/maps/public/maps/map_library/brazil.swf +0 -0
  54. data/examples/maps/public/maps/map_library/canada.swf +0 -0
  55. data/examples/maps/public/maps/map_library/europe.swf +0 -0
  56. data/examples/maps/public/maps/map_library/france.swf +0 -0
  57. data/examples/maps/public/maps/map_library/germany.swf +0 -0
  58. data/examples/maps/public/maps/map_library/italy.swf +0 -0
  59. data/examples/maps/public/maps/map_library/mexico.swf +0 -0
  60. data/examples/maps/public/maps/map_library/sweden.swf +0 -0
  61. data/examples/maps/public/maps/map_library/uk_ireland.swf +0 -0
  62. data/examples/maps/public/maps/map_library/us.swf +0 -0
  63. data/examples/maps/public/maps/map_library/us_canada.swf +0 -0
  64. data/examples/maps/public/maps/map_library/world.swf +0 -0
  65. data/examples/maps/public/maps/themes/default/base_map.yml +27 -0
  66. data/examples/maps/public/maps/themes/default/us_map.yml +20 -0
  67. data/examples/maps/public/maps/themes/default/us_map_2.yml +17 -0
  68. data/examples/maps/public/maps/themes/readme.txt +13 -0
  69. data/examples/maps/public/stylesheets/map.css +16 -0
  70. data/examples/maps/views/index.erb +26 -0
  71. data/examples/maps/views/layout.erb +21 -0
  72. data/lib/ziya/charts/base.rb +15 -14
  73. data/lib/ziya/{components → charts/support}/area.rb +2 -2
  74. data/lib/ziya/{components → charts/support}/axis_category.rb +1 -1
  75. data/lib/ziya/{components → charts/support}/axis_ticks.rb +1 -1
  76. data/lib/ziya/{components → charts/support}/axis_value.rb +1 -1
  77. data/lib/ziya/{components → charts/support}/base.rb +9 -21
  78. data/lib/ziya/{components → charts/support}/bevel.rb +1 -1
  79. data/lib/ziya/{components → charts/support}/blur.rb +1 -1
  80. data/lib/ziya/{components → charts/support}/button.rb +1 -1
  81. data/lib/ziya/{components → charts/support}/chart_border.rb +1 -1
  82. data/lib/ziya/{components → charts/support}/chart_grid_h.rb +1 -1
  83. data/lib/ziya/{components → charts/support}/chart_grid_v.rb +1 -1
  84. data/lib/ziya/{components → charts/support}/chart_guide.rb +1 -1
  85. data/lib/ziya/{components → charts/support}/chart_label.rb +1 -1
  86. data/lib/ziya/{components → charts/support}/chart_note.rb +1 -1
  87. data/lib/ziya/{components → charts/support}/chart_pref.rb +1 -1
  88. data/lib/ziya/{components → charts/support}/chart_rect.rb +1 -1
  89. data/lib/ziya/{components → charts/support}/chart_transition.rb +1 -1
  90. data/lib/ziya/{components → charts/support}/circle.rb +1 -1
  91. data/lib/ziya/{components → charts/support}/context_menu.rb +1 -3
  92. data/lib/ziya/{components → charts/support}/draw.rb +31 -8
  93. data/lib/ziya/{components → charts/support}/draw_base.rb +1 -1
  94. data/lib/ziya/{components → charts/support}/filter.rb +1 -1
  95. data/lib/ziya/{components → charts/support}/flash_to_javascript.rb +1 -3
  96. data/lib/ziya/{components → charts/support}/glow.rb +1 -1
  97. data/lib/ziya/{components → charts/support}/image.rb +1 -1
  98. data/lib/ziya/{components → charts/support}/legend.rb +1 -1
  99. data/lib/ziya/{components → charts/support}/line.rb +1 -1
  100. data/lib/ziya/{components → charts/support}/link.rb +1 -1
  101. data/lib/ziya/{components → charts/support}/link_data.rb +1 -1
  102. data/lib/ziya/{components → charts/support}/rect.rb +1 -1
  103. data/lib/ziya/{components → charts/support}/scroll.rb +1 -3
  104. data/lib/ziya/{components → charts/support}/series.rb +1 -3
  105. data/lib/ziya/{components → charts/support}/series_color.rb +1 -1
  106. data/lib/ziya/{components → charts/support}/series_explode.rb +1 -1
  107. data/lib/ziya/{components → charts/support}/shadow.rb +1 -1
  108. data/lib/ziya/{components → charts/support}/text.rb +9 -1
  109. data/lib/ziya/{components → charts/support}/tooltip.rb +1 -1
  110. data/lib/ziya/{components → charts/support}/update.rb +1 -1
  111. data/lib/ziya/core_ext/string.rb +31 -0
  112. data/lib/ziya/gauges/base.rb +17 -12
  113. data/lib/ziya/gauges/support/base.rb +4 -12
  114. data/lib/ziya/gauges/support/radial_numbers.rb +1 -1
  115. data/lib/ziya/html_helpers/base.rb +91 -0
  116. data/lib/ziya/html_helpers/charts.rb +200 -0
  117. data/lib/ziya/html_helpers/gauges.rb +90 -0
  118. data/lib/ziya/html_helpers/maps.rb +74 -0
  119. data/lib/ziya/html_helpers.rb +1 -0
  120. data/lib/ziya/maps/australia.rb +9 -0
  121. data/lib/ziya/maps/base.rb +409 -0
  122. data/lib/ziya/maps/belgium.rb +7 -0
  123. data/lib/ziya/maps/brazil.rb +7 -0
  124. data/lib/ziya/maps/canada.rb +7 -0
  125. data/lib/ziya/maps/europe.rb +7 -0
  126. data/lib/ziya/maps/france.rb +7 -0
  127. data/lib/ziya/maps/geocode.rb +18 -0
  128. data/lib/ziya/maps/germany.rb +7 -0
  129. data/lib/ziya/maps/italy.rb +7 -0
  130. data/lib/ziya/maps/mexico.rb +7 -0
  131. data/lib/ziya/maps/support/arc.rb +7 -0
  132. data/lib/ziya/maps/support/arc_color.rb +7 -0
  133. data/lib/ziya/maps/support/arc_range.rb +7 -0
  134. data/lib/ziya/maps/support/background_color.rb +7 -0
  135. data/lib/ziya/maps/support/base.rb +34 -0
  136. data/lib/ziya/maps/support/default_color.rb +7 -0
  137. data/lib/ziya/maps/support/default_point.rb +7 -0
  138. data/lib/ziya/maps/support/first_zoom.rb +7 -0
  139. data/lib/ziya/maps/support/heat_range.rb +35 -0
  140. data/lib/ziya/maps/support/hover.rb +7 -0
  141. data/lib/ziya/maps/support/line.rb +7 -0
  142. data/lib/ziya/maps/support/line_color.rb +7 -0
  143. data/lib/ziya/maps/support/line_range.rb +7 -0
  144. data/lib/ziya/maps/support/outline_color.rb +7 -0
  145. data/lib/ziya/maps/support/point.rb +8 -0
  146. data/lib/ziya/maps/support/point_range.rb +7 -0
  147. data/lib/ziya/maps/support/range.rb +31 -0
  148. data/lib/ziya/maps/support/ranges.rb +18 -0
  149. data/lib/ziya/maps/support/region.rb +7 -0
  150. data/lib/ziya/maps/support/scale_points.rb +7 -0
  151. data/lib/ziya/maps/support/show_name.rb +7 -0
  152. data/lib/ziya/maps/support/state.rb +7 -0
  153. data/lib/ziya/maps/support/state_info_icon.rb +7 -0
  154. data/lib/ziya/maps/support/zoom_mode.rb +7 -0
  155. data/lib/ziya/maps/support/zoom_out_button.rb +7 -0
  156. data/lib/ziya/maps/support/zoom_out_scale.rb +7 -0
  157. data/lib/ziya/maps/sweden.rb +7 -0
  158. data/lib/ziya/maps/uk.rb +7 -0
  159. data/lib/ziya/maps/us.rb +7 -0
  160. data/lib/ziya/maps/world.rb +7 -0
  161. data/lib/ziya/version.rb +3 -3
  162. data/lib/ziya/yaml_helpers/base.rb +20 -0
  163. data/lib/ziya/yaml_helpers/charts.rb +49 -0
  164. data/lib/ziya/yaml_helpers/gauges.rb +33 -0
  165. data/lib/ziya/yaml_helpers/maps.rb +17 -0
  166. data/lib/ziya/yaml_helpers.rb +1 -0
  167. data/lib/ziya.rb +20 -11
  168. data/resources/charts/AC_RunActiveContent.js +292 -0
  169. data/resources/charts/charts.swf +0 -0
  170. data/resources/charts/charts_library/ar3d.swf +0 -0
  171. data/resources/charts/charts_library/arno.swf +0 -0
  172. data/resources/charts/charts_library/ars3.swf +0 -0
  173. data/resources/charts/charts_library/arst.swf +0 -0
  174. data/resources/charts/charts_library/brfl.swf +0 -0
  175. data/resources/charts/charts_library/brno.swf +0 -0
  176. data/resources/charts/charts_library/brst.swf +0 -0
  177. data/resources/charts/charts_library/buno.swf +0 -0
  178. data/resources/charts/charts_library/cl3d.swf +0 -0
  179. data/resources/charts/charts_library/clfl.swf +0 -0
  180. data/resources/charts/charts_library/clim.swf +0 -0
  181. data/resources/charts/charts_library/clno.swf +0 -0
  182. data/resources/charts/charts_library/clp3.swf +0 -0
  183. data/resources/charts/charts_library/cls3.swf +0 -0
  184. data/resources/charts/charts_library/clst.swf +0 -0
  185. data/resources/charts/charts_library/cnno.swf +0 -0
  186. data/resources/charts/charts_library/dono.swf +0 -0
  187. data/resources/charts/charts_library/lnno.swf +0 -0
  188. data/resources/charts/charts_library/mxno.swf +0 -0
  189. data/resources/charts/charts_library/pi3d.swf +0 -0
  190. data/resources/charts/charts_library/piim.swf +0 -0
  191. data/resources/charts/charts_library/pino.swf +0 -0
  192. data/resources/charts/charts_library/pono.swf +0 -0
  193. data/resources/charts/charts_library/scno.swf +0 -0
  194. data/resources/charts/full_screen.swf +0 -0
  195. data/resources/charts/scripts/output_jpg.php +23 -0
  196. data/resources/charts/sliders/black.swf +0 -0
  197. data/resources/charts/sliders/preview_handle_1.swf +0 -0
  198. data/resources/charts/sliders/preview_handle_2.swf +0 -0
  199. data/resources/charts/themes/readme.txt +13 -0
  200. data/{gauges → resources/gauges}/designs/circle.yml +0 -0
  201. data/{gauges → resources/gauges}/designs/signal.yml +0 -0
  202. data/{gauges → resources/gauges}/designs/thermo.yml +0 -0
  203. data/{gauges → resources/gauges}/designs/title.yml +0 -0
  204. data/{gauges → resources/gauges}/gauge.swf +0 -0
  205. data/resources/maps/js/Exception.js +45 -0
  206. data/resources/maps/js/FlashProxy.js +72 -0
  207. data/resources/maps/js/FlashSerializer.js +165 -0
  208. data/resources/maps/js/FlashTag.js +111 -0
  209. data/resources/maps/js/JavaScriptFlashGateway.js +455 -0
  210. data/resources/maps/js/JavaScriptFlashGateway.swf +0 -0
  211. data/resources/maps/map_library/australia.swf +0 -0
  212. data/resources/maps/map_library/belgium.swf +0 -0
  213. data/resources/maps/map_library/brazil.swf +0 -0
  214. data/resources/maps/map_library/canada.swf +0 -0
  215. data/resources/maps/map_library/europe.swf +0 -0
  216. data/resources/maps/map_library/france.swf +0 -0
  217. data/resources/maps/map_library/germany.swf +0 -0
  218. data/resources/maps/map_library/italy.swf +0 -0
  219. data/resources/maps/map_library/mexico.swf +0 -0
  220. data/resources/maps/map_library/sweden.swf +0 -0
  221. data/resources/maps/map_library/uk_ireland.swf +0 -0
  222. data/resources/maps/map_library/us.swf +0 -0
  223. data/resources/maps/map_library/us_canada.swf +0 -0
  224. data/resources/maps/map_library/world.swf +0 -0
  225. data/resources/maps/themes/readme.txt +13 -0
  226. data/spec/charts/base_spec.rb +2 -2
  227. data/spec/charts/chart_type_spec.rb +3 -4
  228. data/spec/{components → charts/support}/area_spec.rb +8 -8
  229. data/spec/charts/support/draw_spec.rb +41 -0
  230. data/spec/{components → charts/support}/filter_spec.rb +6 -6
  231. data/spec/{components → charts/support}/link_spec.rb +6 -6
  232. data/spec/{components → charts/support}/series.rb +4 -4
  233. data/spec/{components → charts/support}/series_color_spec.rb +4 -4
  234. data/spec/{components → charts/support}/series_explode.rb +4 -4
  235. data/spec/{components → charts/support}/series_explode_spec.rb +4 -4
  236. data/spec/core_ext/string_spec.rb +40 -0
  237. data/spec/gauges/base_spec.rb +1 -1
  238. data/spec/html_helpers/base_spec.rb +50 -0
  239. data/spec/html_helpers/charts_spec.rb +23 -0
  240. data/spec/html_helpers/gauges_spec.rb +16 -0
  241. data/spec/html_helpers/maps_spec.rb +20 -0
  242. data/spec/maps/base_spec.rb +82 -0
  243. data/spec/maps/support/default_color_spec.rb +29 -0
  244. data/spec/maps/support/heat_range_spec.rb +29 -0
  245. data/spec/maps/us_spec.rb +12 -0
  246. data/spec/maps/world_spec.rb +18 -0
  247. data/spec/spec_helper.rb +5 -4
  248. data/spec/themes/maps/base_map.yml +81 -0
  249. data/spec/themes/maps/us_map.yml +6 -0
  250. data/spec/themes/maps/world_map.yml +6 -0
  251. data/spec/themes/maps/world_ov_map.yml +6 -0
  252. data/spec/{helpers/base_helper_spec.rb → yaml_helpers/charts_spec.rb} +10 -13
  253. data/spec/yaml_helpers/gauges_spec.rb +15 -0
  254. data/spec/ziya_helper_spec.rb +118 -116
  255. data/tasks/gem.rake +1 -1
  256. data/tasks/setup.rb +1 -1
  257. data/ziya.gemspec +39 -0
  258. metadata +259 -438
  259. data/lib/ziya/helpers/base_helper.rb +0 -91
  260. data/lib/ziya/utils/text.rb +0 -39
  261. data/lib/ziya/ziya_helper.rb +0 -362
  262. data/spec/components/draw_spec.rb +0 -37
  263. data/spec/utils/text_spec.rb +0 -33
data/README.txt CHANGED
@@ -1,7 +1,6 @@
1
1
  === ZiYa
2
2
  by Fernand Galiana
3
- ziya.rubyforge.org ( deprecated )
4
- git://github.com/derailed/ziya.git ( preferred )
3
+ git://github.com/derailed/ziya.git
5
4
 
6
5
  == RELEASES
7
6
 
@@ -17,59 +16,65 @@
17
16
  - added draw button support
18
17
  - added chart_note to annotate a chart
19
18
  - added tooltip chart support
19
+ 2.0.8 - Patches to xml/swf/5.0.7 - scroller handle fixe + Stoppped_Scolling js callback
20
+ - added support for flash_to_javascript callbacks
21
+ - added support ids in composite charts
22
+ - various bug fixes
23
+ 2.1.0 - Refactor some of the underlying ziya code
24
+ - Beef up test suite
25
+ - changed component tree
26
+ - Added geographical maps support
27
+ - Changed the default ziyafy to install charts only by default
28
+ Run ziyafy --help for the various options
29
+ - Changed add( :composites, ... ) call to take in a hash of hash instead of id/url pair.
30
+ So the correct call is now of the form chart.add( :composites, :id => { :url => ... } )
31
+ You can now add extra attributes that will be passed to the generated image component.
20
32
 
21
33
  == DESCRIPTION:
22
34
 
23
- ZiYa allows you to easily display graphs in your ruby based applications by leveraging
24
- SWF Charts (http://www.maani.us/xml_charts/index.php) and SWF gauges (http://www.maani.us/gauge/index.php).
25
- This gem bundles version 5.03 and 1.6 of these flash libraries. Incorporating flash graphs or gauge in your app
26
- relieves the server by allowing for delegating graph rendering to the client side. Using this gem, you will
27
- be able to easily create great looking charts for your application. You will also be able
28
- to use the charts or gauges has a navigation scheme by embedding various link in the graphical components
29
- thus bring to the table an ideal scheme for reporting and dashboard like applications. Your
30
- managers will love you for it !!
31
-
32
- Checkout the demo: http://ziya.liquidrail.com
33
- Video : http://www.youtube.com/watch?v=axIMmMHdXzo ( Out of date but you'll get the basics... )
34
- Documentation : http://ziya.liquidrail.com/docs
35
- Forum : http://groups.google.com/group/ziya-plugin
36
- Repositories : http://rubyforge.org/projects/ziya ( deprecated )
37
- git://github.com/derailed/ziya.git ( preferred )
35
+ ZiYa allows you to easily create interactive charts, gauges and maps for your web applications. ZiYa leverages
36
+ flash which offload heavy server side processing to the client. At the root ZiYa allows you to easily generate an
37
+ XML files that will be downloaded to the client for rendering. Using this gem, you will be able to easily create great
38
+ looking charts for your application. You will also be able to use the charts, gauges and maps has a navigation scheme
39
+ by embedding various link in the graphical components thus bringing to the table an ideal scheme for reporting and dashboard
40
+ like applications. Your manager will love you for it !!
38
41
 
42
+ Blog Site : http://ziya.liquidrail.com
43
+ Documentation : http://ziya.liquidrail.com/docs
44
+ Forum : http://groups.google.com/group/ziya-plugin
45
+ Repositories : git://github.com/derailed/ziya.git
39
46
 
40
47
  == FEATURES:
41
48
 
42
49
  * Supports a wide variety of chart/gauge types, sure to fit your needs.
50
+ * Geographical maps. Maps can be drillable and refreshable
43
51
  * Relieves your server load by generating the actual chart on the client side.
44
- * Allows you to style your charts just like you would an html page using css styles
45
- philosophy. Each chart can be associated with a YAML file that allows you to specify
46
- preferences based on SWF Charts properties. Chart stylesheets reside under
47
- public/charts/themes. Each chart type may have an associated YAML file. You can either
48
- inherit the default styles or define your own by specifying an id when you create your graph.
49
- The styles will cascade thru your graph class hierarchy and override default preferences as you
50
- would in a stylesheet.
51
- NOTE: XML/SWF charts are free of charge unless you need to use special features such
52
- as embedded links and printing.
53
- The package cost $45 per domain, including localhost and is well worth the investment.
54
- A similar fee applies to the gauge framework.
55
- * We are leveraging ERB within the YAML file to provide access to the chart/gauge state. State
56
- can be passed in via the options hash when the graph/gauge is generated.
57
- You can also define your own methods in helpers/ziya/xxx_helper. You can access these
58
- helper methods in your style file just like you would in a rails template.
59
- * Theme support. You can change the appearance and behavior of any charts by introducing
60
- new themes under the public/charts/themes directory.
52
+ * Provides for cascading like css-styles for your charts using YAML files.
53
+ * Themes support. You can change the appearance and behavior of any charts by introducing new themes
61
54
 
62
55
  == REQUIREMENTS:
63
56
 
64
- ZiYa depends on the logging gem version >= 0.9.0
65
-
66
- == INSTALL:
57
+ ZiYa depends on the logging gem version ~> 0.9.0
67
58
 
68
- On rubyforge
59
+ ZiYa comes pre-bundled with the following packages:
60
+ * XML/SWF charts Version 5.07 (http://www.maani.us/xml_charts/index.php)
61
+ * XML/SWF gauges Version 1.6 (http://www.maani.us/gauge/index.php)
62
+ * DIY Maps (http://backspace.com/mapapp/)
69
63
 
70
- sudo gem install ziya ( deprecated )
64
+ XML/SWF
65
+ * XML/SWF charts are free of charge unless you need to use special features such
66
+ as embedded links and printing.
67
+
68
+ The package cost $45 per domain, including localhost and is well worth the investment.
69
+ A similar fee applies to the gauge framework.
70
+
71
+ DIY Map
72
+ * This package is free for use in non-commercial applications. For commercial applications,
73
+ there is a $20.00 license per domain. I have chosen this package over others, as it supports
74
+ the interaction and configuration I was looking for, it seems stable and packs lots of features
75
+ for a reasonable price.
71
76
 
72
- or github
77
+ == INSTALL:
73
78
 
74
79
  sudo gem install derailed-ziya ( preferred )
75
80
 
@@ -79,74 +84,76 @@ managers will love you for it !!
79
84
 
80
85
  This will copy the necessary themes and flash files to run ZiYa in your application
81
86
  public/charts directory.
87
+
88
+ > ziyafy --help - for all available options.
82
89
 
83
90
  == SYNOPSIS:
84
91
 
85
- This new gem version requires a client update to flash 9.0 and possibly you will
86
- need to get a new license from XML/SWF >= 5.0 ( $45.0 for your domain ), if you want to use
87
- advanced features suck as links and live updates. Also some api's have changed.
88
- I will try to push a new sample application and more docs in the next few weeks.
89
- So make sure you try this out first in a non production environment and report
90
- bugs or side effects. I'll do my best to keep up with the demand. If anyone would like to give
91
- me a hand with a tutorial app or improving the docs, I am all hears...
92
-
93
- When using within a rails application you will need to create a ziya.rb file in your
94
- config/initializers directory ( Rails 2.0 ).
92
+ This gem version requires a client update to flash 9.0 and possibly you will
93
+ need to get a new license from XML/SWF >= 5.0, if you want to use
94
+ advanced features suck as links and live updates.
95
95
 
96
- NOTE: For rails version < 2.0, you can add the following code in your config/enviroment.rb directly.
96
+ == Creating a ZiYa chart in a rails application
97
97
 
98
- ziya.rb:
98
+ 1 - Edit your environment.rb and add
99
+
100
+ environment.rb
101
+
102
+ config.gem 'derailed-ziya', '~> 2.1.0
99
103
 
100
- # Pull in the ZiYa gem framework
101
- gem "ziya", ">= 2.0.0"
102
- require 'ziya'
104
+ 2 - Create a ziya.rb file under config/initializers
103
105
 
104
- # Initializes the ZiYa Framework
105
- Ziya.initialize(
106
- :logger => RAILS_DEFAULT_LOGGER,
107
- :helpers_dir => File.join( File.dirname(__FILE__), %w[.. .. app helpers ziya] ),
108
- :themes_dir => File.join( File.dirname(__FILE__), %w[.. .. public charts themes])
109
- )
110
-
111
- This will initialize the gem. You can log the output to stdout using the ZiYa bundled logger
112
- or specify a file ie File.join( File.dirname(__FILE__), %w[.. log ziya.log]. If you choose to use the
113
- ZiYa logger, you can specify the :log_level option to either :warn :info :debug or :error.
114
- You will need to indicate your themes directory typically located under public/charts/themes or any location
115
- you'll choose. Lastly you can specify a custom helper directory :helpers_dir, so you can use helper methods
116
- within your ZiYa stylesheets.
117
-
118
- NOTE: You must create the app/helpers/ziya and public/chart/themes directory in your application.
119
-
120
- == Creating a chart
106
+ ziya.rb:
107
+
108
+ # Pull in the ZiYa gem framework
109
+ require 'derailed-ziya'
110
+
111
+ # Initializes the ZiYa Framework
112
+ Ziya.initialize(
113
+ :logger => RAILS_DEFAULT_LOGGER,
114
+ :themes_dir => File.join( File.dirname(__FILE__), %w[.. .. public charts themes])
115
+ )
116
+
117
+ This will initialize the gem. You can log the output to stdout using the ZiYa bundled logger
118
+ or specify a file ie File.join( File.dirname(__FILE__), %w[.. log ziya.log]. If you choose to use the
119
+ ZiYa logger, you can specify the :log_level option to either :warn :info :debug or :error.
120
+ You will need to specify your themes directory typically located under public/charts/themes or any location
121
+ you'll choose.
122
+
123
+ 3 - Create a chart controller
121
124
 
122
- * blee_controller.rb
125
+ blee_controller.rb:
123
126
 
124
- class BleeController < ApplicationController
125
- helper Ziya::Helper
127
+ class BleeController < ApplicationController
128
+ helper Ziya::HtmlHelpers::Charts
129
+ helper Ziya::YamlHelpers::Charts
126
130
 
127
- # Callback from the flash movie to get the chart's data
128
- def load_chart
129
- # Create a bar chart with 2 series composed of 3 data points each.
130
- # Chart will be rendered using the default look and feel
131
- chart = Ziya::Charts::Bar.new
132
- chart.add( :axis_category_text, %w[2006 2007 2008] )
133
- chart.add( :series, "Dogs", [10,20,30] )
134
- chart.add( :series, "Cats", [5,15,25] )
135
- respond_to do |fmt|
136
- fmt.xml => { render :xml => chart.to_xml }
131
+ # Callback from the flash movie to get the chart's data
132
+ def load_chart
133
+ # Create a bar chart with 2 series composed of 3 data points each.
134
+ # Chart will be rendered using the default look and feel
135
+ chart = Ziya::Charts::Bar.new
136
+ chart.add( :axis_category_text, %w[2006 2007 2008] )
137
+ chart.add( :series, "Dogs", [10,20,30] )
138
+ chart.add( :series, "Cats", [5,15,25] )
139
+ respond_to do |fmt|
140
+ fmt.xml => { render :xml => chart.to_xml }
141
+ end
137
142
  end
138
- end
139
-
140
- * blee/index.html.erb
143
+
144
+ 4 - Create a view
141
145
 
142
- Defines the necessary tag to embed a flash movie in your html page.
143
- This will callback to your controller to fetch the necessary xml.
144
- <%= ziya_chart load_chart_url, :size => "300x200" -%>
146
+ blee/index.html.erb:
145
147
 
146
- * config/routes.rb
148
+ # Defines the necessary tag to embed a flash movie in your html page.
149
+ # This will callback to your controller to fetch the necessary xml.
150
+ <%= ziya_chart load_chart_url -%>
151
+
152
+ 5 - Create a named route
147
153
 
148
- Creates a named route for the chart.
149
- map.load_chart '/blee/load_chart', :controller => 'blee', :action => 'load_chart'
154
+ config/routes.rb:
155
+
156
+ map.load_chart '/blee/load_chart', :controller => 'blee', :action => 'load_chart'
150
157
 
151
158
  == Creating a gauge
152
159
 
@@ -162,7 +169,7 @@ managers will love you for it !!
162
169
 
163
170
  class FredController < ApplicationController
164
171
  def load_gauge
165
- gauge = Ziya::Gauges::Base.new( @license_key, 'my_gauge' )
172
+ gauge = Ziya::Gauges::Base.new( LICENCE_KEY, 'my_gauge' )
166
173
  respond_to do |fmt|
167
174
  fmt.xml => { render :xml => gauge.to_xml }
168
175
  end
@@ -171,7 +178,7 @@ managers will love you for it !!
171
178
 
172
179
  * fred/index.html.erb
173
180
 
174
- <%= ziya_gauge load_gauge_url, :size => "300x200" -%>
181
+ <%= ziya_gauge load_gauge_url -%>
175
182
 
176
183
  * config/routes.rb
177
184
 
@@ -249,4 +256,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
249
256
  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
250
257
  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
251
258
  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
252
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
259
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -25,7 +25,7 @@ PROJ.svn = 'ziya'
25
25
  PROJ.rcov_threshold = 90.0
26
26
  PROJ.executables = ['ziyafy']
27
27
 
28
- PROJ.exclude << %w[.DS_Store$ .swo$ .swp$]
28
+ PROJ.exclude << %w[.DS_Store$ .swo$ .swp$ .git$]
29
29
  PROJ.tests = FileList['test/**/test_*.rb']
30
30
  PROJ.annotation_tags << 'BOZO'
31
31
 
@@ -41,4 +41,5 @@ end
41
41
 
42
42
  task 'gem:package' => 'manifest:assert'
43
43
 
44
- depend_on "logging", ">= 0.9.0"
44
+ depend_on "logging", '~> 0.9.3'
45
+ depend_on "color" , '~> 1.4.0'
data/bin/ziyafy CHANGED
@@ -1,25 +1,30 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'optparse'
3
3
  require 'ostruct'
4
+ require 'fileutils'
4
5
 
5
6
  require File.expand_path( File.join(File.dirname(__FILE__), '..', 'lib', 'ziya') )
6
7
 
8
+ # TODO - Use main
7
9
  module Ziya
8
10
  class Ziyafy
9
11
  # Copy necessary ZiYa components to a ruby web application
10
12
  def initialize( argv=ARGV )
11
13
  option_parser = default_option_parser
12
14
  option_parser.parse!(argv)
13
- puts "Installing ZiYa artifacts in `#{options.public_dir}"
14
15
  copy_artifacts
15
16
  end
16
17
 
17
18
  # copies ziya artifacts to public app directory
18
19
  def copy_artifacts
19
- source_dir = File.expand_path( File.join( File.dirname(__FILE__), %w[.. charts]) )
20
- FileUtils.cp_r( source_dir, options.public_dir )
21
- source_dir = File.expand_path( File.join( File.dirname(__FILE__), %w[.. gauges]) )
22
- FileUtils.cp_r( source_dir, options.public_dir )
20
+ %w[charts gauges maps].each do |s|
21
+ if options.send( s )
22
+ dest_dir = File.join( options.public_dir )
23
+ src_dir = File.expand_path( File.join( File.dirname(__FILE__), %w[.. resources], s ) )
24
+ puts "Installing ZiYa artifacts in `#{dest_dir}"
25
+ FileUtils.cp_r( src_dir, dest_dir )
26
+ end
27
+ end
23
28
  end
24
29
 
25
30
  # access the options
@@ -28,6 +33,9 @@ module Ziya
28
33
  @options = OpenStruct.new
29
34
  # Unless specified copy artifacts to the public directory
30
35
  @options.public_dir = File.join( Dir.pwd, %w[public] )
36
+ @options.charts = false
37
+ @options.gauges = false
38
+ @options.maps = false
31
39
  end
32
40
  return @options
33
41
  end
@@ -36,7 +44,25 @@ module Ziya
36
44
  def default_option_parser #:nodoc:
37
45
  OptionParser.new do |op|
38
46
  op.separator ""
39
- op.separator "Ziyafy options"
47
+ op.separator "ziyafy options:"
48
+
49
+ op.on( "-c", "--charts", "Copy ZiYa charts artifacts only" ) do |dir|
50
+ options.charts = true
51
+ end
52
+
53
+ op.on( "-g", "--gauges", "Copy ZiYa gauges artifacts only" ) do |dir|
54
+ options.gauges = true
55
+ end
56
+
57
+ op.on( "-m", "--maps", "Copy ZiYa maps artifacts only" ) do |dir|
58
+ options.maps = true
59
+ end
60
+
61
+ op.on( "-a", "--all", "Copy all ZiYa artifacts" ) do |dir|
62
+ options.charts = true
63
+ options.gauges = true
64
+ options.maps = true
65
+ end
40
66
 
41
67
  op.on( "-p", "--public_dir FILE", "The location of the public app directory." ) do |dir|
42
68
  options.public_dir = dir
@@ -47,7 +73,4 @@ module Ziya
47
73
  end
48
74
  end
49
75
 
50
- Ziya::Ziyafy.new(ARGV)
51
-
52
-
53
-
76
+ Ziya::Ziyafy.new(ARGV)
@@ -0,0 +1,47 @@
1
+ require 'rubygems'
2
+ require 'sinatra'
3
+ require 'builder'
4
+
5
+ # require ZiYa gem and helpers
6
+ require 'ziya'
7
+ require 'ziya/html_helpers'
8
+ require 'ziya/yaml_helpers'
9
+
10
+ # initialize ZiYa environment
11
+ configure do
12
+ Ziya.initialize(
13
+ :log_level => :debug,
14
+ :themes_dir => File.join( File.dirname(__FILE__), %w[public charts themes] ) )
15
+ end
16
+
17
+ helpers do
18
+ # add ZiYa helpers
19
+ include Ziya::HtmlHelpers::Charts
20
+ include Ziya::YamlHelpers::Charts
21
+
22
+ # Default chart
23
+ def gen_chart
24
+ chart = Ziya::Charts::Column.new
25
+ chart.add :axis_category_text, %w[2007 2008 2009]
26
+ chart.add :series, 'dogs', [10,20,30]
27
+ chart.add :series, 'cats', [5,15,25]
28
+ chart
29
+ end
30
+ end
31
+
32
+ # Setup chart and callbacks
33
+ get '/' do
34
+ erb :index
35
+ end
36
+
37
+ # defines a simple column chart
38
+ get '/load_chart' do
39
+ gen_chart.to_xml
40
+ end
41
+
42
+ # exact same chart as above but styled
43
+ get '/load_themed_chart' do
44
+ chart = gen_chart
45
+ chart.add :theme , 'cool_theme'
46
+ chart.to_xml
47
+ end
@@ -0,0 +1,150 @@
1
+ <%= chart :column %>
2
+
3
+ <%=comp :axis_category %>
4
+ shadow: low
5
+
6
+ <%=comp :axis_value %>
7
+ shadow: low
8
+ steps: 4
9
+ size: 10
10
+ alpha: 50
11
+ min: 0
12
+
13
+ <%=comp :chart_border %>
14
+ top_thickness: 1
15
+ bottom_thickness: 2
16
+ left_thickness: 0
17
+ color: 000000
18
+ right_thickness: 0
19
+
20
+ <%=comp :chart_grid_h %>
21
+ alpha: 10
22
+ thickness: 1
23
+ type: dashed
24
+
25
+ <%=comp :chart_label %>
26
+ alpha: 90
27
+ size: 10
28
+ color: ddffff
29
+ position: middle
30
+
31
+ <%=comp :chart_rect %>
32
+ shadow: high
33
+ corner_tr: 0
34
+ x: 75
35
+ positive_alpha: 100
36
+ corner_bl: 40
37
+ y: 50
38
+ corner_tl: 0
39
+ height: 200
40
+ positive_color: eeeeff
41
+ negative_color: dddddd
42
+ bevel: bg
43
+ corner_br: 40
44
+ negative_alpha: 100
45
+ width: 300
46
+
47
+ <%=comp :chart_transition %>
48
+ delay: .5
49
+ order: series
50
+ type: scale
51
+ duration: 0.5
52
+
53
+ <%=comp :draw %>
54
+ components:
55
+ - <%= drawing :text %>
56
+ shadow: high
57
+ alpha: 50
58
+ rotation: -90
59
+ size: 75
60
+ x: -20
61
+ y: 300
62
+ color: f8f8ff
63
+ height: 200
64
+ h_align: center
65
+ width: 300
66
+ text: 'animals'
67
+ - <%= drawing :text %>
68
+ shadow: low
69
+ alpha: 50
70
+ rotation: -90
71
+ size: 16
72
+ x: 7
73
+ y: 230
74
+ color: 000033
75
+ height: 50
76
+ h_align: center
77
+ width: 300
78
+ v_align: middle
79
+ text: '(millions)'
80
+
81
+ <%=comp :filter %>
82
+ filters:
83
+ - <%= filter_type :shadow %>
84
+ blurY: 10
85
+ angle: 45
86
+ alpha: 35
87
+ id: high
88
+ distance: 5
89
+ blurX: 10
90
+ - <%= filter_type :shadow %>
91
+ blurY: 5
92
+ angle: 45
93
+ alpha: 35
94
+ id: low
95
+ distance: 2
96
+ blurX: 5
97
+ - <%= filter_type :bevel %>
98
+ blurY: 50
99
+ inner: true
100
+ angle: 45
101
+ highlightAlpha: 50
102
+ id: bg
103
+ highlightColor: ffffff
104
+ shadowAlpha: 10
105
+ blurX: 50
106
+ distance: 10
107
+ - <%= filter_type :bevel %>
108
+ blurY: 30
109
+ inner: true
110
+ angle: -80
111
+ highlightAlpha: 50
112
+ shadowColor: 000088
113
+ id: blue
114
+ highlightColor: ffffff
115
+ shadowAlpha: 25
116
+ blurX: 0
117
+ distance: 20
118
+ - <%= filter_type :bevel %>
119
+ blurY: 30
120
+ inner: true
121
+ angle: -80
122
+ highlightAlpha: 25
123
+ shadowColor: 000000
124
+ id: gray
125
+ highlightColor: ffffff
126
+ shadowAlpha: 20
127
+ blurX: 0
128
+ distance: 20
129
+
130
+ <%=comp :legend %>
131
+ shadow: low
132
+ line_alpha: 0
133
+ size: 12
134
+ alpha: 90
135
+ x: 75
136
+ fill_alpha: 8
137
+ y: 27
138
+ margin: 5
139
+ height: 20
140
+ fill_color: 000066
141
+ color: 333355
142
+ line_thickness: 0
143
+ width: 300
144
+
145
+ <%=comp :series_color %>
146
+ colors: 666666,768bb3
147
+
148
+ <%=comp :series %>
149
+ set_gap: 40
150
+ bar_gap: -25
@@ -0,0 +1,12 @@
1
+ <h1>ZiYa basic chart example</h1>
2
+
3
+ <div style="text-align:center">
4
+ <div style="float:left;width:50%;border:1px black solid">
5
+ <h2>default theme</h2>
6
+ <%= ziya_chart '/load_chart' %>
7
+ </div>
8
+ <div style="width:100%;border:1px black solid">
9
+ <h2>custom theme</h2>
10
+ <%= ziya_chart '/load_themed_chart' %>
11
+ </div>
12
+ </div>