Hi,
How to get modified data after a PointDrawTool usage ?
I can see new data from a CustomJS callback but cannot figure out how to get them in python for a later use.
Here is my code:
from bokeh.models import ColumnDataSource, PointDrawTool
from bokeh.plotting import Column, figure, output_file, show
from bokeh.models.callbacks import CustomJS
from bokeh.io import output_notebook
output_notebook()
p = figure(x_range=(0, 10), y_range=(0, 10), tools=[],
title='Point Draw Tool')
source = ColumnDataSource({
'x': [1, 5, 9], 'y': [1, 5, 9]
})
code = """
console.log(source.data);
"""
callback = CustomJS(args={'source': source}, code=code)
renderer = p.scatter(x='x', y='y', source=source, size=20)
draw_tool = PointDrawTool(renderers=[renderer], empty_value='black')
p.add_tools(draw_tool)
p.toolbar.active_tap = draw_tool
source.js_on_change('change:data', callback)
show(p)
Any help welcome.