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

[Lens] Extends Axis bounds for XY chart when using Interval operation #134020

Merged
merged 9 commits into from
Jun 15, 2022

Conversation

dej611
Copy link
Contributor

@dej611 dej611 commented Jun 9, 2022

Summary

Partially fixes #129308

This PR introduces the ability to extends or filter axis bounds when using the Interval operation on XY charts.
The code has been refactored to provide some shared functions and components for the feature.
The feature is available under the visualization axis controls and is set by default to Data:

Screenshot 2022-06-08 at 17 54 44

Switching to Custom will show a new range input prefilled with existing bounds:

Screenshot 2022-06-08 at 17 55 25

Screenshot 2022-06-08 at 17 55 33

Screenshot 2022-06-08 at 17 55 54

Screenshot 2022-06-08 at 17 56 08

Notes

This implementation is very limited as it works only on the client side and for XY chart types.
Prior of this PR other approaches have been attempted which led to problems:

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers

@dej611 dej611 added release_note:enhancement Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Lens v8.4.0 labels Jun 9, 2022
@dej611 dej611 added the auto-backport Deprecated - use backport:version if exact versions are needed label Jun 9, 2022
@dej611 dej611 marked this pull request as ready for review June 9, 2022 15:55
@dej611 dej611 requested a review from a team as a code owner June 9, 2022 15:55
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-vis-editors @elastic/kibana-vis-editors-external (Team:VisEditors)

Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

Looks almost good to me, noticed one small bug

const { inputValue: debouncedExtent, handleInputChange: setDebouncedExtent } = useDebouncedValue<
const onExtentChange = useCallback(
(newExtent) => {
const { inclusiveZeroError, boundaryError } = validateExtent(hasBarOrAreaOnAxis, newExtent);
Copy link
Contributor

Choose a reason for hiding this comment

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

When switching from custom to data, this check is applied to undefined/undefined which is preventing an actual state change (the chart doesn't update). We should only validate for "custom" extends

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
lens 921 926 +5

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
expressionXY 137 138 +1
lens 515 517 +2
total +3

Async chunks

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

id before after diff
expressionXY 96.5KB 96.7KB +189.0B
lens 1.2MB 1.2MB +3.7KB
total +3.9KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
expressionXY 32.9KB 33.0KB +172.0B
Unknown metric groups

API count

id before after diff
expressionXY 147 148 +1
lens 592 594 +2
total +3

History

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

@dej611
Copy link
Contributor Author

dej611 commented Jun 15, 2022

@flash1293 it should be fixed now

Copy link
Contributor

@flash1293 flash1293 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 works as expected, LGTM. Great feature!

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 backport:skip This commit does not require backporting Feature:Lens release_note:enhancement Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Lens] Extended bounds for number histogram
5 participants