Profile Picture

Distance factor for sampling and clustering

Posted By Leonardo Rocha 13 Years Ago
Author
Message
Leonardo Rocha
Posted 13 Years Ago
View Quick Profile
Forum Newbie

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
Last Active: 12 Years Ago
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
Posted 13 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 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





Similar Topics


Reading This Topic