Detecting the Click on a DataPoint ServerSide....

Goal: simply to detect the selection (clicking) of an individual datapoint server-side.

Apparent Bokeh-Approved Strategy: monitor the “selected” attribute of the GlyphRenderer’s data source (that’s what the demos do).

Problem: even the TapTool does not limit selections to a single datapoint (if the scatter plot is sufficiently zoomed-out multiple datapoints will appear selected). The result is that there is no way(apparently***) to be updated serverside about a click on an individual datapoint!!! Also, it is a bit counter-intuitive that one needs to add a Tool to trap a click on a datapoint (I’m assuming this is possible with CallbackJS but how do I get the news back to the serverside Python?)…

***I’m sure there’s a way, I’m just not seeing it yet :slight_smile:

This other post in the group links to some references on how to open window with javascript callback after clicking on tables.
Could be useful.

I imagine that you want to call a function in the server side instead of opening a page, but part of the code should be similar in both cases.

For the need of the tool, it should be because the code reads the data points selected on the columnDataSource, hence you need a seletion tool. I get it would be better if we could just click. To help with this detail you could make the selection tool the default tool, making the selection/click more intuitive as you mentioned.

···

On Tuesday, August 8, 2017 at 2:08:17 PM UTC+9, Manor Askenazi wrote:

Goal: simply to detect the selection (clicking) of an individual datapoint server-side.

Apparent Bokeh-Approved Strategy: monitor the “selected” attribute of the GlyphRenderer’s data source (that’s what the demos do).

Problem: even the TapTool does not limit selections to a single datapoint (if the scatter plot is sufficiently zoomed-out multiple datapoints will appear selected). The result is that there is no way(apparently***) to be updated serverside about a click on an individual datapoint!!! Also, it is a bit counter-intuitive that one needs to add a Tool to trap a click on a datapoint (I’m assuming this is possible with CallbackJS but how do I get the news back to the serverside Python?)…

***I’m sure there’s a way, I’m just not seeing it yet :slight_smile:

This correspondence (including any attachments) is for the intended recipient(s) only. It may contain confidential or privileged information or both. No confidentiality or privilege is waived or lost by any mis-transmission. If you receive this correspondence by mistake, please contact the sender immediately, delete this correspondence (and all attachments) and destroy any hard copies. You must not use, disclose, copy, distribute or rely on any part of this correspondence (including any attachments) if you are not the intended recipient(s).本メッセージに記載および添付されている情報(以下、総称して「本情報」といいます。)は、本来の受信者による使用のみを意図しています。誤送信等により本情報を取得された場合でも、本情報に係る秘密、または法律上の秘匿特権が失われるものではありません。本電子メールを受取られた方が、本来の受信者ではない場合には、本情報及びそのコピーすべてを削除・破棄し、本電子メールが誤って届いた旨を発信者宛てにご通知下さいますようお願いします。本情報の閲覧、発信または本情報に基づくいかなる行為も明確に禁止されていることをご了承ください。

I should’ve been more explicit about the context – I am dealing with a scatterplot. Also, I can see that it is straightforward to set a callback on clicking in JS, but that doesn’t get back to the server… Another way to ask the question is as follows: “Is there a way in Bokeh to limit selection to individual data points”. I understand that selection is really for subsets of data, but it is the only mechanism I can see that “gets back to the server”…

···

On Tuesday, August 8, 2017 at 8:03:51 AM UTC+2, [email protected] wrote:

This other post in the group links to some references on how to open window with javascript callback after clicking on tables.
Could be useful.

I imagine that you want to call a function in the server side instead of opening a page, but part of the code should be similar in both cases.

For the need of the tool, it should be because the code reads the data points selected on the columnDataSource, hence you need a seletion tool. I get it would be better if we could just click. To help with this detail you could make the selection tool the default tool, making the selection/click more intuitive as you mentioned.

On Tuesday, August 8, 2017 at 2:08:17 PM UTC+9, Manor Askenazi wrote:

Goal: simply to detect the selection (clicking) of an individual datapoint server-side.

Apparent Bokeh-Approved Strategy: monitor the “selected” attribute of the GlyphRenderer’s data source (that’s what the demos do).

Problem: even the TapTool does not limit selections to a single datapoint (if the scatter plot is sufficiently zoomed-out multiple datapoints will appear selected). The result is that there is no way(apparently***) to be updated serverside about a click on an individual datapoint!!! Also, it is a bit counter-intuitive that one needs to add a Tool to trap a click on a datapoint (I’m assuming this is possible with CallbackJS but how do I get the news back to the serverside Python?)…

***I’m sure there’s a way, I’m just not seeing it yet :slight_smile:

This correspondence (including any attachments) is for the intended recipient(s) only. It may contain confidential or privileged information or both. No confidentiality or privilege is waived or lost by any mis-transmission. If you receive this correspondence by mistake, please contact the sender immediately, delete this correspondence (and all attachments) and destroy any hard copies. You must not use, disclose, copy, distribute or rely on any part of this correspondence (including any attachments) if you are not the intended recipient(s).本メッセージに記載および添付されている情報(以下、総称して「本情報」といいます。)は、本来の受信者による使用のみを意図しています。誤送信等により本情報を取得された場合でも、本情報に係る秘密、または法律上の秘匿特権が失われるものではありません。本電子メールを受取られた方が、本来の受信者ではない場合には、本情報及びそのコピーすべてを削除・破棄し、本電子メールが誤って届いた旨を発信者宛てにご通知下さいますようお願いします。本情報の閲覧、発信または本情報に基づくいかなる行為も明確に禁止されていることをご了承ください。