Multiple Axis - Adapting start/end position in run mode

TeeChart for ActiveX, COM and ASP
Post Reply
Bush
Newbie
Newbie
Posts: 50
Joined: Fri Nov 05, 2004 5:00 am

Multiple Axis - Adapting start/end position in run mode

Post by Bush » Wed Jun 15, 2005 8:43 pm

Hi,

We have 3 drawings on top of each other, all with the same date/time bottom axis.
I tried to use the "drag colorline tool" to adapt the start/end position of a vertical axis using the end drag method. Please, is there any way to bring the colorline-value in correlation with the chart X/Y dimensions? Or please, do you have a better solution for this? :(

Or do you recommend me to use several Tcharts on a form when dimensions need to be adapted by a user?
With several Tcharts I am afraid to encounter problems regarding correct allignement between the different TCharts regarding grid, labels, legende, date and printing? Should I indeed be worried for this? :cry:

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 Jun 20, 2005 11:04 am

Hi you can do this using:

Code: Select all

Private Sub Form_Load()
    TChart1.Series(0).FillSampleValues 10
    TChart1.Series(1).FillSampleValues 10
    TChart1.Series(2).FillSampleValues 10

    TChart1.Axis.Left.PositionUnits = puPixels   
End Sub

Private Sub TChart1_OnColorLineToolEndDragLine()
    TChart1.Axis.Left.PositionPercent = TChart1.Axis.Bottom.CalcXPosValue(TChart1.Tools.Items(0).asColorLine.Value) - TChart1.Axis.Left.Position
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

Bush
Newbie
Newbie
Posts: 50
Joined: Fri Nov 05, 2004 5:00 am

Post by Bush » Mon Jun 20, 2005 4:15 pm

Mny thx yr reply.
I am sorry, I do not mean how to move the axis scale, but how to move the vertical start/end position of each Tchart area. :(

In my sample, I have 3 horizontal areas, separated with 2 horizontal colorlines.
Each area has a few series, the bottom axis is the same for all.
The vertical axis are not commom, custom axis are used.

So if we start with 3 areas equal in size, then we have for start/end position:
0 - 33.3% left axis
33.33-66.66 left custom axis
66.6 -100 another left custom axis

We are searching how to drag the first horizontal colorline, to have let's us say, 50%-17%-33%

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 Jun 21, 2005 1:08 pm

Hi,

You could do something like:

Code: Select all

Dim Axis0Start, Axis1Start As Integer

Private Sub Form_Load()
    Dim i As Integer
    
    For i = 0 To TChart1.SeriesCount - 1
        TChart1.Series(i).FillSampleValues 10
    Next
    
    For j = 0 To TChart1.Axis.CustomCount - 1
        TChart1.Axis.Custom(j).PositionUnits = puPixels
    Next
    
    TChart1.Axis.Left.PositionUnits = puPixels
    
    Me.ScaleMode = 3
    
    Axis0Start = 0
    Axis1Start = 0
End Sub

Private Sub TChart1_OnColorLineToolEndDragLine()
    If (Axis1Start = 0) Then
        TChart1.Axis.Left.EndPosition = Axis0Start
        TChart1.Axis.Custom(0).StartPosition = Axis0Start
    Else
        TChart1.Axis.Custom(0).EndPosition = Axis1Start
        TChart1.Axis.Custom(1).StartPosition = Axis1Start
    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 (TChart1.Tools.Items(1).asColorLine.Clicked(X, Y) <> -1) Then
        Axis0Start = (Y / TChart1.Height) * 100
        Axis1Start = 0
    Else
        If (TChart1.Tools.Items(0).asColorLine.Clicked(X, Y) <> -1) Then
            Axis0Start = 0
            Axis1Start = (Y / TChart1.Height) * 100
        End If
    End If
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