Class: OMF::Web::Widget::Graph::GraphWidget

Inherits:
AbstractDataWidget
  • Object
show all
Defined in:
lib/omf-web/widget/UNUSED/graph/graph_widget.rb

Overview

Maintains the context for a particular graph rendering within a specific session. It is primarily called upon maintaining communication with the browser and will create the necessary html and javascript code for that.

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ GraphWidget

Returns a new instance of GraphWidget.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/omf-web/widget/UNUSED/graph/graph_widget.rb', line 11

def initialize(opts)
  unless opts
    raise "Missing widget options."
  end
  @name = opts[:name] || 'Unknown'
  
  wopts = opts[:wopts] || {}
  unless vizType = (wopts[:viz_type] || opts[:type].split('/')[-1])
    raise "Missing widget option ':viz_type' for widget '#{name}' (#{opts.inspect})"
  end
  opts[:name] = name
  opts[:js_url] = "graph/#{vizType}.js"
  opts[:js_class] = "OML.#{vizType}"
  #opts[:widget_class] = OMF::Web::Widget::AbstractDataWidget 
  
  super opts      
  @widget_type = vizType
end