Highcharts条形图工具提示HTML定位

时间:2016-02-10 15:47:14

标签: javascript jquery html css highcharts

我目前正在使用highcharts,我在条形图上有一个工具提示被overflow:hidden设置切断,这很好,并且理解我需要该设置但是工具提示的定位是不是过于敏锐,有没有办法相对于列的宽度定位工具提示,即如果工具提示正在导致滚动条可以减少偏移?我没有代码示例,但我附上了问题的图片,

enter image description here

1 个答案:

答案 0 :(得分:2)

在工具提示中使用工具提示定位器功能。根据您的显示要求调整tooltipX和tooltipY:

    positioner: function(labelWidth, labelHeight, point) {         
                         var tooltipX, tooltipY;
                            if (point.plotX + labelWidth > this.chart.plotWidth) {
                                tooltipX = point.plotX + this.chart.plotLeft - labelWidth - 40;
                            } else {
                                tooltipX = point.plotX + this.chart.plotLeft + 40;
                            }
                            tooltipY = point.plotY + this.chart.plotTop - 20;
                            return {
                                x: tooltipX,
                                y: tooltipY
                            };       
                    }