Plotly.js autoscale
For me, this worked perfectly and simply (thanks to https://codepen.io/plotly/pen/KpLVzv):
// script comes before
var layout = {
xaxis: {
autorange: true,
showgrid: false,
zeroline: false,
showline: false,
etc.
}
// script comes after
A really silly hack is to add this:
document.querySelector('[data-title="Autoscale"]').click()
It will automatically click the Autoscale button. A better way would be to figure out what function the button is actually calling and call that instead.