Distance factor for sampling and clustering


Author
Message
Leonardo Rocha
Leonardo Rocha
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)
Group: Forum Members
Posts: 7, Visits: 1

Hi,

I am trying to set up the sampling distance and also the clustering distance in order to render each point without overlap, i.e., all point are draw, excepting the points that will have the same (x,y) coordinates in the screen. This should take in account the axes ranges.

Rgds,

Leo


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 Leo,

For this purpose you will have to determine how the logical units map to actual screen pixels. The following code snippet shows how to acheive this:

nChartControl1.Document.Calculate();
nChartControl1.Document.RecalcLayout(nChartControl1.View.Context);

NChart chart1 = nChartControl1.Charts[0];
NAxis xAxis = chart.Axis(StandardAxis.PrimaryX);
NAxis yAxis = chart.Axis(StandardAxis.PrimaryY);

NRange1DD xRulerRange = xAxis.Scale.RulerRange;
NRange1DD yRulerRange = yAxis.Scale.RulerRange;

NRange1DF xModelRange = xAxis.Scale.Ruler.LogicalToScale(xRulerRange);
NRange1DF yModelRange = yAxis.Scale.Ruler.LogicalToScale(yRulerRange);

float xPixelsPerUnit = (float)(xModelRange.GetLength() / xRulerRange.GetLength());
float yPixelsPerUnit = (float)(yModelRange.GetLength() / yRulerRange.GetLength());

m_Point.ClusterDistanceFactor = 0.5 / Math.Max(xPixelsPerUnit, yPixelsPerUnit);

If the number of data points is too large there is a more efficient implementation and it is to resample the data using a bitmap of some sort. This will always perform with linear speed instead of n log (n) speed which is the case with the cluster at the expense of more memory in the general case.

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



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

Login

Explore
Messages
Mentions
Search