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

created pie charts with synced tooltips and common legend #13

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

LB0ge
Copy link
Contributor

@LB0ge LB0ge commented May 3, 2023

No description provided.

Copy link
Collaborator

@ddragula ddragula left a comment

Choose a reason for hiding this comment

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

Good job, I really like this solution!

Comment on lines +15 to +30
H.Tooltip.prototype.hide = function (delay) {
const otherTooltips = this.chart.otherTooltips,
tooltip = this;
U.clearTimeout(tooltip.hideTimer);
delay = pick(delay, tooltip.options.hideDelay);
if (!tooltip.isHidden) {
tooltip.hideTimer = syncTimeout(function () {
otherTooltips.forEach((t) => {
t.getLabel().fadeOut(delay ? void 0 : delay);
t.isHidden = true;
});
tooltip.getLabel().fadeOut(delay ? void 0 : delay);
tooltip.isHidden = true;
}, delay);
}
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can also just use the point.mouseOver option event, but it's also a very nice solution.

Comment on lines +40 to +43
chart.otherTooltips = chart.series.slice(1).map(() => new Highcharts.Tooltip(
chart, Highcharts.merge(chart.options.tooltip)
)
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like that you foresee the possibility of additional synchronized series.

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

Successfully merging this pull request may close these issues.

2 participants