From 35e41dbd0eabeffb1ba081866659afeaba130fb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Fri, 6 Jan 2017 15:58:51 -0500 Subject: [PATCH] clear axis types during `Plotly.newPlot` - so that calling plot then newPlot using the same layout object does not lead to any side-effects. --- src/plot_api/plot_api.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/plot_api/plot_api.js b/src/plot_api/plot_api.js index 0e26c4b8aa9..73d3de2b157 100644 --- a/src/plot_api/plot_api.js +++ b/src/plot_api/plot_api.js @@ -524,6 +524,14 @@ Plotly.redraw = function(gd) { Plotly.newPlot = function(gd, data, layout, config) { gd = helpers.getGraphDiv(gd); + // clear 'auto' axis types that could have leaked in user layout + // in previous Plotly.plot calls + var axList = Plotly.Axes.list({ _fullLayout: layout || {} }); + for(var i = 0; i < axList.length; i++) { + var ax = axList[i]; + if(ax && ax.type) ax.type = '-'; + } + // remove gl contexts Plots.cleanPlot([], {}, gd._fullData || {}, gd._fullLayout || {});