Class: OFC2::Graph

Inherits:
Object
  • Object
show all
Includes:
OWJSON
Defined in:
lib/ofc2.rb

Overview

title

+x_axis+
+y_axis+
+y_axis_right+
+x_legend+
+y_legend+
+bg_colour+
+elements+

Instance Method Summary collapse

Methods included from OWJSON

#method_missing, #to_hash

Constructor Details

#initialize(opts = {}) ⇒ Graph

Returns a new instance of Graph.



277
278
279
280
281
282
283
# File 'lib/ofc2.rb', line 277

def initialize(opts = {})
  @title = Title.new(:text =>  "Graph" )
  @elements = []
  opts.each do |name, value|
    self.send("#{name}=", value)
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class OFC2::OWJSON

Instance Method Details

#add_element(e) ⇒ Object Also known as: <<



285
286
287
# File 'lib/ofc2.rb', line 285

def add_element( e )
  @elements << e
end

#renderObject



290
291
292
293
294
295
296
297
# File 'lib/ofc2.rb', line 290

def render
  s = to_json
  # about underscores
  s.gsub!('___','') # that is for @___3d variable
  s.gsub!('__','-') # that is for @smt__smt variables
  # variables @smt_smt should go without changes
  s
end