Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lens] Area/line charts report last bucket empty #153079

Closed
rajvi-patel-22 opened this issue Mar 10, 2023 · 7 comments · Fixed by #175316
Closed

[Lens] Area/line charts report last bucket empty #153079

rajvi-patel-22 opened this issue Mar 10, 2023 · 7 comments · Fixed by #175316
Assignees
Labels
blocked bug Fixes for quality problems that affect the customer experience Feature:ElasticCharts Issues related to the elastic-charts library Feature:Lens impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@rajvi-patel-22
Copy link

Kibana version: 8.5.0

Elasticsearch version: 8.5.0

Describe the issue:

The new feature was introduced in Kibana [Lens] Show value in legend. This feature is already available in TSVB but there is a minor difference over there. In TSVB, it shows value of last bucket without hovering over the chart. On the other hand, in lens, when this feature is enabled it doesn't show any default values. User must need to hover the chart to see the values.

In Lens,

Scenario 1 : Show value option is enabled and by default it doesn't show any value in the legend.
image

Scenario 2 : Show value option is enabled and it shows value when hover the chart.
image

In TSVB,

Scenario 1 : By default it shows value of last bucket in the legend (which is 0).
image

Scenario 2 : It shows value of count at particular timestamp when hover the chart.
image

Steps to reproduce:

  1. Go to Dashboard > Create Line chart in lens.
  2. Click on the Legend > select Show in Display option and enable Show value toggle
    image

Expected behavior:

  • Lens should show value of last bucket in legend when show value option is enabled and not hovering over the chart.

Actual behavior:

  • The value is not shown in the legend by default even when show value option is enabled.
@botelastic botelastic bot added the needs-team Issues missing a team label label Mar 10, 2023
@stratoula stratoula added the Team:Visualizations Visualization editors, elastic-charts and infrastructure label Mar 10, 2023
@elasticmachine
Copy link
Contributor

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

@botelastic botelastic bot removed the needs-team Issues missing a team label label Mar 10, 2023
@stratoula stratoula added Feature:Lens needs-team Issues missing a team label labels Mar 10, 2023
@botelastic botelastic bot removed the needs-team Issues missing a team label label Mar 10, 2023
@stratoula stratoula added bug Fixes for quality problems that affect the customer experience impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. labels Mar 10, 2023
@stratoula
Copy link
Contributor

The problem here is that the last bucket for area, line charts is empty for some reason, this why you don't see the value in the legend

Bar chart
image

Area chart
image

@markov00
Copy link
Member

@stratoula I have investigated this and seems a behavior that we should handle within elastic-charts and not in Kibana.
What Kibana did in the past was probably a way to "bypass" this problem instead of fixing it at elastic-charts level.
I will drop a ech ticket here when ready

@stratoula
Copy link
Contributor

Great @markov00, thanx for the investigation!

@stratoula stratoula added blocked Feature:ElasticCharts Issues related to the elastic-charts library labels Mar 29, 2023
@NotSoOld
Copy link

@markov00 I would like to ask whether there any updates on this issue. This is, unfortunately, the problem which stops my team from migrating from TSVB to Lens.
Any help needed?

@markov00
Copy link
Member

hey @NotSoOld sorry for the slow investigation on this topic. I'm resuming this work right now and I will update when I have news on how to procede

@markov00
Copy link
Member

@NotSoOld I'm working on it as you can see from the above linked PR/issue

mistic pushed a commit that referenced this issue Feb 8, 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 #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 (@&#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
([#&#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
[@&#8203;elastic/eui](https://togithub.com/elastic/eui) to ^91.3.1
([#&#8203;2286](https://togithub.com/elastic/elastic-charts/issues/2286))
([d4d7b5d](https://togithub.com/elastic/elastic-charts/commit/d4d7b5db6681ec0c65ef8b7e576f1b5fc8b5433a))
- **deps:** update dependency
[@&#8203;elastic/eui](https://togithub.com/elastic/eui) to v92
([#&#8203;2290](https://togithub.com/elastic/elastic-charts/issues/2290))
([cc537fa](https://togithub.com/elastic/elastic-charts/commit/cc537faf43d88acc9abab7e0dac9360bd460b574))
- **legend:** improve last value handling
([#&#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 <[email protected]>
Co-authored-by: Stratoula Kalafateli <[email protected]>
Co-authored-by: Elena Stoeva <[email protected]>
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this issue 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 <[email protected]>
Co-authored-by: Stratoula Kalafateli <[email protected]>
Co-authored-by: Elena Stoeva <[email protected]>
fkanout pushed a commit to fkanout/kibana that referenced this issue 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 <[email protected]>
Co-authored-by: Stratoula Kalafateli <[email protected]>
Co-authored-by: Elena Stoeva <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked bug Fixes for quality problems that affect the customer experience Feature:ElasticCharts Issues related to the elastic-charts library Feature:Lens impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
5 participants