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

Re-position chart annotation when it is near the border #1040

Closed
pheyos opened this issue Mar 1, 2021 · 2 comments · Fixed by #1116
Closed

Re-position chart annotation when it is near the border #1040

pheyos opened this issue Mar 1, 2021 · 2 comments · Fixed by #1116
Assignees
Labels
:annotation Annotation (line, rect, text) related issue bug Something isn't working released Issue released publicly

Comments

@pheyos
Copy link
Member

pheyos commented Mar 1, 2021

Is your feature request related to a problem? Please describe.
The date label of the event rate chart in the ML revert model snapshot flyout does not look ideal when it is near the border of the chart:
image

See codesandbox repro here https://codesandbox.io/s/sad-pond-n2pqh?file=/src/App.tsx

image

Describe the solution you'd like
Leave the small arrow where it is but re-position the text such that it is better readable / does not contain so many line breaks.

Additional context
In a slack discussion, it was suggested to reuse tooltip functionality to do this.

@pheyos pheyos added the enhancement New feature or request label Mar 1, 2021
@nickofthyme nickofthyme self-assigned this Mar 1, 2021
@nickofthyme nickofthyme added :annotation Annotation (line, rect, text) related issue bug Something isn't working and removed enhancement New feature or request labels Apr 7, 2021
@nickofthyme nickofthyme reopened this Apr 22, 2021
@nickofthyme
Copy link
Collaborator

🎉 This issue has been resolved in version 29.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@nickofthyme nickofthyme added the released Issue released publicly label Apr 22, 2021
@nickofthyme
Copy link
Collaborator

nickofthyme commented Apr 23, 2021

Hey @pheyos this is now available in kibana master as of elastic/kibana#98093.

You can now throw the squashed text content into the markerBody prop of the LineAnnotation. Here is an example which looks like this in code...

<LineAnnotation
id="annotation_y"
domainType={AnnotationDomainType.YDomain}
dataValues={[{ dataValue: metric }]}
style={annotationStyle}
hideTooltips
marker={<EuiIcon type={iconMap[side]} />}
markerBody={getMarkerBody((v) => `The value is ${v} right here!`, isVerticalSide)}
/>

image

Lmk if you have any questions or trouble with it. Thanks! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:annotation Annotation (line, rect, text) related issue bug Something isn't working released Issue released publicly
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants