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.
- data/Manifest.txt +240 -432
- data/README.txt +104 -97
- data/Rakefile +3 -2
- data/bin/ziyafy +33 -10
- data/examples/charts/basic_chart.rb +47 -0
- data/{charts → examples/charts/public/charts}/AC_RunActiveContent.js +0 -0
- data/{charts → examples/charts/public/charts}/charts.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/ar3d.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/arno.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/ars3.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/arst.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/brfl.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/brno.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/brst.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/buno.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/cl3d.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/clfl.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/clim.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/clno.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/clp3.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/cls3.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/clst.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/cnno.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/dono.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/lnno.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/mxno.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/pi3d.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/piim.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/pino.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/pono.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/scno.swf +0 -0
- data/{charts → examples/charts/public/charts}/full_screen.swf +0 -0
- data/{charts → examples/charts/public/charts}/scripts/output_jpg.php +0 -0
- data/{charts → examples/charts/public/charts}/sliders/black.swf +0 -0
- data/{charts → examples/charts/public/charts}/sliders/preview_handle_1.swf +0 -0
- data/{charts → examples/charts/public/charts}/sliders/preview_handle_2.swf +0 -0
- data/examples/charts/public/charts/themes/cool_theme/column_chart.yml +150 -0
- data/{charts → examples/charts/public/charts}/themes/readme.txt +0 -0
- data/examples/charts/views/index.erb +12 -0
- data/examples/maps/basic_map.rb +72 -0
- data/examples/maps/helpers/map_helper.rb +15 -0
- data/examples/maps/models/confidential_herpes_report.rb +78 -0
- data/examples/maps/public/javascripts/jquery-1.3.2.js +4376 -0
- data/examples/maps/public/map.xml +336 -0
- data/examples/maps/public/maps/js/Exception.js +45 -0
- data/examples/maps/public/maps/js/FlashProxy.js +72 -0
- data/examples/maps/public/maps/js/FlashSerializer.js +165 -0
- data/examples/maps/public/maps/js/FlashTag.js +111 -0
- data/examples/maps/public/maps/js/JavaScriptFlashGateway.js +455 -0
- data/examples/maps/public/maps/js/JavaScriptFlashGateway.swf +0 -0
- data/examples/maps/public/maps/map_library/australia.swf +0 -0
- data/examples/maps/public/maps/map_library/belgium.swf +0 -0
- data/examples/maps/public/maps/map_library/brazil.swf +0 -0
- data/examples/maps/public/maps/map_library/canada.swf +0 -0
- data/examples/maps/public/maps/map_library/europe.swf +0 -0
- data/examples/maps/public/maps/map_library/france.swf +0 -0
- data/examples/maps/public/maps/map_library/germany.swf +0 -0
- data/examples/maps/public/maps/map_library/italy.swf +0 -0
- data/examples/maps/public/maps/map_library/mexico.swf +0 -0
- data/examples/maps/public/maps/map_library/sweden.swf +0 -0
- data/examples/maps/public/maps/map_library/uk_ireland.swf +0 -0
- data/examples/maps/public/maps/map_library/us.swf +0 -0
- data/examples/maps/public/maps/map_library/us_canada.swf +0 -0
- data/examples/maps/public/maps/map_library/world.swf +0 -0
- data/examples/maps/public/maps/themes/default/base_map.yml +27 -0
- data/examples/maps/public/maps/themes/default/us_map.yml +20 -0
- data/examples/maps/public/maps/themes/default/us_map_2.yml +17 -0
- data/examples/maps/public/maps/themes/readme.txt +13 -0
- data/examples/maps/public/stylesheets/map.css +16 -0
- data/examples/maps/views/index.erb +26 -0
- data/examples/maps/views/layout.erb +21 -0
- data/lib/ziya/charts/base.rb +15 -14
- data/lib/ziya/{components → charts/support}/area.rb +2 -2
- data/lib/ziya/{components → charts/support}/axis_category.rb +1 -1
- data/lib/ziya/{components → charts/support}/axis_ticks.rb +1 -1
- data/lib/ziya/{components → charts/support}/axis_value.rb +1 -1
- data/lib/ziya/{components → charts/support}/base.rb +9 -21
- data/lib/ziya/{components → charts/support}/bevel.rb +1 -1
- data/lib/ziya/{components → charts/support}/blur.rb +1 -1
- data/lib/ziya/{components → charts/support}/button.rb +1 -1
- data/lib/ziya/{components → charts/support}/chart_border.rb +1 -1
- data/lib/ziya/{components → charts/support}/chart_grid_h.rb +1 -1
- data/lib/ziya/{components → charts/support}/chart_grid_v.rb +1 -1
- data/lib/ziya/{components → charts/support}/chart_guide.rb +1 -1
- data/lib/ziya/{components → charts/support}/chart_label.rb +1 -1
- data/lib/ziya/{components → charts/support}/chart_note.rb +1 -1
- data/lib/ziya/{components → charts/support}/chart_pref.rb +1 -1
- data/lib/ziya/{components → charts/support}/chart_rect.rb +1 -1
- data/lib/ziya/{components → charts/support}/chart_transition.rb +1 -1
- data/lib/ziya/{components → charts/support}/circle.rb +1 -1
- data/lib/ziya/{components → charts/support}/context_menu.rb +1 -3
- data/lib/ziya/{components → charts/support}/draw.rb +31 -8
- data/lib/ziya/{components → charts/support}/draw_base.rb +1 -1
- data/lib/ziya/{components → charts/support}/filter.rb +1 -1
- data/lib/ziya/{components → charts/support}/flash_to_javascript.rb +1 -3
- data/lib/ziya/{components → charts/support}/glow.rb +1 -1
- data/lib/ziya/{components → charts/support}/image.rb +1 -1
- data/lib/ziya/{components → charts/support}/legend.rb +1 -1
- data/lib/ziya/{components → charts/support}/line.rb +1 -1
- data/lib/ziya/{components → charts/support}/link.rb +1 -1
- data/lib/ziya/{components → charts/support}/link_data.rb +1 -1
- data/lib/ziya/{components → charts/support}/rect.rb +1 -1
- data/lib/ziya/{components → charts/support}/scroll.rb +1 -3
- data/lib/ziya/{components → charts/support}/series.rb +1 -3
- data/lib/ziya/{components → charts/support}/series_color.rb +1 -1
- data/lib/ziya/{components → charts/support}/series_explode.rb +1 -1
- data/lib/ziya/{components → charts/support}/shadow.rb +1 -1
- data/lib/ziya/{components → charts/support}/text.rb +9 -1
- data/lib/ziya/{components → charts/support}/tooltip.rb +1 -1
- data/lib/ziya/{components → charts/support}/update.rb +1 -1
- data/lib/ziya/core_ext/string.rb +31 -0
- data/lib/ziya/gauges/base.rb +17 -12
- data/lib/ziya/gauges/support/base.rb +4 -12
- data/lib/ziya/gauges/support/radial_numbers.rb +1 -1
- data/lib/ziya/html_helpers/base.rb +91 -0
- data/lib/ziya/html_helpers/charts.rb +200 -0
- data/lib/ziya/html_helpers/gauges.rb +90 -0
- data/lib/ziya/html_helpers/maps.rb +74 -0
- data/lib/ziya/html_helpers.rb +1 -0
- data/lib/ziya/maps/australia.rb +9 -0
- data/lib/ziya/maps/base.rb +409 -0
- data/lib/ziya/maps/belgium.rb +7 -0
- data/lib/ziya/maps/brazil.rb +7 -0
- data/lib/ziya/maps/canada.rb +7 -0
- data/lib/ziya/maps/europe.rb +7 -0
- data/lib/ziya/maps/france.rb +7 -0
- data/lib/ziya/maps/geocode.rb +18 -0
- data/lib/ziya/maps/germany.rb +7 -0
- data/lib/ziya/maps/italy.rb +7 -0
- data/lib/ziya/maps/mexico.rb +7 -0
- data/lib/ziya/maps/support/arc.rb +7 -0
- data/lib/ziya/maps/support/arc_color.rb +7 -0
- data/lib/ziya/maps/support/arc_range.rb +7 -0
- data/lib/ziya/maps/support/background_color.rb +7 -0
- data/lib/ziya/maps/support/base.rb +34 -0
- data/lib/ziya/maps/support/default_color.rb +7 -0
- data/lib/ziya/maps/support/default_point.rb +7 -0
- data/lib/ziya/maps/support/first_zoom.rb +7 -0
- data/lib/ziya/maps/support/heat_range.rb +35 -0
- data/lib/ziya/maps/support/hover.rb +7 -0
- data/lib/ziya/maps/support/line.rb +7 -0
- data/lib/ziya/maps/support/line_color.rb +7 -0
- data/lib/ziya/maps/support/line_range.rb +7 -0
- data/lib/ziya/maps/support/outline_color.rb +7 -0
- data/lib/ziya/maps/support/point.rb +8 -0
- data/lib/ziya/maps/support/point_range.rb +7 -0
- data/lib/ziya/maps/support/range.rb +31 -0
- data/lib/ziya/maps/support/ranges.rb +18 -0
- data/lib/ziya/maps/support/region.rb +7 -0
- data/lib/ziya/maps/support/scale_points.rb +7 -0
- data/lib/ziya/maps/support/show_name.rb +7 -0
- data/lib/ziya/maps/support/state.rb +7 -0
- data/lib/ziya/maps/support/state_info_icon.rb +7 -0
- data/lib/ziya/maps/support/zoom_mode.rb +7 -0
- data/lib/ziya/maps/support/zoom_out_button.rb +7 -0
- data/lib/ziya/maps/support/zoom_out_scale.rb +7 -0
- data/lib/ziya/maps/sweden.rb +7 -0
- data/lib/ziya/maps/uk.rb +7 -0
- data/lib/ziya/maps/us.rb +7 -0
- data/lib/ziya/maps/world.rb +7 -0
- data/lib/ziya/version.rb +3 -3
- data/lib/ziya/yaml_helpers/base.rb +20 -0
- data/lib/ziya/yaml_helpers/charts.rb +49 -0
- data/lib/ziya/yaml_helpers/gauges.rb +33 -0
- data/lib/ziya/yaml_helpers/maps.rb +17 -0
- data/lib/ziya/yaml_helpers.rb +1 -0
- data/lib/ziya.rb +20 -11
- data/resources/charts/AC_RunActiveContent.js +292 -0
- data/resources/charts/charts.swf +0 -0
- data/resources/charts/charts_library/ar3d.swf +0 -0
- data/resources/charts/charts_library/arno.swf +0 -0
- data/resources/charts/charts_library/ars3.swf +0 -0
- data/resources/charts/charts_library/arst.swf +0 -0
- data/resources/charts/charts_library/brfl.swf +0 -0
- data/resources/charts/charts_library/brno.swf +0 -0
- data/resources/charts/charts_library/brst.swf +0 -0
- data/resources/charts/charts_library/buno.swf +0 -0
- data/resources/charts/charts_library/cl3d.swf +0 -0
- data/resources/charts/charts_library/clfl.swf +0 -0
- data/resources/charts/charts_library/clim.swf +0 -0
- data/resources/charts/charts_library/clno.swf +0 -0
- data/resources/charts/charts_library/clp3.swf +0 -0
- data/resources/charts/charts_library/cls3.swf +0 -0
- data/resources/charts/charts_library/clst.swf +0 -0
- data/resources/charts/charts_library/cnno.swf +0 -0
- data/resources/charts/charts_library/dono.swf +0 -0
- data/resources/charts/charts_library/lnno.swf +0 -0
- data/resources/charts/charts_library/mxno.swf +0 -0
- data/resources/charts/charts_library/pi3d.swf +0 -0
- data/resources/charts/charts_library/piim.swf +0 -0
- data/resources/charts/charts_library/pino.swf +0 -0
- data/resources/charts/charts_library/pono.swf +0 -0
- data/resources/charts/charts_library/scno.swf +0 -0
- data/resources/charts/full_screen.swf +0 -0
- data/resources/charts/scripts/output_jpg.php +23 -0
- data/resources/charts/sliders/black.swf +0 -0
- data/resources/charts/sliders/preview_handle_1.swf +0 -0
- data/resources/charts/sliders/preview_handle_2.swf +0 -0
- data/resources/charts/themes/readme.txt +13 -0
- data/{gauges → resources/gauges}/designs/circle.yml +0 -0
- data/{gauges → resources/gauges}/designs/signal.yml +0 -0
- data/{gauges → resources/gauges}/designs/thermo.yml +0 -0
- data/{gauges → resources/gauges}/designs/title.yml +0 -0
- data/{gauges → resources/gauges}/gauge.swf +0 -0
- data/resources/maps/js/Exception.js +45 -0
- data/resources/maps/js/FlashProxy.js +72 -0
- data/resources/maps/js/FlashSerializer.js +165 -0
- data/resources/maps/js/FlashTag.js +111 -0
- data/resources/maps/js/JavaScriptFlashGateway.js +455 -0
- data/resources/maps/js/JavaScriptFlashGateway.swf +0 -0
- data/resources/maps/map_library/australia.swf +0 -0
- data/resources/maps/map_library/belgium.swf +0 -0
- data/resources/maps/map_library/brazil.swf +0 -0
- data/resources/maps/map_library/canada.swf +0 -0
- data/resources/maps/map_library/europe.swf +0 -0
- data/resources/maps/map_library/france.swf +0 -0
- data/resources/maps/map_library/germany.swf +0 -0
- data/resources/maps/map_library/italy.swf +0 -0
- data/resources/maps/map_library/mexico.swf +0 -0
- data/resources/maps/map_library/sweden.swf +0 -0
- data/resources/maps/map_library/uk_ireland.swf +0 -0
- data/resources/maps/map_library/us.swf +0 -0
- data/resources/maps/map_library/us_canada.swf +0 -0
- data/resources/maps/map_library/world.swf +0 -0
- data/resources/maps/themes/readme.txt +13 -0
- data/spec/charts/base_spec.rb +2 -2
- data/spec/charts/chart_type_spec.rb +3 -4
- data/spec/{components → charts/support}/area_spec.rb +8 -8
- data/spec/charts/support/draw_spec.rb +41 -0
- data/spec/{components → charts/support}/filter_spec.rb +6 -6
- data/spec/{components → charts/support}/link_spec.rb +6 -6
- data/spec/{components → charts/support}/series.rb +4 -4
- data/spec/{components → charts/support}/series_color_spec.rb +4 -4
- data/spec/{components → charts/support}/series_explode.rb +4 -4
- data/spec/{components → charts/support}/series_explode_spec.rb +4 -4
- data/spec/core_ext/string_spec.rb +40 -0
- data/spec/gauges/base_spec.rb +1 -1
- data/spec/html_helpers/base_spec.rb +50 -0
- data/spec/html_helpers/charts_spec.rb +23 -0
- data/spec/html_helpers/gauges_spec.rb +16 -0
- data/spec/html_helpers/maps_spec.rb +20 -0
- data/spec/maps/base_spec.rb +82 -0
- data/spec/maps/support/default_color_spec.rb +29 -0
- data/spec/maps/support/heat_range_spec.rb +29 -0
- data/spec/maps/us_spec.rb +12 -0
- data/spec/maps/world_spec.rb +18 -0
- data/spec/spec_helper.rb +5 -4
- data/spec/themes/maps/base_map.yml +81 -0
- data/spec/themes/maps/us_map.yml +6 -0
- data/spec/themes/maps/world_map.yml +6 -0
- data/spec/themes/maps/world_ov_map.yml +6 -0
- data/spec/{helpers/base_helper_spec.rb → yaml_helpers/charts_spec.rb} +10 -13
- data/spec/yaml_helpers/gauges_spec.rb +15 -0
- data/spec/ziya_helper_spec.rb +118 -116
- data/tasks/gem.rake +1 -1
- data/tasks/setup.rb +1 -1
- data/ziya.gemspec +39 -0
- metadata +259 -438
- data/lib/ziya/helpers/base_helper.rb +0 -91
- data/lib/ziya/utils/text.rb +0 -39
- data/lib/ziya/ziya_helper.rb +0 -362
- data/spec/components/draw_spec.rb +0 -37
- data/spec/utils/text_spec.rb +0 -33
@@ -0,0 +1,16 @@
|
|
1
|
+
body {
|
2
|
+
background-color: #ffffff;
|
3
|
+
font-family: "Arial","Helvetica","Verdana","sans-serif";
|
4
|
+
color: #5c5c5c;
|
5
|
+
font-size: 12px;
|
6
|
+
font-size-adjust: none;
|
7
|
+
font-stretch: normal;
|
8
|
+
font-style: normal;
|
9
|
+
font-variant: normal;
|
10
|
+
font-weight: normal;
|
11
|
+
margin: 0;
|
12
|
+
}
|
13
|
+
|
14
|
+
h1 {
|
15
|
+
color: #ff0000;
|
16
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<div style="margin-left:5px">
|
2
|
+
<h1>ZiYa map examples</h1>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<div style="text-align:center;">
|
6
|
+
<div style="float:left;width:49%;border:1px black solid;margin:0px 5px 0px 5px;">
|
7
|
+
<h2>Basic map</h2>
|
8
|
+
<%= ziya_map '/load_map_1', :map_type => :us, :id => "map_1", :size => '400x300' %>
|
9
|
+
</div>
|
10
|
+
<div style="width:49%;border:1px black solid;overflow:auto;margin:0px 5px 0px 0px;">
|
11
|
+
<h2>Drillable/Updatable map</h2>
|
12
|
+
<%= ziya_map '/load_map_2', :map_type => :us, :id => "map2", :size => '400x300' %>
|
13
|
+
<a id="link" href="/goes_nowhere">Refresh Map...</a>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
|
18
|
+
<script type="text/javascript">
|
19
|
+
var flashProxy = new FlashProxy( 'map2', '/maps/js/JavaScriptFlashGateway.swf' );
|
20
|
+
$( function() {
|
21
|
+
$('a').click( function( event ) {
|
22
|
+
flashProxy.call( 'refreshData', '/refresh_map_2' );
|
23
|
+
event.preventDefault();
|
24
|
+
});
|
25
|
+
});
|
26
|
+
</script>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
+
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
6
|
+
<title>ZiYa Maps</title>
|
7
|
+
<link href="/stylesheets/map.css" media="screen" type="text/css" rel="stylesheet" />
|
8
|
+
<script src="/javascripts/jquery-1.3.2.js" type="text/javascript" ></script>
|
9
|
+
|
10
|
+
<script src="/maps/js/Exception.js" type="text/javascript" ></script>
|
11
|
+
<script src="/maps/js/FlashTag.js" type="text/javascript" ></script>
|
12
|
+
<script src="/maps/js/FlashProxy.js" type="text/javascript" ></script>
|
13
|
+
<script src="/maps/js/FlashSerializer.js" type="text/javascript" ></script>
|
14
|
+
</head>
|
15
|
+
|
16
|
+
<body>
|
17
|
+
<%= yield %>
|
18
|
+
</body>
|
19
|
+
|
20
|
+
</html>
|
21
|
+
|
data/lib/ziya/charts/base.rb
CHANGED
@@ -11,7 +11,9 @@
|
|
11
11
|
# Author:: Fernand Galiana
|
12
12
|
# Date:: Dec 15th, 2006
|
13
13
|
# -----------------------------------------------------------------------------
|
14
|
-
require 'ziya/
|
14
|
+
require 'ziya/html_helpers'
|
15
|
+
require 'ziya/html_helpers/charts'
|
16
|
+
require 'ziya/yaml_helpers/charts'
|
15
17
|
require 'yaml'
|
16
18
|
|
17
19
|
module Ziya::Charts
|
@@ -21,7 +23,7 @@ module Ziya::Charts
|
|
21
23
|
# you must create a theme directory in your application public/charts/themes dir. And
|
22
24
|
# reference it via the #add method using the :theme directive.
|
23
25
|
class Base
|
24
|
-
include Ziya::
|
26
|
+
include Ziya::YamlHelpers::Charts, Ziya::HtmlHelpers::Charts
|
25
27
|
|
26
28
|
# =========================================================================
|
27
29
|
protected
|
@@ -166,6 +168,7 @@ module Ziya::Charts
|
|
166
168
|
# TODO Validation categories = series, series = labels, etc...
|
167
169
|
directive = args.shift
|
168
170
|
case directive
|
171
|
+
# BOZO !! Idea - could use a formatter object to specificy how you want to format this series
|
169
172
|
when :axis_category_text
|
170
173
|
categories = args.first.is_a?(Array) ? args.shift : []
|
171
174
|
raise ArgumentError, "Must specify an array of categories" if categories.empty?
|
@@ -173,6 +176,7 @@ module Ziya::Charts
|
|
173
176
|
categs = categories.clone
|
174
177
|
categs.insert( 0, nil )
|
175
178
|
@options[directive] = categs
|
179
|
+
# BOZO !! Need to constrain this only scatter and bubble support this !!
|
176
180
|
when :axis_category_label
|
177
181
|
labels = args.first.is_a?(Array) ? args.shift : []
|
178
182
|
raise ArgumentError, "Must specify an array of category labels" if labels.empty?
|
@@ -239,7 +243,7 @@ module Ziya::Charts
|
|
239
243
|
@xml.chart do
|
240
244
|
@xml.license( @license ) unless @license.nil?
|
241
245
|
if render_parents?
|
242
|
-
if
|
246
|
+
if @type
|
243
247
|
@xml.chart_type( @type )
|
244
248
|
elsif @options[:chart_types].is_a? Array and ! @options[:chart_types].empty?
|
245
249
|
@xml.chart_type do
|
@@ -268,16 +272,15 @@ module Ziya::Charts
|
|
268
272
|
|
269
273
|
# load yaml file associated with class if any
|
270
274
|
def inflate( clazz, theme, instance=nil )
|
271
|
-
class_name =
|
275
|
+
class_name = clazz.to_s.gsub( /Ziya::Charts/, '' ).underscore.gsub( /\//, '' )
|
272
276
|
class_name += '_chart' unless class_name.match( /.?_chart$/ )
|
273
277
|
begin
|
274
278
|
file_name = "#{theme}/#{class_name}"
|
275
279
|
file_name = "#{theme}/#{instance}" unless instance.nil?
|
276
280
|
Ziya.logger.debug ">>> Ziya attempt to load style sheet file '#{file_name}"
|
277
281
|
yml = IO.read( "#{file_name}.yml" )
|
278
|
-
# Ziya.logger.debug( yml )
|
279
282
|
load = YAML::load( erb_render( yml ) )
|
280
|
-
Ziya.logger.
|
283
|
+
Ziya.logger.debug ">>> ZiYa [loading styles] -- #{file_name}.yml"
|
281
284
|
return load
|
282
285
|
rescue SystemCallError => boom
|
283
286
|
; # ignore if no style file...
|
@@ -296,7 +299,7 @@ module Ziya::Charts
|
|
296
299
|
|
297
300
|
# generates category axis data points
|
298
301
|
def gen_axis_category
|
299
|
-
categories = @options[:axis_category_text]
|
302
|
+
categories = @options[:axis_category_text] || []
|
300
303
|
@xml.row do
|
301
304
|
categories.each do |category|
|
302
305
|
case
|
@@ -335,12 +338,12 @@ module Ziya::Charts
|
|
335
338
|
def gen_chart_data( series )
|
336
339
|
block = lambda {
|
337
340
|
series[:points].each do |row|
|
338
|
-
if row
|
341
|
+
if !row
|
339
342
|
@xml.null
|
340
|
-
elsif row.instance_of?
|
343
|
+
elsif row.instance_of?(Hash)
|
341
344
|
# don't side effect the original series
|
342
345
|
the_clone = row.clone
|
343
|
-
value
|
346
|
+
value = the_clone.delete( :value )
|
344
347
|
gen_row_data( value, the_clone, @xml )
|
345
348
|
else
|
346
349
|
gen_row_data( row, nil, @xml )
|
@@ -357,9 +360,7 @@ module Ziya::Charts
|
|
357
360
|
|
358
361
|
# lay down graph data points and labels if any
|
359
362
|
# TODO Validate series sizes/label sizes
|
360
|
-
def setup_series
|
361
|
-
# raise "You must specify an axis_category_text with your series." if !@series_desc.empty? and ! @options[:axis_category_text]
|
362
|
-
|
363
|
+
def setup_series
|
363
364
|
if @options[:axis_category_text]
|
364
365
|
@xml.chart_data do
|
365
366
|
gen_axis_category
|
@@ -453,7 +454,7 @@ module Ziya::Charts
|
|
453
454
|
# Setup instance vars
|
454
455
|
Base.components.each do |comp|
|
455
456
|
instance_var = lambda { |v| self.instance_eval{ instance_variable_set "@#{comp}", v } }
|
456
|
-
instance_var.call(Ziya::
|
457
|
+
instance_var.call(Ziya::Charts::Support.const_get( comp.to_s.classify ).new)
|
457
458
|
end
|
458
459
|
end
|
459
460
|
end
|
@@ -3,9 +3,9 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Fernand Galiana
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
require 'ziya/
|
6
|
+
require 'ziya/charts/support/base'
|
7
7
|
|
8
|
-
module Ziya::
|
8
|
+
module Ziya::Charts::Support
|
9
9
|
# Creates a linkable area on the chart to use with the link component.
|
10
10
|
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=link
|
11
11
|
# for additional documentation, examples and futher detail.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Fernand
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
module Ziya::
|
6
|
+
module Ziya::Charts::Support
|
7
7
|
# Specifies the label attributes on the x or y axis depending on the chart type.
|
8
8
|
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=axis_category
|
9
9
|
# for additional documentation, examples and futher detail.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Fernand
|
5
5
|
# ------------------------------------------------------------------------------
|
6
|
-
module Ziya::
|
6
|
+
module Ziya::Charts::Support
|
7
7
|
# Sets the tick marks on the chart axes.
|
8
8
|
#
|
9
9
|
# <tt>value_ticks</tt>: A boolean value that indicates whether the ticks on the value axis are visible or not.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Fernand Galiana
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
module Ziya::
|
6
|
+
module Ziya::Charts::Support
|
7
7
|
# Specifies the label attribute on the x or y axis depending on the chart type.
|
8
8
|
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=axis_value
|
9
9
|
# for additional documentation, examples and futher detail.
|
@@ -7,9 +7,10 @@
|
|
7
7
|
# Author:: Fernand Galiana
|
8
8
|
# Date:: Dec 15th, 2006
|
9
9
|
# -----------------------------------------------------------------------------
|
10
|
-
|
10
|
+
require 'ziya/core_ext/string'
|
11
|
+
|
12
|
+
module Ziya::Charts::Support
|
11
13
|
class Base # :nodoc:
|
12
|
-
include Ziya::Utils::Text
|
13
14
|
|
14
15
|
# class methods...
|
15
16
|
class << self
|
@@ -59,10 +60,11 @@ module Ziya::Components
|
|
59
60
|
end
|
60
61
|
end
|
61
62
|
|
63
|
+
# -------------------------------------------------------------------------
|
64
|
+
# Flattens out this component to xml
|
62
65
|
def flatten( xml )
|
63
|
-
hash
|
64
|
-
|
65
|
-
pref = underscore( clazz )
|
66
|
+
hash = has_sub_components
|
67
|
+
pref = self.class.name.demodulize.underscore
|
66
68
|
if hash and ! hash.empty?
|
67
69
|
self.class.module_eval <<-XML
|
68
70
|
xml.#{pref}( #{options_as_string} ) do
|
@@ -74,20 +76,6 @@ module Ziya::Components
|
|
74
76
|
end
|
75
77
|
end
|
76
78
|
|
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
79
|
# -------------------------------------------------------------------------
|
92
80
|
# checks if a give component properties have been set.
|
93
81
|
# return true if one or more props have been set. False otherwise...
|
@@ -110,7 +98,7 @@ module Ziya::Components
|
|
110
98
|
options = {}
|
111
99
|
attributes_for(self).each do |p|
|
112
100
|
option = self.send(p.to_sym)
|
113
|
-
options[p] = option
|
101
|
+
options[p] = option if option
|
114
102
|
end
|
115
103
|
options
|
116
104
|
end
|
@@ -122,7 +110,7 @@ module Ziya::Components
|
|
122
110
|
opts = options
|
123
111
|
opts.keys.sort{ |a,b| a.to_s <=> b.to_s }.each do |k|
|
124
112
|
value = opts[k]
|
125
|
-
buff << sprintf( ":%s => '%s'", k, value.to_s ) if
|
113
|
+
buff << sprintf( ":%s => '%s'", k, value.to_s ) if value and !value.is_a? YAML::Omap
|
126
114
|
end
|
127
115
|
buff.join( "," )
|
128
116
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Fernand
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
module Ziya::
|
6
|
+
module Ziya::Charts::Support
|
7
7
|
# Specifies the bevel filter to be applied to some component ie chart_rect, axis_value, etc...
|
8
8
|
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=filter
|
9
9
|
# for additional documentation, examples and futher detail.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Fernand Galiana
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
module Ziya::
|
6
|
+
module Ziya::Charts::Support
|
7
7
|
# Specifies the blur filter to be applied to some component ie chart_rect, axis_value, etc...
|
8
8
|
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=filter
|
9
9
|
# for additional documentation, examples and futher detail.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Fernand Galiana
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
module Ziya::
|
6
|
+
module Ziya::Charts::Support
|
7
7
|
# Button component to draw a a button on the chart.
|
8
8
|
# Must be set up within the draw component.
|
9
9
|
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=draw
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Fernand
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
module Ziya::
|
6
|
+
module Ziya::Charts::Support
|
7
7
|
# Specifies how to render a chart border
|
8
8
|
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=chart_border
|
9
9
|
# for additional documentation, examples and futher detail.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Fernand
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
module Ziya::
|
6
|
+
module Ziya::Charts::Support
|
7
7
|
# Sets the chart's horizontal grid attributes.
|
8
8
|
#
|
9
9
|
# <tt>thickness</tt>: The thickness of the grid's horizontal lines. Valid values are zero and above.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Fernand
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
module Ziya::
|
6
|
+
module Ziya::Charts::Support
|
7
7
|
# Sets the chart's vertical grid attributes.
|
8
8
|
#
|
9
9
|
# <tt>thickness</tt>: The thickness of the grid's vertical lines. Valid values are zero and above.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Fernand Galiana
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
module Ziya::
|
6
|
+
module Ziya::Charts::Support
|
7
7
|
# Specifies how to configure a guide for either axis on a chart
|
8
8
|
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=chart_guide
|
9
9
|
# for additional documentation, examples and futher detail.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Fernand Galiana
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
module Ziya::
|
6
|
+
module Ziya::Charts::Support
|
7
7
|
# Specifies the label for the chart element actual value. This can be setup to
|
8
8
|
# be fixed or as a tooltip
|
9
9
|
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=chart_label
|
@@ -6,7 +6,7 @@
|
|
6
6
|
#
|
7
7
|
# Author:: Fernand Galiana
|
8
8
|
# -----------------------------------------------------------------------------
|
9
|
-
module Ziya::
|
9
|
+
module Ziya::Charts::Support
|
10
10
|
# Specifies an annotation look and feel on a chart.
|
11
11
|
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=chart_note
|
12
12
|
# for additional documentation, examples and futher detail.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Fernand Galiana
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
module Ziya::
|
6
|
+
module Ziya::Charts::Support
|
7
7
|
# Sets the preferences for some chart types. Each chart type has different preferences,
|
8
8
|
# or no preferences at all.
|
9
9
|
#
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Fernand Galiana
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
module Ziya::
|
6
|
+
module Ziya::Charts::Support
|
7
7
|
# Sets the chart's rectangle
|
8
8
|
#
|
9
9
|
# <tt>x</tt>: The horizontal position of the rectangle's upper left corner relative to the upper
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Fernand Galiana
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
module Ziya::
|
6
|
+
module Ziya::Charts::Support
|
7
7
|
# Sets the transition attributes for the chart elements.
|
8
8
|
#
|
9
9
|
# <tt>type</tt>: The type of the transition. Valid values are dissolve, drop, spin, scale, zoom,
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Fernand Galiana
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
module Ziya::
|
6
|
+
module Ziya::Charts::Support
|
7
7
|
# Circle component to draw a circle on the chart. Must be set up within the draw
|
8
8
|
# component.
|
9
9
|
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=draw
|
@@ -3,9 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Fernand Galiana
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
|
7
|
-
|
8
|
-
module Ziya::Components
|
6
|
+
module Ziya::Charts::Support
|
9
7
|
# Refines the default context menu by adding or removing default options
|
10
8
|
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=context_menu
|
11
9
|
# for additional documentation, examples and futher detail.
|
@@ -3,9 +3,9 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Fernand Galiana
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
require 'ziya/
|
6
|
+
require 'ziya/html_helpers/charts'
|
7
7
|
|
8
|
-
module Ziya::
|
8
|
+
module Ziya::Charts::Support
|
9
9
|
# Sets up a drawing area on the chart to draw text, rect, circles...
|
10
10
|
#
|
11
11
|
# Holds any number of elements to draw. A draw element can be a circle, image (JPEG or SWF),
|
@@ -18,11 +18,10 @@ module Ziya::Components
|
|
18
18
|
# for additional documentation, examples and futher detail.
|
19
19
|
#
|
20
20
|
class Draw < Base
|
21
|
-
include Ziya::
|
21
|
+
include Ziya::HtmlHelpers::Charts
|
22
22
|
|
23
23
|
has_attribute :components
|
24
|
-
|
25
|
-
|
24
|
+
|
26
25
|
# -------------------------------------------------------------------------
|
27
26
|
# Dump has_attribute into xml element
|
28
27
|
def flatten( xml, composite_urls=nil )
|
@@ -36,10 +35,34 @@ module Ziya::Components
|
|
36
35
|
|
37
36
|
# -------------------------------------------------------------------------
|
38
37
|
# Generates Draw component for composite charts
|
39
|
-
def gen_composites( xml, composite_urls )
|
40
|
-
composite_urls.
|
41
|
-
|
38
|
+
def gen_composites( xml, composite_urls )
|
39
|
+
composite_urls.keys.sort{ |a,b| a.to_s <=> b.to_s }.each do |chart_id|
|
40
|
+
# composite descriptor can either be a string for the comp url or a pair for the swf lib_path and url
|
41
|
+
raise "You must specify a hash of options" unless composite_urls[chart_id].is_a? Hash
|
42
|
+
opts = composite_urls[chart_id].clone
|
43
|
+
url = opts.delete( :url )
|
44
|
+
raise "Unable to find composite chart url" unless url
|
45
|
+
path = opts.delete(:path ) || chart_path
|
46
|
+
opts[:url] = gen_composite_path( path, url, chart_id )
|
47
|
+
|
48
|
+
self.class.module_eval <<-XML
|
49
|
+
xml.image( #{opts_as_string( opts )} )
|
50
|
+
XML
|
51
|
+
|
52
|
+
# xml.image( opts )
|
42
53
|
end
|
43
54
|
end
|
55
|
+
|
56
|
+
# -------------------------------------------------------------------------
|
57
|
+
# Turns options hash into string representation
|
58
|
+
def opts_as_string( opts )
|
59
|
+
buff = []
|
60
|
+
opts.keys.sort{ |a,b| a.to_s <=> b.to_s }.each do |k|
|
61
|
+
value = opts[k]
|
62
|
+
buff << sprintf( ":%s => '%s'", k, value.to_s ) if value
|
63
|
+
end
|
64
|
+
buff.join( "," )
|
65
|
+
end
|
66
|
+
|
44
67
|
end
|
45
68
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
#
|
7
7
|
# Author:: Fernand
|
8
8
|
# -----------------------------------------------------------------------------
|
9
|
-
module Ziya::
|
9
|
+
module Ziya::Charts::Support
|
10
10
|
# Specifies the various filters that can be reused across components ie blur, bevel, glow, etc...
|
11
11
|
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=filter
|
12
12
|
# for additional documentation, examples and futher detail.
|
@@ -4,9 +4,7 @@
|
|
4
4
|
#
|
5
5
|
# Author:: Fernand Galiana
|
6
6
|
# -----------------------------------------------------------------------------
|
7
|
-
|
8
|
-
|
9
|
-
module Ziya::Components
|
7
|
+
module Ziya::Charts::Support
|
10
8
|
# Toggles flash to js callbacks.
|
11
9
|
#
|
12
10
|
# === Example
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Fernand Galiana
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
module Ziya::
|
6
|
+
module Ziya::Charts::Support
|
7
7
|
# Specifies the glow filter to be applied to some component ie chart_rect, axis_value, etc...
|
8
8
|
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=filter
|
9
9
|
# for additional documentation, examples and futher detail.
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# Author:: Fernand Galiana
|
6
6
|
# Date:: Dec 15th, 2006
|
7
7
|
# -----------------------------------------------------------------------------
|
8
|
-
module Ziya::
|
8
|
+
module Ziya::Charts::Support
|
9
9
|
# Renders the specified image (jpg/gif) on the chart. Must be set up within the draw
|
10
10
|
# component.
|
11
11
|
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=draw
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Fernand Galiana
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
module Ziya::
|
6
|
+
module Ziya::Charts::Support
|
7
7
|
# Renders a legend on the chart
|
8
8
|
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=legend
|
9
9
|
# for additional documentation, examples and futher detail.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Fernand Galiana
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
module Ziya::
|
6
|
+
module Ziya::Charts::Support
|
7
7
|
# Line component to draw a line on the chart. Must be set up within the draw
|
8
8
|
# component.
|
9
9
|
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=draw
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Fernand Galiana
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
module Ziya::
|
6
|
+
module Ziya::Charts::Support
|
7
7
|
# Sets up clickable areas on the chart.
|
8
8
|
#
|
9
9
|
# Holds any number of areas, each defining a rectangle and a URL to go to when the user
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Fernand Galiana
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
module Ziya::
|
6
|
+
module Ziya::Charts::Support
|
7
7
|
# Sets the URL of a script responsible for processing clicks on chart elements.
|
8
8
|
# This enables drilling down into charts.
|
9
9
|
#
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Fernand Galiana
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
module Ziya::
|
6
|
+
module Ziya::Charts::Support
|
7
7
|
# Rect component to draw a rectangle on the chart. Must be set up within the draw
|
8
8
|
# component.
|
9
9
|
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=draw
|
@@ -4,9 +4,7 @@
|
|
4
4
|
# Author:: Fernand Galiana
|
5
5
|
# Date:: Dec 15th, 2006
|
6
6
|
# -----------------------------------------------------------------------------
|
7
|
-
|
8
|
-
|
9
|
-
module Ziya::Components
|
7
|
+
module Ziya::Charts::Support
|
10
8
|
# Specifies the ability to scroll a chart by setting single or double sliders
|
11
9
|
# on the chart.
|
12
10
|
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=scroll
|
@@ -3,9 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Author:: Fernand Galiana
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
|
7
|
-
|
8
|
-
module Ziya::Components
|
6
|
+
module Ziya::Charts::Support
|
9
7
|
# Specifies the gap betwen cols/bars and gap between series for column and bar
|
10
8
|
# charts only.
|
11
9
|
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=series
|