Gantt display objects
TreeGrid documentation
Gantt column Header
One or more lines in header displaying dates
In header you can show one or more lines with dates that are displayed in the chart.
You can specify how the dates will be repeated and the format for the dates.
Up to
5 different header lines can be defined.
chg 6.3 upd 10.0 <C> string
GanttHeader1, ..., GanttHeaderX
Header time/number and format in the first header line: "repeater
#format
#shift".
The possible values of
repeater are the same as
GanttUnits, e.g. "w", "d", "h" or "1", "0.5", "2", ...
The
format is standard
TreeGrid date / time format string for date repeaters, or standard
TreeGrid number format string for number repeaters.
The
shift (new 6.4) is optional and moves the header by the
shift repeater units left, it can be floating point number. It is usually 0.5 to center the label above the position.
The number repeaters and formats are supported since 6.4.
Since 7.0 when
shift is not set and
repeater is number, the negative numbers are shifted for one unit, so zero is printed twice. Set
shift to 0 if you don't want this behavior.
For custom headers (e.g. fiscal year, more years, etc.) use
AddGanttUnits and
OnGetGanttHeader API methods.
Since 10.0 the count of Gantt headers in unlimited and is set by
GanttHeaderCount.
In the default CSS styles the individual headers have this meaning:
1 - main header line, with the important information, can have bigger font.
2 - second header line, it often has inverse colors.
3 - third header line, it can have also inverse colors and / or complementary borders to the second header
2.
4 - standard header with no special meaning and effects.
5 - small header, usually with smaller font.
6 - single header, if the Gantt header has only one line.
new 10.0 upd 13.0 <C> int
GanttHeaderCount
[6]
Count of available headers in the Gantt chart. How many GanttHeader...X attributes can be defined.
By default there are 6 headers (
prior to 13.0 it was 5), GanttHeader1, GanttHeader2, GanttHeader3, GanttHeader4, GanttHeader5, GanttHeader6.
Note the difference to GanttCount, the main bars are indexed from 0, but headers from 1.
deleted 6.3 <C> string
GanttFormat1
Moved to GanttHeader.
Date / time format to format items in the first header line, the same as standard
TreeGrid date / time format.
new 6.3 <C> bool
GanttHeaderRound1, ..., GanttHeaderRoundX
If rounds header date to workdays / work hours, defined by
GanttExclude. Only for
GanttHideExclude=1.
new 7.0 <C> string
GanttHeaderId1, ..., GanttHeaderIdX
id of the header row where the header line will be displayed. If not set, the header line will be displayed in main header.
One header row can show more Gantt header lines.
new 7.0 <C> int
GanttHeaderHeight1, ..., GanttHeaderHeightX
Height in pixels of the header line. Useful when used some special formatting in header or displaying it in more lines.
new 7.0 <C> int
GanttHeaderStyle1, ..., GanttHeaderStyleX
By default the GanttHeaderX gets the X as its style, CSS class G..GanttHeaderX.
This attribute changes style to different header index, to have e.g. style of 4th header in the first header.
Standard predefined header styles are:
1 - big,
2 - medium inverse,
3 - medium with separator,
4 - medium,
5 - small.
It is possible to set it to any string XXX and define the G..HeaderXXX CSS class, in this case set also GanttHeaderHeightX.
renamed 6.0 <C> int
GanttHeaderTrim
0 - The incomplete header items are shown,
1 - the incomplete header items are replaced by '...'
The trimming '...' is set by
<Lang><Format Cont='...' ContLeft='... ' ContRight=' ...'/></Lang> attributes.
new 10.0 <C> int
GanttHeaderMaxUnits
[10000]
Maximal count of cells in all Gantt headers together. If headers contain more cells, error is shown.
Setting this value too high can slow down the grid or even throw JS errors in some browsers, especially in IE.
new 7.0 API event string
OnGetGanttHeader
(TGrid grid, string val, int index, int date, int nextdate, string units, int width, int partial, string col)
Called for every date in every Gantt header line to get the caption displayed.
Return the new value or
val to not change the original caption.
index is the header index (from 1).
date is the first date in the range.
nextdate is the first date after the range,
units is the range unit width like
GanttUnits,
width is width of the space for the caption in pixels.
partial is
0 for full range,
1 for range trimmed from left,
2 for range trimmed from right,
3 for range trimmed from both sides. The date and nextdate are the trimmed dates in these cases.
To highlight some header cell by background or another CSS attribute return the val in <div>, e.g. return
"<div style='background:red;'>"+val+"</div>";
Background
Marks workdays, weekends or any other dates - for all rows the same
Defined by
GanttBackground (date ranges with repeater).
You can color any dates or date range that are periodically repeated as workdays, weekends, working hours and so on and also exact not repeated dates.
The background is the same for whole chart and cannot be set for individual rows.
The background is just visual setting, to exclude some date from Gantt calculation, use GanttExclude instead.
chg 6.3 upd 10.0 <C> <cell> string
GanttBackground
Date ranges displayed as background, useful for marking some period repeatedly.
Similar to GanttLines, but with two differences: the GattBackground can be repeated, but can be changed by API only by refreshing the whole Gantt background.
The order of the rendered background is GanttExclude, GanttBackground, GanttLines, GanttBase, GanttFinish. If overlaid, the latter is visible.
The format is:
rep1
#date1a
~date1b
#class1
;rep2
#date2a
~date2b
#class2
;...
The repeater
rep can be one of
GanttUnits. If it is missing, the date is not repeated. The date is repeated also before it.
The seconds date in range can be missing to show single line.
(Since 7.0) The
class is CSS class defined by GxGanttBackXXX, where Gx is the style prefix like "GW" for White and XXX is the
class value.
If the class is missing, it set to the item position in the GanttBackground, from 1.
(Since 10.0) There are 11 predefined gray classes from 0 (white) to 10 (black)
(Since 10.0) There are 17 predefined color classes, case sensitive -
Aqua, Black, Blue, Fuchsia, Gray, Green, Lime, Maroon, Navy,
Olive, Orange, Purple, Red, Silver, Teal, White, Yellow
(Since 7.0) It is possible to limit the repeating, when the
date range is wider than the
rep, the range is rounded to the
rep range and repeated only between the
dates.
For example 'w#1/5/2008~12/29/2008' marks all weekends, but only in year 2008.
(Since 7.0) It is possible to set the second date before the first one, it will be updated to correctly fill the repeat range.
For example 'd#18:00~8:00' marks all times from 18:00 to 8:00.
For example: GanttBackground = 'd#1/5/2008~1/7/2008; M#1/1/2008' colors weekends and separates months by line
Since 8.0 it can be set and displayed different for every row.
It can be much slower.
If the value is changed by API, call
RefreshGantt (
5) to show the changes.
new 10.0 <C> int
GanttAddBackground
[0]
If and how the column GanttBackground is added to the row GanttBackground, if both of them defined.
0 - no,
1 - before,
2 - after
new 8.0 chg 13.2 <Cfg> int
PrintGanttBackground
[1]
If prints global Gantt background, shown for attributes GanttBackground, GanttExclude, GanttBase, GanttFinish.
Since 13.0 if set to
2 or to
4, it prints background in <svg> to speed up the rendering.
It can cause problems for some PDF exporters.
Since 13.2 if set to
1 or
2 it prints the global background once on the grid background,
if set to
3 or
4 it prints the global background in every row background - more compatible but remarkably slower.
Since 13.2 the default value was set back to
1 because 2 has problems with PDF exporters.
new 10.0 <C> int
GanttBackgroundMaxUnits
[5000]
Maximal count of items in Gantt background. If background contain more items, error is shown.
Setting this value too high can slow down the grid or even throw JS errors in some browsers, especially in IE.
deleted 6.3 <C> string
GanttBackgroundRepeat
Replaced by repeater in GanttBackground.
GanttBackground will be repeated by these units, can be empty to not repeat. Possible values are the same as
GanttUnits.
If
GanttBackground contains more date ranges, it should contain more units (one per range), comma separated.
new 11.0 <C> <cell> string
GanttColor
Base background color of the Gantt cell, shown in place where no GanttBackground and GanttExclude piece is active.
If set to cell, it forces rendering all the column GanttBackground and GanttExclude to the cell, so it can remarkably slow down the grid if they contain many pieces.
Line
Background line, e.g. actual date - one or more vertical lines per chart, editable
new 10.0 <C> string
GanttLines
Lines or date ranges displayed as background, not repeated.
Similar to GanttBackground, but with two differences: the GattLines cannot be repeated, but can be easily changed by API.
The order of the rendered background is GanttExclude, GanttBackground, GanttLines, GanttBase, GanttFinish. If overlaid, the latter is visible.
The format is:
flags1
#date1a
~date1b
#class1
;flags2
#date2a
~date2b
#class2
;...
flags are editing flags, bit array:
&1 - to let the line move by a user,
&2 - to permit moving line to excluded dates,
&4 - the line is moved left from excluded dates instead of right. Only if not set &2.
&8 - date1a is end date instead of start date, only if date1b is missing. The line is shown before the date.
The seconds
date in range is usually missing to show single line.
class is the line CSS class part, the class is defined as GxGanttLineXXX, where Gx is style prefix, e.g. GW for White style and XXX is
class value.
There are 17 basic color classes, case
sensitive -
Aqua,
Black,
Blue,
Fuchsia,
Gray,
Green,
Lime,
Maroon,
Navy,
Olive,
Orange,
Purple,
Red,
Silver,
Teal,
White,
Yellow, these lines are one pixel wide.
There are two next sets for 17 basic colors and two and three pixels wide, e.g.
Red2 is two pixels wide and
Red3 is three pixels wide.
There is one special class
Hidden for not displayed lines - to mark some other line as changeable, e.g. the
ganttprogressline.
For example
"0#4/26/2014#Blue; 1#4/29/2014#Green3; 0#4/8/2014~4/9/2014#Silver"
new 10.0 <C> string
GanttLinesXTip
Tip string shown for individual lines on mouse hover. The X is line index from 0 in
GanttLines.
It can show also the specials:
*Start* - start date of the line,
*End* - end date of the line, if any.
To dynamically generate the tip text use
OnGanttTip API event.
new 10.0 <C> string
GanttLinesTip
Tip string shown for all lines on mouse hover in not defined the
GanttLinesXTip for the individual line.
It can show also the specials:
*Start* - start date of the line,
*End* - end date of the line, if any.
To dynamically generate the tip text use
OnGanttTip API event.
new 10.0 <C> string
GanttLineTipDateFormat
Date format for GanttLinesTip, GanttLinesXTip, GanttBaseTip, GanttBaseAutoTip, GanttFinishTip and GanttFinishAutoTip, values *Start*, *End*
new 10.0 API method type[ ]
GetGanttLine
(int index, string col = null)
Returns one Gantt line.
index is the line position from 0 in
GanttLines.
col is the Gantt column or null for the first one.
index can be also
-1 to get GanttBase line and
-2 to get GanttFinish line.
Returns array as [date1,date2,class,edit], the
date1 and
date2 are line dates as count of milliseconds since 1/1/1970.
Can be used only when the Gantt is rendered, otherwise manually parse the
GanttLines, accessible as
grid.Cols[gantt_col].GanttLines
new 10.0 API method bool
SetGanttLine
(int index, string date1, string date2, string class, bool edit, bool update = 1, string col = null)
Changes one Gantt line.
index is the line position from 0 in
GanttLines.
col is the Gantt column or null for the first one.
date1,
date2,
class,
edit are items to change. If set to null, it is not changed.
If set
update, updates also the line in fixed rows and rows with custom background or calendar.
Can be used only when the Gantt is rendered, otherwise set the
GanttLines directly as
grid.Cols[gantt_col].GanttLines.
It is
not possible to add new lines, only change existing ones. To add new lines, modify the
GanttLines directly and call
grid.RefreshGantt(5);
To hide some line, set the
date1 to empty string - the line is not deleted, it can be next shown by setting the date1 to some date.
It is possible to use the function to change
edit (
only) value of GanttBase (
index = -1) and GanttFinish (
index = -2).
Returns true for success.
new 10.0 API event bool
OnGanttLineChange
(TGrid grid, int index, int date1, int date2, string class, bool edit, int odate1, int odate2, string oclass, bool oedit)
Called before change of any Gantt line. Called from
SetGanttLine method.
index is line position from 0 in
GanttLines,
date1 and
date2 are line new dates as count of milliseconds since 1/1/1970.
class and
edit are new line values.
odate1,
odate2,
oclass and
oedit are actual values of the line.
It is called also for change of
GanttBase with
index = -1 and for
GanttFinish with
index = -2.
Return
true to suppress the change.
new 10.0 API event void
OnGanttLineChanged
(TGrid grid, int index, int date1, int date2, string class, bool edit, int odate1, int odate2, string oclass, bool oedit)
Called after change of any Gantt line. Called from
SetGanttLine method. See parameters in
OnGanttLineChange.
new 10.0 <Actions>
MoveGanttLine
Attached to OnDragGantt, cannot be attached anywhere else
Moves Gantt line under mouse cursor by mouse dragging. Used for
GanttLines,
GanttBase and
GanttFinish lines.
Mark
Mark line, e.g. actual date - one or more vertical lines per row, not editable
Defined by
GanttMark (date ranges).
It is a mark line showing some important date or deadline. It is often the same for whole column, but it need not be.
It is displayed above the other Gantt items, so the line should not be too thick.
It cannot be dynamically changed by a user, only by API.
upd 13.0 <C> <cell> string
GanttMark
Gantt source - column name or exact value
Other times to mark in chart, useful for displaying actual date or vertically divide chart to bigger units or mark weekends and so on.
It can be column name or date range string "d1~d2;d3~d4;d5;..." (date string (M/d/yyyy hh:mm:ss) or count of milliseconds).
If set to column, the column must be
Type='Text'.
These dates do
not extend the displayed date range in chart. When the date is outside the actual displayed range in chart, it is not shown.
Since 7.0 the dates can have postfix
#class to display in css class GxGanttMarkXXX with the
class index. It cannot be used for Mark set as column! For example
GanttMark='1/1/2000#2;1/7/2000#5'.
There are predefined color classes 1 - 5 with full height, 6 - 8 bottom bars, 9 - 11 top bars, 12 - 14 middle lines, 16 - 18 (new 13.0) higher middle bars to display text inside
Since 9.1 there is shown image instead of class in case the css postfix is text (not number).
By default the image is read from CSS style directory as GanttLineXXX.png, where XXX is the value set in GanttMark. It can be changed by
GanttMarkPath.
There are four predefined images for lines 'A' as line
<, 'B' as line
>, 'C' as line
/ and 'D' as line
\
The image is always resized or shrunk to fill the whole date range defined by the GanttMark. To display normal image in Gantt use
GanttFlags instead.
new 13.0 <C> <cell> string
GanttMarkTexts
Gantt source - column name or exact value
A list of inner html texts for the individual marks. The texts can extend the marked area.
Separated by semicolon or by
GanttTextsSeparator.
It can be column name or a list of strings.
<C> <cell> string
GanttMarkRound
['m']
Mark rounding, to these units will be all dates in
GanttMark rounded, possible values are the same as
GanttUnits.
To display just thin vertical lines, set it to 'm', for thicker lines higher the value according to actual
GanttUnits used.
new 9.1 <C> string
GanttMarkPath
Path to images for GanttMark when the third parameter in definition is string that represents image.
If the GanttMarkPath is not set, the images are read from actual TreeGrid CSS directory in format GanttLineXXX.png.
If the GanttMarkPath is set (even to empty string), the images are read from this path (relative to actual HTML page) as PathXXX.png
new 13.0 <C> string
GanttMarkExt
["svg" / "gif"]
Extension for all GanttMark images (if the css class index is text). Can be set to empty string to not use extension at all.
Default value is "svg" except on IE8 and older where is "gif".
If not set (default) and the GanttMark value is progress line default image "A", "B", "C" or "D", it uses CSS class GanttMarkA/B/C/D instead of the <img>.
new 13.0 <C> string
GanttTextsSeparator
If set, it is used instead of Lang.Format.ValueSeparator to separate texts in GanttFlagTexts and GanttMarkTexts.
new 9.1 formula string
ganttprogressline
(string date, string left = 'A', string right = '0', int none = 15, string start = null, string end = null, string duration = null, string complete = null, string ganttcol = null)
Calculates progress line as
GanttMark string for given cell. Use it in formula for GanttMark column to show the progress line as GanttMark.
date is base date of the progress line (as English date string or count of milliseconds since 1/1/1970).
left is name of the left side progress line image (for dates before base
date), set it to
0 to never show left side progress line or to
1 for default image '
A'.
right is name of the right side progress line image (for date after base
date), set it to
0 to never show right side progress line or to
1 for default image '
B'.
none is GanttMask CSS class used for straight progress line
For
type = 0 it shows the progress line only left side to
date. For
type = 1 it show also right side progress line.
start is tasks start date (string or count of ms). If it is null, it is used value GanttStart.
end is tasks end date (string or count of ms). If it is null, it is used value GanttEnd. If GanttEnd is also not set, it uses
duration.
duration is task duration in GanttDataUnits. If it is null, it is used value GanttDuration. Used only if
end is not defined.
complete is percent completion (0 - 100). If it is null, it is used value GanttComplete. For 100% complete tasks is never shown left progress line, for 0% complete tasks is never shown right progress line.
It is possible to have more progress lines in chart by calling more these functions like
Formula="ganttprogressline(parameters1)+';'+ganttprogressline(parameters2)+';'+ganttprogressline(parameters3)+..."