derailed-ziya 2.0.6 → 2.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +59 -2
- data/README.txt +63 -54
- data/Rakefile +2 -2
- data/charts/charts.swf +0 -0
- data/charts/charts_library/ar3d.swf +0 -0
- data/charts/charts_library/arno.swf +0 -0
- data/charts/charts_library/ars3.swf +0 -0
- data/charts/charts_library/arst.swf +0 -0
- data/charts/charts_library/brfl.swf +0 -0
- data/charts/charts_library/brno.swf +0 -0
- data/charts/charts_library/brst.swf +0 -0
- data/charts/charts_library/buno.swf +0 -0
- data/charts/charts_library/cl3d.swf +0 -0
- data/charts/charts_library/clfl.swf +0 -0
- data/charts/charts_library/clim.swf +0 -0
- data/charts/charts_library/clno.swf +0 -0
- data/charts/charts_library/clp3.swf +0 -0
- data/charts/charts_library/cls3.swf +0 -0
- data/charts/charts_library/clst.swf +0 -0
- data/charts/charts_library/cnno.swf +0 -0
- data/charts/charts_library/dono.swf +0 -0
- data/charts/charts_library/lnno.swf +0 -0
- data/charts/charts_library/mxno.swf +0 -0
- data/charts/charts_library/pi3d.swf +0 -0
- data/charts/charts_library/piim.swf +0 -0
- data/charts/charts_library/pino.swf +0 -0
- data/charts/charts_library/pono.swf +0 -0
- data/charts/charts_library/scno.swf +0 -0
- data/charts/themes/readme.txt +13 -0
- data/lib/ziya/charts/base.rb +124 -182
- data/lib/ziya/charts/custom.rb +18 -0
- data/lib/ziya/charts/image_column.rb +18 -0
- data/lib/ziya/charts/image_pie.rb +18 -0
- data/lib/ziya/components/area.rb +2 -3
- data/lib/ziya/components/button.rb +18 -0
- data/lib/ziya/components/chart_guide.rb +4 -2
- data/lib/ziya/components/chart_note.rb +18 -0
- data/lib/ziya/components/draw.rb +4 -6
- data/lib/ziya/components/flash_to_javascript.rb +25 -0
- data/lib/ziya/components/tooltip.rb +20 -0
- data/lib/ziya/helpers/base_helper.rb +4 -4
- data/lib/ziya/version.rb +1 -1
- data/lib/ziya/ziya_helper.rb +32 -19
- data/release_notes.txt +10 -0
- data/spec/charts/base_spec.rb +7 -6
- data/spec/charts/chart_type_spec.rb +8 -0
- data/spec/components/draw_spec.rb +9 -4
- data/spec/ziya_helper_spec.rb +1 -1
- data/tasks/doc.rake +12 -7
- metadata +132 -3
@@ -0,0 +1,20 @@
|
|
1
|
+
# -----------------------------------------------------------------------------
|
2
|
+
# Describes the look and feel for a chart annotation. An annotation must be
|
3
|
+
# added using the Chart#add( :series) call using the hash definition ie
|
4
|
+
#
|
5
|
+
# chart.add( :series, "fred", [ { :value => 10, :tooltip => "Hi there !"} ] )
|
6
|
+
#
|
7
|
+
# Author:: Fernand Galiana
|
8
|
+
# -----------------------------------------------------------------------------
|
9
|
+
module Ziya::Components
|
10
|
+
# Specifies the label for the chart element actual value. This can be setup to
|
11
|
+
# be fixed or as a tooltip
|
12
|
+
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=tooltip
|
13
|
+
# for additional documentation, examples and futher detail.
|
14
|
+
class Tooltip < Base
|
15
|
+
has_attribute :font, :bold, :size, :color, :alpha,
|
16
|
+
:background_color, :background_alpha,
|
17
|
+
:duration,
|
18
|
+
:shadow, :bevel, :glow, :blur
|
19
|
+
end
|
20
|
+
end
|
@@ -10,11 +10,11 @@ module Ziya::Helpers
|
|
10
10
|
# generates a swf chart path from the given url. Used as helper to embed a chart
|
11
11
|
# within a chart
|
12
12
|
# ==== Example
|
13
|
-
# <%= chart_url( chart_1_path ) %>
|
13
|
+
# <%= chart_url( chart_1_path, "fred" ) %>
|
14
14
|
#
|
15
|
-
# => /charts/charts.swf?library_path=/charts/charts_library&xml_source=http://fred/load_chart_1.xml
|
16
|
-
def chart_url( url, swf_chart_dir="/charts" )
|
17
|
-
gen_composite_path( swf_chart_dir, url )
|
15
|
+
# => /charts/charts.swf?library_path=/charts/charts_library&xml_source=http://fred/load_chart_1.xml&chart_id=fred
|
16
|
+
def chart_url( url, swf_chart_dir="/charts", id=nil )
|
17
|
+
gen_composite_path( swf_chart_dir, url, id )
|
18
18
|
end
|
19
19
|
|
20
20
|
# indent yaml content vy multiples of 2 spaces
|
data/lib/ziya/version.rb
CHANGED
data/lib/ziya/ziya_helper.rb
CHANGED
@@ -11,17 +11,22 @@ module Ziya
|
|
11
11
|
|
12
12
|
# generates a javascript tag to include the js script to create object and
|
13
13
|
# embed tags
|
14
|
-
def ziya_javascript_include_tag
|
14
|
+
def ziya_javascript_include_tag( opts={} )
|
15
|
+
options = { :swf_path => chart_path,
|
16
|
+
:major_vers => 9,
|
17
|
+
:minor_vers => 0,
|
18
|
+
:req_vers => 45 }.merge!( opts )
|
19
|
+
|
15
20
|
js = <<-JS
|
16
21
|
<script language="javascript" type="text/javascript">
|
17
22
|
AC_FL_RunContent = 0;
|
18
23
|
DetectFlashVer = 0;
|
19
24
|
</script>
|
20
|
-
<script src="/
|
25
|
+
<script src="#{options[:swf_path]}/AC_RunActiveContent.js" language="javascript"></script>
|
21
26
|
<script language="javascript" type="text/javascript">
|
22
|
-
var requiredMajorVersion =
|
23
|
-
var requiredMinorVersion =
|
24
|
-
var requiredRevision =
|
27
|
+
var requiredMajorVersion = #{options[:major_vers]};
|
28
|
+
var requiredMinorVersion = #{options[:minor_vers]};
|
29
|
+
var requiredRevision = #{options[:req_vers]};
|
25
30
|
</script>
|
26
31
|
JS
|
27
32
|
end
|
@@ -52,7 +57,7 @@ module Ziya
|
|
52
57
|
# setup width and height
|
53
58
|
setup_movie_size( options )
|
54
59
|
|
55
|
-
flash_vars = url ? charts_swf :
|
60
|
+
flash_vars = url ? charts_swf : charts_swf_base
|
56
61
|
xml_swf_path = flash_vars % [options[:swf_path], escape_url(url)]
|
57
62
|
xml_swf_path << "&chart_id=#{options[:id]}"
|
58
63
|
xml_swf_path << "×tamp=#{Time.now.to_i}" if options[:cache] == false
|
@@ -135,29 +140,37 @@ module Ziya
|
|
135
140
|
:use_stage => false
|
136
141
|
}.merge!(chart_options)
|
137
142
|
|
138
|
-
flash_vars = url ? charts_swf :
|
143
|
+
flash_vars = url ? charts_swf : charts_swf_base
|
139
144
|
generate_flash_tag( url, flash_vars, "charts.swf", options )
|
140
145
|
end
|
141
146
|
|
142
147
|
# flash chart library path
|
143
|
-
def gen_composite_path( swf_chart_dir, url )
|
144
|
-
|
148
|
+
def gen_composite_path( swf_chart_dir, url, chart_id=null )
|
149
|
+
buff = ""
|
150
|
+
if url
|
151
|
+
buff = composite_url % [swf_chart_dir, swf_chart_dir, escape_url( url )]
|
152
|
+
else
|
153
|
+
buff = composite_base_url % [swf_chart_dir, swf_chart_dir]
|
154
|
+
end
|
155
|
+
buff << "&chart_id=#{chart_id}" if chart_id
|
156
|
+
buff
|
145
157
|
end
|
146
158
|
|
147
159
|
# =========================================================================
|
148
160
|
# private
|
149
161
|
|
150
162
|
# Const accessors...
|
151
|
-
def mime()
|
152
|
-
def
|
153
|
-
def
|
154
|
-
def
|
155
|
-
def
|
156
|
-
def
|
157
|
-
def
|
158
|
-
def
|
159
|
-
def
|
160
|
-
def
|
163
|
+
def mime() "application/x-shockwave-flash"; end
|
164
|
+
def composite_base_url() "%s/charts.swf?library_path=%s/charts_library" end
|
165
|
+
def composite_url() "#{composite_base_url}&xml_source=%s" end
|
166
|
+
def charts_swf_base() "library_path=%s/charts_library"; end
|
167
|
+
def charts_swf() "#{charts_swf_base}&xml_source=%s"; end
|
168
|
+
def plugin_url() "http://www.macromedia.com/go/getflashplayer"; end
|
169
|
+
def gauges_swf() "%s/gauge.swf?xml_source=%s"; end
|
170
|
+
def gauge_path() "/gauges"; end
|
171
|
+
def chart_path() "/charts"; end
|
172
|
+
def class_id() "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" end
|
173
|
+
def codebase() "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,45,0"; end
|
161
174
|
|
162
175
|
# generates swf path
|
163
176
|
def gen_swf_path( path_directive, swf_dir, url )
|
data/release_notes.txt
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
2.0.0 - Gem release - Update to xml/swf 5.0.2 added xml/gauge 1.6
|
2
|
+
2.0.1 - Update for xml/swf 5.0.3
|
3
|
+
2.0.2 - Changed logging required to 0.9.X - Update to xml/swf 5.0.4
|
4
|
+
2.0.3 - README file update - Thanks to Paul James !
|
5
|
+
2.0.4 - Fixed missing encoding on composite urls - published gem on github
|
6
|
+
2.0.5 - Fixed merb app support issue
|
7
|
+
2.0.6 - Updates to support xml/swf 5.0.5
|
8
|
+
Fixed configuration with stacked 3d area charts
|
9
|
+
Added support for nil url in ziya_chart_helper - This allows to get a js callback when the
|
10
|
+
chart loads and populate the charts xml via javascript
|
data/spec/charts/base_spec.rb
CHANGED
@@ -40,11 +40,11 @@ describe Ziya::Charts::Base do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
it "should support setting a composite chart urls" do
|
43
|
-
@chart.add( :composites,
|
44
|
-
@chart.to_xml.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?><chart></chart>"
|
43
|
+
@chart.add( :composites, { :fred => "url1", :blee => "url2" } )
|
44
|
+
@chart.to_xml.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?><chart><draw><image url=\"/charts/charts.swf?library_path=/charts/charts_library&xml_source=url1&chart_id=fred\"/><image url=\"/charts/charts.swf?library_path=/charts/charts_library&xml_source=url2&chart_id=blee\"/></draw></chart>"
|
45
45
|
end
|
46
46
|
it "should error if the composite url arg is not an array" do
|
47
|
-
lambda { @chart.add( :composites, "") }.should raise_error( ArgumentError, /
|
47
|
+
lambda { @chart.add( :composites, "") }.should raise_error( ArgumentError, /hash of id => url/ )
|
48
48
|
end
|
49
49
|
|
50
50
|
it "should support setting the axis_value label" do
|
@@ -88,10 +88,11 @@ describe Ziya::Charts::Base do
|
|
88
88
|
@chart.add( :series, "test", [ 10, 20 ], "some_url" )
|
89
89
|
@chart.to_xml.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?><chart><chart_data><row><null/><string>dog</string><string>cat</string></row><row url=\"some_url\"><string>test</string><number>10</number><number>20</number></row></chart_data></chart>"
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
|
+
# BOZO !! Review
|
92
93
|
it "should error if a series is defined but no axis_category is specified" do
|
93
|
-
@chart.add( :series, "test", [10,20] )
|
94
|
-
lambda { @chart.to_xml }.should raise_error( RuntimeError, /axis_category_text/i )
|
94
|
+
# @chart.add( :series, "test", [10,20] )
|
95
|
+
# lambda { @chart.to_xml }.should raise_error( RuntimeError, /axis_category_text/i )
|
95
96
|
end
|
96
97
|
|
97
98
|
it "should accept a series with no name" do
|
@@ -26,6 +26,12 @@ describe Ziya::Charts::Base do
|
|
26
26
|
StackedBar
|
27
27
|
StackedColumn
|
28
28
|
StackedThreedColumn
|
29
|
+
StackedThreedArea
|
30
|
+
AreaThreed
|
31
|
+
Donut
|
32
|
+
ImagePie
|
33
|
+
ImageColumn
|
34
|
+
Custom
|
29
35
|
]
|
30
36
|
end
|
31
37
|
|
@@ -40,6 +46,8 @@ describe Ziya::Charts::Base do
|
|
40
46
|
else
|
41
47
|
chart.type.gsub(/ /, '' ).should == "3d" + match[1].downcase
|
42
48
|
end
|
49
|
+
elsif type == "Custom"
|
50
|
+
chart.type.should be_empty
|
43
51
|
else
|
44
52
|
chart.type.gsub(/ /, '' ).should == type.downcase unless type == "Mixed"
|
45
53
|
end
|
@@ -2,10 +2,10 @@ require File.expand_path(File.join(File.dirname(__FILE__), %w[.. spec_helper]))
|
|
2
2
|
|
3
3
|
describe Ziya::Components::Draw do
|
4
4
|
before( :each ) do
|
5
|
-
@comp
|
5
|
+
@comp = Ziya::Components::Draw.new
|
6
6
|
circle = Ziya::Components::Circle.new
|
7
7
|
circle.radius = 10
|
8
|
-
image
|
8
|
+
image = Ziya::Components::Image.new
|
9
9
|
image.x = 10
|
10
10
|
@comp.components = [circle, image]
|
11
11
|
end
|
@@ -25,8 +25,13 @@ describe Ziya::Components::Draw do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it "should support composite charts" do
|
28
|
-
urls =
|
29
|
-
@comp.flatten( @xml, urls ).should == "<draw><circle radius=\"10\"/><image x=\"10\"/><image url=\"/charts/charts.swf?library_path=/charts/charts_library&xml_source=%2Ffred\"/><image url=\"/charts/charts.swf?library_path=/charts/charts_library&xml_source=%2Fblee\"/></draw>"
|
28
|
+
urls = { :fred => "/fred", :blee => "/blee" }
|
29
|
+
@comp.flatten( @xml, urls ).should == "<draw><circle radius=\"10\"/><image x=\"10\"/><image url=\"/charts/charts.swf?library_path=/charts/charts_library&xml_source=%2Ffred&chart_id=fred\"/><image url=\"/charts/charts.swf?library_path=/charts/charts_library&xml_source=%2Fblee&chart_id=blee\"/></draw>"
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should support js based composite chart" do
|
33
|
+
urls = { :fred => nil }
|
34
|
+
@comp.flatten( @xml, urls ).should == "<draw><circle radius=\"10\"/><image x=\"10\"/><image url=\"/charts/charts.swf?library_path=/charts/charts_library&chart_id=fred\"/></draw>"
|
30
35
|
end
|
31
36
|
end
|
32
37
|
end
|
data/spec/ziya_helper_spec.rb
CHANGED
data/tasks/doc.rake
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# $Id$
|
2
|
-
|
3
2
|
require 'rake/rdoctask'
|
3
|
+
gem 'darkfish-rdoc'
|
4
|
+
require 'darkfish-rdoc'
|
5
|
+
|
4
6
|
|
5
7
|
namespace :doc do
|
6
8
|
|
@@ -12,17 +14,20 @@ namespace :doc do
|
|
12
14
|
incl = Regexp.new(PROJ.rdoc_include.join('|'))
|
13
15
|
excl = Regexp.new(PROJ.rdoc_exclude.join('|'))
|
14
16
|
files = PROJ.files.find_all do |fn|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
case fn
|
18
|
+
when excl; false
|
19
|
+
when incl; true
|
20
|
+
else false end
|
21
|
+
end
|
20
22
|
rd.rdoc_files.push(*files)
|
21
23
|
|
22
|
-
title = "#{PROJ.
|
24
|
+
title = "#{PROJ.version} documentation"
|
23
25
|
title = "#{PROJ.rubyforge_name}'s " + title if PROJ.rubyforge_name != title
|
24
26
|
|
25
27
|
rd.options << "-t #{title}"
|
28
|
+
rd.options << "-SHN"
|
29
|
+
rd.options << "-f"
|
30
|
+
rd.options << "darkfish"
|
26
31
|
rd.options.concat(PROJ.rdoc_opts)
|
27
32
|
end
|
28
33
|
|