advice on new structure of "selected" source property?

I have an app where selecting points on the plot triggers a callback on the server side. I wrote the app when source.selected took a list of indices. However, I just updated to Bokeh 0.9 (loving the JS callbacks, by the way) and now get this when I select points:

Traceback (most recent call last):
File “//anaconda/lib/python2.7/site-packages/flask/app.py”, line 1817, in wsgi_app
response = self.full_dispatch_request()
File “//anaconda/lib/python2.7/site-packages/flask/app.py”, line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File “//anaconda/lib/python2.7/site-packages/flask/app.py”, line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File “//anaconda/lib/python2.7/site-packages/flask/app.py”, line 1475, in full_dispatch_request
rv = self.dispatch_request()
File “//anaconda/lib/python2.7/site-packages/flask/app.py”, line 1461, in dispatch_request
return self.view_functionsrule.endpoint
File “//anaconda/lib/python2.7/site-packages/bokeh/server/views/backbone.py”, line 224, in _handle_specific_model_patch
return _handle_specific_model(docid, typename, id, request.method)
File “//anaconda/lib/python2.7/site-packages/bokeh/server/crossdomain.py”, line 34, in wrapped_function
resp = make_response(f(*args, **kwargs))
File “//anaconda/lib/python2.7/site-packages/bokeh/server/views/backbone.py”, line 171, in _handle_specific_model
return update(docid, typename, id)
File “//anaconda/lib/python2.7/site-packages/bokeh/server/views/bbauth.py”, line 21, in wrapper
return func(*args, **kwargs)
File “//anaconda/lib/python2.7/site-packages/bokeh/server/views/backbone.py”, line 279, in update
clientdoc.load(modeldata, events=‘existing’, dirty=True)
File “//anaconda/lib/python2.7/site-packages/bokeh/document.py”, line 179, in load
model.load_json(obj_attrs, instance=model)
File “//anaconda/lib/python2.7/site-packages/bokeh/plot_object.py”, line 177, in load_json
instance.update(**attrs)
File “//anaconda/lib/python2.7/site-packages/bokeh/plot_object.py”, line 290, in update
setattr(self, k, v)
File “//anaconda/lib/python2.7/site-packages/bokeh/properties.py”, line 318, in setattr
super(HasProps, self).setattr(name, value)
File “//anaconda/lib/python2.7/site-packages/bokeh/properties.py”, line 167, in set
raise e
ValueError: expected an element of Dict(String, Dict(String, Any)), got [134, 280]

``

I noticed that source.select now takes a dict with key ‘0d’, which accesses another dictionary with keys ‘indices’ and ‘flag’, and keys ‘1d’ and ‘2d’, which each access a dictionary with key 'indices. Questions:

  1. Any suggestions for fixing the error I’m getting? (I tried to reproduce the error using the server versions of selection_histogram.py, linked_brushing.py, and color_scatter.py, but I couldn’t get any of them to run since upgrading. Selection works fine on file version of linked_brushing.py).

  2. Is there any documentation for the new structure of the ‘selected’ property of ColumnDataSource?

The server version of legend.py worked for me, including the selection. So it must be an issue with my particular app. I’ll to track the issue down more precisely.

···

On Monday, May 18, 2015 at 5:25:43 PM UTC-4, Schaun Wheeler wrote:

I have an app where selecting points on the plot triggers a callback on the server side. I wrote the app when source.selected took a list of indices. However, I just updated to Bokeh 0.9 (loving the JS callbacks, by the way) and now get this when I select points:

Traceback (most recent call last):
File “//anaconda/lib/python2.7/site-packages/flask/app.py”, line 1817, in wsgi_app
response = self.full_dispatch_request()
File “//anaconda/lib/python2.7/site-packages/flask/app.py”, line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File “//anaconda/lib/python2.7/site-packages/flask/app.py”, line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File “//anaconda/lib/python2.7/site-packages/flask/app.py”, line 1475, in full_dispatch_request
rv = self.dispatch_request()
File “//anaconda/lib/python2.7/site-packages/flask/app.py”, line 1461, in dispatch_request
return self.view_functionsrule.endpoint
File “//anaconda/lib/python2.7/site-packages/bokeh/server/views/backbone.py”, line 224, in _handle_specific_model_patch
return _handle_specific_model(docid, typename, id, request.method)
File “//anaconda/lib/python2.7/site-packages/bokeh/server/crossdomain.py”, line 34, in wrapped_function
resp = make_response(f(*args, **kwargs))
File “//anaconda/lib/python2.7/site-packages/bokeh/server/views/backbone.py”, line 171, in _handle_specific_model
return update(docid, typename, id)
File “//anaconda/lib/python2.7/site-packages/bokeh/server/views/bbauth.py”, line 21, in wrapper
return func(*args, **kwargs)
File “//anaconda/lib/python2.7/site-packages/bokeh/server/views/backbone.py”, line 279, in update
clientdoc.load(modeldata, events=‘existing’, dirty=True)
File “//anaconda/lib/python2.7/site-packages/bokeh/document.py”, line 179, in load
model.load_json(obj_attrs, instance=model)
File “//anaconda/lib/python2.7/site-packages/bokeh/plot_object.py”, line 177, in load_json
instance.update(**attrs)
File “//anaconda/lib/python2.7/site-packages/bokeh/plot_object.py”, line 290, in update
setattr(self, k, v)
File “//anaconda/lib/python2.7/site-packages/bokeh/properties.py”, line 318, in setattr
super(HasProps, self).setattr(name, value)
File “//anaconda/lib/python2.7/site-packages/bokeh/properties.py”, line 167, in set
raise e
ValueError: expected an element of Dict(String, Dict(String, Any)), got [134, 280]

``

I noticed that source.select now takes a dict with key ‘0d’, which accesses another dictionary with keys ‘indices’ and ‘flag’, and keys ‘1d’ and ‘2d’, which each access a dictionary with key 'indices. Questions:

  1. Any suggestions for fixing the error I’m getting? (I tried to reproduce the error using the server versions of selection_histogram.py, linked_brushing.py, and color_scatter.py, but I couldn’t get any of them to run since upgrading. Selection works fine on file version of linked_brushing.py).
  1. Is there any documentation for the new structure of the ‘selected’ property of ColumnDataSource?

Ok, so it looks like the problem is with the update method on lines 288-290 of plot_object.py (and, I assume, the corresponding coffeescript, but I don’t know anything about that part of Bokeh):

def update(self, **kwargs):
for k,v in kwargs.items():
setattr(self, k, v)

``

It looks like when the points on the graph are selected, it passes a dict to update that looks something like {‘selected’: [134]} (where, in this case, 134 is the index of the point that was selected). If I call Bokeh.Collections(‘ColumnDataSource’) in the javascript console when I first load the app, the selected attribute looks like this:

  1. selected: Object
  2. 0d: Object
  3. flag: false
  4. indices: Array[0]
  5. proto: Object
  6. 1d: Object
  7. indices: Array[0]
  8. proto: Object
  9. 2d: Object
  10. indices: Array[0]
  11. proto: Object

After selecting a point, it looks like this:

  1. selected: Array[1]
  2. 0: 134
  3. length: 1

Am I correct in assuming this is a bug? Does anyone have any suggestions for a workaround until it gets fixed?

···

On Monday, May 18, 2015 at 5:28:27 PM UTC-4, Schaun Wheeler wrote:

The server version of legend.py worked for me, including the selection. So it must be an issue with my particular app. I’ll to track the issue down more precisely.

On Monday, May 18, 2015 at 5:25:43 PM UTC-4, Schaun Wheeler wrote:

I have an app where selecting points on the plot triggers a callback on the server side. I wrote the app when source.selected took a list of indices. However, I just updated to Bokeh 0.9 (loving the JS callbacks, by the way) and now get this when I select points:

Traceback (most recent call last):
File “//anaconda/lib/python2.7/site-packages/flask/app.py”, line 1817, in wsgi_app
response = self.full_dispatch_request()
File “//anaconda/lib/python2.7/site-packages/flask/app.py”, line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File “//anaconda/lib/python2.7/site-packages/flask/app.py”, line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File “//anaconda/lib/python2.7/site-packages/flask/app.py”, line 1475, in full_dispatch_request
rv = self.dispatch_request()
File “//anaconda/lib/python2.7/site-packages/flask/app.py”, line 1461, in dispatch_request
return self.view_functionsrule.endpoint
File “//anaconda/lib/python2.7/site-packages/bokeh/server/views/backbone.py”, line 224, in _handle_specific_model_patch
return _handle_specific_model(docid, typename, id, request.method)
File “//anaconda/lib/python2.7/site-packages/bokeh/server/crossdomain.py”, line 34, in wrapped_function
resp = make_response(f(*args, **kwargs))
File “//anaconda/lib/python2.7/site-packages/bokeh/server/views/backbone.py”, line 171, in _handle_specific_model
return update(docid, typename, id)
File “//anaconda/lib/python2.7/site-packages/bokeh/server/views/bbauth.py”, line 21, in wrapper
return func(*args, **kwargs)
File “//anaconda/lib/python2.7/site-packages/bokeh/server/views/backbone.py”, line 279, in update
clientdoc.load(modeldata, events=‘existing’, dirty=True)
File “//anaconda/lib/python2.7/site-packages/bokeh/document.py”, line 179, in load
model.load_json(obj_attrs, instance=model)
File “//anaconda/lib/python2.7/site-packages/bokeh/plot_object.py”, line 177, in load_json
instance.update(**attrs)
File “//anaconda/lib/python2.7/site-packages/bokeh/plot_object.py”, line 290, in update
setattr(self, k, v)
File “//anaconda/lib/python2.7/site-packages/bokeh/properties.py”, line 318, in setattr
super(HasProps, self).setattr(name, value)
File “//anaconda/lib/python2.7/site-packages/bokeh/properties.py”, line 167, in set
raise e
ValueError: expected an element of Dict(String, Dict(String, Any)), got [134, 280]

``

I noticed that source.select now takes a dict with key ‘0d’, which accesses another dictionary with keys ‘indices’ and ‘flag’, and keys ‘1d’ and ‘2d’, which each access a dictionary with key 'indices. Questions:

  1. Any suggestions for fixing the error I’m getting? (I tried to reproduce the error using the server versions of selection_histogram.py, linked_brushing.py, and color_scatter.py, but I couldn’t get any of them to run since upgrading. Selection works fine on file version of linked_brushing.py).
  1. Is there any documentation for the new structure of the ‘selected’ property of ColumnDataSource?

Sean,

The update method is generic, chances are the problem lies with whatever is calling update. It is true that the format of "selected" has changed, in order to accommodate a long requested feature, line selections. Normally we like to go through a deprecation cycle, but unfortunately a cleaner path forward on this eluded us. Are you setting the value of "selected" to a list in your app? If not, if Bokeh is setting it to a list somewhere, that is definitely a bug.

The structure of the new selected object is exactly what you see below, a dict with keys for "0d" selections (entire line, patch objects), "1d" selections (most every other glyph type), and "2d" selections (patches, and multi_line). So the field that corresponds to the previous value of selected, is now

  selected['1d'].indices

We've added many thousands of lines of new sphinx documentation for 0.9, but I do believe we overlooked describing this important aspect. We are going to be rolling re-deployments of the 0.9 docs all week with small additions, I will try to make adding this information part of those updates.

Thanks,

Bryan

···

On May 18, 2015, at 5:05 PM, Schaun Wheeler <[email protected]> wrote:

Ok, so it looks like the problem is with the `update` method on lines 288-290 of plot_object.py (and, I assume, the corresponding coffeescript, but I don't know anything about that part of Bokeh):

def update(self, **kwargs):
    for k,v in kwargs.items():
        setattr(self, k, v)

It looks like when the points on the graph are selected, it passes a dict to `update` that looks something like {'selected': [134]} (where, in this case, 134 is the index of the point that was selected). If I call Bokeh.Collections('ColumnDataSource') in the javascript console when I first load the app, the `selected` attribute looks like this:

  • selected: Object
    • 0d: Object
      • flag: false
      • indices: Array[0]
      • __proto__: Object
    • 1d: Object
      • indices: Array[0]
      • __proto__: Object
    • 2d: Object
      • indices: Array[0]
      • __proto__: Object

After selecting a point, it looks like this:

  • selected: Array[1]
    • 0: 134
    • length: 1

Am I correct in assuming this is a bug? Does anyone have any suggestions for a workaround until it gets fixed?

On Monday, May 18, 2015 at 5:28:27 PM UTC-4, Schaun Wheeler wrote:
The server version of legend.py worked for me, including the selection. So it must be an issue with my particular app. I'll to track the issue down more precisely.

On Monday, May 18, 2015 at 5:25:43 PM UTC-4, Schaun Wheeler wrote:
I have an app where selecting points on the plot triggers a callback on the server side. I wrote the app when source.selected took a list of indices. However, I just updated to Bokeh 0.9 (loving the JS callbacks, by the way) and now get this when I select points:

Traceback (most recent call last):
  File "//anaconda/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "//anaconda/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "//anaconda/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "//anaconda/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "//anaconda/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "//anaconda/lib/python2.7/site-packages/bokeh/server/views/backbone.py", line 224, in _handle_specific_model_patch
    return _handle_specific_model(docid, typename, id, request.method)
  File "//anaconda/lib/python2.7/site-packages/bokeh/server/crossdomain.py", line 34, in wrapped_function
    resp = make_response(f(*args, **kwargs))
  File "//anaconda/lib/python2.7/site-packages/bokeh/server/views/backbone.py", line 171, in _handle_specific_model
    return update(docid, typename, id)
  File "//anaconda/lib/python2.7/site-packages/bokeh/server/views/bbauth.py", line 21, in wrapper
    return func(*args, **kwargs)
  File "//anaconda/lib/python2.7/site-packages/bokeh/server/views/backbone.py", line 279, in update
    clientdoc.load(modeldata, events='existing', dirty=True)
  File "//anaconda/lib/python2.7/site-packages/bokeh/document.py", line 179, in load
    model.load_json(obj_attrs, instance=model)
  File "//anaconda/lib/python2.7/site-packages/bokeh/plot_object.py", line 177, in load_json
    instance.update(**attrs)
  File "//anaconda/lib/python2.7/site-packages/bokeh/plot_object.py", line 290, in update
    setattr(self, k, v)
  File "//anaconda/lib/python2.7/site-packages/bokeh/properties.py", line 318, in __setattr__
    super(HasProps, self).__setattr__(name, value)
  File "//anaconda/lib/python2.7/site-packages/bokeh/properties.py", line 167, in __set__
    raise e
ValueError: expected an element of Dict(String, Dict(String, Any)), got [134, 280]

I noticed that source.select now takes a dict with key '0d', which accesses another dictionary with keys 'indices' and 'flag', and keys '1d' and '2d', which each access a dictionary with key 'indices. Questions:

1. Any suggestions for fixing the error I'm getting? (I tried to reproduce the error using the server versions of selection_histogram.py, linked_brushing.py, and color_scatter.py, but I couldn't get any of them to run since upgrading. Selection works fine on file version of linked_brushing.py).

2. Is there any documentation for the new structure of the 'selected' property of ColumnDataSource?

--
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/c777535a-1f25-443c-8f2f-f646a2c4c6f2%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Thanks for the explanation of the new structure. As for my particular case, I’m not setting the value of “selected” to anything - if I’m reading the traceback that I posed earlier correctly, I’m not even getting the chance to: the error raises when plot_object tries to call update.

···

On Monday, May 18, 2015 at 6:19:10 PM UTC-4, Bryan Van de ven wrote:

Sean,

The update method is generic, chances are the problem lies with whatever is calling update. It is true that the format of “selected” has changed, in order to accommodate a long requested feature, line selections. Normally we like to go through a deprecation cycle, but unfortunately a cleaner path forward on this eluded us. Are you setting the value of “selected” to a list in your app? If not, if Bokeh is setting it to a list somewhere, that is definitely a bug.

The structure of the new selected object is exactly what you see below, a dict with keys for “0d” selections (entire line, patch objects), “1d” selections (most every other glyph type), and “2d” selections (patches, and multi_line). So the field that corresponds to the previous value of selected, is now

    selected['1d'].indices

We’ve added many thousands of lines of new sphinx documentation for 0.9, but I do believe we overlooked describing this important aspect. We are going to be rolling re-deployments of the 0.9 docs all week with small additions, I will try to make adding this information part of those updates.

Thanks,

Bryan

On May 18, 2015, at 5:05 PM, Schaun Wheeler [email protected] wrote:

Ok, so it looks like the problem is with the update method on lines 288-290 of plot_object.py (and, I assume, the corresponding coffeescript, but I don’t know anything about that part of Bokeh):

def update(self, **kwargs):
for k,v in kwargs.items():
setattr(self, k, v)

It looks like when the points on the graph are selected, it passes a dict to update that looks something like {‘selected’: [134]} (where, in this case, 134 is the index of the point that was selected). If I call Bokeh.Collections(‘ColumnDataSource’) in the javascript console when I first load the app, the selected attribute looks like this:

    • selected: Object
            • 0d: Object
                    • flag: false
                    • indices: Array[0]
                    • __proto__: Object
            • 1d: Object
                    • indices: Array[0]
                    • __proto__: Object
            • 2d: Object
                    • indices: Array[0]
                    • __proto__: Object

After selecting a point, it looks like this:

    • selected: Array[1]
            • 0: 134
            • length: 1

Am I correct in assuming this is a bug? Does anyone have any suggestions for a workaround until it gets fixed?

On Monday, May 18, 2015 at 5:28:27 PM UTC-4, Schaun Wheeler wrote:

The server version of legend.py worked for me, including the selection. So it must be an issue with my particular app. I’ll to track the issue down more precisely.

On Monday, May 18, 2015 at 5:25:43 PM UTC-4, Schaun Wheeler wrote:

I have an app where selecting points on the plot triggers a callback on the server side. I wrote the app when source.selected took a list of indices. However, I just updated to Bokeh 0.9 (loving the JS callbacks, by the way) and now get this when I select points:

Traceback (most recent call last):

File “//anaconda/lib/python2.7/site-packages/flask/app.py”, line 1817, in wsgi_app

response = self.full_dispatch_request()

File “//anaconda/lib/python2.7/site-packages/flask/app.py”, line 1477, in full_dispatch_request

rv = self.handle_user_exception(e)

File “//anaconda/lib/python2.7/site-packages/flask/app.py”, line 1381, in handle_user_exception

reraise(exc_type, exc_value, tb)

File “//anaconda/lib/python2.7/site-packages/flask/app.py”, line 1475, in full_dispatch_request

rv = self.dispatch_request()

File “//anaconda/lib/python2.7/site-packages/flask/app.py”, line 1461, in dispatch_request

return self.view_functions[rule.endpoint](**req.view_args)

File “//anaconda/lib/python2.7/site-packages/bokeh/server/views/backbone.py”, line 224, in _handle_specific_model_patch

return _handle_specific_model(docid, typename, id, request.method)

File “//anaconda/lib/python2.7/site-packages/bokeh/server/crossdomain.py”, line 34, in wrapped_function

resp = make_response(f(*args, **kwargs))

File “//anaconda/lib/python2.7/site-packages/bokeh/server/views/backbone.py”, line 171, in _handle_specific_model

return update(docid, typename, id)

File “//anaconda/lib/python2.7/site-packages/bokeh/server/views/bbauth.py”, line 21, in wrapper

return func(*args, **kwargs)

File “//anaconda/lib/python2.7/site-packages/bokeh/server/views/backbone.py”, line 279, in update

clientdoc.load(modeldata, events='existing', dirty=True)

File “//anaconda/lib/python2.7/site-packages/bokeh/document.py”, line 179, in load

model.load_json(obj_attrs, instance=model)

File “//anaconda/lib/python2.7/site-packages/bokeh/plot_object.py”, line 177, in load_json

instance.update(**attrs)

File “//anaconda/lib/python2.7/site-packages/bokeh/plot_object.py”, line 290, in update

setattr(self, k, v)

File “//anaconda/lib/python2.7/site-packages/bokeh/properties.py”, line 318, in setattr

super(HasProps, self).__setattr__(name, value)

File “//anaconda/lib/python2.7/site-packages/bokeh/properties.py”, line 167, in set

raise e

ValueError: expected an element of Dict(String, Dict(String, Any)), got [134, 280]

I noticed that source.select now takes a dict with key ‘0d’, which accesses another dictionary with keys ‘indices’ and ‘flag’, and keys ‘1d’ and ‘2d’, which each access a dictionary with key 'indices. Questions:

  1. Any suggestions for fixing the error I’m getting? (I tried to reproduce the error using the server versions of selection_histogram.py, linked_brushing.py, and color_scatter.py, but I couldn’t get any of them to run since upgrading. Selection works fine on file version of linked_brushing.py).
  1. Is there any documentation for the new structure of the ‘selected’ property of ColumnDataSource?


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/c777535a-1f25-443c-8f2f-f646a2c4c6f2%40continuum.io.

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

Figured it out: this was a browser cache problem. The app was loading Bokeh.js 0.8.2 from cache, which caused it to feed a list instead of dict upon selection. Refreshing the browser fixed it. Sorry for the distraction.

···

On Monday, May 18, 2015 at 6:58:38 PM UTC-4, Schaun Wheeler wrote:

Thanks for the explanation of the new structure. As for my particular case, I’m not setting the value of “selected” to anything - if I’m reading the traceback that I posed earlier correctly, I’m not even getting the chance to: the error raises when plot_object tries to call update.

On Monday, May 18, 2015 at 6:19:10 PM UTC-4, Bryan Van de ven wrote:

Sean,

The update method is generic, chances are the problem lies with whatever is calling update. It is true that the format of “selected” has changed, in order to accommodate a long requested feature, line selections. Normally we like to go through a deprecation cycle, but unfortunately a cleaner path forward on this eluded us. Are you setting the value of “selected” to a list in your app? If not, if Bokeh is setting it to a list somewhere, that is definitely a bug.

The structure of the new selected object is exactly what you see below, a dict with keys for “0d” selections (entire line, patch objects), “1d” selections (most every other glyph type), and “2d” selections (patches, and multi_line). So the field that corresponds to the previous value of selected, is now

    selected['1d'].indices

We’ve added many thousands of lines of new sphinx documentation for 0.9, but I do believe we overlooked describing this important aspect. We are going to be rolling re-deployments of the 0.9 docs all week with small additions, I will try to make adding this information part of those updates.

Thanks,

Bryan

On May 18, 2015, at 5:05 PM, Schaun Wheeler [email protected] wrote:

Ok, so it looks like the problem is with the update method on lines 288-290 of plot_object.py (and, I assume, the corresponding coffeescript, but I don’t know anything about that part of Bokeh):

def update(self, **kwargs):
for k,v in kwargs.items():
setattr(self, k, v)

It looks like when the points on the graph are selected, it passes a dict to update that looks something like {‘selected’: [134]} (where, in this case, 134 is the index of the point that was selected). If I call Bokeh.Collections(‘ColumnDataSource’) in the javascript console when I first load the app, the selected attribute looks like this:

    • selected: Object
            • 0d: Object
                    • flag: false
                    • indices: Array[0]
                    • __proto__: Object
            • 1d: Object
                    • indices: Array[0]
                    • __proto__: Object
            • 2d: Object
                    • indices: Array[0]
                    • __proto__: Object

After selecting a point, it looks like this:

    • selected: Array[1]
            • 0: 134
            • length: 1

Am I correct in assuming this is a bug? Does anyone have any suggestions for a workaround until it gets fixed?

On Monday, May 18, 2015 at 5:28:27 PM UTC-4, Schaun Wheeler wrote:

The server version of legend.py worked for me, including the selection. So it must be an issue with my particular app. I’ll to track the issue down more precisely.

On Monday, May 18, 2015 at 5:25:43 PM UTC-4, Schaun Wheeler wrote:

I have an app where selecting points on the plot triggers a callback on the server side. I wrote the app when source.selected took a list of indices. However, I just updated to Bokeh 0.9 (loving the JS callbacks, by the way) and now get this when I select points:

Traceback (most recent call last):

File “//anaconda/lib/python2.7/site-packages/flask/app.py”, line 1817, in wsgi_app

response = self.full_dispatch_request()

File “//anaconda/lib/python2.7/site-packages/flask/app.py”, line 1477, in full_dispatch_request

rv = self.handle_user_exception(e)

File “//anaconda/lib/python2.7/site-packages/flask/app.py”, line 1381, in handle_user_exception

reraise(exc_type, exc_value, tb)

File “//anaconda/lib/python2.7/site-packages/flask/app.py”, line 1475, in full_dispatch_request

rv = self.dispatch_request()

File “//anaconda/lib/python2.7/site-packages/flask/app.py”, line 1461, in dispatch_request

return self.view_functions[rule.endpoint](**req.view_args)

File “//anaconda/lib/python2.7/site-packages/bokeh/server/views/backbone.py”, line 224, in _handle_specific_model_patch

return _handle_specific_model(docid, typename, id, request.method)

File “//anaconda/lib/python2.7/site-packages/bokeh/server/crossdomain.py”, line 34, in wrapped_function

resp = make_response(f(*args, **kwargs))

File “//anaconda/lib/python2.7/site-packages/bokeh/server/views/backbone.py”, line 171, in _handle_specific_model

return update(docid, typename, id)

File “//anaconda/lib/python2.7/site-packages/bokeh/server/views/bbauth.py”, line 21, in wrapper

return func(*args, **kwargs)

File “//anaconda/lib/python2.7/site-packages/bokeh/server/views/backbone.py”, line 279, in update

clientdoc.load(modeldata, events='existing', dirty=True)

File “//anaconda/lib/python2.7/site-packages/bokeh/document.py”, line 179, in load

model.load_json(obj_attrs, instance=model)

File “//anaconda/lib/python2.7/site-packages/bokeh/plot_object.py”, line 177, in load_json

instance.update(**attrs)

File “//anaconda/lib/python2.7/site-packages/bokeh/plot_object.py”, line 290, in update

setattr(self, k, v)

File “//anaconda/lib/python2.7/site-packages/bokeh/properties.py”, line 318, in setattr

super(HasProps, self).__setattr__(name, value)

File “//anaconda/lib/python2.7/site-packages/bokeh/properties.py”, line 167, in set

raise e

ValueError: expected an element of Dict(String, Dict(String, Any)), got [134, 280]

I noticed that source.select now takes a dict with key ‘0d’, which accesses another dictionary with keys ‘indices’ and ‘flag’, and keys ‘1d’ and ‘2d’, which each access a dictionary with key 'indices. Questions:

  1. Any suggestions for fixing the error I’m getting? (I tried to reproduce the error using the server versions of selection_histogram.py, linked_brushing.py, and color_scatter.py, but I couldn’t get any of them to run since upgrading. Selection works fine on file version of linked_brushing.py).
  1. Is there any documentation for the new structure of the ‘selected’ property of ColumnDataSource?


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/c777535a-1f25-443c-8f2f-f646a2c4c6f2%40continuum.io.

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