[Lens] Always show number sign when comparing to Primary metric#222824
[Lens] Always show number sign when comparing to Primary metric#222824dej611 merged 9 commits intoelastic:mainfrom
Conversation
|
|
||
| const formatted = numeralInst.set(val).format(this.param('pattern')); | ||
| let pattern = this.param('pattern'); | ||
| if (this.param('alwaysShowSign')) { |
There was a problem hiding this comment.
Having this set to false by default it should not impact existing configurations
| getParamDefaults = () => ({ | ||
| pattern: this.getConfig!(`format:${this.id}:defaultPattern`), | ||
| // While this should be always defined, it is not guaranteed in testing that the function is available | ||
| pattern: this.getConfig?.(`format:${this.id}:defaultPattern`), |
There was a problem hiding this comment.
Apparently a test was broken due to the force cast previously present who was throwing when this.param was looking for a missing parameter.
src/platform/plugins/shared/field_formats/common/converters/numeral.ts
Outdated
Show resolved
Hide resolved
|
Pinging @elastic/kibana-visualizations (Team:Visualizations) |
💚 Build Succeeded
Metrics [docs]Async chunks
Page load bundle
History
cc @dej611 |
markov00
left a comment
There was a problem hiding this comment.
Tested locally, works fine.
Thanks for removing the unused fontSize prop
|
Starting backport for target branches: 8.19 https://github.com/elastic/kibana/actions/runs/15556198328 |
…tic#222824) ## Summary Fixes elastic#221882 This is a possible take of the enhancement request in elastic#221882. In this scenario the chart automatically enters the `alwaysShowSign` mode when rendering the delta difference with the Primary Metric in the Secondary badge. Some notes: * The user has no control over it. * The behaviour is disabled automatically when moving into `Static value` mode, while it can be replicated using the `custom format` in the `Value format` control * The affected formats are `number`, `bytes`, `bits`, `percentage` in any possible configuration (i.e. also compact mode) * I've noticed that some formats change a bit when the sign is displayed (ie Currency goes from `$ xx.xxx` to `+ xx.xx $`) **Compare to Primary Metric** | Default | Number | Number (compact) | Custom Format (i.e. Currency) | Percentage | Bytes | Bits | | ---- | ---- | ---- | ---- | ---- | ---- | ---- | | <img width="819" alt="Screenshot 2025-06-05 at 14 41 09" src="https://github.com/user-attachments/assets/3e836e07-a5eb-479a-96af-463069cabc35" /> | <img width="473" alt="Screenshot 2025-06-05 at 15 40 37" src="https://github.com/user-attachments/assets/097548c5-4c68-4041-89a7-a46af228fd7a" /> | <img width="472" alt="Screenshot 2025-06-05 at 15 41 29" src="https://github.com/user-attachments/assets/52943f01-c302-4631-8c2c-55fc60d91d99" /> | <img width="480" alt="Screenshot 2025-06-05 at 15 42 33" src="https://github.com/user-attachments/assets/b2dbbaec-4c11-4e3f-80ac-20f810511bf7" /> | <img width="472" alt="Screenshot 2025-06-05 at 14 48 18" src="https://github.com/user-attachments/assets/13a1b102-30dd-46b4-b8f4-52ade1e9eadb" /> | <img width="478" alt="Screenshot 2025-06-05 at 15 44 11" src="https://github.com/user-attachments/assets/e9acbb69-6535-4ee2-962a-f1e5446b93dd" /> | <img width="477" alt="Screenshot 2025-06-05 at 14 47 54" src="https://github.com/user-attachments/assets/c6bb99af-5f08-4d0d-b302-e8fbe42a764b" /> | When using Static value: | Default | Number | Number (compact) | Custom format (i.e. Currency) | Percentage | Bytes | Bits | | ---- | --- | ---- | ---- | ---- | ---- | ---- | | <img width="471" alt="Screenshot 2025-06-05 at 14 56 17" src="https://github.com/user-attachments/assets/6135823f-b644-48aa-b236-076bcc0692ff" /> | <img width="473" alt="Screenshot 2025-06-05 at 15 49 51" src="https://github.com/user-attachments/assets/afe492ad-c908-45ee-b831-2108553c15ce" /> | <img width="477" alt="Screenshot 2025-06-05 at 15 46 24" src="https://github.com/user-attachments/assets/29eaccf5-0be8-46a6-9e87-3b6f99912e26" /> | <img width="472" alt="Screenshot 2025-06-05 at 15 52 27" src="https://github.com/user-attachments/assets/3867b435-a1e2-4cb3-9b4d-687a33f4ff78" /> | <img width="482" alt="Screenshot 2025-06-05 at 15 46 40" src="https://github.com/user-attachments/assets/0e1521b3-6ed3-45e4-a913-44e4f99f027a" /> | <img width="480" alt="Screenshot 2025-06-05 at 15 45 50" src="https://github.com/user-attachments/assets/0343fd8c-6d22-46bb-9676-f27cad4ca9ee" /> | <img width="473" alt="Screenshot 2025-06-05 at 15 46 05" src="https://github.com/user-attachments/assets/072e948d-71ce-48f0-862a-6932c5c510fa" /> | Extra bits: * I did notice that when rendering in Icon mode only and the secondary raw value is `null` an empty badge was rendered. Now it should not. * When running Jest tests a warning about a missing `act` wrapping was shown, which was due to the `jest.advanceTimers` call. Now it is properly wrapped * When testing with a time shift it is very likely to encounter into elastic#221886 and have all badges set to `NA`. In such case close the inline editor and hit `Refresh` again to see fresh values. ### Checklist - [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 (cherry picked from commit af3b804)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
#222824) (#223201) # Backport This will backport the following commits from `main` to `8.19`: - [[Lens] Always show number sign when comparing to Primary metric (#222824)](#222824) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Marco Liberati","email":"dej611@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-06-10T09:46:13Z","message":"[Lens] Always show number sign when comparing to Primary metric (#222824)\n\n## Summary\n\nFixes #221882 \n\nThis is a possible take of the enhancement request in #221882.\nIn this scenario the chart automatically enters the `alwaysShowSign`\nmode when rendering the delta difference with the Primary Metric in the\nSecondary badge.\n\nSome notes:\n* The user has no control over it.\n* The behaviour is disabled automatically when moving into `Static\nvalue` mode, while it can be replicated using the `custom format` in the\n`Value format` control\n* The affected formats are `number`, `bytes`, `bits`, `percentage` in\nany possible configuration (i.e. also compact mode)\n* I've noticed that some formats change a bit when the sign is displayed\n(ie Currency goes from `$ xx.xxx` to `+ xx.xx # Backport This will backport the following commits from `main` to `8.19`: {{{{raw}}}} - [[Lens] Always show number sign when comparing to Primary metric (#222824)](https://github.com/elastic/kibana/pull/222824){{{{/raw}}}} <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT )\n\n**Compare to Primary Metric**\n| Default | Number | Number (compact) | Custom Format (i.e. Currency) |\nPercentage | Bytes | Bits |\n| ---- | ---- | ---- | ---- | ---- | ---- | ---- |\n| <img width=\"819\" alt=\"Screenshot 2025-06-05 at 14 41 09\"\nsrc=\"https://github.com/user-attachments/assets/3e836e07-a5eb-479a-96af-463069cabc35\"\n/> | <img width=\"473\" alt=\"Screenshot 2025-06-05 at 15 40 37\"\nsrc=\"https://github.com/user-attachments/assets/097548c5-4c68-4041-89a7-a46af228fd7a\"\n/> | <img width=\"472\" alt=\"Screenshot 2025-06-05 at 15 41 29\"\nsrc=\"https://github.com/user-attachments/assets/52943f01-c302-4631-8c2c-55fc60d91d99\"\n/> | <img width=\"480\" alt=\"Screenshot 2025-06-05 at 15 42 33\"\nsrc=\"https://github.com/user-attachments/assets/b2dbbaec-4c11-4e3f-80ac-20f810511bf7\"\n/> | <img width=\"472\" alt=\"Screenshot 2025-06-05 at 14 48 18\"\nsrc=\"https://github.com/user-attachments/assets/13a1b102-30dd-46b4-b8f4-52ade1e9eadb\"\n/> | <img width=\"478\" alt=\"Screenshot 2025-06-05 at 15 44 11\"\nsrc=\"https://github.com/user-attachments/assets/e9acbb69-6535-4ee2-962a-f1e5446b93dd\"\n/> | <img width=\"477\" alt=\"Screenshot 2025-06-05 at 14 47 54\"\nsrc=\"https://github.com/user-attachments/assets/c6bb99af-5f08-4d0d-b302-e8fbe42a764b\"\n/> |\n\nWhen using Static value:\n\n| Default | Number | Number (compact) | Custom format (i.e. Currency) |\nPercentage | Bytes | Bits |\n| ---- | --- | ---- | ---- | ---- | ---- | ---- | \n| <img width=\"471\" alt=\"Screenshot 2025-06-05 at 14 56 17\"\nsrc=\"https://github.com/user-attachments/assets/6135823f-b644-48aa-b236-076bcc0692ff\"\n/> | <img width=\"473\" alt=\"Screenshot 2025-06-05 at 15 49 51\"\nsrc=\"https://github.com/user-attachments/assets/afe492ad-c908-45ee-b831-2108553c15ce\"\n/> | <img width=\"477\" alt=\"Screenshot 2025-06-05 at 15 46 24\"\nsrc=\"https://github.com/user-attachments/assets/29eaccf5-0be8-46a6-9e87-3b6f99912e26\"\n/> | <img width=\"472\" alt=\"Screenshot 2025-06-05 at 15 52 27\"\nsrc=\"https://github.com/user-attachments/assets/3867b435-a1e2-4cb3-9b4d-687a33f4ff78\"\n/> | <img width=\"482\" alt=\"Screenshot 2025-06-05 at 15 46 40\"\nsrc=\"https://github.com/user-attachments/assets/0e1521b3-6ed3-45e4-a913-44e4f99f027a\"\n/> | <img width=\"480\" alt=\"Screenshot 2025-06-05 at 15 45 50\"\nsrc=\"https://github.com/user-attachments/assets/0343fd8c-6d22-46bb-9676-f27cad4ca9ee\"\n/> | <img width=\"473\" alt=\"Screenshot 2025-06-05 at 15 46 05\"\nsrc=\"https://github.com/user-attachments/assets/072e948d-71ce-48f0-862a-6932c5c510fa\"\n/> |\n\nExtra bits:\n* I did notice that when rendering in Icon mode only and the secondary\nraw value is `null` an empty badge was rendered. Now it should not.\n* When running Jest tests a warning about a missing `act` wrapping was\nshown, which was due to the `jest.advanceTimers` call. Now it is\nproperly wrapped\n* When testing with a time shift it is very likely to encounter into\nhttps://github.com//issues/221886 and have all badges set\nto `NA`. In such case close the inline editor and hit `Refresh` again to\nsee fresh values.\n\n### Checklist\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios","sha":"af3b804ed331d7a5802fbc7e6ae78912ed603c06","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Visualizations","release_note:skip","Feature:Lens","backport:version","v9.1.0","v8.19.0"],"title":"[Lens] Always show number sign when comparing to Primary metric","number":222824,"url":"https://github.com/elastic/kibana/pull/222824","mergeCommit":{"message":"[Lens] Always show number sign when comparing to Primary metric (#222824)\n\n## Summary\n\nFixes #221882 \n\nThis is a possible take of the enhancement request in #221882.\nIn this scenario the chart automatically enters the `alwaysShowSign`\nmode when rendering the delta difference with the Primary Metric in the\nSecondary badge.\n\nSome notes:\n* The user has no control over it.\n* The behaviour is disabled automatically when moving into `Static\nvalue` mode, while it can be replicated using the `custom format` in the\n`Value format` control\n* The affected formats are `number`, `bytes`, `bits`, `percentage` in\nany possible configuration (i.e. also compact mode)\n* I've noticed that some formats change a bit when the sign is displayed\n(ie Currency goes from `$ xx.xxx` to `+ xx.xx # Backport This will backport the following commits from `main` to `8.19`: {{{{raw}}}} - [[Lens] Always show number sign when comparing to Primary metric (#222824)](https://github.com/elastic/kibana/pull/222824){{{{/raw}}}} <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT )\n\n**Compare to Primary Metric**\n| Default | Number | Number (compact) | Custom Format (i.e. Currency) |\nPercentage | Bytes | Bits |\n| ---- | ---- | ---- | ---- | ---- | ---- | ---- |\n| <img width=\"819\" alt=\"Screenshot 2025-06-05 at 14 41 09\"\nsrc=\"https://github.com/user-attachments/assets/3e836e07-a5eb-479a-96af-463069cabc35\"\n/> | <img width=\"473\" alt=\"Screenshot 2025-06-05 at 15 40 37\"\nsrc=\"https://github.com/user-attachments/assets/097548c5-4c68-4041-89a7-a46af228fd7a\"\n/> | <img width=\"472\" alt=\"Screenshot 2025-06-05 at 15 41 29\"\nsrc=\"https://github.com/user-attachments/assets/52943f01-c302-4631-8c2c-55fc60d91d99\"\n/> | <img width=\"480\" alt=\"Screenshot 2025-06-05 at 15 42 33\"\nsrc=\"https://github.com/user-attachments/assets/b2dbbaec-4c11-4e3f-80ac-20f810511bf7\"\n/> | <img width=\"472\" alt=\"Screenshot 2025-06-05 at 14 48 18\"\nsrc=\"https://github.com/user-attachments/assets/13a1b102-30dd-46b4-b8f4-52ade1e9eadb\"\n/> | <img width=\"478\" alt=\"Screenshot 2025-06-05 at 15 44 11\"\nsrc=\"https://github.com/user-attachments/assets/e9acbb69-6535-4ee2-962a-f1e5446b93dd\"\n/> | <img width=\"477\" alt=\"Screenshot 2025-06-05 at 14 47 54\"\nsrc=\"https://github.com/user-attachments/assets/c6bb99af-5f08-4d0d-b302-e8fbe42a764b\"\n/> |\n\nWhen using Static value:\n\n| Default | Number | Number (compact) | Custom format (i.e. Currency) |\nPercentage | Bytes | Bits |\n| ---- | --- | ---- | ---- | ---- | ---- | ---- | \n| <img width=\"471\" alt=\"Screenshot 2025-06-05 at 14 56 17\"\nsrc=\"https://github.com/user-attachments/assets/6135823f-b644-48aa-b236-076bcc0692ff\"\n/> | <img width=\"473\" alt=\"Screenshot 2025-06-05 at 15 49 51\"\nsrc=\"https://github.com/user-attachments/assets/afe492ad-c908-45ee-b831-2108553c15ce\"\n/> | <img width=\"477\" alt=\"Screenshot 2025-06-05 at 15 46 24\"\nsrc=\"https://github.com/user-attachments/assets/29eaccf5-0be8-46a6-9e87-3b6f99912e26\"\n/> | <img width=\"472\" alt=\"Screenshot 2025-06-05 at 15 52 27\"\nsrc=\"https://github.com/user-attachments/assets/3867b435-a1e2-4cb3-9b4d-687a33f4ff78\"\n/> | <img width=\"482\" alt=\"Screenshot 2025-06-05 at 15 46 40\"\nsrc=\"https://github.com/user-attachments/assets/0e1521b3-6ed3-45e4-a913-44e4f99f027a\"\n/> | <img width=\"480\" alt=\"Screenshot 2025-06-05 at 15 45 50\"\nsrc=\"https://github.com/user-attachments/assets/0343fd8c-6d22-46bb-9676-f27cad4ca9ee\"\n/> | <img width=\"473\" alt=\"Screenshot 2025-06-05 at 15 46 05\"\nsrc=\"https://github.com/user-attachments/assets/072e948d-71ce-48f0-862a-6932c5c510fa\"\n/> |\n\nExtra bits:\n* I did notice that when rendering in Icon mode only and the secondary\nraw value is `null` an empty badge was rendered. Now it should not.\n* When running Jest tests a warning about a missing `act` wrapping was\nshown, which was due to the `jest.advanceTimers` call. Now it is\nproperly wrapped\n* When testing with a time shift it is very likely to encounter into\nhttps://github.com//issues/221886 and have all badges set\nto `NA`. In such case close the inline editor and hit `Refresh` again to\nsee fresh values.\n\n### Checklist\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios","sha":"af3b804ed331d7a5802fbc7e6ae78912ed603c06"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/222824","number":222824,"mergeCommit":{"message":"[Lens] Always show number sign when comparing to Primary metric (#222824)\n\n## Summary\n\nFixes #221882 \n\nThis is a possible take of the enhancement request in #221882.\nIn this scenario the chart automatically enters the `alwaysShowSign`\nmode when rendering the delta difference with the Primary Metric in the\nSecondary badge.\n\nSome notes:\n* The user has no control over it.\n* The behaviour is disabled automatically when moving into `Static\nvalue` mode, while it can be replicated using the `custom format` in the\n`Value format` control\n* The affected formats are `number`, `bytes`, `bits`, `percentage` in\nany possible configuration (i.e. also compact mode)\n* I've noticed that some formats change a bit when the sign is displayed\n(ie Currency goes from `$ xx.xxx` to `+ xx.xx # Backport This will backport the following commits from `main` to `8.19`: {{{{raw}}}} - [[Lens] Always show number sign when comparing to Primary metric (#222824)](https://github.com/elastic/kibana/pull/222824){{{{/raw}}}} <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT )\n\n**Compare to Primary Metric**\n| Default | Number | Number (compact) | Custom Format (i.e. Currency) |\nPercentage | Bytes | Bits |\n| ---- | ---- | ---- | ---- | ---- | ---- | ---- |\n| <img width=\"819\" alt=\"Screenshot 2025-06-05 at 14 41 09\"\nsrc=\"https://github.com/user-attachments/assets/3e836e07-a5eb-479a-96af-463069cabc35\"\n/> | <img width=\"473\" alt=\"Screenshot 2025-06-05 at 15 40 37\"\nsrc=\"https://github.com/user-attachments/assets/097548c5-4c68-4041-89a7-a46af228fd7a\"\n/> | <img width=\"472\" alt=\"Screenshot 2025-06-05 at 15 41 29\"\nsrc=\"https://github.com/user-attachments/assets/52943f01-c302-4631-8c2c-55fc60d91d99\"\n/> | <img width=\"480\" alt=\"Screenshot 2025-06-05 at 15 42 33\"\nsrc=\"https://github.com/user-attachments/assets/b2dbbaec-4c11-4e3f-80ac-20f810511bf7\"\n/> | <img width=\"472\" alt=\"Screenshot 2025-06-05 at 14 48 18\"\nsrc=\"https://github.com/user-attachments/assets/13a1b102-30dd-46b4-b8f4-52ade1e9eadb\"\n/> | <img width=\"478\" alt=\"Screenshot 2025-06-05 at 15 44 11\"\nsrc=\"https://github.com/user-attachments/assets/e9acbb69-6535-4ee2-962a-f1e5446b93dd\"\n/> | <img width=\"477\" alt=\"Screenshot 2025-06-05 at 14 47 54\"\nsrc=\"https://github.com/user-attachments/assets/c6bb99af-5f08-4d0d-b302-e8fbe42a764b\"\n/> |\n\nWhen using Static value:\n\n| Default | Number | Number (compact) | Custom format (i.e. Currency) |\nPercentage | Bytes | Bits |\n| ---- | --- | ---- | ---- | ---- | ---- | ---- | \n| <img width=\"471\" alt=\"Screenshot 2025-06-05 at 14 56 17\"\nsrc=\"https://github.com/user-attachments/assets/6135823f-b644-48aa-b236-076bcc0692ff\"\n/> | <img width=\"473\" alt=\"Screenshot 2025-06-05 at 15 49 51\"\nsrc=\"https://github.com/user-attachments/assets/afe492ad-c908-45ee-b831-2108553c15ce\"\n/> | <img width=\"477\" alt=\"Screenshot 2025-06-05 at 15 46 24\"\nsrc=\"https://github.com/user-attachments/assets/29eaccf5-0be8-46a6-9e87-3b6f99912e26\"\n/> | <img width=\"472\" alt=\"Screenshot 2025-06-05 at 15 52 27\"\nsrc=\"https://github.com/user-attachments/assets/3867b435-a1e2-4cb3-9b4d-687a33f4ff78\"\n/> | <img width=\"482\" alt=\"Screenshot 2025-06-05 at 15 46 40\"\nsrc=\"https://github.com/user-attachments/assets/0e1521b3-6ed3-45e4-a913-44e4f99f027a\"\n/> | <img width=\"480\" alt=\"Screenshot 2025-06-05 at 15 45 50\"\nsrc=\"https://github.com/user-attachments/assets/0343fd8c-6d22-46bb-9676-f27cad4ca9ee\"\n/> | <img width=\"473\" alt=\"Screenshot 2025-06-05 at 15 46 05\"\nsrc=\"https://github.com/user-attachments/assets/072e948d-71ce-48f0-862a-6932c5c510fa\"\n/> |\n\nExtra bits:\n* I did notice that when rendering in Icon mode only and the secondary\nraw value is `null` an empty badge was rendered. Now it should not.\n* When running Jest tests a warning about a missing `act` wrapping was\nshown, which was due to the `jest.advanceTimers` call. Now it is\nproperly wrapped\n* When testing with a time shift it is very likely to encounter into\nhttps://github.com//issues/221886 and have all badges set\nto `NA`. In such case close the inline editor and hit `Refresh` again to\nsee fresh values.\n\n### Checklist\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios","sha":"af3b804ed331d7a5802fbc7e6ae78912ed603c06"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
…tic#222824) ## Summary Fixes elastic#221882 This is a possible take of the enhancement request in elastic#221882. In this scenario the chart automatically enters the `alwaysShowSign` mode when rendering the delta difference with the Primary Metric in the Secondary badge. Some notes: * The user has no control over it. * The behaviour is disabled automatically when moving into `Static value` mode, while it can be replicated using the `custom format` in the `Value format` control * The affected formats are `number`, `bytes`, `bits`, `percentage` in any possible configuration (i.e. also compact mode) * I've noticed that some formats change a bit when the sign is displayed (ie Currency goes from `$ xx.xxx` to `+ xx.xx $`) **Compare to Primary Metric** | Default | Number | Number (compact) | Custom Format (i.e. Currency) | Percentage | Bytes | Bits | | ---- | ---- | ---- | ---- | ---- | ---- | ---- | | <img width="819" alt="Screenshot 2025-06-05 at 14 41 09" src="https://github.com/user-attachments/assets/3e836e07-a5eb-479a-96af-463069cabc35" /> | <img width="473" alt="Screenshot 2025-06-05 at 15 40 37" src="https://github.com/user-attachments/assets/097548c5-4c68-4041-89a7-a46af228fd7a" /> | <img width="472" alt="Screenshot 2025-06-05 at 15 41 29" src="https://github.com/user-attachments/assets/52943f01-c302-4631-8c2c-55fc60d91d99" /> | <img width="480" alt="Screenshot 2025-06-05 at 15 42 33" src="https://github.com/user-attachments/assets/b2dbbaec-4c11-4e3f-80ac-20f810511bf7" /> | <img width="472" alt="Screenshot 2025-06-05 at 14 48 18" src="https://github.com/user-attachments/assets/13a1b102-30dd-46b4-b8f4-52ade1e9eadb" /> | <img width="478" alt="Screenshot 2025-06-05 at 15 44 11" src="https://github.com/user-attachments/assets/e9acbb69-6535-4ee2-962a-f1e5446b93dd" /> | <img width="477" alt="Screenshot 2025-06-05 at 14 47 54" src="https://github.com/user-attachments/assets/c6bb99af-5f08-4d0d-b302-e8fbe42a764b" /> | When using Static value: | Default | Number | Number (compact) | Custom format (i.e. Currency) | Percentage | Bytes | Bits | | ---- | --- | ---- | ---- | ---- | ---- | ---- | | <img width="471" alt="Screenshot 2025-06-05 at 14 56 17" src="https://github.com/user-attachments/assets/6135823f-b644-48aa-b236-076bcc0692ff" /> | <img width="473" alt="Screenshot 2025-06-05 at 15 49 51" src="https://github.com/user-attachments/assets/afe492ad-c908-45ee-b831-2108553c15ce" /> | <img width="477" alt="Screenshot 2025-06-05 at 15 46 24" src="https://github.com/user-attachments/assets/29eaccf5-0be8-46a6-9e87-3b6f99912e26" /> | <img width="472" alt="Screenshot 2025-06-05 at 15 52 27" src="https://github.com/user-attachments/assets/3867b435-a1e2-4cb3-9b4d-687a33f4ff78" /> | <img width="482" alt="Screenshot 2025-06-05 at 15 46 40" src="https://github.com/user-attachments/assets/0e1521b3-6ed3-45e4-a913-44e4f99f027a" /> | <img width="480" alt="Screenshot 2025-06-05 at 15 45 50" src="https://github.com/user-attachments/assets/0343fd8c-6d22-46bb-9676-f27cad4ca9ee" /> | <img width="473" alt="Screenshot 2025-06-05 at 15 46 05" src="https://github.com/user-attachments/assets/072e948d-71ce-48f0-862a-6932c5c510fa" /> | Extra bits: * I did notice that when rendering in Icon mode only and the secondary raw value is `null` an empty badge was rendered. Now it should not. * When running Jest tests a warning about a missing `act` wrapping was shown, which was due to the `jest.advanceTimers` call. Now it is properly wrapped * When testing with a time shift it is very likely to encounter into elastic#221886 and have all badges set to `NA`. In such case close the inline editor and hit `Refresh` again to see fresh values. ### Checklist - [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
…tic#222824) ## Summary Fixes elastic#221882 This is a possible take of the enhancement request in elastic#221882. In this scenario the chart automatically enters the `alwaysShowSign` mode when rendering the delta difference with the Primary Metric in the Secondary badge. Some notes: * The user has no control over it. * The behaviour is disabled automatically when moving into `Static value` mode, while it can be replicated using the `custom format` in the `Value format` control * The affected formats are `number`, `bytes`, `bits`, `percentage` in any possible configuration (i.e. also compact mode) * I've noticed that some formats change a bit when the sign is displayed (ie Currency goes from `$ xx.xxx` to `+ xx.xx $`) **Compare to Primary Metric** | Default | Number | Number (compact) | Custom Format (i.e. Currency) | Percentage | Bytes | Bits | | ---- | ---- | ---- | ---- | ---- | ---- | ---- | | <img width="819" alt="Screenshot 2025-06-05 at 14 41 09" src="https://github.com/user-attachments/assets/3e836e07-a5eb-479a-96af-463069cabc35" /> | <img width="473" alt="Screenshot 2025-06-05 at 15 40 37" src="https://github.com/user-attachments/assets/097548c5-4c68-4041-89a7-a46af228fd7a" /> | <img width="472" alt="Screenshot 2025-06-05 at 15 41 29" src="https://github.com/user-attachments/assets/52943f01-c302-4631-8c2c-55fc60d91d99" /> | <img width="480" alt="Screenshot 2025-06-05 at 15 42 33" src="https://github.com/user-attachments/assets/b2dbbaec-4c11-4e3f-80ac-20f810511bf7" /> | <img width="472" alt="Screenshot 2025-06-05 at 14 48 18" src="https://github.com/user-attachments/assets/13a1b102-30dd-46b4-b8f4-52ade1e9eadb" /> | <img width="478" alt="Screenshot 2025-06-05 at 15 44 11" src="https://github.com/user-attachments/assets/e9acbb69-6535-4ee2-962a-f1e5446b93dd" /> | <img width="477" alt="Screenshot 2025-06-05 at 14 47 54" src="https://github.com/user-attachments/assets/c6bb99af-5f08-4d0d-b302-e8fbe42a764b" /> | When using Static value: | Default | Number | Number (compact) | Custom format (i.e. Currency) | Percentage | Bytes | Bits | | ---- | --- | ---- | ---- | ---- | ---- | ---- | | <img width="471" alt="Screenshot 2025-06-05 at 14 56 17" src="https://github.com/user-attachments/assets/6135823f-b644-48aa-b236-076bcc0692ff" /> | <img width="473" alt="Screenshot 2025-06-05 at 15 49 51" src="https://github.com/user-attachments/assets/afe492ad-c908-45ee-b831-2108553c15ce" /> | <img width="477" alt="Screenshot 2025-06-05 at 15 46 24" src="https://github.com/user-attachments/assets/29eaccf5-0be8-46a6-9e87-3b6f99912e26" /> | <img width="472" alt="Screenshot 2025-06-05 at 15 52 27" src="https://github.com/user-attachments/assets/3867b435-a1e2-4cb3-9b4d-687a33f4ff78" /> | <img width="482" alt="Screenshot 2025-06-05 at 15 46 40" src="https://github.com/user-attachments/assets/0e1521b3-6ed3-45e4-a913-44e4f99f027a" /> | <img width="480" alt="Screenshot 2025-06-05 at 15 45 50" src="https://github.com/user-attachments/assets/0343fd8c-6d22-46bb-9676-f27cad4ca9ee" /> | <img width="473" alt="Screenshot 2025-06-05 at 15 46 05" src="https://github.com/user-attachments/assets/072e948d-71ce-48f0-862a-6932c5c510fa" /> | Extra bits: * I did notice that when rendering in Icon mode only and the secondary raw value is `null` an empty badge was rendered. Now it should not. * When running Jest tests a warning about a missing `act` wrapping was shown, which was due to the `jest.advanceTimers` call. Now it is properly wrapped * When testing with a time shift it is very likely to encounter into elastic#221886 and have all badges set to `NA`. In such case close the inline editor and hit `Refresh` again to see fresh values. ### Checklist - [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
…tic#222824) ## Summary Fixes elastic#221882 This is a possible take of the enhancement request in elastic#221882. In this scenario the chart automatically enters the `alwaysShowSign` mode when rendering the delta difference with the Primary Metric in the Secondary badge. Some notes: * The user has no control over it. * The behaviour is disabled automatically when moving into `Static value` mode, while it can be replicated using the `custom format` in the `Value format` control * The affected formats are `number`, `bytes`, `bits`, `percentage` in any possible configuration (i.e. also compact mode) * I've noticed that some formats change a bit when the sign is displayed (ie Currency goes from `$ xx.xxx` to `+ xx.xx $`) **Compare to Primary Metric** | Default | Number | Number (compact) | Custom Format (i.e. Currency) | Percentage | Bytes | Bits | | ---- | ---- | ---- | ---- | ---- | ---- | ---- | | <img width="819" alt="Screenshot 2025-06-05 at 14 41 09" src="https://github.com/user-attachments/assets/3e836e07-a5eb-479a-96af-463069cabc35" /> | <img width="473" alt="Screenshot 2025-06-05 at 15 40 37" src="https://github.com/user-attachments/assets/097548c5-4c68-4041-89a7-a46af228fd7a" /> | <img width="472" alt="Screenshot 2025-06-05 at 15 41 29" src="https://github.com/user-attachments/assets/52943f01-c302-4631-8c2c-55fc60d91d99" /> | <img width="480" alt="Screenshot 2025-06-05 at 15 42 33" src="https://github.com/user-attachments/assets/b2dbbaec-4c11-4e3f-80ac-20f810511bf7" /> | <img width="472" alt="Screenshot 2025-06-05 at 14 48 18" src="https://github.com/user-attachments/assets/13a1b102-30dd-46b4-b8f4-52ade1e9eadb" /> | <img width="478" alt="Screenshot 2025-06-05 at 15 44 11" src="https://github.com/user-attachments/assets/e9acbb69-6535-4ee2-962a-f1e5446b93dd" /> | <img width="477" alt="Screenshot 2025-06-05 at 14 47 54" src="https://github.com/user-attachments/assets/c6bb99af-5f08-4d0d-b302-e8fbe42a764b" /> | When using Static value: | Default | Number | Number (compact) | Custom format (i.e. Currency) | Percentage | Bytes | Bits | | ---- | --- | ---- | ---- | ---- | ---- | ---- | | <img width="471" alt="Screenshot 2025-06-05 at 14 56 17" src="https://github.com/user-attachments/assets/6135823f-b644-48aa-b236-076bcc0692ff" /> | <img width="473" alt="Screenshot 2025-06-05 at 15 49 51" src="https://github.com/user-attachments/assets/afe492ad-c908-45ee-b831-2108553c15ce" /> | <img width="477" alt="Screenshot 2025-06-05 at 15 46 24" src="https://github.com/user-attachments/assets/29eaccf5-0be8-46a6-9e87-3b6f99912e26" /> | <img width="472" alt="Screenshot 2025-06-05 at 15 52 27" src="https://github.com/user-attachments/assets/3867b435-a1e2-4cb3-9b4d-687a33f4ff78" /> | <img width="482" alt="Screenshot 2025-06-05 at 15 46 40" src="https://github.com/user-attachments/assets/0e1521b3-6ed3-45e4-a913-44e4f99f027a" /> | <img width="480" alt="Screenshot 2025-06-05 at 15 45 50" src="https://github.com/user-attachments/assets/0343fd8c-6d22-46bb-9676-f27cad4ca9ee" /> | <img width="473" alt="Screenshot 2025-06-05 at 15 46 05" src="https://github.com/user-attachments/assets/072e948d-71ce-48f0-862a-6932c5c510fa" /> | Extra bits: * I did notice that when rendering in Icon mode only and the secondary raw value is `null` an empty badge was rendered. Now it should not. * When running Jest tests a warning about a missing `act` wrapping was shown, which was due to the `jest.advanceTimers` call. Now it is properly wrapped * When testing with a time shift it is very likely to encounter into elastic#221886 and have all badges set to `NA`. In such case close the inline editor and hit `Refresh` again to see fresh values. ### Checklist - [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
Summary
Fixes #221882
This is a possible take of the enhancement request in #221882.
In this scenario the chart automatically enters the
alwaysShowSignmode when rendering the delta difference with the Primary Metric in the Secondary badge.Some notes:
Static valuemode, while it can be replicated using thecustom formatin theValue formatcontrolnumber,bytes,bits,percentagein any possible configuration (i.e. also compact mode)$ xx.xxxto+ xx.xx $)Compare to Primary Metric
When using Static value:
Extra bits:
nullan empty badge was rendered. Now it should not.actwrapping was shown, which was due to thejest.advanceTimerscall. Now it is properly wrappedNA. In such case close the inline editor and hitRefreshagain to see fresh values.Checklist