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
Post a Comment