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

bugfix/19078-proximate-legend-enabling #19153

Merged
merged 3 commits into from
Jun 15, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 12 additions & 13 deletions ts/Core/Legend/Legend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ class Legend {
* Legend options.
*/
public init(chart: Chart, options: LegendOptions): void {

/**
* Chart of this legend.
*
Expand All @@ -247,29 +246,29 @@ class Legend {

this.setOptions(options);

if (options.enabled) {
const positionProximate = (): void => {
if (this.options.enabled && this.proximate) {
this.proximatePositions();
this.positionItems();
}
};

if (options.enabled) {
// Render it
this.render();

// move checkboxes
// Move checkboxes
addEvent(this.chart, 'endResize', function (): void {
this.legend.positionCheckboxes();
});

// On Legend.init and Legend.update, make sure that proximate layout
// events are either added or removed (#18362).
addEvent(
this.chart,
'render',
(): void => {
if (this.proximate) {
this.proximatePositions();
this.positionItems();
}
}
);
addEvent(this.chart, 'render', positionProximate);
}

// Need to position the legend after update, #19078.
addEvent(this.chart, 'redraw', positionProximate);
hubertkozik marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand Down