Skip to content

Individual tooltip formatters within a series #241

@flash1293

Description

@flash1293

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    :tooltipRelated to hover tooltip:xyBar/Line/Area chart relatedenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions