Class: Plotly::Data

Inherits:
Object show all
Includes:
Castable
Defined in:
lib/plotly/data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Castable

#to_h

Constructor Details

#initialize(opts = {}) ⇒ Data

Returns a new instance of Data.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • x (Array)
  • y (Array)
  • z (Array)
  • values (Array)
  • labels (Array)
  • mode (String)
  • type (String)
  • name (String)
  • text (Array)

    array of strings

  • colorscale (Array)
  • marker (Hash or Plotly::Marker)


21
22
23
24
25
26
# File 'lib/plotly/data.rb', line 21

def initialize(opts = {})
  opts.each do |k, v|
    v.convert_to(Plotly::Marker) if k == marker
    instance_variable_set("@#{k}", v)
  end
end

Instance Attribute Details

#colorscaleObject

Returns the value of attribute colorscale.



8
9
10
# File 'lib/plotly/data.rb', line 8

def colorscale
  @colorscale
end

#labelsObject

Returns the value of attribute labels.



8
9
10
# File 'lib/plotly/data.rb', line 8

def labels
  @labels
end

#markerObject

Returns the value of attribute marker.



8
9
10
# File 'lib/plotly/data.rb', line 8

def marker
  @marker
end

#modeObject

Returns the value of attribute mode.



8
9
10
# File 'lib/plotly/data.rb', line 8

def mode
  @mode
end

#nameObject

Returns the value of attribute name.



8
9
10
# File 'lib/plotly/data.rb', line 8

def name
  @name
end

#textObject

Returns the value of attribute text.



8
9
10
# File 'lib/plotly/data.rb', line 8

def text
  @text
end

#typeObject

Returns the value of attribute type.



8
9
10
# File 'lib/plotly/data.rb', line 8

def type
  @type
end

#valuesObject

Returns the value of attribute values.



8
9
10
# File 'lib/plotly/data.rb', line 8

def values
  @values
end

#xObject

Returns the value of attribute x.



8
9
10
# File 'lib/plotly/data.rb', line 8

def x
  @x
end

#yObject

Returns the value of attribute y.



8
9
10
# File 'lib/plotly/data.rb', line 8

def y
  @y
end

#zObject

Returns the value of attribute z.



8
9
10
# File 'lib/plotly/data.rb', line 8

def z
  @z
end