Page 1 of 1
How to put a split bar into an existing chart ?
Posted: Mon Mar 05, 2007 5:15 am
by 9534364
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.
Posted: Mon Mar 05, 2007 9:23 am
by narcis
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