Skip to content

Conversation

@renovate
Copy link
Contributor

@renovate renovate bot commented Jan 23, 2024

Note about @elastic/charts BREAKING CHANGE

In version 62.0.0 we introduced a breaking change in time-series charts: the default "extra" legend value now represents the last data point in the passed data array. It doesn't try to reconcile anymore the data computed domain with a passed domain in Settings.xDomain but instead it renders directly the last element of the passed array.
The reasons for this change can be found at elastic/elastic-charts#2115 or can be asked directly to our #charts slack channel

There are a couple of implementations in Kibana that use both the showLegendExtra in the chart configuration. I've commented them out so that the owner teams can help me fix this breaking change if necessary.

In general, the fix requires that the data passed to the chart contains all the buckets, even empty buckets with null/zeros should be passed. To achieve this, your ES query you should provide the extended_bounds settings in the data histogram agg and use a min_doc_count:0. If that doesn't work, please ping me and we can find an alternative solution.

This should not limit the query performance, generating empty date buckets on the server side has a similar or even less performance impact than what we were doing on the client side to calculate every missing bucket, to fillup the chart in particular situations.

Please double-check your queries/data fetches and push a commit to this PR or ping me with the updated data fetch strategy.

fix #153079

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
@elastic/charts 61.2.0 -> 63.0.0 age adoption passing confidence

Release Notes

elastic/elastic-charts (@​elastic/charts)

v63.0.0

Compare Source

Features
BREAKING CHANGES
  • legend: The CustomLegend.item now exposes both the raw and the formatted version of the extra value.

v62.0.0

Compare Source

Bug Fixes
BREAKING CHANGES
  • legend: In cartesian charts, the default legend value now represents the data points that coincide with the latest datum in the X domain. Please consider passing every data point, even the empty ones (like empty buckets/bins/etc) if your x data domain doesn't fully cover a custom x domain passed to the chart configuration.

@renovate renovate bot added backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// labels Jan 23, 2024
@markov00 markov00 self-assigned this Jan 23, 2024
@renovate renovate bot force-pushed the renovate/main-@elasticcharts branch from 6093e3a to cdccbf1 Compare January 24, 2024 15:09
@renovate renovate bot changed the title Update dependency @elastic/charts to v62 (main) Update dependency @elastic/charts to v63 (main) Jan 24, 2024
@renovate
Copy link
Contributor Author

renovate bot commented Jan 26, 2024

Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.

You can manually request rebase by checking the rebase/retry box above.

Warning: custom changes will be lost.

@markov00 markov00 marked this pull request as ready for review January 29, 2024 10:01
@markov00 markov00 requested review from a team as code owners January 29, 2024 10:01
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-visualizations (Team:Visualizations)

@botelastic botelastic bot added Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team Team:obs-ux-management Observability Management User Experience Team labels Jan 29, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services)

@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-management-team (Team:obs-ux-management)

@stratoula
Copy link
Contributor

@markov00 nice!! As this PR will close this can you also add it on the description? #153079

@stratoula
Copy link
Contributor

/ci

Copy link
Contributor

@crespocarlos crespocarlos left a comment

Choose a reason for hiding this comment

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

While testing the change in infra UI, I noticed that the legend no longer shows the bucket value when hovering over the chart:

extralegend_disabled.mov

If I enable the showLegendExtra back, the value shows up, but the legend is truncated and hard to read.

extralegend_enabled.mov

For comparison, this is how it's currently rendered:

current_behaviour.mov

Is this change part of this update?

@markov00
Copy link
Member

Hey @crespocarlos

If I enable the showLegendExtra back, the value shows up, but the legend is truncated and hard to read.

Correct, I've commented out the showLegendExtra just to ping you, so it should be reenabled if you want to see that data by default.
You are also correct in the fact that now the legend could be shorter and hard to read. We can probably find an elastic-charts workaround for this, but I believe, in your case, the best option is to find a valid legend size in pixel better and configure it in the Settings.legendSize prop. Since you have more than one chart above the other, using a common size there also ensures a bit more vertical alignment across both charts. If that doesn't satisfy your charts option/design I can provide different solutions within elastic-charts trying to solve this.

@markov00
Copy link
Member

@crespocarlos Actually, this was the behaviour also before this change, I've checked with an older version of elastic-charts and that was exactly how the legend behaves in such a situation.
I've created an issue to fix that on our end elastic/elastic-charts#2322 but for now I believe we can live with that issue.
I kindly ask you to double check instead the following:
if you are not hovering over the chart, the legend should show the value of the last bucket in the time series. If the legend shows a value but this doesn't represent the last bucket but one earlier because you don't have data in the last bucket, you should change, as described in the PR description, the way you fetch the data to get a dataset with all buckets including the empty ones

Copy link
Contributor

@crespocarlos crespocarlos left a comment

Choose a reason for hiding this comment

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

@markov00 I've tested it as you suggested and it looks good. I didn't see any odd behaviour after enabling the showLegendExtra on the file owned by Obs UX Infra Services.

Copy link
Contributor

@ElenaStoeva ElenaStoeva left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @markov00! I updated the request for fetching data for the chart in Watcher (8e84c98). Tested locally the changes and it LGTM!

@renovate renovate bot requested a review from a team as a code owner February 6, 2024 13:45
@markov00 markov00 force-pushed the renovate/main-@elasticcharts branch from fb84a14 to 45422f3 Compare February 6, 2024 13:49
@markov00 markov00 force-pushed the renovate/main-@elasticcharts branch from 45422f3 to b279d40 Compare February 6, 2024 13:50
// the showLegendExtra will display the last element of the data array as the default legend value
// and if empty buckets are filtered out you can probably see a value that doesn't correspond
// to the value in the last time bucket visualized.
// showLegendExtra
Copy link
Member

Choose a reason for hiding this comment

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

if I'm not wrong the query for this chart is built in buildLogOverviewAggregations from x-pack/plugins/infra/public/utils/logs_overview_fetchers.ts and this doesn't contain the min_doc_count:0 and the extended_bounds. Turning this off for now, but can be turned as soon as the query builder is fixed

@angorayc
Copy link
Contributor

angorayc commented Feb 7, 2024

Hi, an observation about the value in each legend grouping, not sure if it's to do with this PR.
I think the previous behaviour makes more sense to me, are we able to keep the previous behaviour?

Before - - it shows nothing when not interacting with visualizations.
Screenshot 2024-02-07 at 18 02 32

In this PR - it shows 0 when not interacting with visualizations. Would like to know how do we come up with the value 0 in each group here? As it's a time range we are using for querying, I'd a bit confuse about the value in each legend grouping.

Screen.Recording.2024-02-07.at.18.02.43.mov

Copy link
Contributor

@angorayc angorayc left a comment

Choose a reason for hiding this comment

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

Thanks for the upgrade 👍

@mistic mistic merged commit 086c469 into main Feb 8, 2024
@mistic mistic deleted the renovate/main-@elasticcharts branch February 8, 2024 16:13
@kibana-ci
Copy link

kibana-ci commented Feb 8, 2024

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #1 / APM API tests transactions/latency_overall_distribution.spec.ts trial 8.0.0 "after all" hook: runAfter in "8.0.0"

Metrics [docs]

Async chunks

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

id before after diff
observability 637.3KB 637.2KB -19.0B
securitySolution 11.4MB 11.4MB +572.0B
stackAlerts 82.2KB 82.1KB -19.0B
uptime 458.4KB 458.4KB -19.0B
total +515.0B

Page load bundle

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

id before after diff
kbnUiSharedDeps-npmDll 6.2MB 6.2MB -109.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @markov00

CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
## Note about `@elastic/charts` BREAKING CHANGE

In version 62.0.0 we introduced a breaking change in time-series charts:
the default "extra" legend value now represents the last data point in
the passed data array. It doesn't try to reconcile anymore the data
computed domain with a passed domain in `Settings.xDomain` but instead
it renders directly the last element of the passed array.
The reasons for this change can be found at
elastic/elastic-charts#2115 or can be asked
directly to our `#charts` slack channel

There are a couple of implementations in Kibana that use both the
`showLegendExtra` in the chart configuration. I've commented them out so
that the owner teams can help me fix this breaking change if necessary.

In general, the fix requires that the data passed to the chart contains
all the buckets, even empty buckets with null/zeros should be passed. To
achieve this, your ES query you should provide the `extended_bounds`
settings in the [data histogram
agg](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-histogram-aggregation.html#search-aggregations-bucket-histogram-aggregation-extended-bounds)
and use a `min_doc_count:0`. If that doesn't work, please ping me and we
can find an alternative solution.

This should not limit the query performance, generating empty date
buckets on the server side has a similar or even less performance impact
than what we were doing on the client side to calculate every missing
bucket, to fillup the chart in particular situations.

Please double-check your queries/data fetches and push a commit to this
PR or ping me with the updated data fetch strategy.
 

fix elastic#153079


This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@elastic/charts](https://togithub.com/elastic/elastic-charts) |
[`61.2.0` ->
`63.0.0`](https://renovatebot.com/diffs/npm/@elastic%2fcharts/61.2.0/63.0.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@elastic%2fcharts/63.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@elastic%2fcharts/63.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@elastic%2fcharts/61.2.0/63.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@elastic%2fcharts/61.2.0/63.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>elastic/elastic-charts (@&elastic#8203;elastic/charts)</summary>

###
[`v63.0.0`](https://togithub.com/elastic/elastic-charts/blob/HEAD/CHANGELOG.md#6300-2024-01-24)

[Compare
Source](https://togithub.com/elastic/elastic-charts/compare/v62.0.0...v63.0.0)

##### Features

- **legend:** expose extra raw values
([#&elastic#8203;2308](https://togithub.com/elastic/elastic-charts/issues/2308))
([85bfe06](https://togithub.com/elastic/elastic-charts/commit/85bfe0668d66fd24e78f2bba8be4570fa926e94c))

##### BREAKING CHANGES

- **legend:** The `CustomLegend.item` now exposes both the `raw` and the
`formatted` version of the extra value.

###
[`v62.0.0`](https://togithub.com/elastic/elastic-charts/blob/HEAD/CHANGELOG.md#6200-2024-01-23)

[Compare
Source](https://togithub.com/elastic/elastic-charts/compare/v61.2.0...v62.0.0)

##### Bug Fixes

- **deps:** update dependency
[@&elastic#8203;elastic/eui](https://togithub.com/elastic/eui) to ^91.3.1
([#&elastic#8203;2286](https://togithub.com/elastic/elastic-charts/issues/2286))
([d4d7b5d](https://togithub.com/elastic/elastic-charts/commit/d4d7b5db6681ec0c65ef8b7e576f1b5fc8b5433a))
- **deps:** update dependency
[@&elastic#8203;elastic/eui](https://togithub.com/elastic/eui) to v92
([#&elastic#8203;2290](https://togithub.com/elastic/elastic-charts/issues/2290))
([cc537fa](https://togithub.com/elastic/elastic-charts/commit/cc537faf43d88acc9abab7e0dac9360bd460b574))
- **legend:** improve last value handling
([#&elastic#8203;2115](https://togithub.com/elastic/elastic-charts/issues/2115))
([9f99447](https://togithub.com/elastic/elastic-charts/commit/9f9944734c4a13bfe9e4ffc9f4c0f39da5f9931f))

##### BREAKING CHANGES

- **legend:** In cartesian charts, the default legend value now
represents the data points that coincide with the latest datum in the X
domain. Please consider passing every data point, even the empty ones
(like empty buckets/bins/etc) if your x data domain doesn't fully cover
a custom x domain passed to the chart configuration.

</details>

---

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Marco Vettorello <marco.vettorello@elastic.co>
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
Co-authored-by: Elena Stoeva <elenastoeva99@gmail.com>
fkanout pushed a commit to fkanout/kibana that referenced this pull request Mar 4, 2024
## Note about `@elastic/charts` BREAKING CHANGE

In version 62.0.0 we introduced a breaking change in time-series charts:
the default "extra" legend value now represents the last data point in
the passed data array. It doesn't try to reconcile anymore the data
computed domain with a passed domain in `Settings.xDomain` but instead
it renders directly the last element of the passed array.
The reasons for this change can be found at
elastic/elastic-charts#2115 or can be asked
directly to our `#charts` slack channel

There are a couple of implementations in Kibana that use both the
`showLegendExtra` in the chart configuration. I've commented them out so
that the owner teams can help me fix this breaking change if necessary.

In general, the fix requires that the data passed to the chart contains
all the buckets, even empty buckets with null/zeros should be passed. To
achieve this, your ES query you should provide the `extended_bounds`
settings in the [data histogram
agg](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-histogram-aggregation.html#search-aggregations-bucket-histogram-aggregation-extended-bounds)
and use a `min_doc_count:0`. If that doesn't work, please ping me and we
can find an alternative solution.

This should not limit the query performance, generating empty date
buckets on the server side has a similar or even less performance impact
than what we were doing on the client side to calculate every missing
bucket, to fillup the chart in particular situations.

Please double-check your queries/data fetches and push a commit to this
PR or ping me with the updated data fetch strategy.
 

fix elastic#153079


This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@elastic/charts](https://togithub.com/elastic/elastic-charts) |
[`61.2.0` ->
`63.0.0`](https://renovatebot.com/diffs/npm/@elastic%2fcharts/61.2.0/63.0.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@elastic%2fcharts/63.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@elastic%2fcharts/63.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@elastic%2fcharts/61.2.0/63.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@elastic%2fcharts/61.2.0/63.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>elastic/elastic-charts (@&elastic#8203;elastic/charts)</summary>

###
[`v63.0.0`](https://togithub.com/elastic/elastic-charts/blob/HEAD/CHANGELOG.md#6300-2024-01-24)

[Compare
Source](https://togithub.com/elastic/elastic-charts/compare/v62.0.0...v63.0.0)

##### Features

- **legend:** expose extra raw values
([#&elastic#8203;2308](https://togithub.com/elastic/elastic-charts/issues/2308))
([85bfe06](https://togithub.com/elastic/elastic-charts/commit/85bfe0668d66fd24e78f2bba8be4570fa926e94c))

##### BREAKING CHANGES

- **legend:** The `CustomLegend.item` now exposes both the `raw` and the
`formatted` version of the extra value.

###
[`v62.0.0`](https://togithub.com/elastic/elastic-charts/blob/HEAD/CHANGELOG.md#6200-2024-01-23)

[Compare
Source](https://togithub.com/elastic/elastic-charts/compare/v61.2.0...v62.0.0)

##### Bug Fixes

- **deps:** update dependency
[@&elastic#8203;elastic/eui](https://togithub.com/elastic/eui) to ^91.3.1
([#&elastic#8203;2286](https://togithub.com/elastic/elastic-charts/issues/2286))
([d4d7b5d](https://togithub.com/elastic/elastic-charts/commit/d4d7b5db6681ec0c65ef8b7e576f1b5fc8b5433a))
- **deps:** update dependency
[@&elastic#8203;elastic/eui](https://togithub.com/elastic/eui) to v92
([#&elastic#8203;2290](https://togithub.com/elastic/elastic-charts/issues/2290))
([cc537fa](https://togithub.com/elastic/elastic-charts/commit/cc537faf43d88acc9abab7e0dac9360bd460b574))
- **legend:** improve last value handling
([#&elastic#8203;2115](https://togithub.com/elastic/elastic-charts/issues/2115))
([9f99447](https://togithub.com/elastic/elastic-charts/commit/9f9944734c4a13bfe9e4ffc9f4c0f39da5f9931f))

##### BREAKING CHANGES

- **legend:** In cartesian charts, the default legend value now
represents the data points that coincide with the latest datum in the X
domain. Please consider passing every data point, even the empty ones
(like empty buckets/bins/etc) if your x data domain doesn't fully cover
a custom x domain passed to the chart configuration.

</details>

---

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Marco Vettorello <marco.vettorello@elastic.co>
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
Co-authored-by: Elena Stoeva <elenastoeva99@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apm:review backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team Team:obs-ux-management Observability Management User Experience Team Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// v8.13.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Lens] Area/line charts report last bucket empty

10 participants