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

Make the legend extra parameter customizable #561

Closed
3 tasks done
markov00 opened this issue Feb 20, 2020 · 13 comments · Fixed by #1889 or #2355
Closed
3 tasks done

Make the legend extra parameter customizable #561

markov00 opened this issue Feb 20, 2020 · 13 comments · Fixed by #1889 or #2355
Labels
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.
The current legend extra parameter is used to display the latest value on the data series, or the hovered data point value. We should make this configurable to show other values or statistics, like the total value, averages etc

Describe the solution you'd like
We should move the legend props to it's own <Legend> component and allow the user to customize in some way the possible extra parameter

Describe alternatives you've considered
n/a

Additional context
continuation of #246

Kibana Cross Issues

Checklist

  • this request is checked against already exist requests
  • every related Kibana issue is listed under Kibana Cross Issues list
  • kibana cross issue tag is associated to the issue if any kibana cross issue is present
@markov00 markov00 added enhancement New feature or request kibana cross issue Has a Kibana issue counterpart labels Feb 20, 2020
@markov00 markov00 mentioned this issue Mar 6, 2020
@markov00 markov00 added the :legend Legend related issue label Mar 26, 2020
@nickofthyme nickofthyme added this to the Kibana 7.11 milestone Sep 30, 2020
@formgeist
Copy link

@markov00 @nickofthyme Not sure about your prioritization for 7.11, but this is another much-needed addition to the charts in order to display averages across selected time ranges in APM. Can you share an update on this? Thanks 👍

@ghudgins
Copy link
Contributor

+1 o11y case

I guess I expected it to show an aggregate value of the data, average of the entire data for average, max for the maximum line item, etc.

@PhilippeOberti
Copy link

+1 for the @elastic/protections-experience team, we could use a feature to show accumulated values when the user isn't mousing over anything in the chart.
I see that the Alerts page currently has this feature, but the developers had to build an entirely new Legend component themselves.

@yannbolliger
Copy link
Contributor

It would be great if one could provide a custom legend component like for the tooltip.

@yannbolliger
Copy link
Contributor

It would be great if one could provide a custom legend component like for the tooltip.

@markov00 would you accept a PR if I was to try and implement this?

@markov00
Copy link
Member Author

Hi @yannbolliger such a task brings in a set of decisions that we should make before attempting an implementation:

  • What are we looking to expose in the API to provide this capability?
  • Is the current Legend Item object enough or does it need more details (the data table view related to such item for example)?
  • Do we want to expose full control over the value (giving the freedom to the user to send a custom function) or a set of predefined operations (sum, avg, last, min, max)?
  • How can we improve the legend style to accommodate correctly such metric? Today we don't describe such value, but a header will help a lot the readability of the legend.
  • Who should provide the formatting and how do we want to format such value? Does the legend needs to shrink/grow depending on that?
  • Is a value column enough or do we want to transform the legend to a table to allow multiple stats?
  • Does that value change with interactions (as it is today) in all cases? if so what will change to inform the user?

The current legend extra parameter was not actually well thought out when it was merged. It was pushed into the library to align the feature with a legacy functionality that we have in Kibana, so that is why I'm a bit hesitant about letting you try an implementation (I just don't want to waste your time and not accept the PR due to its implementation/logic).
I'm very happy btw if you are interested in discussing this feature and how we can structure a good logic behind that.

@nickofthyme
Copy link
Collaborator

There are also implications related to the width of the legend, such that allowing a fully custom element would require rethinking how we currently size the legend and legend items. Currently, we use CanvasRenderingContext2D.measureText() here to determine the max width of all labels + extra value strings to appropriately size the legend all while limiting reflows.

@yannbolliger
Copy link
Contributor

I'm very happy btw if you are interested in discussing this feature and how we can structure a good logic behind that.

@markov00 @nickofthyme Thanks for the replies! I'm also interested in discussing this.
Is there some easier way to discuss this than Github issue comments?

@markov00
Copy link
Member Author

markov00 commented Nov 9, 2022

@nickofthyme I've talked this morning with Yann and we moved the request toward #862

@markov00
Copy link
Member Author

Reopening since the need of making the "extra" parameter configurable is still there

@markov00 markov00 reopened this May 18, 2023
@markov00
Copy link
Member Author

Hey @formgeist, our dear @gvnmagni has explored a bit this space and how it will probably look like. Please take a look at #580

@formgeist
Copy link

Hey @formgeist, our dear @gvnmagni has explored a bit this space and how it will probably look like. Please take a look at #580

@markov00 sorry if I'm missing something, but is there a specific issue in that list of features that you're referring to?

@markov00
Copy link
Member Author

@formgeist sorry wrong link for you: #2096

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request kibana cross issue Has a Kibana issue counterpart :legend Legend related issue
Projects
None yet
6 participants