Page 1 of 1

Scroll event implementation

Posted: Fri Sep 24, 2010 8:30 am
by 9535061
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,

Re: Scroll event implementation

Posted: Fri Sep 24, 2010 4:01 pm
by yeray
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)

Re: Scroll event implementation

Posted: Mon Sep 27, 2010 9:19 am
by 9535061
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,

Re: Scroll event implementation

Posted: Mon Sep 27, 2010 10:51 am
by narcis
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.

Re: Scroll event implementation

Posted: Mon Sep 27, 2010 12:35 pm
by 9535061
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,

Re: Scroll event implementation

Posted: Wed Sep 29, 2010 9:23 am
by narcis
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.

Re: Scroll event implementation

Posted: Wed Sep 29, 2010 9:41 am
by 9535061
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 8763 times
[/img]

Re: Scroll event implementation

Posted: Wed Sep 29, 2010 9:54 am
by narcis
Hi roger,

In that case you can use OnGetAxisLabel or OnGetNextAxisLabel event for that.