From bc8d225bd148f87fdd8ba56ef5f3eb50a8936683 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Wed, 11 Jan 2017 17:03:32 -0500 Subject: [PATCH] make Axes.clearTypes functional again --- src/plots/cartesian/axes.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/plots/cartesian/axes.js b/src/plots/cartesian/axes.js index 64dc21e4b71..41db5e6344e 100644 --- a/src/plots/cartesian/axes.js +++ b/src/plots/cartesian/axes.js @@ -133,14 +133,15 @@ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { // empty out types for all axes containing these traces // so we auto-set them again axes.clearTypes = function(gd, traces) { - if(!Array.isArray(traces) || !traces.length) { - traces = (gd._fullData).map(function(d, i) { return i; }); + var fullData = gd._fullData; + var mockGd = { _fullLayout: gd.layout }; + + for(var i = 0; i < traces.length; i++) { + var trace = fullData[traces[i]]; + + (axes.getFromId(mockGd, trace.xaxis) || {}).type = '-'; + (axes.getFromId(mockGd, trace.xaxis) || {}).type = '-'; } - traces.forEach(function(tracenum) { - var trace = gd.data[tracenum]; - delete (axes.getFromId(gd, trace.xaxis) || {}).type; - delete (axes.getFromId(gd, trace.yaxis) || {}).type; - }); }; // get counteraxis letter for this axis (name or id)