Skip to content

[Lens] "Compare to" badge for Metric chart#214811

Merged
dej611 merged 82 commits intoelastic:mainfrom
dej611:feat/metric-trend-arrow
May 7, 2025
Merged

[Lens] "Compare to" badge for Metric chart#214811
dej611 merged 82 commits intoelastic:mainfrom
dej611:feat/metric-trend-arrow

Conversation

@dej611
Copy link
Contributor

@dej611 dej611 commented Mar 17, 2025

Summary

Fixes #184907

This PR introduces the Trend badge feature into the Secondary Metric chart type.
Screenshot 2025-04-30 at 13 04 36
Screenshot 2025-04-30 at 13 04 03
Screenshot 2025-04-30 at 13 03 21
Screenshot 2025-04-30 at 13 05 34

Here's a short list of tasks handled by this PR:

  • New Color by value option: None | Static | Dynamic
    • Default None option is the default (legacy preserved)
    • Static option enables the badge with the picked color
      • this is also enforced when the Primary metric is not number based (or when primary transition from number to text)
    • Dynamic option enables both the badge coloring and the icon
      • When disabled a tooltip with the explanation of the issue appears
      • Trend palette is enabled by default on enable
        • Added other 3 extra palettes (Reversed, Temperature, Complementary)
          • Each palette has been implemented using both EUI tokens AND Vis tokens
            • Revisited this decision ♻️
          • Remove redundant palettes
            • keep only Vis palettes & hardcode green value for now.
            • Once EUI exposes the green token integrate in a follow up.
            • Use the @kbn/palettes service with the new compare_to palette with hardcoded values
        • Exposes display options: Icon | Value | Both
          • Both is the default
          • Icon or Both will show up 3 possible icon options: arrow up, arrow down and equal sign from unicode
          • Exposes Trend options: Static value | Primary metric
            • Static value will show up a new Baseline control (debounced)
            • Primary metric is enabled only for numeric primary values
              • When disabled a tooltip shows up explaining the issue
              • Added description text to explain difference with the other compare mode
              • Show only delta value when in Primary
  • Migrated existing metric_vis tests from Enzyme to RTL
  • New tests for the new Secondary metric component in RTL
  • Added new smoketest + panel mode caching testing for the metric feature in FTR

Few aspects of this feature have been discussed and deferred to a follow up issue: #217992

Checklist

@dej611 dej611 added Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// Feature:Lens backport:skip This PR does not require backporting release_note:feature Makes this part of the condensed release notes blocked labels Mar 17, 2025
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label May 9, 2025
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 214811 locally
cc: @dej611

6 similar comments
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 214811 locally
cc: @dej611

@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 214811 locally
cc: @dej611

@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 214811 locally
cc: @dej611

@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 214811 locally
cc: @dej611

@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 214811 locally
cc: @dej611

@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 214811 locally
cc: @dej611

@dej611 dej611 removed the v8.19.0 label May 20, 2025
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 214811 locally
cc: @dej611

4 similar comments
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 214811 locally
cc: @dej611

@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 214811 locally
cc: @dej611

@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 214811 locally
cc: @dej611

@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 214811 locally
cc: @dej611

nickofthyme pushed a commit to nickofthyme/kibana that referenced this pull request May 27, 2025
## Summary

Fixes elastic#184907

This PR introduces the Trend badge feature into the Secondary Metric
chart type.
<img width="1318" alt="Screenshot 2025-04-30 at 13 04 36"
src="https://github.com/user-attachments/assets/6b3c599e-304f-4bc0-8ff2-094ed54ea248"
/>
<img width="1503" alt="Screenshot 2025-04-30 at 13 04 03"
src="https://github.com/user-attachments/assets/cb203156-a7a8-4f61-bf30-57f7d1484fed"
/>
<img width="1339" alt="Screenshot 2025-04-30 at 13 03 21"
src="https://github.com/user-attachments/assets/8896af7f-9193-41b5-a4b5-970907b084c5"
/>
<img width="1319" alt="Screenshot 2025-04-30 at 13 05 34"
src="https://github.com/user-attachments/assets/12aa556e-8743-4167-9902-14fa9ef2e85d"
/>

Here's a short list of tasks handled by this PR:

* [x] New Color by value option: `None` | `Static` | `Dynamic`
  * Default `None` option is the default (legacy preserved)
  * [x] `Static` option enables the badge with the picked color
* [x] this is also enforced when the Primary metric is not number based
(or when primary transition from number to text)
  * [x] `Dynamic` option enables both the badge coloring and the icon
* [x] When disabled a tooltip with the explanation of the issue appears
    * [x] Trend palette is enabled by default on enable
* [x] Added other 3 extra palettes (`Reversed`, `Temperature`,
`Complementary`)
* [x] Each palette has been implemented using both EUI tokens AND Vis
tokens
          * [x] Revisited this decision ♻️
        * [x] Remove redundant palettes
          * ~~keep only Vis palettes & hardcode `green` value for now.~~
* ~~Once EUI exposes the green token integrate in a follow up.~~
* Use the `@kbn/palettes` service with the new `compare_to` palette with
hardcoded values
      * [x] Exposes display options: `Icon` | `Value` | `Both`
        * [x] `Both` is the default
* [x] `Icon` or `Both` will show up 3 possible icon options: arrow up,
arrow down and equal sign from unicode
          * [x]  Make sure both text and icon respect breakpoint sizes
* [x] Remove hack for breakpoints ( Lens Embeddable + Secondary metric)
once new Charts upgrade is merged:
elastic/elastic-charts#2627
* [x] Remove `theme` and contrast color computation once the Elastic
Charts PR above is merged
          * [x] Make sure badge is always accessible
        * [x] Exposes Trend options: `Static value` | `Primary metric`
* [x] `Static value` will show up a new `Baseline` control (debounced)
* [x] `Primary metric` is enabled only for numeric primary values
            * [x]  When disabled a tooltip shows up explaining the issue
* [x] Added description text to explain difference with the other
compare mode
            * [x] Show only delta value when in Primary
 * [x] Migrated existing `metric_vis` tests from Enzyme to RTL
 * [x] New tests for the new Secondary metric component in RTL
* [x] Added new smoketest + panel mode caching testing for the metric
feature in FTR

Few aspects of this feature have been discussed and deferred to a follow
up issue: elastic#217992

### 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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Nick Partridge <nick.ryan.partridge@gmail.com>
(cherry picked from commit 78e7435)

# Conflicts:
#	src/platform/plugins/shared/chart_expressions/expression_metric/public/components/metric_vis.test.tsx
#	x-pack/platform/plugins/shared/lens/public/visualizations/metric/dimension_editor.test.tsx
#	x-pack/platform/plugins/shared/lens/public/visualizations/metric/visualization.tsx
@nickofthyme
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.19

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

@kibanamachine
Copy link
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.
cc: @dej611

akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request May 29, 2025
## Summary

Fixes elastic#184907

This PR introduces the Trend badge feature into the Secondary Metric
chart type.
<img width="1318" alt="Screenshot 2025-04-30 at 13 04 36"
src="https://github.com/user-attachments/assets/6b3c599e-304f-4bc0-8ff2-094ed54ea248"
/>
<img width="1503" alt="Screenshot 2025-04-30 at 13 04 03"
src="https://github.com/user-attachments/assets/cb203156-a7a8-4f61-bf30-57f7d1484fed"
/>
<img width="1339" alt="Screenshot 2025-04-30 at 13 03 21"
src="https://github.com/user-attachments/assets/8896af7f-9193-41b5-a4b5-970907b084c5"
/>
<img width="1319" alt="Screenshot 2025-04-30 at 13 05 34"
src="https://github.com/user-attachments/assets/12aa556e-8743-4167-9902-14fa9ef2e85d"
/>


Here's a short list of tasks handled by this PR:

* [x] New Color by value option: `None` | `Static` | `Dynamic`
  * Default `None` option is the default (legacy preserved)
  * [x] `Static` option enables the badge with the picked color
* [x] this is also enforced when the Primary metric is not number based
(or when primary transition from number to text)
  * [x] `Dynamic` option enables both the badge coloring and the icon
* [x] When disabled a tooltip with the explanation of the issue appears
    * [x] Trend palette is enabled by default on enable
* [x] Added other 3 extra palettes (`Reversed`, `Temperature`,
`Complementary`)
* [x] Each palette has been implemented using both EUI tokens AND Vis
tokens
          * [x] Revisited this decision ♻️ 
        * [x] Remove redundant palettes
          * ~~keep only Vis palettes & hardcode `green` value for now.~~
* ~~Once EUI exposes the green token integrate in a follow up.~~
* Use the `@kbn/palettes` service with the new `compare_to` palette with
hardcoded values
      * [x] Exposes display options: `Icon` | `Value` | `Both`
        * [x] `Both` is the default
* [x] `Icon` or `Both` will show up 3 possible icon options: arrow up,
arrow down and equal sign from unicode
          * [x]  Make sure both text and icon respect breakpoint sizes
* [x] Remove hack for breakpoints ( Lens Embeddable + Secondary metric)
once new Charts upgrade is merged:
elastic/elastic-charts#2627
* [x] Remove `theme` and contrast color computation once the Elastic
Charts PR above is merged
          * [x] Make sure badge is always accessible
        * [x] Exposes Trend options: `Static value` | `Primary metric` 
* [x] `Static value` will show up a new `Baseline` control (debounced)
* [x] `Primary metric` is enabled only for numeric primary values
            * [x]  When disabled a tooltip shows up explaining the issue
* [x] Added description text to explain difference with the other
compare mode
            * [x] Show only delta value when in Primary 
 * [x] Migrated existing `metric_vis` tests from Enzyme to RTL
 * [x] New tests for the new Secondary metric component in RTL
* [x] Added new smoketest + panel mode caching testing for the metric
feature in FTR


Few aspects of this feature have been discussed and deferred to a follow
up issue: elastic#217992

### 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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Nick Partridge <nick.ryan.partridge@gmail.com>
@kibanamachine
Copy link
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.
cc: @dej611

1 similar comment
@kibanamachine
Copy link
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.
cc: @dej611

nickofthyme added a commit to nickofthyme/kibana that referenced this pull request Jun 2, 2025
Fixes elastic#184907

This PR introduces the Trend badge feature into the Secondary Metric
chart type.
<img width="1318" alt="Screenshot 2025-04-30 at 13 04 36"
src="https://github.com/user-attachments/assets/6b3c599e-304f-4bc0-8ff2-094ed54ea248"
/>
<img width="1503" alt="Screenshot 2025-04-30 at 13 04 03"
src="https://github.com/user-attachments/assets/cb203156-a7a8-4f61-bf30-57f7d1484fed"
/>
<img width="1339" alt="Screenshot 2025-04-30 at 13 03 21"
src="https://github.com/user-attachments/assets/8896af7f-9193-41b5-a4b5-970907b084c5"
/>
<img width="1319" alt="Screenshot 2025-04-30 at 13 05 34"
src="https://github.com/user-attachments/assets/12aa556e-8743-4167-9902-14fa9ef2e85d"
/>

Here's a short list of tasks handled by this PR:

* [x] New Color by value option: `None` | `Static` | `Dynamic`
  * Default `None` option is the default (legacy preserved)
  * [x] `Static` option enables the badge with the picked color
* [x] this is also enforced when the Primary metric is not number based
(or when primary transition from number to text)
  * [x] `Dynamic` option enables both the badge coloring and the icon
* [x] When disabled a tooltip with the explanation of the issue appears
    * [x] Trend palette is enabled by default on enable
* [x] Added other 3 extra palettes (`Reversed`, `Temperature`,
`Complementary`)
* [x] Each palette has been implemented using both EUI tokens AND Vis
tokens
          * [x] Revisited this decision ♻️
        * [x] Remove redundant palettes
          * ~~keep only Vis palettes & hardcode `green` value for now.~~
* ~~Once EUI exposes the green token integrate in a follow up.~~
* Use the `@kbn/palettes` service with the new `compare_to` palette with
hardcoded values
      * [x] Exposes display options: `Icon` | `Value` | `Both`
        * [x] `Both` is the default
* [x] `Icon` or `Both` will show up 3 possible icon options: arrow up,
arrow down and equal sign from unicode
          * [x]  Make sure both text and icon respect breakpoint sizes
* [x] Remove hack for breakpoints ( Lens Embeddable + Secondary metric)
once new Charts upgrade is merged:
elastic/elastic-charts#2627
* [x] Remove `theme` and contrast color computation once the Elastic
Charts PR above is merged
          * [x] Make sure badge is always accessible
        * [x] Exposes Trend options: `Static value` | `Primary metric`
* [x] `Static value` will show up a new `Baseline` control (debounced)
* [x] `Primary metric` is enabled only for numeric primary values
            * [x]  When disabled a tooltip shows up explaining the issue
* [x] Added description text to explain difference with the other
compare mode
            * [x] Show only delta value when in Primary
 * [x] Migrated existing `metric_vis` tests from Enzyme to RTL
 * [x] New tests for the new Secondary metric component in RTL
* [x] Added new smoketest + panel mode caching testing for the metric
feature in FTR

Few aspects of this feature have been discussed and deferred to a follow
up issue: elastic#217992

- [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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Nick Partridge <nick.ryan.partridge@gmail.com>
@kibanamachine
Copy link
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.
cc: @dej611

qn895 pushed a commit to qn895/kibana that referenced this pull request Jun 3, 2025
## Summary

Fixes elastic#184907

This PR introduces the Trend badge feature into the Secondary Metric
chart type.
<img width="1318" alt="Screenshot 2025-04-30 at 13 04 36"
src="https://github.com/user-attachments/assets/6b3c599e-304f-4bc0-8ff2-094ed54ea248"
/>
<img width="1503" alt="Screenshot 2025-04-30 at 13 04 03"
src="https://github.com/user-attachments/assets/cb203156-a7a8-4f61-bf30-57f7d1484fed"
/>
<img width="1339" alt="Screenshot 2025-04-30 at 13 03 21"
src="https://github.com/user-attachments/assets/8896af7f-9193-41b5-a4b5-970907b084c5"
/>
<img width="1319" alt="Screenshot 2025-04-30 at 13 05 34"
src="https://github.com/user-attachments/assets/12aa556e-8743-4167-9902-14fa9ef2e85d"
/>


Here's a short list of tasks handled by this PR:

* [x] New Color by value option: `None` | `Static` | `Dynamic`
  * Default `None` option is the default (legacy preserved)
  * [x] `Static` option enables the badge with the picked color
* [x] this is also enforced when the Primary metric is not number based
(or when primary transition from number to text)
  * [x] `Dynamic` option enables both the badge coloring and the icon
* [x] When disabled a tooltip with the explanation of the issue appears
    * [x] Trend palette is enabled by default on enable
* [x] Added other 3 extra palettes (`Reversed`, `Temperature`,
`Complementary`)
* [x] Each palette has been implemented using both EUI tokens AND Vis
tokens
          * [x] Revisited this decision ♻️ 
        * [x] Remove redundant palettes
          * ~~keep only Vis palettes & hardcode `green` value for now.~~
* ~~Once EUI exposes the green token integrate in a follow up.~~
* Use the `@kbn/palettes` service with the new `compare_to` palette with
hardcoded values
      * [x] Exposes display options: `Icon` | `Value` | `Both`
        * [x] `Both` is the default
* [x] `Icon` or `Both` will show up 3 possible icon options: arrow up,
arrow down and equal sign from unicode
          * [x]  Make sure both text and icon respect breakpoint sizes
* [x] Remove hack for breakpoints ( Lens Embeddable + Secondary metric)
once new Charts upgrade is merged:
elastic/elastic-charts#2627
* [x] Remove `theme` and contrast color computation once the Elastic
Charts PR above is merged
          * [x] Make sure badge is always accessible
        * [x] Exposes Trend options: `Static value` | `Primary metric` 
* [x] `Static value` will show up a new `Baseline` control (debounced)
* [x] `Primary metric` is enabled only for numeric primary values
            * [x]  When disabled a tooltip shows up explaining the issue
* [x] Added description text to explain difference with the other
compare mode
            * [x] Show only delta value when in Primary 
 * [x] Migrated existing `metric_vis` tests from Enzyme to RTL
 * [x] New tests for the new Secondary metric component in RTL
* [x] Added new smoketest + panel mode caching testing for the metric
feature in FTR


Few aspects of this feature have been discussed and deferred to a follow
up issue: elastic#217992

### 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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Nick Partridge <nick.ryan.partridge@gmail.com>
nickofthyme added a commit that referenced this pull request Jun 3, 2025
# Backport

This will backport the following commits from `main` to `8.19`:
- [[Lens] "Compare to" badge for Metric chart
(#214811)](#214811)

<!--- 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-05-07T12:44:27Z","message":"[Lens]
\"Compare to\" badge for Metric chart (#214811)\n\n## Summary\n\nFixes
#184907\n\nThis PR introduces the Trend badge feature into the Secondary
Metric\nchart type.\n<img width=\"1318\" alt=\"Screenshot 2025-04-30 at
13 04
36\"\nsrc=\"https://github.com/user-attachments/assets/6b3c599e-304f-4bc0-8ff2-094ed54ea248\"\n/>\n<img
width=\"1503\" alt=\"Screenshot 2025-04-30 at 13 04
03\"\nsrc=\"https://github.com/user-attachments/assets/cb203156-a7a8-4f61-bf30-57f7d1484fed\"\n/>\n<img
width=\"1339\" alt=\"Screenshot 2025-04-30 at 13 03
21\"\nsrc=\"https://github.com/user-attachments/assets/8896af7f-9193-41b5-a4b5-970907b084c5\"\n/>\n<img
width=\"1319\" alt=\"Screenshot 2025-04-30 at 13 05
34\"\nsrc=\"https://github.com/user-attachments/assets/12aa556e-8743-4167-9902-14fa9ef2e85d\"\n/>\n\n\nHere's
a short list of tasks handled by this PR:\n\n* [x] New Color by value
option: `None` | `Static` | `Dynamic`\n * Default `None` option is the
default (legacy preserved)\n * [x] `Static` option enables the badge
with the picked color\n* [x] this is also enforced when the Primary
metric is not number based\n(or when primary transition from number to
text)\n * [x] `Dynamic` option enables both the badge coloring and the
icon\n* [x] When disabled a tooltip with the explanation of the issue
appears\n * [x] Trend palette is enabled by default on enable\n* [x]
Added other 3 extra palettes (`Reversed`,
`Temperature`,\n`Complementary`)\n* [x] Each palette has been
implemented using both EUI tokens AND Vis\ntokens\n * [x] Revisited this
decision ♻️ \n * [x] Remove redundant palettes\n * ~~keep only Vis
palettes & hardcode `green` value for now.~~\n* ~~Once EUI exposes the
green token integrate in a follow up.~~\n* Use the `@kbn/palettes`
service with the new `compare_to` palette with\nhardcoded values\n * [x]
Exposes display options: `Icon` | `Value` | `Both`\n * [x] `Both` is the
default\n* [x] `Icon` or `Both` will show up 3 possible icon options:
arrow up,\narrow down and equal sign from unicode\n * [x] Make sure both
text and icon respect breakpoint sizes\n* [x] Remove hack for
breakpoints ( Lens Embeddable + Secondary metric)\nonce new Charts
upgrade is
merged:\nhttps://github.com/elastic/elastic-charts/pull/2627\n* [x]
Remove `theme` and contrast color computation once the Elastic\nCharts
PR above is merged\n * [x] Make sure badge is always accessible\n * [x]
Exposes Trend options: `Static value` | `Primary metric` \n* [x] `Static
value` will show up a new `Baseline` control (debounced)\n* [x] `Primary
metric` is enabled only for numeric primary values\n * [x] When disabled
a tooltip shows up explaining the issue\n* [x] Added description text to
explain difference with the other\ncompare mode\n * [x] Show only delta
value when in Primary \n * [x] Migrated existing `metric_vis` tests from
Enzyme to RTL\n * [x] New tests for the new Secondary metric component
in RTL\n* [x] Added new smoketest + panel mode caching testing for the
metric\nfeature in FTR\n\n\nFew aspects of this feature have been
discussed and deferred to a follow\nup issue:
https://github.com/elastic/kibana/issues/217992\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\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Nick
Partridge
<nick.ryan.partridge@gmail.com>","sha":"78e74353aafdb5a0397ac4df4dbea5ba8e385e1d","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Visualizations","Feature:Lens","backport
missing","release_note:feature","ci:build-webpack-bundle-analyzer","backport:version","v9.1.0","v8.19.0"],"title":"[Lens]
\"Compare to\" badge for Metric
chart","number":214811,"url":"https://github.com/elastic/kibana/pull/214811","mergeCommit":{"message":"[Lens]
\"Compare to\" badge for Metric chart (#214811)\n\n## Summary\n\nFixes
#184907\n\nThis PR introduces the Trend badge feature into the Secondary
Metric\nchart type.\n<img width=\"1318\" alt=\"Screenshot 2025-04-30 at
13 04
36\"\nsrc=\"https://github.com/user-attachments/assets/6b3c599e-304f-4bc0-8ff2-094ed54ea248\"\n/>\n<img
width=\"1503\" alt=\"Screenshot 2025-04-30 at 13 04
03\"\nsrc=\"https://github.com/user-attachments/assets/cb203156-a7a8-4f61-bf30-57f7d1484fed\"\n/>\n<img
width=\"1339\" alt=\"Screenshot 2025-04-30 at 13 03
21\"\nsrc=\"https://github.com/user-attachments/assets/8896af7f-9193-41b5-a4b5-970907b084c5\"\n/>\n<img
width=\"1319\" alt=\"Screenshot 2025-04-30 at 13 05
34\"\nsrc=\"https://github.com/user-attachments/assets/12aa556e-8743-4167-9902-14fa9ef2e85d\"\n/>\n\n\nHere's
a short list of tasks handled by this PR:\n\n* [x] New Color by value
option: `None` | `Static` | `Dynamic`\n * Default `None` option is the
default (legacy preserved)\n * [x] `Static` option enables the badge
with the picked color\n* [x] this is also enforced when the Primary
metric is not number based\n(or when primary transition from number to
text)\n * [x] `Dynamic` option enables both the badge coloring and the
icon\n* [x] When disabled a tooltip with the explanation of the issue
appears\n * [x] Trend palette is enabled by default on enable\n* [x]
Added other 3 extra palettes (`Reversed`,
`Temperature`,\n`Complementary`)\n* [x] Each palette has been
implemented using both EUI tokens AND Vis\ntokens\n * [x] Revisited this
decision ♻️ \n * [x] Remove redundant palettes\n * ~~keep only Vis
palettes & hardcode `green` value for now.~~\n* ~~Once EUI exposes the
green token integrate in a follow up.~~\n* Use the `@kbn/palettes`
service with the new `compare_to` palette with\nhardcoded values\n * [x]
Exposes display options: `Icon` | `Value` | `Both`\n * [x] `Both` is the
default\n* [x] `Icon` or `Both` will show up 3 possible icon options:
arrow up,\narrow down and equal sign from unicode\n * [x] Make sure both
text and icon respect breakpoint sizes\n* [x] Remove hack for
breakpoints ( Lens Embeddable + Secondary metric)\nonce new Charts
upgrade is
merged:\nhttps://github.com/elastic/elastic-charts/pull/2627\n* [x]
Remove `theme` and contrast color computation once the Elastic\nCharts
PR above is merged\n * [x] Make sure badge is always accessible\n * [x]
Exposes Trend options: `Static value` | `Primary metric` \n* [x] `Static
value` will show up a new `Baseline` control (debounced)\n* [x] `Primary
metric` is enabled only for numeric primary values\n * [x] When disabled
a tooltip shows up explaining the issue\n* [x] Added description text to
explain difference with the other\ncompare mode\n * [x] Show only delta
value when in Primary \n * [x] Migrated existing `metric_vis` tests from
Enzyme to RTL\n * [x] New tests for the new Secondary metric component
in RTL\n* [x] Added new smoketest + panel mode caching testing for the
metric\nfeature in FTR\n\n\nFew aspects of this feature have been
discussed and deferred to a follow\nup issue:
https://github.com/elastic/kibana/issues/217992\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\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Nick
Partridge
<nick.ryan.partridge@gmail.com>","sha":"78e74353aafdb5a0397ac4df4dbea5ba8e385e1d"}},"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/214811","number":214811,"mergeCommit":{"message":"[Lens]
\"Compare to\" badge for Metric chart (#214811)\n\n## Summary\n\nFixes
#184907\n\nThis PR introduces the Trend badge feature into the Secondary
Metric\nchart type.\n<img width=\"1318\" alt=\"Screenshot 2025-04-30 at
13 04
36\"\nsrc=\"https://github.com/user-attachments/assets/6b3c599e-304f-4bc0-8ff2-094ed54ea248\"\n/>\n<img
width=\"1503\" alt=\"Screenshot 2025-04-30 at 13 04
03\"\nsrc=\"https://github.com/user-attachments/assets/cb203156-a7a8-4f61-bf30-57f7d1484fed\"\n/>\n<img
width=\"1339\" alt=\"Screenshot 2025-04-30 at 13 03
21\"\nsrc=\"https://github.com/user-attachments/assets/8896af7f-9193-41b5-a4b5-970907b084c5\"\n/>\n<img
width=\"1319\" alt=\"Screenshot 2025-04-30 at 13 05
34\"\nsrc=\"https://github.com/user-attachments/assets/12aa556e-8743-4167-9902-14fa9ef2e85d\"\n/>\n\n\nHere's
a short list of tasks handled by this PR:\n\n* [x] New Color by value
option: `None` | `Static` | `Dynamic`\n * Default `None` option is the
default (legacy preserved)\n * [x] `Static` option enables the badge
with the picked color\n* [x] this is also enforced when the Primary
metric is not number based\n(or when primary transition from number to
text)\n * [x] `Dynamic` option enables both the badge coloring and the
icon\n* [x] When disabled a tooltip with the explanation of the issue
appears\n * [x] Trend palette is enabled by default on enable\n* [x]
Added other 3 extra palettes (`Reversed`,
`Temperature`,\n`Complementary`)\n* [x] Each palette has been
implemented using both EUI tokens AND Vis\ntokens\n * [x] Revisited this
decision ♻️ \n * [x] Remove redundant palettes\n * ~~keep only Vis
palettes & hardcode `green` value for now.~~\n* ~~Once EUI exposes the
green token integrate in a follow up.~~\n* Use the `@kbn/palettes`
service with the new `compare_to` palette with\nhardcoded values\n * [x]
Exposes display options: `Icon` | `Value` | `Both`\n * [x] `Both` is the
default\n* [x] `Icon` or `Both` will show up 3 possible icon options:
arrow up,\narrow down and equal sign from unicode\n * [x] Make sure both
text and icon respect breakpoint sizes\n* [x] Remove hack for
breakpoints ( Lens Embeddable + Secondary metric)\nonce new Charts
upgrade is
merged:\nhttps://github.com/elastic/elastic-charts/pull/2627\n* [x]
Remove `theme` and contrast color computation once the Elastic\nCharts
PR above is merged\n * [x] Make sure badge is always accessible\n * [x]
Exposes Trend options: `Static value` | `Primary metric` \n* [x] `Static
value` will show up a new `Baseline` control (debounced)\n* [x] `Primary
metric` is enabled only for numeric primary values\n * [x] When disabled
a tooltip shows up explaining the issue\n* [x] Added description text to
explain difference with the other\ncompare mode\n * [x] Show only delta
value when in Primary \n * [x] Migrated existing `metric_vis` tests from
Enzyme to RTL\n * [x] New tests for the new Secondary metric component
in RTL\n* [x] Added new smoketest + panel mode caching testing for the
metric\nfeature in FTR\n\n\nFew aspects of this feature have been
discussed and deferred to a follow\nup issue:
https://github.com/elastic/kibana/issues/217992\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\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Nick
Partridge
<nick.ryan.partridge@gmail.com>","sha":"78e74353aafdb5a0397ac4df4dbea5ba8e385e1d"}},{"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>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels ci:build-webpack-bundle-analyzer Feature:Lens release_note:feature Makes this part of the condensed release notes Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// v8.19.0 v9.1.0

6 participants