property Level.Label as Variant
Retrieves or sets a value that indicates the format of the level's label.

 TypeDescription 
   Variant A String expression that indicates the format of the level's label, an UnitEnum expression that indicates the predefined format being used. The Label property defines predefined formats for labales.  
The Label property defines the HTML labels being displayed on the chart's header.  Use the Alignment property to specify the label's alignment. Use the ToolTip property to specify the tooltip being displayed when the cursor hovers the level. Use the BackColor and ForeColor properties to change the level's appearance.  The WeekDays property retrieves or sets a value that indicates the list of names for each week day, separated by space. Use the MonthNames property to specify the name of the months in the year. The FormatDate property formats a date. Use the ReplaceLabel property to add icons/pictures/images or change the captions of the levels. Valid date values range from January 1, 100 A.D. (-647434) to December 31, 9999 A.D. (2958465). A date value of 0 represents December 30, 1899.

The Label property supports alternative HTML labels being separated by "<|>" and values for Count and Unit being separated by "<||>". By alternate HTML label we mean that you can define a list of HTML labels that may be displayed in the chart's header based on the space allocated for the time-unit. In other words,  the control chooses automatically the alternate HTML label to be displayed for best fitting in the portion of the chart where the time-unit should be shown. 

The Label property format is "ALT1[<|>ALT2<|>...[<||>COUNT[<||>UNIT]]]" where 

The Label property may change the Unit and the Count property. You can always use a different Unit or Count by setting the property after setting the Label property. 

The following screen shots shows the chart's header using different values for UnitWidth property.

For instance, Label = "<|><%d1%><|><%d2%><|><%d3%><|><%dddd%><|><%d3%>, <%m3%> <%d%>, '<%yy%><|><%dddd%>, <%mmmm%> <%d%>, <%yyyy%><||>1<||>4096" indicates a list of 7 alternate HTML labels, the Count property set on 1 and the Unit property set on exDay (4096). 

So, the header of the level in the chart shows one of the following alternate HTML labels:

based on the space being allocated for the time unit. If the label is being shown on the base level, the UnitWidth property defines the space for the time-unit, so the control chooses the alternate HTML label which best fits the allocated space ( width ). The Font property defines the font to show the chart's labels which is also used to get the best fit label to be displayed. For any other level, the space is automatically calculated based on the base level's width. In other words, when UnitWidth property is changed or the user rescale or zoom the chart area, the chart's header displays alternate labels. If the Label property defines no alternate labels, the single representation is shown no matter of the UnitWidth, Font and other zooming settings.

The Label property may change the Unit property as in the following scenario. Let's say that you need to display the weeks so you choose to have the week number "<%ww%>" or the first day in the week in format "<%d3%>, <%m3%> <%d%>, '<%yy%>" so the Label property should be "<%ww%><|><%d3%>, <%m3%> <%d%>, '<%yy%>". If you are using this format, the Unit property will always be set on exDay, as in the second alternate label the unit is day as the minimum scale unit being found is <%d3%>  or <%d%> which indicates days. In order to correct this, you should specify the Unit to be used for the alternate labels as "<%ww%><|><%d3%>, <%m3%> <%d%>, '<%yy%><||><||>256".

For instance, if a level should display 15 to 15 minutes, you can do one of the following:

Any of these statements can be used to let the level displays minutes from 15 to 15.

The Label property supports the following built-in tags:

The following tags are displayed based on the user's Regional and Language Options:

The Label property supports the following built-in HTML tags:

Newer HTML format supports subscript and superscript like follows:

Also, newer HTML format supports decorative text like follows:

The Label property may be a combination of any of these tags. For instance, the "<b><%mmm%></b> <%d%>, '<%yy%>" displays a date like: "May 29,'05".

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.