Skip to content

Graph Class

The Graph class represents a graph loaded and displayed in PrestoPlot. It gives access to some methods to alter the graph.


Public Constants

ANCHOR_EAST
ANCHOR_NORTH
ANCHOR_SOUTH
ANCHOR_WEST
JUSTIFY_CENTER
JUSTIFY_LEFT
JUSTIFY_RIGHT
LEGEND_BOTTOM
LEGEND_LEFT
LEGEND_RIGHT
LEGEND_TOP
LINE_STYLE_DASHED
LINE_STYLE_DOTTED
LINE_STYLE_SOLID
MARKER_2POINTS
MARKER_HORIZONTAL
MARKER_POINT
MARKER_TEXT
MARKER_VERTICAL


Public Properties

background
legendanchor
legendcolor
legendfont
legendposition
legendvisible
majorgridcolor
majorgridstyle
majorgridwidth
minorgridcolor
minorgridstyle
minorgridwidth
name
plotbackground
ticks
title
titlecolor
titlefont
titlejustify
useminorgrid
xticks
yticks


Public Functions

addDataset(datasets, ...)
addMarker(dataset, type)
deleteMarker(marker)
getDatasetConfig(dataset)
getDatasets()
getEvents(ontoDataset, eventsFromDataset)
getXAxis(dataset)
getYAxis(dataset)
importEvents(ontoDataset, eventsFromDataset, all)
print(printerName)
removeDataset(datasets, ...)
resetZoom()
saveAsGraph(filename)
saveAsImage(filename, size)
saveAsModel(filename)
saveAsPGD(filename, options)
spreadAxes()
zoom(from, to)


Detailed Properties Descriptions

background

background

The main graph background

legendanchor

legendanchor

Specify the legend anchor (ANCHOR_WEST, ANCHOR_NORTH, ANCHOR_SOUTH, ANCHOR_EAST)

legendcolor

legendcolor

The legend color

legendfont

legendfont

The legend font (can add bold,italic,underline,overstrike).

legendposition

legendposition

Specify the legend position (LEGEND_LEFT, LEGEND_RIGHT, LEGEND_TOP, LEGEND_BOTTOM)

legendvisible

legendvisible

Wether the legend is displayed (boolean)

majorgridcolor

majorgridcolor

The major grid color

majorgridstyle

majorgridstyle

The major grid line style (LINE_STYLE_SOLID, LINE_STYLE_DOTTED, LINE_STYLE_DASHED)

majorgridwidth

majorgridwidth

The major grid line width

minorgridcolor

minorgridcolor

The minor grid color

minorgridstyle

minorgridstyle

The minor grid line style (LINE_STYLE_SOLID, LINE_STYLE_DOTTED, LINE_STYLE_DASHED)

minorgridwidth

minorgridwidth

The minor grid line width

name

name

The graph name (displayed in PrestoPlot UI).

plotbackground

plotbackground

The plot area background

ticks

ticks

The dataset used for aligning grid lines.

title

title

The graph title (displayed on graph).

titlecolor

titlecolor

The title color.

titlefont

titlefont

The title font (can add bold,italic,underline,overstrike).

titlejustify

titlejustify

The title justifying (JUSTIFY_LEFT, JUSTIFY_CENTER, JUSTIFY_RIGHT).

useminorgrid

useminorgrid

Wether the minor grid lines are displayed (boolean)

xticks

xticks

The dataset used for aligning vertical grid lines.

yticks

yticks

The dataset used for aligning horizontal grid lines.


Detailed Constants descriptions

ANCHOR_EAST

ANCHOR_EAST

Anchor to the east

ANCHOR_NORTH

ANCHOR_NORTH

Anchor to the north

ANCHOR_SOUTH

ANCHOR_SOUTH

Anchor to the south

ANCHOR_WEST

ANCHOR_WEST

Anchor to the west

JUSTIFY_CENTER

JUSTIFY_CENTER

Justified to the middle

JUSTIFY_LEFT

JUSTIFY_LEFT

Justified to the left

JUSTIFY_RIGHT

JUSTIFY_RIGHT

Justified to the right

LEGEND_BOTTOM

LEGEND_BOTTOM

Legend position to the bottom

LEGEND_LEFT

LEGEND_LEFT

Legend position to the left

LEGEND_RIGHT

LEGEND_RIGHT

Legend position to the right

LEGEND_TOP

LEGEND_TOP

Legend position to the top

LINE_STYLE_DASHED

LINE_STYLE_DASHED

Dashed line style

LINE_STYLE_DOTTED

LINE_STYLE_DOTTED

Dotted line style

LINE_STYLE_SOLID

LINE_STYLE_SOLID

Solid line style

MARKER_2POINTS

MARKER_2POINTS

Marker type pointing to 2 data points

MARKER_HORIZONTAL

MARKER_HORIZONTAL

Horizontal marker

MARKER_POINT

MARKER_POINT

Marker type pointing to 1 data point

MARKER_TEXT

MARKER_TEXT

Simple text marker

MARKER_VERTICAL

MARKER_VERTICAL

Vertical marker


Detailed Functions Descriptions

addDataset

addDataset(datasets, ...)

Add a dataset to the graph.

Parameters :

  • datasets : The dataset name or Dataset object to add.

  • ... : Other dataset names or Dataset objects to add.

addMarker

addMarker(dataset, type)

Add a marker to the graph. The returned Marker object lets you configure the marker style and options. Its position can be set through value, point1, point2, xlabelposition and ylabelposition attributes, depending its type.

Parameters :

  • dataset : The dataset to bind the marker on.

  • type : The marker type to add (MARKER_POINT, MARKER_2POINT, MARKER_TEXT, MARKER_VERTICAL or MARKER_HORIZONTAL).

Return : A Marker object.

deleteMarker

deleteMarker(marker)

Delete a marker from the graph.

Parameters :

  • marker : The Marker object to delete.

getDatasetConfig

getDatasetConfig(dataset)

Return a DatasetConfig object corresponding to the given dataset. This can be used to configure the dataset style on this graph.

Parameters :

  • dataset : The dataset name or Dataset object to configure.

Return : A DatasetConfig object for the given dataset.

getDatasets

getDatasets()

Return the list of datasets being part of the graph.

Return : A list of Dataset objects being part of the graph.

getEvents

getEvents(ontoDataset, eventsFromDataset)

Get the EventsConfig object related to the events imported from the given dataset onto another dataset. If the given dataset is not imported as events, no object is returned (empty string).

Parameters :

  • ontoDataset : A dataset name or Dataset object of the graph, to which the events ticks are mapped.

  • eventsFromDataset : A dataset name or Dataset object from which the events were imported. It must be a labelled dataset.

Return : An EventsConfig object or empty string.

getXAxis

getXAxis(dataset)

Return the X Axis object associated to the given dataset.

Parameters :

  • dataset : A dataset name or Dataset object.

Return : An Axis object.

getYAxis

getYAxis(dataset)

Return the Y Axis object associated to the given dataset.

Parameters :

  • dataset : A dataset name or Dataset object.

Return : An Axis object.

importEvents

importEvents(ontoDataset, eventsFromDataset, all)

Import events on the graph, from a labelled datasets.

Parameters :

  • ontoDataset : A dataset name or Dataset object of the graph, to which the events ticks will be mapped.

  • eventsFromDataset : A dataset name or Dataset object from which the events will be imported. It must be a labelled dataset.

  • all : (Optional) Boolean specifying if all event occurences are imported, or only transitions.

Return : An EventsConfig object allowing configuration of the imported events.

print

print(printerName)

Print the graph. If no printer name is given, the first allowed is used.

Parameters :

  • printerName : The printer name to print to.

removeDataset

removeDataset(datasets, ...)

Remove a dataset from the graph. The dataset will remain loaded in PrestoPlot.

Parameters :

  • datasets : The dataset name or Dataset object to remove.

  • ... : Other dataset names or Dataset objects to remove.

resetZoom

resetZoom()

Reset all axis and zooming of the graph.

saveAsGraph

saveAsGraph(filename)

Save the graph as a Graph file.

Parameters :

  • filename : The filename to save the graph to.

saveAsImage

saveAsImage(filename, size)

Save the graph as an image file.

Parameters :

  • filename : The filename to save the image to. The image format is deduced from the file extension. It can be png, gif or eps. On windows it can also be emf. On linux, it can also be ps.

  • size : (Optional) The size of the image to produce. Example : "800x500"

saveAsModel

saveAsModel(filename)

Save the graph as a Model file.

Parameters :

  • filename : The filename to save the model to.

saveAsPGD

saveAsPGD(filename, options)

Save the graph as a PGD file.

Parameters :

  • filename : The filename to save the PGD to.

  • options : An optional dict with following optional entries :

    • optimise (boolean, default false) : Only include configuration items that are not default.
    • xlimits (boolean, default true) : Include X axes limits.
    • ylimits (boolean, default true) : Include Y axes limits.
    • events (boolean, default false) : Include events.

spreadAxes

spreadAxes()

Spread axes.

zoom

zoom(from, to)

Reset all axis and zooming of the graph.

Parameters :

  • from : The date to apply to the left side of the graph, in the unix GMT format. See DateManager for date conversions.

  • to : The date to apply to the right side of the graph, in the unix GMT format. See DateManager for date conversions.