Odd 'hover_line_*' option behaviour with multi_line

Hi all,
I produced the following example trying to understand how the options hover_line_color and hover_line_alpha actually work with multi_line:

from bokeh.layouts import  row, column
from bokeh.models import ColumnDataSource, HoverTool, TapTool, IndexFilter, CDSView
from bokeh.plotting import figure, show

xs1 = [[0, 1],[0,1]]
ys1 = [[1, 1], [2,2]]
ys2 = [[3, 3], [4,4]]

xs = [[0, 1],[0,1],[0,1],[0,1]]
ys = [[1, 1], [2,2],[3, 3], [4,4]]

dd1 = dict(xs1=xs1, ys1=ys1, ys2=ys2)
dd = dict(xs=xs, ys=ys)

source1 = ColumnDataSource(dd1)
source2 = ColumnDataSource(dd1)
source = ColumnDataSource(dd)

filt1 = IndexFilter(indices = [i for i in range(len(source.data['ys'])) if source.data['ys'][i][0] < 2.5])
filt2 = IndexFilter(indices = [i for i in range(len(source.data['ys'])) if source.data['ys'][i][0] > 2.5])

view1 = CDSView(filter = filt1)
view2 = CDSView(filter = filt2)

p = figure(title='directly specified xs and ys', tools=[HoverTool(), TapTool()])

a = p.multi_line(xs = xs1, ys = ys1, line_width=2, line_alpha=0.3, color = 'blue',
    hover_line_color='blue', hover_line_alpha=0.8)
b = p.multi_line(xs = xs1, ys = ys2, line_width=2, line_alpha=0.3, color = 'red',
    hover_line_color='red', hover_line_alpha=0.8)


q = figure(title='same CDS', tools=[HoverTool(), TapTool()])

c = q.multi_line(xs = 'xs1', ys = 'ys1', line_width=2, line_alpha=0.3, color = 'blue',
    hover_line_color='blue', hover_line_alpha=0.8, source = source1)
d = q.multi_line(xs = 'xs1', ys = 'ys2', line_width=2, line_alpha=0.3, color = 'red',
    hover_line_color='red', hover_line_alpha=0.8, source = source1)

r = figure(title = 'different CDS', tools=[HoverTool(), TapTool()])

e = r.multi_line(xs = 'xs1', ys = 'ys1', line_width=2, line_alpha=0.3, color = 'blue',
    hover_line_color='blue', hover_line_alpha=0.8, source = source1)

f = r.multi_line(xs = 'xs1', ys = 'ys2', line_width=2, line_alpha=0.3, color = 'red',
    hover_line_color='red', hover_line_alpha=0.8, source = source2)

s = figure(title='same CDS, different views', tools=[HoverTool(), TapTool()])

g = s.multi_line(xs = 'xs', ys = 'ys', line_width=2, line_alpha=0.3, color = 'blue',
    hover_line_color='blue', hover_line_alpha=0.8, source = source, view = view1)

h = s.multi_line(xs = 'xs', ys = 'ys', line_width=2, line_alpha=0.3, color = 'red',
    hover_line_color='red', hover_line_alpha=0.8, source = source, view = view2)


show(column([row([p,q]),row([r,s])]))

In particular, the result in the last figure (bottom right) is a bit weird IMHO, and affects my use case: if use two different views of the same datasource, the aforementioned options only seem to work for the last rendered multi_line glyph (the red ones). Is this the expected behaviour?

The first three are. I guess I’d regard the last one as exhibiting a bug. I’d suggest you can submit a GitHub Issue with a Minimal Reproducible Example, but standard OSS disclaimers apply: I can’t promise any particular turnaround time. Selections and views are somewhat complex individually, and their intersection will require a fair amount of investigation.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.