I am trying to make a coloured border on a tooltip. The code below is working when using 2.2 but it does not work when upgrading to 2.3.
I defined a tag in the tooltip so that the there is the text is centered with a coloured border for the first line of the tooltip. The border does not exist and the text is not centered.
See minimal code to reproduce the issue.
from bokeh.plotting import output_file, show
from bokeh.plotting import figure
from bokeh.models import ColumnDataSource
from bokeh.models import HoverTool
p = figure(plot_width=600, plot_height=600, x_axis_location='above', tools=['pan', 'wheel_zoom', 'box_zoom', 'reset'])
p.min_border = 0
data = {
'y': [5, 6, 14],
'x': [20, 7, 12],
'name': ['T10_a', 'T56_b', 'T32_c'],
'colours': ['red', 'green', 'blue'],
'desc': ['T10', 'T56', 'T32']
}
squares_source = ColumnDataSource(data=dict(
desc=data['desc'],
name=data['name'],
x=data['x'],
y=data['y'],
colours=data['colours']
))
renderer = p.square(
x='x', y='y', name='name',
size=16,
line_width=1,
source=squares_source, color='colours')
tooltips = """
<style>
.center {
text-align: center;
border: 3px solid @colours{safe};
}
</style>
<div style="width: 250px">
<div class="center">
<span style="font-size: 15px; font-weight: bold;">@desc</span>
</div>
<div>
<span style="font-size: 11px; font-weight: normal;">Name: @name</span>
<br>
<span style="font-size: 11px; font-weight: normal; color: @colours{safe}">@desc</span>
<br>
</div>
</div>
"""
p.add_tools(HoverTool(renderers=[renderer], tooltips=tooltips))
output_file("bokeh_tooltip_broken.html", title="bokeh_tooltip_broken example", mode='inline')
show(p)
See example of the coloured border: