2016-04-09 18 views
1

下の図のようにチャートの端にデータが非常に小さい場合、ツールチップは以下のように切り取られます。あなたは2つの異なるソリューションを使用することができ、このツールチップの最初と最後の子の位置を設定する方法

enter image description here

+0

次のようなソリューションを使用できます。http://stackoverflow.com/questions/17680627/highcharts-tooltip-cropping –

答えて

1

のためのソリューションを提案してください。ツールチップが表示さにする必要がある場合はまず、カウント右または左:

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

フィドル:

positioner: function (labelWidth, labelHeight, point) { 
    var tooltipX, tooltipY; 
    if (point.plotX + chart.plotLeft < labelWidth && point.plotY + labelHeight > chart.plotHeight) { 
     tooltipX = chart.plotLeft; 
     tooltipY = chart.plotTop + chart.plotHeight - 2 * labelHeight - 10; 
    } else { 
     tooltipX = chart.plotLeft; 
     tooltipY = chart.plotTop + chart.plotHeight - labelHeight; 
    } 
    return { 
     x: tooltipX, 
     y: tooltipY 
    }; 
} 

フィドル:http://jsfiddle.net/jugal/8cJD7/?utm_source=website&utm_medium=embed&utm_campaign=8cJD7

またはツールチップの固定位置とhttp://jsfiddle.net/jugal/eSfy8/?utm_source=website&utm_medium=embed&utm_campaign=eSfy8

あなたのチャートタイプでツールチップが同じであれば、「チャート」が定義されている場合(通常は)、注意する必要があります。

希望すると助かります!

関連する問題