2016-12-27 105 views
0

期待是否有可能自定義拆分工具提示位置?

共享系列有獨立的立場提示

試圖

按照Highcharts文件,我知道Highcharts.tooltip.positioner可以使一些自定義的工具提示,但在我四處搜尋,他們全部是未拆分工具提示。並在分裂的情況下失敗,所以有沒有可能自定義拆分工具提示位置?

http://jsfiddle.net/TabGre/fyxqsq4L/

UPD

每個點的工具提示它上面,就像positioner

positioner: function() { 
    return { 
    x: this.plotX; 
    y: this.plotY + 100; 
    } 
} 
+0

你所說的 「分裂」 是什麼意思? – wergeld

+0

定位器無法使用拆分工具提示。你可以使用distance屬性:http://jsfiddle.net/zefz1u5e/1/你究竟想要定位工具提示? – morganfree

+0

我已更新我的問題;微笑; –

回答

1

正如我在評論中提到,目前的定位回調不影響拆分工具提示。但是,可以覆蓋負責渲染拆分工具提示的功能。它需要你自己計算位置。

如果你想要一個分割工具提示在左上角,就像在你的fiddle 你需要覆蓋Highcharts.Tooltip.prototype.renderSplit = function(labels, points)與每個框的所需位置。

var yPos = 0; 

      each(boxes, function(box, i) { 
       var point = box.point, 
        series = point.series; 

       // Put the label in place 
       box.tt.attr({ 
       // visibility: box.pos === undefined ? 'hidden' : 'inherit', 
        x: (rightAligned || point.isHeader ? 
         //box.x : 
         0 : 
         point.plotX + chart.plotLeft + pick(options.distance, 16)), 
        // y: box.pos + chart.plotTop, 
        y: yPos, 
        anchorX: point.isHeader ? 
         point.plotX + chart.plotLeft : point.plotX + series.xAxis.pos, 
        anchorY: point.isHeader ? 
         box.pos + chart.plotTop - 15 : point.plotY + series.yAxis.pos 
       }); 
       yPos += box.size; 
      }); 

例如:http://jsfiddle.net/tbguemvL/

+0

感謝您所做的一切,我會盡我所能瞭解您的代碼。 –