Page 1 of 1

Add function to Tee-chart

Posted: Fri Jul 12, 2013 12:18 pm
by 16664962
My application is developed in C++ using MFC.

I have two series added in the Tee-chart.
Series are filled with the arrays.
Code to add array to series:
m_Chart1.Series(seriesIndex).AddArray(safeArrayLength,YValues,XValues);

Now, I want to add a function called 'Curve Fitting'
Steps followed:
1. Create new series
long seriesIndex = m_Chart1.AddSeries(scLine);
2. Set function for series
m_Chart1.Series(seriesIndex).SetFunction(tfCurveFit);
3. Set datasource for series
m_Chart1.Series(0).CheckDataSource();
m_Chart1.Series(seriesIndex).SetDataSource(m_Chart1.Series(0).GetDataSource());

Result:
Using the code mentioned above in steps:
1. New series is added to Tee-chart
2. Function is set to newly added series.
3. But data source is not set for the function.
I get Bad pointer returned from m_Chart1.Series(0).GetDataSource().

My problem is i didn't get the valid data-source from series 0.

Please suggest me how should i set data source to series and also suggest how should i add the function to Tee-chart.

Re: Add function to Tee-chart

Posted: Mon Jul 15, 2013 3:39 pm
by narcis
Hello,

There's a VC++ example at tutorial 15, at the bottom of the Coding TeeChart for runtime section. Tutorails can be found at TeeChart's program group. Can you please check if that works at your end?

Thanks in advance.

Re: Add function to Tee-chart

Posted: Thu Jul 18, 2013 10:32 am
by 16664962
Thanks for your reply.

In TeeChart2011.chm tutorial 15 is regarding XML Export & Import.
Tutorial 7 is Working with Functions, but sample code given in tutorial is in VB.

I need to set same data source of existing series to the newly added series.

I could not find the VC++ example Coding TeeChart for run time section.
Please let me know where should i look for the C++ example for adding a function.

Re: Add function to Tee-chart

Posted: Thu Jul 18, 2013 10:37 am
by narcis
Hello,

Are you using TeeChart ActiveX? The tutorial file you mention corresponds to TeeChart for .NET.

Re: Add function to Tee-chart

Posted: Fri Jul 19, 2013 4:28 am
by 16664962
Thanks for the reply.
Yes, i am using TeeChart ActiveX. I found the correct tutorial file.
Using VC++ equivalent code provided in tutorial 15 i am able to set same data source of existing series to the newly added series.