From d98aa1b16e7f1d7a962a2f402401438993b2ae20 Mon Sep 17 00:00:00 2001 From: Marco Giuliano Date: Tue, 28 Jul 2020 12:43:03 +0200 Subject: [PATCH] Cannot pan on y-axis when zoomed and rotated=true #2799 --- src/zoom.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/zoom.ts b/src/zoom.ts index 1e7976321..28c285a71 100644 --- a/src/zoom.ts +++ b/src/zoom.ts @@ -57,7 +57,12 @@ ChartInternal.prototype.initZoom = function() { $$.zoom.updateDomain = function() { if (d3.event && d3.event.transform) { - $$.x.domain(d3.event.transform.rescaleX($$.subX).domain()) + if (config.axis_rotated && config.zoom_type === 'scroll' && d3.event.sourceEvent.type === 'mousemove') { + // we're moving the mouse in a rotated chart with zoom = "scroll", so we need rescaleY (i.e. vertical) + $$.x.domain(d3.event.transform.rescaleY($$.subX).domain()); + } else { + $$.x.domain(d3.event.transform.rescaleX($$.subX).domain()); + } } return this }