简体   繁体   English

Highcharts - 如何删除固定工具提示和点之间的连接线

[英]Highcharts - How to remove connecting line between fixed tooltip and point

We've just updated to the latest Highcharts version and now a few of our chart types have a new line connecting the tooltip to the point.我们刚刚更新到最新的 Highcharts 版本,现在我们的一些图表类型有一条新线将工具提示连接到点。

It's mainly obvious on charts with fixed tooltips.它主要在带有固定工具提示的图表上很明显。

Does anyone know how to remove this line without removing the border of the tooltip itself?有谁知道如何在不删除工具提示本身的边框的情况下删除这条线?

I have come up with a work around that involves setting the borderwidth of the tooltip to 0 and adding a rounded, bordered, coloured div to the tooltip using useHTML:true and disabling the shadow.我想出了一个解决方法,包括将工具提示的边框宽度设置为 0,并使用 useHTML:true 和禁用阴影向工具提示添加圆形、带边框、彩色的 div。

Though I dont want to do this for every chart as it seems a bit nasty.虽然我不想对每个图表都这样做,因为它看起来有点讨厌。

This also affects bar and tree maps that I can see and I've trawled the documentation to no avail.这也会影响我可以看到的条形图和树形图,并且我已经浏览了文档无济于事。

连接线

http://jsfiddle.net/mattscotty/bqw4bc4x/1/ http://jsfiddle.net/mattscotty/bqw4bc4x/1/

Highcharts.chart('container', {
title: {
    text: 'Fixed tooltip'
},

tooltip: {
    positioner: function () {
        return { x: 80, y: 50 };
    },
    backgroundColor: 'rgba(255,255,255,0.8)',

    //Uncomment below to remove line, but this also removes tooltip border
    //borderWidth:0,
    //shadow:false
},

xAxis: {
    categories: ['Jan', 'Feb', 'Mar']
},

series: [{
    data: [29.9, 71.5, 106.4]
}, {
    data: [194.1, 95.6, 54.4]
}]
});

Thanks in advance.提前致谢。

By default tooltip's shape is set to a callout which has a chevron/line pointing to the point.默认情况下,工具提示的形状设置为带有指向该点的 V 形/线条的标注。 You can change the tooltip's shape to, eg rectangle - which does not have any connector.您可以将工具提示的形状更改为例如矩形 - 没有任何连接器。

tooltip: {
    positioner: function () {
        return { x: 80, y: 50 };
    },
    backgroundColor: 'rgba(255,255,255,0.8)',
    shape: 'rect'

example: http://jsfiddle.net/bqw4bc4x/2/示例: http : //jsfiddle.net/bqw4bc4x/2/

The accepted answer only partially worked in Highstock.接受的答案仅部分适用于 Highstock。 The connectors for the volume and indicator tooltips were suppressed, but I still had a connector from the DateTime box to the crosshair.音量和指示器工具提示的连接器被抑制,但我仍然有一个从日期时间框到十字准线的连接器。

As an alternative to the shape: 'rect' hack, you can try:作为 shape: 'rect' hack 的替代方案,您可以尝试:

tooltip: {
positioner: function () {
    return { x: 80, y: 50 };
},
split: false,
shared: true,
backgroundColor: 'rgba(255,255,255,0.8)'

These split: and shared: settings consolidate all the tooltip boxes into a single box.这些 split: 和 shared: 设置将所有工具提示框合并为一个框。 Provided that this meets your needs it seems to solve the connector issue.如果这满足您的需求,它似乎可以解决连接器问题。

Very odd design decision by Highcharts. Highcharts 非常奇怪的设计决定。 The connectors are highly intrusive visually and I can't imagine that many designers will want to use them, but you can only disable them with a hack.连接器在视觉上具有很强的侵入性,我无法想象许多设计师会想要使用它们,但您只能通过 hack 来禁用它们。 What were they thinking?他们在想什么?

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

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