module Charts::Renderer::RvgRenderer

Attributes

rvg[R]

Public Instance Methods

canvas(style) { |canvas| ... } click to toggle source
# File lib/charts/renderer/rvg_renderer.rb, line 40
def canvas(style)
  style.delete(:class)
  rvg.rvg(chart.width, chart.height) do |canvas|
    yield(canvas).styles(style)
  end
end
circle(cx, cy, radius, style) click to toggle source
# File lib/charts/renderer/rvg_renderer.rb, line 24
def circle(cx, cy, radius, style)
  canvas(style) { |c| c.circle radius, cx, cy }
end
line(x1, y1, x2, y2, style) click to toggle source
# File lib/charts/renderer/rvg_renderer.rb, line 20
def line(x1, y1, x2, y2, style)
  canvas(style) { |c| c.line x1, y1, x2, y2 }
end
path(d, style) click to toggle source
# File lib/charts/renderer/rvg_renderer.rb, line 32
def path(d, style)
  canvas(style) { |c| c.path d }
end
pre_draw() click to toggle source
# File lib/charts/renderer/rvg_renderer.rb, line 6
def pre_draw
  @rvg = Magick::RVG.new(chart.width, chart.height) do |canvas|
    canvas.background_fill = 'white'
  end
end
print() click to toggle source
rect(x, y, width, height, style) click to toggle source
# File lib/charts/renderer/rvg_renderer.rb, line 28
def rect(x, y, width, height, style)
  canvas(style) { |c| c.rect width, height, x, y }
end
save(filename) click to toggle source
# File lib/charts/renderer/rvg_renderer.rb, line 16
def save(filename)
  rvg.draw.write filename
end
text(text, x, y, style = {}) click to toggle source
# File lib/charts/renderer/rvg_renderer.rb, line 36
def text(text, x, y, style = {})
  canvas(font_style.merge(style)) { |c| c.text x, y, text }
end