ziya 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. data/History.txt +4 -0
  2. data/Manifest.txt +127 -0
  3. data/README.txt +137 -0
  4. data/Rakefile +45 -0
  5. data/bin/ziyafy +51 -0
  6. data/charts/charts.swf +0 -0
  7. data/charts/charts_library/arno.swf +0 -0
  8. data/charts/charts_library/arst.swf +0 -0
  9. data/charts/charts_library/brfl.swf +0 -0
  10. data/charts/charts_library/brno.swf +0 -0
  11. data/charts/charts_library/brst.swf +0 -0
  12. data/charts/charts_library/cl3d.swf +0 -0
  13. data/charts/charts_library/clfl.swf +0 -0
  14. data/charts/charts_library/clno.swf +0 -0
  15. data/charts/charts_library/clp3.swf +0 -0
  16. data/charts/charts_library/cls3.swf +0 -0
  17. data/charts/charts_library/clst.swf +0 -0
  18. data/charts/charts_library/cnno.swf +0 -0
  19. data/charts/charts_library/lnno.swf +0 -0
  20. data/charts/charts_library/mxno.swf +0 -0
  21. data/charts/charts_library/pi3d.swf +0 -0
  22. data/charts/charts_library/pino.swf +0 -0
  23. data/charts/charts_library/pono.swf +0 -0
  24. data/charts/charts_library/scno.swf +0 -0
  25. data/charts/themes/commando/bar_chart.yml +9 -0
  26. data/charts/themes/commando/base_chart.yml +65 -0
  27. data/charts/themes/commando/column_chart.yml +13 -0
  28. data/charts/themes/commando/column_threed_chart.yml +25 -0
  29. data/charts/themes/commando/parallel_threed_column_chart.yml +17 -0
  30. data/charts/themes/commando/pie_chart.yml +22 -0
  31. data/charts/themes/commando/pie_threed_chart.yml +28 -0
  32. data/charts/themes/commando/polar_chart.yml +11 -0
  33. data/charts/themes/commando/stacked_bar_chart.yml +9 -0
  34. data/charts/themes/commando/stacked_column_chart.yml +14 -0
  35. data/charts/themes/commando/stacked_threed_column_chart.yml +17 -0
  36. data/charts/themes/default/bar_chart.yml +3 -0
  37. data/charts/themes/default/base_chart.yml +67 -0
  38. data/charts/themes/default/column_chart.yml +13 -0
  39. data/charts/themes/default/column_threed_chart.yml +25 -0
  40. data/charts/themes/default/parallel_threed_column_chart.yml +17 -0
  41. data/charts/themes/default/pie_chart.yml +29 -0
  42. data/charts/themes/default/pie_threed_chart.yml +28 -0
  43. data/charts/themes/default/polar_chart.yml +12 -0
  44. data/charts/themes/default/stacked_bar_chart.yml +3 -0
  45. data/charts/themes/default/stacked_column_chart.yml +14 -0
  46. data/charts/themes/default/stacked_threed_column_chart.yml +17 -0
  47. data/charts/themes/default/test.yml +4 -0
  48. data/lib/ziya.rb +100 -0
  49. data/lib/ziya/charts/area.rb +13 -0
  50. data/lib/ziya/charts/bar.rb +11 -0
  51. data/lib/ziya/charts/base.rb +435 -0
  52. data/lib/ziya/charts/candle_stick.rb +11 -0
  53. data/lib/ziya/charts/column.rb +11 -0
  54. data/lib/ziya/charts/column_threed.rb +11 -0
  55. data/lib/ziya/charts/floating_bar.rb +11 -0
  56. data/lib/ziya/charts/floating_column.rb +11 -0
  57. data/lib/ziya/charts/line.rb +11 -0
  58. data/lib/ziya/charts/mixed.rb +11 -0
  59. data/lib/ziya/charts/parallel_threed_column.rb +11 -0
  60. data/lib/ziya/charts/pie.rb +11 -0
  61. data/lib/ziya/charts/pie_threed.rb +11 -0
  62. data/lib/ziya/charts/polar.rb +11 -0
  63. data/lib/ziya/charts/scatter.rb +11 -0
  64. data/lib/ziya/charts/stacked_area.rb +11 -0
  65. data/lib/ziya/charts/stacked_bar.rb +11 -0
  66. data/lib/ziya/charts/stacked_column.rb +11 -0
  67. data/lib/ziya/charts/stacked_threed_column.rb +11 -0
  68. data/lib/ziya/components/area.rb +14 -0
  69. data/lib/ziya/components/axis_category.rb +69 -0
  70. data/lib/ziya/components/axis_ticks.rb +37 -0
  71. data/lib/ziya/components/axis_value.rb +59 -0
  72. data/lib/ziya/components/base.rb +100 -0
  73. data/lib/ziya/components/chart_border.rb +33 -0
  74. data/lib/ziya/components/chart_grid_h.rb +28 -0
  75. data/lib/ziya/components/chart_grid_v.rb +28 -0
  76. data/lib/ziya/components/chart_pref.rb +22 -0
  77. data/lib/ziya/components/chart_rect.rb +36 -0
  78. data/lib/ziya/components/chart_transition.rb +26 -0
  79. data/lib/ziya/components/chart_value.rb +71 -0
  80. data/lib/ziya/components/circle.rb +13 -0
  81. data/lib/ziya/components/draw.rb +45 -0
  82. data/lib/ziya/components/image.rb +13 -0
  83. data/lib/ziya/components/legend_label.rb +18 -0
  84. data/lib/ziya/components/legend_rect.rb +19 -0
  85. data/lib/ziya/components/legend_transition.rb +18 -0
  86. data/lib/ziya/components/line.rb +12 -0
  87. data/lib/ziya/components/link.rb +29 -0
  88. data/lib/ziya/components/link_data.rb +19 -0
  89. data/lib/ziya/components/live_update.rb +21 -0
  90. data/lib/ziya/components/rect.rb +13 -0
  91. data/lib/ziya/components/series_color.rb +35 -0
  92. data/lib/ziya/components/series_explode.rb +38 -0
  93. data/lib/ziya/components/series_gap.rb +18 -0
  94. data/lib/ziya/components/series_switch.rb +25 -0
  95. data/lib/ziya/components/text.rb +13 -0
  96. data/lib/ziya/helpers/base_helper.rb +37 -0
  97. data/lib/ziya/utils/logger.rb +125 -0
  98. data/lib/ziya/utils/text.rb +33 -0
  99. data/lib/ziya/version.rb +15 -0
  100. data/lib/ziya/ziya_helper.rb +147 -0
  101. data/spec/charts/base_spec.rb +120 -0
  102. data/spec/charts/chart_type_spec.rb +42 -0
  103. data/spec/components/area_spec.rb +60 -0
  104. data/spec/components/draw_spec.rb +33 -0
  105. data/spec/components/link_spec.rb +23 -0
  106. data/spec/components/series_color_spec.rb +40 -0
  107. data/spec/components/series_explode_spec.rb +40 -0
  108. data/spec/components/series_switch_spec.rb +19 -0
  109. data/spec/helpers/base_helper_spec.rb +22 -0
  110. data/spec/spec_helper.rb +7 -0
  111. data/spec/themes/default/fred.yml +6 -0
  112. data/spec/themes/default/line_chart.yml +6 -0
  113. data/spec/utils/logger_spec.rb +57 -0
  114. data/spec/utils/text_spec.rb +34 -0
  115. data/spec/ziya_helper_spec.rb +40 -0
  116. data/spec/ziya_spec.rb +19 -0
  117. data/tasks/ann.rake +76 -0
  118. data/tasks/annotations.rake +22 -0
  119. data/tasks/doc.rake +48 -0
  120. data/tasks/gem.rake +110 -0
  121. data/tasks/manifest.rake +49 -0
  122. data/tasks/post_load.rake +26 -0
  123. data/tasks/rubyforge.rake +57 -0
  124. data/tasks/setup.rb +227 -0
  125. data/tasks/spec.rake +61 -0
  126. data/tasks/svn.rake +44 -0
  127. data/tasks/test.rake +38 -0
  128. metadata +190 -0
@@ -0,0 +1,13 @@
1
+ <%= chart :column %>
2
+ <%=component :chart_value %>
3
+ position: top
4
+
5
+ <%=component :chart_border %>
6
+ left_thickness: 1
7
+ bottom_thickness: 2
8
+
9
+ <%=component :chart_grid_h %>
10
+ thickness: 5
11
+
12
+ <%=component :chart_grid_v %>
13
+ thickness: 1
@@ -0,0 +1,25 @@
1
+ <%= chart :column_threed %>
2
+ <%=comp :chart_value %>
3
+ color: 000000
4
+ position: over
5
+
6
+ <%=comp :axis_category %>
7
+ orientation: diagonal_down
8
+
9
+ <%=comp :chart_border %>
10
+ left_thickness: 1
11
+ bottom_thickness: 3
12
+
13
+ <%=comp :chart_grid_h %>
14
+ thickness: 3
15
+
16
+ <%=comp :chart_grid_v %>
17
+ thickness: 1
18
+
19
+ <%=comp :chart_rect %>
20
+ x: 40
21
+ y: 40
22
+ height: 200
23
+ width: 300
24
+ positive_alpha: 0
25
+ negative_alpha: 0
@@ -0,0 +1,17 @@
1
+ <%= chart :parallel_threed_column %>
2
+ <%=comp :chart_value %>
3
+ color: 000000
4
+ position: over
5
+
6
+ <%=comp :axis_category %>
7
+ orientation: diagonal_down
8
+
9
+ <%=comp :chart_border %>
10
+ left_thickness: 1
11
+ bottom_thickness: 3
12
+
13
+ <%=comp :chart_grid_h %>
14
+ thickness: 3
15
+
16
+ <%=comp :chart_grid_v %>
17
+ thickness: 1
@@ -0,0 +1,22 @@
1
+ <%= chart :pie %>
2
+ <%=component :legend_rect %>
3
+ x: 40
4
+ y: 0
5
+ width: 0
6
+
7
+ <%=component :chart_rect %>
8
+ x: 110
9
+ y: 0
10
+ height: 200
11
+ width: 200
12
+ positive_alpha: 0
13
+ negative_alpha: 0
14
+
15
+ <%=component :chart_value %>
16
+ position: inside
17
+
18
+ <%=component :chart_border %>
19
+ left_thickness: 0
20
+ bottom_thickness: 0
21
+ top_thickness: 0
22
+ right_thickness: 0
@@ -0,0 +1,28 @@
1
+ <%= chart :pie_threed %>
2
+ <%=comp :legend_rect %>
3
+ x: 10
4
+ y: 0
5
+ width: 0
6
+
7
+ <%=comp :chart_rect %>
8
+ x: 110
9
+ y: 0
10
+ height: 200
11
+ width: 200
12
+ positive_alpha: 0
13
+ negative_alpha: 0
14
+
15
+ <%=comp :chart_value %>
16
+ position: inside
17
+
18
+ <%=comp :chart_border %>
19
+ left_thickness: 0
20
+ bottom_thickness: 0
21
+ top_thickness: 0
22
+ right_thickness: 0
23
+
24
+ <%=comp :chart_grid_h %>
25
+ alpha: 0
26
+
27
+ <%=comp :chart_grid_v %>
28
+ alpha: 0
@@ -0,0 +1,11 @@
1
+ <%= chart :polar %>
2
+ <%=component :chart_rect %>
3
+ x: 80
4
+ y: 5
5
+ height: 200
6
+ width: 200
7
+
8
+ <%=component :legend_rect %>
9
+ x: 80
10
+ y: 230
11
+ width: 200
@@ -0,0 +1,9 @@
1
+ <%= chart :stacked_bar %>
2
+ <%=component :chart_border %>
3
+ left_thickness: 2
4
+
5
+ <%=component :chart_grid_h %>
6
+ thickness: 1
7
+
8
+ <%=component :chart_grid_v %>
9
+ thickness: 5
@@ -0,0 +1,14 @@
1
+ <%= chart :stacked_column %>
2
+ <%=component :chart_value %>
3
+ position: top
4
+
5
+ <%=component :chart_border %>
6
+ left_thickness: 1
7
+ bottom_thickness: 2
8
+
9
+ <%=component :chart_grid_h %>
10
+ thickness: 5
11
+
12
+ <%=component :chart_grid_v %>
13
+ thickness: 1
14
+
@@ -0,0 +1,17 @@
1
+ <%= chart :stacked_threed_column %>
2
+ <%=comp :chart_value %>
3
+ color: 000000
4
+ position: over
5
+
6
+ <%=comp :axis_category %>
7
+ orientation: diagonal_down
8
+
9
+ <%=comp :chart_border %>
10
+ left_thickness: 1
11
+ bottom_thickness: 3
12
+
13
+ <%=comp :chart_grid_h %>
14
+ thickness: 3
15
+
16
+ <%=comp :chart_grid_v %>
17
+ thickness: 1
@@ -0,0 +1,3 @@
1
+ <%= chart :bar %>
2
+ <%=component :chart_border %>
3
+ left_thickness: 3
@@ -0,0 +1,67 @@
1
+ <%= chart :base %>
2
+ <%=component :axis_category %>
3
+ size: 10
4
+ color: 000000
5
+ bold: true
6
+ alpha: 100
7
+
8
+ <%=component :axis_value %>
9
+ color: 000000
10
+ skip: 0
11
+ alpha: 50
12
+ size: 10
13
+
14
+ <%=component :chart_rect %>
15
+ positive_color: ffffff
16
+ positive_alpha: 50
17
+ negative_color: ffff66
18
+ negative_alpha: 50
19
+
20
+ <%=component :legend_rect %>
21
+ fill_color: ffffff
22
+ fill_alpha: 90
23
+ x: 40
24
+ y: 0
25
+
26
+ <%=component :axis_ticks %>
27
+ major_color: 54544c
28
+ minor_color: a19d91
29
+ value_ticks: true
30
+
31
+ <%=component :chart_border %>
32
+ left_thickness: 1
33
+ bottom_thickness: 1
34
+ top_thickness: 1
35
+ right_thickness: 1
36
+
37
+ <%=component :chart_grid_h %>
38
+ thickness: 1
39
+ color: 000000
40
+ alpha: 20
41
+
42
+ <%=component :chart_grid_v %>
43
+ thickness: 3
44
+ color: 000000
45
+ alpha: 20
46
+
47
+ <%=component :chart_transition %>
48
+ type: none
49
+ order: category
50
+ duration: 0.2
51
+
52
+ <%=component :chart_value %>
53
+ position: right
54
+ color: F5F0BE
55
+ size: 9
56
+ alpha: 100
57
+
58
+ <%=component :legend_label %>
59
+ color: 000000
60
+ size: 10
61
+
62
+ <%=component :legend_transition %>
63
+ color: 00ff00
64
+ type: none
65
+
66
+ <%=component :series_color %>
67
+ colors: 666666,768bb3
@@ -0,0 +1,13 @@
1
+ <%= chart :column %>
2
+ <%=component :chart_value %>
3
+ position: top
4
+
5
+ <%=component :chart_border %>
6
+ left_thickness: 1
7
+ bottom_thickness: 3
8
+
9
+ <%=component :chart_grid_h %>
10
+ thickness: 3
11
+
12
+ <%=component :chart_grid_v %>
13
+ thickness: 1
@@ -0,0 +1,25 @@
1
+ <%= chart :column_threed %>
2
+ <%=comp :chart_value %>
3
+ color: 000000
4
+ position: over
5
+
6
+ <%=comp :axis_category %>
7
+ orientation: diagonal_down
8
+
9
+ <%=comp :chart_border %>
10
+ left_thickness: 1
11
+ bottom_thickness: 3
12
+
13
+ <%=comp :chart_grid_h %>
14
+ thickness: 3
15
+
16
+ <%=comp :chart_grid_v %>
17
+ thickness: 1
18
+
19
+ <%=comp :chart_rect %>
20
+ x: 40
21
+ y: 40
22
+ height: 200
23
+ width: 300
24
+ positive_alpha: 0
25
+ negative_alpha: 0
@@ -0,0 +1,17 @@
1
+ <%= chart :parallel_threed_column %>
2
+ <%=comp :chart_value %>
3
+ color: 000000
4
+ position: over
5
+
6
+ <%=comp :axis_category %>
7
+ orientation: diagonal_down
8
+
9
+ <%=comp :chart_border %>
10
+ left_thickness: 1
11
+ bottom_thickness: 3
12
+
13
+ <%=comp :chart_grid_h %>
14
+ thickness: 3
15
+
16
+ <%=comp :chart_grid_v %>
17
+ thickness: 1
@@ -0,0 +1,29 @@
1
+ <%= chart :pie %>
2
+
3
+ <%=component :legend_rect %>
4
+ x: 40
5
+ y: 0
6
+ width: 0
7
+
8
+ <%=component :chart_rect %>
9
+ x: 110
10
+ y: 0
11
+ height: 200
12
+ width: 200
13
+ positive_alpha: 0
14
+ negative_alpha: 0
15
+
16
+ <%=component :chart_value %>
17
+ position: inside
18
+
19
+ <%=component :chart_border %>
20
+ left_thickness: 0
21
+ bottom_thickness: 0
22
+ top_thickness: 0
23
+ right_thickness: 0
24
+
25
+ <%=component :chart_grid_h %>
26
+ alpha: 0
27
+
28
+ <%=component :chart_grid_v %>
29
+ alpha: 0
@@ -0,0 +1,28 @@
1
+ <%= chart :pie_threed %>
2
+ <%=comp :legend_rect %>
3
+ x: 10
4
+ y: 0
5
+ width: 0
6
+
7
+ <%=comp :chart_rect %>
8
+ x: 110
9
+ y: 0
10
+ height: 200
11
+ width: 200
12
+ positive_alpha: 0
13
+ negative_alpha: 0
14
+
15
+ <%=comp :chart_value %>
16
+ position: inside
17
+
18
+ <%=comp :chart_border %>
19
+ left_thickness: 0
20
+ bottom_thickness: 0
21
+ top_thickness: 0
22
+ right_thickness: 0
23
+
24
+ <%=comp :chart_grid_h %>
25
+ alpha: 0
26
+
27
+ <%=comp :chart_grid_v %>
28
+ alpha: 0
@@ -0,0 +1,12 @@
1
+ <%= chart :polar %>
2
+
3
+ <%=component :chart_rect %>
4
+ x: 80
5
+ y: 5
6
+ height: 200
7
+ width: 200
8
+
9
+ <%=component :legend_rect %>
10
+ x: 80
11
+ y: 230
12
+ width: 200
@@ -0,0 +1,3 @@
1
+ <%= chart :stacked_bar %>
2
+ <%=component :chart_border %>
3
+ left_thickness: 3
@@ -0,0 +1,14 @@
1
+ <%= chart :stacked_column %>
2
+ <%=component :chart_value %>
3
+ position: top
4
+
5
+ <%=component :chart_border %>
6
+ left_thickness: 1
7
+ bottom_thickness: 3
8
+
9
+ <%=component :chart_grid_h %>
10
+ thickness: 3
11
+
12
+ <%=component :chart_grid_v %>
13
+ thickness: 1
14
+
@@ -0,0 +1,17 @@
1
+ <%= chart :stacked_threed_column %>
2
+ <%=comp :chart_value %>
3
+ color: 000000
4
+ position: over
5
+
6
+ <%=comp :axis_category %>
7
+ orientation: diagonal_down
8
+
9
+ <%=comp :chart_border %>
10
+ left_thickness: 1
11
+ bottom_thickness: 3
12
+
13
+ <%=comp :chart_grid_h %>
14
+ thickness: 3
15
+
16
+ <%=comp :chart_grid_v %>
17
+ thickness: 1
@@ -0,0 +1,4 @@
1
+ # Testing override
2
+ <%= chart :base %>
3
+ <%=component :axis_category %>
4
+ size: 50
@@ -0,0 +1,100 @@
1
+ # $Id$
2
+
3
+ # BOZO !! Document !!
4
+
5
+ # Equivalent to a header guard in C/C++
6
+ # Used to prevent the class/module from being loaded more than once
7
+ unless defined? Ziya
8
+ module Ziya
9
+ # :stopdoc:
10
+ LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
11
+ PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
12
+
13
+ def self.default_configuration
14
+ { :themes_dir => File.join( File.dirname(__FILE__), %w[.. themes] ),
15
+ :log_file => $stdout,
16
+ :log_level => :info }
17
+ end
18
+
19
+ def self.initialize( opts={} )
20
+ puts ">>> No logger specified. Using ZiYa default logger" unless opts[:logger]
21
+ puts ">>> No themes_dir specified. Using ZiYa default themes" unless opts[:themes_dir]
22
+ @config = default_configuration.merge( opts )
23
+ @logger = opts[:logger] if opts[:logger]
24
+
25
+ # Verify existance of themes and helper dirs if any
26
+ raise "Unable to find themes directory `#{themes_dir}" unless File.exists?( themes_dir )
27
+
28
+ if helpers_dir
29
+ raise "Unable to find helper directory `#{helpers_dir}" unless File.exists?( helpers_dir )
30
+ end
31
+
32
+ # Add the ziya/lib to the ruby path...
33
+ $: << libpath
34
+ Ziya.require_all_libs_relative_to __FILE__
35
+ dump
36
+ end
37
+
38
+ # ZiYa configuration
39
+ def self.config
40
+ @config
41
+ end
42
+
43
+ # directory location for ziya stylesheet custom helpers
44
+ def self.helpers_dir
45
+ config[:helpers_dir]
46
+ end
47
+
48
+ # the themes root directory location
49
+ def self.themes_dir
50
+ config[:themes_dir]
51
+ end
52
+
53
+ # Debug
54
+ def self.dump #:nodoc:
55
+ puts ""
56
+ puts "ZiYa Configuration Landscape"
57
+ config.keys.sort{ |a,b| a.to_s <=> b.to_s }.each do |k|
58
+ key = k.to_s.rjust(20)
59
+ value = config[k].to_s.rjust(97,".")
60
+ puts "#{key} : #{value}"
61
+ end
62
+ end
63
+
64
+ # fetch the framework logger
65
+ def self.logger
66
+ # get a hold of a logger.
67
+ @logger ||= ::Ziya::Logger.new( { :log_file => config[:log_file],
68
+ :logger_name => "ZiYa",
69
+ :log_level => config[:log_level],
70
+ :additive => false } )
71
+ end
72
+
73
+ # Returns the library path for the module. If any arguments are given,
74
+ # they will be joined to the end of the libray path using
75
+ # <tt>File.join</tt>.
76
+ #
77
+ def self.libpath( *args ) #:nodoc:
78
+ args.empty? ? LIBPATH : ::File.join(LIBPATH, *args)
79
+ end
80
+
81
+ # Returns the lpath for the module. If any arguments are given,
82
+ # they will be joined to the end of the path using
83
+ # <tt>File.join</tt>.
84
+ #
85
+ def self.path( *args ) #:nodoc:
86
+ args.empty? ? PATH : ::File.join(PATH, *args)
87
+ end
88
+
89
+ # Utility method used to require all files ending in .rb that lie in the
90
+ # directory below this file that has the same name as the filename passed
91
+ # in. Optionally, a specific _directory_ name can be passed in such that
92
+ # the _filename_ does not have to be equivalent to the directory.
93
+ #
94
+ def self.require_all_libs_relative_to( fname, dir = nil ) #:nodoc:
95
+ dir ||= ::File.basename(fname, '.*')
96
+ search_me = ::File.expand_path( ::File.join(::File.dirname(fname), dir, '**', '*.rb'))
97
+ Dir.glob(search_me).sort.each {|rb| require rb}
98
+ end
99
+ end
100
+ end