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

Visual overlapping of annotation icon and vertical axis tick/label #1400

Open
dej611 opened this issue Sep 22, 2021 · 6 comments
Open

Visual overlapping of annotation icon and vertical axis tick/label #1400

dej611 opened this issue Sep 22, 2021 · 6 comments
Labels
bug Something isn't working Impact:Low kibana cross issue Has a Kibana issue counterpart :Lens Kibana Lens related issue :xy Bar/Line/Area chart related

Comments

@dej611
Copy link
Contributor

dej611 commented Sep 22, 2021

Describe the bug

We use the annotation system to draw thresholds in Lens, and upon adding the Icon marker associated with the annotation, it was noticed that it is possible a collision of the marker with the vertical axis.

image

Kibana Cross Issues
elastic/kibana#112793

@dej611 dej611 added bug Something isn't working :Lens Kibana Lens related issue labels Sep 22, 2021
@nickofthyme
Copy link
Collaborator

nickofthyme commented Sep 22, 2021

As of right now I believe we leave it to the user to set the value of the annotation gutter, if you will, such that it has the width or height it needs. This would be through theme.chartPaddings. Is this true @markov00?

In you case you are using the eui theme which removes the axes ticks making this collision more apparent.

I think we could improve this to be automatic in the future but there are cases like annotations outside and adaptive markBody that make it more difficult.

Screen Recording 2021-09-22 at 08 58 51 AM

@dej611
Copy link
Contributor Author

dej611 commented Sep 22, 2021

I made some experiments with annotation on the left/right/bottom axes tweaking some parameters.

Initial state with overlap:

Screenshot 2021-09-22 at 19 25 53

Here's using the chartPaddings parameter (better, but the axes should shrink together with the chart IMHO):

Screenshot 2021-09-22 at 19 27 18

Here's using the tickLabels.padding (better but the padding is applied in any direction around the label, not just between the label and the axis):

Screenshot 2021-09-22 at 19 26 32

@markov00
Copy link
Member

markov00 commented Sep 22, 2021

Yes @nickofthyme, at the moment this is true, we don't automatically allocate space for the icon on the axis.
Together with the nick workaround, I can suggest to move the icon to the opposite side of the axis to avoid collisions and to have a clean axis.

If you are in the bad situation of having a dual-axis chart (highly discouraged) is advised to keep the icon near the relative axis draw it inside the chart (better if placed on the top/bottom of the line annotation.

Remember that you can also use directly the value instead if just an icon as in the below example.

Finally you can also have the icon externally placed without adding the tickLabel.padding but using the tickLine:{size: sizeoftheicon, visible: true, stroke: 'transparent'}
this will add a 'transparent' tick line that can be used in replacement of the tick padding.

Also another possibility, that doesn't fully resolve but can help reading the chart is to color the axis with the same color of the annotation line to improve, for non-color blinded person, the link between the axis and the annotation in a dual axis situation

Screenshot 2021-09-22 at 19 41 18

https://codesandbox.io/s/summer-browser-q4upn?file=/src/App.tsx

@markov00
Copy link
Member

you can also use tickLabel: {padding: { inner: size_of_the_marker } } instead of tickLabel:{padding: size_of_the_marker}} to

@dej611
Copy link
Contributor Author

dej611 commented Sep 23, 2021

you can also use tickLabel: {padding: { inner: size_of_the_marker } } instead of tickLabel:{padding: size_of_the_marker}} to

I think this one is the best tradeoff at the moment.
Screenshot 2021-09-23 at 11 33 45

If you are in the bad situation of having a dual-axis chart (highly discouraged) is advised to keep the icon near the relative axis draw it inside the chart (better if placed on the top/bottom of the line annotation.

This is definitely an interesting idea and something we might consider given elastic/kibana#112921

Also another possibility, that doesn't fully resolve but can help reading the chart is to color the axis with the same color of the annotation line to improve, for non-color blinded person, the link between the axis and the annotation in a dual axis situation

Screenshot 2021-09-22 at 19 41 18

This makes sense, but I doubt is compatible with a generic case where the user can have multiple annotations on the same axis with distinct colors as in our use case.

@dej611
Copy link
Contributor Author

dej611 commented Sep 23, 2021

Managed to find a solution for all the various combinations (title + tick labels, title only, etc...) in this PR combining all the padding/margin parameters in the Axis component: elastic/kibana#112952

@ghudgins ghudgins added :xy Bar/Line/Area chart related Impact:Low kibana cross issue Has a Kibana issue counterpart labels Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Impact:Low kibana cross issue Has a Kibana issue counterpart :Lens Kibana Lens related issue :xy Bar/Line/Area chart related
Projects
None yet
Development

No branches or pull requests

4 participants