Skip to content

[Feature] tooltip.valueFormatter function needs to supports a third parameter, which is either fragment or fragment.name; When there are multiple series arrays, it is impossible to determine which line segment it is #21459

@tinysimple

Description

@tinysimple

What problem does this feature solve?

Multiple line segments in a line chart cannot be assigned different numerical units to different line charts using the tooltip.valueFormatter function. At present, the valueFormatter function only has two parameters, name and dataIndex.

Since it is just a simple requirement, I do not want to rewrite the entire content and style through tooltip.formatter (I do not want to change the default style).

Upon checking the source code, it was found that the relevant code is located at line 351 in the file src/component/tooltip/tooltipMarkup.ts. Through breakpoint debugging, I found that the name in the fragment object is the line segment name in the series. I need this name field to determine what units should be displayed.

For example:
Add unit A to the current line
Add unit V to the voltage line

What does the proposed API look like?

Original code:
const readableValueList = noValue ? [] : valueFormatter(fragment.value as OptionDataValue, fragment.dataIndex);

new code:
const readableValueList = noValue ? [] : valueFormatter(fragment.value as OptionDataValue, fragment.dataIndex, fragment.name);
or
const readableValueList = noValue ? [] : valueFormatter(fragment.value as OptionDataValue, fragment.dataIndex, fragment);

Metadata

Metadata

Assignees

No one assigned

    Labels

    enThis issue is in EnglishwontfixNo plan to fix this issue or add this feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions