-
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 non-numeric metrics for metric vis #169258
Conversation
5b49775
to
4145f6b
Compare
Pinging @elastic/kibana-visualizations (Team:Visualizations) |
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 looks great! I found some small bugs:
- When the collapse by is on then I see the coloring options in the metric dimension for non numeric fields
- I have a configuration like this
Maybe this does not strictly belong here, but I would like to raise some awareness about long text fields for Metric: While the secondary metric can go multiline, the primary metric has a I've tried to quickly check what would happen without that |
Thank you @dej611, given the nature of the secondary metric it was easier to expect that it could go on multiple lines, it is also way smaller and then way more easy to deal with. At the same time this is an interesting conversation to have because introducing text might make worth to talk about multi-lines for values/strings as well. Thank you for pointing this out! |
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.
Nice! Just did a code review.
x-pack/plugins/lens/public/visualizations/metric/dimension_editor.test.tsx
Show resolved
Hide resolved
src/plugins/chart_expressions/expression_metric/public/components/metric_vis.tsx
Show resolved
Hide resolved
x-pack/plugins/lens/public/visualizations/metric/visualization.test.ts
Outdated
Show resolved
Hide resolved
Yeah, IIRC when no max is provided, elastic-charts interprets the |
@stratoula this is an extreme edgecase and also not an easy problem to fix (we already have it in datatable). I could create a bug or we could also just ignore it – in the end, seeing these options don't really break anything. |
I see that the problem is that the last metric column reports that is a number but is wrong. Can we fix it? If we fix it on the aggs level then it will be solved in both places |
fixableInEditor: true, | ||
displayLocations: [{ id: 'dimensionButton', dimensionId: state.maxAccessor }], | ||
shortMessage: i18n.translate('xpack.lens.lnsMetric_maxDimensionPanel.nonNumericError', { | ||
defaultMessage: 'Maximum value cannot be defined for non-numeric primary metric.', |
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 making this text more positive.
Primary metric must be numeric to set a maximum value.
If the fix on the aggs level is difficult you can do it here possibly (I dont think that this will cause any bugs tbh) We are already doing this for min and max. You can add a check for last value too. If you check the column.meta.params.id the value is string (not numeric) which is the correct type. So you could extend it possibly for other types.
|
5690aaa
to
f7f939f
Compare
@stratoula all the bugs were fixed (by rebasing off the aggs PR) Please recheck 🙏🏼 😊 |
…metrics (#169834) ## Summary When checking my PR here #169258 @stratoula noticed that the `column.meta.type` is not set properly for last value aggregation (it always defaults to 'number', same with all the filtered metrics too!). When I dug deeper, I noticed that happens because we calculate it as: ``` type: column.aggConfig.type.valueType column.aggConfig.params.field?.type || 'number', ``` and some of the `AggConfigs` don't have the static `valueType` property nor field, specifically the one with nested aggregations, like top_hits, top_metrics and filtered_metric. instead of a static `valueType`, I've decided to change it to a method `getValueType` where we can pass AggConfigs and get the type from different places internally. This way `top_hits`, `top_metrics` and `filtered_metric` get the type of the field from `customMetric`. I also changed the values for `min` and `max` aggregation - they were set on `number`, but they can also be a `date`.
e149826
to
088ff3e
Compare
The text re: the primary metric LGTM. What does this message mean: |
@gchaps this doesn't come from this PR, but I am happy to revisit. This error appears when the input value for the color ranges is not correct (see the screenshot attached to Stratoula's message) |
088ff3e
to
d06095e
Compare
Fixed! |
43a43db
to
d06095e
Compare
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Async chunks
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.
Tested the broken color cases! Thank you!
Summary
Fixes #137756
Allows to set non numeric metrics for metric visualization for primary and secondary metric.
Doesn't include coloring by terms.
When primary metric is non-numeric:
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