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);