Javascript 如何在多系列海图中显示固定的工具提示位置?
我有一个多系列的Highchart,我想在固定位置显示工具提示。我是根据这个来跟踪的。不幸的是,根据我编写的配置代码,工具提示没有显示在固定位置 图表有一个设置为true的十字线,当我沿着下面的x轴屏幕截图移动鼠标时,显示y轴点 在上面的屏幕截图上,我想在左上方的绿色框固定位置显示工具提示CDT158:188.84和CDEP158:151.00 这是我的示例配置代码Javascript 如何在多系列海图中显示固定的工具提示位置?,javascript,jquery,highcharts,Javascript,Jquery,Highcharts,我有一个多系列的Highchart,我想在固定位置显示工具提示。我是根据这个来跟踪的。不幸的是,根据我编写的配置代码,工具提示没有显示在固定位置 图表有一个设置为true的十字线,当我沿着下面的x轴屏幕截图移动鼠标时,显示y轴点 在上面的屏幕截图上,我想在左上方的绿色框固定位置显示工具提示CDT158:188.84和CDEP158:151.00 这是我的示例配置代码 function plotChartData(dataSeries, xaxisTitle) { myChart
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/>',
示例:拆分工具提示将自动定位,因此这意味着定位器选项将不起作用。您可以使用共享工具提示来实现所需的结果
tooltip: {
positioner: function() {
return {
x: this.chart.plotLeft,
y: this.chart.plotTop
};
},
shared: true,
headerFormat: '',
pointFormat: '{series.name}: <b>{point.y}</b><br/>',
示例:谢谢您的回答。这就是共享属性的用途。你救了我一天。谢谢你的回答。这就是共享属性的用途。你救了我一天。