Class: MotionPlot::Series

Inherits:
Object
  • Object
show all
Defined in:
lib/motion-plot/series/series.rb

Constant Summary collapse

COLORS =
['4572A7', 'AA4643', '89A54E', '80699B', '3D96AE', 'DB843D', '92A8CD', 'A47D7C', 'B5CA92']

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Series

Returns a new instance of Series.



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/motion-plot/series/series.rb', line 9

def initialize(args={})
  args.each_pair {|key, value|
    send("#{key}=", value) if(respond_to?("#{key}="))
  }

  style_attr = args[:defaults].merge!(color: COLORS[args[:index]])
  merge_plot_options(style_attr, args[:plot_options])
  merge_style(style_attr, args[:style])

  @style        = Style.new(style_attr)
  @plot_symbol  = PlotSymbol.new(args[:plot_symbol].merge(index: @index)) if(args[:plot_symbol])
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



6
7
8
# File 'lib/motion-plot/series/series.rb', line 6

def data
  @data
end

#indexObject

Returns the value of attribute index.



6
7
8
# File 'lib/motion-plot/series/series.rb', line 6

def index
  @index
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/motion-plot/series/series.rb', line 6

def name
  @name
end

#plot_symbolObject (readonly)

Returns the value of attribute plot_symbol.



7
8
9
# File 'lib/motion-plot/series/series.rb', line 7

def plot_symbol
  @plot_symbol
end

#styleObject

Returns the value of attribute style.



6
7
8
# File 'lib/motion-plot/series/series.rb', line 6

def style
  @style
end

#typeObject

Returns the value of attribute type.



6
7
8
# File 'lib/motion-plot/series/series.rb', line 6

def type
  @type
end

Instance Method Details

#colorObject



22
23
24
# File 'lib/motion-plot/series/series.rb', line 22

def color
  @style.color
end

#widthObject



26
27
28
# File 'lib/motion-plot/series/series.rb', line 26

def width
  @style.width
end