Page 1 of 1

trendline problem still

Posted: Tue Apr 13, 2004 4:42 pm
by 9080875
ok, i went thru the tutorial, i can add a trendline just fine using the sample code provided, but in my app the DataSource property doesn't take, i checked the values for the added series in the editor, everything is added, everything is set properly EXCEPT the datasource, it is blank, I've loaded the series name dynamically and explicitly in anattempt to get it to register with the chart...to no avail, are there any limitations on the name? can I just give it the index of the target series?

Posted: Wed Apr 14, 2004 1:14 pm
by Chris
Hi --
ok, i went thru the tutorial, i can add a trendline just fine using the sample code provided, but in my app the DataSource property doesn't take, i checked the values for the added series in the editor, everything is added, everything is set properly EXCEPT the datasource, it is blank, I've loaded the series name dynamically and explicitly in anattempt to get it to register with the chart...to no avail, are there any limitations on the name? can I just give it the index of the target series?
There's an AccessExample on the attacment newsgroup:
news://www.berneda.com/steema.public.attachments

the subject line is: "RE: Error: (MEMO) Displayed instead of field info"

Would you mind modifying this example (and reposting it to attachments) so I can reproduce your problem here?

Many thanks

weird...

Posted: Wed Apr 14, 2004 3:59 pm
by 9080875
i actually thought for awhile that there was a problem with spaces in a Series name/title....anyway, that is not the case, the code pasted here tries to add a trendline DataSource based on the Title of another series, based on the following comment in the example...

'Datasource accepts the Series titles of the other 2 Series


this doesn't seem to work, I got it to work in my App by appending the Series Index which i keep around to the string literal "Series", i.e. if I want a Trendline on a Series with an index of 5, i build the string "Series5", set that as the Datasource property and it works....if I then look in the editor, the data is right, the trendline is right, and the Series DataSource shows the Title of the targeted series!!! even if the acual title is "yyyyzzzz"....


here is the code that tries to use the Title and then tries the same DataSource with the literal string, "Series" & n

'*****************************************************


Option Explicit

Private Sub Command1_Click(Index As Integer)
With TChart1


If Index = 0 Then
' Add a series to be used for an Trend Function
.AddSeries scLine
'Define the Function Type for the new Series
.Series(2).SetFunction tfTrend
'Define the Datasource for the new Function Series
'Datasource accepts the Series titles of the other 2 Series
.Series(2).DataSource = .Series(1).Title
' *Note - When populating your input Series manually you will need to
' use the Checkdatasource method
' - See the section entitled 'Defining a Datasource'

.Series(2).FunctionType.PeriodStyle = psRange

.Series(2).CheckDataSource
Else
' Add a series to be used for an Trend Function
.AddSeries scLine
'Define the Function Type for the new Series
.Series(2).SetFunction tfTrend
'Define the Datasource for the new Function Series
'Datasource accepts the Series titles of the other 2 Series
.Series(2).DataSource = "Series1"

' *Note - When populating your input Series manually you will need to
' use the Checkdatasource method
' - See the section entitled 'Defining a Datasource'
'Change the Period of the Function so that it groups averages
'every 2 Points
.Series(2).FunctionType.PeriodStyle = psRange

.Series(2).CheckDataSource
End If
End With
End Sub

Private Sub Form_Load()
'

With TChart1
.Aspect.View3D = False
'Add 2 data Series
.AddSeries scLine
.AddSeries scLine
' Populate them with data (here random)
.Series(0).FillSampleValues 10
.Series(1).FillSampleValues 10
.Series(1).Title = "any name other then SeriesN "
.Series(0).Title = "xyz"
End With



End Sub

Posted: Wed Apr 14, 2004 4:24 pm
by Chris
Hi --
'Datasource accepts the Series titles of the other 2 Series

this doesn't seem to work,
No, you should be using:

Code: Select all

.Series(2).DataSource = .Series(1).Name
instead of:

Code: Select all

.Series(2).DataSource = .Series(1).Title

Posted: Wed Apr 14, 2004 7:11 pm
by 9080875
thanks