Home forums Using CanvasJS Special characters in labels?

This topic contains 3 replies, has 2 voices, and was last updated by  Indranil Deo 2 months, 3 weeks ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #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 achieve the above requirement by adding Unicode escape sequences in string literals. Please take a look at this jsfiddle.
    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.