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

feat(dashboards): Add onHighlight support to plottables #88491

Conversation

gggritso
Copy link
Member

@gggritso gggritso commented Apr 1, 2025

All plottables can have an onHighlight configuration option. If passed, it'll call the callback with the original data point that is responsible for that plotted point. Mapping from series highlights to original data is a little complicated, so I added a bunch of line annotations for how it works.

Closes DAIN-123: Add an onHighlight support to Plottable objects

Functional Changes

Area and Line plottables now split the dataset into complete and incomplete at instantiation time, not at render time. This makes it possible to then do a reverse lookup, and figure out the split when highlighting.

onHighlight callback in all plottables accepts an offset index, which they can use the look up the corresponding data.

TimeSeriesWidgetVisualization correctly calculates a dataIndex and an offset and passes it to any Plottable that is involved in a "highlight" event

gggritso added 5 commits April 1, 2025 16:49
This is just for stories.
This is under-the-hood, but is useful externally in some cases, to
figure out what range something is responsible for.
Otherwise, they re-render too often.
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 1, 2025
@gggritso gggritso marked this pull request as ready for review April 1, 2025 23:54
@gggritso gggritso requested a review from a team as a code owner April 1, 2025 23:54
Copy link
Member

@nikkikapadia nikkikapadia left a comment

Choose a reason for hiding this comment

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

lgtm!

@gggritso gggritso merged commit f64ef67 into master Apr 3, 2025
44 checks passed
@gggritso gggritso deleted the georgegritsouk/dain-123-add-an-onhighlight-support-to-plottable-objects branch April 3, 2025 14:28
adrian-codecov pushed a commit that referenced this pull request Apr 3, 2025
All plottables can have an `onHighlight` configuration option. If
passed, it'll call the callback with the original data point that is
responsible for that plotted point. Mapping from series highlights to
original data is a little complicated, so I added a bunch of line
annotations for how it works.

Closes [DAIN-123: Add an `onHighlight` support to `Plottable`
objects](https://linear.app/getsentry/issue/DAIN-123/add-an-onhighlight-support-to-plottable-objects)

## Functional Changes

`Area` and `Line` plottables now split the dataset into complete and
incomplete at instantiation time, not at render time. This makes it
possible to then do a reverse lookup, and figure out the split when
highlighting.

`onHighlight` callback in all plottables accepts an offset index, which
they can use the look up the corresponding data.

`TimeSeriesWidgetVisualization` correctly calculates a `dataIndex` and
an offset and passes it to any `Plottable` that is involved in a
`"highlight"` event
andrewshie-sentry pushed a commit that referenced this pull request Apr 8, 2025
All plottables can have an `onHighlight` configuration option. If
passed, it'll call the callback with the original data point that is
responsible for that plotted point. Mapping from series highlights to
original data is a little complicated, so I added a bunch of line
annotations for how it works.

Closes [DAIN-123: Add an `onHighlight` support to `Plottable`
objects](https://linear.app/getsentry/issue/DAIN-123/add-an-onhighlight-support-to-plottable-objects)

## Functional Changes

`Area` and `Line` plottables now split the dataset into complete and
incomplete at instantiation time, not at render time. This makes it
possible to then do a reverse lookup, and figure out the split when
highlighting.

`onHighlight` callback in all plottables accepts an offset index, which
they can use the look up the corresponding data.

`TimeSeriesWidgetVisualization` correctly calculates a `dataIndex` and
an offset and passes it to any `Plottable` that is involved in a
`"highlight"` event
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants