Description
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
- Click on Series 2 to hide it.
- 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.
highcharts/ts/Series/Bubble/BubbleLegend.ts
Line 1267 in 4d2a369
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();
}
}