TPTP 4.1.0 Platform Project
Public API Specification

org.eclipse.hyades.ui.widgets.grapher
Interface Graph

All Known Subinterfaces:
TextGraph
All Known Implementing Classes:
EnumerationGraph, HighlighterGraph, IndicatorLineGraph, LineGraph, ReferenceLineGraph

public interface Graph

The Graph interface describes any graph entity that is to be rendered and the plotting settings to be used to plot the graph. A graph implementation contains references to a valid GraphSource and Indicator Source.

Graphs are rendered by adding implementations to the Graph Canvas. The paintGraph method is responsible for rendering the graph on the graphing canvas. This method is invoked by a call to redraw in the Graph Canvas.

Since:
4.0.0
See Also:
GraphCanvas, GraphSource, IndicatorSource

Field Summary
static int NODATA_DO_NOTHING
          Do Nothing on No Data constant.

Plot no values if there is no data between data points
static int NODATA_DRAW_PREVIOUS
          Draw Previous on No Data constant.

On missing data draw the previous data value that was calculated
static int NODATA_DRAW_ZERO
          Plot zero on No Data constant.

Plot a zero value for all missing values between data points
static int PERIOD_TYPE_MILLIS
          Millisecond period type constant.

The data sampling period between data points is set milliseconds (each time frame in milliseconds will have a value associated with it).
static int PERIOD_TYPE_PIXELS
          Pixel period type constant.

The data sampling period between data points is set to pixels (each x pixel will have a value associated with it).
static int PERIOD_TYPE_TICKS
          Tick period type constant.

The type of data sampling between data points is set to the slider tick width associated with this graph.
static int PERIOD_TYPE_UNAVERAGED
          Pixel period type constant.

The data sampling period between data points is set to unaveraged.
static int PLOTTING_TYPE_AVERAGE
          Average plotting type constant.

Plot the average value data points from the graph source.
static int PLOTTING_TYPE_COUNT
          Count plotting type constant.

Plot the number of data points from the graph source.
static int PLOTTING_TYPE_GRADIENT
          Gradient plotting type constant.

Plot the estimated gradient of value data points from the graph source.
static int PLOTTING_TYPE_MAX
          Maximum plotting type constant.

Plot the maximum value data points from the graph source.
static int PLOTTING_TYPE_MIN
          Minimum plotting type constant.

Plot the minimum value data points from the graph source.
static int PLOTTING_TYPE_MIN_MAX
          Maximum and Minimum plotting type constant.

Plot the maximum and minimum value data points from the graph source.
static int PLOTTING_TYPE_MIN_MAX_AVERAGE
          Maximum and Minimum plotting type constant.

Plot the maximum, minimum and average value data points from the graph source.
static int PLOTTING_TYPE_NEAREST
          Nearest plotting type constant.

Plot the nearest previous value to the current index from the graph source.
static int PLOTTING_TYPE_STDDEV
          Standard deviation plotting type constant.

Plot the standard deviation of data points from the graph source.
static int PLOTTING_TYPE_STDDEV_AVERAGE
          Standard deviation and average plotting type constant.

Plot the standard deviation and average of value data points from the graph source.
static int PLOTTING_TYPE_SUM
          Aggregation plotting type constant.

Plot the sum of value data points from the graph source.
 
Method Summary
 void dispose()
          Dispose of all system resources that will not be garbage collected that are associated with this graph.
 java.lang.String getDescription()
          Get the description for this graph.
 org.eclipse.swt.graphics.Color getForeground()
          Return the current color associated with the foreground drawing color of this graph
 GraphCanvas getGraphCanvas()
          Get the graph canvas that this graph is rendered on.
 BasicGraphSource getGraphSource()
          Get the GraphSource associated with this Graph.
 int getLineStyle()
          Return this graph's line style
 int getLineWidth()
          Get the line width of this graph
 java.lang.String getMisc()
          Get a miscellaneous string for this graph.
 java.lang.String getName()
          Get the name for this graph.
 int getNoDataBehaviour()
          Return the no data behaviour constant.
 int getPlottingPeriodType()
          Get the plotting period type constant for this graph.
 double getPlottingPeriodValue()
          Get the plotting period value.
 int getPlottingType()
          Return the current Graph Plotting Type constant.
 double getStaticScaling()
          Get the static scaling constant.
 double getXMax()
          Get the minimum X value from the data source.
 double getXMin()
          Get the minimum X value from the data source.
 double getXOffset()
          Get the X coordinate time offset.
 TimeZoomSlider getXSlider()
          Get this graphs X slider
 double getYMax()
          Get the maximum Y value from the data source.
 double getYMin()
          Get the minimum Y value from the data source.
 double getYOffset()
          Get the Y coordinate time offset.
 ZoomSlider getYSlider()
          Get this graphs Y slider
 void paintGraph(org.eclipse.swt.graphics.GC gc, int x, int y, int w, int h)
          Paint this graph on the provided GC, within the given bounds.
 void setDescription(java.lang.String description)
          Set the description for this graph.
 void setForeground(org.eclipse.swt.graphics.Color col)
          Set the foreground color to be used for drawing this graph
 void setGraphCanvas(GraphCanvas graphCanvas)
          Set the graph canvas that this graph is to be rendered on.
 void setIndicatorSource(IndicatorSource isource)
          Set the indicator source to be used for plotting slider indicators for this graph.
 void setLineStyle(int swt_line_style)
          Set the line style of this graph.
 void setLineWidth(int w)
          Set the line width of this graph
 void setMisc(java.lang.String misc)
          Set the miscellaneous string for this graph.
 void setName(java.lang.String name)
          Set the name for this graph.
 void setNoDataBehaviour(int behaviour)
          Set the no data behaviour constant.
 void setPlottingPeriod(int type, double value)
          Set the plotting period type and period value.
 void setPlottingType(int type)
          Set the current Graph Plotting Type constant.
 void setStaticScaling(double mult)
          Set the static scaling to be used when plotting data points.
 void setXOffset(double millis)
          Set the X coordinate time offset.
 void setXSlider(TimeZoomSlider slider)
          Set the X TimeZoomSlider that this graph will use for horizontal point indexing
 void setYOffset(double offset)
          Set the Y coordinate offset.
 void setYSlider(ZoomSlider slider)
          Set the Y ZoomSlider that this graph will use for vertical point indexing
 

Field Detail

PLOTTING_TYPE_AVERAGE

public static final int PLOTTING_TYPE_AVERAGE
Average plotting type constant.

Plot the average value data points from the graph source.

See Also:
GraphSource.getAverageBetween(double, double), Constant Field Values

PLOTTING_TYPE_MIN

public static final int PLOTTING_TYPE_MIN
Minimum plotting type constant.

Plot the minimum value data points from the graph source.

See Also:
GraphSource.getMin(), GraphSource.getMinBetween(double, double), Constant Field Values

PLOTTING_TYPE_MAX

public static final int PLOTTING_TYPE_MAX
Maximum plotting type constant.

Plot the maximum value data points from the graph source.

See Also:
GraphSource.getMax(), GraphSource.getMaxBetween(double, double), Constant Field Values

PLOTTING_TYPE_MIN_MAX

public static final int PLOTTING_TYPE_MIN_MAX
Maximum and Minimum plotting type constant.

Plot the maximum and minimum value data points from the graph source.

See Also:
GraphSource.getMax(), GraphSource.getMaxBetween(double, double), GraphSource.getMin(), GraphSource.getMinBetween(double, double), Constant Field Values

PLOTTING_TYPE_MIN_MAX_AVERAGE

public static final int PLOTTING_TYPE_MIN_MAX_AVERAGE
Maximum and Minimum plotting type constant.

Plot the maximum, minimum and average value data points from the graph source.

See Also:
GraphSource.getMax(), GraphSource.getMaxBetween(double, double), GraphSource.getMin(), GraphSource.getMinBetween(double, double), GraphSource.getAverageBetween(double, double), Constant Field Values

PLOTTING_TYPE_SUM

public static final int PLOTTING_TYPE_SUM
Aggregation plotting type constant.

Plot the sum of value data points from the graph source.

See Also:
GraphSource.getSumBetween(double, double), Constant Field Values

PLOTTING_TYPE_NEAREST

public static final int PLOTTING_TYPE_NEAREST
Nearest plotting type constant.

Plot the nearest previous value to the current index from the graph source.

See Also:
Constant Field Values

PLOTTING_TYPE_COUNT

public static final int PLOTTING_TYPE_COUNT
Count plotting type constant.

Plot the number of data points from the graph source.

See Also:
GraphSource.getCountBetween(double, double), Constant Field Values

PLOTTING_TYPE_STDDEV

public static final int PLOTTING_TYPE_STDDEV
Standard deviation plotting type constant.

Plot the standard deviation of data points from the graph source.

See Also:
GraphSource.getStandardDeviationBetween(double, double), Constant Field Values

PLOTTING_TYPE_STDDEV_AVERAGE

public static final int PLOTTING_TYPE_STDDEV_AVERAGE
Standard deviation and average plotting type constant.

Plot the standard deviation and average of value data points from the graph source.

See Also:
GraphSource.getAverageBetween(double, double), GraphSource.getStandardDeviationBetween(double, double), Constant Field Values

PLOTTING_TYPE_GRADIENT

public static final int PLOTTING_TYPE_GRADIENT
Gradient plotting type constant.

Plot the estimated gradient of value data points from the graph source.

See Also:
Constant Field Values

PERIOD_TYPE_TICKS

public static final int PERIOD_TYPE_TICKS
Tick period type constant.

The type of data sampling between data points is set to the slider tick width associated with this graph.

See Also:
Constant Field Values

PERIOD_TYPE_MILLIS

public static final int PERIOD_TYPE_MILLIS
Millisecond period type constant.

The data sampling period between data points is set milliseconds (each time frame in milliseconds will have a value associated with it).

See Also:
Constant Field Values

PERIOD_TYPE_PIXELS

public static final int PERIOD_TYPE_PIXELS
Pixel period type constant.

The data sampling period between data points is set to pixels (each x pixel will have a value associated with it).

See Also:
Constant Field Values

PERIOD_TYPE_UNAVERAGED

public static final int PERIOD_TYPE_UNAVERAGED
Pixel period type constant.

The data sampling period between data points is set to unaveraged.

See Also:
Constant Field Values

NODATA_DO_NOTHING

public static final int NODATA_DO_NOTHING
Do Nothing on No Data constant.

Plot no values if there is no data between data points

See Also:
Constant Field Values

NODATA_DRAW_ZERO

public static final int NODATA_DRAW_ZERO
Plot zero on No Data constant.

Plot a zero value for all missing values between data points

See Also:
Constant Field Values

NODATA_DRAW_PREVIOUS

public static final int NODATA_DRAW_PREVIOUS
Draw Previous on No Data constant.

On missing data draw the previous data value that was calculated

See Also:
Constant Field Values
Method Detail

getGraphSource

public BasicGraphSource getGraphSource()
Get the GraphSource associated with this Graph.

Returns:
a BasicGraphSource associated with this graph

getXMin

public double getXMin()
Get the minimum X value from the data source.

Returns:
the minimum X value
See Also:
GraphSource.getMin()

getXMax

public double getXMax()
Get the minimum X value from the data source.

Returns:
the minimum X value
See Also:
GraphSource.getMin()

getYMin

public double getYMin()
Get the minimum Y value from the data source.

Returns:
the minimum Y value
See Also:
GraphSource.getValueMin()

getYMax

public double getYMax()
Get the maximum Y value from the data source.

Returns:
the maximum Y value
See Also:
GraphSource.getValueMax()

paintGraph

public void paintGraph(org.eclipse.swt.graphics.GC gc,
                       int x,
                       int y,
                       int w,
                       int h)
Paint this graph on the provided GC, within the given bounds. The GC uses a coordinate system increasing from LEFT to RIGHT and TOP to BOTTOM.

The GraphCanvas is responsible for calling the painGraph method on a redraw.

Parameters:
gc - an SWT GC on which the implemented graph should be drawn
x - the x coordinate bound, in pixels
y - the y coordinate bound, in pixels
w - the width of the drawing canvas, in pixels
h - the height of the drawing canvas, in pixels
See Also:
GC

setXSlider

public void setXSlider(TimeZoomSlider slider)
Set the X TimeZoomSlider that this graph will use for horizontal point indexing

Parameters:
slider - The TimeZoomSlider to be used as the X coordinate slider

setYSlider

public void setYSlider(ZoomSlider slider)
Set the Y ZoomSlider that this graph will use for vertical point indexing

Parameters:
slider - The ZoomSlider to be used as the Y coordinate slider

getXSlider

public TimeZoomSlider getXSlider()
Get this graphs X slider

Returns:
the TimeZoomSlider associated with this graph's Y coordinates

getYSlider

public ZoomSlider getYSlider()
Get this graphs Y slider

Returns:
the ZoomSlider associated with this graph's Y coordinates

setForeground

public void setForeground(org.eclipse.swt.graphics.Color col)
Set the foreground color to be used for drawing this graph

Parameters:
col - the Color for this graph to be drawn with

getForeground

public org.eclipse.swt.graphics.Color getForeground()
Return the current color associated with the foreground drawing color of this graph

Returns:
the currently assigned foreground Color

setLineWidth

public void setLineWidth(int w)
Set the line width of this graph

Parameters:
w - the new line width value

getLineWidth

public int getLineWidth()
Get the line width of this graph

Returns:
an integer representing the current line width of this graph
See Also:
getLineWidth()

setLineStyle

public void setLineStyle(int swt_line_style)
Set the line style of this graph. It is common practice to use the line style SWT constants similar to those for the GC. Since the line style is an integer constant the underlying implementation can interpret this in any desired way.

Parameters:
swt_line_style - the SWT line style constant
See Also:
GC.setLineStyle(int), SWT

getLineStyle

public int getLineStyle()
Return this graph's line style

Returns:
an integer representing this graphs line style, as set by the setLineStyle(int swt_line_style) method.
See Also:
setLineStyle(int)

setStaticScaling

public void setStaticScaling(double mult)
Set the static scaling to be used when plotting data points. The static scaling is the multiplier applied to the data point values.

Parameters:
mult - the double multiplier value

getStaticScaling

public double getStaticScaling()
Get the static scaling constant.

Returns:
mult the double multiplier value
See Also:
setStaticScaling(double)

getPlottingType

public int getPlottingType()
Return the current Graph Plotting Type constant. Valid constant values are
  • PLOTTING_TYPE_AVERAGE
  • PLOTTING_TYPE_MIN
  • PLOTTING_TYPE_MAX
  • PLOTTING_TYPE_MIN_MAX
  • PLOTTING_TYPE_MIN_MAX_AVERAGE
  • PLOTTING_TYPE_SUM
  • PLOTTING_TYPE_NEAREST
  • PLOTTING_TYPE_COUNT
  • PLOTTING_TYPE_STDDEV
  • PLOTTING_TYPE_STDDEV_AVERAGE
  • PLOTTING_TYPE_GRADIENT
  • Returns:
    an integer representing the current plotting type

    setPlottingType

    public void setPlottingType(int type)
    Set the current Graph Plotting Type constant. Valid constant values are
  • PLOTTING_TYPE_AVERAGE
  • PLOTTING_TYPE_MIN
  • PLOTTING_TYPE_MAX
  • PLOTTING_TYPE_MIN_MAX
  • PLOTTING_TYPE_MIN_MAX_AVERAGE
  • PLOTTING_TYPE_SUM
  • PLOTTING_TYPE_NEAREST
  • PLOTTING_TYPE_COUNT
  • PLOTTING_TYPE_STDDEV
  • PLOTTING_TYPE_STDDEV_AVERAGE
  • PLOTTING_TYPE_GRADIENT
  • Parameters:
    type - an integer constant representing the desired plotting type

    getNoDataBehaviour

    public int getNoDataBehaviour()
    Return the no data behaviour constant. This behaviour dictates the points plotted when no data is available. Possible values are
  • NODATA_DO_NOTHING
  • NODATA_DRAW_ZERO
  • NODATA_DRAW_PREVIOUS
  • Returns:
    the integer no data constant

    setNoDataBehaviour

    public void setNoDataBehaviour(int behaviour)
    Set the no data behaviour constant. This behaviour dictates the points plotted when no data is available. Possible values are
  • NODATA_DO_NOTHING
  • NODATA_DRAW_ZERO
  • NODATA_DRAW_PREVIOUS
  • Parameters:
    behaviour - the No Data behaviour constant to be used when plotting this graph

    setPlottingPeriod

    public void setPlottingPeriod(int type,
                                  double value)
    Set the plotting period type and period value. The plotting period dictates how often the data source is queried for new values to be plotted. Values are averaged over this period. The value is dependent on the plotting type constant provided. Possible constants for the plotting type and their associated values are
  • PERIOD_TYPE_TICKS - period value is in slider ticks
  • PERIOD_TYPE_MILLIS - period value is in milliseconds
  • PERIOD_TYPE_PIXELS - period value is in pixels
  • PERIOD_TYPE_UNAVERAGED
  • Parameters:
    type - the plotting period type constants
    value - the plotting period value

    getPlottingPeriodType

    public int getPlottingPeriodType()
    Get the plotting period type constant for this graph. Possible constants for the plotting type and their associated values are
  • PERIOD_TYPE_TICKS - period value is in slider ticks
  • PERIOD_TYPE_MILLIS - period value is in milliseconds
  • PERIOD_TYPE_PIXELS - period value is in pixels
  • PERIOD_TYPE_UNAVERAGED
  • Returns:
    the plotting period type constant
    See Also:
    setPlottingPeriod(int, double)

    getPlottingPeriodValue

    public double getPlottingPeriodValue()
    Get the plotting period value.

    Returns:
    the plotting period double value
    See Also:
    setPlottingPeriod(int, double)

    setXOffset

    public void setXOffset(double millis)
    Set the X coordinate time offset. All data points from the data source are offset by this offset before being plotted. This is equivalent to transposing all data points along the x axis.

    Parameters:
    millis - the offset in milliseconds

    getXOffset

    public double getXOffset()
    Get the X coordinate time offset. All data points from the data source are offset by this offset before being plotted. This is equivalent to transposing all data points along the x axis.

    Returns:
    the current x coordinate offset in milliseconds

    setYOffset

    public void setYOffset(double offset)
    Set the Y coordinate offset. All data points from the data source are offset by this offset before being plotted. This is equivalent to transposing all data points along the y axis.

    Parameters:
    offset - the offset in milliseconds

    getYOffset

    public double getYOffset()
    Get the Y coordinate time offset. All data points from the data source are offset by this offset before being plotted. This is equivalent to transposing all data points along the y axis.

    Returns:
    the current y coordinate offset

    setIndicatorSource

    public void setIndicatorSource(IndicatorSource isource)
    Set the indicator source to be used for plotting slider indicators for this graph.

    Parameters:
    isource - the IndicatorSource implementation to be used for plotting the indicators of this graph
    See Also:
    IndicatorSource

    setName

    public void setName(java.lang.String name)
    Set the name for this graph. The graph name can be used by other graphs / graping UI to distinguish between graphs.

    Parameters:
    name - a String name to be assigned to this graph

    getName

    public java.lang.String getName()
    Get the name for this graph. The graph name can be used by other graphs / graping UI to distinguish between graphs.

    Returns:
    String name for this graph

    setDescription

    public void setDescription(java.lang.String description)
    Set the description for this graph. The graph description can be used by other graphs / graping UI to distinguish between graphs.

    Parameters:
    description - String descirption to be assigned to this graph

    getDescription

    public java.lang.String getDescription()
    Get the description for this graph. The graph description can be used by other graphs / graping UI to distinguish between graphs.

    Returns:
    String description for this graph

    setMisc

    public void setMisc(java.lang.String misc)
    Set the miscellaneous string for this graph. The miscelaneous string is used to provide additional detail about this graph in addition to the name and description. The graph name can be used by other graphs or graping UI to distinguish between graphs.

    Parameters:
    misc - String descirption to be assigned to this graph

    getMisc

    public java.lang.String getMisc()
    Get a miscellaneous string for this graph. The miscelaneous string is used to provide additional detail about this graph in addition to the name and description. The graph name can be used by other graphs or graping UI to distinguish between graphs.

    Returns:
    misc String for this graph

    setGraphCanvas

    public void setGraphCanvas(GraphCanvas graphCanvas)
    Set the graph canvas that this graph is to be rendered on. The Graph Canvas allows for graphs to query the state of other graphs and allows for more interaction with the graphing UI.

    Parameters:
    graphCanvas - the Graph Canvas that this graph is assigned to
    See Also:
    GraphCanvas

    getGraphCanvas

    public GraphCanvas getGraphCanvas()
    Get the graph canvas that this graph is rendered on.

    Returns:
    the graph's GraphCanvas
    See Also:
    GraphCanvas, setGraphCanvas(GraphCanvas gc)

    dispose

    public void dispose()
    Dispose of all system resources that will not be garbage collected that are associated with this graph. This method is called when a graph is removed from its parent graph canvas.


    TPTP 4.1.0 Platform Project
    Public API Specification