Page 1 of 1

Problem creating subtraction serie at client

Posted: Tue Dec 12, 2006 2:32 pm
by 9533243
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.

Posted: Tue Dec 12, 2006 2:45 pm
by narcis
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.

Posted: Thu Dec 14, 2006 11:12 am
by 9533243
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?

Posted: Mon Dec 18, 2006 5:57 pm
by Pep
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