Profile Picture

A Faster HitTest?

Posted By Mark Malburg 7 Years Ago
Author
Message
Nevron Support
Posted 6 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:38 AM
Posts: 3,054, Visits: 4,006
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



Kiran Varanasi
Posted 6 Years Ago
View Quick Profile
Forum Newbie

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
Last Active: 6 Years Ago
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
Posted 7 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:38 AM
Posts: 3,054, Visits: 4,006
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



Mark Malburg
Posted 7 Years Ago
View Quick Profile
Forum Newbie

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
Last Active: 3 days ago @ 4:07 AM
Posts: 11, Visits: 64
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?

Mark Malburg
Posted 7 Years Ago
View Quick Profile
Forum Newbie

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
Last Active: 3 days ago @ 4:07 AM
Posts: 11, Visits: 64
I think I'm tracking with you... but how do I undo this after the hit test?

   - Mark

Nevron Support
Posted 7 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:38 AM
Posts: 3,054, Visits: 4,006
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
Question Posted 7 Years Ago
View Quick Profile
Forum Newbie

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
Last Active: 3 days ago @ 4:07 AM
Posts: 11, Visits: 64
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









Similar Topics


Reading This Topic