Class: Ziya::Gauges::Support::RadialTicks
- Inherits:
-
RadialBase
- Object
- Charts::Support::Base
- Base
- RadialBase
- Ziya::Gauges::Support::RadialTicks
- Defined in:
- lib/ziya/gauges/support/radial_ticks.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 YamlHelpers::Gauges
Methods included from YamlHelpers::Base
Methods inherited from Charts::Support::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::Charts::Support::Base
Instance Method Details
#flatten(xml) ⇒ Object
overrides flatten to generate a series of radial tick marks
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ziya/gauges/support/radial_ticks.rb', line 13 def flatten( xml ) i = start_angle while( i <= end_angle ) do angle = deg2rad( i ) hash = { :x1 => (x + Math::sin( angle ) * radius).to_i, :y1 => (y - Math::cos( angle ) * radius).to_i, :x2 => (x + Math::sin( angle ) * (radius + length)).to_i, :y2 => (y - Math::cos( angle ) * (radius + length)).to_i, :thickness => thickness, :color => color } xml.line( hash ) i += (end_angle-start_angle)/(ticks-1) end end |