Renderers

in one file I have a bunch of charts of different types, with the data for the charts coming from a time series df

In bokeh 2 I could use this at the bottom of the file to collect the series names used in all the charts

> fig_list = []
> 
> for obj in gc.get_objects():
>     if isinstance(obj, figure):
>         fig_list.append(obj)
> 
> fig_names = [fig.name for fig in fig_list if fig.name]
> renderer_list = [renderer for fig in fig_list if fig.name == chart_name for renderer in fig.renderers]
> variables = []
> 
> for renderer in renderer_list:
>     if hasattr(renderer.glyph, 'y'):
>         variables.append(renderer.glyph.y)
>     elif hasattr(renderer.glyph, 'top'):
>         top = renderer.glyph.top
>         if isinstance(top, str):
>             variables.append(top)
>         elif 'expr' in top:
>             variables.extend(top['expr'].fields)

The second part of that block collected the column headers used in stacker charts. In bokeh 3 this part of the code fails, because the names/formats used for renderers seem to have changed. What’s the right way to access the column names now?

thanks

This isn’t something anyone typically does, so the right way is only whatever method you find that happens to work for you. Without a complete Minimal Reproducible Example to actually run directly and investigate, I can’t offer more than general advice, e.g. use a debugger to pause execution an inspect the relevant objects directly. If you are unable to provide an MRE, then an actual full traceback might provide clues for more detailed suggestions.

All that said, in cases like this what I would actually suggest, if possible, is just keeping track of the columns configured on the plots up front / as you go, rather than trying to scrape them after the fact.