new Gantt(client, oOptionsopt)
The ExGantt/JS component is our approach to create timeline charts (also known as Gantt charts). Gantt chart is a time-phased graphic display of activity durations. Activities are listed with other tabular information on the left side with time intervals over the bars. Activity durations are shown in the form of horizontal bars. The ExGantt/JS is a HTML standalone-component, written in pure JavaScript, that uses no third-party libraries.
The ExGantt/JS component supports/inherits all objects, properties, members, methods and events of the ExTree/JS component.
Every option of the Gantt.Options and Tree.Options types has associated a property of the control. For instance, the option:
allowActions {string}, customizes the actions the user can perform once the user clicks or touches the controlis associated with the property:
AllowActions {string}, customizes the actions the user can perform once the user clicks or touches the controlwhich means that the following statements are equivalent:
oGantt.Options = {allowActions: "scroll"}where oGantt is an object of Gantt type
oGantt.SetOptions({allowActions: "scroll"})
oGantt.AllowActions = "scroll"
oGantt.SetAllowActions("scroll")
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
client |
any | The client parameter indicates the control's client area as:
|
|
oOptions |
object |
<optional> |
An object of Tree.Options type that defines different options to display the control. Additionally, it supports all fields of Gantt.Options class. |
Requires:
- module:exontrol.commmon.min.js
- module:exontrol.menu.min.js
- module:exontrol.tree.min.js
Requires
- module:exontrol.commmon.min.js
- module:exontrol.menu.min.js
- module:exontrol.tree.min.js
Classes
Members
(static) DefCBCap :string
The DefCBCap field defines the bar's caption to show within the label of the combobox. The DefCBCap field is similar with the item-bar's caption option (exBarCaption).
The DefCBCap supports exHTML format, including the <%=formula%> tag, where formula is an expression that supports predefined operators, functions and % keywords such as %0 (itembar's property), %C0 (cell's value), %CD0 (cell's extra-data) or %CS0 (cell' checkbox-state)
The caption-expression supports the following keywords:
%0, %1, %2, ... specifies the value/option of the item-bar as name, start, end and so on (ItemBarPropertyEnum type).
%C0, %C1, %C2, ... specifies the caption of the cell, or the string the cell displays in the column with the index 0, 1 2, ...
%CD0, %CD1, %CD2, ... specifies the item-bar's user-date in the column with the index 0, 1 2, ...
%CS0, %CS1, %CS2, ... specifies the item-bar's state in the column with the index 0, 1 2, ...
Type:
- string
- Since:
- 1.9
Example
"<%=shortdate(%1)%> - <%=shortdate(%2)%>" {string}, displays the start and end margins of the item-bar
"<b><%=(%CS0 ? %0 : ``)%></b><%=(%CS0 ? `` : %0)%>" {string}, displays the item-bar's name in bold only if the first cell is checked )
DefCBCap
(static, readonly) GroupBarsOptionsEnum :number
The Gantt.GroupBarsOptionsEnum type specifies how two bars are grouped together. It can specify options to prevent changing the lengths of the bars or limit the interval between them when they are grouped.
Type:
- number
Properties:
Name | value | Type | Description |
---|---|---|---|
exGroupBarsNone |
-1 |
number | Performs ungrouping the bars or specifies that the bars are not grouped. The exGroupBarsNone can't be used with any other options |
exGroupBarsOptionNone |
0 |
number | Specifies no options when grouping bars (default option) |
exPreserveBarLength |
3 |
number | Preserves the length of both bars when grouping. The length of both bars is not changed when another bar in the same group may change the length of bars A and B. |
exPreserveBarLengthA |
1 |
number | Preserves the length of the bar A when grouping. The length of the bar A is not changed if another bar in the same group may change it by grouping. Use the exPreserveBarLength value to specify that both bars should preserve their lengths. |
exPreserveBarLengthB |
2 |
number | Preserves the length of the bar B when grouping. The length of the bar B is not changed if another bar in the same group may change it by grouping. Use the exPreserveBarLength value to specify that both bars should preserve their lengths |
exIgnoreOriginalInterval |
4 |
number | Ignores the original interval between bars when grouping. At the moment GroupBars method is called, the control keeps the original interval between bars, so this option will specify whether to handle or not. For instance, you can have the exIgnoreOriginalInterval, and you can specify a different interval between bars using the first parameter ( Fixed Interval ) in the Options parameter of the GroupBars method. |
exLimitInterval |
24 |
number | Limits the interval between bars so it fits a specified range. |
exLimitIntervalMin |
8 |
number | Limits the interval between bars so it can't be less than a specified value. |
exLimitIntervalMax |
16 |
number | Limits the interval between bars so it can't be greater than a specified value. |
exFlexibleInterval |
32 |
number | The interval between bars is not limited and the bar B can be moved anywhere to the right of the bar A. |
- Since:
- 3.3
(static, readonly) HistogramCumulativeOriginalColorBarsEnum :number
The Gantt.HistogramCumulativeOriginalColorBarsEnum type indicates whether the color for the bars being represented in the histogram is changed.
Type:
- number
Properties:
Name | value | Type | Description |
---|---|---|---|
exShowCumulativeColor |
-1 |
number | The color for bar is not changed, but its reflection in the histogram shows the corresponding cumulative color |
exChangeColor |
0 |
number | The color for bar and its reflection in the histogram is showing the corresponding cumulative color |
exKeepOriginalColor |
1 |
number | The color for bar and its reflection in the histogram is not changed |
(static, readonly) HistogramTypeEnum :number
The Gantt.HistogramTypeEnum type specifies the types of the histogram that currently the control supports.
Type:
- number
Properties:
Name | value | Type | Description |
---|---|---|---|
exHistOverload |
0 |
number | Shows the overloads and subloads of your current planning situation. The histogram-graph shows the count of specified tasks day by day, or unit by unit |
exHistOverAllocation |
1 |
number | Shows in percents, the over-allocations of your current planning situation using the effort of the task divided by the length of the task (effort/length). The exHistOverAllocation flag can be combined with exHistOverAllocationFixed or exHistOverAllocationMultiply. The work-load for a task is computed as exBarEffort / length of the bar. The work-load for the task is the work effort / task duration. (i.e. If item.exBarEffort = 1 and bar's length is 10 days, then the work-load = 0.1 or 10%). The histogram- graph shows the sum of the work-loads (the work-load of each task item is added, unit by unit) |
exHistCumulative |
256 |
number | Bars in the histogram show cumulative colors. The exHistCumulative can be applied to exHistOverload and exHistOverAllocation values. For instance, the exHistOverAllocation + exHistCumulative defines a cumulative histogram for exHistOverAllocation type |
exHistOverAllocationFixed |
512 |
number | Shows in percents, the over-allocations of your current planning situation using the effort of the task (effort). The exHistOverAllocationFixed can be combined with the exHistOverAllocation flag only |
exHistOverAllocationMultiply |
1024 |
number | Shows in percents, the over-allocations of your current planning situation using the effort of the task multiplied by the length of the task (effort * length). The exHistOverAllocationFixed can be combined with the exHistOverAllocation flag only |
(static, readonly) HistogramViewEnum :number
The Gantt.HistogramViewEnum type specifies the items to include in the histogram.
Type:
- number
Properties:
Name | value | Type | Description |
---|---|---|---|
exHistogramVisibleItems |
1 |
number | The histogram is shown for the visible items only |
exHistogramSelectedItems |
2 |
number | The histogram is shown for the selected items only |
exHistogramCheckedItems |
4 |
number | The histogram is shown for the checked items only |
exHistogramSelectedBars |
8 |
number | The histogram is shown for the selected bars only |
exHistogramUnlockedItems |
16 |
number | The histogram is shown only for unlocked items |
exHistogramLockedTopItems |
32 |
number | The histogram is shown only for locked items in the top side of the control |
exHistogramLockedBottomItems |
64 |
number | The histogram is shown only for locked items in the bottom side of the control |
exHistogramAllItems |
112 |
number | The histogram is shown for all items |
exHistogramFilteredItems |
128 |
number | The histogram is shown for the filtered items only |
exHistogramLeafItems |
256 |
number | The histogram shows the bars for leaf items (a leaf item contains no child items) |
exHistogramRecLeafItems |
512 |
number | The histogram shows all bars for all recursive leaf items (a leaf item contains no child items) |
exHistogramNoGrouping |
1024 |
number | The histogram shows all bars without grouping based on the item's parent |
exHistogramBackground |
2048 |
number | The histogram's chart goes on the background, while the non-working part is shown on front ( erases the non-working parts ) |
exHistogramNoGroupCaption |
4096 |
number | The histogram shows no caption for groups being shown |
exHistogramGroupCumulative |
8192 |
number | The histogram shows cumulative groups |
(static, readonly) ItemBarPropertyEnum :number
The Gantt.ItemBarPropertyEnum type holds the properties of the bar.
Type:
- number
Properties:
Name | value | Type | Description |
---|---|---|---|
exBarName |
0 |
number | Defines the bar's name (defines the bar's visual appearance) ("name" of exontrol.Gantt.BarOptions). The name of the bar does not indicate the bar's caption as exBarCaption property. The exBarName indicates a string such as "Task", "Progress", "Split", or any other predefined type. |
exBarStart |
1 |
number | Specifies the date-time the bar starts from ("start" of exontrol.Gantt.BarOptions). |
exBarEnd |
2 |
number | Specifies the date-time the bar ends to ("end" of exontrol.Gantt.BarOptions). |
exBarCaption |
3 |
number | Specifies the caption to display within the bar ("caption" of exontrol.Gantt.BarOptions). |
exBarHAlignCaption |
4 |
number | Specifies the horizontal-alignment / clipping of the item-bar's caption inside / outside the bar ("hAlignCaption" of exontrol.Gantt.BarOptions). |
exBarVAlignCaption |
5 |
number | Specifies the vertical-alignment of the item-bar's caption inside / outside the bar ("vAlignCaption" of exontrol.Gantt.BarOptions). |
exBarToolTip |
6 |
number | Specifies the tooltip to be shown once the cursor hovers the bar ("toolTip" of exontrol.Gantt.BarOptions). |
exBarKey |
9 |
number | Indicates the bar's key (used only if item hosts multiple bars) ("key" of exontrol.Gantt.BarOptions). |
exBarCanResize |
10 |
number | Specifies whether the user can resize the bar on both margins by drag (requires to be selectable too) ("canResize" of exontrol.Gantt.BarOptions). |
exBarCanMove |
11 |
number | Specifies whether the user can move the bar within the same item by drag (requires to be selectable too) ("canMove" of exontrol.Gantt.BarOptions). |
exBarPercent |
12 |
number | Specifies the bar's percent, as a value from 0 to 1 (for 100%) ("percent" of exontrol.Gantt.BarOptions). |
exBarPercentCaptionFormat |
13 |
number | Specifies the HTML format to display the bar's percent ("percentCaptionFormat" of exontrol.Gantt.BarOptions). |
exBarShowPercentCaption |
14 |
number | Shows or hides the bar's percent-caption ("showPercentCaption" of exontrol.Gantt.BarOptions). |
exBarAlignPercentCaption |
15 |
number | Horizontally aligns the bar's percent-caption ("alignPercentCaption" of exontrol.Gantt.BarOptions). |
exBarCanResizePercent |
16 |
number | Specifies whether the user can resize the percent at runtime ("canResizePercent" of exontrol.Gantt.BarOptions). |
exBarCanResizePercent |
18 |
number | Indicates the vertical-offset relative to the default position, the bar is displayed ("offset" of exontrol.Gantt.BarOptions). |
exBarEffort |
21 |
number | Indicates the bar's effort, or the effort to execute an unit within the bar (bar's histogram value) ("effort" of exontrol.Gantt.BarOptions). |
exBarCanMoveToAnother |
28 |
number | Specifies whether the bar can be moved to another item by drag and drop (requires to be selectable too) ("canMoveToAnother" of exontrol.Gantt.BarOptions). |
exBarSelectable |
29 |
number | Indicates whether the item-bar is selectable or unselectable ("selectable" of exontrol.Gantt.BarOptions). |
exBarColor |
33 |
number | Defines the bar's individual-shape ("shape" of exontrol.Gantt.BarOptions). |
exBarOverviewColor |
41 |
number | Defines the bar's individual overview-color ("overviewColor" of exontrol.Gantt.BarOptions). |
exBarExtraCaption |
44 |
number | Specifies the extra caption to display within the bar ("extraCaption" of exontrol.Gantt.BarOptions). |
exBarExtraCaptionHAlign |
45 |
number | Specifies the horizontal-alignment / clipping of the item-bar's extra caption inside / outside the bar ("extraCaptionHAlign" of exontrol.Gantt.BarOptions). |
exBarExtraCaptionHAlign |
46 |
number | Specifies the vertical-alignment of the item-bar's extra caption inside / outside the bar ("extraCaptionVAlign" of exontrol.Gantt.BarOptions). |
exBarResources |
49 |
number | Specifies the resources to be used by the current bar, separated by commas ("resources" of exontrol.Gantt.BarOptions). |
exBarResourceFormat |
50 |
number | Specifies the format for displaying a bar's resource ("resourceFormat" of exontrol.Gantt.BarOptions). |
exBarOverlaidKey |
52 |
number | Specifies the z-order of the bar when it overlaps other bars (exOverlaidBarsCascade type) ("overlaidKey" of exontrol.Gantt.BarOptions). |
exBarShowCaption |
56 |
number | Shows or hides the bar's caption ("showCaption" of exontrol.Gantt.BarOptions). |
exBarShowExtraCaption |
57 |
number | Shows or hides the bar's extra caption ("showExtraCaption" of exontrol.Gantt.BarOptions). |
exBarHistLegend |
60 |
number | Specifies the bar's description in the histogram-legend ("histLegend" of exontrol.Gantt.BarOptions). |
exBarResourcesFormat |
266 |
number | Gets the HTML caption to display the item-bar's resources (including the percentage of the resource) ("resourcesFormat" of exontrol.Gantt.BarOptions). |
exBarCriticalPath |
269 |
number | Indicates whether the current bar is part of the critical path (currently, the exBarCriticalPath property specifies the position (1-based) of the bar in the critical path) ("criticalPath" of exontrol.Gantt.BarOptions). |
exBarPredecessor |
270 |
number | Indicates the list of predecessor bars (INDEX1['SF'|'FS'|'FF'|'SS'][KEY][:['W']LAG|:LAG['W']] format), separated by comma |
exBarSuccessor |
271 |
number | Indicates the list of successor bars (INDEX1['SF'|'FS'|'FF'|'SS'][KEY][:['W']LAG|:LAG['W']] format), separated by comma |
exBarParent |
512 |
number | Gets the item that hosts the item bar ("parent" of exontrol.Gantt.BarOptions). |
exBarDuration |
513 |
number | Gets the item-bar's duration or length in days ("duration" of exontrol.Gantt.BarOptions). |
(static, readonly) LevelLineEnum :number
The Gantt.LevelLineEnum type specifies the style of lines to shown within the chart's levels.
Type:
- number
Properties:
Name | value | Type | Description |
---|---|---|---|
exLevelNoLine |
0 |
number | No line is shown |
exLevelDefaultLine |
-1 |
number | Indicates the default grid line style |
exLevelDotLine |
1 |
number | Indicates a dotted line. For vertical/tick lines, it can be combined with exLevelLowerHalf, exLevelUpperHalf or exLevelMiddleLine. Can be combined with exLevelLowerHalf, exLevelUpperHalf or exLevelMiddleLine option. |
exLevelSolidLine |
2 |
number | Indicates a solid line. For vertical/tick lines, it can be combined with exLevelLowerHalf, exLevelUpperHalf or exLevelMiddleLine. Can be combined with exLevelLowerHalf, exLevelUpperHalf or exLevelMiddleLine option. |
exLevelLowerHalf |
16 |
number | Indicates that the line is shown in the lower half of the level. For vertical/tick lines, it can be combined with exLevelDotLine or exLevelSolidLine |
exLevelUpperHalf |
32 |
number | Indicates that the line is shown in the upper half of the level. For vertical/tick lines, it can be combined with exLevelDotLine or exLevelSolidLine |
exLevelMiddleLine |
64 |
number | Indicates that the line is shown in the middle. For vertical/tick lines, it can be combined with exLevelDotLine or exLevelSolidLine |
exLevelQuarterHeight |
256 |
number | Indicates that the line is shown as a quarter of the full height. Specify the exLevelQuarterHeight option to show shorter tick lines in the chart's level. Can be combined with exLevelLowerHalf, exLevelUpperHalf or exLevelMiddleLine option |
(static, readonly) OverlaidBarsTypeEnum :number
The Gantt.OverlaidBarsTypeEnum type defines the type of overlay-bar the control supports.
Type:
- number
Properties:
Name | value | Type | Description |
---|---|---|---|
exOverlaidBarsNone |
0 |
number | No overlaid bars are shown |
exOverlaidBarsOffset |
1 |
number | The overlaid bars are shown using a different vertical offset. The Overlaid(exOverlaidBarsOffset) specifies the vertical offset, in pixels, to display the overlaid bars. This option does NOT change the height of the item. |
exOverlaidBarsIntersect |
2 |
number | The overlaid portion is shown using a different type of bar. The Overlaid(exOverlaidBarsIntersect) specifies the name of the bar to be displayed on the portion that laid over bars. This option does NOT change the height of the item. |
exOverlaidBarsStack |
3 |
number | The bars that covers each other are shown as a stack. The Overlaid(exOverlaidBarsStack) specifies the distance in pixels between two bars that covers each other. This option changes the height of the item so the bars that covers each other are displayed entirely. |
exOverlaidBarsCascade |
4 |
number | The bars gets arranged as a cascade with the z-order being indicated by ItemBar(exBarOverlaidCascade) key. Arrange the bars on the same level for those with the same exBarOverlaidCascade key, and on a different level for bars with a different exBarOverlaidCascade key. This option changes the height of the item so the bars that covers each other are displayed entirely. |
exOverlaidBarsTransparent |
256 |
number | The overlaid portion is shown using a semi-transparent color. The Overlaid(exOverlaidBarsTransparent) specifies the percent of transparency being applied to the covered bar. |
exOverlaidBarsStackAutoArrange |
512 |
number | The overlaid stack is automatically arranged for best fit in the item. The exOverlaidBarsStackAutoArrange flag can be combined with exOverlaidBarsStack flag only. |
exOverlaidBarsIncludeCaption |
4096 |
number | The overlaid mechanism includes the caption for bars |
exOverlaidBarsStrict |
8192 |
number | The overlaid mechanism includes only bars in the same group ( OverlaidGroup property ) but of different types. |
(static, readonly) OverviewVisibleEnum :number
The Gantt.OverviewVisibleEnum type specifies the way items are represented in the overview area.
Type:
- number
Properties:
Name | value | Type | Description |
---|---|---|---|
exOverviewHidden |
0 |
number | The control's overview is not visible |
exOverviewShowOnlyVisible |
1 |
number | The control's overview shows the bars from the visible items using the range of bars in the visible items only |
exOverviewShowAllVisible |
2 |
number | The control's overview shows the bars from the visible items using the range for all bars in the chart. |
exOverviewAllowVerticalScroll |
256 |
number | Indicates whether the user can vertically scroll the chart while navigating up or down the overview part of the control. For instance, you can click the overview panel, the chart displays the selected area, and you can drag the cursor left or right to select a new date-time range to be displayed, or you can go up or down, to scroll items up or down. |
exOverviewHideBars |
512 |
number | Prevents showing the bars in the overview part of the control. For instance, you can use this flag in combination of any other flag to show just the time-scale in the overview part of the control, to allow the user to quickly scroll the chart's content to a specific time-zone. |
exOverviewShowDateTimeScale |
4096 |
number | Specifies whether the overview part of the control displays the date-time scale. This flag includes the time-scale on the overview. The time-scale intersects the bars in the overview. By default, the time-scale of the overview part is shown on the top of it, so you can combine the exOverviewShowDateTimeScale flag with exOverviewShowDateTimeScaleBottom flag, to display the time-scale on the bottom side of the overview part of the control. |
exOverviewShowDateTimeScaleSplit |
5120 |
number | Specifies whether the overview's date-time scale is displayed into a separate portion of the overview. This flag includes the time-scale on the overview. The time-scale does not intersect the bars in the overview. By default, the time-scale of the overview part is shown on the top of it, so you can combine the exOverviewShowDateTimeScaleSplit flag with exOverviewShowDateTimeScaleBottom flag, to display the time-scale on the bottom side of the overview part of the control. |
exOverviewShowDateTimeScaleBottom |
6144 |
number | Specifies whether the overview's date-time scale is displayed on the bottom side of the overview. By default, the time-scale of the overview part is shown on the top of it, so you can use the exOverviewShowDateTimeScaleBottom flag with exOverviewShowDateTimeScale or exOverviewShowDateTimeScaleSplit to display the time-scale on the bottom side of the overview part of the control. |
exOverviewShowMargins |
8192 |
number | Displays the limits of the overview bars. You can include the exOverviewShowMargins flag to display the margins/limits of all (project) / visible bars. In other words, the exOverviewShowMargins flag displays the minimal ItemBar(exBarStart) value, and the maximal ItemBar(exBarEnd) value. |
exOverviewShowSelMargins |
16384 |
number | Displays the selection limits (first/last visible date in the chart). |
exOverviewSplitter |
65536 |
number | Specifies whether the overview's horizontal splitter is visible or hidden(makes the control's overview resizable or fixed) |
(static, readonly) PutResEnum :number
The Gantt.PutResEnum type defines the operations for loading resources from source controls and saving them to target controls.
Type:
- number
Properties:
Name | value | Type | Description |
---|---|---|---|
exPutResLoad |
1 |
number | Loads the resources for all bars from another control (synchronizes the resources from the source control to the target control) |
exPutResSave |
2 |
number | Saves the resources of all bars to another control (syncronizes the resources from the target control back to the source control) |
- Since:
- 3.2
(static) type :string
The type field defines the full-name of the object (the constructor.name does not give the same name for minimized forms).
The Gantt.type member always returns "Gantt"
Type:
- string
- Since:
- 1.8
(static) version :string
The version field defines the version of the control.
The current version is 3.2
Type:
- string
Methods
AddGanttView(name, attributesopt) → {GV}
The AddGanttView() method creates a new view to display bars. The RemoveGanttView() method removes the chart-view already created by the AddGanttView() method.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
string | defines the name of the gantt-view to be created. It must be an unique name. The "tree" defines the control's default-tree view, and it is reserved. If missing, the "tree.split" is used instead | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
attributes |
exontrol.W.Options |
<optional> |
A exontrol.W.Options that defines the attributes of the window
Properties
|
Returns:
Returns the newly created view as an object of GV type. Returns null, in case there is already a window with specified name.
- Type
- GV
Bar(name, includeShortcutopt) → {Bar}
The Bar() method gets the bar giving its index, name or reference. The Bar(name) method is equivalent with Chart.Bars.Item(name) method.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
any | The name parameter could be any of the following:
|
|
includeShortcut |
boolean |
<optional> |
Specifies whether the bar is searched for its shortcut as well (defaults to false) (@since 3.2) |
- Since:
- 1.6
Returns:
Returns null(the bar is not found), or an object of Bar type, if the bars collection contains the giving name.
- Type
- Bar
Example
The following statements are equivalents:
oGantt.Bar("Task") {Bar}
oGantt.Chart.Bar("Task") {Bar}
oGantt.Chart.Bars.Item("Task") {Bar}
and returns the "Task" bar
where oGantt is an object of Gantt type
Bar
Export(exportOptsopt) → {any}
The Export() method exports the control's data as an array or CSV format. The Export() method extends the extree's Export() method. The GetData() method is equivalent with Export() method.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
exportOpts |
object |
<optional> |
Indicates the options to export control's data. The exportOpts object can include any of the following fields:
|
Returns:
Returns an array of [[value]] type or the control's data as as string in CSV format (only if the exportOpts.format field is "CSV")
- Type
- any
GetChart() → {Chart}
The GetChart() method gets the control's chart object
Returns:
Returns an object of Chart type that represents the control's chart object.
- Type
- Chart
Example
The following statements are equivalents:
oGantt.GetChart(), returns the control's chart object
oGantt.Chart, returns the control's chart object
where oGantt is an object of Gantt type
GetChart
GetData() → {any}
The GetData() method exports the control's data as an array or CSV format. The GetData() method extends the extree's GetData() method. The GetData() method is equivalent with Export() method. The ExportOptions type defines the default options to export data.
Returns:
Returns an array of [[value]] type or the control's data as as string in CSV format (only if the ExportOptions.format field is "CSV")
- Type
- any
Import(source, importOptsopt)
The Import() method imports data from CSV/XML format. The Import() method extends the extree's Import() method. The SetData(value) method is equivalent with Import(value) method.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
source |
any | The source parameter may be one of the following:
|
||||||||||||||||||||||||||||||||||
importOpts |
object |
<optional> |
The importOpts parameter specifies options to import data into the control as object of ImportOptions type.
Properties
|
Example
"xml/datasource.xml" {string}, imports data from datasource.xml file
"Item 1.1,SubItem 1.2\r\nItem 1.2,SubItem 2.2" {string}, creates two columns and two rows
{items: {value: "Machine", bars: {name: "Task", start: "#01/10/2024#", end: "#01/15/2024#"}}} {object}, inserts a 'Task' bar for a new item labeled 'Machine' (@since 3.2)
{items: [{value: "Machine 1", bars: {name: "Task", start: "#01/10/2024#", end: "#01/15/2024#"}}, {value: "Machine 2", bars: {name: "Task", start: "#01/16/2024#", end: "#01/21/2024#"}}], links: {from: 0, to: 1}} {object}, Creates two items, each with its own task bar, and establishes a link between them (@since 3.2)
Import
ItemBar(item, key) → {ItemBar}
The ItemBar() method returns the item-bar based on the item and its key, as an object of Gantt.ItemBar type (equivalent of Item.ItemBar method)
Parameters:
Name | Type | Description |
---|---|---|
item |
any | The item parameter could be any of the following: item {number}, indicates a numeric value that defines the index of the item to request item {string}, specifies a string expression that defines the identifier/key of the item to request item {exontrol.Tree.Item}, specifies the object reference to the item to request for |
key |
any | Specifies the key of the item-bar to request |
Returns:
Returns null (no item-bar) or the item-bar as an object of Gantt.ItemBar type
- Type
- ItemBar
Link(id) → {Link}
The Link() method gets the link giving its index, identifier/key or reference.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | string | Link | The id parameter could be any of the following:
|
- Since:
- 1.1
Returns:
Returns null if the link is not found, or an object of Link type, if the links collection contains the giving id.
- Type
- Link
PutRes(target, typeopt)
The PutRes() method synchronizes the resources of the source control with the target control based on the Resources/GetResources()/SetResources(value) method of the ItemBar object. In order to use the PutRes method the Source control must:
- specify the activity/bar's resources using the Resources/GetResources()/SetResources(value) method of the ItemBar object
- adds the "Resources" column (nothing happens if the PutRes method was already called, or the Target control already contains a column with the Key "Resources")
- adds a new item with the name of the resource for each resource found ('resources' of ItemBar) in the Source control ( R1, R2, ... )
- adds a new bar for each activity/bar in the Source control, that uses the specified resource, where the 'percent' and 'effort' properties of ItemBar indicate the usage of the resource (numeric expression between 0 and 1 ). During the BarResizing event, if a histogram view is implemented for the Target control, the 'effort' property should be adjusted to reflect the 'percent' value.
- updates the 'start' and 'end' margins of the activity/bar in the Source control based on its associated bar in the Target control
- updates the 'resources' property in the Source control with the new resource usage indicated by the 'percent' property in the Target control
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
target |
Gantt | Indicates the target to update | |
type |
PutResEnum |
<optional> |
Specifies the type of updating, as a value of {PutResEnum} type, exPutResLoad is missing, null or undefined |
- Since:
- 3.2
Example
oSource.PutRes(oTarget), updates and lists the resources of the Source control to the Target control (Source => Target)
oSource.PutRes(oTarget, "save"), updates the resources of the Source control from the Target control (Target => Source)
PutRes
RemoveGanttView(name)
The RemoveGanttView() method removes the chart-view already created by the AddGanttView() method.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | defines the name of the gantt-view to be removed. The "gantt" defines the control's default-chart view, and it can not be removed. |
SetData(value)
Imports data from CSV or XML files. The SetData(value) method extends the extree's SetData(value) method. The SetData(value) method is equivalent with Import(value) method. The ImportOptions type defines default options to import data.
Parameters:
Name | Type | Description |
---|---|---|
value |
any | Indicates the source of the data, as one of the following:
|
Example
"xml/datasource.xml" {string}, imports data from datasource.xml file
"Item 1.1,SubItem 1.2\r\nItem 1.2,SubItem 2.2" {string}, creates two columns and two rows
{items: {value: "Machine", bars: {name: "Task", start: "#01/10/2024#", end: "#01/15/2024#"}}} {object}, inserts a 'Task' bar for a new item labeled 'Machine' (@since 3.2)
{items: [{value: "Machine 1", bars: {name: "Task", start: "#01/10/2024#", end: "#01/15/2024#"}}, {value: "Machine 2", bars: {name: "Task", start: "#01/16/2024#", end: "#01/21/2024#"}}], links: {from: 0, to: 1}} {object}, Creates two items, each with its own task bar, and establishes a link between them (@since 3.2)
SetData
feIB(callback, thisArg)
The feIB/forEachItemBar() method invokes the callback for each item-bar of the control (unscrolled(top,bottom items) and scrolled items as well)
Parameters:
Name | Type | Description |
---|---|---|
callback |
callback | A function of callback(oItemBar) type that's called for every item-bar, where oItemBar is oItemBar {ItemBar}, specifies an item-bar of ItemBar type |
thisArg |
any | Indicates the value of "this" keyword during the callback |
feIBU(callback, thisArg) → {any}
The feIBU/forEachItemBarUntil() method invokes the callback for each item-bar of the control (unscrolled(top,bottom items) and scrolled items as well), until the callback returns a not-empty value
Parameters:
Name | Type | Description |
---|---|---|
callback |
callback | A function of callback(oItemBar) {any} type that's called for every item-bar, where oItemBar is oItemBar {ItemBar}, specifies an item-bar of ItemBar type |
thisArg |
any | Indicates the value of "this" keyword during the callback |
Returns:
Retuns the result of the last-callback
- Type
- any
feL(callback, thisArg)
The feL/forEachLink() method invokes the callback for each link of the control
Parameters:
Name | Type | Description |
---|---|---|
callback |
callback | A function of callback(oLink) type that's called for every link, where oLink is oLink {Link}, specifies a link of Link type |
thisArg |
any | Indicates the value of "this" keyword during the callback |
- Since:
- 1.1
feLU(callback, thisArg) → {any}
The feLU/forEachLinkUntil() method invokes the callback for each link of the control, until the callback returns a not-empty value
Parameters:
Name | Type | Description |
---|---|---|
callback |
callback | A function of callback(oLink) type that's called for every link, where oLink is oLink {Link}, specifies a link of Link type |
thisArg |
any | Indicates the value of "this" keyword during the callback |
- Since:
- 1.1
Returns:
Retuns the result of the last-callback
- Type
- any
Events
onallowlink
The onallowlink() method occurs to querry if a link between two bars is possible. The Add(oLinkOpts) method creates and adds a link between two bars.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
oEvent |
object | holds information about the link to create, as an object of {start, end, cancel} type.
Properties
|
Example
The following samples cancels adding any links:
oGantt.onallowlink = function (oEvent)
{
oEvent.cancel = true;
}
or
oGantt.Listeners.Add("onallowlink", function (oEvent)
{
oEvent.cancel = true;
})
where oGantt is an object of Gantt type
onallowlink
onbarparentchange
The onbarparentchange() method occurs once the item-bar is about to be moved to a new item, by drag. The Parent / GetParent() method gets the item that hosts the item bar.
Parameters:
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
oEvent |
object | holds information about the item-bar being moved, as an object of {newItem, item, key, bar, cancel} type.
Properties
|
Example
The following samples display the bar's new item once it is moved to another item:
oGantt.onbarparentchange = function (oEvent)
{
console.log(oEvent.newItem);
}
or
oGantt.Listeners.Add("onbarparentchange", function (oEvent)
{
console.log(oEvent.newItem);
})
where oGantt is an object of Gantt type
The following samples cancels moving the bar from an ite to another:
oGantt.onbarparentchange = function (oEvent)
{
oEvent.cancel = true;
}
or
oGantt.Listeners.Add("onbarparentchange", function (oEvent)
{
oEvent.cancel = true;
})
where oGantt is an object of Gantt type
onbarparentchange
onbarresize
The onbarresize() method occurs once the user resizes or moves an item-bar by drag. The Start / GetStart() method gets the date-time the bar starts from. The End / GetEnd() method gets the date-time the bar ends to.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
oEvent |
object | holds information about the item-bar being resize/moved, as an object of {item, key, bar} type.
Properties
|
Example
The following samples display information about the bar being moved or resized, by drag and drop:
oGantt.onbarresize = function (oEvent)
{
console.log(oEvent);
}
or
oGantt.Listeners.Add("onbarresize", function (oEvent)
{
console.log(oEvent);
})
where oGantt is an object of Gantt type
onbarresize
onchartselchange
The onchartselchange() method notifies that the chart's selection has been changed. The Selection / GetSelection() method gets the chart's selection (bars). The onselchange()(extree) method notifies that the control's selection has been changed (items).
Parameters:
Name | Type | Description |
---|---|---|
oEvent |
object | holds the control's selection, as explained: |
Example
The following samples display the chart's selection once it changes:
oGantt.onchartselchange = function (oEvent)
{
console.log(oEvent);
}
or
oGantt.Listeners.Add("onchartselchange", function (oEvent)
{
console.log(oEvent);
})
where oGantt is an object of Gantt type
onchartselchange
oncreatebar
The oncreatebar() method occurs once the user creates a new item-bar by drag. The AddBar(name, start, end, key, text) method adds a bar for the current item, and returns an object of ItemBar type.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
oEvent |
object | holds information about the created item-bar, as an object of {item, start, end, bar} type.
Properties
|
Example
The following samples display information about the created-bar, once the user creates it by drag and drop:
oGantt.oncreatebar = function (oEvent)
{
console.log(oEvent);
}
or
oGantt.Listeners.Add("oncreatebar", function (oEvent)
{
console.log(oEvent);
})
where oGantt is an object of Gantt type
oncreatebar
oncreatelink
The oncreatelink() method notifies your application once the user creates a link between two bars. The Add(oLinkOpts) method creates and adds a link between two bars.
Parameters:
Name | Type | Description |
---|---|---|
oEvent |
Link | indicates the link between two bars, as an object of Link type |
Example
The following samples display the link being created:
oGantt.oncreatelink = function (oEvent)
{
console.log(oEvent);
}
or
oGantt.Listeners.Add("oncreatelink", function (oEvent)
{
console.log(oEvent);
})
where oGantt is an object of Gantt type
oncreatelink
ondatechange
The ondatechange() method occurs once the chart's first visible date is changed. The FirstVisibleDate / GetFirstVisibleDate() method gets the chart's first visible date. The GetLastVisibleDate() method gets the chart's last visible date.
Parameters:
Name | Type | Description |
---|---|---|
oEvent |
GV | Specifies the gantt-view where the first visible date is changed, as an object of GV type. |
Example
The following samples display the chart's first visible date once it changes:
oGantt.ondatechange = function (oEvent)
{
console.log(oGantt.Chart.FirstVisibleDate);
}
or
oGantt.Listeners.Add("ondatechange", function (oEvent)
{
console.log(oGantt.Chart.FirstVisibleDate);
})
where oGantt is an object of Gantt type
In case your control displays multiple gantt-view, the following sample displays the view's first visible date as soon as it changes:
oGantt.ondatechange = function (oEvent)
{
console.log(oEvent.FirstVisibleDate);
}
or
oGantt.Listeners.Add("ondatechange", function (oEvent)
{
console.log(oEvent.FirstVisibleDate);
})
where oGantt is an object of Gantt type
ondatechange
ondateselchange
The ondateselchange() method notifies your application once the user selects zero, one or more dates within the control. The SelectDates / GetSelectDates() method gets the current selected-dates as an array of [{start,end}] type.
Parameters:
Name | Type | Description |
---|---|---|
oEvent |
object | holds the selected-dates, as explained:
|
Example
The following samples display the chart's date(s) being selected:
oGantt.ondateselchange = function (oEvent)
{
console.log(oEvent);
}
or
oGantt.Listeners.Add("ondateselchange", function (oEvent)
{
console.log(oEvent);
})
where oGantt is an object of Gantt type
ondateselchange