I am pulling data from my database and I am trying to set it up as the data for highcharts. I am passing a variable from flask to my template in the following format:
[{
'x': 185.42,
'team': 'PIT',
'y': 99.79,
'position': 'QB',
'f_name': 'Bruce Gradkowski',
'number': 5
},
{
'x': 190.5,
'team': 'DET',
'y': 105.23,
'position': 'QB',
'f_name': 'Matthew Stafford',
'number': 9
}]
Basically it's a list full of dictionaries. If i copy and paste that text in the highcharts data section it works like a charm. I did not use jsonify or .getJSON (mostly because i have been looking it up online but still dont have a clear idea of how to pass the data from .getJSON to highcharts data).Instead I found this and thought it would be easier to pass the data to the template and inside the javascript function that sets the data for the highcharts series using {{ var_name }}. However, it does not work. Why? Can you give me an example of how to using .getJSON to set up the data for the Highcharts series or help me use the variable as the data source for the data?