2013-12-16 103 views
0

工具提示格式化程序似乎在某些情况下会丢失空间。工具提示格式化程序中的间隔错误?

例如在http://jsfiddle.net/tobinibot/FaHNN/1。您可以看到,在格式化程序功能中,<间距>和<强大的>元素之间存在一个空格,但从视觉上看,在生成的工具提示中似乎没有任何间距。如果您在<范围内>和<强大的>元素之间有2个空格,则工具提示看起来像我所期望的。

tooltip: { 
    formatter: function() { 
     return 'this.x + '<br/><span style="color: ' + this.series.color + ';">' + this.series.name + '</span> <strong>' + this.y + '</strong>'; 
     //                         ^problem spot is here 
    } 
}, 

回答

1

参照useHTML from Highcharts API Options Reference

添加useHTML: true,下提示

tooltip: { 
      useHTML: true, 
      formatter: function() { 
       return this.x + '<br/><span style="color: ' + this.series.color + ';">' + this.series.name + '</span> <strong>' + this.y + '</strong>'; 
      } 
     } 

DEMO: http://jsfiddle.net/FaHNN/2/

+0

是啊,这工作。我更希望只是向开发者提出这个问题,以便他们意识到这个问题,但我会接受你的答案,因为它解决了这个问题(尽管我已经使用2个空格工作了)。 – tobinibot

相关问题