AnswerVector

TeeChart for ActiveX, COM and ASP
Post Reply
JKO
Newbie
Newbie
Posts: 16
Joined: Mon Mar 26, 2012 12:00 am

AnswerVector

Post by JKO » Tue May 22, 2012 8:49 pm

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

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: AnswerVector

Post by Yeray » Wed May 23, 2012 10:28 am

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
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

JKO
Newbie
Newbie
Posts: 16
Joined: Mon Mar 26, 2012 12:00 am

Re: AnswerVector

Post by JKO » Wed May 23, 2012 7:02 pm

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

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: AnswerVector

Post by Yeray » Thu May 24, 2012 9:52 am

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
TeeChart Pro Inserted into Excel.zip
(29.45 KiB) Downloaded 974 times
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

JKO
Newbie
Newbie
Posts: 16
Joined: Mon Mar 26, 2012 12:00 am

Re: AnswerVector

Post by JKO » Thu May 24, 2012 2:59 pm

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

Jack
Newbie
Newbie
Posts: 24
Joined: Wed Aug 01, 2007 12:00 am

Re: AnswerVector

Post by Jack » Fri May 25, 2012 5:29 am

Additional

PC5: WIN7 64 bit, Excel 2007 (32 bit), Teechart 2010.0.0.2: OK

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: AnswerVector

Post by Yeray » Fri May 25, 2012 10:41 am

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:

Code: Select all

TChart1.Header.Text.Text =  tmp
I use:

Code: Select all

TChart1.Header.Text.Text = TChart1.Version
TChart1.Header.Text.Add tmp
And this is what I get:
test.png
test.png (54.24 KiB) Viewed 15520 times
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: AnswerVector

Post by Yeray » Fri May 25, 2012 10:44 am

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.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

JKO
Newbie
Newbie
Posts: 16
Joined: Mon Mar 26, 2012 12:00 am

Re: AnswerVector

Post by JKO » Sat May 26, 2012 2:05 pm

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

Post Reply