Python Bokeh - Assign taptool to a subset of Glyphs -


hi have timeserie add circle glyphs, representing 2 different type of data.

i managed assign different tooltip each of them using suggestion presented here: https://stackoverflow.com/a/37558475/4961888

i hoping use similar syntax assign specific subset of glyph taptool, bring me url present in source of glyphs.

so tried:

    fig = figure(x_axis_type="datetime", height=200, tools="tap")     fig.line(x_range, y_range)       news_points = fig.circle(x='timestamp', y='y', fill_color="green", size=5, source=news_source)      url = "@url"     taptool = fig.select(type=taptool)     taptool.renderers.append(news_points)     taptool.callback = openurl(url=url) 

but receive:

attributeerror: '_list_attr_splat' object has no attribute 'renderers' 

it seems me taptool has different way of being assigned glyphs hovertool, , couldn't find documentation on web regarding problem. glad if better grip of package me wrap head around it.

fig.select returns list, you'll want access first (and only, i'd assume) element.

fig = figure(x_axis_type="datetime", height=200, tools="tap") fig.line(x_range, y_range)   news_points = fig.circle(x='timestamp', y='y', fill_color="green", size=5, source=news_source)  url = "@url" taptool = fig.select(type=taptool)[0] taptool.renderers.append(news_points) taptool.callback = openurl(url=url) 

or

fig = figure(x_axis_type="datetime", height=200, tools="tap") fig.line(x_range, y_range)   news_points = fig.circle(x='timestamp', y='y', fill_color="green", size=5, source=news_source)  url = "@url" taptool = fig.select_one(taptool) taptool.renderers.append(news_points) taptool.callback = openurl(url=url) 

Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -