Charting Module

Provide functions to display and populate line charts.

Dependencies

This module depends on following other modules which will automatically be loaded.

Method Overview

Method Description
addMarker() Add a marker to the chart.
axis() Alias for setAxisRange().
clear() Clears the active chart.
createChart() Create a new chart on a given parent composite.
exportGraph() Export the current figure as png file.
figure() Opens a new view with an empty figure.
plot() Plot array of points (x[],y[]) on the last series that is set with method series(seriesName, format).
plotPoint() Add (x,y) point to the last Series that is set with method series(seriesName,format).
removeSeries() Deletes a given series.
series() Series will be created with the name seriesName.
setAutoScale() Activates or deactivates auto scaling whenever the cart is updated.
setAxisRange() Set lower and upper limit of the X axis and the Y axis.
setPlotTitle() Sets the title of the active chart.
setXLabel() Set X axis name.
setYLabel() Set Y axis name.
showGrid() Activates or deactivates drawing of a background grid.
title() Alias for setPlotTitle().
xlabel() Alias for setXLabel().
ylabel() Alias for setYLabel().

Methods

addMarker

org.eclipse.nebula.visualization.xygraph.figures.Annotation addMarker(String text, [Double xPosition], [Double yPosition])

Add a marker to the chart. A marker is a text label that points to a grid location. By default the marker will point to the data point that was added last. If positions are provided always xPosition and yPosition need to be provided. The returned marker can be further customized in the UI thread.

text
text to display
xPosition
if set, this will be the X position the marker points toOptional: defaults to <null>.
yPosition
if set, this will be the Y position the marker points toOptional: defaults to <null>.

marker implementation

clear

void clear()

Clears the active chart.

createChart

Chart createChart(Composite parent, [String figureId])

Create a new chart on a given parent composite.

parent
composite to create chart into
figureId
name of the figure to be createdOptional: defaults to <null>.

new chart instance

exportGraph

void exportGraph([Object location], [boolean overwrite]) throws Throwable

Export the current figure as png file. When no location is provided, a popup dialog will ask the user for the target location.

location
where to store image to. Accepts strings, IFile and File instancesOptional: defaults to <null>.
overwrite
Overwrite flag, if true file will be overwritten without questionOptional: defaults to <false>.
Throwable
when the view could not be initialized

figure

Chart figure([String figureId]) throws Throwable

Opens a new view with an empty figure. figureId is used as a view and chart title. If a view with the same figureId already exists, it will be activated. The last activated figure will be used for all further commands of this modules.

figureId
name of the figure to be createdOptional: defaults to <null>.

new or activated chart

Throwable
when the view could not be initialized

plot

org.eclipse.nebula.visualization.xygraph.figures.Trace plot(double[] x, double[] y) throws Throwable

Plot array of points (x[],y[]) on the last series that is set with method series(seriesName, format). If there is no active Figure and Series then both will be created and activated.

x
array of x coordinates
y
array of y coordinates

series as Trace type to set different properties for this series

Throwable
when the view could not be initialized

plotPoint

org.eclipse.nebula.visualization.xygraph.figures.Trace plotPoint(double x, double y) throws Throwable

Add (x,y) point to the last Series that is set with method series(seriesName,format). If there is no active figure and series then both will be created and activated.

x
x coordinate of this point
y
y coordinate of this point

series as Trace type to set different properties for this series

Throwable
when the view could not be initialized

removeSeries

void removeSeries(String seriesName) throws Throwable

Deletes a given series. If the series does not exists this method does nothing.

seriesName
name of series to be deleted
Throwable
when the view could not be initialized

series

org.eclipse.nebula.visualization.xygraph.figures.Trace series([String seriesName], [String format]) throws Throwable

Series will be created with the name seriesName. If the name is not given then Series will have the name "Series id" where id is the current number of the Series Iterator. Series Iterator start at 1 and with every new Series is incremented by one. If Series is already created with seriesName then that series will be set as currently active Series and on that Series methods will be performed. If there is no active Figure then Figure will be created and activated.

seriesName
Name of this series. Default is null if no seriesName is given, in that case the name is "Series id" as explained aboveOptional: defaults to <null>.
format
default is "", if number is written inside format like "f#25" point size will be set(in this case 25), please write format correctly, if for example 2 colors will be written like "rg" then the last one will be taken, in this case g or green, so please set line style, point size, color and Marker Type only once. Used matlab syntax to define plot format:
Specifier LineStyle
'-' Solid line (default)
'--' Dashed line
':' Dotted line
'-.' Dash-dot line
'#' No line
Specifier Color
r Red
g Green
b Blue
c Cyan
m Magenta
y Yellow
k Black
w White
Specifier Marker Type
'+' Plus sign
'o' Circle
'p' Point
'x' Cross
's' Square
'f' Filled Square
'd' Diamond
'v' Downward-pointing triangle
'n' No point
Optional: defaults to <>.

series as Trace type to set different properties for this series

Throwable
if the series could not be initialized

setAutoScale

void setAutoScale(boolean performAutoScale)

Activates or deactivates auto scaling whenever the cart is updated. An auto scale may also be triggered by double clicking right into the chart area.

performAutoScale
if true auto scaling will be enabled

setAxisRange

void setAxisRange(double[] xRange, double[] yRange)

Set lower and upper limit of the X axis and the Y axis.

Alias: axis()

xRange
Range from x Axis to be set, format is [xmin, xmax]
yRange
Range from Y Axis to be set, format is [ymin, ymax]

setPlotTitle

org.eclipse.nebula.visualization.xygraph.figures.XYGraph setPlotTitle(String chartTitle)

Sets the title of the active chart.

Alias: title()

chartTitle
title to be set

XYGraph object or null if there is no active graph

setXLabel

org.eclipse.nebula.visualization.xygraph.figures.Axis setXLabel(String label)

Set X axis name.

Alias: xlabel()

label
label to be used for X axis

Axis object or null if there is no active graph

setYLabel

org.eclipse.nebula.visualization.xygraph.figures.Axis setYLabel(String label)

Set Y axis name.

Alias: ylabel()

label
label to be used for Y axis

Axis object or null if there is no active graph

showGrid

void showGrid(boolean showGrid)

Activates or deactivates drawing of a background grid.

showGrid
if true a grid will be displayed