I have a plot with multiple lines. Now I want that the HoverTool shows the color of the corresponding line, when hovering over this line.
So I put all the colors in in a list and then into the ColumnDataSource. However, the HoverTool says ‘color unknown’. Do you see my mistake?
source = ColumnDataSource(data=source_dict)
...
colors = []
lines = []
for curr,color in zip(range(len(currencies)),color_palette):
line = p.line(x='dates', y=currencies[curr], line_width=2, alpha=1, color=color, name=currencies[curr], legend_label=currencies[curr], source=source)
lines.append(line)
colors.append(color)
source_dict['color'] = colors
hover = HoverTool(tooltips=[("date", "@dates{%F}"),
('currency','$name'),
('return','@$name{0.00%}'),
('line color', "$color[hex, swatch]:color")],
formatters={'@dates': 'datetime'})