Class: Squid::Graph

Inherits:
Object
  • Object
show all
Extended by:
Settings
Defined in:
lib/squid/graph.rb

Instance Method Summary collapse

Methods included from Settings

has_settings

Constructor Details

#initialize(document, data = {}, settings = {}) ⇒ Graph

Returns a new instance of Graph.



18
19
20
21
22
# File 'lib/squid/graph.rb', line 18

def initialize(document, data = {}, settings = {})
  @data, @settings = data, settings
  @plot = Plotter.new document, bottom: bottom
  @plot.paddings = {left: left.width, right: right.width} if @data.any?
end

Instance Method Details

#drawObject



24
25
26
# File 'lib/squid/graph.rb', line 24

def draw
  @plot.box(h: height, border: border) { draw_graph if @data.any? }
end