![]() | Type | Description | ||
| Long | A Long expression that indicates the number of levels being displayed in the control's header. |

The first level displays the month, the year and the number of the week in the year , the second level displays the name of the week day, and the third level displays the day of the month. The LevelCount property specifies the number of levels being displayed, in our case 3.
The following Template shows how to display your header using three levels as arranged in the picture above ( just copy and paste the following script to Template page ):
BeginUpdate()
Chart
{
LevelCount = 3
Level(0)
{
Label = "<b><%mmm%>, <%yyyy%></b> <r>Week: <%ww%>"
Unit = 256 'exWeek
}
Level(1).Label = "<%d1%>"
Level(2).Label = "<%d%>"
}
EndUpdate()
The following VB sample displays your header using 3 levels as shown above:
With G2antt1
.BeginUpdate
With .Chart
.LevelCount = 3
With .Level(0)
.Label = "<b><%mmm%>, <%yyyy%></b> <r>Week: <%ww%>"
.Unit = EXG2ANTTLibCtl.UnitEnum.exWeek
End With
.Level(1).Label = "<%d1%>"
.Level(2).Label = "<%d%>"
End With
.EndUpdate
End With
The following VFP sample displays your header using 3 levels:
with thisform.g2antt1 .BeginUpdate() with .Chart .LevelCount = 3 with .Level(0) .Label = "<b><%mmm%>, <%yyyy%></b> <r>Week: <%ww%>" .Unit = 256 endwith .Level(1).Label = "<%d1%>" .Level(2).Label = "<%d%>" endwith .EndUpdate() endwith
The following VB.NET sample displays your header using 3 levels:
With AxG2antt1
.BeginUpdate()
With .Chart
.LevelCount = 3
With .Level(0)
.Label = "<b><%mmm%>, <%yyyy%></b> <r>Week: <%ww%>"
.Unit = EXG2ANTTLib.UnitEnum.exWeek
End With
.Level(1).Label = "<%d1%>"
.Level(2).Label = "<%d%>"
End With
.EndUpdate()
End With
The following C# sample displays your header using 3 levels:
axG2antt1.BeginUpdate(); EXG2ANTTLib.Chart chart = axG2antt1.Chart; chart.LevelCount = 3; chart.get_Level(0).Label = "<b><%mmm%>, <%yyyy%></b> <r>Week: <%ww%>"; chart.get_Level(0).Unit = EXG2ANTTLib.UnitEnum.exWeek; chart.get_Level(1).Label = "<%d1%>"; chart.get_Level(2).Label = "<%d%>"; axG2antt1.EndUpdate();
The following C++ sample displays your header using 3 levels:
m_g2antt.BeginUpdate(); CChart chart = m_g2antt.GetChart(); chart.SetLevelCount( 3 ); chart.GetLevel(0).SetLabel(COleVariant( "<b><%mmm%>, <%yyyy%></b> <r>Week: <%ww%>" )); chart.GetLevel(0).SetUnit(256); chart.GetLevel(1).SetLabel(COleVariant( "<%d1%>" )); chart.GetLevel(2).SetLabel(COleVariant( "<%d%>" )); m_g2antt.EndUpdate();

The following VB sample enumerates the levels in the chart:
With G2antt1.Chart
Dim i As Long
For i = 0 To .LevelCount - 1
With .Level(i)
Debug.Print .Label
End With
Next
End With
The following C++ sample enumerates the levels in the chart:
CChart chart = m_g2antt.GetChart();
for ( long i = 0; i < chart.GetLevelCount(); i++ )
{
CLevel level = chart.GetLevel( i );
OutputDebugString( V2S( &level.GetLabel() ) );
}
where the V2S function converts a Variant expression to a string expression:
static CString V2S( VARIANT* pvtDate )
{
COleVariant vtDate;
vtDate.ChangeType( VT_BSTR, pvtDate );
return V_BSTR( &vtDate );
}
The following VB.NET sample enumerates the levels in the chart:
With AxG2antt1.Chart
Dim i As Long
For i = 0 To .LevelCount - 1
With .Level(i)
Debug.Write(.Label())
End With
Next
End With
The following C# sample enumerates the levels in the chart:
for (int i = 0; i < axG2antt1.Chart.LevelCount; i++)
{
EXG2ANTTLib.Level level = axG2antt1.Chart.get_Level(i);
System.Diagnostics.Debug.Write(level.Label);
}
The following VFP sample enumerates the levels in the chart:
With thisform.G2antt1.Chart
For i = 0 To .LevelCount - 1
With .Level(i)
wait window nowait .Label
EndWith
Next
EndWith