Python:HoverToool和Datetime轴

Python:HoverToool和Datetime轴,python,datetime,bokeh,Python,Datetime,Bokeh,我正试图为我的情节找到一个合适的日期时间可视化。它只显示日期时间轴的数值。当我将鼠标悬停在绘图上时,不会显示正确的日期时间 。 对我的代码有什么建议吗?时间戳采用2016-01-01 00:45:00格式 # define source for ColumnDataSource source = ColumnDataSource(df) # define figure plot = figure(plot_height=300, x_axis_type="datetime", sizing_m

我正试图为我的情节找到一个合适的日期时间可视化。它只显示日期时间轴的数值。当我将鼠标悬停在绘图上时,不会显示正确的日期时间

对我的代码有什么建议吗?时间戳采用
2016-01-01 00:45:00
格式

# define source for ColumnDataSource
source = ColumnDataSource(df)
# define figure
plot = figure(plot_height=300, x_axis_type="datetime", sizing_mode="scale_width")
# add a glyph
plot.line('Datetime', 'Preis', source = source, legend='Ausgleichsenergiepreis')
# define hoverTool
hover_tool = HoverTool(tooltips=[('Time', '$Datetime'),('Price', '@Preis')], mode='vline')
hover_tool.formatters = {"Datetime": "datetime"}
plot.add_tools(hover)
# show plot
output_file('Ausgleichenergiepreise.html')
show(plot)

您可以将所需的日期时间格式附加到工具提示(请参见此处:

在“关于鼠标悬停工具的工具提示”部分中)。这只是对代码的一个小小的补充:

hover_tool = HoverTool(tooltips=[
    ('Time', '@Datetime{"%Y-%m-%d %H:%M:%S"}'),
    ('Price', '@Preis')], mode='vline')