Skip to content

[Lens] Implement null instead of zero switch#127731

Merged
flash1293 merged 11 commits intoelastic:mainfrom
flash1293:drop-zero-option
Mar 22, 2022
Merged

[Lens] Implement null instead of zero switch#127731
flash1293 merged 11 commits intoelastic:mainfrom
flash1293:drop-zero-option

Conversation

@flash1293
Copy link
Copy Markdown
Contributor

@flash1293 flash1293 commented Mar 15, 2022

Fixes #119478

This PR adds a swtich for count/unique count and sum to show null instead of 0 in case of missing data.

Screenshot 2022-03-15 at 11 54 20

Screenshot 2022-03-15 at 11 54 24

  • Sum/cardinality/count behave like average/min/max when it comes to gaps
  • Chart has the chance to handle gaps like it wants (datasource doesn't dictate) - e.g. dotted lines for a count of records chart - impossible before
  • Especially for heatmap by default "empty" is rendered distinctly different from "data":
    Old behavior: zero is just another value and rendered as color

Screenshot 2022-03-15 at 12 12 22

New behavior: Empty is distinctly different

Screenshot 2022-03-15 at 12 12 27

* Setting is disabled for formula because otherwise common calculations won't work anymore (e.g. `sum(kql="A") + sum(kql="B")` will stop working if one of these sums is null because nulls can't be added) which slightly changes behavior between formula and quick functions

@flash1293 flash1293 added release_note:enhancement Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// Team:AppServicesSv Feature:Lens backport:skip This PR does not require backporting v8.2.0 labels Mar 15, 2022
@flash1293
Copy link
Copy Markdown
Contributor Author

@ghudgins Do you think the upsides are worth the downsides?

@flash1293
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@flash1293 flash1293 changed the title Implement null instead of zero switch [Lens] Implement null instead of zero switch Mar 17, 2022
@flash1293 flash1293 marked this pull request as ready for review March 17, 2022 13:34
@flash1293 flash1293 requested review from a team as code owners March 17, 2022 13:34
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-vis-editors @elastic/kibana-vis-editors-external (Team:VisEditors)

@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-app-services (Team:AppServicesSv)

Copy link
Copy Markdown
Member

@kertal kertal left a comment

Choose a reason for hiding this comment

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

DataDiscovery.team code LGTM, code owners review, just tests were changed. didn't test

@flash1293
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

Copy link
Copy Markdown
Contributor

@ppisljar ppisljar left a comment

Choose a reason for hiding this comment

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

code LGTM

return (
<EuiFormRow display="rowCompressed" hasChildLabel={false}>
<EuiSwitch
label={i18n.translate('xpack.lens.indexPattern.cardinality.hideZero', {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This copy is tricky... @KOTungseth could you help here?
I'd suggest 'don't display zero values', hide zero values, exclude zero values from visualization.

Copy link
Copy Markdown
Contributor

@mbondyra mbondyra left a comment

Choose a reason for hiding this comment

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

It works great and I think it solves a lot of mentioned problems for our users (apart from the ones in the description, in the datatable users sometimes also want to thave - instead of 0). I am just not sure if the copy is clear enough and if we shouldn't put this setting into the advanced popover.

@flash1293
Copy link
Copy Markdown
Contributor Author

@MichaelMarcialis Aside the copy, it's a bit annoying to have a new setting that visible in the sidebar which is not relevant in a lot of cases. Do you have another idea how to handle it?

@MichaelMarcialis
Copy link
Copy Markdown
Contributor

@MichaelMarcialis Aside the copy, it's a bit annoying to have a new setting that visible in the sidebar which is not relevant in a lot of cases. Do you have another idea how to handle it?

If we're confident that the majority of cases would not need/desire to use such a setting, then moving under advanced options (as @mbondyra mentions above) makes sense to avoid adding another ever-present item to the form.

Another thought might be whether or not such a setting needs to be managed at the individual dimension configuration level, or if it can/should be managed globally for all relevant dimensions in the visualization. If there is a desire to explore a global-level setting, it could be moved out of the configuration flyouts entirely and placed in one of the toolbar menus (perhaps under appearance).

@flash1293
Copy link
Copy Markdown
Contributor Author

flash1293 commented Mar 22, 2022

Thanks for the feedback, what about this:
Screenshot 2022-03-22 at 12 49 55
Screenshot 2022-03-22 at 12 50 00

I really like this approach, feels much better than the previous one!

If there is a desire to explore a global-level setting, it could be moved out of the configuration flyouts entirely and placed in one of the toolbar menus (perhaps under appearance).

It feels like this setting should be close to the metric it is affecting

@MichaelMarcialis
Copy link
Copy Markdown
Contributor

Thanks for the feedback, what about this: Screenshot 2022-03-22 at 12 49 55 Screenshot 2022-03-22 at 12 50 00

I really like this approach, feels much better than the previous one!

While this works technically, the issue I have with this approach is that it's inconsistent with the rest of the advanced settings presented. Interacting with the other advanced settings options renders a new form input to the configuration flyout. This would be the only advanced setting that doesn't do that in this particular configuration flyout.

Personally, I'm still of the mindset that these advanced settings should be placed a simple advanced settings accordion in the flyout, rather than a popover menu whose options trigger the rendering of new advanced setting inputs individually. I know we've put some advanced settings in an accordion in some configuration flyouts, but we still need to transition to that approach in places such as this. If we don't have the time/scope to make such a change here, we can either go with your approach here or have the option render a new EuiSwitch component to the flyout when clicked (to keep consistent with the rest of the menu interactions).

@flash1293
Copy link
Copy Markdown
Contributor Author

flash1293 commented Mar 22, 2022

Screenshot 2022-03-22 at 17 17 39

@MichaelMarcialis what about this?

If we don't have the time/scope to make such a change here, we can either go with your approach here or have the option render a new EuiSwitch component to the flyout when clicked (to keep consistent with the rest of the menu interactions).

I would like to do that separately, I put it on the agenda for 8.3

we can either go with your approach here or have the option render a new EuiSwitch component to the flyout when clicked

It felt weird to me because the switch would either disappear on disabling the setting or it would stick around forever after being added once which is both slightly unexpected to me.

@MichaelMarcialis
Copy link
Copy Markdown
Contributor

Screenshot 2022-03-22 at 17 17 39

@MichaelMarcialis what about this?

That works for the interim, until we take the accordion approach. Not super keen about the switch throwing off the text alignment, but not sure moving the switch to the right side would look much better.

@flash1293 flash1293 enabled auto-merge (squash) March 22, 2022 17:20
@flash1293 flash1293 merged commit 725000d into elastic:main Mar 22, 2022
@kibana-ci
Copy link
Copy Markdown

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
data 2834 2838 +4
lens 353 354 +1
total +5

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
lens 1.1MB 1.1MB +2.6KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
lens 42 43 +1

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
data 458.0KB 458.9KB +1002.0B
Unknown metric groups

API count

id before after diff
data 3447 3451 +4
lens 426 427 +1
total +5

History

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:Lens release_note:enhancement Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// v8.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Lens] Offer option to drop 0 values generated by count and sum aggs

8 participants