This may be a user error, but I have no idea what I am doing wrong. I’m trying to return to the default x and y axis range before purging the plot so that when the plot is opened again, the x and y axis ranges correspond to the new trace being plotted. Currently, if I plot a trace, manually drag the axis ranges slightly off, and then purge the plot and try to plot another trace in
the same div, the x and y axis ranges remain as they did after I manually changed them.
Here is the code:
var update = {
‘yaxis.rangemode’: “tozero”,
‘xaxis.type’: “date”
};
var newlayout = {
yaxis: {
rangemode: “tozero”
},
xaxis: {
type: “date”
}
};
Plotly.relayout(‘plotly-TS’, newlayout);
Plotly.purge(‘plotly-TS’);
This works as far as it does what I want it to do with resetting the axis ranges; however, I checked the console and I get
this error “`TypeError: e is undefined”.
I thought I was defining newlayout incorrectly and tried using update(as defined above) instead. When I do this, I get the same TypeError, and I do not get the desired behaviour with the plot range. The x and y axis ranges remain as they were when I manually drag them.
Am I doing something wrong? Or is there a different work around for my desired behaviour?