Skip to content

Conversation

etpinard
Copy link
Contributor

fixes #1341

@etpinard etpinard added status: reviewable bug something broken labels Jan 30, 2017
}).catch(fail).then(done);
});

it('should emit afterplot event after plotting is done', function(done) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test here fails on master.

I'm not exactly sure why though which might me related to #76

Consider:

var gd = document.getElementById('graph')

Plotly.plot(gd, [{}])

gd.on('plotly_afterplot', () => {})

I suspect that on master the Plotly.plot promise is resolved before gd.on('plotly_relayout, /* */) is set. By tucking gd.emit('plotly_afterplot') is the Promise.all callback the Plotly.plot promise is resolved after gd.on.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect that on master the Plotly.plot promise is resolved before gd.on('plotly_afterplot, /* */) is set.

exactly - in most cases the plotting itself is sync, so your fix here is spot on.

@alexcjohnson
Copy link
Collaborator

💃

@etpinard etpinard merged commit 5206b49 into master Jan 31, 2017
@etpinard etpinard deleted the afterplot branch January 31, 2017 15:59
@alexander-daniel
Copy link
Contributor

Just wondering, is this only fired on Plotly.plot calls?

Curious, as I'd love to use this event with the React component, but that seems to use either:
Plotly.newPlot &
Plotly.react

Thanks!

@etpinard
Copy link
Contributor Author

Right, plotly_afterplot should be fired when Plotly.newPlot completes. Not sure why that doesn't happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

afterplot event not fired on load
3 participants