简体   繁体   English

如何改变Highchart工具提示的对齐方式?

[英]How to change alignment of Highchart tooltip?

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. 由于波斯语是一种rtl语言,我需要更改文本对齐方式,使其从右侧开始。 How can I do this? 我怎样才能做到这一点?

dont forget use:(useHTML: true,) 别忘了使用:(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. 我只是用Google搜索并在某个地方找到它。

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. 所以我认为你的文档的方向设置为RTL ,在html标签中使用dir="rtl"属性,或者在样式表文件中设置一些选择器,如*{direction:rtl;}这样文档中的所有内容都将从右到左。 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. 这会将图表的方向重置为ltr ,这样就不会乱了。 but still it's text-alignment is to left. 但仍然是文本对齐是左。

您也可以使用波斯语的一些技巧,可以在这个Farsi网站http://www.barnamenevis.org找到

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM