Page 1 of 1

Surface Series AddXYZ()

Posted: Wed Jul 18, 2007 1:00 pm
by 9536092
I'm using TeeChart ActiveX 7.0.1.4 with VC++. I have multiple charts in a dialog with one chart using using a SurfaceSeries to display a 3D image of a set of 384 x 576 sensor grid values. That's a total of 221,184 Z-values that I am adding to the series. I'm doing that via the AddXYZ() function which takes 1.0 to 1.5 seconds to load that many points. I need to speed that up quite a bit.

I've read the article about realtime charting (VCL version) but some of those function calls aren't available for ActiveX 7.0.1.4 that I can find. Here is a code snippet where I'm loading the values:

Code: Select all

CSurfaceSeries SurfaceSeriesHigh = m_ctrlChart3DHigh.Series(0).GetAsSurface();
SurfaceSeriesHigh.GetPen().SetVisible(FALSE);
	
SurfaceSeriesHigh.SetNumXValues(HIGHRESWIDTH);
SurfaceSeriesHigh.SetNumZValues(HIGHRESLENGTH);

for(nRow = 0; nRow < 576; nRow++)
{
	for(nCol = 0; nCol < 384; nCol++)
	{
		if(m_byHighResData[nRow][nCol] != 0)
		{
			SurfaceSeriesHigh.AddXYZ((double)nCol, (double)m_byHighResData[nRow][nCol], (double)nRow, "", m_crefHighResPal[m_byHighResData[nRow][nCol]]);
		}
	}
}
How can I speed up the loading of this series in VC++ with the ActiveX version of TeeChart?

Thanks.

Posted: Mon Jul 23, 2007 8:17 am
by yeray
Hi pdm1999,

Could you please tell us with which vcl functions do you have problems? We'll try to suggest you activex functions.

Posted: Mon Jul 23, 2007 1:03 pm
by 9536092
I was referring to the article "Real-time charting in TeeChart VCL" which shows a way to avoid the AddXYZ() function call and access the TeeChart series values directly. Under the section "Populate Series With Data", it uses the following code:

Code: Select all

  { set our X array }
  With Series1.XValues do
  begin
    Value:=TChartValues(X);  { <-- the array }
    Count:=Num;               { <-- number of points }
    Modified:=True;           { <-- recalculate min and max }
  end;

  { set our Y array }
  With Series1.YValues do
  begin
    Value:=TChartValues(Y);
    Count:=Num;
    Modified:=True;
  end;
However, I do not see any Series1.XValues or Series1.YValues function in the ActiveX version. There is a GetZValues() function but none for X or Y.

Am I correct in thinking that bypassing the AddXYZ() function for large numbers of data points and directly adding the data to TeeChart would be much faster? If so, then how would do I do that in the ActiveX version?

Thanks.

Posted: Mon Jul 23, 2007 2:41 pm
by Pep
Hi,
However, I do not see any Series1.XValues or Series1.YValues function in the ActiveX version. There is a GetZValues() function but none for X or Y.
You should be able to do this :

Code: Select all

 m_chart1.Series(0).GetXValues().SetModified(True);
 m_chart1.Series(0).GetXValues().SetValue(xx);
 m_chart1.Series(0).GetYValues().SetModified(True);
 m_chart1.Series(0).GetYValues().SetValue(xx);
Am I correct in thinking that bypassing the AddXYZ() function for large numbers of data points and directly adding the data to TeeChart would be much faster? If so, then how would do I do that in the ActiveX version?
The faster way is by adding the data using Arrays, as in the article or using for example :
m_chart1.GetSeries(0).GetAsSurface().AddArrayXYZ((COleVariant)(short)(Fourier
),(COleVariant)(short)(Fourier),(COleVariant)(short)(Fourier));

If you want you can compare it also adding data directly using AddXYZ method, iterating through all the values.