Search code examples
svgraphaelhtml-entitiesgraphael

raphael: show HTML entity within a tag


I want to add HTML entity to raphael tag, but I see the text deg and not the degree sign -

this.tags.push(
  // make tag (x, y, text, degree, radius)
  r.tag(this.x, this.y[i], this.values[i]+ "°C", 20, 4).insertBefore(this) ...

How can I escape it?

I am not sure which language actually displays this text, HTML, JavaScript or SVG ...

enter image description here


Solution

  • you can also pass fromCharCode to a raphael node.

    r.text(100, 100, String.fromCharCode(176));
    

    would render the ° entity in a text node.