What is the best way to store extra data such as current x_range?

I have some time-series charts and I would like to store the current viewing window information:

x_range: (time) start, end
y_range: (price) min, max 

Particularly, I would like to store the current viewing window after zooms and drags. It looks a bit like that right now:

x_range = [1591210744150.53, 1591220662959.6016],
y_range = [8488.884999999998, 8575.015000000001]
  • I tried storing on the window object, in the browser and it is working. A bit crude though.
  • I have used the browser local storage, works but also not very intuitive.
  • Finally, I have added an extra column inside my ColumnDataSource and I use the first 4 rows to store
    the above data, which also works but is a bit of a waste of the rest of the column.

Any suggestions?

I handle and store this data through CustomJS event scripts and I need it so I can reframe a specific area after some changes are peroformed.

Why not just access the current values directly via plot.x_range? You can set an ID for a plot and then get the plot itself via Bokeh.documents[0].get_model_by_id.

1 Like

Thank you. You are correct.