Highcharts 将标志工具提示移到上方
我有带旗帜的高股价图表。一切都很好,但我想更改标志工具提示的位置。(将标志的工具提示移到标志的上方)。我还想提供指向标志文本“Test”的链接,它将在新选项卡中打开。有人能帮我吗?这是我的全部代码Highcharts 将标志工具提示移到上方,highcharts,Highcharts,我有带旗帜的高股价图表。一切都很好,但我想更改标志工具提示的位置。(将标志的工具提示移到标志的上方)。我还想提供指向标志文本“Test”的链接,它将在新选项卡中打开。有人能帮我吗?这是我的全部代码 //创建图表 window.chart=新的Highcharts.StockChart({ 图表:{ renderTo:“容器” }, 工具提示:{ 定位器:功能(箱宽、箱高、点){ 返回{ x:point.plotX+20, y:point.plotY+-20 }; }, 分享:是的, 格式化程序:
//创建图表
window.chart=新的Highcharts.StockChart({
图表:{
renderTo:“容器”
},
工具提示:{
定位器:功能(箱宽、箱高、点){
返回{
x:point.plotX+20,
y:point.plotY+-20
};
},
分享:是的,
格式化程序:函数(){
var p='';
如果(本点){
p++=''+Highcharts.dateFormat('%A,%b%e,%Y',this.point.x)+'
';
p+=''+this.point.title+''//这将在标志上添加文本
}
否则{
p++=''+Highcharts.dateFormat(“%A,%b%e,%Y',this.x)+'
';
$.each(this.points,function(i,series){
p+=''+this.series.name+:''+this.y;
});
}
返回p;
},
},
范围选择器:{
选定:1
},
标题:{
文字:“美元兑欧元汇率”
},
亚克斯:{
标题:{
文字:“汇率”
}
},
系列:[{
名称:“美元兑欧元”,
数据:数据,
id:'数据系列',
工具提示:{
样本:4
}
}, {
键入:“标志”,
数据:[{
x:UTC日期(2011年1月20日),
标题:“测试”
}, {
x:UTC日期(2011年3月20日),
标题:“测试”
}],
onSeries:'dataseries',
allowPointSelect:true,
形状:'方针',
y:-40
}]
});
您可以像下面的回答那样调整工具提示
并使用与此类似的方法使标志可单击,以便在单击标志时重定向到url。您可以在“单击事件”上创建函数: 我不认为这将是很容易创建您自己的定位器只为国旗的工具提示,但不为currencytooltip
// 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
}]
});