Method: GoogleChart::LineChart#process_data

Defined in:
lib/google_chart/line_chart.rb

#process_dataObject



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/google_chart/line_chart.rb', line 60

def process_data
  if self.is_xy or @data.size > 1
    if self.is_xy # XY Line graph data series
      encoded_data = []
      @data.size.times { |i|
        # Interleave X and Y co-ordinate data
        encoded_data << join_encoded_data([encode_data(x_data[i],max_x_value), encode_data(y_data[i],max_y_value)])
      }
      join_encoded_data(encoded_data)
    else # Line graph multiple data series          
      join_encoded_data(@data.collect { |series|
                          encode_data(series, max_data_value)
                        })
    end
  else
    encode_data(@data.flatten, max_data_value)
  end
end