Creating a Contour Map. Very Slow
Posted: Tue Jul 28, 2015 3:33 pm
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();
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();