hover mode on Chart.js(Chart.js 上的悬停模式)
问题描述
当您没有悬停在折线图中的特定点"上时,是否可以激活悬停?
Is it possible to have the hover activated when you are not hovering over a specific 'point' in a line graph?
当我将鼠标悬停在图表的任何部分上时,我希望 那个 特定的工具提示能够激活.
I want that particular tooltip to activate whenever I hover over any part of the chart.
类似 http://watchstocks.herokuapp.com/
推荐答案
是的,您可以使用 chart.js 配置工具提示,以获得与您引用的图表类似的行为.
Yes, you can use chart.js to configure tooltips to get a similiar behavior to the chart that you referenced.
有关详细信息,请查看 模式 工具提示配置选项和 hover 配置选项满足您的需求.这是一个例子.
For more information, check out the mode tooltip config option and hover config options for your needs. Here is an example.
options: {
responsive: true,
title:{
display:true,
text:'Chart.js Line Chart'
},
tooltips: {
mode: 'index',
intersect: false,
},
hover: {
mode: 'nearest',
intersect: true
},
scales: {
xAxes: [{
display: true,
scaleLabel: {
display: true,
labelString: 'Month'
}
}],
yAxes: [{
display: true,
scaleLabel: {
display: true,
},
}]
}
}
这是一个 codepen 示例,展示了与您的示例相匹配的行为.
Here is a codepen example demonstrating the behavior that matches your example.
这篇关于Chart.js 上的悬停模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Chart.js 上的悬停模式
基础教程推荐
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
