property Bar.HistogramItems as Long
Specifies the number of items being represented in the histogram when overload histogram is shown.

 TypeDescription 
   Long A long expression that specifies the minimum number of items being show in the histogram, if positive,  or a fixed number of items, if negative. If 0, the histogram is re-scaled to fit all elements.  
By default, the HistogramItems property is 0. The property has effect while the HistogramType property is exOverload. By default, when the HistogramItems property is 0, the height of the units being displayed in the histogram is computed, so all units fit the histogram area. If the HistogramItems property is greater than 0 this value indicates the number of minimum units being displayed on the vertical axis. If the HistogramItems property less than 0, the absolute value represents the fixed number of units being displayed on the vertical axis.

For instance, the following sample shows the histogram while HistogramItems property is 0:

If the HistogramItems property is 0, and the user resizes the histogram the height of the units being displayed is automatically updated so all units fit the histogram area. Also, if the user includes or excludes items to be shown in the histogram the height of the unit is recomputed. For instance, if a single item is being included in the histogram the entire height of the histogram specifies the height for the unit for the bars. Instead, if the HistogramItems property is greater than 0, the height of the units being displayed in the histogram is changed only if requires multiple units being displayed on the vertical axis.

The following sample shows the histogram while HistogramItems property is -6:

In this case, HistogramItems property is -6, so the number of units being displayed on the vertical axis is always 6 no matter how many units are required.

The following VB sample specifies a fixed number of units being shown in the histogram on the vertical axis:
With G2antt1
	With .Chart
		.FirstVisibleDate = #1/1/2001#
		.HistogramVisible = True
		.HistogramHeight = 64
		.PaneWidth(0) = 78
		.HistogramView = 1300
		With .Bars.Item("Task")
			.HistogramPattern = exPatternBDiagonal
			.HistogramCriticalValue = 3
			.HistogramItems = -6
			.HistogramRulerLinesColor = RGB(1,0,0)
		End With
	End With
	.Columns.Add "Column"
	With .Items
		h = .AddItem("Project 1")
		.CellHasCheckBox(h,0) = True
		.CellState(h,0) = 1
		.AddBar .InsertItem(h,0,"Item 1"),"Task",#1/2/2001#,#1/4/2001#
		.AddBar .InsertItem(h,0,"Item 2"),"Task",#1/3/2001#,#1/5/2001#
		.ExpandItem(h) = True
		h = .AddItem("Project 2")
		.CellHasCheckBox(h,0) = True
		.CellState(h,0) = 1
		.AddBar .InsertItem(h,0,"Item 1"),"Task",#1/4/2001#,#1/7/2001#
		.AddBar .InsertItem(h,0,"Item 2"),"Task",#1/6/2001#,#1/8/2001#
		.ExpandItem(h) = True
		h = .AddItem("Project 3")
		.CellHasCheckBox(h,0) = True
		.CellState(h,0) = 1
		.AddBar .InsertItem(h,0,"Item 1"),"Task",#1/2/2001#,#1/4/2001#
		.AddBar .InsertItem(h,0,"Item 2"),"Task",#1/3/2001#,#1/5/2001#
		.ExpandItem(h) = True
		h = .AddItem("Project 4")
		.CellHasCheckBox(h,0) = True
		.CellState(h,0) = 1
		.AddBar .InsertItem(h,0,"Item 1"),"Task",#1/4/2001#,#1/7/2001#
		.AddBar .InsertItem(h,0,"Item 2"),"Task",#1/6/2001#,#1/8/2001#
		.ExpandItem(h) = True
	End With
End With
The following VB.NET sample specifies a fixed number of units being shown in the histogram on the vertical axis:
Dim h
With AxG2antt1
	With .Chart
		.FirstVisibleDate = #1/1/2001#
		.HistogramVisible = True
		.HistogramHeight = 64
		.PaneWidth(0) = 78
		.HistogramView = 1300
		With .Bars.Item("Task")
			.HistogramPattern = EXG2ANTTLib.PatternEnum.exPatternBDiagonal
			.HistogramCriticalValue = 3
			.HistogramItems = -6
			.HistogramRulerLinesColor = 1
		End With
	End With
	.Columns.Add "Column"
	With .Items
		h = .AddItem("Project 1")
		.CellHasCheckBox(h,0) = True
		.CellState(h,0) = 1
		.AddBar .InsertItem(h,0,"Item 1"),"Task",#1/2/2001#,#1/4/2001#
		.AddBar .InsertItem(h,0,"Item 2"),"Task",#1/3/2001#,#1/5/2001#
		.ExpandItem(h) = True
		h = .AddItem("Project 2")
		.CellHasCheckBox(h,0) = True
		.CellState(h,0) = 1
		.AddBar .InsertItem(h,0,"Item 1"),"Task",#1/4/2001#,#1/7/2001#
		.AddBar .InsertItem(h,0,"Item 2"),"Task",#1/6/2001#,#1/8/2001#
		.ExpandItem(h) = True
		h = .AddItem("Project 3")
		.CellHasCheckBox(h,0) = True
		.CellState(h,0) = 1
		.AddBar .InsertItem(h,0,"Item 1"),"Task",#1/2/2001#,#1/4/2001#
		.AddBar .InsertItem(h,0,"Item 2"),"Task",#1/3/2001#,#1/5/2001#
		.ExpandItem(h) = True
		h = .AddItem("Project 4")
		.CellHasCheckBox(h,0) = True
		.CellState(h,0) = 1
		.AddBar .InsertItem(h,0,"Item 1"),"Task",#1/4/2001#,#1/7/2001#
		.AddBar .InsertItem(h,0,"Item 2"),"Task",#1/6/2001#,#1/8/2001#
		.ExpandItem(h) = True
	End With
End With
The following C++ sample specifies a fixed number of units being shown in the histogram on the vertical axis:
/*
	Copy and paste the following directives to your header file as
	it defines the namespace 'EXG2ANTTLib' for the library: 'ExG2antt 1.0 Control Library'

	#import <ExG2antt.dll>
	using namespace EXG2ANTTLib;
*/
EXG2ANTTLib::IG2anttPtr spG2antt1 = GetDlgItem(IDC_G2ANTT1)->GetControlUnknown();
EXG2ANTTLib::IChartPtr var_Chart = spG2antt1->GetChart();
	var_Chart->PutFirstVisibleDate("1/1/2001");
	var_Chart->PutHistogramVisible(VARIANT_TRUE);
	var_Chart->PutHistogramHeight(64);
	var_Chart->PutPaneWidth(0,78);
	var_Chart->PutHistogramView((EXG2ANTTLib::HistogramViewEnum)1300);
	EXG2ANTTLib::IBarPtr var_Bar = var_Chart->GetBars()->GetItem("Task");
		var_Bar->PutHistogramPattern(EXG2ANTTLib::exPatternBDiagonal);
		var_Bar->PutHistogramCriticalValue(3);
		var_Bar->PutHistogramItems(-6);
		var_Bar->PutHistogramRulerLinesColor(RGB(1,0,0));
spG2antt1->GetColumns()->Add(L"Column");
EXG2ANTTLib::IItemsPtr var_Items = spG2antt1->GetItems();
	long h = var_Items->AddItem("Project 1");
	var_Items->PutCellHasCheckBox(h,long(0),VARIANT_TRUE);
	var_Items->PutCellState(h,long(0),1);
	var_Items->AddBar(var_Items->InsertItem(h,long(0),"Item 1"),"Task","1/2/2001","1/4/2001",vtMissing,vtMissing);
	var_Items->AddBar(var_Items->InsertItem(h,long(0),"Item 2"),"Task","1/3/2001","1/5/2001",vtMissing,vtMissing);
	var_Items->PutExpandItem(h,VARIANT_TRUE);
	h = var_Items->AddItem("Project 2");
	var_Items->PutCellHasCheckBox(h,long(0),VARIANT_TRUE);
	var_Items->PutCellState(h,long(0),1);
	var_Items->AddBar(var_Items->InsertItem(h,long(0),"Item 1"),"Task","1/4/2001","1/7/2001",vtMissing,vtMissing);
	var_Items->AddBar(var_Items->InsertItem(h,long(0),"Item 2"),"Task","1/6/2001","1/8/2001",vtMissing,vtMissing);
	var_Items->PutExpandItem(h,VARIANT_TRUE);
	h = var_Items->AddItem("Project 3");
	var_Items->PutCellHasCheckBox(h,long(0),VARIANT_TRUE);
	var_Items->PutCellState(h,long(0),1);
	var_Items->AddBar(var_Items->InsertItem(h,long(0),"Item 1"),"Task","1/2/2001","1/4/2001",vtMissing,vtMissing);
	var_Items->AddBar(var_Items->InsertItem(h,long(0),"Item 2"),"Task","1/3/2001","1/5/2001",vtMissing,vtMissing);
	var_Items->PutExpandItem(h,VARIANT_TRUE);
	h = var_Items->AddItem("Project 4");
	var_Items->PutCellHasCheckBox(h,long(0),VARIANT_TRUE);
	var_Items->PutCellState(h,long(0),1);
	var_Items->AddBar(var_Items->InsertItem(h,long(0),"Item 1"),"Task","1/4/2001","1/7/2001",vtMissing,vtMissing);
	var_Items->AddBar(var_Items->InsertItem(h,long(0),"Item 2"),"Task","1/6/2001","1/8/2001",vtMissing,vtMissing);
	var_Items->PutExpandItem(h,VARIANT_TRUE);
The following C# sample specifies a fixed number of units being shown in the histogram on the vertical axis:
EXG2ANTTLib.Chart var_Chart = axG2antt1.Chart;
	var_Chart.FirstVisibleDate = "1/1/2001";
	var_Chart.HistogramVisible = true;
	var_Chart.HistogramHeight = 64;
	var_Chart.set_PaneWidth(0 != 0,78);
	var_Chart.HistogramView = (EXG2ANTTLib.HistogramViewEnum)1300;
	EXG2ANTTLib.Bar var_Bar = var_Chart.Bars["Task"];
		var_Bar.HistogramPattern = EXG2ANTTLib.PatternEnum.exPatternBDiagonal;
		var_Bar.HistogramCriticalValue = 3;
		var_Bar.HistogramItems = -6;
		var_Bar.HistogramRulerLinesColor = 1;
axG2antt1.Columns.Add("Column");
EXG2ANTTLib.Items var_Items = axG2antt1.Items;
	int h = var_Items.AddItem("Project 1");
	var_Items.set_CellHasCheckBox(h,0,true);
	var_Items.set_CellState(h,0,1);
	var_Items.AddBar(var_Items.InsertItem(h,0,"Item 1"),"Task","1/2/2001","1/4/2001",null,null);
	var_Items.AddBar(var_Items.InsertItem(h,0,"Item 2"),"Task","1/3/2001","1/5/2001",null,null);
	var_Items.set_ExpandItem(h,true);
	h = var_Items.AddItem("Project 2");
	var_Items.set_CellHasCheckBox(h,0,true);
	var_Items.set_CellState(h,0,1);
	var_Items.AddBar(var_Items.InsertItem(h,0,"Item 1"),"Task","1/4/2001","1/7/2001",null,null);
	var_Items.AddBar(var_Items.InsertItem(h,0,"Item 2"),"Task","1/6/2001","1/8/2001",null,null);
	var_Items.set_ExpandItem(h,true);
	h = var_Items.AddItem("Project 3");
	var_Items.set_CellHasCheckBox(h,0,true);
	var_Items.set_CellState(h,0,1);
	var_Items.AddBar(var_Items.InsertItem(h,0,"Item 1"),"Task","1/2/2001","1/4/2001",null,null);
	var_Items.AddBar(var_Items.InsertItem(h,0,"Item 2"),"Task","1/3/2001","1/5/2001",null,null);
	var_Items.set_ExpandItem(h,true);
	h = var_Items.AddItem("Project 4");
	var_Items.set_CellHasCheckBox(h,0,true);
	var_Items.set_CellState(h,0,1);
	var_Items.AddBar(var_Items.InsertItem(h,0,"Item 1"),"Task","1/4/2001","1/7/2001",null,null);
	var_Items.AddBar(var_Items.InsertItem(h,0,"Item 2"),"Task","1/6/2001","1/8/2001",null,null);
	var_Items.set_ExpandItem(h,true);
The following VFP sample specifies a fixed number of units being shown in the histogram on the vertical axis:
with thisform.G2antt1
	with .Chart
		.FirstVisibleDate = {^2001-1-1}
		.HistogramVisible = .T.
		.HistogramHeight = 64
		.PaneWidth(0) = 78
		.HistogramView = 1300
		with .Bars.Item("Task")
			.HistogramPattern = 6
			.HistogramCriticalValue = 3
			.HistogramItems = -6
			.HistogramRulerLinesColor = RGB(1,0,0)
		endwith
	endwith
	.Columns.Add("Column")
	with .Items
		h = .AddItem("Project 1")
		.DefaultItem = h
		.CellHasCheckBox(0,0) = .T.
		.DefaultItem = h
		.CellState(0,0) = 1
		.AddBar(.InsertItem(h,0,"Item 1"),"Task",{^2001-1-2},{^2001-1-4})
		.AddBar(.InsertItem(h,0,"Item 2"),"Task",{^2001-1-3},{^2001-1-5})
		.DefaultItem = h
		.ExpandItem(0) = .T.
		h = .AddItem("Project 2")
		.DefaultItem = h
		.CellHasCheckBox(0,0) = .T.
		.DefaultItem = h
		.CellState(0,0) = 1
		.AddBar(.InsertItem(h,0,"Item 1"),"Task",{^2001-1-4},{^2001-1-7})
		.AddBar(.InsertItem(h,0,"Item 2"),"Task",{^2001-1-6},{^2001-1-8})
		.DefaultItem = h
		.ExpandItem(0) = .T.
		h = .AddItem("Project 3")
		.DefaultItem = h
		.CellHasCheckBox(0,0) = .T.
		.DefaultItem = h
		.CellState(0,0) = 1
		.AddBar(.InsertItem(h,0,"Item 1"),"Task",{^2001-1-2},{^2001-1-4})
		.AddBar(.InsertItem(h,0,"Item 2"),"Task",{^2001-1-3},{^2001-1-5})
		.DefaultItem = h
		.ExpandItem(0) = .T.
		h = .AddItem("Project 4")
		.DefaultItem = h
		.CellHasCheckBox(0,0) = .T.
		.DefaultItem = h
		.CellState(0,0) = 1
		.AddBar(.InsertItem(h,0,"Item 1"),"Task",{^2001-1-4},{^2001-1-7})
		.AddBar(.InsertItem(h,0,"Item 2"),"Task",{^2001-1-6},{^2001-1-8})
		.DefaultItem = h
		.ExpandItem(0) = .T.
	endwith
endwith
The following Delphi sample specifies a fixed number of units being shown in the histogram on the vertical axis:
with AxG2antt1 do
begin
	with Chart do
	begin
		FirstVisibleDate := '1/1/2001';
		HistogramVisible := True;
		HistogramHeight := 64;
		PaneWidth[0 <> 0] := 78;
		HistogramView := EXG2ANTTLib.HistogramViewEnum(1300);
		with Bars.Item['Task'] do
		begin
			HistogramPattern := EXG2ANTTLib.PatternEnum.exPatternBDiagonal;
			HistogramCriticalValue := 3;
			HistogramItems := -6;
			HistogramRulerLinesColor := 1;
		end;
	end;
	Columns.Add('Column');
	with Items do
	begin
		h := AddItem('Project 1');
		CellHasCheckBox[TObject(h),TObject(0)] := True;
		CellState[TObject(h),TObject(0)] := 1;
		AddBar(InsertItem(h,TObject(0),'Item 1'),'Task','1/2/2001','1/4/2001',Nil,Nil);
		AddBar(InsertItem(h,TObject(0),'Item 2'),'Task','1/3/2001','1/5/2001',Nil,Nil);
		ExpandItem[h] := True;
		h := AddItem('Project 2');
		CellHasCheckBox[TObject(h),TObject(0)] := True;
		CellState[TObject(h),TObject(0)] := 1;
		AddBar(InsertItem(h,TObject(0),'Item 1'),'Task','1/4/2001','1/7/2001',Nil,Nil);
		AddBar(InsertItem(h,TObject(0),'Item 2'),'Task','1/6/2001','1/8/2001',Nil,Nil);
		ExpandItem[h] := True;
		h := AddItem('Project 3');
		CellHasCheckBox[TObject(h),TObject(0)] := True;
		CellState[TObject(h),TObject(0)] := 1;
		AddBar(InsertItem(h,TObject(0),'Item 1'),'Task','1/2/2001','1/4/2001',Nil,Nil);
		AddBar(InsertItem(h,TObject(0),'Item 2'),'Task','1/3/2001','1/5/2001',Nil,Nil);
		ExpandItem[h] := True;
		h := AddItem('Project 4');
		CellHasCheckBox[TObject(h),TObject(0)] := True;
		CellState[TObject(h),TObject(0)] := 1;
		AddBar(InsertItem(h,TObject(0),'Item 1'),'Task','1/4/2001','1/7/2001',Nil,Nil);
		AddBar(InsertItem(h,TObject(0),'Item 2'),'Task','1/6/2001','1/8/2001',Nil,Nil);
		ExpandItem[h] := True;
	end;
end


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