Completed
Last Updated: 26 Jun 2015 07:45 by ADMIN
ADMIN
Dimitar
Created on: 04 Jun 2015 13:38
Category: ChartView
Type: Bug Report
0
FIX. RadChartView - NullReferenceException when a data point with null value is hovered with the mouse.
To reproduce:
- Add line series with large point size and null points.
- Hover a near a point which is close to null point (the line break).

Workaround:
public class MyChartTooltipController : ChartTooltipController
{
    protected override ActionResult OnMouseMove(MouseEventArgs e)
    {
        for (int i = 0; i < this.Area.Series.Count; i++)
        {
            DataPoint point = this.Area.Series[i].HitTest(e.X, e.Y);
            DataPoint hoveredPoint = typeof(ChartTooltipController).GetField("hoveredPoint", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(this) as DataPoint;
            ToolTip toolTip = typeof(ChartTooltipController).GetField("toolTip", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(this) as ToolTip;
            if (point != null && hoveredPoint != point)
            {
                hoveredPoint = point;
                var result = typeof(CategoricalDataPoint).GetMethod("GetTooltipValue", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).Invoke(hoveredPoint, null);
                
                if (result == null)
                {
                    return new ChartRefreshResult();
                }
            }
        }
        return base.OnMouseMove(e);
    }
}



 
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments