Page 1 of 1

Creating a Contour Map. Very Slow

Posted: Tue Jul 28, 2015 3:33 pm
by 13050364
Hi

Im creating a contour plot from 30 2D lines each of which have 1025 points. The code Im using looks something like as shown below.
It works and creates the contour OK. The problem is it takes over a minute to do it. Is there a quicker method?
Note Im using a fairly old version of Teechart (version 3.5.3187.15585). Perhaps a newer version of Teechart would be quicker??

-----------------------------------------------------------------------------------------------------------------------

newContour = new Contour(spectrumChart.Chart);
int numberOfSeries = spectrumChart.Series.Count;
double theNum = 0;


int a = 0;
while (a < numberOfSeries - 1)
{
int numberOfValues = spectrumChart.Series[a].Count;

int b = 0;
while (b < numberOfValues)
{

double y1 = spectrumChart.Series[a].YValues;
if (y1 == 0)
{
if (b > 0)
y1 = spectrumChart.Series[a].YValues;
else
{
y1 = 0.5;
}
}
theNum = theNum + 1;
newContour.Add(spectrumChart.Series[a].XValues, y1, theNum);
b = b + 1;
}
a = a + 1;
}


newContour.UsePalette = true;
newContour.UseColorRange = false;
newContour.IrregularGrid = true;
newContour.ClearPalette();

Re: Creating a Contour Map. Very Slow

Posted: Thu Jul 30, 2015 11:16 am
by narcis
Hi Dave,

Contour series should be populated as described here. Setting IrregularGrid to true makes the chart calculation slower so please try to avoid it unless it's strictly necessary.

If you want us to look at the problem thoroughly, please attach a Short, Self Contained, Correct (Compilable), Example.

Thanks in advance.