TreeGrid v6.4
Gantt resources
The resource list is defined globally for whole chart in <Resources> root tag.
The individual resources can be assigned to tasks to compute their price.
The tasks can filtered according to the assigned resources.
TreeGrid provides various calculations for resources and prices.
Resources are defined globally for the whole project in root tag <Resources>, individual resources are defined in nested <R> tags.
For example simple definition can be:
<Grid>
...
<Resources>
<R Name=’Resource1’ Price=’100’/>
<R Name=’Resource2’ Price=’200’/>
</Resources>
</Grid>
<Resources> <R> new 6.4 .
One resource definition. It can be placed only in root <Resources> tag.
<R> string Name new 6.4 .
Unique name of the resource.
<R> string Text new 6.4 .
Text displayed for the resource in the popup menu for assigning resources to the task.
If not set, the Name is used.
<R> int Type [1] new 7.0 .
Type of the resource.
1 – Work, not consumed resource. The Availability is the maximal count per time unit.
2 – Material, consumed resource. The Availability is calculated from start and consumed per every used time unit.
<R> float Price new 6.4 .
Price per one resource unit.
The resource units are set by GanttDataUnits.
<R> string Availability new 7.0.
Resource availability. Maximal summary count of resource units assigned to all tasks at one time unit (Type=1) or for whole project (Type=2).
Since 7.0 it can contain more values for given date ranges, in format: repeater1#date1a~date1b#count1;repeater2#date2a~date2b#count2;....
The possible values of repeater are the same as GanttUnits, e.g. “w”, “d”, “h” or “1”, “0.5”, “2”, ... If the repeater is not present, the date range is not repeated
The date range is range where the count of resources is available. The date range can be periodically repeated by the repeater.
For Material Type resources is used only the first date from date range as date when the count of resources arrives.
If some date ranges are overlapped, the count values are summed. The count can be also negative to reduce the count for some range.
For example “3;w#1/3/2011~1/4/2011#-1” – The resource count is 3 except Mondays when is 2.
It is possible to limit the repeating - when the date range is wider than the repeater, the range is rounded to the repeater range and repeated only between the dates.
For example ‘w#1/5/2008~12/29/2008#1’ marks all weekends, but only in year 2008.
The availability can be easily edited by users in dialog for Dates type Button.
<R> float MaxCount new 6.4; deleted 7.0.
Renamed to Availability
API variable object[] Resources new 6.4 .
The array of all resources in grid, accessible by its name.
The resource objects contain all the XML attributes like Price or Availability.
Example: Grid.Resources.Worker.Price = 150;
Every task can have assigned one or more resources from global <Resources> list. It can have also specified how many resource units it uses.
<C><cell> string GanttResources Gantt source – column name or exact value chg 7.0 .
The resources assigned to the task. It can be column name or string
It is in format: name1*amount1+extra1;name2*amount2+extra2;...
Resources are separated by semicolon (defined by <Format ValueSeparator/>), the name and amount are separated by asterisk (defined by <Format CountSeparator/>),
the extra is separated by plus (defined by <Format AddSeparator/>).
The name is resource Name.
The amount is amount of resource units per task data unit. The amount can be omitted if it is 1 and extra is not defined. Or is 0 and extra is defined.
The extra is extra amount of resource units independent on the task duration. The extra can be omitted if it is 0. This item changed its meaning in 7.0!
If the name and amount are both omitted, the extra is extra price for the task independent on resources and task duration. There should be only one such extra price per task.
The GanttResources can be also just plain text to display it next to task, without filtering and pricing functionality.
<C> int GanttResourcesAssign [4] new 6.4 .
How the resources can be assigned to the task, affects the menu for assigning resources.
The behavior can be more modified also by GanttResourcesMenu.
0 – Only one resource can be assigned to the task, the menu is clickable. The Extra prices are not shown.
1 – The resources can be assigned only as 0/1, the checkboxes are shown - set Default: { Bool:1 }
2 – The resources can be assigned as 0 – 10, the enums are shown – set Default: { Enum:1, Width:22, Items:["","1","2","3","4","5","6","7","8","9","10"] }
3 – The resources can be assigned as integers, the edits are shown – set Default: { Edit:1, Width:40, Type:”Int”, Size:5 }
4 – The resources can be assigned as floats, the edits are shown –
set Default: { Edit:1, Width:60, Type:”Float”, Format:"0.##;;", DisplayFormat:"0.00;;", EditMask:"^\\d{0,5}(\\.\\d{0,2})?$"}
5 – Only extra price and resource units permitted by GanttResourcesExtra are shown.
<C> int GanttResourcesExtra [0] new 6.4; chg 7.0.
If and how will be possible to add extra prices and resource units to tasks when editing resources from menu.
0 – no extra price possible.
1 – one extra price per whole task
2 – extra resource units per task
3 – both extra price and extra units
If set to 1 or 3, the resource names should not be numbers.
<C><cell> string GanttResourcesMenu new 6.4 .
Optional menu to assign the resources to the task. Here is possible to specify which resources and how can be assigned to the individual task.
It is standard TreeGrid menu.
The items must be named (Name attribute) as resource names to be correctly assigned.
The Name of the extra task price item must be “Extra”, the names of extra resource units must be name+”Extra”
<Actions> EditGanttResource Attached to OnDblClickGantt event .
Lets a user to assign resources for the task in popup menu
The tasks can be easily filtered according to assigned resources.
User interface for filtering by resources can be added to grid by cell Type=’SelectGanttResources’
<Space cell> string Type Type=”SelectGanttResources” new 6.3 .
Special combo box to choose resources to display in grid. It hides all rows that do not contain any selected resources
It presets these cell attribute: Type=”Html” Button=”Defaults” Defaults= "|*None|-|*RowsVariableCol"+resource col+"*"
OnChange= "Grid.FilterTextRange('"+ resource col +"',Value);" Range=”1”
Requires GanttResources to be defined in <C> tag.
<C> string GanttResourcesFilter Saved to cookies, to avoid it set <Cfg GanttLap=’1’/> new 6.4 .
Predefined filter for the resources, contains the resource names separated by semicolon.
The grid will show only tasks containing these resources.
API method float GetGanttPrice (TRow row, string col, int bar = null) new 6.4 .
Returns price of the bar according to its duration and assigned resources
If bar is null uses bar according to the GanttObject. Otherwise bar is 1 for main bar, 2 for flow and 3 for run.
In Formula it can be called as Grid.GetGanttPrice(Row,”XXX”) where XXX is Gantt column name.
API method float GetGanttResourceCount (string res, int start, int end, int type, string col, string def) new 6.4 .
Returns information about the resource res usage between dates start and end.
The start and end can be Date object, number of milliseconds or date string in English.
def – name of default row (Def attribute). Only variable rows with this default will be iterated. If not set, all variable rows are iterated.
col – gantt column to use, if not set, the first gantt column in grid will be used
type = 0 – returns Total – Sum of all resource units used in the range
type = 1 – returns Peak – Maximum count of the resource in the range at the same time.
type = 2 – returns Average – Average usage of the resource in the range
API method type[][] GetResourceErrors (string name, int type = 6) new 8.0 .
Returns all errors or usage in grid for the resource name.
Returns two dimensional array [[Start1,End1,Count1], [Start2,End2,Count2], [Start3,End3,Count3],...]
In date range Start-End there is resource available Count. Negative Count means resource error.
type = 1 – resources usage (only usage)
3 – resource availability (only availability)
5 – free resources (availability – usage),
6 – only resource errors (availability – usage, only negative Count),
Other values reserved.
API method string GetResourceUsage (string name, int type, TRow row, int opt, string def, string col) new 8.0 .
Returns Availability string as usage of given resource in chart.
Use it in formulas for own calculation and showing Availability chart.
The returned string can differ from standard availability format, but it is supported in availability chart and in negav.
name is the name of the resource. It does not need to be defined by <R> tag, it just checks the GanttResource attribute values of given tasks.
type is type of the resource, 1 – work, 2 – material.
opt specifies which rows will be iterated: 0 – only the row, or the bit array:
1.bit (&1) – children of the row, 2.bit (&2) – deep (all nested children in tree), 3.bit (&4) – all siblings of the row, 4.bit (&8) – the row itself
def if set, only rows with Def attribute named def will be iterated
col the Gantt column
API method float[][] GetGanttResourcesUsage (string def, TRow row, string col, string units, int bar, bool notmp) new 6.4; deleted 8.0.
Removed, replaced by GetResourceErrors.
API method float[] GetGanttResourceAvailability (string resource, string col) new 7.0; deleted 8.0.
Removed, replaced by GetResourceErrors.
formula float ganttresourcepeak (string resource, string def) new 6.4 .
Returns maximal count of the resource used in grid at one time
resource is Name of the resource.
def is name of default row (Def attribute). Only variable rows with this default will be iterated. If not set, all variable rows are iterated.
formula float ganttresourceunits (string resource, string def) new 6.4 .
Returns count of all allocated units for given resource in the whole grid.
If the value is multiplied by resource price, you will get the summary cost of the resource in the project
def is name of default row (Def attribute). Only variable rows with this default will be iterated. If not set, all variable rows are iterated.
formula float ganttresourcesextra (string def) new 7.0 .
Returns summary of extra prices assigned to all tasks
def is name of default row (Def attribute). Only variable rows with this default will be iterated. If not set, all variable rows are iterated.
formula float ganttresourceextra (string resource, string def) deleted 7.0.
Since 7.0 version there are no extra prices per resource, only per task.
Universal chart to show availability or usage of normal or custom/not defined resource.
<C><cell> string GanttAvailability new 8.0 .
Defines the Availability chart sources.
Comma separated column (or row attribute) names, every value represents one chart.
For example GanttAvailability=’A,B,C’ shows three availability charts according to cell values in A, B and C column.
The Availability format (in the individual sources, e.g. in the cells A, B and C):
repeater1#date1a~date1b#count1;repeater2#date2a~date2b#count2;....
The possible values of repeater are the same as GanttUnits, e.g. “w”, “d”, “h” or “1”, “0.5”, “2”, ... If the repeater is not present, the date range is not repeated
The date range is range where the count of resources is available. The date range can be periodically repeated by the repeater.
For Material type resources is used only the first date from date range as date when the count of resources arrives.
If some date ranges are overlapped, the count values are summed. The count can be also negative to reduce the count for some range.
It can be also one number to be present for whole range, or arrives on start for Material resource.
For example “3;w#1/3/2011~1/4/2011#-1” – The resource count is 3 except Mondays when is 2.
It is possible to limit the repeating - when the date range is wider than the repeater, the range is rounded to the repeater range and repeated only between the dates.
For example ‘w#1/5/2008~12/29/2008#1’ marks all weekends, but only in year 2008.
There are special settings to display global resource (defined in <R> tags) usage and availability charts
Instead if the column name use: resource_name#chart_type#def_name. It is possible to mix the resource and standard availability charts.
For example “R1#3,CellR2#1,A,B” it shows four charts, two for the resources R1 and R2 and two for the availability definition in cells A and B
The resource_name can be direct resource name or column name where the resource name is stored.
The chart_type is:
1 – resource usage by the tasks in chart. Uses Green class by default.
2 – resource usage, for Work is the same as 1, for Material shows constant usage, not incremental. Uses Green class by default.
3 – availability chart, shows chart for the resource Availability value. Uses Yellow Class by default.
4 – actual availability at given times, for Work it is the same as 3, for Material is similar to 5, but shifted by one GanttDataUnit. Uses Yellow Class by default.
5 – free resources chart (availability minus usage). Uses default (blue/red) class by default.
6 – resource errors (availability minus usage, only negative values). Uses Red class by default.
7 – resource errors, positive (availability minus usage, only negative values as positive values). Uses Red class by default.
8 – resource errors, full (availability minus usage, only negative values as full usage at given time). Uses Red class by default.
The def_name is optional and if set, the resource usage chart iterates only rows with given Def name.
The resource usage for fixed row it counts all tasks in chart, for variable row it counts only children.
<C><cell> int GanttAvailabilityType [1] new 8.0 .
Type of the resource.
1 – Work, not consumed resource. Work resource is available only in defined range.
2 – Material, consumed resource. Material resource arrives on defined date and is available forever.
It can be: a) one number as type for all Availability charts, b) comma separated numbers (the same count as the Availability definition), one number per availability chart
c) column or attribute name. This cell or attribute contains the one or more numbers as type definition
<C><cell> string GanttAvailabilityClass [] new 8.0 .
Name of custom CSS class to be used for the availability chart(s). To this name is added prefix GxGanttAvailability, where Gx is grid style prefix, e.g. GM
There are predefined color classes: Aqua, Black, Blue, Fuchsia, Gray, Green, Lime, Maroon, Navy, Olive, Orange, Purple, Red, Silver, Teal, White, Yellow
If no Class is defined, the chart is blue for positive numbers and red for negative number. These color classes provide the same color for both positive and negative numbers.
It can be: a) one string as class for all Availability charts, b) comma separated strings (the same count as the Availability definition), one class name per availability chart
c) column or attribute name. This cell or attribute contains the one or more strings as class name
API event string OnGetAvailabilityClass (TGrid grid, TRow row, string col, int value, string src, string cls) new 8.0 .
Called to compute Availability CSS class dynamically according to the value.
value is the value to be shown in the chart, cls is predefined class.
src is source column, one part from GanttAvailability.
Return new CSS class to be used , as full class name including all prefixes, e.g. “GMGanttAvailabilityRed”
<C><cell> int GanttAvailabilityExclude [0] new 8.0 .
How the GanttExclude in the target row will be applied to the chart.
0 – Ignore, the charts will be shown as defined, the chart boxes can start or end on excluded dates
1 – Apply only to bounds, the chart boxes will not start and end on excluded dates, but can contain exclude dates.
2 – Apply everywhere, the chart boxes will be shown only on not excluded dates, they will be split to these ranges.
It can be: a) one number as value for all Availability charts, b) comma separated numbers (the same count as the Availability definition), one value per availability chart.
Ignored for Material resources.
<C><cell> string GanttAvailabilityFormat [] new 8.0 .
Format of the numbers shown in the availability chart.
The same as TreeGrid number format.
It can be: a) one number as value for all Availability charts, b) comma separated numbers (the same count as the Availability definition), one value per availability chart
<C><cell> string GanttAvailabilityTextWidth [15] new 8.0 .
Approximate width of one text label in the chart, in pixels.
Controls how many text values (the numbers), will be show in chart, the bigger value, the less texts.
It can be: a) one number as value for all Availability charts, b) comma separated numbers (the same count as the Availability definition), one value per availability chart
<C><cell> int GanttAvailabilityShift [] new 8.0 .
Shift down of the whole chart (all charts), in pixels. Just to display under other Gantt objects in the same cell.
<C> bool GanttAvailabilityZero [0] new 8.0 .
If set to 1, the zero values will be shown in chart too, as small positive boxes
<C><cell> int GanttAvailabilityMin [] new 8.0 .
Minimal value in the chart, specifies height of the chart, lower limit. Lower values will be displayed as high as this limit, their size label will be unchanged.
If not set, the lower limit will be calculated as the smallest value in all the Availability charts in the row
<C><cell> int GanttAvailabilityMax [] new 8.0 .
Maximal value in the chart, specifies height of the chart, upper limit. Higher values will be displayed as high as this limit, their size label will be unchanged.
If not set, the upper limit will be calculated as the biggest value in all the Availability charts in the row
formula string negav (string availability) new 8.0 .
Negates the Availability definition, just changes sign of all counts in the definition.
Use it in formulas to subtract Availability values.
Don’t forget to add the ‘;’ when summing or subtracting the Availability values!
For example Formula = ” Col1 + ’;’ + Col2 + ”;” + negav(Col3) ”, all three columns contain the Availability definitions
Replaced by GanttAvailability with special resource format string.
The usage of individual resource in grid can be shown in row in gantt Chart object of type “Resources”.
Set attribute GanttChart=”Resources”.
The resources usage chart can be combined also with other Gantt objects.
<C><cell> string GanttChart GanttChart = “Resources” new 6.4; deleted 8.0.
Shows the resource usage chart in the Gantt cell
<C><cell> string GanttChartResource new 6.4; deleted 8.0.
Name of the resource to show in the resource usage chart.
<C><cell> int GanttChartResourceType [3] new 7.0; deleted 8.0.
What chart will be shown.
1 – resource usage, 2 – resource availability, 3 – both resource usage and availability
4 – resource errors, 6 – both resource errors and availability
The values 5 and 7 are also possible, but it has not sense to show both resource errors and usage charts.
<C><cell> string GanttChartResourceDef new 6.4; deleted 8.0.
If set, only rows with the given default name (Def attribute) are iterated for the resource usage.
<C><cell> string GanttChartResourceFormat new 6.4; deleted 8.0.
Format of the number shown in the resource chart.
The same as TreeGrid number format.
The resource usage chart can be automatically generated from another (even invisible) grid.
The resources list can be modified, the resources can be added, deleted, changed or renamed.
There are must be two grids on page, master and detail.
Detail grid is the grid displaying the resources usage chart.
It should have defined only layout XML source.
The body rows are automatically generated from master’s <Resources> list. This way is defined by detail’s attributes <Cfg GanttResources... /> attributes.
The detail grid can contain Gantt column to show the resources usage from the master grid. Use the attributes for Resources usage chart.
The detail’s Gantt column reads these attributes from master’s Gantt column:
DataUnits,EndLast,Exclude,Include,MaxExclude,HeaderTrim,Background,Zoom,SmoothZoom,ZoomList,Width,Units and the <Zoom> tag
Changes in the resources list should be uploaded from detail grid as normal changes in data rows.
Master grid is the source grid.
The master grid must contain standard Gantt chart with tasks with assigned resources and global resources list in <Resources>.
The master’s <Resources> list is automatically updated after any change (add, deleted, modify, rename) in the detail grid.
The master grid be displayed and recalculated according to the changes in resources.
The resources assigned to tasks are not automatically changed after resource is renamed or deleted and should be done manually in some API event.
Or the master grid can be hidden (<treegrid Hidden=’1’) and used only as resources list source
<Cfg> string GanttResourcesMaster new 6.4 .
Base attribute in automatically generated resource usage chart.
Specifies id of the master grid from where this detail grid’s resource chart will be calculated.
<Cfg> string GanttResourcesName [“Name”] new 6.4 .
Name of column in detail grid where the resource Name will be displayed and edited
<Cfg> string GanttResourcesType [“Type”] new 7.0 .
Name of column in detail grid where the resource Type will be displayed and edited
<Cfg> string GanttResourcesPrice [“Price”] new 6.4 .
Name of column in detail grid where the resource Price will be displayed and edited
<Cfg> string GanttResourcesAvailability [“Availability”] new 7.0 .
Name of column in detail grid where the resource Availability will be displayed and edited
<Cfg> string GanttResourcesMaxCount [“MaxCount”] new 6.4; deleted 7.0 .
Renamed to GanttResourcesAvailability
<Cfg> string GanttResourcesGantt [first Gantt column in master grid] new 6.4 .
The Gantt column in master grid where to read the resources usage (this attribute is still set in detail grid).
<Cfg> string GanttResourcesChart [first Gantt column in detail grid] new 6.4 .
The Gantt column in detail grid where to display the resources chart
<treegrid,bdo> bool Hidden [0] new 6.4 .
If set to 1 the grid is never rendered and can be used as invisible data source for other grids or other page components.
The hidden grid has not set MainTag and cannot be shown at all.
It can be set in master grid to use it just as data source.