Sepp Report post Posted February 14, 2018 Hello Team, i have the problem in python Django does when i take the special Special Character degree it will not display on browser This is my django code < views.py> def weather_chart(request): tester = sensoren.objects.filter(sensorname='Aussen').order_by('-id')[:1] dataSource1 = {} dataSource1['chart'] = { "caption":"Temperatur Alfdorf", "subCaption":"Aktueller Tagesverlauf °", "yAxisName":"Temperatur", "yAxisNameFontSize":"14", "captionOnTop":"1", "labeldisplay": "ROTATE", "slantlabels": "1", "labelStep":"4", "drawAnchors":"0", "showValues":"0", "theme":"fint" } dataSource1['data'] =[] for key in sensoren.objects.filter(sensorname='Aussen', \ messdatum__range=[datetime.combine(date.today(), time.min), \ datetime.combine(date.today(), time.max)]): data = {} data['label'] = datetime.time(key.messdatum).strftime("%H:%M") data['value'] = key.temperatur dataSource1['data'].append(data) # Create an object for the column2d chart using the FusionCharts class constructor column2d = FusionCharts("line", "ex1" , "450", "300", "Temperchart", "json", dataSource1) this is the html code <div id="Temperchart"> <script type="text/javascript"> FusionCharts.ready(function () { new FusionCharts({"width": "450", "renderAt": "Temperchart", "dataFormat": "json", "type": "line", "height": "300", "id": "ex1", "dataSource": {"data": [{"label": "00:00", "value": "-8.5"}, {"label": "00:15", "value": "-8.9"}, {"label": "00:30", "value": "-8.9"}, {"label": "00:45", "value": "-9.2"}, {"label": "01:00", "value": "-9.1"}, {"label": "01:15", "value": "-9.0"}, {"label": "01:30", "value": "-9.5"}, {"label": "01:45", "value": "-9.9"}, {"label": "02:00", "value": "-9.9"}, {"label": "02:15", "value": "-10.3"}, {"label": "02:30", "value": "-10.4"}, {"label": "02:45", "value": "-10.1"}, {"label": "03:00", "value": "-10.1"}, {"label": "03:15", "value": "-10.2"}, {"label": "03:30", "value": "-10.0"}, {"label": "03:45", "value": "-9.6"}, {"label": "04:00", "value": "-9.9"}, {"label": "04:15", "value": "-9.9"}, {"label": "04:30", "value": "-10.0"}, {"label": "04:45", "value": "-10.0"}, {"label": "05:00", "value": "-9.8"}, {"label": "05:15", "value": "-9.6"}, {"label": "05:30", "value": "-9.5"}, {"label": "05:45", "value": "-9.8"}, {"label": "06:00", "value": "-9.8"}, {"label": "06:15", "value": "-9.8"}, {"label": "06:30", "value": "-9.7"}, {"label": "06:45", "value": "-9.9"}, {"label": "07:00", "value": "-10.2"}, {"label": "07:15", "value": "-10.2"}, {"label": "07:30", "value": "-10.2"}, {"label": "07:45", "value": "-10.1"}, {"label": "08:00", "value": "-9.4"}, {"label": "08:15", "value": "-9.4"}, {"label": "08:30", "value": "-8.9"}, {"label": "08:45", "value": "-8.9"}, {"label": "09:00", "value": "-8.2"}, {"label": "09:15", "value": "-7.2"}, {"label": "09:30", "value": "-6.2"}, {"label": "09:45", "value": "-5.2"}, {"label": "10:00", "value": "-4.5"}, {"label": "10:15", "value": "-3.9"}, {"label": "10:30", "value": "-3.6"}, {"label": "10:45", "value": "-3.5"}, {"label": "11:00", "value": "-3.0"}, {"label": "11:15", "value": "-3.0"}, {"label": "11:30", "value": "-2.5"}, {"label": "11:45", "value": "-2.1"}, {"label": "12:00", "value": "-1.7"}, {"label": "12:15", "value": "-1.5"}, {"label": "12:30", "value": "-1.2"}, {"label": "12:45", "value": "-1.0"}, {"label": "13:00", "value": "-1.0"}, {"label": "13:15", "value": "-0.9"}, {"label": "13:30", "value": "-0.8"}, {"label": "13:45", "value": "-0.8"}, {"label": "14:00", "value": "-0.8"}, {"label": "14:15", "value": "-0.9"}, {"label": "14:30", "value": "-0.6"}, {"label": "14:45", "value": "-0.7"}, {"label": "15:00", "value": "-0.8"}, {"label": "15:15", "value": "-0.9"}, {"label": "15:30", "value": "-1.0"}, {"label": "15:45", "value": "-1.2"}, {"label": "16:00", "value": "-1.3"}, {"label": "16:15", "value": "-1.6"}, {"label": "16:30", "value": "-2.0"}, {"label": "16:45", "value": "-2.0"}, {"label": "17:00", "value": "-2.5"}, {"label": "17:15", "value": "-3.2"}, {"label": "17:30", "value": "-3.8"}, {"label": "17:45", "value": "-4.4"}, {"label": "18:00", "value": "-5.1"}, {"label": "18:15", "value": "-5.9"}, {"label": "18:30", "value": "-6.5"}, {"label": "18:45", "value": "-6.8"}, {"label": "19:00", "value": "-6.7"}, {"label": "19:15", "value": "-6.6"}, {"label": "19:30", "value": "-6.6"}, {"label": "19:45", "value": "-6.5"}, {"label": "20:00", "value": "-6.3"}, {"label": "20:15", "value": "-6.5"}], "chart": {"drawAnchors": "0", "yAxisNameFontSize": "14", "yAxisName": "Temperatur", "caption": "Temperatur Alfdorf", "labelStep": "4", "slantlabels": "1", "labeldisplay": "ROTATE", "captionOnTop": "1", "theme": "fint", "showValues": "0", "subCaption": "Aktueller Tagesverlauf u00b0"}}}); }); </script> <script type="text/javascript"> FusionCharts.ready(function () { FusionCharts("ex1").render(); }); and the screenshot is at the attachment. has anybody a solution? Depp Share this post Link to post Share on other sites
Ayan Bhadury Report post Posted February 16, 2018 Hi, Please try providing the Python's Unicode for degree or you could use javascript to change the caption using FusionCharts.items global properties, to know more check this link - https://www.fusioncharts.com/dev/api/fusioncharts/fusioncharts-properties.html#static-items Share this post Link to post Share on other sites
Sepp Report post Posted February 16, 2018 Hello, sorry I'm to stupid. I try many things about this problem "subCaption": u"\N{DEGREE SIGN}" or u = u"\N{DEGREE SIGN}" dataSource1['chart'] = { "caption":"Temperatur Alfdorf", "subCaption": u.encode("utf8"), but always the same problem do you have any hint for me Michael Share this post Link to post Share on other sites
Ayan Bhadury Report post Posted February 22, 2018 Hi Apologies for the delayed response, I am looking into this I will get back to you shortly, appreciate your patience. Share this post Link to post Share on other sites
Sepp Report post Posted April 30, 2018 Hello, any news about the degree problem ? Michael Share this post Link to post Share on other sites
Ayan Bhadury Report post Posted May 8, 2018 Hi, Apologies for the delayed response. Since all the chart attributes are provided as a string the Python compiler is changing the degree symbol to its corresponding Unicode, therefore as a workaround, you can apply the degree symbol using javascript from your view page and apply this method when the chart has been initialized using FusionCharts API events, to know more check this sample - https://www.dropbox.com/s/ovb7nm0li5g6buv/fc_column2d.zip?dl=0 To know about initialized events check here - https://www.fusioncharts.com/dev/api/fusioncharts/fusioncharts-events#initializedstatic-event-7 Share this post Link to post Share on other sites