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

[Lens] Color mapping for categorical dimensions #162389

Merged
merged 90 commits into from
Sep 28, 2023

Conversation

markov00
Copy link
Member

@markov00 markov00 commented Jul 24, 2023

Summary

This PR introduces the new color mapping feature into Lens.

The color mapping feature is introduced as a standalone sharable component available from @kbn/coloring. The README.md file describes the components and the logic behind it.

The Color Mapping component is also connected to Lens and is available in the following charts:

  • XY (you can specify the mappings from a breakdown dimension
  • Partition (you can specify the mappings from the main slice/group by dimension)
  • Tag cloud (you can specify the mappings from the tags dimension)

This MVP feature will be released under the Tech Preview flag.
This PR needs to prove the user experience and the ease of use. UI styles, design improvements and embellishments will be released in subsequent PRs.

The current MVP-provided palettes are just a placeholder. I'm coordinating with @gvnmagni for a final set of palettes.

close #155037
close #6480
fix #28618
fix #96044
fix #101942
fix #112839
fix #116634

Release note

This feature introduces the ability to change and map colors to break down dimensions in Lens. The feature provides an improved way to specify colors and their association with categories by giving the user a predefined set of color choices
or customized one that drives the user toward a correct color selection.
It provides ways to pick new colors and generate gradients.
This feature is in Tech Preview and is enabled by default on every new visualization but can be turned off at will.
image

@markov00 markov00 force-pushed the 2023_07_17-color_mapping_lens branch 6 times, most recently from c26a3cb to 7ec4bdd Compare August 3, 2023 10:40
@markov00 markov00 force-pushed the 2023_07_17-color_mapping_lens branch 6 times, most recently from e7a581d to 03dc53f Compare August 31, 2023 16:08
@markov00 markov00 force-pushed the 2023_07_17-color_mapping_lens branch 4 times, most recently from befd1dc to b361b2e Compare September 8, 2023 08:50
@markov00 markov00 force-pushed the 2023_07_17-color_mapping_lens branch from 9cb310d to d442274 Compare September 26, 2023 14:43
delanni pushed a commit that referenced this pull request Sep 27, 2023
## Summary

Closes #166833
Closes #167063

This PR allows the inline editing of Lens panels in canvas and
dashboards.


![inline_editing](https://github.com/elastic/kibana/assets/17003240/8abb636b-7b5a-4d35-9f91-a1bf2ff963f2)

### Changes

#### Discover
- The basic UI change in Discover flyout is that we add the Cancel
button in the flyout footer (resets to the state before the flyout
changes).
- It also solves (with passing the embeddableOutput observable to the
flyout) the bug that is more prominent in this PR ([first
bullet](#162389 (comment)))


#### Dashboard
- All Lens panels have an Edit visualization panel action
- The Edit Lens action is now hidden
- A flyout opens (in the header there is a link where the users can go
to the editor)
- The by reference panels change to by value as long as the users are
editing. On apply and close, we save to the SO
- All tests have changed to accomodate this navigation change. All the
existing ones test the editor (as they used to do). I have added new
tests for testing the inline experience


#### Known issues
- If a user is currently editing a by reference visualization, doesn't
click Cancel or Apply and navigate away, the panel stays as by value
panel. The users can always go back and reset the changes and we could
not find an easy fix with Devon. We consider it as a nice to have and a
non-blocking behavior.


#### Missing
These 2 features are missing to give the full set of capabilities of the
editor to the flyout. Both are missing from ESQL editing too and are
going to be added on a follow up PR
- Chart switcher
- Suggestions (as icons and not previews)

#### Flaky tests runner 

https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3182
(100 times)

#### Panel focus
This PR will look even better when this is merged!
#165417

### Checklist

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [x] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: Marco Liberati <[email protected]>
@stratoula
Copy link
Contributor

The only thing I found is that in tagcloud the suggestions are not colored correctly (I consider it a nit)

image

I tested everything else and seems fine.

@markov00
Copy link
Member Author

The only thing I found is that in tagcloud the suggestions are not colored correctly (I consider it a nit)

thanks @stratoula nice catch, I just fixed that and also aligned the colors set shown in the dimension button with the color mapping selected

Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

Tested again and it works fine. 🎉

@MichaelMarcialis can you please review again? Marco has made the majority of the changes you asked. This PR introduces changes in many files so I would love this be merged before the FF 🙏

@Danouchka
Copy link

Hi @stratoula do you think this feature has good chance to be released in 8.11 ?

@stratoula
Copy link
Contributor

@Danouchka yes we are very positive that this is going to be merged soonish :)

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
charts 90 119 +29
eventAnnotationListing 429 458 +29
expressionGauge 87 88 +1
expressionHeatmap 121 151 +30
expressionLegacyMetricVis 32 33 +1
expressionMetricVis 61 91 +30
expressionPartitionVis 95 163 +68
expressionTagcloud 72 139 +67
expressionXY 155 223 +68
lens 1087 1119 +32
total +355

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
@kbn/chart-expressions-common 8 10 +2
@kbn/coloring 90 169 +79
data 2575 2577 +2
expressionXY 165 166 +1
lens 524 526 +2
total +86

Async chunks

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

id before after diff
expressionPartitionVis 32.1KB 40.6KB +8.5KB
expressionTagcloud 15.2KB 23.0KB +7.9KB
expressionXY 122.9KB 131.1KB +8.2KB
lens 1.4MB 1.4MB +45.8KB
total +70.3KB

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
@kbn/coloring 1 8 +7

Page load bundle

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

id before after diff
data 407.9KB 408.2KB +336.0B
expressionGauge 14.5KB 14.7KB +139.0B
expressionHeatmap 14.7KB 14.8KB +139.0B
expressionLegacyMetricVis 10.1KB 10.2KB +144.0B
expressionMetricVis 13.6KB 13.8KB +139.0B
expressionPartitionVis 25.7KB 26.7KB +1.0KB
expressionTagcloud 9.9KB 10.8KB +948.0B
expressionXY 38.0KB 38.7KB +703.0B
total +3.5KB
Unknown metric groups

API count

id before after diff
@kbn/chart-expressions-common 11 14 +3
@kbn/coloring 116 206 +90
data 3310 3313 +3
expressionXY 175 176 +1
lens 622 625 +3
total +100

ESLint disabled line counts

id before after diff
@kbn/coloring 1 2 +1

Total ESLint disabled count

id before after diff
@kbn/coloring 1 2 +1

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 commit does not require backporting ci:build-webpack-bundle-analyzer Feature:Lens release_note:feature Makes this part of the condensed release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.11.0
Projects
None yet