2012-07-11 154 views
1

我已經使用highcharts並使用「usehtml = true」來顯示3行中的文本併爲其中的一行添加顏色。highcharts tooltip usehtml不起作用

工具提示的代碼是

tooltip: 
{ 
    useHTML: true, 
    formatter: function() 
    { 
     var color = ""; 
     if (this.point.config[2]>0) color = "green"; 
     else if (this.point.config[2]<0) color = "red"; 
     return '<div style="direction:rtl;"' + 
      '<p>שעה:' + Highcharts.dateFormat('%H:%M:%S', this.x) +'</p> <p>indice:'+ this.y + '</p><p> change:</p>' 
      + "<p class='"+color+"'>" + this.point.config[2] + "</p>"+'</div>'; 
    } 
}, 

,您可以在這裏的行動 http://s-maof.com/PRO/index3.php?fkapp=2(鼠標懸停6個boxs的一個人也沒有)查看。

這裏具有諷刺意味的,它工作在IE8(我認爲9太多),但不能在FF和鉻(搞笑..)

就是這樣,有什麼建議?

編輯:

我發現highcharts 2.1.4不支持useHTML財產, 所以我upgarded爲2.2.5, 可以查看這裏 http://s-maof.com/PRO/index4.php?fkapp=2

但現在的圖是根本沒有顯示,也嘗試升級我的jQuery版本,沒有。

+0

使用
標籤有你累了嗎? – 2012-07-11 07:44:42

+0

是的,但html屬性在FF中不工作。 tootip標籤獲取脫離html – devmonster 2012-07-11 07:49:31

+0


標記正在FF中使用此小工具正常工作http://jsfiddle.net/gh/get/jquery/1.7.1/highslide-software/highcharts.com/tree/master/samples/highcharts/tooltip/formatter-shared/ – 2012-07-11 08:06:50

回答

1

你的HTML是不完整的:

'<div style="direction:rtl;"' + 

應該是:

'<div style="direction:rtl;">' + 
0

你必須這樣設置方向:

tooltip: { 
useHTML: true, 
formatter: function() { 
return '<div lang="fa" dir="rtl"> ' + 
this.x + ' : ' + this.y + 
'</div>'; 
    } 
}, 
相關問題