Aquila  2.0 prealpha
Cognitive Robotics Architecture
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Slots | Signals | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
QCustomPlot Class Reference

The central class of the library, the QWidget which displays the plot and interacts with the user. More...

#include <plot2d.h>

Inheritance diagram for QCustomPlot:

Public Types

enum  Interaction {
  iRangeDrag = 0x001, iRangeZoom = 0x002, iMultiSelect = 0x004, iSelectTitle = 0x008,
  iSelectPlottables = 0x010, iSelectAxes = 0x020, iSelectLegend = 0x040, iSelectItems = 0x080
}
 
enum  LayerInsertMode { limBelow, limAbove }
 

Public Slots

void deselectAll ()
 
void replot ()
 
void rescaleAxes ()
 

Signals

void mouseDoubleClick (QMouseEvent *event)
 
void mousePress (QMouseEvent *event)
 
void mouseMove (QMouseEvent *event)
 
void mouseRelease (QMouseEvent *event)
 
void mouseWheel (QWheelEvent *event)
 
void plottableClick (QCPAbstractPlottable *plottable, QMouseEvent *event)
 
void plottableDoubleClick (QCPAbstractPlottable *plottable, QMouseEvent *event)
 
void itemClick (QCPAbstractItem *item, QMouseEvent *event)
 
void itemDoubleClick (QCPAbstractItem *item, QMouseEvent *event)
 
void axisClick (QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event)
 
void axisDoubleClick (QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event)
 
void legendClick (QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event)
 
void legendDoubleClick (QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event)
 
void titleClick (QMouseEvent *event)
 
void titleDoubleClick (QMouseEvent *event)
 
void selectionChangedByUser ()
 
void beforeReplot ()
 
void afterReplot ()
 

Public Member Functions

 QCustomPlot (QWidget *parent=0)
 
virtual ~QCustomPlot ()
 
QString title () const
 
QFont titleFont () const
 
QColor titleColor () const
 
QRect axisRect () const
 
QRect viewport () const
 
int marginLeft () const
 
int marginRight () const
 
int marginTop () const
 
int marginBottom () const
 
bool autoMargin () const
 
QColor color () const
 
Qt::Orientations rangeDrag () const
 
Qt::Orientations rangeZoom () const
 
QCPAxisrangeDragAxis (Qt::Orientation orientation)
 
QCPAxisrangeZoomAxis (Qt::Orientation orientation)
 
double rangeZoomFactor (Qt::Orientation orientation)
 
QCP::AntialiasedElements antialiasedElements () const
 
QCP::AntialiasedElements notAntialiasedElements () const
 
bool autoAddPlottableToLegend () const
 
QPixmap axisBackground () const
 
bool axisBackgroundScaled () const
 
Qt::AspectRatioMode axisBackgroundScaledMode () const
 
const Interactions interactions () const
 
int selectionTolerance () const
 
QFont selectedTitleFont () const
 
QColor selectedTitleColor () const
 
bool titleSelected () const
 
bool noAntialiasingOnDrag () const
 
QCP::PlottingHints plottingHints () const
 
Qt::KeyboardModifier multiSelectModifier () const
 
void setTitle (const QString &title)
 
void setTitleFont (const QFont &font)
 
void setTitleColor (const QColor &color)
 
void setAxisRect (const QRect &arect)
 
void setMarginLeft (int margin)
 
void setMarginRight (int margin)
 
void setMarginTop (int margin)
 
void setMarginBottom (int margin)
 
void setMargin (int left, int right, int top, int bottom)
 
void setAutoMargin (bool enabled)
 
void setColor (const QColor &color)
 
void setRangeDrag (Qt::Orientations orientations)
 
void setRangeZoom (Qt::Orientations orientations)
 
void setRangeDragAxes (QCPAxis *horizontal, QCPAxis *vertical)
 
void setRangeZoomAxes (QCPAxis *horizontal, QCPAxis *vertical)
 
void setRangeZoomFactor (double horizontalFactor, double verticalFactor)
 
void setRangeZoomFactor (double factor)
 
void setAntialiasedElements (const QCP::AntialiasedElements &antialiasedElements)
 
void setAntialiasedElement (QCP::AntialiasedElement antialiasedElement, bool enabled=true)
 
void setNotAntialiasedElements (const QCP::AntialiasedElements &notAntialiasedElements)
 
void setNotAntialiasedElement (QCP::AntialiasedElement notAntialiasedElement, bool enabled=true)
 
void setAutoAddPlottableToLegend (bool on)
 
void setAxisBackground (const QPixmap &pm)
 
void setAxisBackground (const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding)
 
void setAxisBackgroundScaled (bool scaled)
 
void setAxisBackgroundScaledMode (Qt::AspectRatioMode mode)
 
void setInteractions (const Interactions &interactions)
 
void setInteraction (const Interaction &interaction, bool enabled=true)
 
void setSelectionTolerance (int pixels)
 
void setSelectedTitleFont (const QFont &font)
 
void setSelectedTitleColor (const QColor &color)
 
void setTitleSelected (bool selected)
 
void setNoAntialiasingOnDrag (bool enabled)
 
void setPlottingHints (const QCP::PlottingHints &hints)
 
void setPlottingHint (QCP::PlottingHint hint, bool enabled=true)
 
void setMultiSelectModifier (Qt::KeyboardModifier modifier)
 
QCPAbstractPlottableplottable (int index)
 
QCPAbstractPlottableplottable ()
 
bool addPlottable (QCPAbstractPlottable *plottable)
 
bool removePlottable (QCPAbstractPlottable *plottable)
 
bool removePlottable (int index)
 
int clearPlottables ()
 
int plottableCount () const
 
QList< QCPAbstractPlottable * > selectedPlottables () const
 
QCPAbstractPlottableplottableAt (const QPointF &pos, bool onlySelectable=false) const
 
bool hasPlottable (QCPAbstractPlottable *plottable) const
 
QCPGraphgraph (int index) const
 
QCPGraphgraph () const
 
QCPGraphaddGraph (QCPAxis *keyAxis=0, QCPAxis *valueAxis=0)
 
bool removeGraph (QCPGraph *graph)
 
bool removeGraph (int index)
 
int clearGraphs ()
 
int graphCount () const
 
QList< QCPGraph * > selectedGraphs () const
 
QCPAbstractItemitem (int index) const
 
QCPAbstractItemitem () const
 
bool addItem (QCPAbstractItem *item)
 
bool removeItem (QCPAbstractItem *item)
 
bool removeItem (int index)
 
int clearItems ()
 
int itemCount () const
 
QList< QCPAbstractItem * > selectedItems () const
 
QCPAbstractItemitemAt (const QPointF &pos, bool onlySelectable=false) const
 
QCPLayerlayer (const QString &name) const
 
QCPLayerlayer (int index) const
 
QCPLayercurrentLayer () const
 
bool setCurrentLayer (const QString &name)
 
bool setCurrentLayer (QCPLayer *layer)
 
int layerCount () const
 
bool addLayer (const QString &name, QCPLayer *otherLayer=0, LayerInsertMode insertMode=limAbove)
 
bool removeLayer (QCPLayer *layer)
 
bool moveLayer (QCPLayer *layer, QCPLayer *otherLayer, LayerInsertMode insertMode=limAbove)
 
QList< QCPAxis * > selectedAxes () const
 
QList< QCPLegend * > selectedLegends () const
 
void setupFullAxesBox ()
 
bool savePdf (const QString &fileName, bool noCosmeticPen=false, int width=0, int height=0)
 
bool savePng (const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1)
 
bool saveJpg (const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1)
 
bool saveBmp (const QString &fileName, int width=0, int height=0, double scale=1.0)
 
bool saveRastered (const QString &fileName, int width, int height, double scale, const char *format, int quality=-1)
 

Public Attributes

QCPAxisxAxis
 
QCPAxisyAxis
 
QCPAxisxAxis2
 
QCPAxisyAxis2
 
QCPLegendlegend
 

Protected Member Functions

virtual QSize minimumSizeHint () const
 
virtual void paintEvent (QPaintEvent *event)
 
virtual void resizeEvent (QResizeEvent *event)
 
virtual void mouseDoubleClickEvent (QMouseEvent *event)
 
virtual void mousePressEvent (QMouseEvent *event)
 
virtual void mouseMoveEvent (QMouseEvent *event)
 
virtual void mouseReleaseEvent (QMouseEvent *event)
 
virtual void wheelEvent (QWheelEvent *event)
 
virtual bool handlePlottableSelection (QMouseEvent *event, bool additiveSelection, bool &modified)
 
virtual bool handleItemSelection (QMouseEvent *event, bool additiveSelection, bool &modified)
 
virtual bool handleAxisSelection (QMouseEvent *event, bool additiveSelection, bool &modified)
 
virtual bool handleTitleSelection (QMouseEvent *event, bool additiveSelection, bool &modified)
 
virtual void draw (QCPPainter *painter)
 
virtual void drawAxisBackground (QCPPainter *painter)
 
void updateAxisRect ()
 
bool selectTestTitle (const QPointF &pos) const
 

Protected Attributes

QString mTitle
 
QFont mTitleFont
 
QFont mSelectedTitleFont
 
QColor mTitleColor
 
QColor mSelectedTitleColor
 
QRect mViewport
 
QRect mAxisRect
 
int mMarginLeft
 
int mMarginRight
 
int mMarginTop
 
int mMarginBottom
 
bool mAutoMargin
 
bool mAutoAddPlottableToLegend
 
QColor mColor
 
QList< QCPAbstractPlottable * > mPlottables
 
QList< QCPGraph * > mGraphs
 
QList< QCPAbstractItem * > mItems
 
QList< QCPLayer * > mLayers
 
Qt::Orientations mRangeDrag
 
Qt::Orientations mRangeZoom
 
QCPAxismRangeDragHorzAxis
 
QCPAxismRangeDragVertAxis
 
QCPAxismRangeZoomHorzAxis
 
QCPAxismRangeZoomVertAxis
 
double mRangeZoomFactorHorz
 
double mRangeZoomFactorVert
 
bool mDragging
 
QCP::AntialiasedElements mAntialiasedElements
 
QCP::AntialiasedElements mNotAntialiasedElements
 
QPixmap mAxisBackground
 
bool mAxisBackgroundScaled
 
Qt::AspectRatioMode mAxisBackgroundScaledMode
 
Interactions mInteractions
 
int mSelectionTolerance
 
bool mTitleSelected
 
QRect mTitleBoundingBox
 
bool mNoAntialiasingOnDrag
 
QPixmap mPaintBuffer
 
QPoint mDragStart
 
QCPRange mDragStartHorzRange
 
QCPRange mDragStartVertRange
 
QPixmap mScaledAxisBackground
 
bool mReplotting
 
QCP::AntialiasedElements mAADragBackup
 
QCP::AntialiasedElements mNotAADragBackup
 
QCPLayermCurrentLayer
 
QCP::PlottingHints mPlottingHints
 
Qt::KeyboardModifier mMultiSelectModifier
 

Friends

class QCPLegend
 
class QCPAxis
 
class QCPLayer
 

Detailed Description

The central class of the library, the QWidget which displays the plot and interacts with the user.

For tutorials on how to use QCustomPlot, see the website
http://www.WorksLikeClockWork.com/index.php/components/qt-plotting-widget

Member Enumeration Documentation

Defines the mouse interactions possible with QCustomPlot

Interactions is a flag of or-combined elements of this enum type.

See Also
setInteractions, setInteraction
Enumerator
iRangeDrag 

0x001 Axis ranges are draggable (see setRangeDrag, setRangeDragAxes)

iRangeZoom 

0x002 Axis ranges are zoomable with the mouse wheel (see setRangeZoom, setRangeZoomAxes)

iMultiSelect 

0x004 The user can select multiple objects by holding the modifier set by setMultiSelectModifier while clicking

iSelectTitle 

0x008 The plot title is selectable

iSelectPlottables 

0x010 Plottables are selectable

iSelectAxes 

0x020 Axes are selectable (or parts of them, see QCPAxis::setSelectable)

iSelectLegend 

0x040 Legends are selectable (or their child items, see QCPLegend::setSelectable)

iSelectItems 

0x080 Items are selectable (Rectangles, Arrows, Textitems, etc. see QCPAbstractItem)

Defines how a layer should be inserted relative to a specified other layer.

See Also
addLayer, moveLayer
Enumerator
limBelow 

Layer is inserted below other layer.

limAbove 

Layer is inserted above other layer.

Constructor & Destructor Documentation

QCustomPlot::QCustomPlot ( QWidget *  parent = 0)
explicit

Constructs a QCustomPlot and sets reasonable default values. Four axes are created at the bottom, left, top and right sides (xAxis, yAxis, xAxis2, yAxis2), however, only the bottom and left axes are set to be visible. The legend is also set to be invisible initially.

QCustomPlot::~QCustomPlot ( )
virtual

Member Function Documentation

QCPGraph * QCustomPlot::addGraph ( QCPAxis keyAxis = 0,
QCPAxis valueAxis = 0 
)

Creates a new graph inside the plot. If keyAxis and valueAxis are left unspecified (0), the bottom (xAxis) is used as key and the left (yAxis) is used as value. If specified, keyAxis and valueAxis must reside in this QCustomPlot.

keyAxis will be used as key axis (typically "x") and valueAxis as value axis (typically "y") for the graph.

Returns a pointer to the newly created graph.

See Also
graph, graphCount, removeGraph, clearGraphs
bool QCustomPlot::addItem ( QCPAbstractItem item)

Adds the specified item to the plot. QCustomPlot takes ownership of the item.

Returns true on success, i.e. when item wasn't already added to the plot and the parent plot of item is this QCustomPlot.

See Also
item, itemCount, removeItem, clearItems
bool QCustomPlot::addLayer ( const QString &  name,
QCPLayer otherLayer = 0,
QCustomPlot::LayerInsertMode  insertMode = limAbove 
)

Adds a new layer to this QCustomPlot instance. The new layer will have the name name, which must be unique. It is positioned either below or above otherLayer, which can be controlled with insertMode.

Returns true on success, i.e. if there is no other layer named name and otherLayer is a valid layer inside this QCustomPlot.

If otherLayer is 0, the highest layer in the QCustomPlot will be used.

For an explanation of what layers are in QCustomPlot, see the documentation of QCPLayer.

See Also
layer, moveLayer, removeLayer
bool QCustomPlot::addPlottable ( QCPAbstractPlottable plottable)

Adds the specified plottable to the plot and, if setAutoAddPlottableToLegend is enabled, to the legend. QCustomPlot takes ownership of the plottable.

Returns true on success, i.e. when plottable wasn't already added to the plot and the parent plot of plottable is this QCustomPlot (the latter is controlled by what axes the plottable was passed in the constructor).

See Also
plottable, plottableCount, removePlottable, clearPlottables
void QCustomPlot::afterReplot ( )
signal

This signal is emitted immediately after a replot has taken place (caused by a call to the slot replot).

It is safe to mutually connect the replot slot with this signal on two QCustomPlots to make them replot synchronously (i.e. it won't cause an infinite recursion).

See Also
replot, beforeReplot
QCP::AntialiasedElements QCustomPlot::antialiasedElements ( ) const
inline
bool QCustomPlot::autoAddPlottableToLegend ( ) const
inline
bool QCustomPlot::autoMargin ( ) const
inline
QPixmap QCustomPlot::axisBackground ( ) const
inline
bool QCustomPlot::axisBackgroundScaled ( ) const
inline
Qt::AspectRatioMode QCustomPlot::axisBackgroundScaledMode ( ) const
inline
void QCustomPlot::axisClick ( QCPAxis axis,
QCPAxis::SelectablePart  part,
QMouseEvent *  event 
)
signal

This signal is emitted when an axis is clicked.

event is the mouse event that caused the click, axis is the axis that received the click and part indicates the part of the axis that was clicked.

See Also
axisDoubleClick
void QCustomPlot::axisDoubleClick ( QCPAxis axis,
QCPAxis::SelectablePart  part,
QMouseEvent *  event 
)
signal

This signal is emitted when an axis is double clicked.

event is the mouse event that caused the click, axis is the axis that received the click and part indicates the part of the axis that was clicked.

See Also
axisClick
QRect QCustomPlot::axisRect ( ) const
inline
void QCustomPlot::beforeReplot ( )
signal

This signal is emitted immediately before a replot takes place (caused by a call to the slot replot).

It is safe to mutually connect the replot slot with this signal on two QCustomPlots to make them replot synchronously (i.e. it won't cause an infinite recursion).

See Also
replot, afterReplot
int QCustomPlot::clearGraphs ( )

Removes all graphs from the plot (and the legend, if necessary). Returns the number of graphs removed.

See Also
removeGraph
int QCustomPlot::clearItems ( )

Removes all items from the plot.

Returns the number of items removed.

See Also
removeItem
int QCustomPlot::clearPlottables ( )

Removes all plottables from the plot (and the legend, if necessary).

Returns the number of plottables removed.

See Also
removePlottable
QColor QCustomPlot::color ( ) const
inline
QCPLayer * QCustomPlot::currentLayer ( ) const

Returns the layer that is set as current layer (see setCurrentLayer).

void QCustomPlot::deselectAll ( )
slot

Deselects everything in the QCustomPlot (plottables, items, axes, legend and title).

Since calling this function is not a user interaction, this does not emit the selectionChangedByUser signal. The individual selectionChanged signals are emitted though, if the objects were previously selected.

See Also
setInteractions, selectedPlottables, selectedItems, selectedAxes, selectedLegends
void QCustomPlot::draw ( QCPPainter painter)
protectedvirtual
void QCustomPlot::drawAxisBackground ( QCPPainter painter)
protectedvirtual
QCPGraph * QCustomPlot::graph ( int  index) const

Returns the graph with index. If the index is invalid, returns 0.

There is an overloaded version of this function with no parameter which returns the last created graph, see QCustomPlot::graph()

See Also
graphCount, addGraph
QCPGraph * QCustomPlot::graph ( ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the last graph, that was created with addGraph. If there are no graphs in the plot, returns 0.

See Also
graphCount, addGraph
int QCustomPlot::graphCount ( ) const

Returns the number of currently existing graphs in the plot

See Also
graph, addGraph
bool QCustomPlot::handleAxisSelection ( QMouseEvent *  event,
bool  additiveSelection,
bool &  modified 
)
protectedvirtual
bool QCustomPlot::handleItemSelection ( QMouseEvent *  event,
bool  additiveSelection,
bool &  modified 
)
protectedvirtual
bool QCustomPlot::handlePlottableSelection ( QMouseEvent *  event,
bool  additiveSelection,
bool &  modified 
)
protectedvirtual
bool QCustomPlot::handleTitleSelection ( QMouseEvent *  event,
bool  additiveSelection,
bool &  modified 
)
protectedvirtual
bool QCustomPlot::hasPlottable ( QCPAbstractPlottable plottable) const

Returns whether this QCustomPlot instance contains the plottable.

See Also
addPlottable
const Interactions QCustomPlot::interactions ( ) const
inline
QCPAbstractItem * QCustomPlot::item ( int  index) const

Returns the item with index. If the index is invalid, returns 0.

There is an overloaded version of this function with no parameter which returns the last added item, see QCustomPlot::item()

See Also
itemCount, addItem
QCPAbstractItem * QCustomPlot::item ( ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the last item, that was added with addItem. If there are no items in the plot, returns 0.

See Also
itemCount, addItem
QCPAbstractItem * QCustomPlot::itemAt ( const QPointF &  pos,
bool  onlySelectable = false 
) const

Returns the item at the pixel position pos. Items that only consist of single lines (e.g. QCPItemLine or QCPItemCurve) have a tolerance band around them, see setSelectionTolerance. If multiple items come into consideration, the one closest to pos is returned.

If onlySelectable is true, only items that are selectable (QCPAbstractItem::setSelectable) are considered.

If there is no item at pos, the return value is 0.

void QCustomPlot::itemClick ( QCPAbstractItem item,
QMouseEvent *  event 
)
signal

This signal is emitted when an item is clicked.

event is the mouse event that caused the click and item is the item that received the click.

See Also
itemDoubleClick
int QCustomPlot::itemCount ( ) const

Returns the number of currently existing items in the plot

See Also
item, addItem
void QCustomPlot::itemDoubleClick ( QCPAbstractItem item,
QMouseEvent *  event 
)
signal

This signal is emitted when an item is double clicked.

event is the mouse event that caused the click and item is the item that received the click.

See Also
itemClick
QCPLayer * QCustomPlot::layer ( const QString &  name) const

Returns the layer with the specified name.

See Also
addLayer, moveLayer, removeLayer
QCPLayer * QCustomPlot::layer ( int  index) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the layer by index.

See Also
addLayer, moveLayer, removeLayer
int QCustomPlot::layerCount ( ) const

Returns the number of currently existing layers in the plot

See Also
layer, addLayer
void QCustomPlot::legendClick ( QCPLegend legend,
QCPAbstractLegendItem item,
QMouseEvent *  event 
)
signal

This signal is emitted when a legend (item) is clicked.

event is the mouse event that caused the click, legend is the legend that received the click and item is the legend item that received the click. If only the legend and no item is clicked, item is 0 (e.g. a click inside the legend padding, which is not part of any item).

See Also
legendDoubleClick
void QCustomPlot::legendDoubleClick ( QCPLegend legend,
QCPAbstractLegendItem item,
QMouseEvent *  event 
)
signal

This signal is emitted when a legend (item) is double clicked.

event is the mouse event that caused the click, legend is the legend that received the click and item is the legend item that received the click. If only the legend and no item is clicked, item is 0 (e.g. a click inside the legend padding, which is not part of any item).

See Also
legendClick
int QCustomPlot::marginBottom ( ) const
inline
int QCustomPlot::marginLeft ( ) const
inline
int QCustomPlot::marginRight ( ) const
inline
int QCustomPlot::marginTop ( ) const
inline
QSize QCustomPlot::minimumSizeHint ( ) const
protectedvirtual
void QCustomPlot::mouseDoubleClick ( QMouseEvent *  event)
signal

This signal is emitted when the QCustomPlot receives a mouse double click event.

void QCustomPlot::mouseDoubleClickEvent ( QMouseEvent *  event)
protectedvirtual
void QCustomPlot::mouseMove ( QMouseEvent *  event)
signal

This signal is emitted when the QCustomPlot receives a mouse move event.

It is emitted before the QCustomPlot handles its range dragging mechanism, so a slot connected to this signal can still influence the behaviour e.g. with setRangeDrag.

Warning
It is discouraged to change the drag-axes with setRangeDragAxes here, because the dragging starting point was saved the moment the mouse was pressed. Thus it only has a sensible meaning for the range drag axes that were set at that moment. If you want to change the drag axes, consider doing this in the mousePress signal instead.
void QCustomPlot::mouseMoveEvent ( QMouseEvent *  event)
protectedvirtual
void QCustomPlot::mousePress ( QMouseEvent *  event)
signal

This signal is emitted when the QCustomPlot receives a mouse press event.

It is emitted before the QCustomPlot handles its range dragging mechanism, so a slot connected to this signal can still influence the behaviour e.g. with setRangeDrag or setRangeDragAxes.

void QCustomPlot::mousePressEvent ( QMouseEvent *  event)
protectedvirtual
void QCustomPlot::mouseRelease ( QMouseEvent *  event)
signal

This signal is emitted when the QCustomPlot receives a mouse release event.

It is emitted before the QCustomPlot handles its selection mechanism, so a slot connected to this signal can still influence the behaviour e.g. with setInteractions or QCPAbstractPlottable::setSelectable.

void QCustomPlot::mouseReleaseEvent ( QMouseEvent *  event)
protectedvirtual
void QCustomPlot::mouseWheel ( QWheelEvent *  event)
signal

This signal is emitted when the QCustomPlot receives a mouse wheel event.

It is emitted before the QCustomPlot handles its range zooming mechanism, so a slot connected to this signal can still influence the behaviour e.g. with setRangeZoom, setRangeZoomAxes or setRangeZoomFactor.

bool QCustomPlot::moveLayer ( QCPLayer layer,
QCPLayer otherLayer,
QCustomPlot::LayerInsertMode  insertMode = limAbove 
)

Moves the specified layer to the position relative to otherLayer. Whether layer is placed above or below otherLayer can be controlled with insertMode.

Returns true on success, i.e. when both layer and otherLayer are valid layers in the QCustomPlot.

See Also
layer, addLayer, moveLayer
Qt::KeyboardModifier QCustomPlot::multiSelectModifier ( ) const
inline
bool QCustomPlot::noAntialiasingOnDrag ( ) const
inline
QCP::AntialiasedElements QCustomPlot::notAntialiasedElements ( ) const
inline
void QCustomPlot::paintEvent ( QPaintEvent *  event)
protectedvirtual
QCPAbstractPlottable * QCustomPlot::plottable ( int  index)

Returns the plottable with index. If the index is invalid, returns 0.

There is an overloaded version of this function with no parameter which returns the last added plottable, see QCustomPlot::plottable()

See Also
plottableCount, addPlottable
QCPAbstractPlottable * QCustomPlot::plottable ( )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the last plottable, that was added with addPlottable. If there are no plottables in the plot, returns 0.

See Also
plottableCount, addPlottable
QCPAbstractPlottable * QCustomPlot::plottableAt ( const QPointF &  pos,
bool  onlySelectable = false 
) const

Returns the plottable at the pixel position pos. Plottables that only consist of single lines (e.g. graphs) have a tolerance band around them, see setSelectionTolerance. If multiple plottables come into consideration, the one closest to pos is returned.

If onlySelectable is true, only plottables that are selectable (QCPAbstractPlottable::setSelectable) are considered.

If there is no plottable at pos, the return value is 0.

void QCustomPlot::plottableClick ( QCPAbstractPlottable plottable,
QMouseEvent *  event 
)
signal

This signal is emitted when a plottable is clicked.

event is the mouse event that caused the click and plottable is the plottable that received the click.

See Also
plottableDoubleClick
int QCustomPlot::plottableCount ( ) const

Returns the number of currently existing plottables in the plot

See Also
plottable, addPlottable
void QCustomPlot::plottableDoubleClick ( QCPAbstractPlottable plottable,
QMouseEvent *  event 
)
signal

This signal is emitted when a plottable is double clicked.

event is the mouse event that caused the click and plottable is the plottable that received the click.

See Also
plottableClick
QCP::PlottingHints QCustomPlot::plottingHints ( ) const
inline
Qt::Orientations QCustomPlot::rangeDrag ( ) const
inline
QCPAxis * QCustomPlot::rangeDragAxis ( Qt::Orientation  orientation)

Returns the range drag axis of the orientation provided

See Also
setRangeDragAxes
Qt::Orientations QCustomPlot::rangeZoom ( ) const
inline
QCPAxis * QCustomPlot::rangeZoomAxis ( Qt::Orientation  orientation)

Returns the range zoom axis of the orientation provided

See Also
setRangeZoomAxes
double QCustomPlot::rangeZoomFactor ( Qt::Orientation  orientation)

Returns the range zoom factor of the orientation provided

See Also
setRangeZoomFactor
bool QCustomPlot::removeGraph ( QCPGraph graph)

Removes the specified graph from the plot and, if necessary, from the legend. If any other graphs in the plot have a channel fill set towards the removed graph, the channel fill property of those graphs is reset to zero (no channel fill).

Returns true on success.

See Also
clearGraphs
bool QCustomPlot::removeGraph ( int  index)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Removes the graph by its index.

bool QCustomPlot::removeItem ( QCPAbstractItem item)

Removes the specified item from the plot.

Returns true on success.

See Also
addItem, clearItems
bool QCustomPlot::removeItem ( int  index)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Removes the item by its index.

bool QCustomPlot::removeLayer ( QCPLayer layer)

Removes the specified layer and returns true on success.

All layerables (e.g. plottables and items) on the removed layer will be moved to the layer below layer. If layer is the bottom layer, the layerables are moved to the layer above. In both cases, the total rendering order of all layerables in the QCustomPlot is preserved.

If layer is the current layer (setCurrentLayer), the layer below (or above, if bottom layer) becomes the new current layer.

Note that it is not possible to remove the last layer.

See Also
layer, addLayer, moveLayer
bool QCustomPlot::removePlottable ( QCPAbstractPlottable plottable)

Removes the specified plottable from the plot and, if necessary, from the legend.

Returns true on success.

See Also
addPlottable, clearPlottables
bool QCustomPlot::removePlottable ( int  index)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Removes the plottable by its index.

void QCustomPlot::replot ( )
slot

Causes a complete replot (axes, labels, graphs, etc.) into the internal buffer. Finally, update() is called, to redraw the buffer on the QCustomPlot widget surface.

Before the replot happens, the signal beforeReplot is emitted. After the replot, afterReplot is emitted. It is safe to mutually connect the replot slot with any of those two signals on two QCustomPlots to make them replot synchronously (i.e. it won't cause an infinite recursion).

void QCustomPlot::rescaleAxes ( )
slot

Rescales the axes such that all plottables (e.g. graphs) in the plot are fully visible. It does this by calling QCPAbstractPlottable::rescaleAxes on all plottables.

See Also
QCPAbstractPlottable::rescaleAxes
void QCustomPlot::resizeEvent ( QResizeEvent *  event)
protectedvirtual
bool QCustomPlot::saveBmp ( const QString &  fileName,
int  width = 0,
int  height = 0,
double  scale = 1.0 
)

Saves a BMP image file to fileName on disc. The output plot will have the dimensions width and height in pixels. If either width or height is zero, the exported image will have the same dimensions as the QCustomPlot widget currently has. Line widths and texts etc. are not scaled up when larger widths/heights are used. If you want that effect, use the scale parameter.

For example, if you set both width and height to 100 and scale to 2, you will end up with an image file of size 200*200 in which all graphical elements are scaled up by factor 2 (line widths, texts, etc.). This scaling is not done by stretching a 100*100 image, the result will have full 200*200 pixel resolution.

Warning
If calling this function inside the constructor of the parent of the QCustomPlot widget (i.e. the MainWindow constructor, if QCustomPlot is inside the MainWindow), always provide explicit non-zero widths and heights. If you leave width or height as 0 (default), this function uses the current width and height of the QCustomPlot widget. However, in Qt, these aren't defined yet inside the constructor, so you would get an image that has strange widths/heights.

The objects of the plot will appear in the current selection state. If you don't want any selected objects to be painted in their selected look, deselect everything with deselectAll before calling this function.

Returns true on success. If this function fails, most likely the BMP format isn't supported by the system, see Qt docs about QImageWriter::supportedImageFormats().

See Also
savePdf, savePng, saveJpg, saveRastered
bool QCustomPlot::saveJpg ( const QString &  fileName,
int  width = 0,
int  height = 0,
double  scale = 1.0,
int  quality = -1 
)

Saves a JPG image file to fileName on disc. The output plot will have the dimensions width and height in pixels. If either width or height is zero, the exported image will have the same dimensions as the QCustomPlot widget currently has. Line widths and texts etc. are not scaled up when larger widths/heights are used. If you want that effect, use the scale parameter.

For example, if you set both width and height to 100 and scale to 2, you will end up with an image file of size 200*200 in which all graphical elements are scaled up by factor 2 (line widths, texts, etc.). This scaling is not done by stretching a 100*100 image, the result will have full 200*200 pixel resolution.

Warning
If calling this function inside the constructor of the parent of the QCustomPlot widget (i.e. the MainWindow constructor, if QCustomPlot is inside the MainWindow), always provide explicit non-zero widths and heights. If you leave width or height as 0 (default), this function uses the current width and height of the QCustomPlot widget. However, in Qt, these aren't defined yet inside the constructor, so you would get an image that has strange widths/heights.

The objects of the plot will appear in the current selection state. If you don't want any selected objects to be painted in their selected look, deselect everything with deselectAll before calling this function.

JPG compression can be controlled with the quality parameter which must be between 0 and 100 or -1 to use the default setting.

Returns true on success. If this function fails, most likely the JPG format isn't supported by the system, see Qt docs about QImageWriter::supportedImageFormats().

See Also
savePdf, savePng, saveBmp, saveRastered
bool QCustomPlot::savePdf ( const QString &  fileName,
bool  noCosmeticPen = false,
int  width = 0,
int  height = 0 
)

Saves a PDF with the vectorized plot to the file fileName. The axis ratio as well as the scale of texts and lines will be derived from the specified width and height. This means, the output will look like the normal on-screen output of a QCustomPlot widget with the corresponding pixel width and height. If either width or height is zero, the exported image will have the same dimensions as the QCustomPlot widget currently has.

noCosmeticPen disables the use of cosmetic pens when drawing to the PDF file. Cosmetic pens are pens with numerical width 0, which are always drawn as a one pixel wide line, no matter what zoom factor is set in the PDF-Viewer. For more information about cosmetic pens, see QPainter and QPen documentation.

The objects of the plot will appear in the current selection state. So when you don't want e.g. selected axes to be painted in their selected look, deselect everything with deselectAll before calling this function.

Returns true on success.

Warning
  • If you plan on editing the exported PDF file with a vector graphics editor like Inkscape, it is advised to set noCosmeticPen to true to avoid losing those cosmetic lines (which might be quite many, because cosmetic pens are the default for e.g. axes and tick marks).
  • If calling this function inside the constructor of the parent of the QCustomPlot widget (i.e. the MainWindow constructor, if QCustomPlot is inside the MainWindow), always provide explicit non-zero widths and heights. If you leave width or height as 0 (default), this function uses the current width and height of the QCustomPlot widget. However, in Qt, these aren't defined yet inside the constructor, so you would get an image that has strange widths/heights.
See Also
savePng, saveBmp, saveJpg, saveRastered
bool QCustomPlot::savePng ( const QString &  fileName,
int  width = 0,
int  height = 0,
double  scale = 1.0,
int  quality = -1 
)

Saves a PNG image file to fileName on disc. The output plot will have the dimensions width and height in pixels. If either width or height is zero, the exported image will have the same dimensions as the QCustomPlot widget currently has. Line widths and texts etc. are not scaled up when larger widths/heights are used. If you want that effect, use the scale parameter.

For example, if you set both width and height to 100 and scale to 2, you will end up with an image file of size 200*200 in which all graphical elements are scaled up by factor 2 (line widths, texts, etc.). This scaling is not done by stretching a 100*100 image, the result will have full 200*200 pixel resolution.

Warning
If calling this function inside the constructor of the parent of the QCustomPlot widget (i.e. the MainWindow constructor, if QCustomPlot is inside the MainWindow), always provide explicit non-zero widths and heights. If you leave width or height as 0 (default), this function uses the current width and height of the QCustomPlot widget. However, in Qt, these aren't defined yet inside the constructor, so you would get an image that has strange widths/heights.

The objects of the plot will appear in the current selection state. If you don't want any selected objects to be painted in their selected look, deselect everything with deselectAll before calling this function.

If you want the plot to be painted in a PNG with transparent background, call setColor with a transparent color, e.g. Qt::transparent, before saving.

PNG compression can be controlled with the quality parameter which must be between 0 and 100 or -1 to use the default setting.

Returns true on success. If this function fails, most likely the PNG format isn't supported by the system, see Qt docs about QImageWriter::supportedImageFormats().

See Also
savePdf, saveBmp, saveJpg, saveRastered
bool QCustomPlot::saveRastered ( const QString &  fileName,
int  width,
int  height,
double  scale,
const char *  format,
int  quality = -1 
)

Saves the plot to a rastered image file fileName in the image format format. The plot is sized to width and height in pixels and scaled with scale. (width 100 and scale 2.0 lead to a full resolution file with width 200) If the format supports compression, quality may be between 0 and 100 to control it.

Returns true on success. If this function fails, most likely the given format isn't supported by the system, see Qt docs about QImageWriter::supportedImageFormats().

See Also
saveBmp, saveJpg, savePng
QList< QCPAxis * > QCustomPlot::selectedAxes ( ) const

Returns the axes that currently have selected parts, i.e. whose selection is not QCPAxis::spNone.

See Also
selectedPlottables, selectedLegends, setInteractions, QCPAxis::setSelected, QCPAxis::setSelectable
QList< QCPGraph * > QCustomPlot::selectedGraphs ( ) const

Returns a list of the selected graphs. If no graphs are currently selected, the list is empty.

Note
Even if the returned list is empty, it might still be, that there are selected plottables in the plot that are not of type QCPGraph (e.g. QCPCurve, QCPBars, etc.), see selectedPlottables. Of course, this only applies, if you actually add non-QCPGraph plottables.
See Also
setInteractions, selectedPlottables, QCPAbstractPlottable::setSelectable, QCPAbstractPlottable::setSelected
QList< QCPAbstractItem * > QCustomPlot::selectedItems ( ) const

Returns a list of the selected items. If no items are currently selected, the list is empty.

See Also
setInteractions, QCPAbstractItem::setSelectable, QCPAbstractItem::setSelected
QList< QCPLegend * > QCustomPlot::selectedLegends ( ) const

Returns the legends (typically one or zero) that currently have selected parts, i.e. whose selection is not QCPLegend::spNone.

See Also
selectedPlottables, selectedAxes, setInteractions, QCPLegend::setSelected, QCPLegend::setSelectable, QCPLegend::selectedItems
QList< QCPAbstractPlottable * > QCustomPlot::selectedPlottables ( ) const

Returns a list of the selected plottables. If no plottables are currently selected, the list is empty.

There is a convenience function if you're only interested in selected graphs, see selectedGraphs.

See Also
setInteractions, QCPAbstractPlottable::setSelectable, QCPAbstractPlottable::setSelected, selectedGraphs
QColor QCustomPlot::selectedTitleColor ( ) const
inline
QFont QCustomPlot::selectedTitleFont ( ) const
inline
void QCustomPlot::selectionChangedByUser ( )
signal

This signal is emitted after the user has changed the selection in the QCustomPlot, e.g. by clicking. It is not emitted, when the selection state of an object has changed programmatically, e.g. by a direct call to setSelected() on a plottable or by calling deselectAll.

See the documentation of setInteractions for how to find out which objects are currently selected.

See Also
setInteractions, QCPAbstractPlottable::selectionChanged, QCPAxis::selectionChanged
int QCustomPlot::selectionTolerance ( ) const
inline
bool QCustomPlot::selectTestTitle ( const QPointF &  pos) const
protected
void QCustomPlot::setAntialiasedElement ( QCP::AntialiasedElement  antialiasedElement,
bool  enabled = true 
)

Sets whether the specified antialiasedElement is forcibly drawn antialiased.

This overrides the antialiasing settings for whole element groups, normally controlled with the setAntialiasing function on the individual elements. If an element is neither specified in setAntialiasedElements nor in setNotAntialiasedElements, the antialiasing setting on each individual element instance is used.

For example, if enabled is true and antialiasedElement is QCP::aePlottables, all plottables will be drawn antialiased, no matter what the specific QCPAbstractPlottable::setAntialiased value was set to.

See Also
setNotAntialiasedElement
void QCustomPlot::setAntialiasedElements ( const QCP::AntialiasedElements &  antialiasedElements)

Sets which elements are forcibly drawn antialiased as an or combination of QCP::AntialiasedElement.

This overrides the antialiasing settings for whole element groups, normally controlled with the setAntialiasing function on the individual elements. If an element is neither specified in setAntialiasedElements nor in setNotAntialiasedElements, the antialiasing setting on each individual element instance is used.

For example, if antialiasedElements contains QCP::aePlottables, all plottables will be drawn antialiased, no matter what the specific QCPAbstractPlottable::setAntialiased value was set to.

See Also
setNotAntialiasedElements
void QCustomPlot::setAutoAddPlottableToLegend ( bool  on)

If set to true, adding a plottable (e.g. a graph) to the QCustomPlot automatically also adds the newly created plottable to the legend.

See Also
addPlottable, addGraph, QCPLegend::addItem
void QCustomPlot::setAutoMargin ( bool  enabled)

Sets whether the margins are calculated automatically depeding on the sizes of the tick labels, axis labels, paddings etc. If disabled, the margins must be set manually with the setMargin functions.

See Also
setMargin, QCPAxis::setLabelPadding, QCPAxis::setTickLabelPadding
void QCustomPlot::setAxisBackground ( const QPixmap &  pm)

Sets pm as the axis background pixmap. The axis background pixmap will be drawn inside the current axis rect, before anything else (e.g. the axes themselves, grids, graphs, etc.) is drawn. If the provided pixmap doesn't have the same size as the axis rect, scaling can be enabled with setAxisBackgroundScaled and the scaling mode (i.e. whether and how the aspect ratio is preserved) can be set with setAxisBackgroundScaledMode. To set all these options in one call, consider using the overloaded version of this function.

See Also
setAxisBackgroundScaled, setAxisBackgroundScaledMode
void QCustomPlot::setAxisBackground ( const QPixmap &  pm,
bool  scaled,
Qt::AspectRatioMode  mode = Qt::KeepAspectRatioByExpanding 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Allows setting the background pixmap, whether it shall be scaled and how it shall be scaled in one call.

See Also
setAxisBackground(const QPixmap &pm), setAxisBackgroundScaled, setAxisBackgroundScaledMode
void QCustomPlot::setAxisBackgroundScaled ( bool  scaled)

Sets whether the axis background pixmap shall be scaled to fit the current axis rect or not. If scaled is set to true, you may control whether and how the aspect ratio of the original pixmap is preserved with setAxisBackgroundScaledMode.

Note that the scaled version of the original pixmap is buffered, so there is no performance penalty on replots, when enabling the scaling. (Except of course, the axis rect is continuously changed, but that's not very likely.)

See Also
setAxisBackground, setAxisBackgroundScaledMode
void QCustomPlot::setAxisBackgroundScaledMode ( Qt::AspectRatioMode  mode)

If scaling of the axis background pixmap is enabled (setAxisBackgroundScaled), use this function to define whether and how the aspect ratio of the original pixmap passed to setAxisBackground is preserved.

See Also
setAxisBackground, setAxisBackgroundScaled
void QCustomPlot::setAxisRect ( const QRect &  arect)

An alternative way to set the margins, by directly setting the wanted axis rect. The rect will be translated into appropriate margin values.

Warning
Setting the axis rect with this function does not guarantee that the axis rect will stay like this indefinitely. In QCustomPlot, margins are the fixed values (if setAutoMargin is false). Hence the axis rect is automatically changed when the widget size changes, but the margins (distances between axis rect sides and widget/viewport rect sides) stay the same.
See Also
setMargin
void QCustomPlot::setColor ( const QColor &  color)

Sets the background color of the QCustomPlot widget.

bool QCustomPlot::setCurrentLayer ( const QString &  name)

Sets the layer with the specified name to be the current layer. All newly created/added layerables (QCPLayerable), e.g. plottables and items, are initially placed on the current layer.

Returns true on success, i.e. if there is a layer with the specified name in the QCustomPlot.

See Also
addLayer, moveLayer, removeLayer
bool QCustomPlot::setCurrentLayer ( QCPLayer layer)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Sets the provided layer to be the current layer.

Returns true on success, i.e. when layer is a valid layer in the QCustomPlot.

See Also
addLayer, moveLayer, removeLayer
void QCustomPlot::setInteraction ( const Interaction interaction,
bool  enabled = true 
)

Sets the single interaction of this QCustomPlot to enabled.

For details about the interaction system, see setInteractions.

See Also
setInteractions
void QCustomPlot::setInteractions ( const Interactions &  interactions)

Sets the possible interactions of this QCustomPlot as an or-combination of Interaction enums. There are the following types of interactions:

Axis range manipulation is controlled via iRangeDrag and iRangeZoom. When the respective interaction is enabled, the user may drag axes ranges and zoom with the mouse wheel. For details how to control which axes the user may drag/zoom and in what orientations, see setRangeDrag, setRangeZoom, setRangeDragAxes, setRangeZoomAxes.

Plottable selection is controlled by iSelectPlottables. If iSelectPlottables is set, the user may select plottables (e.g. graphs, curves, bars,...) by clicking on them or in their vicinity, see setSelectionTolerance. Whether the user can actually select a plottable can further be restricted with the QCPAbstractPlottable::setSelectable function on the specific plottable. To find out whether a specific plottable is selected, call QCPAbstractPlottable::selected(). To retrieve a list of all currently selected plottables, call selectedPlottables. If you're only interested in QCPGraphs, you may use the convenience function selectedGraphs.

Item selection is controlled by iSelectItems. If iSelectItems is set, the user may select items (e.g. QCPItemLine, QCPItemText,...) by clicking on them or in their vicinity. To find out whether a specific item is selected, call QCPAbstractItem::selected(). To retrieve a list of all currently selected items, call selectedItems.

Axis selection is controlled with iSelectAxes. If iSelectAxes is set, the user may select parts of the axes by clicking on them. What parts exactly (e.g. Axis base line, tick labels, axis label) are selectable can be controlled via QCPAxis::setSelectable for each axis. To retrieve a list of all axes that currently contain selected parts, call selectedAxes. Which parts of an axis are selected, can be retrieved with QCPAxis::selected().

Legend selection is controlled with iSelectLegend. If this is set, the user may select the legend itself or individual items by clicking on them. What parts exactly are selectable can be controlled via QCPLegend::setSelectable. To find out whether the legend or any child items are selected, check the value of QCPLegend::selected. To find out which child items are selected, call QCPLegend::selectedItems.

Plot title selection is controlled with iSelectTitle. If set, the user may select the plot title by clicking on it. To find out whether the title is currently selected, call QCustomPlot::titleSelected().

If the selection state has changed by user interaction, the selectionChangedByUser signal is emitted. Each selectable object additionally emits an individual selectionChanged signal whenever their selection state has changed, i.e. not only by user interaction.

To allow multiple objects to be selected by holding the modifier set with setMultiSelectModifier, set the flag iMultiSelect.

Note
In addition to the selection mechanism presented here, QCustomPlot always emits corresponding signals, when an object is clicked or double clicked. see plottableClick and plottableDoubleClick for example.
See Also
setInteraction, setSelectionTolerance
void QCustomPlot::setMargin ( int  left,
int  right,
int  top,
int  bottom 
)

Sets the margins manually. Will only have effect, if setAutoMargin is set to false. The margins are the distances in pixels between the axes box and the viewport box. The viewport box normally is the entire QCustomPlot widget or the entire image, if using one of the export functions. Positive margin values always mean the axes box is shrinked, going inward from the sides of the viewport box.

void QCustomPlot::setMarginBottom ( int  margin)

Sets the bottom margin manually. Will only have effect, if setAutoMargin is set to false. see setMargin for an explanation of what margins mean in QCustomPlot.

void QCustomPlot::setMarginLeft ( int  margin)

Sets the left margin manually. Will only have effect, if setAutoMargin is set to false. see setMargin for an explanation of what margins mean in QCustomPlot.

void QCustomPlot::setMarginRight ( int  margin)

Sets the right margin manually. Will only have effect, if setAutoMargin is set to false. see setMargin for an explanation of what margins mean in QCustomPlot.

void QCustomPlot::setMarginTop ( int  margin)

Sets the top margin manually. Will only have effect, if setAutoMargin is set to false. see setMargin for an explanation of what margins mean in QCustomPlot.

void QCustomPlot::setMultiSelectModifier ( Qt::KeyboardModifier  modifier)

Sets the keyboard modifier that will be recognized as multi-select-modifier.

If iMultiSelect is specified in setInteractions, the user may select multiple objects by clicking on them one after the other while holding down modifier.

By default the multi-select-modifier is set to Qt::ControlModifier.

See Also
setInteractions
void QCustomPlot::setNoAntialiasingOnDrag ( bool  enabled)

Sets whether antialiasing is disabled for all elements while the user is dragging axes ranges. If many objects, especially plottables, are normally drawn antialiased, this greatly improves performance during dragging. Thus it creates a more responsive user experience. As soon as the user stops dragging, the last replot is done with normal antialiasing, to restore high image quality.

See Also
setAntialiasedElements, setNotAntialiasedElements
void QCustomPlot::setNotAntialiasedElement ( QCP::AntialiasedElement  notAntialiasedElement,
bool  enabled = true 
)

Sets whether the specified notAntialiasedElement is forcibly drawn not antialiased.

This overrides the antialiasing settings for whole element groups, normally controlled with the setAntialiasing function on the individual elements. If an element is neither specified in setAntialiasedElements nor in setNotAntialiasedElements, the antialiasing setting on each individual element instance is used.

For example, if enabled is true and notAntialiasedElement is QCP::aePlottables, no plottables will be drawn antialiased, no matter what the specific QCPAbstractPlottable::setAntialiased value was set to.

if enabled is true and notAntialiasedElement is already set with setAntialiasedElement, it is removed from there.

See Also
setAntialiasedElement
void QCustomPlot::setNotAntialiasedElements ( const QCP::AntialiasedElements &  notAntialiasedElements)

Sets which elements are forcibly drawn not antialiased as an or combination of QCP::AntialiasedElement.

This overrides the antialiasing settings for whole element groups, normally controlled with the setAntialiasing function on the individual elements. If an element is neither specified in setAntialiasedElements nor in setNotAntialiasedElements, the antialiasing setting on each individual element instance is used.

For example, if notAntialiasedElements contains QCP::aePlottables, no plottables will be drawn antialiased, no matter what the specific QCPAbstractPlottable::setAntialiased value was set to.

if an element in notAntialiasedElements is already set in setAntialiasedElements, it is removed from there.

See Also
setAntialiasedElements
void QCustomPlot::setPlottingHint ( QCP::PlottingHint  hint,
bool  enabled = true 
)

Sets the specified plotting hint to enabled.

See Also
setPlottingHints
void QCustomPlot::setPlottingHints ( const QCP::PlottingHints &  hints)

Sets the plotting hints for this QCustomPlot instance.

See Also
setPlottingHint
void QCustomPlot::setRangeDrag ( Qt::Orientations  orientations)

Sets which axis orientation may be range dragged by the user with mouse interaction. What orientation corresponds to which specific axis can be set with setRangeDragAxes(QCPAxis *horizontal, QCPAxis *vertical). By default, the horizontal axis is the bottom axis (xAxis) and the vertical axis is the left axis (yAxis).

To disable range dragging entirely, pass 0 as orientations or remove iRangeDrag from setInteractions. To enable range dragging for both directions, pass Qt::Horizontal | Qt::Vertical as orientations.

In addition to setting orientations to a non-zero value, make sure setInteractions contains iRangeDrag to enable the range dragging interaction.

See Also
setRangeZoom, setRangeDragAxes, setNoAntialiasingOnDrag
void QCustomPlot::setRangeDragAxes ( QCPAxis horizontal,
QCPAxis vertical 
)

Sets the axes whose range will be dragged when setRangeDrag enables mouse range dragging on the QCustomPlot widget.

See Also
setRangeZoomAxes
void QCustomPlot::setRangeZoom ( Qt::Orientations  orientations)

Sets which axis orientation may be zoomed by the user with the mouse wheel. What orientation corresponds to which specific axis can be set with setRangeZoomAxes(QCPAxis *horizontal, QCPAxis *vertical). By default, the horizontal axis is the bottom axis (xAxis) and the vertical axis is the left axis (yAxis).

To disable range zooming entirely, pass 0 as orientations or remove iRangeZoom from setInteractions. To enable range zooming for both directions, pass Qt::Horizontal | Qt::Vertical as orientations.

In addition to setting orientations to a non-zero value, make sure setInteractions contains iRangeZoom to enable the range zooming interaction.

See Also
setRangeZoomFactor, setRangeZoomAxes, setRangeDrag
void QCustomPlot::setRangeZoomAxes ( QCPAxis horizontal,
QCPAxis vertical 
)

Sets the axes whose range will be zoomed when setRangeZoom enables mouse wheel zooming on the QCustomPlot widget. The two axes can be zoomed with different strengths, when different factors are passed to setRangeZoomFactor(double horizontalFactor, double verticalFactor).

See Also
setRangeDragAxes
void QCustomPlot::setRangeZoomFactor ( double  horizontalFactor,
double  verticalFactor 
)

Sets how strong one rotation step of the mouse wheel zooms, when range zoom was activated with setRangeZoom. The two parameters horizontalFactor and verticalFactor provide a way to let the horizontal axis zoom at different rates than the vertical axis. Which axis is horizontal and which is vertical, can be set with setRangeZoomAxes.

When the zoom factor is greater than one, scrolling the mouse wheel backwards (towards the user) will zoom in (make the currently visible range smaller). For zoom factors smaller than one, the same scrolling direction will zoom out.

void QCustomPlot::setRangeZoomFactor ( double  factor)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Sets both the horizontal and vertical zoom factor.

void QCustomPlot::setSelectedTitleColor ( const QColor &  color)

This color is used to draw the title, when it is selected.

See Also
setTitleSelected, setTitleColor
void QCustomPlot::setSelectedTitleFont ( const QFont &  font)

This font is used to draw the title, when it is selected.

See Also
setTitleSelected, setTitleFont
void QCustomPlot::setSelectionTolerance ( int  pixels)

Sets the tolerance that is used when deciding whether a click on the QCustomPlot surface selects an object (e.g. a plottable) or not.

If for example the user clicks in the vicinity of the line of a QCPGraph, it's only regarded as a potential selection when the minimum distance between the click position and the graph line is smaller than pixels. Objects that are defined by an area (e.g. QCPBars) only react to clicks directly inside the area and ignore this selection tolerance. In other words it only has meaning for parts of objects that are too thin to exactly hit with a click and thus need such a tolerance.

See Also
setInteractions, QCPAbstractPlottable::selectTest
void QCustomPlot::setTitle ( const QString &  title)

Sets the plot title which will be drawn centered at the top of the widget. The title position is not dependant on the actual position of the axes. However, if setAutoMargin is set to true, the top margin will be adjusted appropriately, so the top axis labels/tick labels will not overlap with the title.

See Also
setTitleFont, setTitleColor
void QCustomPlot::setTitleColor ( const QColor &  color)

Sets the text color of the plot title

See Also
setTitleFont, setTitle
void QCustomPlot::setTitleFont ( const QFont &  font)

Sets the font of the plot title

See Also
setTitleColor, setTitle
void QCustomPlot::setTitleSelected ( bool  selected)

Sets whether the plot title is selected.

See Also
setInteractions, setSelectedTitleFont, setSelectedTitleColor, setTitle
void QCustomPlot::setupFullAxesBox ( )

Convenience function to make the top and right axes visible and assign them the following properties from their corresponding bottom/left axes:

Tick labels (QCPAxis::setTickLabels) however, is always set to false.

This function does not connect the rangeChanged signals of the bottom and left axes to the QCPAxis::setRange slots of the top and right axes in order to synchronize the ranges permanently.

QString QCustomPlot::title ( ) const
inline
void QCustomPlot::titleClick ( QMouseEvent *  event)
signal

This signal is emitted when the plot title is clicked.

event is the mouse event that caused the click.

See Also
titleDoubleClick
QColor QCustomPlot::titleColor ( ) const
inline
void QCustomPlot::titleDoubleClick ( QMouseEvent *  event)
signal

This signal is emitted when the plot title is double clicked.

event is the mouse event that caused the click.

See Also
titleClick
QFont QCustomPlot::titleFont ( ) const
inline
bool QCustomPlot::titleSelected ( ) const
inline
void QCustomPlot::updateAxisRect ( )
protected
QRect QCustomPlot::viewport ( ) const
inline

Returns the viewport rect of this QCustomPlot instance. The viewport is the area the plot is drawn in, all mechanisms, e.g. margin caluclation take the viewport to be the outer border of the plot. The viewport normally is the rect() of the QCustomPlot widget, i.e. a rect with top left (0, 0) and size of the QCustomPlot widget.

Don't confuse the viewport with the axisRect. An axisRect is the rect defined by two axes, where the graphs/plottables are drawn in. The viewport is larger and contains also the axes themselves, their tick numbers, their labels, the plot title etc.

Only when saving to a file (see savePng, savePdf etc.) the viewport is temporarily modified to allow saving plots with sizes independent of the current widget size.

void QCustomPlot::wheelEvent ( QWheelEvent *  event)
protectedvirtual

Friends And Related Function Documentation

friend class QCPAxis
friend
friend class QCPLayer
friend
friend class QCPLegend
friend

Member Data Documentation

QCPLegend* QCustomPlot::legend
QCP::AntialiasedElements QCustomPlot::mAADragBackup
protected
QCP::AntialiasedElements QCustomPlot::mAntialiasedElements
protected
bool QCustomPlot::mAutoAddPlottableToLegend
protected
bool QCustomPlot::mAutoMargin
protected
QPixmap QCustomPlot::mAxisBackground
protected
bool QCustomPlot::mAxisBackgroundScaled
protected
Qt::AspectRatioMode QCustomPlot::mAxisBackgroundScaledMode
protected
QRect QCustomPlot::mAxisRect
protected
QColor QCustomPlot::mColor
protected
QCPLayer* QCustomPlot::mCurrentLayer
protected
bool QCustomPlot::mDragging
protected
QPoint QCustomPlot::mDragStart
protected
QCPRange QCustomPlot::mDragStartHorzRange
protected
QCPRange QCustomPlot::mDragStartVertRange
protected
QList<QCPGraph*> QCustomPlot::mGraphs
protected
Interactions QCustomPlot::mInteractions
protected
QList<QCPAbstractItem*> QCustomPlot::mItems
protected
QList<QCPLayer*> QCustomPlot::mLayers
protected
int QCustomPlot::mMarginBottom
protected
int QCustomPlot::mMarginLeft
protected
int QCustomPlot::mMarginRight
protected
int QCustomPlot::mMarginTop
protected
Qt::KeyboardModifier QCustomPlot::mMultiSelectModifier
protected
bool QCustomPlot::mNoAntialiasingOnDrag
protected
QCP::AntialiasedElements QCustomPlot::mNotAADragBackup
protected
QCP::AntialiasedElements QCustomPlot::mNotAntialiasedElements
protected
QPixmap QCustomPlot::mPaintBuffer
protected
QList<QCPAbstractPlottable*> QCustomPlot::mPlottables
protected
QCP::PlottingHints QCustomPlot::mPlottingHints
protected
Qt::Orientations QCustomPlot::mRangeDrag
protected
QCPAxis* QCustomPlot::mRangeDragHorzAxis
protected
QCPAxis * QCustomPlot::mRangeDragVertAxis
protected
Qt::Orientations QCustomPlot::mRangeZoom
protected
double QCustomPlot::mRangeZoomFactorHorz
protected
double QCustomPlot::mRangeZoomFactorVert
protected
QCPAxis * QCustomPlot::mRangeZoomHorzAxis
protected
QCPAxis * QCustomPlot::mRangeZoomVertAxis
protected
bool QCustomPlot::mReplotting
protected
QPixmap QCustomPlot::mScaledAxisBackground
protected
QColor QCustomPlot::mSelectedTitleColor
protected
QFont QCustomPlot::mSelectedTitleFont
protected
int QCustomPlot::mSelectionTolerance
protected
QString QCustomPlot::mTitle
protected
QRect QCustomPlot::mTitleBoundingBox
protected
QColor QCustomPlot::mTitleColor
protected
QFont QCustomPlot::mTitleFont
protected
bool QCustomPlot::mTitleSelected
protected
QRect QCustomPlot::mViewport
protected
QCPAxis* QCustomPlot::xAxis
QCPAxis * QCustomPlot::xAxis2
QCPAxis * QCustomPlot::yAxis
QCPAxis * QCustomPlot::yAxis2

The documentation for this class was generated from the following files: