Search code examples
amchartsamcharts4

amcharts4 - how to escape square bracket character ("[")


I would like to have Spread Value [EUR] as my title axis text so I tried with

valueAxis.title.text = "Spread Value \[EUR\]";

because

valueAxis.title.text = "Spread Value [EUR]";

results in Spread Value.

Any suggestions how to fix?

Note: I could fix it with Spread Value (EUR) but I would like to use square brackets.


Solution

  • You can use valueAxis.title.html instead of valueAxis.title.text:

    valueAxis.title.html = "Spread Value [EUR]";
    

    Here is an example code pen.

    Alternatively you can use double [[]] with valueAxis.title.text:

    valueAxis.title.text = "Spread Value [[EUR]]";