bokeh - HoverToolTip 持续散景
问题描述
考虑以下散景示例,双击相应的圆圈后,如何使悬停工具箱持续存在?我希望能够同时在多个圆圈上可视化悬停工具提示。再次双击应该会使持久悬停工具框消失。
from bokeh.plotting import ColumnDataSource, figure, output_file, show
output_file("toolbar.html")
source = ColumnDataSource(data=dict(
x=[1, 2, 3, 4, 5],
y=[2, 5, 8, 2, 7],
desc=['A', 'b', 'C', 'd', 'E'],
imgs=[
'https://docs.bokeh.org/static/snake.jpg',
'https://docs.bokeh.org/static/snake2.png',
'https://docs.bokeh.org/static/snake3D.png',
'https://docs.bokeh.org/static/snake4_TheRevenge.png',
'https://docs.bokeh.org/static/snakebite.jpg'
],
fonts=[
'<i>italics</i>',
'<pre>pre</pre>',
'<b>bold</b>',
'<small>small</small>',
'<del>del</del>'
]
))
TOOLTIPS = """
<div>
<div>
<img
src="@imgs" height="42" alt="@imgs" width="42"
style="float: left; margin: 0px 15px 15px 0px;"
border="2"
></img>
</div>
<div>
<span style="font-size: 17px; font-weight: bold;">@desc</span>
<span style="font-size: 15px; color: #966;">[$index]</span>
</div>
<div>
<span>@fonts{safe}</span>
</div>
<div>
<span style="font-size: 15px;">Location</span>
<span style="font-size: 10px; color: #696;">($x, $y)</span>
</div>
</div>
"""
p = figure(plot_width=400, plot_height=400, tooltips=TOOLTIPS,
title="Mouse over the dots")
p.circle('x', 'y', size=20, source=source)
show(p)
解决方案
推荐阅读
- javascript - 使用html js实现定时器暂停
- python - 具有不同贪心程度的 Python 正则表达式
- python - 无法在 mysql 表中正确存储非英文名称
- c# - 我无法使用 c# 将文件上传到一个驱动器
- javascript - 在 JavaScript 中以变量的形式添加整数
- windows - Powershell以百分比获取进程统计信息
- c# - 在模态类操作链接中将文本框值从视图传递到控制器
- swift - 如何将包集合添加到我的 Xcode 项目?
- flutter - 如何解释颤振工具提示以独立编写代码?
- html - 如何在 Inkscape 中制作区域的正常边界?