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

[ML] DF Analytics results view: ensure boolean values in charts shown without formatting #78888

Merged

Conversation

alvarezmelissa87
Copy link
Contributor

@alvarezmelissa87 alvarezmelissa87 commented Sep 29, 2020

Summary

Related meta issue: #77182

  • update Chart data items to always have key_as_string property and use them in the charts so that values like booleans show up as 'true'/'false' vs 1/0

image

  • Adds functional tests for training filters to ensure training filter exists in relevant views.

Checklist

Delete any items that are not applicable to this PR.

@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

@peteharverson peteharverson changed the title [ML] DF Analytics results view: ensure booelan values shown without formatting [ML] DF Analytics results view: ensure boolean values shown without formatting Sep 30, 2020
@peteharverson
Copy link
Contributor

This looks good. But as part of this work would be nice to look at the behavior of the tooltip for the data grid histogram for boolean types to also show true / false rather than 1 / 0 currently:

image

@walterra suggested the easiest approach might be to adapt the data we pass on to the chart instead of fiddling with custom formatting in the tooltip.

@peteharverson
Copy link
Contributor

peteharverson commented Sep 30, 2020

Regarding #78888 (comment), it looks like the schema change has changed the axis labelling for boolean types. On master, it labels the columns as 'true' / 'false' rather than '2 categories' (although the tooltip still says 1 / 0):

image


@peteharverson - thanks for taking a look! 🙏 I was able to fix the tooltip issue but it requires keeping the schema for boolean defined - which causes the boolean values to be displayed as capitalized. Looks like those are coupled for now - I'll do some more digging.

@alvarezmelissa87 alvarezmelissa87 changed the title [ML] DF Analytics results view: ensure boolean values shown without formatting [ML] DF Analytics results view: ensure boolean values in charts shown without formatting Sep 30, 2020
Copy link
Member

@pheyos pheyos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional test changes LGTM

@@ -231,11 +231,13 @@ export const useColumnChart = (
if (isOrdinalChartData(chartData)) {
data = chartData.data.map((d: OrdinalDataItem) => ({
...d,
key_as_string: d.key_as_string || d.key,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if d.key_as_string could be undefined this should probably be a ?? check.
also, should key_as_string be optional in the interface?

Copy link
Contributor Author

@alvarezmelissa87 alvarezmelissa87 Oct 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, d.key_as_string is not defined in some items this point so we are checking for undefined. Great suggestion for updating to use ?? check.

As key_as_string will now always be defined (since we're setting it as key when it isn't) I left it as required in the interface. Though it will be less flexible and doesn't really reflect the original item - I think leaving it as optional is the better option. Good catch! 🙏

Updated in df3142a

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and LGTM.

Formatting true in the table cell rather than True might be best done eventually in the EUI data grid itself.

Copy link
Member

@jgowdyelastic jgowdyelastic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

async chunks size

id before after diff
ml 10.6MB 10.6MB +696.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@alvarezmelissa87 alvarezmelissa87 merged commit 4c65b6d into elastic:master Oct 6, 2020
alvarezmelissa87 added a commit to alvarezmelissa87/kibana that referenced this pull request Oct 6, 2020
… without formatting (elastic#78888)

* add functional test for searchBar filters. remove boolean schema from datagrid

* always use string version of key for charts

* add schema back in for histogram label

* use ?? instead of || for undefined check
@alvarezmelissa87 alvarezmelissa87 deleted the ml-dfanalytics-update branch October 6, 2020 18:41
alvarezmelissa87 added a commit that referenced this pull request Oct 6, 2020
… without formatting (#78888) (#79741)

* add functional test for searchBar filters. remove boolean schema from datagrid

* always use string version of key for charts

* add schema back in for histogram label

* use ?? instead of || for undefined check
tylersmalley pushed a commit to tylersmalley/kibana that referenced this pull request Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants