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 |
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:By default, the control defines the following bar-names/types:
|
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
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
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. By default, the control defines the following bar-names/types:
- "Task"
- "Split"
- "Progress"
- "Milestone"
- "Summary"
- "Project Summary"
- "Deadline"
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) |
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:
|
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. |