Best Way to Have CustomJS Work With Variable Quantity of Bokeh Objects?

Hello,

I love Bokeh’s ability to make standalone html files! However, I have not figured out how to send a list/collection/dictionary/whatever of Bokeh objects to a CustomJS method.

I recently had a Python project where I would create a simple line-and-marker plot for a set of 4 dimensional data. I had controls to allow you to set the vertical and horizontal axis to any of the 4 supported by the data. However, I sent each line-and-marker object to each CustomJS seperately with a hard coded name. As more data became available, I had to add in the code to deal with those additional sets by hand. It isn’t scalable.

I am contemplating writing a system in Python to write Python code with the appropriate CustomJS calls written out with all the necessary single bokeh objects referenced individually, along with the needed Javascript code needed. I am not looking forward to such a project.

Questions:

  1. Is there a better way than automating writing Python code to deal with a variable number of Bokeh objects being passed to CustomJS?

  2. Is there a maximum limit to the number of Bokeh objects that can be passed in a CustomJS call?

What exactly have you tried? Offhand I might expect lists to work but not dicts, though AFAIK it’s never been officially supported as in, put under CI testing.

Otherwise, we hope to have this completed for 2.0:

I believe I have tested Dictionaries, but possibly not Lists. I will loop back and report after I have been able to definitively test lists with Bokeh 1.4.x