I want to show some information in Farsi language on highchart tooltip. It works ok but the text align is not right.
As Persian language is a rtl language, I need to change text alignment so it starts from right. How can I do this?
dont forget use:(useHTML: true,)
tooltip: {
useHTML: true,
formatter: function() {
return '<div lang="fa" dir="rtl"> ' +
this.x + ' : ' + this.y +
'</div>';
}
},
May be you can do something like this:
tooltip: {
formatter: function() {
return '<div lang="fa" dir="rtl">دستشویی/داروخانه) کجاست؟ : ' +
this.x + ' : ' + this.y +
'</div>';
}
}
Is that Farsi? I just googled and found it somewhere.
Some refs:
I had the same problem with right to left direction. so I think your document's direction is set to RTL
either in html
tag with dir="rtl"
attribute or in your stylesheet file with some selector like *{direction:rtl;}
so that everything in your document gonna be right to left. to fix the chart alignment just add the following rule in your stylesheet:
#container {
direction:ltr !important;
}
this will reset the direction of the chart to ltr
, so that It will not be messy. but still it's text-alignment is to left.
您也可以使用波斯语的一些技巧,可以在这个Farsi网站http://www.barnamenevis.org找到
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.