A Faster HitTest?


Author
Message
Mark Malburg
Mark Malburg
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)
Group: Forum Members
Posts: 11, Visits: 66
I'm working with a GridSurface chart with millions of points.  I want some double-click behaviors as follows:

1. Double-click the legend or the vertical axis... bring up a scaling dialog
2. Double-click the plot or the walls... restore the viewing angle (elevation, rotation, zoom, height)

My problem is that the hit test is very slow when I have a million or so points.  The use will double-click, and then double-click again thinking that the first one wasn't handled.

private void nChartControl1_MouseDoubleClick(object sender, MouseEventArgs e)
{
   // this handler is called immediately after the double click, but the HitTest function takes too much time. 
   NHitTestResult result = nChartControl1.HitTest(e.X, e.Y);
   // do something with "result"
}

Is there anyway I can do a hit test in a faster way?  Perhaps ignore the plot and just check for walls, legend and axes?

Thanks,
 
    - Mark






Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Mark,

You can workaround this by removing the surface series from the series collection before hit testing and then adding it again after you're done with the hit test. You can also freeze the axes ranges before you hit test to ensure that the chart hit tests a plot with exactly the same axis ranges - for example:

   // before hit test (fix the axis ranges as they were before you removed the grid surface
   StandardAxis[] axisIds = new StandardAxis[] { StandardAxis.PrimaryX, StandardAxis.PrimaryY, StandardAxis.Depth };

   foreach (StandardAxis axisId in axisIds)
   {
    NRange1DD rulerRange = chart.Axis(axisId).Scale.RulerRange;
    chart.Axis(axisId).View = new NRangeAxisView(rulerRange, true, true);
   }

   // after hit test - restore the default axis view
   foreach (StandardAxis axisId in axisIds)
   {
    chart.Axis(axisId).View = new NContentAxisView();
   }

Hope this helps - let us know if you meet any problems or have any questions.


Best Regards,
Nevron Support Team


Mark Malburg
Mark Malburg
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)
Group: Forum Members
Posts: 11, Visits: 66
I think I'm tracking with you... but how do I undo this after the hit test?

   - Mark
Mark Malburg
Mark Malburg
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)
Group: Forum Members
Posts: 11, Visits: 66
Since my data sets are huge... is there a quick way to remove it prior to the hit test and then quickly restore it after the hit test?
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Mark,
You can set the Visible property of the surface series to false before hit testing and then to true again when hit testing is done. We may also consider to implement a hardware accelerated hit test for the new release.

Best Regards,
Nevron Support Team


Kiran Varanasi
Kiran Varanasi
Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)
Group: Forum Members
Posts: 0, Visits: 4
I am using NChartControl in a winform application.  This have curve created from NPointSeries. 
Selecting the curve take multiple attempts as the selection has to be accurate. The HitTest method takes the location input to confirm if the chartelement selected is a data point. 
Is there a way to provide some kind of tolerance, so that user can pick the curve with slightly lesser accuracy of location?


Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Kiran,
You can perform hit test for all the points that surround the point in question and then return the most commonly returned chart element. Hope this helps - let us know if you meet any problems.


Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic
1 active, 1 guest, 0 members, 0 anonymous
No members currently viewing this topic!

Login

Explore
Messages
Mentions
Search