Is it possible to support reset_start / reset_end in DataRange1d?

Help us help you! Writing your post to the following guidelines will help Bokeh Discourse reviewers understand your question, and increases the likelihood of a response.

What are you trying to do?
Hi, I am trying to achieve the DataShading feature by myself. I tried to update the columndatasource in the change event of X-axis (I used DataRange1d)

What have you tried that did NOT work as expected? If you have also posted this question elsewhere (e.g. StackOverflow), please include a link to that post.
However, I found that after zoom-in, the data was updated, so the range couldn’t be restored after click reset. And I found there are reset_start and reset_end in Range1d class, but it seems not as friendly as DataRange1d since I need to set the range and the margin, etc. by myself.
So, is it possible to Is it possible to support reset_start / reset_end in DataRange1d?

Appreciate your great works, thanks!

If this is a question about Bokeh code, please include a complete Minimal, Reproducible Example so that reviewers can test and see what you see.

In some cases, a screenshot of your plot will also be helpful.

Not currently, reset_start only exists on basic Range1d and does not exist for DataRange1d

OK got it. Is there any way to get the initial start & end of DataRange1d?
I tried to implement it by the on_change callback of x_range.
For Example,

fig.x_range.on_change("start", cb)
fig.x_range.on_change("end", cb)
def cb(attr, old, new):
  if old == None:
    if attr == "start":
      org_start = new
    if attr == "end"
      org_end = new

However, if more than one plot streamed, the range was modified more than one time, which the old won’t be None.
Thus, I can’t identify the change was fired by streaming of plot, or by user event.


I’m afraid I don’t really have a clear picture either of what you are trying to accomplish, or how you are trying to accomplish it. The most efficient way to make use of the expertise in this forum is to provide the Minimal Reproducible Example that was asked for, since actually running real code (even a toy example created for a narrow question) removes all ambiguity.