Module: Ziya::YamlHelpers::Charts

Includes:
HtmlHelpers::Charts, Base
Included in:
Charts::Base
Defined in:
lib/ziya/yaml_helpers/charts.rb

Instance Method Summary collapse

Methods included from Base

#clazz, #indent

Methods included from HtmlHelpers::Charts

#_ziya_chart, #chart_path, #charts_swf, #charts_swf_base, #class_id, #codebase, #composite_base_url, #composite_url, #default_chart_options, #gen_composite_path, #gen_swf_path, #ziya_chart, #ziya_chart_js, #ziya_javascript_include_tag

Methods included from HtmlHelpers::Base

#escape_chars, #escape_once, #escape_url, #mime, #plugin_url, #setup_movie_size, #setup_wmode, #tag, #tag_options

Instance Method Details

#chart(class_name) ⇒ Object

generates a yaml chart declaration

Example

<%= chart :bar %>
=> --- !ruby/object:Ziya::Charts::Bar


44
45
46
# File 'lib/ziya/yaml_helpers/charts.rb', line 44

def chart( class_name )
  "--- #{clazz( class_name, :Charts )}" 
end

#chart_url(url, swf_chart_dir = "/charts", id = nil) ⇒ Object

generates a swf chart path from the given url. Used as helper to embed a chart within a chart

Example

 <%= chart_url( chart_1_path, "fred" ) %>

=> /charts/charts.swf?library_path=/charts/charts_library&xml_source=http://fred/load_chart_1.xml&chart_id=fred


17
18
19
# File 'lib/ziya/yaml_helpers/charts.rb', line 17

def chart_url( url, swf_chart_dir="/charts", id=nil )
  gen_composite_path( swf_chart_dir, url, id )
end

#component(component_name) ⇒ Object Also known as: comp

generates a component yaml class declaration

Example

<%= component :axis_category %>
=> axis_category: --- !ruby/object:Ziya::Charts::Support::AxisCategory


25
26
27
# File 'lib/ziya/yaml_helpers/charts.rb', line 25

def component( component_name )
  "#{component_name}: #{clazz component_name, 'Charts::Support' }"
end

#drawing(class_name) ⇒ Object Also known as: filter_type, area

generates a drawing yaml class declaration

Example

<%=drawing :rect %>
=> --- !ruby/object:Ziya::Charts::Support::Rect


34
35
36
# File 'lib/ziya/yaml_helpers/charts.rb', line 34

def drawing( class_name )
  clazz( class_name, 'Charts::Support' )
end