Problem creating subtraction serie at client

TeeChart for ActiveX, COM and ASP
Post Reply
fjarvirkni
Newbie
Newbie
Posts: 8
Joined: Mon Dec 04, 2006 12:00 am

Problem creating subtraction serie at client

Post by fjarvirkni » Tue Dec 12, 2006 2:32 pm

Hello.

I am using VBScript to manipulate ActiveX TeeChart version 7.0.1.3. The problem is that the datasources are not set. I get the serie and the function type is correct but the datasources are not set. I can open the editor and add the series manually but the following code does not work. What is the problem here?

sub AddDifferenceSerie()
Dim dsNum
'Add line
axChart.AddSeries(0)
dsNum = axChart.SeriesCount - 1
With axChart.Series(dsNum)
.Title = "Difference"
.Color = 0
.SetFunction 2 'tfSubtract
.DataSource = axChart.Series(0).Title & "," & axChart.Series(1).Title
End With
End sub

Regards, fjarvirkni.
Last edited by fjarvirkni on Thu Dec 14, 2006 12:25 pm, edited 1 time in total.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Dec 12, 2006 2:45 pm

Hi fjarvirkni,

You may need to call CheckDataSource method as told in Tutorial 7 - Working with Functions. You'll find the tutorials at TeeChart's program group.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

fjarvirkni
Newbie
Newbie
Posts: 8
Joined: Mon Dec 04, 2006 12:00 am

Post by fjarvirkni » Thu Dec 14, 2006 11:12 am

I have added the CheckDataSource but that does not do anything. The code is now as follows:

sub AddDifferenceSerie()
Dim dsNum
'Add line
axChart.AddSeries(0)
dsNum = axChart.SeriesCount - 1
With axChart.Series(dsNum)
.Title = "Difference"
.Color = 0
.SetFunction 2 'tfSubtract
.DataSource = axChart.Series(0).Title & "," & axChart.Series(1).Title
.CheckDataSource
End With
End sub

Is there any restrictions on the Charts Titles? The chart titles are formatted like "Location - device, measurement" i.e. with a comma. Is that allowed?

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Dec 18, 2006 5:57 pm

Hi,

the problem is that you've to pass the Series name as DataSource, not the Series title :

Code: Select all

Dim dsNum
TChart1.Series(0).Name = "seriesname"
'Add line
TChart1.AddSeries (0)
dsNum = TChart1.SeriesCount - 1
With TChart1.Series(dsNum)
.Title = "Difference"
.Color = 0
.SetFunction 2 'tfSubtract
.DataSource = TChart1.Series(0).Name
.CheckDataSource
End With

Post Reply