I was struggling hard to find a way to display time in local (browser) timezone - it’s not currently supported by existing “formatters”-
Sharing it mostly for knowledge:
hover_ts_update_callback = CustomJS(args={'data_source':data_source}, code="""
var el_arr = document.querySelectorAll('.hover_timestamp')
el_arr.forEach(function(el) {
if (cb_data.index['0d'].indices[0]) {
var tick = data_source.data['time'][cb_data.index['0d'].indices[0]];
var date = new Date(tick);
var date_str = date.toLocaleDateString('en-EN', {
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
hour12: false,
month: 'short',
day: 'numeric'
});
el.innerHTML = date_str;
}
})
""")
historical_hover_tool = HoverTool(
tooltips=[('timestamp', '<div style="min-width: 100px;"><span class="hover_timestamp"></span></div>')] +
[(var, '@%s{0.000}' % var) for var in signals],
callback=hover_ts_update_callback,
)
fig = figure(
tools = [historical_hover_tool],
)

