fl_chart icon indicating copy to clipboard operation
fl_chart copied to clipboard

Display tooltip when pressing a point in a line containing multiple points that all have the same x value.

Open thav1992 opened this issue 3 years ago • 4 comments

** Don't make a duplicate issue. It does not appear to a similar issue for this (if there is, i apologise).

Thank you for a great package! After many tries there does not seem to be a way to display a tooltip when pressing a singular point in a line that has multiple points that all have the same x value in a graph.

Screenshot 2022-02-23 at 10 22 03 Screenshot 2022-02-23 at 10 22 44

Am i missing something. The touchCallback function always returns the lowest point on the line when clicking other points.

thav1992 avatar Feb 23 '22 10:02 thav1992

Hi. What do you prefer? Showing tooltip on the point, you touch? Or the highest one?

imaNNeo avatar Feb 23 '22 20:02 imaNNeo

It seems like you want to show the tooltip for the dot you press? By default only the x distance between the touch to the dot is used to find the closest one. Using LineTouchData.distanceCalculator you can write your own function that uses the Euclidean distance. This would then select the dot you press.

joeldomke avatar Feb 28 '22 13:02 joeldomke

Hi. What do you prefer? Showing tooltip on the point, you touch? Or the highest one?

Showing the tooltip on the point (or right above the point)

It seems like you want to show the tooltip for the dot you press? By default only the x distance between the touch to the dot is used to find the closest one. Using LineTouchData.distanceCalculator you can write your own function that uses the Euclidean distance. This would then select the dot you press.

Cool i will try it out!

thav1992 avatar Mar 08 '22 21:03 thav1992

how did it work out? currently trying out a similar thing

hpiu avatar Mar 28 '22 17:03 hpiu

Can you please add some sample code how to use LineTouchData.distanceCalculator to show the tooltip for the dot you press? @joeldomke @imaNNeo

Sumit258000 avatar Oct 02 '23 08:10 Sumit258000