Javascript Highcharts-单击鼠标而不是悬停时显示工具提示
我已经尝试了解决方案,但没有任何效果,因为我的高图表由两个系列的数据组成 按照上面的解决方案返回错误 未捕获的TypeError:无法读取未定义的属性“category”Javascript Highcharts-单击鼠标而不是悬停时显示工具提示,javascript,jquery,highcharts,Javascript,Jquery,Highcharts,我已经尝试了解决方案,但没有任何效果,因为我的高图表由两个系列的数据组成 按照上面的解决方案返回错误 未捕获的TypeError:无法读取未定义的属性“category” 但是,当我点击任何一点时,工具提示都不会显示。解决了这个问题 刚刚改变 this.chart.myTooltip.refresh(evt.point,evt) 到 刷新([evt.point],evt) 但此修复的唯一限制是,如果存在多个系列(例如A和B行),且两个系列的数据位于同一X轴上(例如,在同一日期),单击它将仅显示该
但是,当我点击任何一点时,工具提示都不会显示。解决了这个问题强> 刚刚改变 this.chart.myTooltip.refresh(evt.point,evt) 到 刷新([evt.point],evt) 但此修复的唯一限制是,如果存在多个系列(例如A和B行),且两个系列的数据位于同一X轴上(例如,在同一日期),单击它将仅显示该特定系列数据的工具提示(如果单击系列A的数据,工具提示仅显示A的数据而不显示B,即使它们共享相同的X轴)
$(function () {
$('#container').highcharts({
chart: {
type: 'spline',
zoomType: 'xy',
events: {
load: function(){
this.myTooltip = new Highcharts.Tooltip(this, this.options.tooltip);
}
}
},
tooltip: {
enabled: false,
headerFormat: '<b>{point.x: %A, %b %e at %I:%M %p}</b><br>',
shared: true,
borderRadius: 10,
crosshairs: [true, false] //x,y
},
plotOptions: {
series: {
stickyTracking: false,
events: {
click: function(evt) {
this.chart.myTooltip.refresh(evt.point, evt);
},
mouseOut: function() {
this.chart.myTooltip.hide();
}
}
}
},
title: {
text: 'Glucose/Carbohydrate'
},
subtitle: {
text: 'Ratio between Glucose and Glucose'
},
xAxis: {
type: 'datetime',
dateTimeLabelFormats: {
month: '%e/%b',
},
title: {
text: 'Date'
}
},
yAxis: [{ // Glucose yAxis
labels: {
format: '{value}mmol/L',
style: {
color: Highcharts.getOptions().colors[0]
}
},
title: {
text: 'Glucose',
style: {
color: Highcharts.getOptions().colors[0]
}
}
}, { // Carbohydrate yAxis
title: {
text: 'Carbohydrate',
style: {
color: Highcharts.getOptions().colors[1]
}
},
labels: {
style: {
color: Highcharts.getOptions().colors[1]
}
},
opposite: true
}],
series: [{
name: 'Glucose',
data: glucose,
marker: {
enabled: true
},
tooltip: {
valueSuffix: ' mmol/L'
}
},{
name: 'Carbohydrate',
data: carbohydrate,
dashStyle: 'shortdot',
yAxis: 1,
marker: {
enabled: true
}
}
]}
);
});
plotOptions: {
series: [{
stickyTracking: false,
events: {
click: function(evt) {
this.chart.myTooltip.refresh(evt.point, evt);
},
mouseOut: function() {
this.chart.myTooltip.hide();
}
}
},
{
stickyTracking: false,
events: {
click: function(evt) {
this.chart.myTooltip.refresh(evt.point, evt);
},
mouseOut: function() {
this.chart.myTooltip.hide();
}
}
}]
},