【发布时间】:2021-09-27 15:45:41
【问题描述】:
我正在尝试在散景图的 HoverTool 工具提示中嵌入超链接。
我可以通过用 HTML 编写超链接并将其用作工具提示来附加超链接,但是当它在图表上弹出时,该链接不可点击。
有没有办法将可点击的链接附加到散景工具提示中?
示例代码如下:
from bokeh.plotting import ColumnDataSource, figure, show
source = ColumnDataSource(data=dict(
x=[1, 2, 3],
top=[3, 8, 5]))
html_tooltips = """
<div>
<a href="https://xkcd.com/353/">
Come Fly With Me!
</a>
</div>"""
plot = figure(
plot_height = 500,
plot_width = 700,
tooltips=html_tooltips)
plot.vbar(
source=source,
x='x',
top='top')
show(plot)
示例图在这里:
【问题讨论】:
标签: python hyperlink tooltip bokeh