-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] Thresholds: Add text to markers body #113629
Conversation
…reshold_panel.tsx Co-authored-by: Michael Marcialis <michael@marcial.is>
@elasticmachine merge upstream |
merge conflict between base and head |
That is an interesting idea to unify the icon and text labels under a common term. The two concerns I have with such an approach are 1) that it complicates the icon selection flow (requires additional clicks, must conditionally disable the icon selector, etc.) and 2) that it turns a simple switch into a more complex selector or button group. I'm curious if we can instead address @mbondyra's concerns with some verbiage and ordering changes. For example:
So the new final order would be something like:
Would an approach like this address the original concern? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great, @dej611! Leaving you a few comments and questions below for my review:
-
Do you have any thoughts about changing all the references to the
Display name
input to simplyName
?Display name
always seemed overly verbose to me, and doing so means we could also shortenShow display name
toShow name
. CCing @ghudgins for thoughts on this as well. -
Regarding @markov00's excellent suggestions for improving the in-visualization threshold label styling, is this an enhancement the dataviz team would provide via an enhancement to Elastic charts? Or is the assumption that such an enhancement would be on us (the Lens team) to implement on our end? If it's something we'd be responsible for implementing, is this something we wish to address in this PR or separately in a future issue?
<div | ||
style={{ | ||
display: 'inline-block', | ||
overflow: 'hidden', | ||
width: THRESHOLD_MARKER_SIZE, | ||
lineHeight: 1.5, | ||
}} | ||
> | ||
<div | ||
className="eui-textTruncate" | ||
style={{ | ||
display: 'inline-block', | ||
whiteSpace: 'nowrap', | ||
transform: 'translate(0, 100%) rotate(-90deg)', | ||
transformOrigin: '0 0', | ||
maxWidth: THRESHOLD_MARKER_SIZE * 3, | ||
}} | ||
> | ||
{label} | ||
<div | ||
style={{ | ||
float: 'left', | ||
marginTop: '100%', | ||
}} | ||
/> | ||
</div> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from the styles that reference the THRESHOLD_MARKER_SIZE
variable, what is the reason for using inline styles versus using classes that apply styles via an external SCSS file? I'm only asking for the sake of consistency with how we appear to handle styles elsewhere in Lens.
<div | ||
style={{ | ||
float: 'left', | ||
marginTop: '100%', | ||
}} | ||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you end up changing these inline styles to SCSS (as described in the previous comment), consider also switching from styling this empty div
element to an ::after
pseudo element.
To me it makes sense what @ghudgins wrote here: #112921 (comment) if we are going to offer the experience we have right now anyway, let’s start with that and follow up with additional configuration options. We can discuss offline though. |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making those changes, @dej611. Left one small suggestion, but otherwise looks good to me. Approving now so I don't hold you up.
.lnsXyDecorationRotatedWrapper { | ||
display: inline-block; | ||
overflow: hidden; | ||
line-height: 1.5; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest using the $euiLineHeight
variable here:
line-height: 1.5; | |
line-height: $euiLineHeight; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM, I tested it locally and it seems to work fine :) I think for a first iteration is a very cool addition!
@@ -187,6 +188,10 @@ export const yAxisConfig: ExpressionFunctionDefinition< | |||
options: ['auto', 'above', 'below', 'left', 'right'], | |||
help: 'The placement of the icon for the threshold line', | |||
}, | |||
textVisibility: { | |||
types: ['boolean'], | |||
help: 'Visibility of the marker label', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super nit: Can we also add to the help text that it is used for the reference line? Otherwise, both the variable name and help text are very generic. Moreover I can't see the word marker anywhere in the UI so this confuses even more
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
* 🐛 Add padding to the tick label to fit threshold markers * 🐛 Better icon detection * 🐛 Fix edge cases with no title or labels * 📸 Update snapshots * ✨ Add icon placement flag * ✨ Sync padding computation with marker positioning * 👌 Make disabled when no icon is selected * ✨ First text on marker implementation * 🐛 Fix some edge cases with auto positioning * Update x-pack/plugins/lens/public/xy_visualization/xy_config_panel/threshold_panel.tsx Co-authored-by: Michael Marcialis <michael@marcial.is> * 🐛 Fix minor details * 💄 Small tweak * ✨ Reduce the padding if no icon is shown on the axis * ✅ Fix broken unit tests * 💄 Fix vertical text centering * 🚨 Fix linting issue * 🐛 Fix issue * 💄 Reorder panel inputs * 💄 Move styling to sass * 👌 Address feedback Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Michael Marcialis <michael@marcial.is>
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync. |
* 🐛 Add padding to the tick label to fit threshold markers * 🐛 Better icon detection * 🐛 Fix edge cases with no title or labels * 📸 Update snapshots * ✨ Add icon placement flag * ✨ Sync padding computation with marker positioning * 👌 Make disabled when no icon is selected * ✨ First text on marker implementation * 🐛 Fix some edge cases with auto positioning * Update x-pack/plugins/lens/public/xy_visualization/xy_config_panel/threshold_panel.tsx Co-authored-by: Michael Marcialis <michael@marcial.is> * 🐛 Fix minor details * 💄 Small tweak * ✨ Reduce the padding if no icon is shown on the axis * ✅ Fix broken unit tests * 💄 Fix vertical text centering * 🚨 Fix linting issue * 🐛 Fix issue * 💄 Reorder panel inputs * 💄 Move styling to sass * 👌 Address feedback Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Michael Marcialis <michael@marcial.is> Co-authored-by: Marco Liberati <dej611@users.noreply.github.com> Co-authored-by: Michael Marcialis <michael@marcial.is>
Summary
Fixes #112921
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:
For maintainers