高图表在点单击时显示工具提示
highcharts show tooltip on point click
我正在尝试更改我的高图表的行为,以便在单击点而不是悬停在点上时显示有关数据的工具提示,这是我的图表对象代码,
this.chart = new Highcharts.Chart({
chart : {
renderTo : $container[0],
type : chartType,
events : {
load: function() {
this.myTooltip = new Highcharts.Tooltip(this, this.options.tooltip);
console.log(this.myTooltip);
}
}
},
title: {
enabled : false,
useHTML: true,
text: ''
},
legend : {
enabled : false
},
xAxis: {
categories: self.categories,
labels : {
rotation : 90,
formatter: function(){
return '<a href="" class="axisLabel" data-name="'+ this.value +'">' + this.value + '</a>';
},
useHTML: true,
padding: '10px',
y: 30,
x: -5,
align:'left'
}
},
yAxis: {
allowDecimals: false,
opposite:false
},
tooltip: {
enabled: false,
useHTML : true,
backgroundColor: "rgba(255,255,255,1)",
formatter : function() {
if(self.graphView != "turn") {
var tooltip = self.showClientProjects(this.x, self.organisation_filter, this.y, self.graphView);
self.pointIndex = this.point.index;
return tooltip.innerHTML;
} else {
console.log(this.x);
var tooltip = self.showClientProjects(this.x, null, null, self.graphView);
self.pointIndex = this.point.index;
return tooltip.innerHTML;
}
}
},
plotOptions: {
column: {
maxPointWidth: 5,
pointPadding: 0.2,
//borderWidth:1
},
series: {
stickyTracking: false,
events: {
click: function(evt){
this.chart.myTooltip.refresh(evt.point, evt)
},
mouseOut: function() {
this.chart.myTooltip.hide();
}
}
}
},
series: [{
data : data,
dataLabels : {
crop : false
}
}]
});
单击一个点将返回此错误,
highcharts.src.js:1319 uncatch 类型错误:无法读取 null 的属性"调用",这行代码来自 Highcharts 库,
// If the event handler return false, prevent the default handler from executing
if (fn.call(el, eventArguments) === false) {
eventArguments.preventDefault();
}
然而,它在我敲起的快速小提琴上工作得很好,
http://jsfiddle.net/d1gL4cjx/1/
这是更新(固定)小提琴的链接:http://jsfiddle.net/d1gL4cjx/2/
相关文章:
- Highcharts-在单击而不是悬停时显示工具提示
- C3.js通过单击按钮显示工具提示
- 未单击按钮时显示工具提示
- 高图表在点单击时显示工具提示
- Flexslider-当鼠标悬停在点上时显示工具提示
- 高亮显示工具提示共享项,具体取决于Highcharts中悬停的系列
- 显示工具提示而不双击字段
- 在 Twitter 引导程序中自动显示工具提示,而无需放置光标
- 悬停时显示工具提示
- 隐藏 x 轴标签,但在图表.js中显示工具提示
- 突出显示工具提示中未显示名称的 3D 散点
- 如何在图像库森时更改颜色和显示工具提示
- q提示 2 - 鼠标按下以显示工具提示?鼠标向上隐藏
- D3.js水平折线图无法正确显示工具提示
- 在 d3.js 折线图中永久显示工具提示
- 如何在 SVG 上的鼠标光标旁边显示工具提示,尽管网站上有非 SVG 元素
- 高图表在类别标签悬停时显示工具提示
- 仅在完全创建时显示工具提示
- 鼠标输入时未显示工具提示
- 鼠标悬停时无法显示工具提示,jQuery1.11