Hi,
I'm using TeeChart 5 under VC8 and would be grateful for some help in defining and using custom functions. I have two FastLine series, and would like to add a third series, which is (series 1 - series 2) * 100. I add points to the series like this:
XValues.Create(VT_R8, 1, numElements);
YValues.Create(VT_R8, 1, numElements);
[add points to the arrays]
m_Graph.Series(seriesId).AddArray(index, YValues, XValues);
Do you have any sample code that shows how to create a third series and tie it to series1 and series2 using the relationship (series 1 - series 2) * 100?
Many thanks,
Sacha
VC++ and custom functions
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Sacha,
Yes, you can do something like this:
Hope this helps!
Yes, you can do something like this:
Code: Select all
long series1;
series1 = m_Chart1.AddSeries(scLine);
m_Chart1.Series(series1).FillSampleValues(10);
long series2;
series2 = m_Chart1.AddSeries(scLine) ;
m_Chart1.Series(series2).FillSampleValues(10);
long series3;
series3 = m_Chart1.AddSeries(scLine);
for (int i=0; i< m_Chart1.Series(series1).GetCount(); i++)
{
m_Chart1.Series(series3).AddXY(m_Chart1.Series(series1).GetXValues().GetValue(i),
(m_Chart1.Series(series1).GetYValues().GetValue(i)-
m_Chart1.Series(series2).GetYValues().GetValue(i))*100,"",clTeeColor);
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Hi Narcis,
Thanks for the sample. I was thinking more of using the custom function features in TeeChart to set up a relationship between two series. This would hopefully enable me to only have to populate series 1 and 2, and then the third series would be automatically populated. This is the most convenient implementation for my application.
Additionally, the graphs may not have the same X values. For instance:
Series 1:
X Y
1 1
2 2
3 3
4 4
Series 2:
X Y
0.5 6
1.7 7
1.9 8
2.9 9
Is this handled by the Function feature in TeeChart?
Kind regards,
Sacha
Thanks for the sample. I was thinking more of using the custom function features in TeeChart to set up a relationship between two series. This would hopefully enable me to only have to populate series 1 and 2, and then the third series would be automatically populated. This is the most convenient implementation for my application.
Additionally, the graphs may not have the same X values. For instance:
Series 1:
X Y
1 1
2 2
3 3
4 4
Series 2:
X Y
0.5 6
1.7 7
1.9 8
2.9 9
Is this handled by the Function feature in TeeChart?
Kind regards,
Sacha
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Sacha,
This supported in newer TeeChart Pro ActiveX versions (current version is number 8 ) where y=f(x) function is included. I'd recommend you to have a look at the fully functional evaluation version here. It includes examples of mentioned function usage.
In that case you should decide what to do with them if processing them as it's done with Y values, add a point for each X value in both series, etc.
This supported in newer TeeChart Pro ActiveX versions (current version is number 8 ) where y=f(x) function is included. I'd recommend you to have a look at the fully functional evaluation version here. It includes examples of mentioned function usage.
Code: Select all
Additionally, the graphs may not have the same X values.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Sacha,
Below there's an example of custom function available in TeeChart Pro v8 ActiveX.
Below there's an example of custom function available in TeeChart Pro v8 ActiveX.
Code: Select all
Private Sub UpdateChart()
'Force the recalculation function
TChart1.Series(0).FunctionType.BeginUpdate
TChart1.Series(0).FunctionType.EndUpdate
End Sub
Private Sub Form_Load()
UpdateChart
End Sub
Private Sub TChart1_OnFunctionCalculate(ByVal SeriesIndex As Long, ByVal X As Double, Y As Double)
Y = Sin(X / 10)
End Sub
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Sacha,
As I told you before, this function is not available in v5. Its usage would be exactly the same in VC++ just changing syntax is needed.
As I told you before, this function is not available in v5. Its usage would be exactly the same in VC++ just changing syntax is needed.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |