I’m changing the y-range on a plot in a CustomJS callback, but sometimes the original y-range comes back!
I have a complex app that’s a mix of a range tool (selecting data using a bar chart) and a line chart to show the data. In the range tool callback, I’m updating what lines to show in the line chart based on what’s selected in the range tool. On my line chart, I’m using the visible=false setting to not show lines and visible=true to show lines.
This is working great, but I need to manually change the y_range, which I can do.
I have some code in my callback that does something like this:
let max_y = 0.0;
loop - not showing details here. isVisible is true to show line.
if (isVisible) {{
max_y = Math.max(Bokeh.index.get_one_by_id(plot.renderers[i].id).bounds().y1,
max_y);
}}
plot.y_range.setv({{
'start': -0.1*max_y,
'end': 1.1*max_y
}});
Most of the time, this works great and my line chart updates perfectly. But on some line selections, the original y-range comes back!
Bear in mind I’m using the visible value.
Has anyone any idea what I’m doing wrong?