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

[Legend] improve handling for legend rendered value #2044

Open
markov00 opened this issue May 18, 2023 · 0 comments
Open

[Legend] improve handling for legend rendered value #2044

markov00 opened this issue May 18, 2023 · 0 comments
Assignees
Labels
:all Applies to all chart types bug Something isn't working enhancement New feature or request kibana cross issue Has a Kibana issue counterpart :legend Legend related issue

Comments

@markov00
Copy link
Member

Is your feature request related to a problem? Please describe.
Currently, our legend can be configured to show a value. We internally call it extra and a hardcoded logic picks that value from the dataset only if that value coincides with the domain max.

This logic works well if the X domain is computed automatically from the dataset itself, but instead, if the domain is passed through the xDomain property of the Settings and the max doesn't correspond to the last value in your dataset then this value is not represented in the legend.

This is particularly evident in Kibana, where the time window is configured by the user in Lens and, due to the way time-picker works there are cases where the domain max will not coincide with the latest datapoint (see elastic/kibana#153079

There are a few problems here:

  1. there is no proper definition of "last value", or "extra" and how it works
  2. the semantic meaning of this "last value" is not clear to the user and to the consumer (we call it extra, we "internally" know that this represents an "elusive" last value but this is not explicit and is hard to understand).
  3. There is no visual description in the Legend about the meaning of that value
  4. This value can change meaning: when you are not hovering over a chart, the value represents this "last value" but when hovering over the chart it represents the current one. This behavior was inherited from TSVB. Its usage was to allow hovering over a chart and show the value in the legends of every cursor-synchronized chart without showing a tooltip for each chart.
  5. There are requests to make this value be configurable by showing an average, a total sum, a min/max Make the legend extra parameter customizable  #561

Describe the solution you'd like

  1. renaming the legend extra to something more meaningful
  2. refactor the logic to provide a way to customize this value through hardcoded functions and/or external functions.
  3. design a way to describe that value in the legend (column title or something similar)
  4. define and redesign, if necessary, the way the value is changed when hovering over the chart (probably we can disable that behavior when hovering over the chart owner of the legend)

Describe alternatives you've considered

  • There is already the possibility to fully customize the legend, by externalizing the rendering. This is a valid approach but includes additional steps for the developer
  • Exposing the legend as a set of composable components is a viable option too. This anyway doesn't fix the immediate needs of having a configurable value and a clean and meaningful API

Kibana Cross Issues
elastic/kibana#153079

@markov00 markov00 added bug Something isn't working enhancement New feature or request kibana cross issue Has a Kibana issue counterpart :legend Legend related issue :all Applies to all chart types labels May 18, 2023
@markov00 markov00 self-assigned this May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:all Applies to all chart types bug Something isn't working enhancement New feature or request kibana cross issue Has a Kibana issue counterpart :legend Legend related issue
Projects
None yet
Development

No branches or pull requests

1 participant