我有带标志的Highstock图表。一切都很好,但我想更改标志的工具提示的位置。(将标志的工具提示移动到标志的上侧)。此外,我还想提供标志文本"测试"的链接,该文本将在新选项卡中打开。有人能帮我吗?这是我的完整代码http://jsfiddle.net/anant_ghate/8byc9/1/
// Create the chart
window.chart = new Highcharts.StockChart({
chart: {
renderTo: 'container'
},
tooltip: {
positioner: function(boxWidth, boxHeight, point) {
return {
x: point.plotX + 20,
y: point.plotY + -20
};
},
shared:true,
formatter: function(){
var p = '';
if(this.point) {
p += '<span>'+ Highcharts.dateFormat('%A, %b %e, %Y', this.point.x) +'</span><br/>';
p += '<b>'+ this.point.title + '</b>' // This will add the text on the flags
}
else {
p += '<b>'+ Highcharts.dateFormat('%A, %b %e, %Y', this.x) +'</b><br/>';
$.each(this.points, function(i, series){
p += '<span style="color:' + this.series.color + '">' + this.series.name + '</span>: <b>'+ this.y;
});
}
return p;
},
},
rangeSelector: {
selected: 1
},
title: {
text: 'USD to EUR exchange rate'
},
yAxis: {
title: {
text: 'Exchange rate'
}
},
series: [{
name: 'USD to EUR',
data: data,
id: 'dataseries',
tooltip: {
yDecimals: 4
}
}, {
type: 'flags',
data: [{
x: Date.UTC(2011, 1, 20),
title: 'Test test'
}, {
x: Date.UTC(2011, 3, 20),
title: 'Test test'
}],
onSeries: 'dataseries',
allowPointSelect : true,
shape: 'squarepin',
y : -40
}]
});
您可以像这个答案中那样调整工具提示Highcharts工具提示始终位于光标的右侧
并使用类似于此高图的方法使标志可点击标签如何定位
要在单击标志时重定向到url,可以在"单击事件"上创建一个函数:http://jsfiddle.net/8byc9/5/我认为只为标志工具提示而不是为currencytolip创建自己的定位器并不容易。。。