Hovertool-Bokeh“;无法读取属性";
我的问题是,在Chrome中,当我将光标悬停在直方图上的数据上时,出现以下错误:Hovertool-Bokeh“;无法读取属性";,hover,bokeh,Hover,Bokeh,我的问题是,在Chrome中,当我将光标悬停在直方图上的数据上时,出现以下错误: Uncaught TypeError: Cannot read property '0' 这是我的代码: hist, edges = np.histogram(data,bins=3000) plot = quad( top=hist, bottom=0, left=edges[:-1], right=edges[1:], fill_color="#036564",
Uncaught TypeError: Cannot read property '0'
这是我的代码:
hist, edges = np.histogram(data,bins=3000)
plot = quad(
top=hist,
bottom=0,
left=edges[:-1],
right=edges[1:],
fill_color="#036564",
line_color="#033649",
tools="pan,wheel_zoom,box_zoom,reset, hover",
x_range=[-0.5,3.5],
plot_width=1100,
title="",
)
hover = plot.select(dict(type=HoverTool))
hover.tooltips = [('index','$index')]
resources = Resources("inline")
plot_script, plot_div = components(plot, resources)
html_script = mark_safe(encode_utf8(plot_script))
html_div = mark_safe(encode_utf8(plot_div))
figure()
return html_script, html_div
“数据”是如下所示的数组:
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1.24,1,1.32,1,2,3]
我试着在四元组中添加一个“源代码”,更改了图形,更改了文档中的代码,但仍然存在错误
作为参考,除了悬停工具外,一切都运行得很好
事实上,在“悬停框”中,我需要另一个信息,然后只是“索引”,但这只是为了测试
谢谢你的阅读 对不起,我刚才错过了这个。您已经用悬停工具发现了一个小错误,它是
quad
glyphs特有的。同时,您可以将hover.snap\u添加到\u data=False
以使其正常工作
以下是您可以跟踪的完整解决方案的GH问题:
下周一的0.7.1版本中应该会有一个补丁
顺便说一句,您正在使用一个不推荐使用的API。您现在应该编写如下代码:
p = figure(...)
p.quad(...)