borisvanax
borisvanax

Reputation: 794

Displaying datetime format in Bokeh hovertools?

I have a Bokeh plot that looks like this: bokehplot

I used the following code for hovertools

hover = HoverTool(tooltips=
                      [
        ('Time', '@van_timestamp'),
        ('Traffic Intensity', '@aantal'),
        ('VRI Number', '@vri')
    ])

where 'van_timestamp' is a datetime formatted column. My questions is: Is it possible to display the actual datetime format on hover instead of Unix time code? And if so, How can I achieve this?

Thanks!

Upvotes: 0

Views: 573

Answers (1)

Eugene Pakhomov
Eugene Pakhomov

Reputation: 10652

HoverTool(tooltips=[('Time', '@van_timestamp{%c}')],
          formatters={'@van_timestamp': 'datetime'})

%c is the format that specifies the preferred date and time representation for the current locale. More formats are available in the documentation for bokeh.models.formatters.DatetimeTickFormatter.

Upvotes: 3

Related Questions