Page 1 of 1

Making custom axis visible

Posted: Wed Nov 08, 2006 4:43 pm
by 9529060
We have upgraded form TeeChart v5 to v7 and code that used to make a custom axis and its grid visible now doesn't work anymore. It is meant to be a vertical axis (I'm not sure why the left axis isn't used instead!) The real code is a bit complicated but I've got two routines: one to set the left axis and one to set the custom axis. The one that sets the left works but the one for the custom one doesn't. What am I missing here??

Code: Select all

Private Sub Check1_Click(Index As Integer)
Debug.Print "Index is " & Index
If Check1(Index).Value = vbChecked Then
    If gbDarkBackground Then
        frmPI.TChart(Index).Axis.Custom(0).GridPen.Color = DARK_GRID_COLOUR
    Else
        frmPI.TChart(Index).Axis.Custom(0).GridPen.Color = LIGHT_GRID_COLOUR
    End If
    frmPI.TChart(Index).Axis.Custom(0).SetMinMax 0, 4
    frmPI.TChart(Index).Axis.Custom(0).Increment = 1
    frmPI.TChart(Index).Axis.Custom(0).GridPen.Visible = True
    frmPI.TChart(Index).Axis.Custom(0).Visible = True
    frmPI.TChart(Index).Axis.Custom(0).AxisPen.Visible = True
    frmPI.TChart(Index).Axis.Custom(0).Labels.Visible = False
    
Else
    frmPI.TChart(Index).Axis.Custom(0).GridPen.Visible = False
    frmPI.TChart(Index).Axis.Custom(0).Visible = True
    frmPI.TChart(Index).Axis.Custom(0).AxisPen.Visible = True
    frmPI.TChart(Index).Axis.Custom(0).Ticks.Visible = False
    frmPI.TChart(Index).Axis.Custom(0).Labels.Visible = False
End If
End Sub
Private Sub Check1_Click_old(Index As Integer)
Debug.Print "Index is " & Index
If Check1(Index).Value = vbChecked Then
    If gbDarkBackground Then
        frmPI.TChart(Index).Axis.Left.GridPen.Color = DARK_GRID_COLOUR
    Else
        frmPI.TChart(Index).Axis.Left.GridPen.Color = LIGHT_GRID_COLOUR
    End If
    frmPI.TChart(Index).Axis.Left.SetMinMax 0, 4
    frmPI.TChart(Index).Axis.Left.Increment = 1
    frmPI.TChart(Index).Axis.Left.GridPen.Visible = True
    frmPI.TChart(Index).Axis.Left.Visible = True
    frmPI.TChart(Index).Axis.Left.AxisPen.Visible = True
    frmPI.TChart(Index).Axis.Left.Labels.Visible = False
    
Else
    frmPI.TChart(Index).Axis.Left.GridPen.Visible = False
    frmPI.TChart(Index).Axis.Left.Visible = True
    frmPI.TChart(Index).Axis.Left.AxisPen.Visible = True
    frmPI.TChart(Index).Axis.Left.Ticks.Visible = False
    frmPI.TChart(Index).Axis.Left.Labels.Visible = False
End If
End Sub
Thanks.

Posted: Wed Nov 08, 2006 5:38 pm
by narcis
Hi bluebird,

Do you have any series assigned to this custom axis? For example:

Code: Select all

    TChart1.Series(0).VerticalAxisCustom = 0
This code sets the first series vertical axis to the first custom axis.

Posted: Thu Nov 09, 2006 11:37 am
by 9529060
Thanks. That solved the problem!