[Fixed]-Remove quotes from an item in list in django for highcharts

1👍

Finally figured it out, changed it to:

last_day_data['avg_temperature'][index_max] = "{\"y\": %s, \"marker\":" \
                                               " {\"symbol\": \"url(%ssun.png)\"}" \
                                                  "}" % (value_max, settings.STATIC_URL)

And inside home.html:

var series = {{ series3|safe }};
var obj = series[0]['data'];

for(var x in obj){
 if(typeof obj[x] === "string") obj[x] = JSON.parse(obj[x]);
}
series[0]['data'] = obj;
$({{ chartID3|safe }}).highcharts({
    chart: {{ chart3|safe }},
    title: {{ title3|safe }},
    xAxis: {{ xAxis3|safe }},
    yAxis: {{ yAxis3|safe }},
    series: series
});

Now it works perfectly!

👤bumbur

Leave a comment