move tool available outside of TeeCommander1

TeeChart for ActiveX, COM and ASP
Post Reply
mpaulson
Newbie
Newbie
Posts: 41
Joined: Fri Nov 15, 2002 12:00 am

move tool available outside of TeeCommander1

Post by mpaulson » Mon Apr 07, 2008 8:59 pm

Hi:

I'm successfully using the rotate and magnifying tools. Now I want to a "move" tool, similar to what the TeeCommander does, but don't want to use the commander per se.

Can I use this tool outside of the commander? Or is this function only available in the commander?

Thanks,

Matt

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

Post by Yeray » Tue Apr 08, 2008 8:34 am

Hi Matt,

I'm afraid there's no tool to move the chart. Otherwise, you always can emulate this TeeCommander function by doing something similar than following:

Code: Select all

Dim MoveChart As Boolean
Dim StartX, StartY As Double

Private Sub Form_Load()
  TChart1.AddSeries scPoint
  TChart1.Series(0).FillSampleValues 25
  
  MoveChart = False
  TChart1.Zoom.Enable = False
End Sub

Private Sub TChart1_OnMouseDown(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
  If Button = mbLeft Then
    StartX = X
    StartY = Y
    MoveChart = True
  End If
End Sub

Private Sub TChart1_OnMouseMove(ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
  If MoveChart = True Then
    With TChart1
        .Aspect.HorizOffset = X - StartX
        .Aspect.VertOffset = Y - StartY
    End With
  End If
End Sub

Private Sub TChart1_OnMouseUp(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
  If Button = mbLeft Then
    With TChart1
        .Aspect.HorizOffset = X - StartX
        .Aspect.VertOffset = Y - StartY
    End With
    MoveChart = False
  End If
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

mpaulson
Newbie
Newbie
Posts: 41
Joined: Fri Nov 15, 2002 12:00 am

Post by mpaulson » Tue Apr 08, 2008 10:47 am

Hi:

That's fine, as long as it works. Thanks!

What about the 3d depth tool? Do use the same event structure and follow a "mode" selector to change the 3d-ness? If so, just let me know what the correct method is.

Thanks again,

Matt

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

Post by Yeray » Tue Apr 08, 2008 11:37 am

Hi Matt,

Here you have an example of how you could achieve similar results as teecommander, using simple buttons:

Code: Select all

Dim RotateChart, MoveChart, ZoomChart, DChart, Go As Boolean
Dim StartX, StartY As Double
Dim StartZoom As Integer

Private Sub Rotate_Click()
  RotateChart = True
  MoveChart = False
  ZoomChart = False
  DChart = False
End Sub

Private Sub Reset_Click()
  With TChart1
    .Aspect.Orthogonal = True
    .Aspect.HorizOffset = 0
    .Aspect.VertOffset = 0
    .Aspect.Zoom = 100
    .Aspect.Chart3DPercent = 15
  End With

  MoveChart = False
  RotateChart = False
  ZoomChart = False
  DChart = False
  Go = False
End Sub

Private Sub Move_Click()
  MoveChart = True
  RotateChart = False
  ZoomChart = False
  DChart = False
End Sub

Private Sub Zoom_Click()
  ZoomChart = True
  MoveChart = False
  Rotate = False
  DChart = False
End Sub

Private Sub ThreeDPercent_Click()
  DChart = True
  ZoomChart = False
  MoveChart = False
  Rotate = False
End Sub

Private Sub Editor_Click()
  TChart1.ShowEditor
End Sub

Private Sub Form_Load()
  With TChart1
    .AddSeries scLine
    .Series(0).FillSampleValues 20
    .Zoom.Enable = False
    .Scroll.Enable = pmNone
  End With
End Sub

Private Sub TChart1_OnMouseDown(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
  If RotateChart = True Then
    Go = True
    StartX = X
    StartY = Y
  End If
  If MoveChart = True Then
    Go = True
    StartX = X
    StartY = Y
  End If
  If ZoomChart = True Then
    Go = True
    StartZoom = TChart1.Aspect.Zoom
    StartY = Y
  End If
  If DChart = True Then
    Go = True
    StartX = X
    StartY = Y
  End If
End Sub

Private Sub TChart1_OnMouseMove(ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
  If RotateChart = True And Go = True Then
    With TChart1
      .Aspect.Orthogonal = False
      .Aspect.Elevation = X - StartX
      .Aspect.Rotation = Y - StartY
    End With
  End If
  If MoveChart = True And Go = True Then
    With TChart1
      .Aspect.HorizOffset = X - StartX
      .Aspect.VertOffset = Y - StartY
    End With
  End If
  If ZoomChart = True And Go = True Then
    With TChart1
      .Aspect.Zoom = StartZoom + StartY - Y
    End With
  End If
  If DChart = True And Go = True Then
    With TChart1
      If (X - StartX) < 101 And (X - StartX) > 0 Then
        .Aspect.Chart3DPercent = X - StartX
      Else
        If (X - StartX) > 101 Then
          .Aspect.Chart3DPercent = 100
        Else
          .Aspect.Chart3DPercent = 1
        End If
      End If
    End With
  End If
End Sub

Private Sub TChart1_OnMouseUp(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
  If RotateChart = True Then
    With TChart1
      .Aspect.Orthogonal = False
      .Aspect.Elevation = X - StartX
      .Aspect.Rotation = Y - StartY
    End With
    Go = False
  End If
  If MoveChart = True Then
    With TChart1
      .Aspect.HorizOffset = X - StartX
      .Aspect.VertOffset = Y - StartY
    End With
    Go = False
  End If
  If ZoomChart = True Then
    With TChart1
      .Aspect.Zoom = StartZoom + StartY - Y
    End With
    Go = False
  End If
  If DChart = True Then
    With TChart1
      If (X - StartX) < 101 And (X - StartX) > 0 Then
        .Aspect.Chart3DPercent = X - StartX
      Else
        If (X - StartX) > 101 Then
          .Aspect.Chart3DPercent = 100
        Else
          .Aspect.Chart3DPercent = 1
        End If
      End If
    End With
    Go = False
  End If
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

mpaulson
Newbie
Newbie
Posts: 41
Joined: Fri Nov 15, 2002 12:00 am

Post by mpaulson » Tue Apr 08, 2008 1:56 pm

Hi:

This code is working fairly nicely (with a few minor mods). Thanks again.

I need to turn off the default left-click mouse behavior that drags and grid around independently of the plotting data, since in some cases, it interferes with the functions in the code you provided. How is that done?

Thanks,

Matt

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

Post by Narcís » Tue Apr 08, 2008 2:58 pm

Hi Matt,

You can use this:

Code: Select all

    TChart1.Scroll.Enable = pmNone
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

mpaulson
Newbie
Newbie
Posts: 41
Joined: Fri Nov 15, 2002 12:00 am

Post by mpaulson » Tue Apr 08, 2008 5:07 pm

Thanks!

mpaulson
Newbie
Newbie
Posts: 41
Joined: Fri Nov 15, 2002 12:00 am

Post by mpaulson » Tue Apr 08, 2008 5:59 pm

Hi:

Your suggestion doesn't appear to work. Maybe I didn't explain what has happening. This issue occurs when I lasso a box somewhere in the graph. When I let the right button up, the chart appears to zoom in on a particular section. It is this behavior I want to suppress.

Thanks,

Matt

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

Post by Narcís » Wed Apr 09, 2008 9:18 am

Hi Matt,

Sorry for the confusion. In that case you can try using this:

Code: Select all

    TChart1.Zoom.Enable = False
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

mpaulson
Newbie
Newbie
Posts: 41
Joined: Fri Nov 15, 2002 12:00 am

Post by mpaulson » Wed Apr 09, 2008 11:13 am

Thanks! That did the trick.

-- Matt

Post Reply