highcharts - 为了显示工具提示,有没有办法增加特定点的灵敏度?
问题描述
我有一个包含多个点的 Highcharts 面积图。这些点的一部分是特殊的,因此用符号(图像)表示。
当有其他点非常靠近特殊点时,很难显示特殊点的工具提示。相反,它显示另一点的工具提示,即使鼠标指针正好在特殊点上。
是否有可能使特殊点对鼠标指针更敏感,以便当我将鼠标移到它的符号(图像)上时它的工具提示将被克服。
这是我的意思的一个例子(jsfiddle) - jsfiddle.net/orenise/cgz7t3yq/30 当我越过太阳标记时,我希望专注于它,它现在的工作方式是如果我有其他观点靠近它,他们可能会成为焦点
解决方案
您可以使用 tooltip.formatter 回调禁用这些点的悬停状态并关闭它们的工具提示。
禁用悬停:
{
x: 1584339600,
y: 24,
id: 'noTooltip',
marker: {
states: {
hover: {
enabled: false
}
}
},
},
工具提示自定义:
tooltip: {
formatter() {
var output = `<span style="font-size: 10px">${Highcharts.time.dateFormat('%A, %b %e, %H:%M:%S', this.key)
}</span><br>
<span style="color:${this.point.color}">●</span> ${this.point.series.name}: <b>${this.point.y}</b><br/>`
if (this.point.id === 'noTooltip') {
return false
} else {
return output
}
}
},
演示:https ://jsfiddle.net/BlackLabel/zbcvLjx3/
API:https ://api.highcharts.com/highcharts/tooltip.formatter
API:https ://api.highcharts.com/highcharts/series.line.marker.states.hover.enabled
推荐阅读
- sql-server - 违反 PRIMARY KEY 约束。无法在对象中插入重复键 - SQL Server - 简单表
- audio - 如何更改 SoX 的录音设备?
- flutter - 为什么这两种为 onPressed 指定回调的方式有效?
- selenium - 无法使用 intellij 和 ubuntu 运行黄瓜场景,实现步骤定义但它们已经实现
- java - CompletableFuture 异常处理 runAsync & thenRun
- c# - 如何通过C#获取我刚刚插入到文档(MS Word)的图片的名称和路径?
- c++ - C++ oop - 类和数据结构
- reporting-services - 将列组中的总计显示为行
- pandas - 州缩写和州名的快速人行横道
- applescript - 如何使用 AppleScript 反复移动桌面上的每个文件夹?