new Series(oGraph)
The Series object represents a collection of Serie objects (the control's series). A serie displays a set of related data points in the graph, rendered according to its specific type (such as line, column, area, and so on), and defines how that data is visually represented within the control. Use the Series property to access the control's series collection. The Data property of the control is used to assign data to the control's series. The Series collection provides the Add() method to create and add a new serie to the control, the Item() method to retrieve a serie by its index, key/name/index, or reference, and the Remove() method to remove a serie by its index, key/name/index, or reference.
Parameters:
| Name | Type | Description |
|---|---|---|
oGraph |
Graph | Indicates an object of Graph type that owns the collection. |
Members
(readonly) Count :number
The Count property gets the number of series within the collection. The Add, Remove and Clear methods of the Series collection affect the count of series within the collection. The Item() method gets the serie giving its index, key/name/index or reference. The ItemByPos(pos) method gets the serie giving its position (0-based) within the collection. You can use the Item and Count members to iterate through the series in a collection.
Type:
- number
Example
The following statements are equivalents:
oGraph.Series.GetCount(), counts the series within the control
oGraph.Series.Count, counts the series within the control
where oGraph is an object of Graph type
Count
Methods
Add(oSerieOptsopt) → {Serie}
The Add() method creates a new serie, adds it to the control's Series collection, and returns a reference to the newly created serie so it can be further configured. Once added, the serie becomes part of the control and can be assigned data, customized (such as setting its type, appearance, or key/name/index), and displayed according to the graph's current view. The oSerieOpts parameter of the Add() method specifies the options to create the new serie as an object of SerieOptions type. If the oSerieOpts parameter is a string or a number, it is considered as the 'data' option of the new serie.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
oSerieOpts |
SerieOptions |
<optional> |
Specifies the options used to create the new serie as an object of SerieOptions type. If the oSerieOpts parameter is provided as a string or a number, it is interpreted as the data field of the new serie. |
Returns:
Returns the newly created serie, as an object of Serie type
- Type
- Serie
Example
oGraph.Serie.Add("10,20,30,40") {Serie}, adds a a new serie with the specified data
oGraph.Serie.Add({data: "1,2,3"}) {Serie}, adds a new serie with the specified data
Add
Clear()
The Clear() method removes all series of the control and inits the control's scroll-bars. The Remove() method removes a serie from the collection. The Serie.Remove() method removes the serie itself from the series collection. The RemoveRange() method removes multiple-series at once. The Count property returns the number of series within the collection.
Example
oGraph.Series.Clear(), removes all series of the control
Clear
Item(id) → {null|Serie}
The Item() method returns a serie by specifying its index, key/name/index, or reference. The Serie(id) method returns a serie based on its index or key/name/index and is equivalent to the Item() method. The ItemByPos(pos) method returns a serie by specifying its zero-based position within the collection.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
any | The id parameter could be any of the following:
|
Returns:
Returns null if the serie is not found, or an object of Serie type, if the series collection contains the giving id.
- Type
- null | Serie
Example
oGraph.Serie.Item(0) {Serie}, gets the first serie within the collection
oGraph.Serie.Item("MySerie") {Serie}, gets the serie with the key/name/index "MySerie"
oGraph.Serie.Item(-1) or oGraph.Serie.Item(oGraph.Series.Count - 1) {Serie}, gets the last serie within the collection as they were added
Item
ItemByPos(pos) → {null|Serie}
The ItemByPos() method gets the serie giving its position (0-based) within the collection. The Item(id) method gets the serie giving its index, key/name/index or reference. The Serie(id) method returns the serie based on its index or key/name/index. The Position of a serie is determined by the order of series within the collection as they are displayed in the chart-view, which can be different from the order of series as they were added to the collection. The position of a serie can be changed by setting its Position property. You can use the ItemByPos(pos) method along with the Count property to iterate through the series in a collection based on their display order.
Parameters:
| Name | Type | Description |
|---|---|---|
pos |
number | Specifies the zero-based position of the serie within the collection (it supports negative indices as well, where -1 returns the last serie as they are displayed, -2 returns the serie before it, and so on @since 5.2). |
- Since:
- 4.9
Returns:
Returns null if the serie is not found, or an object of Serie type, if the series collection contains the giving position.
- Type
- null | Serie
Example
oGraph.Serie.ItemByPos(0) {Serie}, gets the first serie within the collection as they are displayed
oGraph.Serie.ItemByPos(-1) or oGraph.Serie.ItemByPos(oGraph.Series.Count - 1) {Serie}, gets the last serie within the collection as they are displayed
ItemByPos
Remove(id)
The Remove() method removes a serie from the collection. The Serie.Remove() method removes the serie itself from the series collection. The Clear method removes all series of the control. The RemoveRange() method removes multiple-series at once. The Item or ItemByPos methods can be used to get the serie by index, key/name/index or position. The Count property returns the number of series within the collection.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
any | The id parameter could be any of the following:
|
Example
The following statements are equivalents:
oGraph.Serie.Remove(0), removes the first serie within the collection
oGraph.Serie(0).Remove(), removes the first serie within the collection
where oGraph is an object of Graph type
Remove
RemoveRange(range)
The RemoveRange() method removes multiple-series at once. The Remove() method removes a serie from the collection. The Serie.Remove() method removes the serie itself from the series collection. The Clear method removes all series of the control. The Item or ItemByPos methods can be used to get the serie by index, key/name/index or position. The Count property returns the number of series within the collection.
Parameters:
| Name | Type | Description |
|---|---|---|
range |
any | Indicates a serie, an array [{Serie}], or an exontrol.Arr([{Serie}]). |
Example
oGraph.Series.RemoveRange([oGraph.Serie(0), oGraph.Serie(1)]), removes the first two series within the collection
oGraph.Series.RemoveRange(oGraph.Serie(0)), removes the first serie within the collection
RemoveRange