[Lens] Update @elastic/charts to 71.0.0 and use new metric chart#229815
[Lens] Update @elastic/charts to 71.0.0 and use new metric chart#229815mariairiartef merged 183 commits intoelastic:mainfrom
Conversation
96a35bc to
60f3c3d
Compare
c9ff587 to
9c625fd
Compare
e5cf06a to
d4fe004
Compare
| ? euiLightVars.euiColorPrimary | ||
| : euiThemeVars.euiColorEmptyShade; | ||
| if (showingBar(state) && isMetricNumeric) { | ||
| return euiLightVars.euiColorPrimary; |
There was a problem hiding this comment.
I'm not sure why we default to color.primary from brand colors if in the palette selection we don't show this color as we show the data visualization colors.
There was a problem hiding this comment.
In agreement with giovanni we can use the VisColor 2, but is not need to do it in this PR
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#9131[✅] x-pack/platform/test/functional/apps/lens/group6/config.ts: 25/25 tests passed. |
| async ({ id, pattern, finalPattern }) => { | ||
| await getFormattedMetrics(394.2393, 983123.984, { id, params: { pattern } }); | ||
| expect(mockDeserialize).toHaveBeenCalledTimes(2); | ||
| expect(mockDeserialize).toHaveBeenCalledTimes(4); |
There was a problem hiding this comment.
Using the default secondary metric component and calling the getSecondaryMetricInfo method from metric_vis, it gets called 3 times. Should we optimize this?
There was a problem hiding this comment.
not in this PR, please open an issue for that
|
|
||
| import { DimensionsVisParam, MetricVisParam } from '../../common'; | ||
| import { FormatOverrides } from './helpers'; | ||
| import { getMetricFormatter } from './helpers'; |
There was a problem hiding this comment.
Note: import the formatter directly from the file instead of passing it as parameter from metric_vis
|
@gvnmagni @mariairiartef I've created a follow up issue with Giovanni's comments #233702 |
markov00
left a comment
There was a problem hiding this comment.
Changes looks good to me, tested locally also with preexisting metrics.
No major differences and new logic works fine
...lugins/shared/chart_expressions/expression_metric/public/components/secondary_metric_info.ts
Outdated
Show resolved
Hide resolved
...platform/plugins/shared/chart_expressions/expression_metric/public/components/metric_vis.tsx
Show resolved
Hide resolved
...platform/plugins/shared/chart_expressions/expression_metric/public/components/metric_vis.tsx
Show resolved
Hide resolved
| async ({ id, pattern, finalPattern }) => { | ||
| await getFormattedMetrics(394.2393, 983123.984, { id, params: { pattern } }); | ||
| expect(mockDeserialize).toHaveBeenCalledTimes(2); | ||
| expect(mockDeserialize).toHaveBeenCalledTimes(4); |
There was a problem hiding this comment.
not in this PR, please open an issue for that
| ? euiLightVars.euiColorPrimary | ||
| : euiThemeVars.euiColorEmptyShade; | ||
| if (showingBar(state) && isMetricNumeric) { | ||
| return euiLightVars.euiColorPrimary; |
There was a problem hiding this comment.
In agreement with giovanni we can use the VisColor 2, but is not need to do it in this PR
nickofthyme
left a comment
There was a problem hiding this comment.
This looks great! I tested locally with a few old Metrics and everything works smoothly.
I reviewed most files and left only minor comments. I have about 10 more files to review that are the larger code diffs, but I ran out of time tonight. I'll pick back up reviewing in the morning.
...uptime/public/legacy_uptime/components/common/charts/__snapshots__/donut_chart.test.tsx.snap
Show resolved
Hide resolved
x-pack/platform/plugins/shared/lens/public/visualizations/metric/runtime_state/index.ts
Outdated
Show resolved
Hide resolved
x-pack/platform/plugins/shared/lens/public/visualizations/metric/runtime_state/index.ts
Show resolved
Hide resolved
nickofthyme
left a comment
There was a problem hiding this comment.
Ok, I went through the rest of the code changes and everything look great.
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
History
|
…stic#229815) closes elastic#228964 Replaces renovate bot PR elastic#230486 for Elastic Charts v71.0.0 ## Summary - Upgrade Elastic Charts to version 71.0.0 - Update Metric Chart toolbar with new settings: - Primary Metric alignment - Secondary Metric alignment - Primary Metric position - Title weight - Update Primary Metric sidebar settings by adding ability to apply color to value when supporting visualization is a panel - Update Secondary Metric sidebar settings by adding ability to add label (previously called prefix) before or after the Secondary Metric value - Use default Secondary Metric component from Elastic Charts so we don't rely on a custom Secondary Metric component created in Lens - Update unit and functional tests when using the new metric version ## Screenshots and screen recordings ### New progress bar style <img width="327" height="328" alt="Screenshot 2025-08-22 at 11 22 50" src="https://github.com/user-attachments/assets/e800cda4-ad94-48f1-9af6-bfe0b58f0034" /> ### Allows new primary metric position "top"* https://github.com/user-attachments/assets/9158cf22-2988-489f-81a9-71810d6ac550 *note: when the user selects primary position > top, it automatically selects title weight to normal and primary align to left. And when the user selects primary position > bottom, it automatically selects title weight to bold and primary align to right ### New toolbar settings https://github.com/user-attachments/assets/068d5877-c3ba-4191-bd78-b5b68eab4d99 ### Allows applying color to the Metric chart background (panel) or Primary Metric value* https://github.com/user-attachments/assets/42700919-b358-4227-b05b-ea89ad450ea1 *note: when value is selected, we use the [data visualization text colors](https://eui.elastic.co/docs/getting-started/theming/tokens/colors/#dataVisText) ### Enables changing the label position for the Secondary Metric https://github.com/user-attachments/assets/3f070821-d2b9-4236-943a-a0d651ea32ec ## Checklist - [ ] 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/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [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 - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary Moves several Lens state runtime migrations to CM migrations before `v1` is established. - Add ColorMapping fix for looping mode #231165 - Add Changes to metric config from #229815 - Cleanup Lens SO attributes - The `description` and `visualizationType` properties can be more strict and less redundant for saving the SO. ### 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 - [x] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. --------- Co-authored-by: Marco Vettorello <marco.vettorello@elastic.co> Co-authored-by: Marco Vettorello <vettorello.marco@gmail.com>
This PR adds the new appearance settings for the metric chart. Closes #3088 Relates to elastic/kibana#229815 and elastic/kibana#233992
## Summary Moves several Lens state runtime migrations to CM migrations before `v1` is established. - Add ColorMapping fix for looping mode elastic#231165 - Add Changes to metric config from elastic#229815 - Cleanup Lens SO attributes - The `description` and `visualizationType` properties can be more strict and less redundant for saving the SO. ### 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 - [x] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. --------- Co-authored-by: Marco Vettorello <marco.vettorello@elastic.co> Co-authored-by: Marco Vettorello <vettorello.marco@gmail.com>
closes #228964
Replaces renovate bot PR #230486 for Elastic Charts v71.0.0
Summary
Upgrade Elastic Charts to version 71.0.0
Update Metric Chart toolbar with new settings:
Update Primary Metric sidebar settings by adding ability to apply color to value when supporting visualization is a panel
Update Secondary Metric sidebar settings by adding ability to add label (previously called prefix) before or after the Secondary Metric value
Use default Secondary Metric component from Elastic Charts so we don't rely on a custom Secondary Metric component created in Lens
Update unit and functional tests when using the new metric version
Screenshots and screen recordings
New progress bar style
Allows new primary metric position "top"*
Screen.Recording.2025-08-22.at.12.26.27.mov
*note: when the user selects primary position > top, it automatically selects title weight to normal and primary align to left. And when the user selects primary position > bottom, it automatically selects title weight to bold and primary align to right
New toolbar settings
Screen.Recording.2025-08-13.at.15.39.30.mov
Allows applying color to the Metric chart background (panel) or Primary Metric value*
Screen.Recording.2025-08-13.at.15.31.55.mov
*note: when value is selected, we use the data visualization text colors
Enables changing the label position for the Secondary Metric
Screen.Recording.2025-08-13.at.15.33.42.mov
Checklist
release_note:breakinglabel should be applied in these situations.release_note:*label is applied per the guidelinesbackport:*labels.