Home Forums Chart Support Special characters in labels?

Special characters in labels?

Viewing 4 posts - 1 through 4 (of 4 total)
  • #23879

    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: "&#223",
    	  		dataPoints: dataPoints
    		}]

    This shows up the actual “&#223” 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: "\&#223 é",

    If there a way to stop it encoding the label? (i.e actually translate the HTML entity, and don’t double encode it like &#223)

    Thanks

    Andy

    #23880

    @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.

    Adding Unicode to Legend Text

    Also, you can refer to this Wikipedia page for a list of Unicode.

    __________
    Indrail Deo
    Team CanvasJS

    #23881

    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.

    Thanks

    Andy

    #23895

    @andynewby,

    Glad that it works :)

    __________
    Indrail Deo,
    Team CanvasJS

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.