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.

Some attributes can be read and changed with get and set :

  • background : The main graph background
  • legendfont : The legend font (can add bold,italic,underline,overstrike).
  • legendvisible : Wether the legend is displayed (boolean)
  • legendanchor : Specify the legend anchor (WEST, NORTH, SOUTH, EAST)
  • legendposition : Specify the legend position (LEFT, RIGHT, TOP, BOTTOM)
  • majorgridcolor : The major grid color
  • majorgridstyle : The major grid line style (SOLID, DOTTED, DASHED)
  • majorgridwidth : The major grid line width
  • minorgridcolor : The minor grid color
  • minorgridstyle : The minor grid line style (SOLID, DOTTED, DASHED)
  • minorgridwidth : The minor grid line width
  • name : The graph name (displayed in PrestoPlot UI).
  • plotbackground : The plot area background
  • ticks : The dataset used for aligning grid lines.
  • title : The graph title (displayed on graph).
  • titlecolor : The title color.
  • titlefont : The title font (can add bold,italic,underline,overstrike).
  • titlejustify : The title justifying (if multiline) (LEFT, CENTER, RIGHT).
  • useminorgrid : Wether the minor grid lines are displayed (boolean)
  • xticks : The dataset used for aligning vertical grid lines.
  • yticks : The dataset used for aligning horizontal grid lines.

Public Functions

addDataset{ datasets ... }
addMarker{ dataset type }
deleteMarker{ marker }
get{ attribute }
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 }
set{ attribute value }
spreadAxes{}
zoom{ from to }


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 (POINT, 2POINT, TEXT, VERTICAL or HORIZONTAL).

Return : A Marker object.

deleteMarker

deleteMarker{ marker }

Delete a marker from the graph.

Parameters :

  • marker : The Marker object to delete.

get

get{ attribute }

Get an attribute of the graph. See the list of attributes in the Graph description.

Parameters :

  • attribute : The attribute name to fetch.

Return : The attribute value.

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.

set

set{ attribute value }

Set an attribute of the graph. See the list of attributes in the Graph description.

Parameters :

  • attribute : The attribute name to set.

  • value : The value to set to the attribute.

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.