Profile Picture

NHitTestResult and NTriangulatedSurfaceSeries

Posted By Ignacio Mendiguren 11 Years Ago
Author
Message
Ignacio Mendiguren
Posted 11 Years Ago
View Quick Profile
Junior Member

Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 20, Visits: 1
Hi,

I have changed a chart where I was using NGridSurfaceSeries to use NTriangulatedSurfaceSeries
On the MouseMove I was using NHitTestResult to obtain the values of the serie in the chart when the user moves the mouse over the chart.
However, after changing the series type to NTriangulatedSurfaceSeries, it seems NHitTestResult returns datapointindex = -1 everytime.

How or what should I use with NTriangulatedSurfaceSeries?

Thanks,

Ignacio


Nevron Support
Posted 11 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: Last Week
Posts: 3,054, Visits: 4,009
Hi Ignacio,

In general the hit test for surface series is based on the polygons that are formed by adjacent data points. The data points themselves cannot be hit-tested. For the Grid and Mesh surface series it is possible to relate a surface "segment" with a data point - when a rectangular segment is hit, the chart returns the index of the "left-bottom" data point in the grid. For Triangulated surface the segments are arbitrary triangles and such relation is not possible. For this series type the chart returns a NSurfaceTriangle object that has the indices of the three data points that form the hit triangle.


void OnChartControlMouseDown(object sender, MouseEventArgs e)
{
NHitTestResult result = nChartControl1.HitTest(e.X, e.Y);

NSurfaceTriangle tr = result.Object as NSurfaceTriangle;
if (tr == null)
return;

NTriangulatedSurfaceSeries surface = tr.ParentNode as NTriangulatedSurfaceSeries;

int index1 = tr.DataPointIndex1;
int index2 = tr.DataPointIndex2;
int index3 = tr.DataPointIndex3;
}


It is possible to implement "exact" hit testing for all types of surface series - that is in case you need the exact scale coordinates of the clicked point on the surface. We have such examples for Grid and Triangulated surface series, please contact Nevron support if you need them.


Best Regards,
Nevron Support Team



Ignacio Mendiguren
Posted 11 Years Ago
View Quick Profile
Junior Member

Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 20, Visits: 1
I updated my code with the examples provided by mail, everything working perfectly.

Many thanks,

IM



Similar Topics


Reading This Topic