Skip to content

Dataset Class

The Dataset class represents one dataset loaded in PrestoPlot. It gives access to its properties/attributes and its data values.


Public Properties

dateformat
description
length (read only)
name
source
unit
xlabel


Public Functions

addPoint(date, value)
addPointRealTime(date, value)
addPoints(dates, values)
setLabel(value, label)
x(indexFrom, indexTo)
y(indexFrom, indexTo)


Detailed Properties Descriptions

dateformat

dateformat

The original date format (see DateManager)

description

description

The dataset description

length (read only)

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

source

source

Indicates the origin of the dataset (file name, computed, socket, ...).

unit

unit

The dataset unit

xlabel

xlabel

The XLabel that can be displayed on graphs.


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 the dates list. The value can be either a double value or a label.

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.

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.

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.