You must be logged in to post your query.
Home › Forums › Chart Support › Special characters in labels?
I’m trying to get a special character to show up in my label, but it doesn’t seem to like it.
data: [{ type: "line", showInLegend: true, legendText: "ß", dataPoints: dataPoints }]
This shows up the actual “ß” in the label (not what it should show – ie the entity itself). If I try and use actual utf8 in the label that shows up as a ? :
legendText: "\ß é",
If there a way to stop it encoding the label? (i.e actually translate the HTML entity, and don’t double encode it like ß)
Thanks
Andy
@andynewby,
You can add special characters to legends by adding Unicode escape sequences in string literals like legendText: "\u00DF e". Please take a look at this JSFiddle for an example on adding unicode to legend text.
legendText: "\u00DF e"
Also, you can refer to this Wikipedia page for a list of Unicode.
__________ Indrail Deo Team CanvasJS
Hi,
Thanks for that. For some reason I was trying to use CSS values (hex), instead of escape sequences ;) I also found out the reason stuff like é was coming out corrupted. The issue was actually that the file was in ANSI and not UTF8 format. After converting the file, it works fine now.
Glad that it works :)
__________ Indrail Deo, Team CanvasJS
You must be logged in to reply to this topic. Login/Register