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

BubbleLegends hides when clicking the last legend, even if I prevent the event from happening #14080

Closed
josejulio opened this issue Aug 18, 2020 · 3 comments · Fixed by #18765

Comments

@josejulio
Copy link

josejulio commented Aug 18, 2020

I prevent the event on legendItemClick from happening and I manage externally when to hide the legends.

Expected behaviour

When clicking on the last legend, the BubbleLegend remains showing because I'm controlling externally the legends show/hide.

Actual behaviour

When clicking on the last legend, the BubbleLegend hides

Live demo with steps to reproduce

https://jsfiddle.net/kzqhfa0r/6/
I'm preventing the Series 1 from being hidden

  1. Click on Series 2 to hide it.
  2. Click on Series 1 - It won't hide the Series, but the BubbleLegend will do

Product version

Reproduced using https://code.highcharts.com/highcharts-more.js

Affected browser(s)

At least Google Chrome Version 84.0.4147.105 (Official Build) (64-bit)

I suppose this happens because BubbleLegend is listening to legendItemClick, assuming the legend will toggle regardless.

addEvent(Series, 'legendItemClick', function (this: Highcharts.Series): void {

edit:

Actually the same happens with legend text is dimmed off(?), suppose is something similar.

I'm workarounding this issue by doing:

legendItemClick(e: any) {
    e.preventDefault();

    // Workaround to prevent the bubbleLegend from being hidden:
    this.chart.legend.update({ bubbleLegend: { enabled: true }});
    this.chart.legend.bubbleLegend.visible = true;
    // for the label, I'm doing something like this, but somewhere else
    if (this.visible) {
        this.show();
     }
}
@ppotaczek
Copy link
Contributor

Hi @josejulio, Thank you for reporting!

@stale
Copy link

stale bot commented Apr 17, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions!

@stale stale bot added the Status: Stale This issue hasn't had any activity for a while, and will be auto-closed if no further updates occur. label Apr 17, 2022
@pawellysy
Copy link
Member

unstale

@stale stale bot removed the Status: Stale This issue hasn't had any activity for a while, and will be auto-closed if no further updates occur. label Apr 21, 2022
@hubertkozik hubertkozik self-assigned this Mar 29, 2023
@highsoft-bot highsoft-bot moved this from To do to Review in progress in Development-Flow Mar 30, 2023
Development-Flow automation moved this from Review in progress to Done Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

5 participants