Method: DataLayer#append_data

Defined in:
lib/technical_graph/data_layer.rb

#append_data(data_array) ⇒ Object

Accessor for setting chart data for layer to draw



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/technical_graph/data_layer.rb', line 57

def append_data(data_array)
  if data_array.kind_of? Array
    # append as DataPoint
    # convert to DataPoints, which has more specialized methods

    t = Time.now
    data_array.each do |d|
      @data << DataPoint.new(d)
    end
    logger.debug "appending data, size #{data_array.size}"
    logger.debug " TIME COST #{Time.now - t}"

    # sort, clean bad records
    process_data_internal

    # @raw_data is dirty, deleting @processed_data
    @processed_data = nil
  else
    raise 'Data not an Array'
  end
end