Skip to content

Conversation

@enmanuelduran
Copy link
Contributor

Description

Significantly reduces the amount of re-renders on data point tooltips by implementing group deep equality check -- groups change depending on the cursor position on the chart and the proximity of the datapoints to the cursor, at the moment it is not necessary to re-render the tooltip when we know we are still on the same group domain.

Using react dev tools to analyze the cadence of the render events

Before

tooltip-render-issue

After

tooltip-render-fix

How has this been tested?

Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@enmanuelduran enmanuelduran force-pushed the tooltip-performance-improvement-on-render branch from 081b31e to b6187ed Compare August 7, 2025 21:55
@enmanuelduran enmanuelduran marked this pull request as ready for review August 7, 2025 22:02
// Just re-render when the groups are different.
private setGroupIfDifferent(group: readonly Highcharts.Point[]) {
function isGroupEqual(a: Highcharts.Point, b: Highcharts.Point) {
return a?.x === b?.x && a?.y === b?.y && a?.series?.type === b?.series?.type;
Copy link
Member

Choose a reason for hiding this comment

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

The series often have the same type, but those can be different series. I suggest we compare them as such: getSeriesId(a?.series) === getSeriesId(b?.series).

@pan-kot pan-kot added this pull request to the merge queue Aug 8, 2025
Merged via the queue into main with commit 8aa51c1 Aug 8, 2025
38 of 39 checks passed
@pan-kot pan-kot deleted the tooltip-performance-improvement-on-render branch August 8, 2025 09:11
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