Hi, thanks in advance for looking at my code below. I can create points and a line but I would like to connect a line between 2 points and make it draggable with first point being fixed. Also would like to add a hover listener so when I hover over a point I can get the coordinates. Thanks again
here is my py code
from bokeh.plotting import figure, output_file, show, Column
from bokeh.models import DataTable, TableColumn, PointDrawTool, ColumnDataSource
from bokeh.models import PolyDrawTool
output_file("tools_point_draw.html")
p = figure(x_range=(0, 10), y_range=(0, 10), tools=[],
title='Point Draw Tool')
p.background_fill_color = 'lightgrey'
source = ColumnDataSource({
'x': [1, 5, 9], 'y': [1, 5, 9], 'color': ['red', 'green', 'yellow']
})
renderer = p.scatter(x='x', y='y', source=source, color='color', size=10)
columns = [TableColumn(field="x", title="x"),
TableColumn(field="y", title="y"),
TableColumn(field='color', title='color')]
table = DataTable(source=source, columns=columns, editable=True, height=200)
l1 = p.multi_line([[1, 9]], [[5, 5]], line_width=5, alpha=0.4, color='red')
draw_tool = PointDrawTool(renderers=[renderer], empty_value='black')
draw_tool_l1 = PolyDrawTool(renderers=[l1])
p.add_tools(draw_tool, draw_tool_l1)
p.toolbar.active_tap = draw_tool
show(Column(p, table))