antvis/G2

Tooltip shared=True change order of the values dynamically. #4187

ThamaluM posted onGitHub

When we used the shared tooltip, I want to list the categorical variable according to the descending order of the value.

For example, Berlin above London in the tool-tip if and only if the y-axis value of Berlin is greater than London. image

Is there already a way to do this? Or can you add that feature in a next version. It is really helpful when there are lot of categories.


You can custom the tooltip items by ordering them as you want.

chart.tooltip({
  // ...
  customItems: (originalItems: TooltipItem[]) => {
    return originalItems.sort(/* by your order method */)
  };
})
posted by hustcc over 2 years ago

Fund this Issue

$0.00
Funded

Pull requests