Home Forums Feature Requests & Feedback Support for HTML unicode characters Reply To: Support for HTML unicode characters

#27937

I’m passing into an Angular component the following:

<componentName yAxisLabel=”\u00B5W / cm\u00B2″></componentName>

Then, within the component I am using the @Input value like this:
@Input() yAxisLabel: string;

…CanvasJS Chart config…

axisY: {
title: this.yAxisLabel
}

However, the chart translates it literally as “\u00B5W / cm\u00B2” which is what displays as the axis title. It works just fine if I hard-code the title, but not as an input value.

Solution:
Where I was passing: “\u00B5W / cm\u00B2”
I now pass the HTML Entity: “µW / cm²”

…CanvasJS Chart config…

axisY: {
title: this.yAxisLabel
}

Works like a charm.

A great reference for HTML entities, etc: https://www.toptal.com/designers/htmlarrows/