☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

JS: monitor changes in core properties?

Community Support
ltalirz
ltalirz

The helpful example for wrapping a JS library uses a bokeh.models.ColumnDataSource in order to update the graph whenever the data changes.

Can I also monitor changes in, say, a bokeh.core.properties.String or bokeh.core.properties.Dict?

I’m trying to write a JSmol bokeh extension and I’m currently just awkwardly passing things through a ColumnDataSource that don’t really belong there.

The code that does the monitoring in the example is

    # Set a listener so that when the Bokeh data source has a change
    # event, we can process the new data
    @connect(@model.data_source.change, () =>
        @_graph.setData(@get_data())
    )

``

which uses the .change property that does not seem to be available for core properties

Best,

Leopold

⌁   Link to post
Mateusz_Paprocki2
Mateusz_Paprocki2

Hi,

···

On Tue, Sep 18, 2018 at 11:28 PM, Leopold Talirz leopold.talirz@gmail.com wrote:

The helpful example for wrapping a JS library uses a bokeh.models.ColumnDataSource in order to update the graph whenever the data changes.

Can I also monitor changes in, say, a bokeh.core.properties.String or bokeh.core.properties.Dict?

I’m trying to write a JSmol bokeh extension and I’m currently just awkwardly passing things through a ColumnDataSource that don’t really belong there.

The code that does the monitoring in the example is

    # Set a listener so that when the Bokeh data source has a change
    # event, we can process the new data
    @connect(@model.data_source.change, () =>
        @_graph.setData(@get_data())
    )

``

which uses the .change property that does not seem to be available for core properties

there are two types of change signals, one for models and one for individual properties:

  1. this.connect(this.model.data_source.change, listener) will invoke the listener when the contents of the object referenced by data_source changed

  2. this.connect(this.model.properties.data_source.properties.change, listener) will invoke the listener when the value of data_source property changed

If you want to listen listen to change to a particular property of a data source (e.g. data), then you would use this.connect(this.model.data_source.properties.data.change, listener).

Mateusz

Best,

Leopold

–

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 bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/42e9c72f-6377-4639-9f5a-da393680aff8%40continuum.io.

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

⌁   Link to post
ltalirz
ltalirz

Dear Mateusz,

thank you very much for your advice! It already simplifies things to be able to just watch the “data” property without having to re-create the whole object.

What I was trying to get at originally - do I need to use ColumnDataSource at all?

I.e. if what I would like to watch is not really columnar data but, say, a string or a dictionary, what object should I use on the python side?

As an alternative to watching, it would also be fine to add a function to the extension that can be called explicitly from the python side - could you maybe point me to an example of how to do this?

Best wishes,

Leopold

···

On Wednesday, September 19, 2018 at 2:03:16 PM UTC+2, mateusz.paprocki wrote:

Hi,

On Tue, Sep 18, 2018 at 11:28 PM, Leopold Talirz leopold...@gmail.com wrote:

The helpful example for wrapping a JS library uses a bokeh.models.ColumnDataSource in order to update the graph whenever the data changes.

Can I also monitor changes in, say, a bokeh.core.properties.String or bokeh.core.properties.Dict?

I’m trying to write a JSmol bokeh extension and I’m currently just awkwardly passing things through a ColumnDataSource that don’t really belong there.

The code that does the monitoring in the example is

    # Set a listener so that when the Bokeh data source has a change
    # event, we can process the new data
    @connect(@model.data_source.change, () =>
        @_graph.setData(@get_data())
    )

``

which uses the .change property that does not seem to be available for core properties

there are two types of change signals, one for models and one for individual properties:

  1. this.connect(this.model.data_source.change, listener) will invoke the listener when the contents of the object referenced by data_source changed
  1. this.connect(this.model.properties.data_source.properties.change, listener) will invoke the listener when the value of data_source property changed

If you want to listen listen to change to a particular property of a data source (e.g. data), then you would use this.connect(this.model.data_source.properties.data.change, listener).

Mateusz

Best,

Leopold

–

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 bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/42e9c72f-6377-4639-9f5a-da393680aff8%40continuum.io.

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

⌁   Link to post

End of archived discussion · Replies are disabled