Scroll event implementation

TeeChart for ActiveX, COM and ASP
Post Reply
roger
Newbie
Newbie
Posts: 26
Joined: Thu May 10, 2007 12:00 am

Scroll event implementation

Post by roger » Fri Sep 24, 2010 8:30 am

Hello,
I am using TeeChart Pro Activex Control v7.

I want to get the min Y axes value and maximum Y axis value displayed in the graph at the current instance.
And i want it in the up arrow or down arrow pressed event.
For example suppose i have 260000 points and if right now only 260 points are visible then i want to get the maximum visible point.

I think it could be done by implementing the scroll event
Can you please tell me which should event should be registered?

Can you please help me with an sample code in VC++.

Thanks in advance,

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

Re: Scroll event implementation

Post by Yeray » Fri Sep 24, 2010 4:01 pm

Hi Roger,

If you are looking for the min and max visible Values, you could do something like following:

Code: Select all

Private Sub Form_Load()
  TeeCommander1.ChartLink = TChart1.ChartLink
   
  TChart1.AddSeries scPoint
  TChart1.Series(0).FillSampleValues 100
  
  TChart1.Tools.Add tcPageNumber
  TChart1.Page.MaxPointsPerPage = 20
End Sub

Private Sub TChart1_OnPageChange()
  TChart1.Environment.InternalRepaint
    TChart1.Header.Text.Text = "Min X: " + Str$(TChart1.Series(0).MinVisibleValue(0)) + ", " + _
                             "Max X: " + Str$(TChart1.Series(0).MaxVisibleValue(0)) + vbNewLine + _
                             "Min Y: " + Str$(TChart1.Series(0).MinVisibleValue(1)) + ", " + _
                             "Max Y: " + Str$(TChart1.Series(0).MaxVisibleValue(1))
End Sub
If you are looking for the first and last visible Indexes, change it for this:

Code: Select all

  TChart1.Header.Text.Text = "First Index: " + Str$(TChart1.Series(0).FirstValueIndex) + ", " + _
                             "Last Index: " + Str$(TChart1.Series(0).LastValueIndex)
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

roger
Newbie
Newbie
Posts: 26
Joined: Thu May 10, 2007 12:00 am

Re: Scroll event implementation

Post by roger » Mon Sep 27, 2010 9:19 am

Hi Yeray,
Thanks for your reply.

I tried implementing the GetFirstValueIndex() and GetLastValueIndex() but it returns -1 many times. in very rare cases it returns the values.

Is there any solution over it?
Thanks,

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

Re: Scroll event implementation

Post by Narcís » Mon Sep 27, 2010 10:51 am

Hi roger,

Are you using latest v7 release available at the client area? Do you get the same using TeeChart Pro v8 ActiveX evaluation version?

Thanks in advance.
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

roger
Newbie
Newbie
Posts: 26
Joined: Thu May 10, 2007 12:00 am

Re: Scroll event implementation

Post by roger » Mon Sep 27, 2010 12:35 pm

Hi Narcis,
I tested on ActiveXv7 and now i tried on ActiveXv8 also but it has the same issue.
The GetLastValueIndex mostly returns -1 and at some times returns 63 or 79 no other values are returned by the method.

Seems it is problematic.
Any other method which would return the maximum value displayed at current instance by the graph will also do.

Thanks,

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

Re: Scroll event implementation

Post by Narcís » Wed Sep 29, 2010 9:23 am

Hi roger,

Why not using axis minimum and maximum properties then? You'll find more information about them at tutorial 4. Tutorials are available 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

roger
Newbie
Newbie
Posts: 26
Joined: Thu May 10, 2007 12:00 am

Re: Scroll event implementation

Post by roger » Wed Sep 29, 2010 9:41 am

Hi,
Maximum and minimum returns the values of X/Y
Where as I want the maximum label in left axis. I am attaching an image where the left axis last label is rounded which must be retieved from the code
[img]
teechart1.JPG
Rounded value is to be retrieved
teechart1.JPG (12.3 KiB) Viewed 8765 times
[/img]

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

Re: Scroll event implementation

Post by Narcís » Wed Sep 29, 2010 9:54 am

Hi roger,

In that case you can use OnGetAxisLabel or OnGetNextAxisLabel event for that.
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

Post Reply