Skip to content

Commit

Permalink
[8.9] [Unified Histogram] Set legend width to extra large and enable …
Browse files Browse the repository at this point in the history
…text wrapping in legend labels (#163009) (#163060)

# Backport

This will backport the following commits from `main` to `8.9`:
- [[Unified Histogram] Set legend width to extra large and enable text
wrapping in legend labels
(#163009)](#163009)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Davis
McPhee","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-08-03T13:00:14Z","message":"[Unified
Histogram] Set legend width to extra large and enable text wrapping in
legend labels (#163009)\n\n## Summary\r\n\r\nThis PR sets the Unified
Histogram chart's legend width to extra large\r\nand enables text
wrapping in legend labels.\r\n\r\nNote that this means the legend will
always use the extra large size\r\n(230px) even if the screen size is
small or the labels do not fill the\r\navailable legend
space.\r\n\r\nWith long labels:\r\n<img width=\"1369\"
alt=\"long\"\r\nsrc=\"https://github.com/elastic/kibana/assets/25592674/1f6f0d80-d924-48a4-b758-4cf72b99fc57\">\r\n\r\nWith
short labels:\r\n<img width=\"1369\"
alt=\"short\"\r\nsrc=\"https://github.com/elastic/kibana/assets/25592674/704f2b75-a565-44a0-be1a-e27bdca00a8e\">\r\n\r\nResolves
#162932.\r\n\r\n### Checklist\r\n\r\n- [ ] ~Any text added follows
[EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)~\r\n-
[
]\r\n~[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials~\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] ~Any UI
touched in this PR is usable by keyboard only (learn more\r\nabout
[keyboard\r\naccessibility](https://webaim.org/techniques/keyboard/))~\r\n-
[ ] ~Any UI touched in this PR does not create any new axe
failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))~\r\n-
[ ] ~If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~\r\n-
[ ] ~This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))~\r\n-
[ ] ~This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)~\r\n\r\n###
For maintainers\r\n\r\n- [ ] This was checked for breaking API changes
and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"79303c24f6ee395a3860947a691ff8da1df7c4d6","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","Feature:Discover","Team:DataDiscovery","backport:prev-minor","Feature:UnifiedHistogram","v8.10.0"],"number":163009,"url":"https://github.com/elastic/kibana/pull/163009","mergeCommit":{"message":"[Unified
Histogram] Set legend width to extra large and enable text wrapping in
legend labels (#163009)\n\n## Summary\r\n\r\nThis PR sets the Unified
Histogram chart's legend width to extra large\r\nand enables text
wrapping in legend labels.\r\n\r\nNote that this means the legend will
always use the extra large size\r\n(230px) even if the screen size is
small or the labels do not fill the\r\navailable legend
space.\r\n\r\nWith long labels:\r\n<img width=\"1369\"
alt=\"long\"\r\nsrc=\"https://github.com/elastic/kibana/assets/25592674/1f6f0d80-d924-48a4-b758-4cf72b99fc57\">\r\n\r\nWith
short labels:\r\n<img width=\"1369\"
alt=\"short\"\r\nsrc=\"https://github.com/elastic/kibana/assets/25592674/704f2b75-a565-44a0-be1a-e27bdca00a8e\">\r\n\r\nResolves
#162932.\r\n\r\n### Checklist\r\n\r\n- [ ] ~Any text added follows
[EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)~\r\n-
[
]\r\n~[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials~\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] ~Any UI
touched in this PR is usable by keyboard only (learn more\r\nabout
[keyboard\r\naccessibility](https://webaim.org/techniques/keyboard/))~\r\n-
[ ] ~Any UI touched in this PR does not create any new axe
failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))~\r\n-
[ ] ~If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~\r\n-
[ ] ~This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))~\r\n-
[ ] ~This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)~\r\n\r\n###
For maintainers\r\n\r\n- [ ] This was checked for breaking API changes
and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"79303c24f6ee395a3860947a691ff8da1df7c4d6"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/163009","number":163009,"mergeCommit":{"message":"[Unified
Histogram] Set legend width to extra large and enable text wrapping in
legend labels (#163009)\n\n## Summary\r\n\r\nThis PR sets the Unified
Histogram chart's legend width to extra large\r\nand enables text
wrapping in legend labels.\r\n\r\nNote that this means the legend will
always use the extra large size\r\n(230px) even if the screen size is
small or the labels do not fill the\r\navailable legend
space.\r\n\r\nWith long labels:\r\n<img width=\"1369\"
alt=\"long\"\r\nsrc=\"https://github.com/elastic/kibana/assets/25592674/1f6f0d80-d924-48a4-b758-4cf72b99fc57\">\r\n\r\nWith
short labels:\r\n<img width=\"1369\"
alt=\"short\"\r\nsrc=\"https://github.com/elastic/kibana/assets/25592674/704f2b75-a565-44a0-be1a-e27bdca00a8e\">\r\n\r\nResolves
#162932.\r\n\r\n### Checklist\r\n\r\n- [ ] ~Any text added follows
[EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)~\r\n-
[
]\r\n~[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials~\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] ~Any UI
touched in this PR is usable by keyboard only (learn more\r\nabout
[keyboard\r\naccessibility](https://webaim.org/techniques/keyboard/))~\r\n-
[ ] ~Any UI touched in this PR does not create any new axe
failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))~\r\n-
[ ] ~If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~\r\n-
[ ] ~This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))~\r\n-
[ ] ~This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)~\r\n\r\n###
For maintainers\r\n\r\n- [ ] This was checked for breaking API changes
and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"79303c24f6ee395a3860947a691ff8da1df7c4d6"}}]}]
BACKPORT-->

Co-authored-by: Davis McPhee <[email protected]>
  • Loading branch information
kibanamachine and davismcphee authored Aug 3, 2023
1 parent ad47e5f commit b08ac76
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/plugins/unified_histogram/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
"id": "unifiedHistogram",
"server": false,
"browser": true,
"requiredBundles": ["data", "dataViews", "embeddable", "inspector", "expressions"]
"requiredBundles": [
"data",
"dataViews",
"embeddable",
"inspector",
"expressions",
"visualizations"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ describe('getLensAttributes', () => {
],
"legend": Object {
"isVisible": true,
"legendSize": "xlarge",
"position": "right",
"shouldTruncate": false,
},
"preferredSeriesType": "bar_stacked",
"showCurrentTimeMarker": true,
Expand Down Expand Up @@ -346,7 +348,9 @@ describe('getLensAttributes', () => {
],
"legend": Object {
"isVisible": true,
"legendSize": "xlarge",
"position": "right",
"shouldTruncate": false,
},
"preferredSeriesType": "bar_stacked",
"showCurrentTimeMarker": true,
Expand Down Expand Up @@ -502,7 +506,9 @@ describe('getLensAttributes', () => {
],
"legend": Object {
"isVisible": true,
"legendSize": "xlarge",
"position": "right",
"shouldTruncate": false,
},
"preferredSeriesType": "bar_stacked",
"showCurrentTimeMarker": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type {
TypedLensByValueInput,
Suggestion,
} from '@kbn/lens-plugin/public';
import { LegendSize } from '@kbn/visualizations-plugin/public';
import { fieldSupportsBreakdown } from './field_supports_breakdown';

export interface LensRequestData {
Expand Down Expand Up @@ -160,6 +161,8 @@ export const getLensAttributes = ({
legend: {
isVisible: true,
position: 'right',
legendSize: LegendSize.EXTRA_LARGE,
shouldTruncate: false,
},
preferredSeriesType: 'bar_stacked',
valueLabels: 'hide',
Expand Down
1 change: 1 addition & 0 deletions src/plugins/unified_histogram/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@kbn/shared-ux-utility",
"@kbn/ui-actions-plugin",
"@kbn/kibana-utils-plugin",
"@kbn/visualizations-plugin",
],
"exclude": [
"target/**/*",
Expand Down

0 comments on commit b08ac76

Please sign in to comment.