Method: Vis::Graph2d#initialize

Defined in:
lib/vis/graph2d.rb

#initialize(native_container, item_dataset, group_dataset = nil, options = {}) ⇒ Graph2d

Returns a new instance of Graph2d.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/vis/graph2d.rb', line 20

def initialize(native_container, item_dataset, group_dataset = nil, options = {})
  native_item_data = item_dataset.to_n
  if group_dataset.is_a?(Hash) && options == {}
    options = group_dataset
    group_dataset = nil
  end
  native_options = options_to_native(options)
  @event_handlers = {}
  if group_dataset.nil?
    @native = `new vis.Graph2d(native_container, native_item_data, native_options)`
  else
    native_group_data = group_dataset.to_n
    @native = `new vis.Graph2d(native_container, native_item_data, native_group_data, native_options)`
  end
end