2014-11-21 38 views
3

我使用垂直方向更長的圖表,該圖表在啓用Veritical滾動的情況下包裝在容器中。一切正常。但是,當我創建一個工具提示(在我的情況下是一個大工具提示)時,它有時會隱藏,因爲它認爲圖表的視圖端口很大。有沒有辦法使工具提示處於固定位置或始終顯示在父容器的視口中?Highcharts:如何使工具提示位置在視口中可見

enter image description here

具有類似問題的一個樣本小提琴:http://jsfiddle.net/Swsbb/52/

<div style='max-height:300px;overflow-y:auto'> 
    <div id="container" style="height: 1000px"></div> 
</div> 
+0

見[此](http://stackoverflow.com/questions/10734746/highcharts-tooltip-溢出是隱藏的)問題和[這一個](http://stackoverflow.com/questions/ 18658043/highcharts餡餅,提示切口關閉)。 – 2014-11-21 13:37:07

+1

@PawełFus:兩者都不同於我所問(見我的小提琴)。感謝您分享他們。 – bragboy 2014-11-21 14:55:48

+0

您可以隨時禁用內置的工具提示,並創建自己的位於該容器外部的工具提示。然後簡單使用['plotOptions.series.point.events.mouseOver/mouseOut'](http://api.highcharts.com/highcharts#plotOptions.series.point.events.mouseOut)事件。 – 2014-11-21 15:22:36

回答

1

在提示有選擇useHTML,即增加了高級格式化,以提示,也有選擇positioner - 這是回調函數允許您更改工具提示的位置。

// fixed position 
positioner: function() { 
    return { x: 10, y: 10 }; 
}, 

// change position only for y 
positioner: function (labelWidth, labelHeight, point) { 
    return { x: point.plotX, y: point.plotY - 50 }; 
}