I am working on this code:
from plotly examples i have connected this range selector with graph, but when i am using dcc.Interval and @app.callback to auto-update this graph (1 sec interval) whole application is autoscaling to default.
My problem is:
When i am using this range selector i want to update graph only when i click option “see all” graph . Because i cant zoom in to specific place using range selector because after each second zoomed place is autoscaling ;/
is there any option to pu in code to turn of autoscale when using range selector or update only xaxis when zoomed in ?
Probably you have a good reason for this, but either way this is would be helpful to come up with a solution:
why do you want to update the graph every second?
Is there actually new data coming in, or what is triggering the update?
yes, i am monitoring up to date data, of course i will change from 1 sec to 100 sec but if someone else will to work on specific time period (selected on graph) that would be annoying when all graphs will be refreshed
Mhh you could, for the callback that is updating your graph get the values and the range of the range slider as a State,
get the data and the ‘‘see all’’ button as inputs.
You can then check what has been the Input:
https://dash.plot.ly/faqs (scroll down to " Q: How do I determine which
Input has changed? ")
Then you can do simple conditioning:
If the min, max values of the range slider are equal to its range, return the graph.
If the input was the “show all” button return the graph.
Edit: Okay, I see now from your second post that the range slider in your example is part of the figure layout. That is making it more difficult as it does not really have a value property…
maybe we can do something else, maybe add a button “stop updating” if this button will be selected graph will be frozen , how about that?
I think a checkbox with the same functionality would be easier to implement, but yeah that should work.
You can give it a single value (‘stop updating’), get it’s value as a state and then just set the conditioning in front of your return statement
if CheckboxValue !='stop updating':