Bokeh- Callback to update two lines

I am trying to figure out on how to setup two callbacks in order to update two line. How can I assign several callbacks to the slider. I would like to use the change on the same slider to affect multiple line.
Is that possible?

Thank you,

Hi,

You shouldn’t need 2 callbacks to update 2 lines but I may be getting your use case wrong. Could you post an example code that can help us understand the problem ?

Thanks

Fabio

···

On Mon, Jun 1, 2015 at 9:21 AM, jax [email protected] wrote:

I am trying to figure out on how to setup two callbacks in order to update two line. How can I assign several callbacks to the slider. I would like to use the change on the same slider to affect multiple line.
Is that possible?

Thank you,

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/f114d449-2405-4a06-8cf5-8d07a8956811%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Fabio Pliger

This is a copy of what I was trying to do. Once I update the first line I need to go back and call the tangency fucntion to get the optimal point in order to update the second line. I am using scipy to calculate the optimal point so I can’t do it in the javascript code block.

···

On Monday, June 1, 2015 at 11:20:01 AM UTC-5, Fabio Pliger wrote:

Hi,

You shouldn’t need 2 callbacks to update 2 lines but I may be getting your use case wrong. Could you post an example code that can help us understand the problem ?

Thanks

Fabio

On Mon, Jun 1, 2015 at 9:21 AM, jax [email protected] wrote:

I am trying to figure out on how to setup two callbacks in order to update two line. How can I assign several callbacks to the slider. I would like to use the change on the same slider to affect multiple line.
Is that possible?

Thank you,

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/f114d449-2405-4a06-8cf5-8d07a8956811%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.


Fabio Pliger

So in that case the JSCallback is not very useful for you. It makes much more sense to have the entire code that updates the 2 sources when the slider changes value on the python side (within bokeh-server) because you need to call a python function and not only a js function to compute the values.
Having both (JS Callback and server side update) is not valuable and actually I’m not sure if the values sent to the python code for source1 are the original ones or those after the JSCallback have executed (would have to check this…). So yes, I’d suggest you to just set everything on the server.

The stock_applet and the sliders_applet examples should be a good source for what you need.

Cheers

Fabio

···

On Mon, Jun 1, 2015 at 11:37 AM, jax [email protected] wrote:

This is a copy of what I was trying to do. Once I update the first line I need to go back and call the tangency fucntion to get the optimal point in order to update the second line. I am using scipy to calculate the optimal point so I can’t do it in the javascript code block.

https://gist.github.com/arashaga/a99934b0aa54feef938e

On Monday, June 1, 2015 at 11:20:01 AM UTC-5, Fabio Pliger wrote:

Hi,

You shouldn’t need 2 callbacks to update 2 lines but I may be getting your use case wrong. Could you post an example code that can help us understand the problem ?

Thanks

Fabio

On Mon, Jun 1, 2015 at 9:21 AM, jax [email protected] wrote:

I am trying to figure out on how to setup two callbacks in order to update two line. How can I assign several callbacks to the slider. I would like to use the change on the same slider to affect multiple line.
Is that possible?

Thank you,

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/f114d449-2405-4a06-8cf5-8d07a8956811%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.


Fabio Pliger

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/97076145-3afb-47a9-8036-c3b1f5884ebe%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Fabio Pliger

Yes I think that is the way to go. Thanks for the help.

···

On Monday, June 1, 2015 at 10:45:57 PM UTC-5, Fabio Pliger wrote:

So in that case the JSCallback is not very useful for you. It makes much more sense to have the entire code that updates the 2 sources when the slider changes value on the python side (within bokeh-server) because you need to call a python function and not only a js function to compute the values.
Having both (JS Callback and server side update) is not valuable and actually I’m not sure if the values sent to the python code for source1 are the original ones or those after the JSCallback have executed (would have to check this…). So yes, I’d suggest you to just set everything on the server.

The stock_applet and the sliders_applet examples should be a good source for what you need.

Cheers

Fabio

On Mon, Jun 1, 2015 at 11:37 AM, jax [email protected] wrote:

This is a copy of what I was trying to do. Once I update the first line I need to go back and call the tangency fucntion to get the optimal point in order to update the second line. I am using scipy to calculate the optimal point so I can’t do it in the javascript code block.

https://gist.github.com/arashaga/a99934b0aa54feef938e

On Monday, June 1, 2015 at 11:20:01 AM UTC-5, Fabio Pliger wrote:

Hi,

You shouldn’t need 2 callbacks to update 2 lines but I may be getting your use case wrong. Could you post an example code that can help us understand the problem ?

Thanks

Fabio

On Mon, Jun 1, 2015 at 9:21 AM, jax [email protected] wrote:

I am trying to figure out on how to setup two callbacks in order to update two line. How can I assign several callbacks to the slider. I would like to use the change on the same slider to affect multiple line.
Is that possible?

Thank you,

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected]nuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/f114d449-2405-4a06-8cf5-8d07a8956811%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.


Fabio Pliger

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/97076145-3afb-47a9-8036-c3b1f5884ebe%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.


Fabio Pliger

With respect to Fabio’s comment “actually I’m not sure if the values sent to the python code for source1 are the original ones or those after the JSCallback have executed”. In the Python callback associated to a Slider, I need to use values of some ColumnDataSource that may have been modified by JS callbacks associated to other events. As an example, imagine that the Python callback calculates the mean value of data selected via a SelectTool (if it were that easy I would do it in JS, but I really want/need to use Pandas for the calculations). However, it would seem that Python only sees the initialisation values of the sources, and not their modifications occurring via JS callbacks. Is that correct? Python and JS sources are not necessarily synched at all times?
Thanks a lot for any feedback.

Cheers,

Gerardo

···

On Tuesday, 2 June 2015 16:55:59 UTC+2, jax wrote:

Yes I think that is the way to go. Thanks for the help.

On Monday, June 1, 2015 at 10:45:57 PM UTC-5, Fabio Pliger wrote:

So in that case the JSCallback is not very useful for you. It makes much more sense to have the entire code that updates the 2 sources when the slider changes value on the python side (within bokeh-server) because you need to call a python function and not only a js function to compute the values.
Having both (JS Callback and server side update) is not valuable and actually I’m not sure if the values sent to the python code for source1 are the original ones or those after the JSCallback have executed (would have to check this…). So yes, I’d suggest you to just set everything on the server.

The stock_applet and the sliders_applet examples should be a good source for what you need.

Cheers

Fabio

On Mon, Jun 1, 2015 at 11:37 AM, jax [email protected] wrote:

This is a copy of what I was trying to do. Once I update the first line I need to go back and call the tangency fucntion to get the optimal point in order to update the second line. I am using scipy to calculate the optimal point so I can’t do it in the javascript code block.

https://gist.github.com/arashaga/a99934b0aa54feef938e

On Monday, June 1, 2015 at 11:20:01 AM UTC-5, Fabio Pliger wrote:

Hi,

You shouldn’t need 2 callbacks to update 2 lines but I may be getting your use case wrong. Could you post an example code that can help us understand the problem ?

Thanks

Fabio

On Mon, Jun 1, 2015 at 9:21 AM, jax [email protected] wrote:

I am trying to figure out on how to setup two callbacks in order to update two line. How can I assign several callbacks to the slider. I would like to use the change on the same slider to affect multiple line.
Is that possible?

Thank you,

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/f114d449-2405-4a06-8cf5-8d07a8956811%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.


Fabio Pliger

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/97076145-3afb-47a9-8036-c3b1f5884ebe%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.


Fabio Pliger