1

I'm using Bokeh 2.3.0. I have several items in my Legend that are all muted on load. I provided a button that I want to use for toggling the visibility of all legend items.

Here's what I have now:

enter image description here

Here's my JS callback:

enter image description here

I believe I'm close enough to achieve it but setting the muted property doesn't work and I don't know how to send an onclick event. Hope someone can help or confirm that this is not supported in BokehJS. enter image description here

firnnauriel
  • 2,047
  • 7
  • 27
  • 44
  • Where are you expecting the value of `this.origin` to come from and what are you expecting it to be? It does not exist inside the callback function, which is what the error message is telling you. – bigreddot Apr 19 '21 at 17:55
  • @bigreddot `this.origin` refers to the Button. there's no issue inside the callback. the error in my screenshot is using the browser console after the breakpoint is triggered. I believe it is due to improper use of `trigger_event`. can you give a sample usage? – firnnauriel Apr 20 '21 at 11:14
  • 1
    These aren't really intended to be public API, which is why they are not demonstrated anywhere. I'd regard any usage of `trigger_event` outside BokehJS internals to be improper usage so I don't have any sample to share. Programatic access to hiding/muting legends seems like a reasonable ask. I'd recommend submitting a [github issue](https://github.com/bokeh/bokeh/issues) about it. There is either some current reaonable way of doing it that I just don't know about (in which case it needs to be documented better) or there isn't (in which case the issue can be a feature request). – bigreddot Apr 20 '21 at 19:17
  • ok, thanks @bigreddot – firnnauriel Apr 21 '21 at 16:05
  • `cb_obj` is the button object, not `this`. – gshpychka Apr 29 '21 at 06:51

0 Answers0