I'm handling the MouseDown event on NChartControl and checking if the user clicked a DataPoint inside the handler:
NHitTestResult ht = nChartControl1.HitTest(e.X, e.Y);
if(ht.ChartElement == ChartElement.DataPoint)
{
// do some stuff
}
The chart is also updated multiple times -- it is a scatter plot and I redraw it based on some parameters.
This works most of the time, but sometimes there's a NullReferenceException thrown by the HitTest call. nChartControl1 is not null and the event args have reasonable values.
Any idea what could be going wrong? Thanks.