Wheel zoom

TeeChart for ActiveX, COM and ASP
Post Reply
guilz2010
Newbie
Newbie
Posts: 63
Joined: Thu Nov 25, 2010 12:00 am
Location: Paris, France

Wheel zoom

Post by guilz2010 » Mon Jul 04, 2011 7:19 am

Hi,

I would like to zoom with the mouse wheel (I don't want to push the wheel button but when I use the wheel I want the chart
- to zoom in near the latest data with the first wheel way
- to zoom out with the other wheel way

How can I do this with Teechart v8 ?

Thanks a lot for your help

Guilz

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

Re: Wheel zoom

Post by Yeray » Mon Jul 04, 2011 8:19 am

Hello Guilz,

Isn't this what you want to do?
http://www.teechart.net/support/viewtop ... =1&t=11010
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

guilz2010
Newbie
Newbie
Posts: 63
Joined: Thu Nov 25, 2010 12:00 am
Location: Paris, France

Re: Wheel zoom

Post by guilz2010 » Mon Jul 04, 2011 8:46 am

Hi Yeray,

Thank you for your code but I think you need to add this instruction

Code: Select all

AxTChart1.Environment.MouseWheelScroll = False
but now I don't know how to use it to do what I would like to do :? : when I will use the wheel, I would like my chart zoom in on the right part of the graph and when I use the wheel in the other way, the chart zoom out


How can I do this in my code bellow ?

Thank you very much for your help :wink:

Guilz

Code: Select all

Public Class Form1


    Public Sub New()

        ' This call is required by the Windows Form Designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        AxTChart1.Environment.MouseWheelScroll = False
        AxTChart1.Aspect.View3D = False

        InitializeChart()
    End Sub

    Private Sub InitializeChart()
        axTChart1.Aspect.View3D = False

        axTChart1.AddSeries(TeeChart.ESeriesClass.scFastLine)
        AxTChart1.Series(0).FillSampleValues(300)

        AddHandler Me.MouseWheel, AddressOf Form1_MouseWheel


    End Sub

    Private Sub Form1_MouseWheel(ByVal sender As Object, ByVal e As MouseEventArgs)
        axTChart1.Header.Caption = "mousewheel event"
        Dim rect As New Rectangle(axTChart1.Location.X, axTChart1.Location.Y, axTChart1.ChartBounds.Right - axTChart1.ChartBounds.Left, axTChart1.ChartBounds.Bottom - axTChart1.ChartBounds.Top)
        If rect.Contains(e.X, e.Y) Then
            axTChart1.Header.Caption = axTChart1.Header.Caption + " in chart"
        End If
    End Sub


End Class

guilz2010
Newbie
Newbie
Posts: 63
Joined: Thu Nov 25, 2010 12:00 am
Location: Paris, France

Re: Wheel zoom

Post by guilz2010 » Mon Jul 04, 2011 9:09 am

Details: using wheel mouse zoom in:
zoom_in.png
zoom_in.png (20.33 KiB) Viewed 15679 times
zoom_in02.png
zoom_in02.png (15.49 KiB) Viewed 15681 times

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Wheel zoom

Post by Sandra » Mon Jul 04, 2011 11:50 am

Hello guilz2010,

I have made a simple code, I think this can help you to achieve as you want:

Code: Select all

 Public Sub New()

        ' This call is required by the Windows Form Designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        AxTChart1.Environment.MouseWheelScroll = False


        AxTChart1.Aspect.View3D = False

        InitializeChart()
    End Sub

    Private Sub InitializeChart()
        AxTChart1.Aspect.View3D = False

        AxTChart1.AddSeries(TeeChart.ESeriesClass.scFastLine)
        AxTChart1.Series(0).FillSampleValues(300)
        AddHandler Me.MouseWheel, AddressOf Form1_MouseWheel
    End Sub

    Private Sub Form1_MouseWheel(ByVal sender As Object, ByVal e As MouseEventArgs)
      If e.Delta > 0 Then
            AxTChart1.Axis.Bottom.SetMinMax(AxTChart1.Axis.Bottom.CalcPosPoint(AxTChart1.Axis.Bottom.IEndPos - 100), AxTChart1.Axis.Bottom.Maximum)
        Else
            AxTChart1.Axis.Bottom.Automatic = True
        End If
    End Sub
Could you confirm us, if previous code works as you expected?

Thanks,
Best Regards,
Sandra Pazos / 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

guilz2010
Newbie
Newbie
Posts: 63
Joined: Thu Nov 25, 2010 12:00 am
Location: Paris, France

Re: Wheel zoom

Post by guilz2010 » Mon Jul 04, 2011 11:59 am

Hi Sandra,

Thank you for your code - The zoom in code works well :D but I would like to have the same function to zoom out (here you make a full zoom out - AxTChart1.Axis.Bottom.Automatic = True)
How can we come back to the previous zoom state when we zoom out, without returning directly to the initial chart range (progressively like the zoom in) ?

Kind regards,

Guilz

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

Re: Wheel zoom

Post by Narcís » Tue Jul 05, 2011 1:31 pm

Hi Guilz,

Yes, you can do that enabling Zoom.History property, for example:

Code: Select all

    TChart1.Zoom.History = True
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

guilz2010
Newbie
Newbie
Posts: 63
Joined: Thu Nov 25, 2010 12:00 am
Location: Paris, France

Re: Wheel zoom

Post by guilz2010 » Tue Jul 05, 2011 1:38 pm

Hi Narcis,

Unfortunaly, this property is not available in Teechart v8, the version we use :(

Guilz

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

Re: Wheel zoom

Post by Narcís » Tue Jul 05, 2011 1:45 pm

Hi Guilz,

In that case you have two options:

1. Upgrade to TeeChart 2010 ActiveX.
2. Implement the feature yourself recording axes min. and max. values for each zoom level and revert them back when unzooming.
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

guilz2010
Newbie
Newbie
Posts: 63
Joined: Thu Nov 25, 2010 12:00 am
Location: Paris, France

Re: Wheel zoom

Post by guilz2010 » Tue Jul 05, 2011 2:06 pm

1 - We are waiting for bugs fixed since months on v10 version. Steema support says please read Feed RSS or Facebook or ... but NOTHING is coming...the upgrade version is a shame on this product :twisted: And do not ask me the list of bugs I waiting for -> I already post it, please use search engine !
2 - Thank you very much - In the future, If I ask something to support I must before remember to do it myself

Guilz

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

Re: Wheel zoom

Post by Narcís » Tue Jul 05, 2011 2:45 pm

Hi Guilz,
1 - We are waiting for bugs fixed since months on v10 version. Steema support says please read Feed RSS or Facebook or ... but NOTHING is coming...the upgrade version is a shame on this product :twisted: And do not ask me the list of bugs I waiting for -> I already post it, please use search engine !
Ok, I found the list. I checked what Sandra posted in this thread and I'm updating each issue status:

TV52014461: Not a bug but a feature request. Not implemented yet.
TV52015105: Not a bug but a feature request. Not implemented yet.
TV52015259: Not a bug but a feature request. Not implemented yet.
TA05015311: Fixed for next TeeChart 2010 ActiveX maintenance release.
TA05015119: Open.
TV52015326: Not a bug but a feature request. Not implemented yet. Actually no datasources are exported with TeeChart. Imagine the case where a database connection is exported in a *.tee file and then this is loaded in a computer without that connection, it would crash. Datasources need to be assigned manually after importing charts.
TV52015179: Fixed in last TeeChart 2010 ActiveX maintenance release as you can see at the version info page.
TV52015427: Fixed for next TeeChart 2010 ActiveX maintenance release.
2 - Thank you very much - In the future, If I ask something to support I must before remember to do it myself
I'd like to apologise if that's the impression you got from my reply but that was not my intention. Steema technical support mission is assisting Steema customers with TeeChart usage. I gave you a brief idea on how to implement the feature you requested and which is already implemented in current TeeChart version. Regarding your inquiry I'd recommend you to use arrays/structs to store left and bottom axes minimum and maximum properties after zoom is performed using the OnZoom event. When UndoZoom event is fired you should check if there are values on those structures and if that's the case assign last values set to chart axes and remove those values. If you come across any problem implementing this let us know and we will try to help you solving it.
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

guilz2010
Newbie
Newbie
Posts: 63
Joined: Thu Nov 25, 2010 12:00 am
Location: Paris, France

Re: Wheel zoom

Post by guilz2010 » Tue Jul 05, 2011 3:05 pm

My apologies Narcis for my answer too but we are frustated about the long 'next release period' - No worries for the feature requests but for the bugs it's too long to wait...
We use Teechart v8 every day in our developments, we buy license for v10 version but we don't use it until bugs are not fixed.

Thank you for the point 2 - We will try to implement this.

Regards,

Guilz

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

Re: Wheel zoom

Post by Narcís » Tue Jul 05, 2011 3:16 pm

Hi Guilz,
My apologies Narcis for my answer too but we are frustated about the long 'next release period' - No worries for the feature requests but for the bugs it's too long to wait...
We use Teechart v8 every day in our developments, we buy license for v10 version but we don't use it until bugs are not fixed.
Ok, no problem. Now you can see that all bugs you reported except for TA05015119 should be fixed in next TeeChart 2010 ActiveX maintenance release due out before the end of July. In that bug list you said that TV52015179 was the most critical issue for you. This should be already fixed in current v2010 release, this would be an improvement from v8 already.
Thank you for the point 2 - We will try to implement this.
For completeness with Sandra's example, you could also check if e.Delta is negative for unzooming, contrary to what you do for zooming when e.Delta is positive.
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