How to access original data in current range of Rasterplot?

Hi!

I am working on a Bokeh application where I want to display a huge dataset (millions of points) from a pd.dataframe rastered in 2D with Holoviews.

Then, there is a button that if the user zoomed into the data enough (let’s just say if xrange and yrange are small enough), plots the currently visible data in another visualization (in my case a 3D viz with Three.js).

However, I am having a hard time accessing the currently visible data in the raster plot. I tried passing the full data via a ColumnDataSource but since this gets fully serialized, it breaks my browser.

I see two options:

  1. I somehow access the data that I assume Holoviews must have filtered somehow already. Not sure if this is possible since HV probably discards that filtered data after it created the rastered image.
  2. I let Python filter my data on that button click, create a filtered CDS of some kind and pass that to my JS function that updates the custom detailed plot. But here, I have no clue how I would create a callback that runs a python function that filters the df, creates the CDS and calls a JS function with it.

Maybe someone here has a clue. I can potentially prepare an example but it will take quite some time to extract the relevant parts. Maybe someone can tell me if what I want to do is possible first.

@specter This question would probably be better posed on the HoloViz Discourse since HoloViews is an independent project maintained by different people. As always, a Minimal Reproducible Example (eg. a toy representative of your full app that highlights the single concern) that focuses the question on concrete details will do more than anything else to help others help you.