Dataset Class
The Dataset class represents one dataset loaded in PrestoPlot. It gives
access to its properties/attributes and its data values.
name: The displayed name of the dataset.unit: The dataset unit.description: The dataset description.source: Indicates the origin of the dataset (file name, computed, socket, ...).xlabel: The XLabel that can be displayed on graphs.dateformat: The original date format (see DateManager)
Public Functions
addPoint{ date value }
addPointRealTime{ date value }
addPoints{ dates values }
dateformat
description
get{ attribute }
length
name
set{ attribute value }
setLabel{ value label }
source
unit
x{ indexFrom indexTo }
xlabel
y{ indexFrom indexTo }
Detailed Functions Descriptions
addPoint
addPoint{ date value }
Append a point at the end of the dataset. The point will not be inserted in the middle of the dataset if the date is within the current range (instead, the plot will go backward).
If you intend to add several points, prefer building a buffered list of x values and y values, and use addPoints
If you intend to add points in a real-time way (for example from a stream), prefer using addPointRealTime.
Parameters :
-
date: The point date in the unix GMT format. -
value: The point value at the given date. The value can be either a double value or a label.
addPointRealTime
addPointRealTime{ date value }
Append a point at the end of the data vector. Use this function if you are feeding the dataset with a real-time stream. This function is optimized for real-time processing and it enables real-time features.
Do not use this function for a static initial data feeding.
Parameters :
-
date: The point date in the unix GMT format. -
value: The point value at the given date. The value can be either a double value or a label.
addPoints
addPoints{ dates values }
Append a list of points at the end of the dataset. The points will not be inserted in the middle of the dataset if the dates are within the current range (instead, the plot will go backward).
If you intend to add points in a real-time way (for example from a stream), prefer using addPointRealTime.
Parameters :
-
dates: A list of dates in the unix GMT format. -
values: A list of point values at the corresponding date in thedateslist. The value can be either a double value or a label.
dateformat
dateformat
The original date format (see DateManager)
description
description
The dataset description
get
get{ attribute }
Get an attribute of the dataset. See the list of attributes in the Dataset description.
Parameters :
attribute: The attribute name to fetch.
Return : The attribute value.
length
length
Get the dataset length, that is, its number of points.
Return : An integer representing the number of points.
name
name
The displayed name of the dataset
set
set{ attribute value }
Set an attribute of the dataset. See the list of attributes in the Dataset description.
Parameters :
-
attribute: The attribute name to set. -
value: The value to set to the attribute.
setLabel
setLabel{ value label }
Set a label to display in place of a specific integer value.
Parameters :
-
value: The value to map to a label. It must be an integer value. -
label: The label to display at the given value.
source
source
Indicates the origin of the dataset (file name, computed, socket, ...).
unit
unit
The dataset unit
x
x{ indexFrom indexTo }
Get one or more X values from this dataset. X values are generally dates in the PrestoPlot internal format (see DateManager). If you only give an index, the X value at this position is returned. The first value is the 0'th index. If you give both an index From and an index To, a list of all values between those indices (both included) is returned.
Parameters :
-
indexFrom: The first index to read. -
indexTo:(Optional)The last index to read.
Return : An X value, or a list of X values.
xlabel
xlabel
The XLabel that can be displayed on graphs.
y
y{ indexFrom indexTo }
Get one or more Y values from this dataset. If you only give an index, the Y value at this position is returned. The first value is the 0'th index. If you give both an index From and an index To, a list of all values between those indices (both included) is returned.
Parameters :
-
indexFrom: The first index to read. -
indexTo:(Optional)The last index to read.
Return : A Y value, or a list of Y values.