property Chart.LevelCount as Long
Specifies the number of levels in the control's header.

 TypeDescription 
   Long A Long expression that indicates the number of levels being displayed in the control's header.  
By default, the control displays a single level. Use the LevelCount property to specify the number of levels being displayed in the chart's header. Use the Level property to access the level in the chart area. Use the Label property to specify the level's HTML label. Use the Unit property to specify the time-scale unit for the chart's level. Use the HeaderVisible property to hide the control's header bar. The control's header bar displays the levels in the chart area too. Use the Caption property to specify the column's caption being displayed in the control's header bar. Use the BackColorLevelHeader property to specify the background color of the chart's header. Use the ForeColorLevelHeader property to specify the foreground color of the chart's header. If the control displays the header bar using multiple levels the HeaderHeight property gets the height in pixels of a single level in the header bar. Use the LevelKey property to specify the key of the column.

Newer versions support Regional and Language Options for tags such as:

You can use these in methods as: Level.Label, Level.ToolTip, Chart.Label, Chart.LabelToolTip, Chart.FormatDate, Chart.OverviewToolTip, Chart.ToolTip, InsideZoomFormat.InsideLabel, InsideZoomFormat.OwnerLabel, Note.PartText and Note.Text ( where supported ).

The following screen shot shows the chart's header for English (United States) format:

The following screen shot shows the chart's header for Nepali (Nepal) format:

The following screen shot shows the chart's header for German (Germany) format:

The following VBA sample shows how to specify the levels using the user's Regional and Language Options?
With Gantt1
	.BeginUpdate 
	.Font.Name = "Arial Unicode MS"
	.HeaderHeight = 36
	With .Chart
		.FirstVisibleDate = #5/30/2010#
		.PaneWidth(False) = 0
		.FirstWeekDay = 1
		.UnitWidth = 36
		.LevelCount = 2
		With .Level(0)
			.Label = "<b><%loc_mmmm%></b> <%yyyy%><br><%loc_sdate%><r> <%ww%> "
			.ToolTip = .Label
			.Unit = 256
		End With
		With .Level(1)
			.Label = "<%loc_ddd%><br><%d%>"
			.ToolTip = .Label
		End With
		.ToolTip = "<%loc_ldate%>"
	End With
	.EndUpdate 
End With
The following VB6 sample shows how to specify the levels using the user's Regional and Language Options?
With Gantt1
	.BeginUpdate 
	.Font.Name = "Arial Unicode MS"
	.HeaderHeight = 36
	With .Chart
		.FirstVisibleDate = #5/30/2010#
		.PaneWidth(False) = 0
		.FirstWeekDay = exMonday
		.UnitWidth = 36
		.LevelCount = 2
		With .Level(0)
			.Label = "<b><%loc_mmmm%></b> <%yyyy%><br><%loc_sdate%><r> <%ww%> "
			.ToolTip = .Label
			.Unit = exWeek
		End With
		With .Level(1)
			.Label = "<%loc_ddd%><br><%d%>"
			.ToolTip = .Label
		End With
		.ToolTip = "<%loc_ldate%>"
	End With
	.EndUpdate 
End With
The following VB.NET sample shows how to specify the levels using the user's Regional and Language Options?
With Exgantt1
	.BeginUpdate()
	.Font.Name = "Arial Unicode MS"
	.HeaderHeight = 36
	With .Chart
		.FirstVisibleDate = #5/30/2010#
		.set_PaneWidth(False,0)
		.FirstWeekDay = exontrol.EXGANTTLib.WeekDayEnum.exMonday
		.UnitWidth = 36
		.LevelCount = 2
		With .get_Level(0)
			.Label = "<b><%loc_mmmm%></b> <%yyyy%><br><%loc_sdate%><r> <%ww%> "
			.ToolTip = .Label
			.Unit = exontrol.EXGANTTLib.UnitEnum.exWeek
		End With
		With .get_Level(1)
			.Label = "<%loc_ddd%><br><%d%>"
			.ToolTip = .Label
		End With
		.ToolTip = "<%loc_ldate%>"
	End With
	.EndUpdate()
End With
The following VB.NET for /COM sample shows how to specify the levels using the user's Regional and Language Options?
With AxGantt1
	.BeginUpdate()
	.Font.Name = "Arial Unicode MS"
	.HeaderHeight = 36
	With .Chart
		.FirstVisibleDate = #5/30/2010#
		.PaneWidth(False) = 0
		.FirstWeekDay = EXGANTTLib.WeekDayEnum.exMonday
		.UnitWidth = 36
		.LevelCount = 2
		With .Level(0)
			.Label = "<b><%loc_mmmm%></b> <%yyyy%><br><%loc_sdate%><r> <%ww%> "
			.ToolTip = .Label
			.Unit = EXGANTTLib.UnitEnum.exWeek
		End With
		With .Level(1)
			.Label = "<%loc_ddd%><br><%d%>"
			.ToolTip = .Label
		End With
		.ToolTip = "<%loc_ldate%>"
	End With
	.EndUpdate()
End With
The following C++ sample shows how to specify the levels using the user's Regional and Language Options?
/*
	Copy and paste the following directives to your header file as
	it defines the namespace 'EXGANTTLib' for the library: 'ExGantt 1.0 Control Library'

	#import <ExGantt.dll>
	using namespace EXGANTTLib;
*/
EXGANTTLib::IGanttPtr spGantt1 = GetDlgItem(IDC_GANTT1)->GetControlUnknown();
spGantt1->BeginUpdate();
spGantt1->GetFont()->PutName(L"Arial Unicode MS");
spGantt1->PutHeaderHeight(36);
EXGANTTLib::IChartPtr var_Chart = spGantt1->GetChart();
	var_Chart->PutFirstVisibleDate("5/30/2010");
	var_Chart->PutPaneWidth(VARIANT_FALSE,0);
	var_Chart->PutFirstWeekDay(EXGANTTLib::exMonday);
	var_Chart->PutUnitWidth(36);
	var_Chart->PutLevelCount(2);
	EXGANTTLib::ILevelPtr var_Level = var_Chart->GetLevel(0);
		var_Level->PutLabel("<b><%loc_mmmm%></b> <%yyyy%><br><%loc_sdate%><r> <%ww%> ");
		var_Level->PutToolTip(var_Level->GetLabel());
		var_Level->PutUnit(EXGANTTLib::exWeek);
	EXGANTTLib::ILevelPtr var_Level1 = var_Chart->GetLevel(1);
		var_Level1->PutLabel("<%loc_ddd%><br><%d%>");
		var_Level1->PutToolTip(var_Level1->GetLabel());
	var_Chart->PutToolTip(L"<%loc_ldate%>");
spGantt1->EndUpdate();
The following C# sample shows how to specify the levels using the user's Regional and Language Options?
exgantt1.BeginUpdate();
exgantt1.Font.Name = "Arial Unicode MS";
exgantt1.HeaderHeight = 36;
exontrol.EXGANTTLib.Chart var_Chart = exgantt1.Chart;
	var_Chart.FirstVisibleDate = Convert.ToDateTime("5/30/2010");
	var_Chart.set_PaneWidth(false,0);
	var_Chart.FirstWeekDay = exontrol.EXGANTTLib.WeekDayEnum.exMonday;
	var_Chart.UnitWidth = 36;
	var_Chart.LevelCount = 2;
	exontrol.EXGANTTLib.Level var_Level = var_Chart.get_Level(0);
		var_Level.Label = "<b><%loc_mmmm%></b> <%yyyy%><br><%loc_sdate%><r> <%ww%> ";
		var_Level.ToolTip = var_Level.Label;
		var_Level.Unit = exontrol.EXGANTTLib.UnitEnum.exWeek;
	exontrol.EXGANTTLib.Level var_Level1 = var_Chart.get_Level(1);
		var_Level1.Label = "<%loc_ddd%><br><%d%>";
		var_Level1.ToolTip = var_Level1.Label;
	var_Chart.ToolTip = "<%loc_ldate%>";
exgantt1.EndUpdate();
The following C# for /COM sample shows how to specify the levels using the user's Regional and Language Options?
axGantt1.BeginUpdate();
axGantt1.Font.Name = "Arial Unicode MS";
axGantt1.HeaderHeight = 36;
EXGANTTLib.Chart var_Chart = axGantt1.Chart;
	var_Chart.FirstVisibleDate = Convert.ToDateTime("5/30/2010");
	var_Chart.set_PaneWidth(false,0);
	var_Chart.FirstWeekDay = EXGANTTLib.WeekDayEnum.exMonday;
	var_Chart.UnitWidth = 36;
	var_Chart.LevelCount = 2;
	EXGANTTLib.Level var_Level = var_Chart.get_Level(0);
		var_Level.Label = "<b><%loc_mmmm%></b> <%yyyy%><br><%loc_sdate%><r> <%ww%> ";
		var_Level.ToolTip = var_Level.Label;
		var_Level.Unit = EXGANTTLib.UnitEnum.exWeek;
	EXGANTTLib.Level var_Level1 = var_Chart.get_Level(1);
		var_Level1.Label = "<%loc_ddd%><br><%d%>";
		var_Level1.ToolTip = var_Level1.Label;
	var_Chart.ToolTip = "<%loc_ldate%>";
axGantt1.EndUpdate();
The following VFP sample shows how to specify the levels using the user's Regional and Language Options?
with thisform.Gantt1
	.BeginUpdate
	.Font.Name = "Arial Unicode MS"
	.HeaderHeight = 36
	with .Chart
		.FirstVisibleDate = {^2010-5-30}
		.PaneWidth(.F.) = 0
		.FirstWeekDay = 1
		.UnitWidth = 36
		.LevelCount = 2
		with .Level(0)
			.Label = "<b><%loc_mmmm%></b> <%yyyy%><br><%loc_sdate%><r> <%ww%> "
			.ToolTip = .Label
			.Unit = 256
		endwith
		with .Level(1)
			.Label = "<%loc_ddd%><br><%d%>"
			.ToolTip = .Label
		endwith
		.ToolTip = "<%loc_ldate%>"
	endwith
	.EndUpdate
endwith
The following Delphi sample shows how to specify the levels using the user's Regional and Language Options?
with AxGantt1 do
begin
	BeginUpdate();
	Font.Name := 'Arial Unicode MS';
	HeaderHeight := 36;
	with Chart do
	begin
		FirstVisibleDate := '5/30/2010';
		PaneWidth[False] := 0;
		FirstWeekDay := EXGANTTLib.WeekDayEnum.exMonday;
		UnitWidth := 36;
		LevelCount := 2;
		with Level[0] do
		begin
			Label := '<b><%loc_mmmm%></b> <%yyyy%><br><%loc_sdate%><r> <%ww%> ';
			ToolTip := Label;
			Unit := EXGANTTLib.UnitEnum.exWeek;
		end;
		with Level[1] do
		begin
			Label := '<%loc_ddd%><br><%d%>';
			ToolTip := Label;
		end;
		ToolTip := '<%loc_ldate%>';
	end;
	EndUpdate();
end

The following VB sample enumerates the levels in the chart:

With Gantt1.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_gantt.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 AxGantt1.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 < axGantt1.Chart.LevelCount; i++)
{
	EXGANTTLib.Level level = axGantt1.Chart.get_Level(i);
	System.Diagnostics.Debug.Write(level.Label);
}

The following VFP sample enumerates the levels in the chart:

With thisform.Gantt1.Chart
    For i = 0 To .LevelCount - 1
        With .Level(i)
            wait window nowait .Label
        EndWith
    Next	
EndWith

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 Gantt1
    .BeginUpdate
    With .Chart
        .LevelCount = 3
        With .Level(0)
            .Label = "<b><%mmm%>, <%yyyy%></b> <r>Week: <%ww%>"
            .Unit = EXGANTTLibCtl.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.gantt1
.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 AxGantt1
    .BeginUpdate()
    With .Chart
        .LevelCount = 3
        With .Level(0)
            .Label = "<b><%mmm%>, <%yyyy%></b> <r>Week: <%ww%>"
            .Unit = EXGANTTLib.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:

axGantt1.BeginUpdate();
EXGANTTLib.Chart chart = axGantt1.Chart;
chart.LevelCount = 3;
chart.get_Level(0).Label = "<b><%mmm%>, <%yyyy%></b> <r>Week: <%ww%>";
chart.get_Level(0).Unit = EXGANTTLib.UnitEnum.exWeek;
chart.get_Level(1).Label = "<%d1%>";
chart.get_Level(2).Label = "<%d%>";
axGantt1.EndUpdate();

 The following C++ sample displays your header using 3 levels:

m_gantt.BeginUpdate();
CChart chart = m_gantt.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_gantt.EndUpdate();

 


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.