Highcharts改变了工具提示的外观

时间:2013-08-14 14:28:27

标签: highcharts tooltip

对于我的项目,我需要更改工具提示的外观。 我在api文档中找到了将useHTML设置为true,但它没有帮助。

这是我的例子:

tooltip: {
          borderWidth: 0,
          style: {
              padding: 0
          },
          useHTML: true,

          formatter: function(){
              return '<div style="float:left"><small>' + this.series.name + 
                     '</small></div><br/><div style="float:left;">test:</div>' + 
                     '<div style="float:left;padding-left: 30px;"><b>' +
                     this.point.test + 
                     '</b></div>';
              }


          }

http://jsfiddle.net/6tc6T/147/

1 个答案:

答案 0 :(得分:1)

将工具提示移出plotOptions http://jsfiddle.net/ahZWS/

    var options = {

        ...

        legend: {
            enabled: false
        },
        tooltip: {
            borderWidth: 0,
            style: {
                padding: 0
            },
            useHTML: true,

            formatter: function(){
                return '<div style="float:left"><small>' + this.series.name + 
                    '</small></div><br/><div style="float:left;">test:</div>' + 
                    '<div style="float:left;padding-left: 30px;"><b>' + this.point.test + 
                    '</b></div>';
            }


        },
        plotOptions: {
            ...
        }
        , series: seriesArr
    };