What's the most elegant solution in Django to take data from database and pass it into Highcharts? I stumbled across this question, but I keep on getting the following error: JSerror: Invalid property id at var chart_id = {{ chartID|safe }}, if I try to use it in my example.
template looks like this:
var chart_id = {{ chartID|safe }}
var series = {{ series|safe }}
var title = {{ title|safe }}
var xAxis = {{ xAxis|safe }}
var yAxis = {{ yAxis|safe }}
var chart = {{ chart|safe }}
In case there are better ways to pass data to highcharts please let me know.
解决方案
Maybe you are missing the quotes in your javascript:
var chart_id = "{{ chartID|safe }}";