工具提示格式化程序中的间距错误?

时间:2013-12-16 05:16:26

标签: javascript highcharts

工具提示格式化程序在某些情况下似乎正在丢弃空间。

http://jsfiddle.net/tobinibot/FaHNN/1处的示例。你可以看到在formatter函数中,< span>之间有一个空格。和< strong>元素,但在视觉上,生成的工具提示中似乎没有任何间距。如果< span>之间有2个空格和< strong>元素,然后工具提示看起来像我期望的那样。

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 个答案:

答案 0 :(得分:2)

请参阅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>';
            }
        }

样本: http://jsfiddle.net/FaHNN/2/

相关问题