class GerbilCharts::SVGDC::SVGArc

SVGARC - a simple elliptical arc

Attributes

angle[RW]
cx[RW]
cy[RW]
px[RW]
py[RW]
qx[RW]
qy[RW]
r1[RW]
r2[RW]

Public Class Methods

new(cx,cy,r1,r2,px,py,qx,qy,angle) click to toggle source

cx,cy = center point r1,r2 = radius 1, 2 px,py = starting point qx,qy = ending point

To create rectangle top left corner at (10,10) and width 200,height 100 do :

SVGRect.new (10,10,200,150)
Calls superclass method
# File lib/gerbilcharts/svgdc/svg_arc.rb, line 22
def initialize(cx,cy,r1,r2,px,py,qx,qy,angle)
    @cx,@cy,@r1,@r2,@px,@py,@qx,@qy=cx,cy,r1,r2,px,py,qx,qy
    @angle=angle
    super()
end

Public Instance Methods

anglestr() click to toggle source
# File lib/gerbilcharts/svgdc/svg_arc.rb, line 34
def anglestr
      angle >= 180 ? "1,1" : "0,1"
end
render(xfrag) click to toggle source
# File lib/gerbilcharts/svgdc/svg_arc.rb, line 28
def render(xfrag)
  d_str = "M#{cx},#{cy}  L#{px},#{py} A#{r1},#{r2} 0 #{anglestr}  #{qx},#{qy} "
  h= { :d =>  d_str }
  render_base(xfrag) { xfrag.path( h.merge(render_attributes)) }
end