I have looked over the other questions addressing this, but they don't 
answer my questions specifically. I am trying to use data returned from SQL 
in Flask, and passing it to the Google Charts API. It's a basic 
weight/calorie tracker, and I need to return date and weight for the chart. 
My 'userdata' for one user returns from SQL query

userdata = db.execute("SELECT * FROM history WHERE id = :id", id=session[
"user_id"])


[{'id': 1, 'weight': 180, 'calories': 2100, 'rewards': 1, 'date': 
'2018-04-14'}, {'id': 1, 'weight': 185, 'calories': 1800, 'rewards': -1, 
'date': '2018-04-15'}, {'id': 1, 'weight': 180, 'calories': 1600, 'rewards': 
1, 'date': '2018-04-13'}, {'id': 1, 'weight': 180, 'calories': 1900, 
'rewards': -2, 'date': '2018-04-12'}, {'id': 1, 'weight': 186, 'calories': 
1111, 'rewards': 5, 'date': '2018-04-16'}, {'id': 1, 'weight': 184, 
'calories': 1200, 'rewards': 5, 'date': '2018-04-17'}, {'id': 1, 'weight': 
184, 'calories': 1400, 'rewards': 3, 'date': '2018-04-18'}, {'id': 1, 
'weight': 180, 'calories': 2100, 'rewards': -4, 'date': '2018-04-11'}]

I am not familiar with PHP which I see pop up often, but I am OK with 
Python, and just learning JavaScript. It appears I need to jsonify the data 
to pass, but I'm not sure how to do that. I read through the Google Charts 
documentation, but I'm still not quite sure how to pass this info into the 
chart code.

Any help you can give is MUCH appreciated!

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/634e89db-7e73-4deb-917c-64845cfb601c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to