-
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] Support metric trendlines #141851
[Lens] Support metric trendlines #141851
Conversation
bc7709e
to
4168799
Compare
@markov00 keep in mind that this always happens if there are null data points between existing data points which is a common situation to occur if the date histogram interval drops below the sampling rate of the source data. |
@flash1293 this is ready for another look. I think we're getting close to ready for takeoff! 🚀 |
@KOTungseth I know you had some feedback on the PoC for this feature. Do you have any feedback on the copy here? Mostly it's the supporting visualization button group and the messaging when one supporting visualization type is disabled. |
0610ad5
to
8ee436c
Compare
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.
Tested and didn't find any problems anymore, LGTM once green. Awesome work!
Test failures seem simple to fix
ff1edb3
to
d48b4b7
Compare
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Public APIs missing exports
Page load bundle
Unknown metric groupsAPI count
ESLint disabled line counts
References to deprecated APIs
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
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.
Hey, @andrewctate! It looks like I've arrived late, as this PR is merged now. Nonetheless, I have a handful of comments and questions that I've written up some below for your review. Hopefully we can address them in a follow-up PR:
-
In our last vis editors sync, we discussed potentially moving "Supporting visualization" (and the conditional "Bar direction" button group) into its own section within the primary metric configuration flyout, below "Appearance." With a section heading of "Supporting visualization, we could then change the "Supporting visualization" label for the button group to something shorter, like "Type." Is that being split off as a separate issue? Or did we decide against it after our discussion?
-
Adding a reduced time range to the primary or secondary metric while "Trend line" is selected causes an error to appear in the workspace. Can we instead automatically fallback to using "None" for the supporting visualization to avoid the error altogether? This would also be more consistent with how we handle maximum value dimensions being removed when "Bar" is selected.
-
Changing the supporting visualization type to "Trend line" and closing the flyout causes the visualization layer's previous "Clear" button to incorrectly change to a "Delete" button. Attempting to then delete the layer via this button causes a number problems to occur. For the metric type visualization, the action should always be clear. Delete shouldn't be an option, as metric visualizations only support a single layer.
{ | ||
id: `${buttonIdPrefix}trendline`, | ||
label: i18n.translate('xpack.lens.metric.supportingVisualization.trendline', { | ||
defaultMessage: 'Trend line', |
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 noticed that this text gets truncated at smaller viewport sizes. Would it make sense to change Trend line
to simply Line
to avoid the truncation?
isFullWidth | ||
buttonSize="compressed" | ||
legend={i18n.translate('xpack.lens.metric.progressDirectionLabel', { | ||
defaultMessage: 'Bar direction', |
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.
Thoughts on changing this text from Bar direction
to Bar orientation
?
if (!state.maxAccessor) { | ||
supportingVisHelpTexts.push( | ||
i18n.translate('xpack.lens.metric.summportingVis.needMaxDimension', { | ||
defaultMessage: 'Add a maximum dimension to enable the progress bar.', |
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 changing this text to: Bar visualizations require a maximum value to be defined.
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.
How about:
To use bar charts, you must use a maximum value to enable the progress bar.
supportingVisHelpTexts.push( | ||
!hasDefaultTimeField | ||
? i18n.translate('xpack.lens.metric.supportingVis.needDefaultTimeField', { | ||
defaultMessage: 'Use a data view with a default time field to enable trend lines.', |
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 changing this text to: Line visualizations require use of a data view with a default time field.
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 thought that, since we aim to give the user direction, the imperative voice was most appropriate. Could you clarify your reasoning?
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.
Ultimately, I'll defer to @KOTungseth for all of my wording suggestions here. However, my reasoning for suggesting this direction (and moving away from imperative) was to put the name of the visualization being referenced first in the sentence for easier scanning (since there exists the possibility of showing multiple help text sentences across multiple visualization types (bar, line).
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.
Okay, I'll implement your suggestions in #143781 and @KOTungseth can chime in there next week if she has time 👍
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.
How about:
To create line charts, you must use a data view with a default time field.
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 worry that "To create line charts" implies greater flexibility than we offer with the metric trend lines (on/off switch). I wonder if even getting away from calling them trend lines is a good idea (getting back to Michael's original feedback on the button itself).
WDYT? I ultimately defer to you 👍
: metricHasReducedTimeRange | ||
? i18n.translate('xpack.lens.metric.supportingVis.metricHasReducedTimeRange', { | ||
defaultMessage: | ||
'Remove the reduced time range on this dimension to enable trend lines.', |
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 changing this text to: Line visualizations cannot be used when a reduced time range is applied to the primary metric.
: secondaryMetricHasReducedTimeRange | ||
? i18n.translate('xpack.lens.metric.supportingVis.secondaryMetricHasReducedTimeRange', { | ||
defaultMessage: | ||
'Remove the reduced time range on the secondary metric dimension to enable trend lines.', |
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 changing this text to: Line visualizations cannot be used when a reduced time range is applied to the secondary metric
Hi @MichaelMarcialis . I merged this PR because the functionality is complete and it was incurring a maintenance burden, but I'm not finished with the feature polishing. Thanks for your comments.
This is still in the plans 👍
I agree with you here. Falling back to "None" was my first choice. But, quite a bit of sleight of hand was required to deliver on the "layerless" trend line experience so the technical machinery isn't really comparable to the progress bar. Due to this, falling back to "None" (i.e. triggering the removal of the hidden trend line layer when a setting on a datasource operation changed) didn't look like a reasonable option from a technical perspective. I was glad to get it at least to where the user clearly sees what action caused the problem and if they come at it in the other order, we handle it more gracefully with the disabled button and the help text. Happy to discuss further if you feel strongly.
Excellent find. Here we see the true implementation leaking through. Created an issue here #143687 I'll wrap your copy suggestions up in another PR 👍 |
Summary
resolve #135882
Screen.Recording.2022-10-10.at.2.04.21.PM.mov
Outstanding Issues
Functional test for linked dimensions?Trendline suggestions(waiting until next iteration)Fix duplicate requests problem(will be resolved by Allow to disable partial results in expressions #143344)Checklist
Delete any items that are not applicable to this PR.