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

Click annotations handler #1

Draft
wants to merge 5 commits into
base: add-annotations
Choose a base branch
from

Conversation

amsiglan
Copy link

Description

Adds small framework to allow adding event handlers on vega visualizations.

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
    • yarn test:ftr
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

ohltyler and others added 5 commits March 9, 2023 10:22
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com>
@@ -21,6 +21,8 @@ import {
HOVER_PARAM,
} from '../';

const showEventsFlyoutAction = 'show-events-flyout';
Copy link
Owner

Choose a reason for hiding this comment

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

Do you want to take on the view events flyout action, or just have the framework set up that I can build on top of? For example I already have the defined open flyout action in my draft PR here: https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3415/files#diff-e5581c4c9ed88d345c2fffa25e66f906e98b05d699e4c5614a87748e31996d4d

Comment on lines +341 to +344
{
event: 'click',
expressionFunction: 'visAugmenter.handlePointInTimeClick',
},
Copy link
Owner

@ohltyler ohltyler Mar 28, 2023

Choose a reason for hiding this comment

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

Recommend making the interaction handler an interface / typesafe. Also, expressionFunction field could be renamed to just function or something else, since it is not an expression function.

Comment on lines +348 to +350
export const isPointInTimeView = (item: any) => {
return item.datum.action === showEventsFlyoutAction;
};
Copy link
Owner

Choose a reason for hiding this comment

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

not sure if you've played around much with the different scenarios, but what happens if user clicks at a blank space in the chart, or somewhere irrelevant within the canvas? (axes, legend, etc.). I'm assuming datum would be empty, or action within datum would be empty, if clicking on other datapoints.

};

export const addPointInTimeInteractionHandlers = (spec: any) => {
spec.interactionHandlers = [
Copy link
Owner

Choose a reason for hiding this comment

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

we can probably add this field as a nested field in kibana, which is used in the vega parser to process things within the spec that aren't specific to vega itself. ref: opensearch-project#3145 (comment)

@ohltyler ohltyler force-pushed the add-annotations branch 2 times, most recently from 4fa4d70 to 3f4e1e1 Compare March 30, 2023 19:35
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