class GerbilCharts::SVGDC::SVGPolygon

Attributes

operstring[R]

Public Class Methods

new() click to toggle source
# File lib/gerbilcharts/svgdc/svg_polygon.rb, line 15
def initialize
  @operstring = ""
      @last_svg = ""
end

Public Instance Methods

addpoint(x,y) click to toggle source
# File lib/gerbilcharts/svgdc/svg_polygon.rb, line 20
def addpoint(x,y)
  # truncate to 2 significant places (cuts down SVG size)
  xf,yf = POLYGON_RESOLUTION%x, POLYGON_RESOLUTION%y
      s = "#{xf},#{yf} "
  @operstring << "#{xf},#{yf} " unless s == @last_svg
      @last_svg = s
end
isempty?() click to toggle source
# File lib/gerbilcharts/svgdc/svg_polygon.rb, line 33
def isempty?
  return @operstring.length==0
end
render(xfrag) click to toggle source
# File lib/gerbilcharts/svgdc/svg_polygon.rb, line 28
def render(xfrag)
  h= {:points => @operstring }
  xfrag.polygon( h.merge(render_attributes))
end