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

Annotation Icon is cropped on reference lines #149414

Closed
Tracked by #136409
angorayc opened this issue Jan 24, 2023 · 12 comments · Fixed by #149573
Closed
Tracked by #136409

Annotation Icon is cropped on reference lines #149414

angorayc opened this issue Jan 24, 2023 · 12 comments · Fixed by #149573
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature:ElasticCharts Issues related to the elastic-charts library Feature:Lens impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@angorayc
Copy link
Contributor

angorayc commented Jan 24, 2023

Please observe that the annotation icon appears on the left side of the chart is cropped.
Screenshot 2023-01-24 at 11 01 23

Same issue in Lens Embeddable as well:
Screenshot 2023-01-24 at 11 00 46

@angorayc angorayc added bug Fixes for quality problems that affect the customer experience Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Lens labels Jan 24, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-visualizations @elastic/kibana-visualizations-external (Team:Visualizations)

@nickofthyme nickofthyme changed the title Icon decoration is cropped Annotation Icon is cropped on reference lines Jan 24, 2023
@nickofthyme nickofthyme added the Feature:ElasticCharts Issues related to the elastic-charts library label Jan 24, 2023
@stratoula stratoula added impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. blocked labels Jan 24, 2023
@stratoula
Copy link
Contributor

This should be fixed on the EC side if I am not mistaken.

@markov00
Copy link
Member

It should be fixed on ElasticCharts, but I think today is easier to extend the work @dej611 already did for that in Lens.
We can probably just missing in Lens margin that case (right axis, left icon)

@stratoula
Copy link
Contributor

So @markov00 just to ensure that I got your suggestion right:

  • In case we identify this scenario we can increase the left chart margin? Correct?

@nickofthyme
Copy link
Contributor

nickofthyme commented Jan 24, 2023

Actually in charts we do not determine the size of the marker to adjust chart size and placement.

Since the marker prop allows consumers to use any react component we don't know how big the marker will be. As such we treat the markers as if they will fit given the defined margins and paddings. See demo.

Screen Recording 2023-01-24 at 10 09 50 AM

So I think this is a kibana issue not charts. Unless we want to change this assumption in charts to be responsive to the marker size.

@stratoula stratoula removed the blocked label Jan 24, 2023
@stratoula
Copy link
Contributor

Great, thanx guys, this makes sense!

@dej611 dej611 self-assigned this Jan 25, 2023
@dej611
Copy link
Contributor

dej611 commented Jan 25, 2023

I've also noticed that trying to hover the reference line icon will trigger on the EC side due to some boundary computation for the tooltip:

hover_error

@nickofthyme
Copy link
Contributor

@dej611 Is that error emanating from the chart? If so could you share it?

@dej611
Copy link
Contributor

dej611 commented Jan 25, 2023

You can easily reproduce it:

  • create a Lens chart with a date histogram
  • set the metric axis to right
  • add a reference layer
  • add an icon to the reference line on the left
  • move the cursor, left to right and reach the icon
  • 💥

@markov00
Copy link
Member

@nickofthyme is important to note that this happens only when your cursor moves from within the chart area to the icon, and doesn't happen if your cursor starts from somewhere outside the chart and reach first the annotation icon.

@markov00
Copy link
Member

@nickofthyme @dej611 I identified the cause: the Endzones component in Kibana use a hook in the tooltip prompt to get some styles.
This hook in a nested component creates the issue.

I've reproduced the issue here with elastic-charts only here: https://codesandbox.io/s/tender-kapitsa-vnx4i7?file=/src/App.tsx

The reason is that due to the way the elastic/charts lib works with components you should not use hooks inside a wrapped component.

The only possible solution is to fix it by converting elastic-charts to use a custom react-reconciler elastic/elastic-charts#914 that is an hard/long task

@nickofthyme
Copy link
Contributor

After some searching I think we have discovered the issue to @dej611 #149414 (comment) inside @elastic/charts. The fix is in elastic/elastic-charts#1949 and will be released and updated in kibana soon.

dej611 added a commit that referenced this issue Jan 27, 2023
…eft side (#149573)

## Summary

Fix #149414 

Fixed margin computation for annotations icons on the left side. Added
unit tests.

<img width="1238" alt="Screenshot 2023-01-26 at 10 12 10"
src="https://user-images.githubusercontent.com/924948/214798802-6d176cf2-1bee-4f1e-bcaf-40bd970d857d.png">

### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### 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&mdash;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&mdash;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](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

Co-authored-by: Stratoula Kalafateli <[email protected]>
kqualters-elastic pushed a commit to kqualters-elastic/kibana that referenced this issue Feb 6, 2023
…eft side (elastic#149573)

## Summary

Fix elastic#149414 

Fixed margin computation for annotations icons on the left side. Added
unit tests.

<img width="1238" alt="Screenshot 2023-01-26 at 10 12 10"
src="https://user-images.githubusercontent.com/924948/214798802-6d176cf2-1bee-4f1e-bcaf-40bd970d857d.png">

### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### 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&mdash;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&mdash;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](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

Co-authored-by: Stratoula Kalafateli <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:ElasticCharts Issues related to the elastic-charts library Feature:Lens impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants