Page 1 of 1
AnswerVector
Posted: Tue May 22, 2012 8:49 pm
by 16662032
Hi,
I'm trying to retrieve the coefficients of a fit on some data via otemp:FunctionType:asCurveFit:answervector. But it looks like the answervector array isn't accessible.
Could you check this please?
I'm using the 2011.0.0.5 version.
TIA,
Jack
Re: AnswerVector
Posted: Wed May 23, 2012 10:28 am
by yeray
Hi Jack,
the following code seems to work fine for me here in VB6, doesn't it for you?
Code: Select all
Private Sub Form_Load()
TChart1.Aspect.View3D = False
TChart1.AddSeries scFastLine
TChart1.Series(0).FillSampleValues 200
TChart1.AddSeries scFastLine
TChart1.Series(1).SetFunction tfCurveFit
TChart1.Series(1).DataSource = TChart1.Series(0)
Dim t As Integer
Dim tmp As String
tmp = "y="
With TChart1.Series(1).FunctionType.asCurveFit
For t = 1 To .PolyDegree
tmp = tmp + " "
If .AnswerVector(t) >= 0 Then
tmp = tmp + "+"
End If
tmp = tmp + Format$(.AnswerVector(t), "0.0##") + "*x"
If t > 1 Then
tmp = tmp + "^" + Str$(t)
End If
Next t
TChart1.Header.Text.Text = tmp
End With
End Sub
Re: AnswerVector
Posted: Wed May 23, 2012 7:02 pm
by 16662032
Hi Yeray,
Unfortunately i don't have VB6.
Do you have a working example in MS Word/Excel?
You can send it via PM.
TIA,
Jack
Re: AnswerVector
Posted: Thu May 24, 2012 9:52 am
by yeray
Hi Jack,
I've opened the "TeeChart Pro Inserted into Excel.xls" example shipped with the v2012.0.0.1 installation, in "\Examples\MSOffice\VBA Excel". I've opened the VB editor (Alt+F11), opened the Sheet1 in it and changed the code in CommandButton1_Click for the code I've shown you in my last post.
Find attached the result
Re: AnswerVector
Posted: Thu May 24, 2012 2:59 pm
by 16662032
Hi Yeray,
Thanks for the file.
Here are my test results:
PC1: WinXP 32 bit, Excel 2003, Teechart 2011.0.0.5: OK
PC2: WIN7 32 bit, Excel 2010, Teechart 2011.0.0.5: OK
PC3: WIN7 64 bit, Excel 2010 64 bit, Teechart 2011.0.0.5: Error, runtime error '424' Object required.
PC3: WIN7 64 bit, Excel 2010 64 bit, Teechart 2012.0.0.1 (32 bit): Error, runtime error '424' Object required.
PC4: WIN7 64 bit, Excel 2010 64 bit, with fresh install of Teechart 2012 (32 bit and working demos): Error, runtime error '424' Object required.
I will try to find other PC configurations tomorrow to do some more testing.
There is definitly something weird going on (see my post a few weeks ago) and it looks like 64 bit (Excel or WIN7) is a factor in this.
Greetings,
Jack
Re: AnswerVector
Posted: Fri May 25, 2012 5:29 am
by 15046294
Additional
PC5: WIN7 64 bit, Excel 2007 (32 bit), Teechart 2010.0.0.2: OK
Re: AnswerVector
Posted: Fri May 25, 2012 10:41 am
by yeray
Hi Jack,
It seems to work fine here in Win7 x64 + Office x64.
I've modified the VB code a little bit to both show the formula and the TeeChart version. Instead of:
I use:
Code: Select all
TChart1.Header.Text.Text = TChart1.Version
TChart1.Header.Text.Add tmp
And this is what I get:
- test.png (54.24 KiB) Viewed 15696 times
Re: AnswerVector
Posted: Fri May 25, 2012 10:44 am
by yeray
Hi Jack,
Note the first version including a 64bit ocx is the latest one: v2012.0.0.1. And the 64bit ocx is needed if you want to use TeeChart in an Office x64. So please, make sure you have the latest version installed and both 32 and 64 bit ocx are registered in the machine.
Re: AnswerVector
Posted: Sat May 26, 2012 2:05 pm
by 16662032
Hi Yeray,
It works.
My mistake. I wasn't aware that I had to use the 64 bit ocx in a full 64 bit OS+app.
Thanks,
Jack