How to put a split bar into an existing chart ?

TeeChart for ActiveX, COM and ASP
Post Reply
David
Newbie
Newbie
Posts: 4
Joined: Mon Feb 26, 2007 12:00 am

How to put a split bar into an existing chart ?

Post by David » Mon Mar 05, 2007 5:15 am

Hi !

TeeChart is really awesome since it has plenty of functionalities.
I have a question as follows.

How to put a split bar into an existing chart ?
The chart has three different sub-charts on the same window.
I want to resize all sub-charts' size (particularly height) by using such as two split bars between two sub-charts.
I've had a look at all examples. Couldn't find one.

Can anybody help me ?

Thanks a lot in advance.

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

Post by Narcís » Mon Mar 05, 2007 9:23 am

Hi David,

To achieve what you request I'd use custom axes as shown here:

Code: Select all

Dim MoveAxis As Boolean
Dim Horiz, Vert As Integer
 
Private Sub Form_Load()
    TeeCommander1.Chart = TChart1
    
    With TChart1
        .AddSeries scLine
        .AddSeries scLine
        
        With .Axis
            Vert = .AddCustom(False)
            Horiz = .AddCustom(True)

            .Left.StartPosition = 50
            .Left.EndPosition = 100
            
            .Custom(0).StartPosition = 0
            .Custom(0).EndPosition = 50
            
            .Custom(1).PositionPercent = 50
        End With
        
        .Series(1).VerticalAxisCustom = Vert
        .Series(1).HorizontalAxisCustom = Horiz
        
        .Series(0).FillSampleValues 10
        .Series(1).FillSampleValues 10
    End With
    
    MoveAxis = False
End Sub

 
Private Sub TChart1_OnClickAxis(ByVal Axis As Long, ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
    If (Axis = TChart1.Axis.Custom(1).Index) Then
        MoveAxis = True
    Else
        MoveAxis = False
    End If
End Sub
 

Private Sub TChart1_OnMouseMove(ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
    If MoveAxis Then
        With TChart1.Axis
            Top = .Top.Position - TChart1.Aspect.Height3D
            Bottom = .Bottom.Position
            MousePercent = ((Y - Top) / (Bottom - Top)) * 100
            
            .Custom(1).PositionPercent = 100 - MousePercent
            .Custom(0).EndPosition = MousePercent
            .Left.StartPosition = MousePercent
        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)
    MoveAxis = False
End Sub
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