Vertical auto-scaling on horizontal zoom

Hi, I am looking at the demos - i.e. https://plot.ly/python/ohlc-charts/#simple-ohlc-chart-with-pandas

It only has horizontal zoom, which is fine. However, is there a way to activate auto-scaling on vertical? That would make such graphs a lot more useful.

Thanks.

I did something like this for javascript. Basically, when you zoom on a region in the x axis, xmin and ymax will be defined by the event, while ymin and ymax will be undefined. Then you just need to do some basic calculation for the y axis boundaries and then call relayout. Hope this helps.

PLOT.on('plotly_relayout', (data) => {

			//console.log(data);
			let xmin = data["xaxis.range[0]"];
			let xmax = data["xaxis.range[1]"];

			let ymin = data["yaxis.range[0]"];
			let ymax = data["yaxis.range[1]"];

			console.log(ymin, ymax);
			if((ymin == undefined || ymax == undefined) && ((xmin != undefined) && (xmax != undefined))){
				//handle zoom
				console.log("Horizontal zooming");
				let {x, y} = this.getHistogramData();
				
				let left_index = parseInt(xmin);
				let right_index = parseInt(xmax);
				let v = max(y.slice(left_index, right_index))*1.1;

				let update = {"yaxis.range[1]": v};

				Plotly.relayout(this._id, update);
			}

		});