score:2

Accepted answer

I don't know if it's the best practice, but you can store dates in an array and temperatures in an other one like this :

# Considering you already stored your data, you need to parse it now
data = JSON.parse(your_data)

# Initialize your two arrays
@dates = Array.new
@temperatures = Array.new

# Fill your two arrays
data["data"].each do |d|
  @dates.push(d.keys)
  @temperatures.push(d.values.to_i) # Need to be a number to work with .series of HightCharts
end

Now you have the @dates array which contains all your dates and @temperatures array which contains all your temperatures.

Hope this help !


Related Articles