Bars class (Gantt)

Bars(oChart)

new Bars(oChart)

The Bars object holds a collection of Bar objects. The Bar objects define the look and feel for bars in the chart's area. The Bars / GetBars() method gets the control's bars. The Bar(name) method gets the bar giving its index, name or reference.
Parameters:
Name Type Description
oChart Chart Specifies the control's chart as an object of Chart type
Bars

Methods

Add(oBarOptions) → {Bar}

The Add() method adds a new type of bar to the control, and returns the reference to the newly created bar, as an object of Bar type.
Parameters:
Name Type Description
oBarOptions object Indicates the name of the bar-type to add/request (as a string), or an object of BarOptions type, that defines the options of the bar-type to add. If the name(parameter or option) includes the '%' character, it defines a bar of percent-type ("A%B"). A bar of percent-type displays and handles inner progress-bar, according with the bar's "percent" option.
The A of "A%B" format can be:
  • the name of already added bar, that defines the base-bar or the background-bar, such as "Task"
  • the index of already added bar, that defines the base-bar or the background-bar, such as 0
The B of "A%B" format can be:
  • the name of already added bar, that defines the progress-bar or the foreground-bar, such as "Progress"
  • the index of already added bar, that defines the progress-bar or the foreground-bar, such as 0
  • the shape to show the progress-bar or the foreground-bar as
    • "red" {string}, fills the progress-bar in red (CSS color)
    • '{"fillColor": "red"}' or '{"normal":{"fillColor": "red"}}' {string}, fills the progress-bar in red (JSON-representation of an object of exontrol.Def.Shape type)
    • "xxx" {string}, indicates that exontrol.Shapes.Tree.xxx or exontrol.Shapes.xxx is applied on the progress-bar. If the xxx field is missing, no custom shape is applied (no default object's shape is be applied)
Returns:
Returns an object of Bar type being requested/created.
Type
Bar
Example
oGantt.Chart.Bars.Add({name: "R", shape: "red"}), creates a new type of bar called "R" that will be shown as solid-red
 oGantt.Chart.Bars.Add("Task%Progress"), defines a "Task" bar of percent-type, so it displays the bar's "percent" value using the "Progress" shape
 oGantt.Chart.Bars.Add("Summary%Task"), defines a "Summary" bar of percent-type, so it displays the bar's "percent" value using another "Task" shape
 oGantt.Chart.Bars.Add("Task%red"), defines a "Task" bar of percent-type, so it displays the bar's "percent" value using the "red" color
 oGantt.Chart.Bars.Add("Task%Button"), defines a "Task" bar of percent-type, so it displays the bar's "percent" value using the "Button" already-defined shape
 oGantt.Chart.Bars.Add('Summary%{"fillColor": "rgba(0,0,0,0.5)", "client": "[,y+2*height/3+3,,height/3]", "primitive": "round"}'), defines a "Summary" bar of percent-type, so it displays the bar's "percent" value using a predefined shape

where oGantt is a object of Gantt type
Add

Clear()

The Clear() method removes all bars of the control
Clear

Copy(name, newName) → {Bar}

The Copy() method copies a Bar object and returns a reference to the newly created object, as an object of Bar type.
Parameters:
Name Type Description
name string Specifies the name/shortcut name of the bar to be copied
newName string Indicates the name of the bar to be created as a copy
Returns:
Returns an object of Bar type that holds the newly created object
Type
Bar
Copy

GetCount() → {number}

The GetCount() method gets the count of bars(types of bars) within the collection.
Returns:
Returns the number of bars within the collection
Type
number
Example
The following statements are equivalents:

 oGantt.Chart.Bars.GetCount(), count of bars(types of bars) within the collection
 oGantt.Chart.Bars.Count, count of bars(types of bars) within the collection

where oGantt is an object of Gantt type
GetCount

Item(name, includeShortcutopt) → {Bar}

The Item() method gets the bar giving its index, name, shortcut or reference, as an object of Bar type. The Item(name) method is equivalent with the Bar(name) method.
Parameters:
Name Type Attributes Description
name any The name parameter could be any of the following:
  • name {number}, indicates a numeric value that defines the index of the bar to request
  • name {string}, specifies a string expression that defines the name of the bar to request
  • name {Bar}, specifies the object reference to the bar to request for
includeShortcut boolean <optional>
Specifies whether the bar is searched for its shortcut as well (defaults to false)
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
Item

Remove(name)

The Remove() method removes a bar from the collection.
Parameters:
Name Type Description
name any The name parameter could be any of the following:
  • name {number}, indicates a numeric value that defines the index of the bar to request
  • name {string}, specifies a string expression that defines the name or shortcut name of the bar to request
  • name {Bar}, specifies the object reference to the bar to request for
Remove

RemoveRange(range)

The RemoveRange() method removes multiple-bars at once
Parameters:
Name Type Description
range any Indicates a bar, an array of [{Bar}] type, or exontrol.Arr.
RemoveRange