Page 1 of 1

Determine if custom axis is visible.

Posted: Fri Oct 17, 2014 1:53 pm
by 13052810
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.

Re: Determine if custom axis is visible.

Posted: Fri Oct 17, 2014 2:33 pm
by narcis
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