Skip to content

tickFormatter for legend, tooltip and axis #713

@nickofthyme

Description

@nickofthyme

Is your feature request related to a problem? Please describe.
Have a way to format/truncate the axis labels without effecting the tooltip values.

Describe the solution you'd like
I think it would be too convoluted to have a tick formatter for legend, tooltip and axis. A better solution may be to have a third parameter to the tooltip function for where the value is used.

type Scope = 'tooltip' | 'legend' | 'axis';
export type TickFormatter = (value: any, options?: TickFormatterOptions, scope?: Scope) => string;

Then we can call this in any place differently without using three separate formatter functions. Similarly to how we currently handle naming.

/**
* Function to create custom series name for a given series
*/
export type SeriesNameFn = (series: XYChartSeriesIdentifier, isTooltip: boolean) => SeriesName;

Describe alternatives you've considered
No real way to separate these cases as it currently stands.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestreleasedIssue released publicly

    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