TeeChart for ActiveX, COM and ASP
-
Guilz
- Newbie

- Posts: 46
- Joined: Mon Nov 13, 2006 12:00 am
Post
by Guilz » Thu Oct 01, 2009 1:55 pm
Hi,
Is it possible to add user calculated chart ?
ie: I have 2 charts. I want a new chart (chart3) who is the difference between Chart1 and Chart2.
If I add new point in Chart 1 and Chart2, I want Chart3 reflecting this change automatically.
Does it exist a functionnality of Teechart to add chart based on a user formula (in my case it is a difference but I would like to specify my own formula ex Chart1 + 0.75485*Chart2 ...
Thanks for your help
Guilz
-
Narcís
- Site Admin

- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Fri Oct 02, 2009 8:15 am
Hi Guilz,
Yes, there are subtract and y=f(x) functions. Please have a look at the All Features\Welcome!\Functions examples in the features demo and read tutorial 7. Demo and tutorials are available at TeeChart's program group.
-
Guilz
- Newbie

- Posts: 46
- Joined: Mon Nov 13, 2006 12:00 am
Post
by Guilz » Fri Oct 02, 2009 8:33 am
Hi Narcis,
y=f(x) is not what I'am looking for
CalculateMany Function is used to calculate function result if multiple series can be datasource, it is what i am looking for
Tell me if I'm wrong but the
CalculateMany function is not available for Teechart ActiveX but only for VCL...
Guilz
-
Yeray
- Site Admin

- Posts: 9645
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Fri Oct 02, 2009 10:22 am
Hi Guilz,
Note that CalculateMany function is a function present into some TeeChart functions.
Please, try to explain what are you exactly trying to do here and we'll try to suggest you the best way we can find to achieve it.
-
Guilz
- Newbie

- Posts: 46
- Joined: Mon Nov 13, 2006 12:00 am
Post
by Guilz » Fri Oct 02, 2009 10:36 am
Yeray,
I have 1 chart with 2 series (S1 and S2).
I want to add a new serie S3 reflecting changes of S1 and S2 by a function like S3= S1-S2 (*)
If a new point is added to S1 and S2, S3 must automaticaly reflect this change and add the new calculated point defined by the formula (*)
Hope it is help you to understand what I am looking for
Guilz
-
Yeray
- Site Admin

- Posts: 9645
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Fri Oct 02, 2009 11:13 am
Hi Guilz,
I think I agree with Narcís. If I understood well you are trying to do something as follows:
Code: Select all
Private Sub Command1_Click()
Dim diff As Double
diff = TChart1.Series(0).YValues.Maximum - TChart1.Series(0).YValues.Minimum
TChart1.Series(0).Add (Rnd * diff / 5) - diff / 10 + TChart1.Series(0).YValues.Minimum, "", clTeeColor
diff = TChart1.Series(1).YValues.Maximum - TChart1.Series(1).YValues.Minimum
TChart1.Series(1).Add (Rnd * diff / 5) - diff / 10 + TChart1.Series(1).YValues.Minimum, "", clTeeColor
TChart1.Series(2).CheckDataSource
TChart1.Axis.Bottom.SetMinMax 0, TChart1.Series(0).Count - 1
End Sub
Private Sub Form_Load()
TeeCommander1.Chart = TChart1
TChart1.Aspect.View3D = False
TChart1.AddSeries scPoint
TChart1.AddSeries scPoint
TChart1.AddSeries scLine
TChart1.Series(0).FillSampleValues 25
TChart1.Series(1).FillSampleValues 25
TChart1.Series(2).SetFunction tfCustom
TChart1.Series(2).DataSource = "Series0,Series1"
TChart1.Axis.Bottom.SetMinMax 0, TChart1.Series(0).Count - 1
End Sub
Private Sub TChart1_OnFunctionCalculate(ByVal SeriesIndex As Long, ByVal X As Double, Y As Double)
Y = TChart1.Series(0).YValues.Value(X) - TChart1.Series(1).YValues.Value(X)
End Sub
-
Guilz
- Newbie

- Posts: 46
- Joined: Mon Nov 13, 2006 12:00 am
Post
by Guilz » Fri Oct 02, 2009 11:21 am
Fantastic Yeray, it is exactly what I was looking for
thanks a lot
Guilz