GV class (Gantt)

GV(oGantt)

new GV(oGantt)

The GV class defines the chart's view, which displays the tasks of the chart, according with the chart's time-scale. By default, the control includes the oGV member that defines the default view of the control, as an object of GV type. The control can include multiple views, which can be created by AddGanttView() method. Each view can have its own time-scale and header levels, but all views share the same chart's items and selection. The view supports different methods to scroll its content and ensure that a giving client or the chart's selection fits the view's client area. The view also supports methods to get or set the first and last visible dates of the view.
Parameters:
Name Type Description
oGantt Gantt Specifies an object of Gantt type that defines the owner control of the view to create.

Members

FirstVisibleDate :number|string|Date

The FirstVisibleDate property gets or sets the view's first visible date. The LastVisibleDate property gets the view's last visible date. The StartPrintDate property gets the minimum-date for the entire chart (lower date) as undefined (the chart includes no bars) or the minimum-date for the entire chart (lower date). The EndPrintDate property gets the maximum-date for the entire chart (upper date), as undefined (the chart includes no bars) or the maximum-date for the entire chart (upper date).

The FirstVisibleDate property can be one of the following types:

  • value {string}, defines the date in string-format as "#MM/DD/YYYY[ HH:mm:ss]#"
  • value {Date}, indicates a JavaScript date to be copied
  • value {number} integer value representing the year of the date to be created
  • value {null} or {undefined}, indicates the current date and time (equivalent of Now)
Type:
  • number | string | Date
Example
The following statements are equivalents:

 oGantt.oGV.SetFirstVisibleDate("#12/31/1971#"), sets the view's first visible date
 oGantt.oGV.FirstVisibleDate = "#12/31/1971#", sets the view's first visible date

where oGantt is an object of Gantt type
FirstVisibleDate

(readonly) LastVisibleDate :Date

The LastVisibleDate property gets the view's last visible date. The FirstVisibleDate property gets or sets the view's first visible date. The StartPrintDate property gets the minimum-date for the entire chart (lower date) as undefined (the chart includes no bars) or the minimum-date for the entire chart (lower date). The EndPrintDate property gets the maximum-date for the entire chart (upper date), as undefined (the chart includes no bars) or the maximum-date for the entire chart (upper date).
Type:
  • Date
Example
The following statements are equivalents:

 oGantt.oGV.GetLastVisibleDate(), gets the view's last visible date
 oGantt.oGV.LastVisibleDate, gets the view's last visible date

where oGantt is an object of Gantt type
LastVisibleDate

Methods

EnsureVisibleClient(clientA, ensureOptsopt)

The EnsureVisibleClient() method ensures that the giving object/client fits the control's client area. The client can be any of the following: item-bar, item or an absolute-coordinates of a layout-rectangle. The EnsureVisibleSelection() method scrolls the control's content to ensure that the control's selection fits the control's client area. The ScrollPos property scrolls horizontally and/or vertically the control's default view. The Chart.ScrollTo() method scrolls the chart to ensure that specified date fits the chart's area. The Zoom() method zooms the view so the start-end interval fits the client's area. The EnsureVisibleClient() method applies only to the chart section, whereas Gantt.EnsureVisibleClient() applies to both the items section and the chart section.
Parameters:
Name Type Attributes Description
clientA object The client parameter could be any of the following:
  • clientA {object}, indicates an object of {ItemBar} type that indicates the item-bar to fit into the chart's client area
  • clientA {object}, indicates an object of {exontrol.Tree.Item} type that indicates the item to fit into the chart's client area
  • clientA {object}, indicates an object of {s(tart),e(nd),y,h(eight)} type as explained:
    • s(tart) {Date}, specifies the start of the range to fit the view
    • e(nd) {Date}, specifies the end of the range to fit the view
    • y {number}, specifies the y-offset (absolute) of the item to fit the view
    • h(eight) {number}, specifies the height (absolute) of the item to fit the view
ensureOpts object <optional>
Specifies different options to run the current method, as an object of {force, allowScale, allowScroll, nearestFit, duration, thisArg, cbkR, cbkI, cbkT}
Properties
Name Type Description
force boolean forces the EnsureVisibleClient()'s smooth operation to run, not matter if no zoom/scale or scroll changed.
allowScale boolean updates the control's scale/zoom-factor to ensure full-fit the client.
allowScroll number specifies whether horizontal/vertical is allowed as explained:
  • 3 {number}/{null}/{undefined}, allows scrolling horizontal and vertical as required
  • 0 {number}, no horizontal or vertical scroll is allowed
  • 1 {number}, horizontal scroll is allowed
  • 2 {number}, vertical scroll is allowed
nearestFit boolean ensures that corner of the object nearest the window's client area fits it (it has effect only if the size of the object is greater than size of the window's client area).
duration number specifies the time in ms the control is smoothly performs the changes.
thisArg any specifies the value of "this" keyword during the cbkI/cbkT callbacks.
cbkR callback specifies a function of callback(p) type that's invoked once the EnsureVisibleClient()'s smooth operation runs (p {number}, specifies the progress of the smooth so far, as a value between 0 and 1).
cbkI callback specifies a function of callback() type that's invoked once the EnsureVisibleClient()'s smooth operation begins.
cbkT callback specifies a function of callback() type that's invoked once the EnsureVisibleClient()'s smooth operation ends.
Example
oGantt.oGV.EnsureVisibleClient( oItemBar ); // ensures that the item-bar fits the view's client area, by scrolling the view if required
oGantt.oGV.EnsureVisibleClient( oItem ); // ensures that the item fits the view's client area, by scrolling the view if required
oGantt.oGV.EnsureVisibleClient( {s: startDate, e: endDate} ); // ensures that the date range between startDate and endDate fits the view's client area, by scrolling and/or zooming the view if required

where oGantt is the control's object of Gantt type, oGV is the control's gantt-view as an object of GV type, oItemBar is an object of ItemBar type that belongs to the control, oItem is an object of exontrol.Tree.Item type that belongs to the control, and startDate/endDate are Date objects.
EnsureVisibleClient

EnsureVisibleSelection(ensureOpts)

The EnsureVisibleSelection() method scrolls the control's content to ensure that the view's selection fits the control's client area. The EnsureVisibleClient() method ensures that the giving object/client fits the view's client area. The ScrollPos property scrolls horizontally and/or vertically the control's default view. The Chart.ScrollTo() method scrolls the chart to ensure that specified date fits the chart's area. The EnsureVisibleSelection() method applies only to the chart section, whereas Gantt.EnsureVisibleSelection() applies to both the items section and the chart section. The Zoom() method zooms the view so the start-end interval fits the client's area.
Parameters:
Name Type Description
ensureOpts object Specifies different options to run the current method, as an object of {expandParents, selection, duration} type.
Properties
Name Type Description
expandParents number expands the parent-items as explained:
  • 0 {number}, no parent-item is expanded (ignored)
  • 1 {number}, the parent-item(s) is expanded
  • 2 {number}, ensure to fit the parent-item(s) as well
selection Array.<ItemBar> holds an array of item-bars as [ItemBar] type to fit into current-view. If missing the EnsureVisibleSelection() method scrolls the chart to ensure that the current chart's selection fits the chart's visible area.
duration number specifies the time in ms the control is smoothly performs the changes.
Example
oGantt.oGV.EnsureVisibleSelection({expandParents: 1}); // expands the parent-items of the selected item-bars and scrolls the chart to ensure that the current chart's selection fits the chart's visible area.
EnsureVisibleSelection

Zoom(start, end, changeUnitWidthopt)

The Zoom() method zooms the view so the start-end interval fits the client's area. The EnsureVisibleClient() method ensures that the giving object/client fits the control's client area. The client can be any of the following: item-bar, item or an absolute-coordinates of a layout-rectangle. The EnsureVisibleSelection() method scrolls the control's content to ensure that the control's selection fits the control's client area. The ScrollPos property scrolls horizontally and/or vertically the control's default view. The Chart.ScrollTo() method scrolls the chart to ensure that specified date fits the chart's area.
Parameters:
Name Type Attributes Description
start number | string | Date A value of one of the following types:
  • date {string}, defines the date in string-format as "#MM/DD/YYYY[ HH:mm:ss]#"
  • date {Date}, indicates a JavaScript date to be copied
  • date {number} integer value representing the year of the date to be created
  • date {null} or {undefined}, indicates the current date and time (equivalent of Now)
      that defines the start of the interval.
end number | string | Date A value of one of the following types:
  • date {string}, defines the date in string-format as "#MM/DD/YYYY[ HH:mm:ss]#"
  • date {Date}, indicates a JavaScript date to be copied
  • date {number} integer value representing the year of the date to be created
  • date {null} or {undefined}, indicates the current date and time (equivalent of Now)
      that defines the end of the interval.
changeUnitWidth boolean <optional>
Specifies whether the chart's unit-width is changed (defaults to true).
Since:
  • 1.6
Example
oGantt.oGV.Zoom("#12/31/1971#", "#12/31/2024#"), zooms the view to fit the interval between December 31, 1971 and December 31, 2024
Zoom