Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Plotly.react/Angular missing categories + axis tick labels #5345

Merged
merged 2 commits into from Dec 15, 2020

Conversation

wbrgss
Copy link
Contributor

@wbrgss wbrgss commented Dec 15, 2020

Fixes #5318 + adds a test. Many thanks to @alexcjohnson for uncovering this solution and reproducing in CodePen! πŸ™‚

All Jasmine expectations in the new test should fail on master.

Demo:
Before vs After


I also recreated the Angular environment in #5318 and confirmed that this fixes the problem. However, while I can use the build of plotly.js from this PR locally following the plotly via window module instructions, I unfortunately can't find a way to do the same in the stackblitz example β€” it can't find the Plotly window global on an uploaded plotly.js file.

@plotly/plotly_js


afterEach(destroyGraphDiv);

function _hover(gd, opts) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Borrowed from hover_label_test.js

function _hover(gd, opts) {
Fx.hover(gd, opts);
Lib.clearThrottle();
}

return Plotly.react(gd, fig);
})
.then(function() {
expect(gd._fullLayout.xaxis._categories).toEqual(['a', 'b', 'c', 'd']);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fails with empty array ([]) on master

})
.then(function() {
_hover(gd, { xval: fig.data[0].x.indexOf('a') });
expect(d3.selectAll('g.axistext').select('text').html()).toEqual('a');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fails with empty string ('') on master

@archmoj
Copy link
Contributor

archmoj commented Dec 15, 2020

Great fix.
Thanks very much for the PR.
πŸ’ƒ

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

Successfully merging this pull request may close these issues.

tick labels missing after interacting with plot from angular-plotly
2 participants