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

Individual tooltip formatters within a series #241

Closed
3 tasks
flash1293 opened this issue Jun 14, 2019 · 1 comment
Closed
3 tasks

Individual tooltip formatters within a series #241

flash1293 opened this issue Jun 14, 2019 · 1 comment
Labels
enhancement New feature or request :tooltip Related to hover tooltip :xy Bar/Line/Area chart related

Comments

@flash1293
Copy link

Is your feature request related to a problem? Please describe.
As a series can have multiple y accessors, it can contain multiple data points for the same x accessor value. To format the tooltips, currently the tick formatter of the axis is used. There are situations in which it would make sense to have different formatters for the tooltip values of the individual series (e.g. because in Kibana formatters can be attached to a field which could result in two y values on the same axis with two different formatters)

Describe the solution you'd like
Not 100% sure about the api, but there could be a prop on the series to configure the tooltip formatters in greater detail:

<LineSeries {...props} tooltipFormatters={{ yAccessor1: formatter1, yAccessor2: formatter2 }} />

If a user wants to specify just one formatter for the tooltip values which differentiates from the tick formatter, something like this could also be provided:

<LineSeries {...props} tooltipFormatter={formatter} />

The specifity priority should probably be default formatter -> axis tick formatter -> single series tooltip formatter -> y-accessor specific tooltip formatter.

Describe alternatives you've considered
A current workaround is to have a separate hidden axis for each series, but to do so you have to harmonize the domains of each axis by basically doing what elastic-charts is doing internally:
-if you have all negative values and yScaleToExtent=false than the min domain is 0 and the max domain is the max negative value
-if you have all negative values and yScaleToExtent=true than the min domain is the min negative and the max domain is the max negative value

  • if you have half negative and half positive values, than the min Domain is the max negative, and the max domain is the max positive

Additional context

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
@flash1293 flash1293 added the enhancement New feature or request label Jun 14, 2019
@nickofthyme nickofthyme added the :tooltip Related to hover tooltip label Sep 27, 2019
@markov00 markov00 mentioned this issue Dec 2, 2020
18 tasks
@markov00 markov00 added the :xy Bar/Line/Area chart related label Jul 28, 2021
@markov00
Copy link
Member

Copying the same reply used in kibana#112141

@ghudgins @flash1293 @dej611 I have reviewed this issue with @gvnmagni and we don't agree on that request because:

  • each Y-axis drives the data format of what is represented along that axis. There can be a variation in the tooltip, like for example increasing the precision or including an extended unit name, but using different formatting for two different series on the same Y-axis is a bad practice. Values on the same Y-axis should be compared easily and should represent the same unit and metric.
  • If you have 2 Y-axis, you can have different formatters, one for each Y-axis with a different unit, multipliers, etc. But you always have to consider the previous point: the same tuple of formatters should be used within the tooltip on each associated series (with the extent of improving the data precision).
  • having a tooltip with 3 series using 3 different formattings should be avoided.

To summarize:

  • a y-axis can use only 1 value formatter
  • Each metric associated with a y-axis will inherit the y-axis formatter.
  • The inherited formatter can be tweaked, at the tooltip level, to increase its precision (from 0 decimal on the axis to 2 del on the tooltip) or extend the unit (kB -> kilobyte).
  • Two metrics, associated with the same y-axis, will inherit the same formatter on the tooltip.

A completely different discussion is if you want to introduce more information in the tooltip related to the current data point (like for example showing some correlated data value, or some contextual information). In this case, a custom tooltip needs to be delivered explaining clearly what each value is and why we are showing them.

If you disagree, please reopen this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request :tooltip Related to hover tooltip :xy Bar/Line/Area chart related
Projects
None yet
Development

No branches or pull requests

3 participants