Skip to content

Commit d7124f4

Browse files
committed
Add final drawing step
1 parent 44fb3c7 commit d7124f4

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/plot_api/plot_api.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -364,15 +364,24 @@ Plotly.plot = function(gd, data, layout, config) {
364364
// source links
365365
Plots.addLinks(gd);
366366

367+
// Mark the first render as complete
368+
gd._replotting = false;
369+
367370
return Plots.previousPromises(gd);
368371
}
369372

373+
function finalDraw(){
374+
Shapes.drawAll(gd);
375+
Plotly.Annotations.drawAll(gd);
376+
Legend.draw(gd);
377+
}
378+
370379
function cleanUp() {
371380
// now we're REALLY TRULY done plotting...
372381
// so mark it as done and let other procedures call a replot
373-
gd._replotting = false;
374382
Lib.markTime('done plot');
375383
gd.emit('plotly_afterplot');
384+
376385
}
377386

378387
var donePlotting = Lib.syncOrAsync([
@@ -382,7 +391,8 @@ Plotly.plot = function(gd, data, layout, config) {
382391
marginPushersAgain,
383392
positionAndAutorange,
384393
drawAxes,
385-
drawData
394+
drawData,
395+
finalDraw
386396
], gd, cleanUp);
387397

388398
// even if everything we did was synchronous, return a promise

src/snapshot/index.js

-4
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
'use strict';
1111

12-
var Plotly = require('../plotly');
13-
1412
function getDelay(fullLayout) {
1513
return (fullLayout._hasGL3D || fullLayout._hasGL2D) ? 500 : 0;
1614
}
@@ -24,8 +22,6 @@ function getRedrawFunc(gd) {
2422
(gd.data && gd.data[0] && gd.data[0].r)
2523
) return;
2624

27-
Plotly.Annotations.drawAll(gd);
28-
Plotly.Legend.draw(gd, fullLayout.showlegend);
2925
(gd.calcdata || []).forEach(function(d) {
3026
if(d[0] && d[0].t && d[0].t.cb) d[0].t.cb();
3127
});

0 commit comments

Comments
 (0)