Page 1 of 1

[ANSWERED] scroll in chart scline, with multiple axes

Posted: Tue Mar 26, 2013 8:04 pm
by 16665441
look at the first attachment,
I have 7 scline in a chart with multiple axes on the Y axis
Scline one is attached to the first custom axis (0.04 to 0.4)
the other 6 are attached to the second custom axis (0 to 200)
when I scroll up the second chart (0-200), the scline reach the first chart (see the second attachment)
the scline should not exceed the limits of their axis, they must disappear.

Note: this chart has 2 axis customs. On axis Y.
Has No custom chart this axis is absice.

How to scline that remain within the limits of their axes.

Re: scroll in chart scline, with multiple axes

Posted: Wed Mar 27, 2013 12:33 pm
by yeray
Hello,

It looks as what is shown in the "Opaque Zones" example in the features demo.
Find in at "All Features\Welcome !\Axes\Opaque zones".

Re: scroll in chart scline, with multiple axes

Posted: Wed Mar 27, 2013 2:39 pm
by 16665441
HELLO
I am a new user
I do not know where is the demo
"Opaque areas" example in the demo features.
Find in at "All Features \ Welcome! \ Axes \ Opaque areas".
What is "All Features \ Welcome! \ Axes \ Opaque areas"

Re: scroll in chart scline, with multiple axes

Posted: Wed Mar 27, 2013 3:24 pm
by 10050769
Hello jika

You must open the project TeeChart Activex Pro V2012 you will find as shortcut in the Program Group of start menu or in a similar path as next C:\Program Files\Steema Software\TeeChart Pro v2012 ActiveX Control\Examples\Visual Basic\TeeChartAXV2012Demo and run the TeeChartAxV2012.exe. After you execute the demo please go to tab All Features \ Welcome! \ Axes \ Opaque areas. See next image to understand good my indications:
OpaqueZonesExample.jpg
OpaqueZonesExample.jpg (205.36 KiB) Viewed 11443 times
I hope will helps.

Thanks,

Re: scroll in chart scline, with multiple axes

Posted: Thu Mar 28, 2013 2:34 pm
by 16665441
Thank you very much.
but is it possible to scroll in one or other of the chart. I do not want to scroll all the chart at the same time
i have a chart with one main axis
and one custom axis
thank you

Re: scroll in chart scline, with multiple axes

Posted: Tue Apr 02, 2013 10:44 am
by yeray
Hello,

To scroll/zoom each zone individually you should disable the default scroll/zoom feature and implement your version of it.
For example, this seems to work in the opaque zones example mentioned above:

Code: Select all

Dim MouseDownX, MouseDownY, custAxisIndex As Integer
Dim inLeft As Boolean

Private Sub Form_Load()
  With TChart1    
    .Zoom.Enable = False
    .Scroll.Enable = pmNone
    MouseDownX = -1
    MouseDownY = -1
    custAxisIndex = -1
    inLeft = False
  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 Button = mbRight And _
     X > TChart1.Axis.Bottom.IStartPos And X < TChart1.Axis.Bottom.IEndPos And _
     Y > TChart1.GetChartRect.Top And Y < TChart1.GetChartRect.Bottom Then
    Dim i As Integer
    For i = 0 To TChart1.Axis.CustomCount - 1
      If Y > TChart1.Axis.Custom(i).IStartPos And Y < TChart1.Axis.Custom(i).IEndPos Then
        custAxisIndex = i
        Exit For
      End If
    Next i
    
    If custAxisIndex = -1 And _
       Y > TChart1.Axis.Left.IStartPos And Y < TChart1.Axis.Left.IEndPos Then
      inLeft = True
    End If
    
    MouseDownX = X
    MouseDownY = Y
  End If
End Sub

Private Sub TChart1_OnMouseMove(ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
  If MouseDownX <> -1 And MouseDownY <> -1 Then
    If custAxisIndex > -1 Then
      With TChart1.Axis.Custom(custAxisIndex)
        tmpIncr = .CalcPosPoint(MouseDownY - Y) - .CalcPosPoint(0)
        .SetMinMax .Minimum + tmpIncr, .Maximum + tmpIncr
        MouseDownY = Y
      End With
    Else
      If inLeft Then
        With TChart1.Axis.Left
          tmpIncr = .CalcPosPoint(MouseDownY - Y) - .CalcPosPoint(0)
          .SetMinMax .Minimum + tmpIncr, .Maximum + tmpIncr
          MouseDownY = Y
        End With
      End If
    End If
    
    With TChart1.Axis.Bottom
      tmpIncr = .CalcPosPoint(MouseDownX - X) - .CalcPosPoint(0)
      .SetMinMax .Minimum + tmpIncr, .Maximum + tmpIncr
      MouseDownX = X
    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)
  MouseDownX = -1
  MouseDownY = -1
  custAxisIndex = -1
  inLeft = False
End Sub