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

[ML] Add annotation markers to the Anomaly Swimlane axis #97202

Merged
merged 17 commits into from
Apr 20, 2021

Conversation

qn895
Copy link
Member

@qn895 qn895 commented Apr 15, 2021

Summary

This PR addresses #93463 and adds annotation markers to the Anomaly swimlane within the Anomaly Explorer page.

Screen Shot 2021-04-14 at 22 16 14

Checklist

Delete any items that are not applicable to this PR.

@walterra
Copy link
Contributor

Noticed that with just a few annotations and without further labeling it might not be that obvious for users what they are looking at:

image

Here's a quick&dirty suggestion how to improve:

image

  • Remove the duplicate anomaly levels legend and date labels
  • Move annotations to the top with an "Annotations" labels similar to "Overall".
  • Style the row with annotations slightly similar to the swimlanes so it's more obvious to users that they are looking at another "row" of data. That gray border is really just a quick suggestion, maybe it's also enough to make it more subtle, e.g. just a line below the annoation markers.

@@ -214,6 +220,7 @@ const loadExplorerDataProvider = (
tap(explorerService.setChartsDataLoading),
mergeMap(
({
allAnnotations,
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if we should rename everything related to allAnnotations to overallAnnotations. "all" might be a bit misleading since ANNOTATIONS_TABLE_DEFAULT_QUERY_SIZE = 500 limits how many annotations we fetch and it's not really "all".

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated here bc00e98 (#97202)

@peteharverson
Copy link
Contributor

Agree with @walterra that the annotations would benefit from a label, and I like his proposed styling with border (or single line).

I guess that the legend is part of the swim lane chart, so it may be more practical to stick with your current layout where the annotations are below the Overall swim lane. The Overall timeline is probably more important information that the annotations, so again it makes sense to make that the top element in the view.

@qn895
Copy link
Member Author

qn895 commented Apr 15, 2021

@walterra @peteharverson I have updated the styling to include the border and label on the y axis here. The result is definitely much more pleasing!
Screen Shot 2021-04-15 at 11 29 15

@qn895 qn895 marked this pull request as ready for review April 15, 2021 16:30
@qn895 qn895 requested a review from a team as a code owner April 15, 2021 16:30
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Tested and overall looks good. Just found a few styling / range issues.

chartElement.selectAll('*').remove();

const startingXPos = Y_AXIS_LABEL_WIDTH + 2 * Y_AXIS_LABEL_PADDING;
const endingXPos = startingXPos + chartWidth - Y_AXIS_LABEL_PADDING;
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the end of the annotation chart need adjusting? It always seems to extend past the swim lane for me:

image

Copy link
Member Author

@qn895 qn895 Apr 20, 2021

Choose a reason for hiding this comment

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

After discussing with Dima, we think the best way to fix this issue is through some modifications with the elastic-charts component itself. We can provide a callback function that exposes the positions of the heatmap cells whenever the swimlane is resized. Added this to the meta issue for Annotations.

x-pack/test/functional/apps/ml/anomaly_detection/index.ts Outdated Show resolved Hide resolved
@qn895 qn895 mentioned this pull request Apr 20, 2021
25 tasks
Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Tested latest edits and LGTM. Would be good to align the ends of the annotation bar and the swim lanes, but it is only off by a few pixels so can be addressed separately.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
ml 1796 1802 +6

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
ml 6.0MB 6.0MB +64.3KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @qn895

@qn895 qn895 added the auto-backport Deprecated - use backport:version if exact versions are needed label Apr 20, 2021
@qn895 qn895 merged commit 9365ca8 into elastic:master Apr 20, 2021
@qn895 qn895 deleted the ml-annotations-swimlane branch April 20, 2021 18:33
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Apr 20, 2021
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed Feature:Anomaly Detection ML anomaly detection :ml release_note:enhancement v7.13.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants