I'm trying to make a line chart from the API data
[{"Apr 11":{"count":150}},{"Apr 12":{"count":140}},{"Apr 13":{"count":160}}]
I tried doing:
@metrics.each do |data|
data.each do |key, value|
render json: data(:key).count
end
end
All example in chartkick is rendering Model data. I'm struggling with rendering API data. Can anyone explain me how can I do it?
First build a json then return this one
json_object = @metrics.map do |m|
{ date_value => { :count => count_value} }
end
render :json => json_object