I’m not sure what I’m about to describe is a Bokeh bug, a misuse on my part of the tools, or a misunderstanding of javascript, so I thought I’d start here instead of going straight to the github issue tracker. I’m using the latest version of Bokeh 0.13.0 on py36.
Basically what I’m trying to do is update a standalone plot (no server) using the values extracted from two sliders using CustomJS callbacks. The values are extracted from the sliders and then stored in a PropertyValueDict and then the PropertyValueDict is used to update the plots. A minimal example can be found in the following:
The behavior that I’m seeing is that when I adjust one slider, the value corresponding to the other slider is set back to its default value (that I created the original python PropertyValueDict with) in the plot, although the value displayed on the slider remains at its previous value. What I want to happen is that the values are maintained as the value of whatever each sider is set to.
Does anyone have an idea of what might be going wrong or if there is a different approach/workaround for this?
I’m not a Bokeh expert but looking at the source of test.html, you see that PropertyValueDict is frozen when transitioning from Python to Javascript. So with every callback you get the same values.
The only “live” JS object that I know and that you can easily get your hand on while still in Python is ColumnarDataSource.
So the following works:
Instead of line 26:
state = ColumnDataSource(data=dict(y0=[default_y0], y1=[default_y1]))
Instead of line 51:
state.data[‘{}’] = [cb_obj.value];
Best,
Boris
···
On Sunday, July 8, 2018 at 4:15:09 AM UTC+3, Joshua Adelman wrote:
I’m not sure what I’m about to describe is a Bokeh bug, a misuse on my part of the tools, or a misunderstanding of javascript, so I thought I’d start here instead of going straight to the github issue tracker. I’m using the latest version of Bokeh 0.13.0 on py36.
Basically what I’m trying to do is update a standalone plot (no server) using the values extracted from two sliders using CustomJS callbacks. The values are extracted from the sliders and then stored in a PropertyValueDict and then the PropertyValueDict is used to update the plots. A minimal example can be found in the following:
The behavior that I’m seeing is that when I adjust one slider, the value corresponding to the other slider is set back to its default value (that I created the original python PropertyValueDict with) in the plot, although the value displayed on the slider remains at its previous value. What I want to happen is that the values are maintained as the value of whatever each sider is set to.
Does anyone have an idea of what might be going wrong or if there is a different approach/workaround for this?
On Sunday, July 8, 2018 at 4:15:09 AM UTC+3, Joshua Adelman wrote:
I’m not sure what I’m about to describe is a Bokeh bug, a misuse on my part of the tools, or a misunderstanding of javascript, so I thought I’d start here instead of going straight to the github issue tracker. I’m using the latest version of Bokeh 0.13.0 on py36.
Basically what I’m trying to do is update a standalone plot (no server) using the values extracted from two sliders using CustomJS callbacks. The values are extracted from the sliders and then stored in a PropertyValueDict and then the PropertyValueDict is used to update the plots. A minimal example can be found in the following:
The behavior that I’m seeing is that when I adjust one slider, the value corresponding to the other slider is set back to its default value (that I created the original python PropertyValueDict with) in the plot, although the value displayed on the slider remains at its previous value. What I want to happen is that the values are maintained as the value of whatever each sider is set to.
Does anyone have an idea of what might be going wrong or if there is a different approach/workaround for this?
Thanks, that seems to have worked. The ergonomics of it aren’t ideal, but it works. It would be nice to have a general purpose object that didn’t have to cast everything as array-like columns to pass and persist non-columnar data. Maybe it’s just not possible at this point to do in Bokeh.
Thanks again,
Josh
···
On Sunday, July 8, 2018 at 11:30:31 AM UTC-4, Boris Ettinger wrote:
Also forgot:
lines 33,34:
var y0_val = state.data[‘y0’][0];
var y1_val = state.data[‘y1’][0];
On Sunday, July 8, 2018 at 4:15:09 AM UTC+3, Joshua Adelman wrote:
I’m not sure what I’m about to describe is a Bokeh bug, a misuse on my part of the tools, or a misunderstanding of javascript, so I thought I’d start here instead of going straight to the github issue tracker. I’m using the latest version of Bokeh 0.13.0 on py36.
Basically what I’m trying to do is update a standalone plot (no server) using the values extracted from two sliders using CustomJS callbacks. The values are extracted from the sliders and then stored in a PropertyValueDict and then the PropertyValueDict is used to update the plots. A minimal example can be found in the following:
The behavior that I’m seeing is that when I adjust one slider, the value corresponding to the other slider is set back to its default value (that I created the original python PropertyValueDict with) in the plot, although the value displayed on the slider remains at its previous value. What I want to happen is that the values are maintained as the value of whatever each sider is set to.
Does anyone have an idea of what might be going wrong or if there is a different approach/workaround for this?
As an aside, PropertyValueDict is an incredibly low level piece of Bokeh. It’s really purely an implementation detail, and not meant to be used at all by end users which is why its not ever demonstrated in any examples, tutorials, or user guide materials.
Thanks, that seems to have worked. The ergonomics of it aren’t ideal, but it works. It would be nice to have a general purpose object that didn’t have to cast everything as array-like columns to pass and persist non-columnar data. Maybe it’s just not possible at this point to do in Bokeh.
Thanks again,
Josh
On Sunday, July 8, 2018 at 11:30:31 AM UTC-4, Boris Ettinger wrote:
Also forgot:
lines 33,34:
var y0_val = state.data[‘y0’][0];
var y1_val = state.data[‘y1’][0];
On Sunday, July 8, 2018 at 4:15:09 AM UTC+3, Joshua Adelman wrote:
I’m not sure what I’m about to describe is a Bokeh bug, a misuse on my part of the tools, or a misunderstanding of javascript, so I thought I’d start here instead of going straight to the github issue tracker. I’m using the latest version of Bokeh 0.13.0 on py36.
Basically what I’m trying to do is update a standalone plot (no server) using the values extracted from two sliders using CustomJS callbacks. The values are extracted from the sliders and then stored in a PropertyValueDict and then the PropertyValueDict is used to update the plots. A minimal example can be found in the following:
The behavior that I’m seeing is that when I adjust one slider, the value corresponding to the other slider is set back to its default value (that I created the original python PropertyValueDict with) in the plot, although the value displayed on the slider remains at its previous value. What I want to happen is that the values are maintained as the value of whatever each sider is set to.
Does anyone have an idea of what might be going wrong or if there is a different approach/workaround for this?
As an aside, PropertyValueDict is an incredibly low level piece of Bokeh. It’s really purely an implementation detail, and not meant to be used at all by end users which is why its not ever demonstrated in any examples, tutorials, or user guide materials.
Thanks, that seems to have worked. The ergonomics of it aren’t ideal, but it works. It would be nice to have a general purpose object that didn’t have to cast everything as array-like columns to pass and persist non-columnar data. Maybe it’s just not possible at this point to do in Bokeh.
Thanks again,
Josh
On Sunday, July 8, 2018 at 11:30:31 AM UTC-4, Boris Ettinger wrote:
Also forgot:
lines 33,34:
var y0_val = state.data[‘y0’][0];
var y1_val = state.data[‘y1’][0];
On Sunday, July 8, 2018 at 4:15:09 AM UTC+3, Joshua Adelman wrote:
I’m not sure what I’m about to describe is a Bokeh bug, a misuse on my part of the tools, or a misunderstanding of javascript, so I thought I’d start here instead of going straight to the github issue tracker. I’m using the latest version of Bokeh 0.13.0 on py36.
Basically what I’m trying to do is update a standalone plot (no server) using the values extracted from two sliders using CustomJS callbacks. The values are extracted from the sliders and then stored in a PropertyValueDict and then the PropertyValueDict is used to update the plots. A minimal example can be found in the following:
The behavior that I’m seeing is that when I adjust one slider, the value corresponding to the other slider is set back to its default value (that I created the original python PropertyValueDict with) in the plot, although the value displayed on the slider remains at its previous value. What I want to happen is that the values are maintained as the value of whatever each sider is set to.
Does anyone have an idea of what might be going wrong or if there is a different approach/workaround for this?
Thanks,
Josh
–
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].
As an aside, PropertyValueDict is an incredibly low level piece of Bokeh. It’s really purely an implementation detail, and not meant to be used at all by end users which is why its not ever demonstrated in any examples, tutorials, or user guide materials.
Thanks, that seems to have worked. The ergonomics of it aren’t ideal, but it works. It would be nice to have a general purpose object that didn’t have to cast everything as array-like columns to pass and persist non-columnar data. Maybe it’s just not possible at this point to do in Bokeh.
Thanks again,
Josh
On Sunday, July 8, 2018 at 11:30:31 AM UTC-4, Boris Ettinger wrote:
Also forgot:
lines 33,34:
var y0_val = state.data[‘y0’][0];
var y1_val = state.data[‘y1’][0];
On Sunday, July 8, 2018 at 4:15:09 AM UTC+3, Joshua Adelman wrote:
I’m not sure what I’m about to describe is a Bokeh bug, a misuse on my part of the tools, or a misunderstanding of javascript, so I thought I’d start here instead of going straight to the github issue tracker. I’m using the latest version of Bokeh 0.13.0 on py36.
Basically what I’m trying to do is update a standalone plot (no server) using the values extracted from two sliders using CustomJS callbacks. The values are extracted from the sliders and then stored in a PropertyValueDict and then the PropertyValueDict is used to update the plots. A minimal example can be found in the following:
The behavior that I’m seeing is that when I adjust one slider, the value corresponding to the other slider is set back to its default value (that I created the original python PropertyValueDict with) in the plot, although the value displayed on the slider remains at its previous value. What I want to happen is that the values are maintained as the value of whatever each sider is set to.
Does anyone have an idea of what might be going wrong or if there is a different approach/workaround for this?
Thanks,
Josh
–
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].
As an aside, PropertyValueDict is an incredibly low level piece of Bokeh. It’s really purely an implementation detail, and not meant to be used at all by end users which is why its not ever demonstrated in any examples, tutorials, or user guide materials.
Thanks, that seems to have worked. The ergonomics of it aren’t ideal, but it works. It would be nice to have a general purpose object that didn’t have to cast everything as array-like columns to pass and persist non-columnar data. Maybe it’s just not possible at this point to do in Bokeh.
Thanks again,
Josh
On Sunday, July 8, 2018 at 11:30:31 AM UTC-4, Boris Ettinger wrote:
Also forgot:
lines 33,34:
var y0_val = state.data[‘y0’][0];
var y1_val = state.data[‘y1’][0];
On Sunday, July 8, 2018 at 4:15:09 AM UTC+3, Joshua Adelman wrote:
I’m not sure what I’m about to describe is a Bokeh bug, a misuse on my part of the tools, or a misunderstanding of javascript, so I thought I’d start here instead of going straight to the github issue tracker. I’m using the latest version of Bokeh 0.13.0 on py36.
Basically what I’m trying to do is update a standalone plot (no server) using the values extracted from two sliders using CustomJS callbacks. The values are extracted from the sliders and then stored in a PropertyValueDict and then the PropertyValueDict is used to update the plots. A minimal example can be found in the following:
The behavior that I’m seeing is that when I adjust one slider, the value corresponding to the other slider is set back to its default value (that I created the original python PropertyValueDict with) in the plot, although the value displayed on the slider remains at its previous value. What I want to happen is that the values are maintained as the value of whatever each sider is set to.
Does anyone have an idea of what might be going wrong or if there is a different approach/workaround for this?
Thanks,
Josh
–
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].