Class: MotionPlot::Line

Inherits:
Base
  • Object
show all
Defined in:
lib/motion-plot/chart/line_plot.rb

Direct Known Subclasses

Area

Instance Attribute Summary

Attributes inherited from Base

#axes, #data_label, #graph, #layer_hosting_view, #legend, #major_grid_line_style, #plot_options, #plot_space, #plots, #series, #theme, #title, #xaxis, #yaxis

Instance Method Summary collapse

Methods inherited from Base

#add_axis_title, #add_chart_title, #add_legend, #add_plot_space, #add_plot_symbol, #add_xy_range, #bootstrap, #initWithOptions

Instance Method Details

#add_seriesObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/motion-plot/chart/line_plot.rb', line 4

def add_series
  @delegate_object = if(@plot_options and @plot_options.line[:beizer]) 
    BeizerCurveDelegate.new(self) 
  else
    LineDelegate.new(self)
  end

  @series.keys.each_with_index do |name, index|
    line                  = CPTScatterPlot.alloc.initWithFrame(CGRectNull)
    line.identifier       = name

    line_style            = line.dataLineStyle.mutableCopy
    line_style.lineWidth  = @series[name].width

    line_style.lineColor  = @series[name].color

    line.dataLineStyle    = line_style
    line.dataSource       = @delegate_object
    line.delegate         = @delegate_object
    line.interpolation    = CPTScatterPlotInterpolationCurved if(@plot_options and @plot_options.line[:curve_inerpolation])

    add_plot_symbol(line, @series[name].plot_symbol.symbol_for(line)) if(@series[name].plot_symbol)

    @graph.addPlot(line)
    @plots << line
  end
end

#default_paddingObject



32
33
34
35
# File 'lib/motion-plot/chart/line_plot.rb', line 32

def default_padding
  line_series.style.paddings_for(@graph)
  line_series.style.plot_area.add_style(@graph.plotAreaFrame)
end

#line_seriesObject



37
38
39
# File 'lib/motion-plot/chart/line_plot.rb', line 37

def line_series
  @series[plot_identifier]
end

#plot_identifierObject



41
42
43
# File 'lib/motion-plot/chart/line_plot.rb', line 41

def plot_identifier
  @series.keys.select{|k| @series[k].type == plot_type}.first
end