Changing selection using js

Hello,

I have a Bokeh scatter plot (embedded in a web app) in which I’d like to be able to highlight particular data indices.

I know that I can get the current selection indices using:

Bokeh.ColumnDataSource.Collection.models[0].attributes.selected

But is there a setter that I can use to update these indices, so that the corresponding points are highlighted?

Thanks for your help,

Stephen

These are backbone models, you should be able to update the selected indices with something like:

  source.set('selected', [10, 27, 52])

It's possible that merely setting the selection won't trigger a re-render request (I can't recall offhand). To make sure a re-render happens, you can also trigger the 'change' event on the source:

  source.trigger('change')

Thanks,

Bryan

···

On Apr 21, 2015, at 3:52 PM, [email protected] wrote:

Hello,

I have a Bokeh scatter plot (embedded in a web app) in which I'd like to be able to highlight particular data indices.

I know that I can get the current selection indices using:
Bokeh.ColumnDataSource.Collection.models[0].attributes.selected
But is there a setter that I can use to update these indices, so that the corresponding points are highlighted?

Thanks for your help,
Stephen

--
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/4f1b67b2-7f93-4993-bdb8-92b48e573acc%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.