禁用具有标志的点的工具提示



我正在尝试创建一个高股价图,其中一些点用圆圈标记。将鼠标悬停在图表上时,图表中的所有点都有一个工具提示。

但是,具有标志的点的工具提示应该是标志中的一个。我一直在尝试看看highstock是否有API,通过它我可以根据点是否有标志的条件来判断是否应该显示工具提示。然而,我一直纠结于如何发现一个点是否有标志。

下面是我的一个例子:http://jsfiddle.net/ulhas87/WSDza/

{
    rangeSelector: {
        selected: 1
    },
    title: {
        text: 'USDtoEURexchangerate'
    },
    yAxis: {
        title: {
            text: 'Exchangerate'
        }
    },
    tooltip: {
        formatter: function(){
            console.log(this);
            if(this.point){
                //if this point has a flag then return false 
                //else return the tooltip for this point 
                return this.y;
            }else{
                //this is a flag - hence return the flag tooltip
                return this.y;
            }
        },
    },
    series: [
        {
            name: 'USDtoEUR',
            data: data,
            id: 'dataseries',
            tooltip: {
                valueDecimals: 4
            },
            followPointer: false
        },
        {
            type: 'flags',
            data: [
                {
                    x: Date.UTC(2011,
                    1,
                    14),
                    title: '',
                    text: 'Shape: "circle"'
                },
                {
                    x: Date.UTC(2011,
                    3,
                    28),
                    title: '',
                    text: 'Shape: "circle"'
                }
            ],
            onSeries: 'dataseries',
            shape: 'circle',
            width: 1,
            height: 1,
            y: -4,
            states: {
                hover: {
                    fillColor: '#395C84'//darker
                }
            },
            point: {
                events: {
                    mouseOver: function(){
                        console.log(this);
                    }
                }
            },
            zIndex: 10
        },
        {
            type: 'flags',
            data: [
                {
                    x: Date.UTC(2011,
                    2,
                    10),
                    title: 'C',
                    text: 'Shape: "flag"'
                },
                {
                    x: Date.UTC(2011,
                    3,
                    11),
                    title: 'C',
                    text: 'Shape: "flag"'
                }
            ],
            color: '#5F86B3',
            fillColor: '#5F86B3',
            onSeries: 'dataseries',
            width: 16,
            style: {
                //textstylecolor: 'white'
            },
            states: {
                hover: {
                    fillColor: '#395C84'//darker
                }
            },
            marker: {
                fillColor: '#000000'
            }
        }
    ]
}

感谢您的帮助。感谢

问题是,您的樱桃与用于标志的樱桃不同。请参阅更新版本:http://jsfiddle.net/WSDza/3/

此外,我建议将较低的hideDelay设置为观察点并没有工具提示。

最新更新