new MarkZones(oSchedule)
The MarkZones object holds a collection of MarkZone objects (mark-zone of the control). A mark-zone is a time-interval that can be displayed into the schedule and time-scale panels, with a specific shape (color, pattern, etc.) and caption. Mark-zones are useful to display non-working times, holidays, or any other relevant time-intervals into the schedule. Mark-zones with eventShape option set, can also be used to highlight events that intersect them, by applying a specific shape on them. Use the MarkZones property to access the control's mark-zones collection.
Parameters:
| Name | Type | Description |
|---|---|---|
oSchedule |
Schedule | Indicates an object of Schedule type that owns the collection. |
Members
Count :number
The Count property returns the number of mark-zones within the collection. The Add, Remove and Clear methods automatically update the count of mark-zones, so you can also use the Count property to get the number of mark-zones within the collection. The Item and Count methods can be user to iterate over the mark-zones collection, as shown in the example.
Type:
- number
Example
The following statements are equivalents:
oSchedule.MarkZones.GetCount(), counts the mark-zones within the control
oSchedule.MarkZones.Count, counts the mark-zones within the control
The following statements are equivalents, to iterate over the mark-zones collection:
for(var i = 0, l = oSchedule.MarkZones.Count, oMarkZone; i < l; i++)
{
var oMarkZone = oSchedule.MarkZone(i);
...
}
or
oSchedule.MarkZones.forEach(function(oMarkZone)
{
...
})
where oSchedule is an object of Schedule type
Count
Methods
Add(oMarkZoneOptsopt) → {MarkZone}
The Add() method creates and adds a new mark-zone or timer into the control. A mark-zone is a time-interval that can be displayed into the schedule and time-scale panels, with a specific shape (color, pattern, etc.) and caption. Mark-zones are useful to display non-working times, holidays, or any other relevant time-intervals into the schedule. The Add() method supports one (timer or options) or two parameters (start and end margins of the mark-zone), as shown in the example. The mark-zone can highlight the time-scale and schedule panels at a specific date/time. The MarkZoneOptions.shape field defines the shape to apply on the mark-zone, while the MarkZoneOptions.eventShape field defines the shape to apply on events that intersect the mark-zone. Mark-zones with eventShape option set, can also be used to highlight events that intersect them, by applying a specific shape on them.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
oMarkZoneOpts |
object |
<optional> |
Specifies the options to create the new mark-zone as an object of MarkZoneOptions type. The oMarkZoneOpts parameter can be passed as an object of MarkZoneOptions type, or as a string/number to specify the time of a timer (a mark-zone with identical start and end time). If two parameters are passed, they are considered as start and end margins of the mark-zone, respectively. |
Returns:
Returns the newly created mark-zone, as an object of MarkZone type
- Type
- MarkZone
Example
oSchedule.MarkZones.Add("#1/1/2002 8:30#").Shape = "black", (one parameter) adds a new timer at 8:30 AM, on Jan 1st, 2002
oSchedule.MarkZones.Add({start: "#1/1/2001 10:00#", end: "#1/1/2001 13:00#"}), (one parameter) adds a new mark-zone from 10:00 AM to 1:00 PM on Jan 1st, 2001
oSchedule.MarkZones.Add("#1/1/2001 10:00#", "#1/1/2001 13:00#"), (two-parameters) adds a new mark-zone from 10:00 AM to 1:00 PM on Jan 1st, 2001
Add
Clear()
The Clear() method removes all mark-zones of the control. The Schedule.ShowMarkZone property controls whether mark-zones are displayed in the background (behind events), in the foreground (in front of events), or not displayed at all. The Schedule.Clear() method clears the events, groups and mark-zones. The Remove() method removes a mark-zone from the collection giving its index, identifier/key or reference. The Item and Count methods can be user to iterate over the mark-zones collection.
Example
oSchedule.MarkZones.Clear(), removes all mark-zones of the control
oSchedule.Clear(), removes all events, groups and mark-zones of the control (resets the control)
Clear
Item(id) → {null|MarkZone}
The Item() method gets the mark-zone giving its index, identifier/key or reference. The Schedule.MarkZone(id) method returns the mark-zone based on its index or identifier/key (equivalent of this method). The Item and Count methods can be user to iterate over the mark-zones collection, as shown in the example.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
any | The id parameter could be any of the following:
|
Returns:
Returns null if the mark-zone is not found, or an object of MarkZone type, if the mark-zones collection contains the giving id.
- Type
- null | MarkZone
Example
The following statements are equivalents, to iterate over the mark-zones collection:
for(var i = 0, l = oSchedule.MarkZones.Count, oMarkZone; i < l; i++)
{
var oMarkZone = oSchedule.MarkZone(i);
...
}
or
oSchedule.MarkZones.forEach(function(oMarkZone)
{
...
})
where oSchedule is an object of Schedule type
Item
Remove(id)
The Remove() method removes a mark-zone from the collection giving its index, identifier/key or reference. The MarkZone.Remove method removes the mark-zone itself (equivalent of this method). The Clear() method removes all mark-zones of the control. The Schedule.ShowMarkZone property controls whether mark-zones are displayed in the background (behind events), in the foreground (in front of events), or not displayed at all. The Schedule.Clear() method clears the events, groups and mark-zones. The Item and Count methods can be user to iterate over the mark-zones collection, as shown in the example.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
any | The id parameter could be any of the following:
|
Example
The following statements are equivalents:
oSchedule.MarkZones.Remove(0), removes the mark-zone of index 0
oSchedule.MarkZone(0).Remove(), removes the mark-zone of index 0
where oSchedule is an object of Schedule type
Remove
RemoveRange(range) → {number}
The RemoveRange() method removes multiple-mark-zones at once. The Clear() method removes all mark-zones of the control. The Remove() method removes a mark-zone from the collection giving its index, identifier/key or reference. The Item and Count methods can be user to iterate over the mark-zones collection.
Parameters:
| Name | Type | Description |
|---|---|---|
range |
any | Indicates a mark-zone, an array [{MarkZone}], or an exontrol.Arr([{MarkZone}]). |
Returns:
Returns the number of mark-zones being deleted
- Type
- number
Example
oSchedule.MarkZones.RemoveRange( [oSchedule.MarkZone(0), oSchedule.MarkZone(1)] ), removes the mark-zones of index 0 and 1 at once
RemoveRange