-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Conversation
|
||
afterEach(destroyGraphDiv); | ||
|
||
function _hover(gd, opts) { |
There was a problem hiding this comment.
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
plotly.js/test/jasmine/tests/hover_label_test.js
Lines 3712 to 3715 in 82da615
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']); |
There was a problem hiding this comment.
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'); |
There was a problem hiding this comment.
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
Great fix. |
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