property Chart.HistogramView as HistogramViewEnum
Specifies the list of items being included in the histogram.

 TypeDescription 
   HistogramViewEnum A HistogramView type that specifies the list of items being displayed in the histogram.   
By default, the HistogramView property is exHistogramVisibleItems, which makes the control to display the histogram for visible items only. The HistogramView property specify the  items being represented in the histogram view. Use the HistogramVisible property to show the histogram bar/view. Use the HistogramHeight property to specify at runtime the height of the histogram bar being displayed on the bottom side of the control.  

If the HistogramView property is:

The following screen shot shows the items grouped by their parents ( the exHistogramNoGrouping option is not set )

The following screen shot shows the items grouped by their parents ( the exHistogramNoGrouping option is set )

 

Only the exHistogramVisibleItems and exHistogramSelectedItems shows the histogram by grouping the items based on their common parent. The rest of options shows the histogram in the same space, without grouping.

Please follow the steps in order to view your bars in the histogram.

  1. Changes the HistogramVisible property on True ( by default, it is False ). After setting the HistogramVisible property on True, the control shows a horizontal splitter in the bottom side of the control.
  2. Adjusts the height of the histogram view using the HistogramHeight property ( by default it is 0 ). After setting the HistogramHeight property on a value greater than 0, the control shows a the histogram view in the bottom side of the control.
  3. Changes the HistogramPattern or/and HistogramColor property, else no bars will be shown in the histogram. The HistogramPattern/HistogramColor properties belong to a Bar object. For instance the Chart.Bars("Task").HistogramPattern = exPatternDot, specifies that the Task bars will be represented in the histogram using the exPatternDot pattern ()

The followings are optional properties that you can set in order to customize your histogram:

 

The following screen shot shows the histogram for all items ( as they are all checked in the first column ):

The following screen shot shows the histogram for the last 2 items ( Item 2, Item 3 as they are checked ):

The following VB sample shows the histogram for "Task" bars in the checked items:

With G2antt1
	.BeginUpdate 
	With .Chart
		.FirstVisibleDate = #1/1/2001#
		.HistogramVisible = True
		.HistogramView = exHistogramCheckedItems
		.HistogramHeight = 32
		.Bars.Item("Task").HistogramPattern = exPatternBDiagonal
	End With
	.Columns.Add("Column").Def(exCellHasCheckBox) = True
	With .Items
		.AddBar .AddItem("Item 1"),"Task",#1/3/2001#,#1/5/2001#
		h = .AddItem("Item 2")
		.AddBar h,"Task",#1/4/2001#,#1/7/2001#
		.CellState(h,0) = 1
		h = .AddItem("Item 3")
		.AddBar h,"Task",#1/2/2001#,#1/5/2001#
		.CellState(h,0) = 1
	End With
	.EndUpdate 
End With

The following VB.NET sample shows the histogram for "Task" bars in the checked items:

Dim h
With AxG2antt1
	.BeginUpdate 
	With .Chart
		.FirstVisibleDate = #1/1/2001#
		.HistogramVisible = True
		.HistogramView = EXG2ANTTLib.HistogramViewEnum.exHistogramCheckedItems
		.HistogramHeight = 32
		.Bars.Item("Task").HistogramPattern = EXG2ANTTLib.PatternEnum.exPatternBDiagonal
	End With
	.Columns.Add("Column").Def(EXG2ANTTLib.DefColumnEnum.exCellHasCheckBox) = True
	With .Items
		.AddBar .AddItem("Item 1"),"Task",#1/3/2001#,#1/5/2001#
		h = .AddItem("Item 2")
		.AddBar h,"Task",#1/4/2001#,#1/7/2001#
		.CellState(h,0) = 1
		h = .AddItem("Item 3")
		.AddBar h,"Task",#1/2/2001#,#1/5/2001#
		.CellState(h,0) = 1
	End With
	.EndUpdate 
End With

The following C# sample shows the histogram for "Task" bars in the checked items:

axG2antt1.BeginUpdate();
EXG2ANTTLib.Chart var_Chart = axG2antt1.Chart;
	var_Chart.FirstVisibleDate = "1/1/2001";
	var_Chart.HistogramVisible = true;
	var_Chart.HistogramView = EXG2ANTTLib.HistogramViewEnum.exHistogramCheckedItems;
	var_Chart.HistogramHeight = 32;
	var_Chart.Bars["Task"].HistogramPattern = EXG2ANTTLib.PatternEnum.exPatternBDiagonal;
(axG2antt1.Columns.Add("Column") as EXG2ANTTLib.Column).set_Def(EXG2ANTTLib.DefColumnEnum.exCellHasCheckBox,true);
EXG2ANTTLib.Items var_Items = axG2antt1.Items;
	var_Items.AddBar(var_Items.AddItem("Item 1"),"Task","1/3/2001","1/5/2001",null,null);
	int h = var_Items.AddItem("Item 2");
	var_Items.AddBar(h,"Task","1/4/2001","1/7/2001",null,null);
	var_Items.set_CellState(h,0,1);
	h = var_Items.AddItem("Item 3");
	var_Items.AddBar(h,"Task","1/2/2001","1/5/2001",null,null);
	var_Items.set_CellState(h,0,1);
axG2antt1.EndUpdate();

The following C++ sample shows the histogram for "Task" bars in the checked items:

/*
	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 "D:\\Windows\\System32\\ExG2antt.dll"
	using namespace EXG2ANTTLib;
*/
EXG2ANTTLib::IG2anttPtr spG2antt1 = GetDlgItem(IDC_G2ANTT1)->GetControlUnknown();
spG2antt1->BeginUpdate();
EXG2ANTTLib::IChartPtr var_Chart = spG2antt1->GetChart();
	var_Chart->PutFirstVisibleDate("1/1/2001");
	var_Chart->PutHistogramVisible(VARIANT_TRUE);
	var_Chart->PutHistogramView(EXG2ANTTLib::exHistogramCheckedItems);
	var_Chart->PutHistogramHeight(32);
	var_Chart->GetBars()->GetItem("Task")->PutHistogramPattern(EXG2ANTTLib::exPatternBDiagonal);
((EXG2ANTTLib::IColumnPtr)(spG2antt1->GetColumns()->Add(L"Column")))->PutDef(EXG2ANTTLib::exCellHasCheckBox,VARIANT_TRUE);
EXG2ANTTLib::IItemsPtr var_Items = spG2antt1->GetItems();
	var_Items->AddBar(var_Items->AddItem("Item 1"),"Task","1/3/2001","1/5/2001",vtMissing,vtMissing);
	long h = var_Items->AddItem("Item 2");
	var_Items->AddBar(h,"Task","1/4/2001","1/7/2001",vtMissing,vtMissing);
	var_Items->PutCellState(h,long(0),1);
	h = var_Items->AddItem("Item 3");
	var_Items->AddBar(h,"Task","1/2/2001","1/5/2001",vtMissing,vtMissing);
	var_Items->PutCellState(h,long(0),1);
spG2antt1->EndUpdate();

The following VFP sample shows the histogram for "Task" bars in the checked items:

with thisform.G2antt1
	.BeginUpdate
	with .Chart
		.FirstVisibleDate = {^2001-1-1}
		.HistogramVisible = .T.
		.HistogramView = 4
		.HistogramHeight = 32
		.Bars.Item("Task").HistogramPattern = 6
	endwith
	.Columns.Add("Column").Def(0) = .T.
	with .Items
		.AddBar(.AddItem("Item 1"),"Task",{^2001-1-3},{^2001-1-5})
		h = .AddItem("Item 2")
		.AddBar(h,"Task",{^2001-1-4},{^2001-1-7})
		.CellState(h,0) = 1
		h = .AddItem("Item 3")
		.AddBar(h,"Task",{^2001-1-2},{^2001-1-5})
		.CellState(h,0) = 1
	endwith
	.EndUpdate
endwith
 


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