cee::plt::OverlayPlot

class OverlayPlot : public OverlayItem

Overlay item with basic 2D plotting.

A view overlay item capable of showing a 2D plot (with optional border and background). The overlay plot can have any number of curves and offers a curve legend and a marker line. Various settings such as range, titles and colors(text, curve, lines, background, …) can be set.

../_images/plot_simple.png

See the topic 2D Plotting

An overlay plot contains one or more curves where each curve is a series of x- and y-values. These values can be saved and read from the VTFx model file. Plot settings, such as which curves are used in which plots, colors, titles and other, are saved as properties. (See PropertyApplierPlot2d and PropertyBuilderPlot2d).

The overlay item can be added to a view using the View::overlay() and Overlay::addItem(). The view manages the layout of the overlay items, so only a desired size can be given in this class. The position is specified when the overlay item is added to the view.

An overlay item can be shown in multiple views at the same time.

The demo apps found in the CEETRON Envision distribution offers example code for import, export and usage of plot data and overlay plots.

Public Types

enum LegendPosition

Position of the plot legend.

Values:

enumerator RIGHT

Show the legend to the right of the plot.

enumerator BELOW

Show the legend below the plot.

Public Functions

OverlayPlot(vis::Font *font)

Constructs an overlay plot.

virtual unsigned int width() const

Returns the width of the overlay plot in pixels.

virtual unsigned int height() const

Returns the height of the overlay plot in pixels.

virtual void setSize(unsigned int width, unsigned int height)

Sets the size of the text box, in pixels.

virtual int priority() const

Returns the render priority of the item.

virtual void setPriority(int priority)

Sets render priority of the item.

The render priority determines the order in which item get rendered. Items with lower priorities get rendered first. The default priority is 18.

Str title() const

Returns the plot title.

void setTitle(const Str &title)

Sets the plot title.

bool drawBackground() const

Returns true if plot background is drawn.

void setDrawBackground(bool drawBackground)

Specifies if the border should be drawn or not.

Color3f backgroundColor() const

Returns the background color of the overlay plot.

void setBackgroundColor(const Color3f &color)

Sets the background color of the overlay plot.

float backgroundOpacity() const

Returns the opacity of the background.

1.0 = opaque, 0.0 = fully transparent

void setBackgroundOpacity(float opacity)

Sets the opacity (transparency) of the background of the overlay plot.

1.0 = opaque, 0.0 = fully transparent

Color3f borderColor() const

Returns the border color of the overlay plot.

void setBorderColor(const Color3f &color)

Sets the color of the border of the overlay plot.

float borderWidth() const

Returns the width of the border around the overlay plot in pixels.

void setBorderWidth(float width)

Sets the width in pixels of the border around the overlay plot.

bool drawBorder() const

Returns true if the border is drawn.

void setDrawBorder(bool drawBorder)

Specifies if the border should be drawn or not.

const AxisSettings &axisSettings() const

Returns the axis settings for this plot.

AxisSettings &axisSettings()

Returns the axis settings for this plot.

const MarkerLine &markerLine() const

Returns the marker line for this plot.

MarkerLine &markerLine()

Returns the marker line for this plot.

bool drawCurveLegend() const

Returns true if the curve legend is drawn.

void setDrawCurveLegend(bool drawCurveLegend)

Specifies if the curve legend is drawn or not.

LegendPosition curveLegendPosition() const

Returns the curve legend position.

void setCurveLegendPosition(LegendPosition position)

Sets the curve legend position.

Color3f textColor() const

Sets the color used for text (labels and titles)

void setTextColor(const Color3f &color)

Sets the color used for text (labels and titles)

void setFont(vis::Font *font)

Sets the font used by the plot.

size_t curveCount() const

Returns the number of curves in this plot.

const Curve *curve(size_t curveIndex) const

Returns the curve at the specified index.

Curve *curve(size_t curveIndex)

Returns the curve at the specified index.

Curve *addCurve(const Str &curveName, const std::vector<double> &xValues, const std::vector<double> &yValues)

Adds a curve to the plot specifying a name and an x- and y-value array.

void removeAllCurves()

Removes all curves from the plot.

void removeCurve(size_t curveIndex)

Removes the curve at the specified index from the plot.

double xValuesMinimum() const

Returns the minimum x value of all curves in the plot.

double xValuesMaximum() const

Returns the maximum x value of all curves in the plot.

double yValuesMinimum() const

Returns the minimum y value of all curves in the plot.

double yValuesMaximum() const

Returns the maximum y value of all curves in the plot.