-
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] Allow modifying curve type for line/area series charts #94675
Conversation
Pinging @elastic/uptime (Team:uptime) |
Thanks for looking into this! As this feature entered the roadmap on short notice, there are some UI/UX questions we haven't answered. Let's try to do so on this PR.
|
Thanks @markov00 , that's great input! |
I also like the brush icon idea and keeping it in the same popover. I will go ahead and make the change, if there are no objections. |
Update: @flash1293 Switched to curved/non-surved option and consolidated in a single popover |
Pinging @elastic/kibana-app (Team:KibanaApp) |
Seems like some tests have to be adjusted, but looks pretty good. |
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.
I'm liking this direction that you've all proceeded with. Left a few comments/questions below.
label={ | ||
<> | ||
{i18n.translate('xpack.lens.xyChart.curveStyleLabel', { | ||
defaultMessage: 'Line style', |
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.
For consistency with how we've previously presented most switches across Lens, can you change the EuiFormRow
label to something like Curve lines
(and subsequently hide the label on the EuiSwitch
component via the showLabel
prop)?
<EuiIconTip | ||
color="subdued" | ||
content={i18n.translate('xpack.lens.xyChart.curveStyleLabelHelpText', { | ||
defaultMessage: `By default, Lines are not curved.`, | ||
})} | ||
iconProps={{ | ||
className: 'eui-alignTop', | ||
}} | ||
position="top" | ||
size="s" | ||
type="questionInCircle" | ||
/> |
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.
Minor nitpick: I'd personally be OK with removing this tooltip altogether, as I imagine the default will be evident to users during the creation process.
return ( | ||
<ToolbarPopover | ||
title={i18n.translate('xpack.lens.shared.curveLabel', { | ||
defaultMessage: 'Visual options', |
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.
Any thoughts on changing Visual options
to Appearance options
?
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.
Honestly to me seems like Visual and Appearance both are loaded words, but i am not a native speaker :D
It could be just simply Style options
? then again style could be more of a css thing. i am 50/50 on Visual and Appearance. may be slightly in favor of Visual.
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.
No opinion on this, previously Gail would do a pass over all newly introduced wording before the release. I think we can go either way on this PR and let her check before we push it out.
})} | ||
type="visualOptions" | ||
groupPosition="right" | ||
buttonDataTestSubj="lnsLegendButton" |
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.
Is this probably a wrong copy and paste or have I miss something? it was lnsValuesButton
in the previous code
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.
yes, i am cleaning the code, this should get cleaned as well, with tests alongside.
Does anyone have any opinion about keeping default option as Curved? i feel like that aligns with providing user with sensible defaults kibana wide. I feel like providing curved lines is a sensible default. |
@wylieconlon that sounds like a good idea, but i guess we can do that as an enhancement. I think curved/non curved is a good start. |
@flash1293 this is ready as far tests etc goes. |
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.
Looks almost good to me, left two minor comments.
I agree we can add stepped in a follow-up, this is definitely a valuable increment in itself.
Edit:
I noticed one issue: On switching from a curved line chart to an area chart, the curve option gets lost. Make sure to pass the setting along in the suggestions logic:
changeType, |
|
||
return ( | ||
<> | ||
{isValueLabelsEnabled ? ( |
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.
nit: You can use isValueLabelsEnabled &&
syntax here to get rid of the : null
@@ -0,0 +1,44 @@ | |||
/* |
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.
I might miss something, but the visual options are only used for the xy visualization, right? In that case they should be located in the xy_visualization
folder as well (shared_components
is meant for things used in multiple chart types)
curveType: { | ||
types: ['number'], | ||
help: i18n.translate('xpack.lens.xyChart.curveType.help', { | ||
defaultMessage: 'Define how curve type is rendered for a line chart', |
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.
Can we pass the enum here instead of the number (and resolve it in the component using CurveType[arg]
)? That seems easier to follow (and I'm somehow scared of the numbers changing and nobody notices)
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.
i am not sure how enum will work here. can you give an example?
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.
done !!
It doesn't look like the comment I added via edit was addressed: #94675 (review)
Switching between area/line charts and adding dimensions should preserve the "curve" option |
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.
See my comment
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.
While testing this I found a bug: using the Area Percentage chart type with a histogram shows this set of messages:
It seems like we do not allow fitting functions for Area Percentage, but we do allow curving now. The message is outdated.
Other than that, the code and behavior LGTM
Edit: I would still like to see the Stepped option added here, but I will open an issue for it.
💚 Build SucceededMetrics [docs]Module Count
Async chunks
History
To update your PR or re-run it, just comment with: cc @shahzad31 |
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.
LGTM
#95536) Co-authored-by: Shahzad <[email protected]>
Summary
Fixes: #94060
Default will be
CurveType.Linear