Class: Ziya::Gauges::Support::RadialNumbers
- Inherits:
-
RadialBase
- Object
- Components::Base
- Base
- RadialBase
- Ziya::Gauges::Support::RadialNumbers
- Defined in:
- lib/ziya/gauges/support/radial_numbers.rb
Instance Method Summary collapse
-
#flatten(xml) ⇒ Object
overrides flatten to generate a series of radial tick marksß.
Methods inherited from Base
Methods included from Helpers::BaseHelper
#chart, #chart_url, #clazz, #component, #dial, #dials, #drawing, #gauge, #indent
Methods included from Utils::Text
#camelize, #classify, #demodulize, #underscore
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 Components::Base
#==, attributes, #attributes_for, #configured?, has_attribute, #has_sub_components, #initialize, #merge, #options, #options_as_string
Constructor Details
This class inherits a constructor from Ziya::Components::Base
Instance Method Details
#flatten(xml) ⇒ Object
overrides flatten to generate a series of radial tick marksß
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/ziya/gauges/support/radial_numbers.rb', line 16 def flatten( xml ) number = start_num i = start_angle while( i <= end_angle ) do angle = deg2rad( i ) hash = { :x => (x + Math::sin( angle ) * radius).to_i, :y => (y - Math::cos( angle ) * radius).to_i, :width => width || 20, :height => height || 20, :font => font || "Arial", :size => size || 10, :bold => bold || true, :alpha => alpha, :rotation => i, :align => align || "left", :color => color } xml.text( hash ) do xml.text! number.to_s end i += (end_angle-start_angle)/(ticks-1) number += (end_num-start_num)/(ticks-1) end end |