That did indeed fix it! Seems counter intuitive though. Seems like you want to add the data, and then format the display rather than the other way around.
I agreed, it’s not ideal. But, in order to properly compute the auto-range, one needs all the data present on the graph.
If you had set xaxis.range, yaxis.range and yaxis2.range, the addTraces and relayout order would not have mattered.
We are planning on adding a general Plotly.update method that would expose a way to update the data and layout at the same time in plotly.js v2.0.0 - which would solve the ordering issue you pointed out here. I recommend subscribing to wishlist for potential breaking changes since v1 · Issue #420 · plotly/plotly.js · GitHub for the latest development info.