Class: TChart::Chart

Inherits:
Object
  • Object
show all
Defined in:
lib/tchart/model/chart.rb

Overview

The plots of zero or more date ranges. Includes bars representing the date ranges, x and y axes lines, gridlines, and labels. Has overall responsibility for generating all of the TikZ code to render the chart.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(elements) ⇒ Chart

Returns a new instance of Chart.



12
13
14
# File 'lib/tchart/model/chart.rb', line 12

def initialize(elements)
  @elements = elements
end

Instance Attribute Details

#elementsObject (readonly)

Labels, gridlines and bars that make up the chart.



10
11
12
# File 'lib/tchart/model/chart.rb', line 10

def elements
  @elements
end

Instance Method Details

#renderObject

> String



16
17
18
19
20
21
22
# File 'lib/tchart/model/chart.rb', line 16

def render # => String
  tex = TeXBuilder.new
  tex.begin_chart
  @elements.each { |element| element.render(tex) }
  tex.end_chart
  tex.to_s
end