Skip to content
Advertisement

Update DataTable on Tap event in Bokeh

I am trying to calculate euclidean distance of two points. Initial distance is calculated in the data.

Then, when the user is moving the line, I’d like the distance column to update based on the new coordinates. I can see that x and y columns are updating, but not the distance column. Below is my attempt:

JavaScript

Advertisement

Answer

Your callback actually never triggers here. It’s just the pointdraw event doing its thing. You should have your callback trigger when source.data is changed.

JavaScript

I did it for distance from the first point but you could do from origin too.

If it’s from the first point you need to update all the distances each time (since the draw tool lets you drag existing points)

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement