Determine if custom axis is visible.

TeeChart for ActiveX, COM and ASP
Post Reply
tirby
Newbie
Newbie
Posts: 84
Joined: Mon Mar 16, 2009 12:00 am

Determine if custom axis is visible.

Post by tirby » Fri Oct 17, 2014 1:53 pm

Hi,

I'm using TeeChart Pro v2013.0.1.4.131120
Using FastLine.

When a series is assigned to a custom vertical axis, the axis will only be visible if the series is active. This also applies to assigning multiple series to a single axis.

When there is no active series, the axis becomes invisible.

How can I detect when the custom axis turns invisible?

I have tried this:
TChart1.Axis.Custom(0).Visible

This does not change when a "no active series" condition causes the axis to become invisible.

Thanks.

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

Re: Determine if custom axis is visible.

Post by Narcís » Fri Oct 17, 2014 2:33 pm

Hi tirby,

You can do it manually like this:

Code: Select all

Private Sub Form_Load()
    List1.Clear

    TeeCommander1.ChartLink = TChart1.ChartLink
    
    TChart1.Aspect.View3D = False
    TChart1.Legend.CheckBoxes = True
    
    Dim CustomAxis As Integer
        
    CustomAxis = TChart1.Axis.AddCustom(False)
    
    For i = 0 To 5
        TChart1.AddSeries scLine
        TChart1.Series(i).FillSampleValues
        
        If i Mod 2 = 0 Then
            TChart1.Series(i).VerticalAxisCustom = CustomAxis
        End If
    Next
    
    TChart1.Axis.Left.EndPosition = 50
    TChart1.Axis.Custom(CustomAxis).StartPosition = 50
End Sub

Private Sub TChart1_OnClickLegend(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
    For i = 0 To TChart1.Axis.CustomCount - 1
        Dim AxisVisible As Boolean
        
        AxisVisible = False
        
        For j = 0 To TChart1.SeriesCount - 1
            If ((TChart1.Series(j).VerticalAxisCustom = i) And (TChart1.Series(j).Active)) Then
                AxisVisible = True
            End If
        Next
        
        Dim text As String
        
        If AxisVisible Then
            text = "Custom Axis " & CStr(i) & " is VISIBLE"
        Else
            text = "Custom Axis " & CStr(i) & " is NOT visible"
        End If
        
        List1.AddItem text
    Next
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