Sha256: 60446b05323898de6e26f41c097a89f2c8693edbd065ebbad2d1ec581f32fb51
Contents?: true
Size: 1.01 KB
Versions: 22
Compression:
Stored size: 1.01 KB
Contents
# ----------------------------------------------------------------------------- # Draws a circle with ticks # # Author:: Fernand Galiana # ----------------------------------------------------------------------------- require 'ziya/gauges/support/radial_base' module Ziya::Gauges::Support class RadialTicks < RadialBase has_attribute :length, :thickness # overrides flatten to generate a series of radial tick marks 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 end end
Version data entries
22 entries across 22 versions & 2 rubygems