簡體   English   中英

如何在多系列高圖中顯示固定的工具提示位置?

[英]How to display fixed tooltip position in a multiple series highchart?

我有一系列Highchart,我想在固定位置顯示工具提示。 我根據這個文檔跟蹤了這個高圖演示 不幸的是,根據我編寫的配置代碼,工具提示沒有顯示在固定位置。

該圖表的crosshair設置為true並在我沿x軸移動鼠標時顯示y軸點(下面的屏幕截圖)。 固定工具提示

在上面的截圖中,我要顯示的工具提示CDT158:188.84CDEP158:151.00綠色框(左上固定位置)。

這是我的示例配置代碼

    function plotChartData(dataSeries, xaxisTitle)
{
    myChart = new Highcharts.Chart({
        chart: {
            renderTo: 'chartSpace',
            type: 'line',
            zoomType: 'xy',
            panning: true,
            panKey: 'shift',
            plotBorderWidth: 1,
            events: {
                dblclick: function (e) {
                    window.alert('Hello Chart!')
                }
            }
        },
        title: {
            text: 'Fixed Tooltip'
        },
        legend: {
            layout: 'horizontal',
            align: 'left',
            itemDistance: 10,
            borderWidth: 0,
            itemMarginTop: 0,
            itemMarginBottom: 0,
            padding: 20
        },
        plotOptions: {
            series: {
                states: {
                    hover: {
                        enabled: false
                    }
                },
                dataLabels: {
                    enabled: false,
                    format: '{y}'
                },
                allowPointSelect: false
            }
        },
        xAxis: {
            type: 'datetime',
            labels: {
                rotation: -65,
                style: {
                    fontSize: '9px',
                    fontFamily: 'Verdana, sans-serif'
                }
            },
            crosshair: true
        },
        yAxis: {
            gridLineColor: '#DDDDDD',
            gridLineWidth: 0.5
        },
        tooltip: {
            positioner: function () {
                return { x: 80, y: 10 };
            },
            pointFormat: '{series.name}: <b>{point.y}</b><br/>',
            split: true,
            valueDecimals: 2,
            shadow: false,
            borderWidth: 0,
            backgroundColor: 'rgba(255,255,255,0.8)'
        },
        series: [{
            name: xaxisTitle,
            data: dataSeries
        }]
    });
}

我似乎找不到任何類似於我的要求的解決方案。 我查看了Highcharts API文檔,但是我對使用哪個屬性或對象感到困惑。

任何幫助是極大的贊賞。

拆分工具提示會自動定位,因此這意味着定位器選項不起作用。 您可以使用共享工具提示來獲得所需的結果。

  tooltip: {
positioner: function() {
  return {
    x: this.chart.plotLeft,
    y: this.chart.plotTop
  };
},
shared: true,
headerFormat: '',
pointFormat: '{series.name}: <b>{point.y}</b><br/>',

示例: http//jsfiddle.net/ydwLkyfe/1/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM