Class: Ziya::Components::Draw

Inherits:
Base
  • Object
show all
Includes:
Helper
Defined in:
lib/ziya/components/draw.rb

Overview

Sets up a drawing area on the chart to draw text, rect, circles…

Holds any number of elements to draw. A draw element can be a circle, image (JPEG or SWF), line, rectangle, or text. Use draw “image” to include SWF flash file with animation, roll-over buttons, sounds, scripts, etc.

:

See www.maani.us/xml_charts/index.php?menu=Reference&submenu=draw for additional documentation, examples and futher detail.

Instance Method Summary collapse

Methods included from Helper

#block_is_within_action_view?, #capture_block, #chart_path, #charts_swf, #class_id, #codebase, #composite_url, #content_tag, #content_tag_string, #escape_chars, #escape_once, #escape_url, #gauge_path, #gauges_swf, #gen_composite_path, #gen_swf_path, #generate_flash_tag, #generate_old_style_flash_tag, #mime, #plugin_url, #setup_movie_size, #setup_wmode, #tag, #tag_options, #ziya_chart, #ziya_chart_js, #ziya_gauge, #ziya_javascript_include_tag

Methods inherited from Base

#==, attributes, #attributes_for, #configured?, has_attribute, #has_sub_components, #initialize, #merge, #options, #options_as_string

Methods included from Utils::Text

#camelize, #classify, #demodulize, #underscore

Constructor Details

This class inherits a constructor from Ziya::Components::Base

Instance Method Details

#flatten(xml, composite_urls = nil) ⇒ Object


Dump has_attribute into xml element



28
29
30
31
32
33
34
35
# File 'lib/ziya/components/draw.rb', line 28

def flatten( xml, composite_urls=nil )
  if components
    xml.draw do 
      components.each { |comp| comp.flatten( xml ) }
      gen_composites( xml, composite_urls ) if composite_urls
    end
  end
end

#gen_composites(xml, composite_urls) ⇒ Object


Generates Draw component for composite charts



39
40
41
42
43
44
45
# File 'lib/ziya/components/draw.rb', line 39

def gen_composites( xml, composite_urls )
  # chart_path = chart_path
  for url in composite_urls do
    # xml.image( :url => composite_url % [ chart_path, chart_path, url] )
    xml.image( :url => gen_composite_path( chart_path, url ) )
  end
end