Last value in AreaSeries doesn't show the Tooltip Android

Hi, I am having a problem with the tooltip in a AreaSeries, the last value in the graph does not show the tooltip, could you help me please.



4 Replies 1 reply marked as answer

HM Hemalatha Marikumar Syncfusion Team January 4, 2021 01:21 PM UTC

Hi Jair Alejandro Pinedo Pacheco, 
 
Greetings from Syncfusion. 
 
We have checked the reported problem “Tooltip doesn’t show for last value in AreaSeries in Xamarin.Forms Android” but it has been worked fine at our end.  To replicate it, we have also checked by using default tooltip and added template view to show the tooltip for last values. Both are working fine.  
 
Please find the tested sample, 
 
 
Could you please ensure us whether you have added any customization beyond the provided sample? If then could you please share it? 
 
Please share modified sample to replicate this issue. 
 
Could you please share your tested device configuration? 
 
Or else could you please share the last data point values? We ensured this with 0 as last point value. But it shows properly. 
 
Regards,
Hemalatha M. 



JA Jair Alejandro Pinedo Pacheco January 4, 2021 10:14 PM UTC

This is the AreaSeries that I am working on, the last point is the problem, is it ok with this image? or should I edit the sample project? I tested on android 8.0, 10  and 11 


HM Hemalatha Marikumar Syncfusion Team January 5, 2021 04:20 PM UTC

Hi Jair Alejandro Pinedo Pacheco, 
 
Thanks for your update. Currently we are ensuring this our end and we will share the status on or before January 7,2021, meanwhile could you please share the modified sample to ensure at our end and provide a possible solution at earlier. 
 
Regards,
Hemalatha M. 



SM Saravanan Madheswaran Syncfusion Team January 7, 2021 12:24 PM UTC

Hi Alejandro,  
 
Thanks for your patience.  
  
Further validating the reported issue, we would like to let you know that the actual behavior of the tooltip rendering in AreaSeries  is to show the tooltip on data points when we touch inside the chart area.

While comparing the provided screenshot, it seems too tiny on getting a touch interactive rectangle region, hence it will be shown tooltip only on its last segment.
  
 
 
 
With that conclusion and to make it at our end, we have prepared a workaround by overriding the ChartTooltipBehavior and finding and raising tooltip for nearest data points using GetDataPoints support.  
   
Please check the code snippet and sample from the below link.  
   
 
public class CustomTooltipBehavior : ChartTooltipBehavior 
    public ChartSeries Series { get; set; } 
    protected override void OnTouchUp(float pointX, float pointY) 
   
        var datapoints = (Series as AreaSeries).GetDataPoints(new Rectangle(pointX - 50, pointY - 50, 100, 100)); 
        List<Point> collection = new List<Point>(); 
        if (datapoints != null && datapoints.Count > 0) 
        
            int i = 0; 
            foreach (var data in datapoints) 
           
                var d = data as Model; 
                var x = Chart.ValueToPoint(Chart.PrimaryAxis, d.XValue - 1); // minus 1 to ensure the position lies inside the segment area.  
                var y = Chart.ValueToPoint(Chart.SecondaryAxis, 45); // y value mentioned as static with in minimum of all data points.  
 
                collection.Add(new Point(x, y)); 
                i++; 
           
       
 
        Point segmentPoint = new Point(pointX, pointY); 
        if (collection.Count > 0) 
       
            segmentPoint = FindNearestYPoint(collection, pointX); 
       
 
        this.Show((float)segmentPoint.X, (float)segmentPoint.Y, true); 
   
 
    private Point FindNearestYPoint(List<Point> collection, float pointX) 
   
        Point nearestPoint = collection[0]; 
        double div = pointX > nearestPoint.X ? pointX - nearestPoint.X : nearestPoint.X - pointX; 
        int i = 1; 
        while (i < collection.Count) 
       
            var nextPoint = collection[i]; 
            var temp_div = pointX > nextPoint.X ? pointX - nextPoint.X : nextPoint.X - pointX; 
            if (temp_div < div) 
           
                nearestPoint = nextPoint; 
                div = temp_div; 
           
 
            i++; 
       
 
        return nearestPoint; 
   
 
Also, we suggested to check other possible interaction support with SfChart. We hope ChartTrackballBehavior  also fulfill your requirement. Please check the below UG guidelines for more.  
 
 
Regards, 
Saravanan.  


Marked as answer
Loader.
Up arrow icon