Skip to content

Commit 652b905

Browse files
committed
first try at making the new cartesian subplot paradigm work
- we must now call drawAxes AFTER drawData (i.e. after updateSubplots) as drawAxes looks for some <g> that updateSubplots creates - move layoutStyles / Fx.init out of makePlotFramework - make makePlotFramework return 'FRAMEWORK' so that restyle polar <-> cartesian still works
1 parent 40fc7f9 commit 652b905

File tree

1 file changed

+16
-21
lines changed

1 file changed

+16
-21
lines changed

src/plot_api/plot_api.js

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,10 @@ Plotly.plot = function(gd, data, layout, config) {
180180
function marginPushersAgain() {
181181
// in case the margins changed, draw margin pushers again
182182
var seq = JSON.stringify(fullLayout._size) === oldmargins ?
183-
[] : [marginPushers, subroutines.layoutStyles];
184-
return Lib.syncOrAsync(seq.concat(Fx.init), gd);
183+
[] :
184+
[marginPushers, subroutines.layoutStyles];
185+
186+
return Lib.syncOrAsync(seq, gd);
185187
}
186188

187189
function positionAndAutorange() {
@@ -205,7 +207,6 @@ Plotly.plot = function(gd, data, layout, config) {
205207
}
206208
}
207209

208-
209210
// calc and autorange for errorbars
210211
ErrorBars.calc(gd);
211212

@@ -219,17 +220,13 @@ Plotly.plot = function(gd, data, layout, config) {
219220

220221
function doAutoRange() {
221222
if(gd._transitioning) return;
223+
222224
var axList = Plotly.Axes.list(gd, '', true);
223225
for(var i = 0; i < axList.length; i++) {
224226
Plotly.Axes.doAutoRange(axList[i]);
225227
}
226228
}
227229

228-
function drawAxes() {
229-
// draw ticks, titles, and calculate axis scaling (._b, ._m)
230-
return Plotly.Axes.doTicks(gd, 'redraw');
231-
}
232-
233230
// Now plot the data
234231
function drawData() {
235232
var calcdata = gd.calcdata,
@@ -277,6 +274,15 @@ Plotly.plot = function(gd, data, layout, config) {
277274
return Plots.previousPromises(gd);
278275
}
279276

277+
// draw ticks, titles, and calculate axis scaling (._b, ._m)
278+
function drawAxes() {
279+
Lib.syncOrAsync([
280+
subroutines.layoutStyles,
281+
function() { return Plotly.Axes.doTicks(gd, 'redraw'); },
282+
Fx.init,
283+
], gd);
284+
}
285+
280286
// An initial paint must be completed before these components can be
281287
// correctly sized and the whole plot re-margined. gd._replotting must
282288
// be set to false before these will work properly.
@@ -302,8 +308,8 @@ Plotly.plot = function(gd, data, layout, config) {
302308
marginPushersAgain,
303309
positionAndAutorange,
304310
subroutines.layoutStyles,
305-
drawAxes,
306311
drawData,
312+
drawAxes,
307313
finalDraw
308314
], gd, cleanUp);
309315

@@ -2736,16 +2742,5 @@ function makePlotFramework(gd) {
27362742

27372743
gd.emit('plotly_framework');
27382744

2739-
// position and style the containers, make main title
2740-
var frameWorkDone = Lib.syncOrAsync([
2741-
subroutines.layoutStyles,
2742-
function goAxes() { return Plotly.Axes.doTicks(gd, 'redraw'); },
2743-
Fx.init
2744-
], gd);
2745-
2746-
if(frameWorkDone && frameWorkDone.then) {
2747-
gd._promises.push(frameWorkDone);
2748-
}
2749-
2750-
return frameWorkDone;
2745+
return 'FRAMEWORK';
27512746
}

0 commit comments

Comments
 (0)