简体   繁体   English

Highcharts:如何使工具提示位置在视口中可见

[英]Highcharts: How to make Tooltip position to be visible in the Viewport

I am using a chart that is vertically longer that is wrapped inside a Container with Veritical scrolling enabled. 我正在使用一个垂直更长的图表,它包含在启用了Veritical滚动的Container中。 Everything works fine. 一切正常。 However, when I create a tooltip (in my case a big one), it gets hidden at times because it thinks the view port of chart is big. 但是,当我创建一个工具提示(在我的情况下是一个大工具提示)时,它有时会被隐藏,因为它认为图表的视图端口很大。 Is there any way to make the tooltip in a fixed position or always appear in the parent container's viewport ? 有没有办法让工具提示处于固定位置或始终出现在父容器的视口中?

在此输入图像描述

A sample fiddle having the similar problem: http://jsfiddle.net/Swsbb/52/ 一个样本小提琴有类似的问题: http//jsfiddle.net/Swsbb/52/

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

In tooltip there is option useHTML , that adds advanced formatting to tooltip, also there is option positioner - this is callback function that allows you change position for tooltip. 在工具提示中有选项useHTML ,它为工具提示添加高级格式,还有选项定位器 - 这是允许您更改工具提示位置的回调函数。

// 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 };
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM