ioam / parambokeh

Generate widgets from Parameterized objects in Jupyter or Bokeh server
https://ioam.github.com/parambokeh
BSD 3-Clause "New" or "Revised" License
22 stars 7 forks source link

Multi-level dynamic parameters? #42

Open yerfdogyrag opened 6 years ago

yerfdogyrag commented 6 years ago

I was trying to do this with DynamicMap, but kept getting errors when I tried instantiating a DynamicMap inside a DynamicMap callback. I have some data that looks (roughly) like:

{ project1: { step1: [1,2,3], step2: [10,11,12]},
  project2: {step2: [15,16,17], step3: [20,21,22]} }

Basically, the first pull-down should have Select between project1 and project2. If I select project1, then my step pull-down should be step1, step2. If I select project2, the step pull-down should be step2, step3.

Will parambokeh do this? I'm also not quite sure how to fit this into holoviews.

Thanks!

yerfdogyrag commented 6 years ago

Hmm... I just looked through enough other issues and it sounds like there's no way to do this right now.

philippjfr commented 6 years ago

Correct currently not possible but parambokeh should absolutely be able to handle this kind of scenario eventually. We'll probably revisit this after holoviews 1.10 is released.

jbednar commented 6 years ago

Note that hierarchical object parameter setting works in paramnb already, if paramnb will meet your needs for now; it's just a limitation of parambokeh that we desperately need to address soon. Unfortunately for you :-), we found a workaround when we needed this capability last month, which was to show the parameters for all of the possible sub-objects in a separate area off to the right from the top-level selection. But that's an obviously bad long-term solution, and only works for a single hierarchical level with a small number of possibilities, which is what we were doing, and is really not tenable in the long term.

yerfdogyrag commented 6 years ago

Ya, I really can't pre-populate this. The first level selector allows me to do a query against a database which reduces my count down to ~60k or so. Without that, I have to do 1M which is a little much.

Do you have any suggestions how this can be done at all under the holoviews/bokeh/bokeh server umbrella? A hierarchical DynamicMap would also work for me, but I'm not sure if it's "easy" to make that work or not.

Thanks!

philippjfr commented 6 years ago

I spent an hour yesterday prototyping an idea I had which allows attaching arbitrary widgets to a plot and syncing them bidirectionally without the use of parambokeh. This is where we want to take the internal HoloViews widget system eventually:

widget_streams

The implementation is very hacky (you can see it here: https://anaconda.org/philippjfr/widget_streams/notebook), but this should eventually allow independently updating widgets, so you don't necessarily need hierarchical nesting as @jbednar describes. Hierarchical nesting is a good approach in some cases but if you just want to update the selection for one widget depending on another it seems overly complex.

yerfdogyrag commented 6 years ago

Cool - thanks! I gave it a try and hit an error. Is that a newer version of bokeh? I'm running 0.12.14 release right now and I'm getting:

AttributeError: 'BokehRenderer' object has no attribute 'components'

during render_widgets - let me know if you want a full traceback. Also let me know if you're just proof-of-concepting and having a user in the middle is mucking things up ;-).