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

Skip "hoverinfo": "none" trace display for hover modes #5854

Merged
merged 19 commits into from
Oct 7, 2021

Conversation

Domino987
Copy link
Contributor

@Domino987 Domino987 commented Jul 26, 2021

Fixes #5516 5516

As documented, hoverinfo: none should trigger hover events, but should not be displayed in the hover field.

Currently, if the hovermode is "x/y unified", it groups the labels together but does not skip over the 'hoverinfo': 'none' data.
It skips the text resulting in an empty row.
image

This PR skips the 'hoverinfo': 'none' data for the labels so that the events are still triggerd but the empty row is not displayed.
image

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@archmoj archmoj added type: maintenance bug something broken and removed type: maintenance labels Jul 26, 2021
Copy link
Contributor

@archmoj archmoj left a comment

Choose a reason for hiding this comment

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

Thanks very much for the PR.
I noticed some tests failed.
You could run the click_test locally using the command below.

npm run test-jasmine click

Also please see my other comments below. Hope that may help fix the problem.

@archmoj archmoj added the community community contribution label Jul 26, 2021
@Domino987 Domino987 changed the title Skip "hoverinfo": "none" traces for x/y unified Skip "hoverinfo": "none" trace display for hover modes Jul 26, 2021
@archmoj
Copy link
Contributor

archmoj commented Aug 5, 2021

@Domino987 how about picking these two commits: b0eb6db and c52953d
which you can find on this dev branch: https://github.com/plotly/plotly.js/compare/pull-5854_dev ?

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Pull 5854 dev

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@archmoj
Copy link
Contributor

archmoj commented Aug 5, 2021

Now let's add a test somewhere in this block:

describe('hovermode: (x|y)unified', function() {

@archmoj
Copy link
Contributor

archmoj commented Aug 24, 2021

All the tests used to pass at 3fe967f commit. Why they started failing after you added new test? Please revert the changes you made after that commit and only keep the new test.

@archmoj archmoj added this to the v2.4.0 milestone Aug 24, 2021
@Domino987
Copy link
Contributor Author

That's because the code was not correct because the first header was still taken from the first entry even if this was hoverinfo = "skip". I fixed the code and new tests failed and i am still looking into it.

@archmoj
Copy link
Contributor

archmoj commented Aug 24, 2021

That's because the code was not correct because the first header was still taken from the first entry even if this was hoverinfo = "skip". I fixed the code and new tests failed and i am still looking into it.

Thank you! I added this PR to the next milestone which is due for August 26, 2021. In case you were able to get this to the finish line we could include it in the v2.4.0 release.

@@ -4601,6 +4601,74 @@ describe('hovermode: (x|y)unified', function() {
.then(done, done.fail);
});

it('should not display hover for display: none', function(done) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This test fails on CircleCI. Does it pass on your machine?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No it does not and I have problems with the tests in the first place on my machine, since its a windows.
But yes, that should work.

Copy link
Contributor

Choose a reason for hiding this comment

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

The test is not passing.
Please simply replace it with

it('should not display hover for display: none', function(done) {
        Plotly.newPlot(gd, {
            data: [{
                name: 'A',
                y: [1]
            }, {
                name: 'B',
                y: [2],
                hoverinfo: 'none'
            }],
            layout: {
                hovermode: 'x unified',
                showlegend: false,
                width: 500,
                height: 500,
                margin: {
                    t: 50,
                    b: 50,
                    l: 50,
                    r: 50
                }
            }
        })
        .then(function() {
            _hover(gd, { xpx: 200, ypx: 200 });
            assertLabel({title: '0', items: [
                'A : 1'
            ]});
        })
        .then(done, done.fail);
    });

Copy link
Contributor

Choose a reason for hiding this comment

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

@Domino987 Could you please adjust the test as mentioned above? It looks like the only remaining item here.

@archmoj archmoj removed this from the v2.4.0 milestone Aug 27, 2021
@archmoj
Copy link
Contributor

archmoj commented Oct 4, 2021

Also please create draftlog/5854_fix.md file as described here for example

 - Fix to include traces with "none" `hoverinfo` in event data [[#5854](https://github.com/plotly/plotly.js/pull/5854)],
   with thanks to @Domino987 for the contribution!

@Domino987
Copy link
Contributor Author

Also please create draftlog/5854_fix.md file as described here for example

 - Fix to include traces with "none" `hoverinfo` in event data [[#5854](https://github.com/plotly/plotly.js/pull/5854)],
   with thanks to @Domino987 for the contribution!

I thought I did here ?

@archmoj
Copy link
Contributor

archmoj commented Oct 5, 2021

Also please create draftlog/5854_fix.md file as described here for example

 - Fix to include traces with "none" `hoverinfo` in event data [[#5854](https://github.com/plotly/plotly.js/pull/5854)],
   with thanks to @Domino987 for the contribution!

I thought I did here ?

That's correct.

@archmoj
Copy link
Contributor

archmoj commented Oct 7, 2021

💃

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

Successfully merging this pull request may close these issues.

hoverinfo=none with hovermode=x unified
3 participants