| CQCPAbstractItem | The abstract base class for all items in a plot |
| CQCPAbstractLegendItem | The abstract base class for all entries in a QCPLegend |
| CQCPAbstractPaintBuffer | The abstract base class for paint buffers, which define the rendering backend |
| CQCPAbstractPlottable | The abstract base class for all data representing objects in a plot |
| CQCPAbstractPlottable1D | A template base class for plottables with one-dimensional data |
| CQCPAxis | Manages a single axis inside a QCustomPlot |
| CQCPAxisRect | Holds multiple axes and arranges them in a rectangular shape |
| CQCPAxisTicker | The base class tick generator used by QCPAxis to create tick positions and tick labels |
| CQCPAxisTickerDateTime | Specialized axis ticker for calendar dates and times as axis ticks |
| CQCPAxisTickerFixed | Specialized axis ticker with a fixed tick step |
| CQCPAxisTickerLog | Specialized axis ticker suited for logarithmic axes |
| CQCPAxisTickerPi | Specialized axis ticker to display ticks in units of an arbitrary constant, for example pi |
| CQCPAxisTickerText | Specialized axis ticker which allows arbitrary labels at specified coordinates |
| CQCPAxisTickerTime | Specialized axis ticker for time spans in units of milliseconds to days |
| CQCPBars | A plottable representing a bar chart in a plot |
| CQCPBarsData | Holds the data of one single data point (one bar) for QCPBars |
| CQCPBarsGroup | Groups multiple QCPBars together so they appear side by side |
| CQCPColorGradient | Defines a color gradient for use with e.g. QCPColorMap |
| CQCPColorMap | A plottable representing a two-dimensional color map in a plot |
| CQCPColorMapData | Holds the two-dimensional data of a QCPColorMap plottable |
| CQCPColorScale | A color scale for use with color coding data such as QCPColorMap |
| CQCPCurve | A plottable representing a parametric curve in a plot |
| CQCPCurveData | Holds the data of one single data point for QCPCurve |
| CQCPDataContainer | The generic data container for one-dimensional plottables |
| CQCPDataRange | Describes a data range given by begin and end index |
| CQCPDataSelection | Describes a data set by holding multiple QCPDataRange instances |
| CQCPErrorBars | A plottable that adds a set of error bars to other plottables |
| CQCPErrorBarsData | Holds the data of one single error bar for QCPErrorBars |
| CQCPFinancial | A plottable representing a financial stock chart |
| CQCPFinancialData | Holds the data of one single data point for QCPFinancial |
| CQCPGraph | A plottable representing a graph in a plot |
| CQCPGraphData | Holds the data of one single data point for QCPGraph |
| CQCPGrid | Responsible for drawing the grid of a QCPAxis |
| CQCPItemAnchor | An anchor of an item to which positions can be attached to |
| CQCPItemBracket | A bracket for referencing/highlighting certain parts in the plot |
| CQCPItemCurve | A curved line from one point to another |
| CQCPItemEllipse | An ellipse |
| CQCPItemLine | A line from one point to another |
| CQCPItemPixmap | An arbitrary pixmap |
| CQCPItemPosition | Manages the position of an item |
| CQCPItemRect | A rectangle |
| CQCPItemStraightLine | A straight line that spans infinitely in both directions |
| CQCPItemText | A text label |
| CQCPItemTracer | Item that sticks to QCPGraph data points |
| CQCPLayer | A layer that may contain objects, to control the rendering order |
| CQCPLayerable | Base class for all drawable objects |
| CQCPLayout | The abstract base class for layouts |
| CQCPLayoutElement | The abstract base class for all objects that form the layout system |
| CQCPLayoutGrid | A layout that arranges child elements in a grid |
| CQCPLayoutInset | A layout that places child elements aligned to the border or arbitrarily positioned |
| CQCPLegend | Manages a legend inside a QCustomPlot |
| CQCPLineEnding | Handles the different ending decorations for line-like items |
| CQCPMarginGroup | A margin group allows synchronization of margin sides if working with multiple layout elements |
| CQCPPaintBufferGlFbo | A paint buffer based on OpenGL frame buffers objects, using hardware accelerated rendering |
| CQCPPaintBufferGlPbuffer | A paint buffer based on OpenGL pixel buffers, using hardware accelerated rendering |
| CQCPPaintBufferPixmap | A paint buffer based on QPixmap, using software raster rendering |
| CQCPPainter | QPainter subclass used internally |
| CQCPPlottableInterface1D | Defines an abstract interface for one-dimensional plottables |
| CQCPPlottableLegendItem | A legend item representing a plottable with an icon and the plottable name |
| CQCPRange | Represents the range an axis is encompassing |
| CQCPScatterStyle | Represents the visual appearance of scatter points |
| CQCPSelectionDecorator | Controls how a plottable's data selection is drawn |
| CQCPSelectionDecoratorBracket | A selection decorator which draws brackets around each selected data segment |
| CQCPSelectionRect | Provides rect/rubber-band data selection and range zoom interaction |
| CQCPStatisticalBox | A plottable representing a single statistical box in a plot |
| CQCPStatisticalBoxData | Holds the data of one single data point for QCPStatisticalBox |
| CQCPTextElement | A layout element displaying a text |
| CQCPVector2D | Represents two doubles as a mathematical 2D vector |
| CQCustomPlot | The central class of the library. This is the QWidget which displays the plot and interacts with the user |
The abstract base class for all items in a plot. + More...
+
+Public Functions | |
| QCPAbstractItem (QCustomPlot *parentPlot) | |
| +bool | clipToAxisRect () const |
| +QCPAxisRect * | clipAxisRect () const |
| +bool | selectable () const |
| +bool | selected () const |
| void | setClipToAxisRect (bool clip) |
| void | setClipAxisRect (QCPAxisRect *rect) |
| Q_SLOT void | setSelectable (bool selectable) |
| Q_SLOT void | setSelected (bool selected) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const =0 |
| QList< QCPItemPosition * > | positions () const |
| QList< QCPItemAnchor * > | anchors () const |
| QCPItemPosition * | position (const QString &name) const |
| QCPItemAnchor * | anchor (const QString &name) const |
| bool | hasAnchor (const QString &name) const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Signals | |
| void | selectionChanged (bool selected) |
| +void | selectableChanged (bool selectable) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
+Protected Functions | |
| virtual QCP::Interaction | selectionCategory () const |
| virtual QRect | clipRect () const |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | draw (QCPPainter *painter)=0 |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| virtual QPointF | anchorPixelPosition (int anchorId) const |
| double | rectDistance (const QRectF &rect, const QPointF &pos, bool filledRect) const |
| QCPItemPosition * | createPosition (const QString &name) |
| QCPItemAnchor * | createAnchor (const QString &name, int anchorId) |
Protected Functions inherited from QCPLayerable | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
The abstract base class for all items in a plot.
+In QCustomPlot, items are supplemental graphical elements that are neither plottables (QCPAbstractPlottable) nor axes (QCPAxis). While plottables are always tied to two axes and thus plot coordinates, items can also be placed in absolute coordinates independent of any axes. Each specific item has at least one QCPItemPosition member which controls the positioning. Some items are defined by more than one coordinate and thus have two or more QCPItemPosition members (For example, QCPItemRect has topLeft and bottomRight).
+This abstract base class defines a very basic interface like visibility and clipping. Since this class is abstract, it can't be instantiated. Use one of the subclasses or create a subclass yourself to create new items.
+The built-in items are:
| QCPItemLine | A line defined by a start and an end point. May have different ending styles on each side (e.g. arrows). |
| QCPItemStraightLine | A straight line defined by a start and a direction point. Unlike QCPItemLine, the straight line is infinitely long and has no endings. |
| QCPItemCurve | A curve defined by start, end and two intermediate control points. May have different ending styles on each side (e.g. arrows). |
| QCPItemRect | A rectangle |
| QCPItemEllipse | An ellipse |
| QCPItemPixmap | An arbitrary pixmap |
| QCPItemText | A text label |
| QCPItemBracket | A bracket which may be used to reference/highlight certain parts in the plot. |
| QCPItemTracer | An item that can be attached to a QCPGraph and sticks to its data points, given a key coordinate. |
Items are by default clipped to the main axis rect (they are only visible inside the axis rect). To make an item visible outside that axis rect, disable clipping via setClipToAxisRect(false).
+On the other hand if you want the item to be clipped to a different axis rect, specify it via setClipAxisRect. This clipAxisRect property of an item is only used for clipping behaviour, and in principle is independent of the coordinate axes the item might be tied to via its position members (QCPItemPosition::setAxes). However, it is common that the axis rect for clipping also contains the axes used for the item positions.
+First you instantiate the item you want to use and add it to the plot:
by default, the positions of the item are bound to the x- and y-Axis of the plot. So we can just set the plot coordinates where the line should start/end:
If we don't want the line to be positioned in plot coordinates but a different coordinate system, e.g. absolute pixel positions on the QCustomPlot surface, we need to change the position type like this:
Then we can set the coordinates, this time in pixels:
and make the line visible on the entire QCustomPlot, by disabling clipping to the axis rect:
For more advanced plots, it is even possible to set different types and parent anchors per X/Y coordinate of an item position, using for example QCPItemPosition::setTypeX or QCPItemPosition::setParentAnchorX. For details, see the documentation of QCPItemPosition.
+To create an own item, you implement a subclass of QCPAbstractItem. These are the pure virtual functions, you must implement:
See the documentation of those functions for what they need to do.
+As mentioned, item positions are represented by QCPItemPosition members. Let's assume the new item shall have only one point as its position (as opposed to two like a rect or multiple like a polygon). You then add a public member of type QCPItemPosition like so:
+the const makes sure the pointer itself can't be modified from the user of your new item (the QCPItemPosition instance it points to, can be modified, of course). The initialization of this pointer is made easy with the createPosition function. Just assign the return value of this function to each QCPItemPosition in the constructor of your item. createPosition takes a string which is the name of the position, typically this is identical to the variable name. For example, the constructor of QCPItemExample could look like this:
+To give your item a visual representation, reimplement the draw function and use the passed QCPPainter to draw the item. You can retrieve the item position in pixel coordinates from the position member(s) via QCPItemPosition::pixelPosition.
+To optimize performance you should calculate a bounding rect first (don't forget to take the pen width into account), check whether it intersects the clipRect, and only draw the item at all if this is the case.
+Your implementation of the selectTest function may use the helpers QCPVector2D::distanceSquaredToLine and rectDistance. With these, the implementation of the selection test becomes significantly simpler for most items. See the documentation of selectTest for what the function parameters mean and what the function should return.
+Providing anchors (QCPItemAnchor) starts off like adding a position. First you create a public member, e.g.
+and create it in the constructor with the createAnchor function, assigning it a name and an anchor id (an integer enumerating all anchors on the item, you may create an own enum for this). Since anchors can be placed anywhere, relative to the item's position(s), your item needs to provide the position of every anchor with the reimplementation of the anchorPixelPosition(int anchorId) function.
+In essence the QCPItemAnchor is merely an intermediary that itself asks your item for the pixel position when anything attached to the anchor needs to know the coordinates.
+
+
|
+ +explicit | +
Base class constructor which initializes base class members.
+ +| void QCPAbstractItem::setClipToAxisRect | +( | +bool | +clip | ) | ++ |
Sets whether the item shall be clipped to an axis rect or whether it shall be visible on the entire QCustomPlot. The axis rect can be set with setClipAxisRect.
+| void QCPAbstractItem::setClipAxisRect | +( | +QCPAxisRect * | +rect | ) | ++ |
Sets the clip axis rect. It defines the rect that will be used to clip the item when setClipToAxisRect is set to true.
+| void QCPAbstractItem::setSelectable | +( | +bool | +selectable | ) | ++ |
Sets whether the user can (de-)select this item by clicking on the QCustomPlot surface. (When QCustomPlot::setInteractions contains QCustomPlot::iSelectItems.)
+However, even when selectable was set to false, it is possible to set the selection manually, by calling setSelected.
+| void QCPAbstractItem::setSelected | +( | +bool | +selected | ) | ++ |
Sets whether this item is selected or not. When selected, it might use a different visual appearance (e.g. pen and brush), this depends on the specific item though.
+The entire selection mechanism for items is handled automatically when QCustomPlot::setInteractions contains QCustomPlot::iSelectItems. You only need to call this function when you wish to change the selection state manually.
+This function can change the selection state even when setSelectable was set to false.
+emits the selectionChanged signal when selected is different from the previous selection state.
+
+
|
+ +pure virtual | +
This function is used to decide whether a click hits a layerable object or not.
+pos is a point in pixel coordinates on the QCustomPlot surface. This function returns the shortest pixel distance of this point to the object. If the object is either invisible or the distance couldn't be determined, -1.0 is returned. Further, if onlySelectable is true and the object is not selectable, -1.0 is returned, too.
+If the object is represented not by single lines but by an area like a QCPItemText or the bars of a QCPBars plottable, a click inside the area should also be considered a hit. In these cases this function thus returns a constant value greater zero but still below the parent plot's selection tolerance. (typically the selectionTolerance multiplied by 0.99).
+Providing a constant value for area objects allows selecting line objects even when they are obscured by such area objects, by clicking close to the lines (i.e. closer than 0.99*selectionTolerance).
+The actual setting of the selection state is not done by this function. This is handled by the parent QCustomPlot when the mouseReleaseEvent occurs, and the finally selected object is notified via the selectEvent/deselectEvent methods.
+details is an optional output parameter. Every layerable subclass may place any information in details. This information will be passed to selectEvent when the parent QCustomPlot decides on the basis of this selectTest call, that the object was successfully selected. The subsequent call to selectEvent will carry the details. This is useful for multi-part objects (like QCPAxis). This way, a possibly complex calculation to decide which part was clicked is only done once in selectTest. The result (i.e. the actually clicked part) can then be placed in details. So in the subsequent selectEvent, the decision which part was selected doesn't have to be done a second time for a single selection operation.
+In the case of 1D Plottables (QCPAbstractPlottable1D, like QCPGraph or QCPBars) details will be set to a QCPDataSelection, describing the closest data point to pos.
+You may pass 0 as details to indicate that you are not interested in those selection details.
+Reimplemented from QCPLayerable.
+ +Implemented in QCPItemTracer, QCPItemText, QCPItemBracket, QCPItemPixmap, QCPItemCurve, QCPItemLine, QCPItemEllipse, QCPItemRect, and QCPItemStraightLine.
+ +
+
|
+ +inline | +
+
|
+ +inline | +
Returns all anchors of the item in a list. Note that since a position (QCPItemPosition) is always also an anchor, the list will also contain the positions of this item.
+ + +| QCPItemPosition * QCPAbstractItem::position | +( | +const QString & | +name | ) | +const | +
Returns the QCPItemPosition with the specified name. If this item doesn't have a position by that name, returns 0.
+This function provides an alternative way to access item positions. Normally, you access positions direcly by their member pointers (which typically have the same variable name as name).
+ + +| QCPItemAnchor * QCPAbstractItem::anchor | +( | +const QString & | +name | ) | +const | +
Returns the QCPItemAnchor with the specified name. If this item doesn't have an anchor by that name, returns 0.
+This function provides an alternative way to access item anchors. Normally, you access anchors direcly by their member pointers (which typically have the same variable name as name).
+ + +| bool QCPAbstractItem::hasAnchor | +( | +const QString & | +name | ) | +const | +
Returns whether this item has an anchor with the specified name.
+Note that you can check for positions with this function, too. This is because every position is also an anchor (QCPItemPosition inherits from QCPItemAnchor).
+ + +
+
|
+ +signal | +
This signal is emitted when the selection state of this item has changed, either by user interaction or by a direct call to setSelected.
+ +
+
|
+ +protectedvirtual | +
Returns the selection category this layerable shall belong to. The selection category is used in conjunction with QCustomPlot::setInteractions to control which objects are selectable and which aren't.
+Subclasses that don't fit any of the normal QCP::Interaction values can use QCP::iSelectOther. This is what the default implementation returns.
+Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
Returns the rect the visual representation of this item is clipped to. This depends on the current setting of setClipToAxisRect as well as the axis rect set with setClipAxisRect.
+If the item is not clipped to an axis rect, QCustomPlot's viewport rect is returned.
+Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
A convenience function to easily set the QPainter::Antialiased hint on the provided painter before drawing item lines.
+This is the antialiasing state the painter passed to the draw method is in by default.
+This function takes into account the local setting of the antialiasing flag as well as the overrides set with QCustomPlot::setAntialiasedElements and QCustomPlot::setNotAntialiasedElements.
+Implements QCPLayerable.
+ +
+
|
+ +protectedpure virtual | +
Draws this item with the provided painter.
+The cliprect of the provided painter is set to the rect returned by clipRect before this function is called. The clipRect depends on the clipping settings defined by setClipToAxisRect and setClipAxisRect.
+ +Implements QCPLayerable.
+ +Implemented in QCPItemText, QCPItemTracer, QCPItemPixmap, QCPItemBracket, QCPItemEllipse, QCPItemRect, QCPItemCurve, QCPItemLine, and QCPItemStraightLine.
+ +
+
|
+ +protectedvirtual | +
This event is called when the layerable shall be selected, as a consequence of a click by the user. Subclasses should react to it by setting their selection state appropriately. The default implementation does nothing.
+event is the mouse event that caused the selection. additive indicates, whether the user was holding the multi-select-modifier while performing the selection (see QCustomPlot::setMultiSelectModifier). if additive is true, the selection state must be toggled (i.e. become selected when unselected and unselected when selected).
+Every selectEvent is preceded by a call to selectTest, which has returned positively (i.e. returned a value greater than 0 and less than the selection tolerance of the parent QCustomPlot). The details data you output from selectTest is fed back via details here. You may use it to transport any kind of information from the selectTest to the possibly subsequent selectEvent. Usually details is used to transfer which part was clicked, if it is a layerable that has multiple individually selectable parts (like QCPAxis). This way selectEvent doesn't need to do the calculation again to find out which part was actually clicked.
+selectionStateChanged is an output parameter. If the pointer is non-null, this function must set the value either to true or false, depending on whether the selection state of this layerable was actually changed. For layerables that only are selectable as a whole and not in parts, this is simple: if additive is true, selectionStateChanged must also be set to true, because the selection toggles. If additive is false, selectionStateChanged is only set to true, if the layerable was previously unselected and now is switched to the selected state.
+Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
This event is called when the layerable shall be deselected, either as consequence of a user interaction or a call to QCustomPlot::deselectAll. Subclasses should react to it by unsetting their selection appropriately.
+just as in selectEvent, the output parameter selectionStateChanged (if non-null), must return true or false when the selection state of this layerable has changed or not changed, respectively.
+Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
Returns the pixel position of the anchor with Id anchorId. This function must be reimplemented in item subclasses if they want to provide anchors (QCPItemAnchor).
+For example, if the item has two anchors with id 0 and 1, this function takes one of these anchor ids and returns the respective pixel points of the specified anchor.
+Reimplemented in QCPItemText, QCPItemPixmap, QCPItemBracket, QCPItemEllipse, and QCPItemRect.
+ +
+
|
+ +protected | +
A convenience function which returns the selectTest value for a specified rect and a specified click position pos. filledRect defines whether a click inside the rect should also be considered a hit or whether only the rect border is sensitive to hits.
+This function may be used to help with the implementation of the selectTest function for specific items.
+For example, if your item consists of four rects, call this function four times, once for each rect, in your selectTest reimplementation. Finally, return the minimum (non -1) of all four returned values.
+ +
+
|
+ +protected | +
Creates a QCPItemPosition, registers it with this item and returns a pointer to it. The specified name must be a unique string that is usually identical to the variable name of the position member (This is needed to provide the name-based position access to positions).
+Don't delete positions created by this function manually, as the item will take care of it.
+Use this function in the constructor (initialization list) of the specific item subclass to create each position member. Don't create QCPItemPositions with new yourself, because they won't be registered with the item properly.
+
+
|
+ +protected | +
Creates a QCPItemAnchor, registers it with this item and returns a pointer to it. The specified name must be a unique string that is usually identical to the variable name of the anchor member (This is needed to provide the name based anchor access to anchors).
+The anchorId must be a number identifying the created anchor. It is recommended to create an enum (e.g. "AnchorIndex") for this on each item that uses anchors. This id is used by the anchor to identify itself when it calls QCPAbstractItem::anchorPixelPosition. That function then returns the correct pixel coordinates for the passed anchor id.
+Don't delete anchors created by this function manually, as the item will take care of it.
+Use this function in the constructor (initialization list) of the specific item subclass to create each anchor member. Don't create QCPItemAnchors with new yourself, because then they won't be registered with the item properly.
+The abstract base class for all entries in a QCPLegend. + More...
+
+Public Functions | |
| QCPAbstractLegendItem (QCPLegend *parent) | |
| +QCPLegend * | parentLegend () const |
| +QFont | font () const |
| +QColor | textColor () const |
| +QFont | selectedFont () const |
| +QColor | selectedTextColor () const |
| +bool | selectable () const |
| +bool | selected () const |
| void | setFont (const QFont &font) |
| void | setTextColor (const QColor &color) |
| void | setSelectedFont (const QFont &font) |
| void | setSelectedTextColor (const QColor &color) |
| Q_SLOT void | setSelectable (bool selectable) |
| Q_SLOT void | setSelected (bool selected) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
Public Functions inherited from QCPLayoutElement | |
| QCPLayoutElement (QCustomPlot *parentPlot=0) | |
| QCPLayout * | layout () const |
| QRect | rect () const |
| QRect | outerRect () const |
| +QMargins | margins () const |
| +QMargins | minimumMargins () const |
| +QCP::MarginSides | autoMargins () const |
| +QSize | minimumSize () const |
| +QSize | maximumSize () const |
| +SizeConstraintRect | sizeConstraintRect () const |
| +QCPMarginGroup * | marginGroup (QCP::MarginSide side) const |
| +QHash< QCP::MarginSide, QCPMarginGroup * > | marginGroups () const |
| void | setOuterRect (const QRect &rect) |
| void | setMargins (const QMargins &margins) |
| void | setMinimumMargins (const QMargins &margins) |
| void | setAutoMargins (QCP::MarginSides sides) |
| void | setMinimumSize (const QSize &size) |
| void | setMinimumSize (int width, int height) |
| void | setMaximumSize (const QSize &size) |
| void | setMaximumSize (int width, int height) |
| void | setSizeConstraintRect (SizeConstraintRect constraintRect) |
| void | setMarginGroup (QCP::MarginSides sides, QCPMarginGroup *group) |
| virtual void | update (UpdatePhase phase) |
| virtual QSize | minimumOuterSizeHint () const |
| virtual QSize | maximumOuterSizeHint () const |
| virtual QList< QCPLayoutElement * > | elements (bool recursive) const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Signals | |
| void | selectionChanged (bool selected) |
| +void | selectableChanged (bool selectable) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
+Protected Functions | |
| virtual QCP::Interaction | selectionCategory () const |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual QRect | clipRect () const |
| virtual void | draw (QCPPainter *painter)=0 |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
Protected Functions inherited from QCPLayoutElement | |
| virtual int | calculateAutoMargin (QCP::MarginSide side) |
| virtual void | layoutChanged () |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
Protected Functions inherited from QCPLayerable | |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Additional Inherited Members | |
Public Types inherited from QCPLayoutElement | |
| enum | UpdatePhase |
| enum | SizeConstraintRect |
The abstract base class for all entries in a QCPLegend.
+It defines a very basic interface for entries in a QCPLegend. For representing plottables in the legend, the subclass QCPPlottableLegendItem is more suitable.
+Only derive directly from this class when you need absolute freedom (e.g. a custom legend entry that's not even associated with a plottable).
+You must implement the following pure virtual functions:
You inherit the following members you may use:
| QCPLegend *mParentLegend | A pointer to the parent QCPLegend. |
| QFont mFont | The generic font of the item. You should use this font for all or at least the most prominent text of the item. |
+
|
+ +explicit | +
Constructs a QCPAbstractLegendItem and associates it with the QCPLegend parent. This does not cause the item to be added to parent, so QCPLegend::addItem must be called separately.
+ +| void QCPAbstractLegendItem::setFont | +( | +const QFont & | +font | ) | ++ |
Sets the default font of this specific legend item to font.
+| void QCPAbstractLegendItem::setTextColor | +( | +const QColor & | +color | ) | ++ |
Sets the default text color of this specific legend item to color.
+| void QCPAbstractLegendItem::setSelectedFont | +( | +const QFont & | +font | ) | ++ |
When this legend item is selected, font is used to draw generic text, instead of the normal font set with setFont.
+| void QCPAbstractLegendItem::setSelectedTextColor | +( | +const QColor & | +color | ) | ++ |
When this legend item is selected, color is used to draw generic text, instead of the normal color set with setTextColor.
+ + +| void QCPAbstractLegendItem::setSelectable | +( | +bool | +selectable | ) | ++ |
Sets whether this specific legend item is selectable.
+| void QCPAbstractLegendItem::setSelected | +( | +bool | +selected | ) | ++ |
Sets whether this specific legend item is selected.
+It is possible to set the selection state of this item by calling this function directly, even if setSelectable is set to false.
+
+
|
+ +virtual | +
Layout elements are sensitive to events inside their outer rect. If pos is within the outer rect, this method returns a value corresponding to 0.99 times the parent plot's selection tolerance. However, layout elements are not selectable by default. So if onlySelectable is true, -1.0 is returned.
+See QCPLayerable::selectTest for a general explanation of this virtual method.
+QCPLayoutElement subclasses may reimplement this method to provide more specific selection test behaviour.
+ +Reimplemented from QCPLayoutElement.
+ +
+
|
+ +signal | +
This signal is emitted when the selection state of this legend item has changed, either by user interaction or by a direct call to setSelected.
+ +
+
|
+ +protectedvirtual | +
Returns the selection category this layerable shall belong to. The selection category is used in conjunction with QCustomPlot::setInteractions to control which objects are selectable and which aren't.
+Subclasses that don't fit any of the normal QCP::Interaction values can use QCP::iSelectOther. This is what the default implementation returns.
+Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
This function applies the default antialiasing setting to the specified painter, using the function applyAntialiasingHint. It is the antialiasing state the painter is put in, when draw is called on the layerable. If the layerable has multiple entities whose antialiasing setting may be specified individually, this function should set the antialiasing state of the most prominent entity. In this case however, the draw function usually calls the specialized versions of this function before drawing each entity, effectively overriding the setting of the default antialiasing hint.
+First example: QCPGraph has multiple entities that have an antialiasing setting: The graph line, fills and scatters. Those can be configured via QCPGraph::setAntialiased, QCPGraph::setAntialiasedFill and QCPGraph::setAntialiasedScatters. Consequently, there isn't only the QCPGraph::applyDefaultAntialiasingHint function (which corresponds to the graph line's antialiasing), but specialized ones like QCPGraph::applyFillAntialiasingHint and QCPGraph::applyScattersAntialiasingHint. So before drawing one of those entities, QCPGraph::draw calls the respective specialized applyAntialiasingHint function.
+Second example: QCPItemLine consists only of a line so there is only one antialiasing setting which can be controlled with QCPItemLine::setAntialiased. (This function is inherited by all layerables. The specialized functions, as seen on QCPGraph, must be added explicitly to the respective layerable subclass.) Consequently it only has the normal QCPItemLine::applyDefaultAntialiasingHint. The QCPItemLine::draw function doesn't need to care about setting any antialiasing states, because the default antialiasing hint is already set on the painter when the draw function is called, and that's the state it wants to draw the line with.
+ +Reimplemented from QCPLayoutElement.
+ +
+
|
+ +protectedvirtual | +
Returns the clipping rectangle of this layerable object. By default, this is the viewport of the parent QCustomPlot. Specific subclasses may reimplement this function to provide different clipping rects.
+The returned clipping rect is set on the painter before the draw function of the respective object is called.
+ +Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedpure virtual | +
This function draws the layerable with the specified painter. It is only called by QCustomPlot, if the layerable is visible (setVisible).
+Before this function is called, the painter's antialiasing state is set via applyDefaultAntialiasingHint, see the documentation there. Further, the clipping rectangle was set to clipRect.
+ +Reimplemented from QCPLayoutElement.
+ +Implemented in QCPPlottableLegendItem.
+ +
+
|
+ +protectedvirtual | +
This event is called when the layerable shall be selected, as a consequence of a click by the user. Subclasses should react to it by setting their selection state appropriately. The default implementation does nothing.
+event is the mouse event that caused the selection. additive indicates, whether the user was holding the multi-select-modifier while performing the selection (see QCustomPlot::setMultiSelectModifier). if additive is true, the selection state must be toggled (i.e. become selected when unselected and unselected when selected).
+Every selectEvent is preceded by a call to selectTest, which has returned positively (i.e. returned a value greater than 0 and less than the selection tolerance of the parent QCustomPlot). The details data you output from selectTest is fed back via details here. You may use it to transport any kind of information from the selectTest to the possibly subsequent selectEvent. Usually details is used to transfer which part was clicked, if it is a layerable that has multiple individually selectable parts (like QCPAxis). This way selectEvent doesn't need to do the calculation again to find out which part was actually clicked.
+selectionStateChanged is an output parameter. If the pointer is non-null, this function must set the value either to true or false, depending on whether the selection state of this layerable was actually changed. For layerables that only are selectable as a whole and not in parts, this is simple: if additive is true, selectionStateChanged must also be set to true, because the selection toggles. If additive is false, selectionStateChanged is only set to true, if the layerable was previously unselected and now is switched to the selected state.
+Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
This event is called when the layerable shall be deselected, either as consequence of a user interaction or a call to QCustomPlot::deselectAll. Subclasses should react to it by unsetting their selection appropriately.
+just as in selectEvent, the output parameter selectionStateChanged (if non-null), must return true or false when the selection state of this layerable has changed or not changed, respectively.
+Reimplemented from QCPLayerable.
+ +The abstract base class for paint buffers, which define the rendering backend. + More...
+
+Public Functions | |
| QCPAbstractPaintBuffer (const QSize &size, double devicePixelRatio) | |
| +QSize | size () const |
| +bool | invalidated () const |
| +double | devicePixelRatio () const |
| void | setSize (const QSize &size) |
| void | setInvalidated (bool invalidated=true) |
| void | setDevicePixelRatio (double ratio) |
| virtual QCPPainter * | startPainting ()=0 |
| virtual void | donePainting () |
| virtual void | draw (QCPPainter *painter) const =0 |
| virtual void | clear (const QColor &color)=0 |
+Protected Functions | |
| virtual void | reallocateBuffer ()=0 |
The abstract base class for paint buffers, which define the rendering backend.
+This abstract base class defines the basic interface that a paint buffer needs to provide in order to be usable by QCustomPlot.
+A paint buffer manages both a surface to draw onto, and the matching paint device. The size of the surface can be changed via setSize. External classes (QCustomPlot and QCPLayer) request a painter via startPainting and then perform the draw calls. Once the painting is complete, donePainting is called, so the paint buffer implementation can do clean up if necessary. Before rendering a frame, each paint buffer is usually filled with a color using clear (usually the color is Qt::transparent), to remove the contents of the previous frame.
The simplest paint buffer implementation is QCPPaintBufferPixmap which allows regular software rendering via the raster engine. Hardware accelerated rendering via pixel buffers and frame buffer objects is provided by QCPPaintBufferGlPbuffer and QCPPaintBufferGlFbo. They are used automatically if QCustomPlot::setOpenGl is enabled.
+
+
|
+ +explicit | +
Creates a paint buffer and initializes it with the provided size and devicePixelRatio.
+Subclasses must call their reallocateBuffer implementation in their respective constructors.
+ +| void QCPAbstractPaintBuffer::setSize | +( | +const QSize & | +size | ) | ++ |
Sets the paint buffer size.
+The buffer is reallocated (by calling reallocateBuffer), so any painters that were obtained by startPainting are invalidated and must not be used after calling this method.
+If size is already the current buffer size, this method does nothing.
+ +| void QCPAbstractPaintBuffer::setInvalidated | +( | +bool | +invalidated = true | ) | ++ |
Sets the invalidated flag to invalidated.
+This mechanism is used internally in conjunction with isolated replotting of QCPLayer instances (in QCPLayer::lmBuffered mode). If QCPLayer::replot is called on a buffered layer, i.e. an isolated repaint of only that layer (and its dedicated paint buffer) is requested, QCustomPlot will decide depending on the invalidated flags of other paint buffers whether it also replots them, instead of only the layer on which the replot was called.
+The invalidated flag is set to true when QCPLayer association has changed, i.e. if layers were added or removed from this buffer, or if they were reordered. It is set to false as soon as all associated QCPLayer instances are drawn onto the buffer.
+Under normal circumstances, it is not necessary to manually call this method.
+ +| void QCPAbstractPaintBuffer::setDevicePixelRatio | +( | +double | +ratio | ) | ++ |
Sets the the device pixel ratio to ratio. This is useful to render on high-DPI output devices. The ratio is automatically set to the device pixel ratio used by the parent QCustomPlot instance.
+The buffer is reallocated (by calling reallocateBuffer), so any painters that were obtained by startPainting are invalidated and must not be used after calling this method.
+
+
|
+ +pure virtual | +
Returns a QCPPainter which is ready to draw to this buffer. The ownership and thus the responsibility to delete the painter after the painting operations are complete is given to the caller of this method.
+Once you are done using the painter, delete the painter and call donePainting.
+While a painter generated with this method is active, you must not call setSize, setDevicePixelRatio or clear.
+This method may return 0, if a painter couldn't be activated on the buffer. This usually indicates a problem with the respective painting backend.
+ +Implemented in QCPPaintBufferGlFbo, QCPPaintBufferGlPbuffer, and QCPPaintBufferPixmap.
+ +
+
|
+ +inlinevirtual | +
If you have acquired a QCPPainter to paint onto this paint buffer via startPainting, call this method as soon as you are done with the painting operations and have deleted the painter.
+paint buffer subclasses may use this method to perform any type of cleanup that is necessary. The default implementation does nothing.
+ +Reimplemented in QCPPaintBufferGlFbo.
+ +
+
|
+ +pure virtual | +
Draws the contents of this buffer with the provided painter. This is the method that is used to finally join all paint buffers and draw them onto the screen.
+ +Implemented in QCPPaintBufferGlFbo, QCPPaintBufferGlPbuffer, and QCPPaintBufferPixmap.
+ +
+
|
+ +pure virtual | +
Fills the entire buffer with the provided color. To have an empty transparent buffer, use the named color Qt::transparent.
This method must not be called if there is currently a painter (acquired with startPainting) active.
+ +Implemented in QCPPaintBufferGlFbo, QCPPaintBufferGlPbuffer, and QCPPaintBufferPixmap.
+ +
+
|
+ +protectedpure virtual | +
Reallocates the internal buffer with the currently configured size (setSize) and device pixel ratio, if applicable (setDevicePixelRatio). It is called as soon as any of those properties are changed on this paint buffer.
+Implemented in QCPPaintBufferGlFbo, QCPPaintBufferGlPbuffer, and QCPPaintBufferPixmap.
+ +The abstract base class for all data representing objects in a plot. + More...
+
+Public Functions | |
| QCPAbstractPlottable (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
| +QString | name () const |
| +bool | antialiasedFill () const |
| +bool | antialiasedScatters () const |
| +QPen | pen () const |
| +QBrush | brush () const |
| +QCPAxis * | keyAxis () const |
| +QCPAxis * | valueAxis () const |
| +QCP::SelectionType | selectable () const |
| bool | selected () const |
| QCPDataSelection | selection () const |
| QCPSelectionDecorator * | selectionDecorator () const |
| void | setName (const QString &name) |
| void | setAntialiasedFill (bool enabled) |
| void | setAntialiasedScatters (bool enabled) |
| void | setPen (const QPen &pen) |
| void | setBrush (const QBrush &brush) |
| void | setKeyAxis (QCPAxis *axis) |
| void | setValueAxis (QCPAxis *axis) |
| Q_SLOT void | setSelectable (QCP::SelectionType selectable) |
| Q_SLOT void | setSelection (QCPDataSelection selection) |
| void | setSelectionDecorator (QCPSelectionDecorator *decorator) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const =0 |
| virtual QCPPlottableInterface1D * | interface1D () |
| virtual QCPRange | getKeyRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const =0 |
| virtual QCPRange | getValueRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const =0 |
| void | coordsToPixels (double key, double value, double &x, double &y) const |
| const QPointF | coordsToPixels (double key, double value) const |
| void | pixelsToCoords (double x, double y, double &key, double &value) const |
| void | pixelsToCoords (const QPointF &pixelPos, double &key, double &value) const |
| void | rescaleAxes (bool onlyEnlarge=false) const |
| void | rescaleKeyAxis (bool onlyEnlarge=false) const |
| void | rescaleValueAxis (bool onlyEnlarge=false, bool inKeyRange=false) const |
| bool | addToLegend (QCPLegend *legend) |
| bool | addToLegend () |
| bool | removeFromLegend (QCPLegend *legend) const |
| bool | removeFromLegend () const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Signals | |
| void | selectionChanged (bool selected) |
| void | selectionChanged (const QCPDataSelection &selection) |
| void | selectableChanged (QCP::SelectionType selectable) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
+Protected Functions | |
| virtual QRect | clipRect () const |
| virtual void | draw (QCPPainter *painter)=0 |
| virtual QCP::Interaction | selectionCategory () const |
| void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| virtual void | drawLegendIcon (QCPPainter *painter, const QRectF &rect) const =0 |
| void | applyFillAntialiasingHint (QCPPainter *painter) const |
| void | applyScattersAntialiasingHint (QCPPainter *painter) const |
Protected Functions inherited from QCPLayerable | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
The abstract base class for all data representing objects in a plot.
+It defines a very basic interface like name, pen, brush, visibility etc. Since this class is abstract, it can't be instantiated. Use one of the subclasses or create a subclass yourself to create new ways of displaying data (see "Creating own plottables" below). Plottables that display one-dimensional data (i.e. data points have a single key dimension and one or multiple values at each key) are based off of the template subclass QCPAbstractPlottable1D, see details there.
+All further specifics are in the subclasses, for example:
Subclassing directly from QCPAbstractPlottable is only recommended if you wish to display two-dimensional data like QCPColorMap, i.e. two logical key dimensions and one (or more) data dimensions. If you want to display data with only one logical key dimension, you should rather derive from QCPAbstractPlottable1D.
+If subclassing QCPAbstractPlottable directly, these are the pure virtual functions you must implement:
+See the documentation of those functions for what they need to do.
+For drawing your plot, you can use the coordsToPixels functions to translate a point in plot coordinates to pixel coordinates. This function is quite convenient, because it takes the orientation of the key and value axes into account for you (x and y are swapped when the key axis is vertical and the value axis horizontal). If you are worried about performance (i.e. you need to translate many points in a loop like QCPGraph), you can directly use QCPAxis::coordToPixel. However, you must then take care about the orientation of the axis yourself.
+Here are some important members you inherit from QCPAbstractPlottable:
| QCustomPlot *mParentPlot | A pointer to the parent QCustomPlot instance. The parent plot is inferred from the axes that are passed in the constructor. |
| QString mName | The name of the plottable. |
| QPen mPen | The generic pen of the plottable. You should use this pen for the most prominent data representing lines in the plottable (e.g QCPGraph uses this pen for its graph lines and scatters) |
| QBrush mBrush | The generic brush of the plottable. You should use this brush for the most prominent fillable structures in the plottable (e.g. QCPGraph uses this brush to control filling under the graph) |
| QPointer<QCPAxis> mKeyAxis, mValueAxis | The key and value axes this plottable is attached to. Call their QCPAxis::coordToPixel functions to translate coordinates to pixels in either the key or value dimension. Make sure to check whether the pointer is null before using it. If one of the axes is null, don't draw the plottable. |
| QCPSelectionDecorator mSelectionDecorator | The currently set selection decorator which specifies how selected data of the plottable shall be drawn and decorated. When drawing your data, you must consult this decorator for the appropriate pen/brush before drawing unselected/selected data segments. Finally, you should call its QCPSelectionDecorator::drawDecoration method at the end of your draw implementation. |
| QCP::SelectionType mSelectable | In which composition, if at all, this plottable's data may be selected. Enforcing this setting on the data selection is done by QCPAbstractPlottable automatically. |
| QCPDataSelection mSelection | Holds the current selection state of the plottable's data, i.e. the selected data ranges (QCPDataRange). |
| QCPAbstractPlottable::QCPAbstractPlottable | +( | +QCPAxis * | +keyAxis, | +
| + | + | QCPAxis * | +valueAxis | +
| + | ) | ++ |
Constructs an abstract plottable which uses keyAxis as its key axis ("x") and valueAxis as its value axis ("y"). keyAxis and valueAxis must reside in the same QCustomPlot instance and have perpendicular orientations. If either of these restrictions is violated, a corresponding message is printed to the debug output (qDebug), the construction is not aborted, though.
+Since QCPAbstractPlottable is an abstract class that defines the basic interface to plottables, it can't be directly instantiated.
+You probably want one of the subclasses like QCPGraph or QCPCurve instead.
+ +
+
|
+ +inline | +
Returns true if there are any data points of the plottable currently selected. Use selection to retrieve the current QCPDataSelection.
+ +
+
|
+ +inline | +
Returns a QCPDataSelection encompassing all the data points that are currently selected on this plottable.
+
+
|
+ +inline | +
Provides access to the selection decorator of this plottable. The selection decorator controls how selected data ranges are drawn (e.g. their pen color and fill), see QCPSelectionDecorator for details.
+If you wish to use an own QCPSelectionDecorator subclass, pass an instance of it to setSelectionDecorator.
+ +| void QCPAbstractPlottable::setName | +( | +const QString & | +name | ) | ++ |
The name is the textual representation of this plottable as it is displayed in the legend (QCPLegend). It may contain any UTF-8 characters, including newlines.
+ +| void QCPAbstractPlottable::setAntialiasedFill | +( | +bool | +enabled | ) | ++ |
Sets whether fills of this plottable are drawn antialiased or not.
+Note that this setting may be overridden by QCustomPlot::setAntialiasedElements and QCustomPlot::setNotAntialiasedElements.
+ +| void QCPAbstractPlottable::setAntialiasedScatters | +( | +bool | +enabled | ) | ++ |
Sets whether the scatter symbols of this plottable are drawn antialiased or not.
+Note that this setting may be overridden by QCustomPlot::setAntialiasedElements and QCustomPlot::setNotAntialiasedElements.
+ +| void QCPAbstractPlottable::setPen | +( | +const QPen & | +pen | ) | ++ |
| void QCPAbstractPlottable::setBrush | +( | +const QBrush & | +brush | ) | ++ |
| void QCPAbstractPlottable::setKeyAxis | +( | +QCPAxis * | +axis | ) | ++ |
The key axis of a plottable can be set to any axis of a QCustomPlot, as long as it is orthogonal to the plottable's value axis. This function performs no checks to make sure this is the case. The typical mathematical choice is to use the x-axis (QCustomPlot::xAxis) as key axis and the y-axis (QCustomPlot::yAxis) as value axis.
+Normally, the key and value axes are set in the constructor of the plottable (or QCustomPlot::addGraph when working with QCPGraphs through the dedicated graph interface).
+| void QCPAbstractPlottable::setValueAxis | +( | +QCPAxis * | +axis | ) | ++ |
The value axis of a plottable can be set to any axis of a QCustomPlot, as long as it is orthogonal to the plottable's key axis. This function performs no checks to make sure this is the case. The typical mathematical choice is to use the x-axis (QCustomPlot::xAxis) as key axis and the y-axis (QCustomPlot::yAxis) as value axis.
+Normally, the key and value axes are set in the constructor of the plottable (or QCustomPlot::addGraph when working with QCPGraphs through the dedicated graph interface).
+| void QCPAbstractPlottable::setSelectable | +( | +QCP::SelectionType | +selectable | ) | ++ |
Sets whether and to which granularity this plottable can be selected.
+A selection can happen by clicking on the QCustomPlot surface (When QCustomPlot::setInteractions contains QCP::iSelectPlottables), by dragging a selection rect (When QCustomPlot::setSelectionRectMode is QCP::srmSelect), or programmatically by calling setSelection.
+| void QCPAbstractPlottable::setSelection | +( | +QCPDataSelection | +selection | ) | ++ |
Sets which data ranges of this plottable are selected. Selected data ranges are drawn differently (e.g. color) in the plot. This can be controlled via the selection decorator (see selectionDecorator).
+The entire selection mechanism for plottables is handled automatically when QCustomPlot::setInteractions contains iSelectPlottables. You only need to call this function when you wish to change the selection state programmatically.
+Using setSelectable you can further specify for each plottable whether and to which granularity it is selectable. If selection is not compatible with the current QCP::SelectionType set via setSelectable, the resulting selection will be adjusted accordingly (see QCPDataSelection::enforceType).
+emits the selectionChanged signal when selected is different from the previous selection state.
+| void QCPAbstractPlottable::setSelectionDecorator | +( | +QCPSelectionDecorator * | +decorator | ) | ++ |
Use this method to set an own QCPSelectionDecorator (subclass) instance. This allows you to customize the visual representation of selected data ranges further than by using the default QCPSelectionDecorator.
+The plottable takes ownership of the decorator.
+The currently set decorator can be accessed via selectionDecorator.
+ +
+
|
+ +pure virtual | +
This function is used to decide whether a click hits a layerable object or not.
+pos is a point in pixel coordinates on the QCustomPlot surface. This function returns the shortest pixel distance of this point to the object. If the object is either invisible or the distance couldn't be determined, -1.0 is returned. Further, if onlySelectable is true and the object is not selectable, -1.0 is returned, too.
+If the object is represented not by single lines but by an area like a QCPItemText or the bars of a QCPBars plottable, a click inside the area should also be considered a hit. In these cases this function thus returns a constant value greater zero but still below the parent plot's selection tolerance. (typically the selectionTolerance multiplied by 0.99).
+Providing a constant value for area objects allows selecting line objects even when they are obscured by such area objects, by clicking close to the lines (i.e. closer than 0.99*selectionTolerance).
+The actual setting of the selection state is not done by this function. This is handled by the parent QCustomPlot when the mouseReleaseEvent occurs, and the finally selected object is notified via the selectEvent/deselectEvent methods.
+details is an optional output parameter. Every layerable subclass may place any information in details. This information will be passed to selectEvent when the parent QCustomPlot decides on the basis of this selectTest call, that the object was successfully selected. The subsequent call to selectEvent will carry the details. This is useful for multi-part objects (like QCPAxis). This way, a possibly complex calculation to decide which part was clicked is only done once in selectTest. The result (i.e. the actually clicked part) can then be placed in details. So in the subsequent selectEvent, the decision which part was selected doesn't have to be done a second time for a single selection operation.
+In the case of 1D Plottables (QCPAbstractPlottable1D, like QCPGraph or QCPBars) details will be set to a QCPDataSelection, describing the closest data point to pos.
+You may pass 0 as details to indicate that you are not interested in those selection details.
+Reimplemented from QCPLayerable.
+ +Implemented in QCPBars, QCPFinancial, QCPColorMap, QCPErrorBars, QCPGraph, QCPStatisticalBox, QCPCurve, QCPAbstractPlottable1D< DataType >, QCPAbstractPlottable1D< QCPFinancialData >, QCPAbstractPlottable1D< QCPStatisticalBoxData >, QCPAbstractPlottable1D< QCPGraphData >, QCPAbstractPlottable1D< QCPBarsData >, and QCPAbstractPlottable1D< QCPCurveData >.
+ +
+
|
+ +inlinevirtual | +
If this plottable is a one-dimensional plottable, i.e. it implements the QCPPlottableInterface1D, returns the this pointer with that type. Otherwise (e.g. in the case of a QCPColorMap) returns zero.
+You can use this method to gain read access to data coordinates while holding a pointer to the abstract base class only.
+ +Reimplemented in QCPErrorBars, QCPAbstractPlottable1D< DataType >, QCPAbstractPlottable1D< QCPFinancialData >, QCPAbstractPlottable1D< QCPStatisticalBoxData >, QCPAbstractPlottable1D< QCPGraphData >, QCPAbstractPlottable1D< QCPBarsData >, and QCPAbstractPlottable1D< QCPCurveData >.
+ +
+
|
+ +pure virtual | +
Returns the coordinate range that all data in this plottable span in the key axis dimension. For logarithmic plots, one can set inSignDomain to either QCP::sdNegative or QCP::sdPositive in order to restrict the returned range to that sign domain. E.g. when only negative range is wanted, set inSignDomain to QCP::sdNegative and all positive points will be ignored for range calculation. For no restriction, just set inSignDomain to QCP::sdBoth (default). foundRange is an output parameter that indicates whether a range could be found or not. If this is false, you shouldn't use the returned range (e.g. no points in data).
+Note that foundRange is not the same as QCPRange::validRange, since the range returned by this function may have size zero (e.g. when there is only one data point). In this case foundRange would return true, but the returned range is not a valid range in terms of QCPRange::validRange.
+Implemented in QCPBars, QCPErrorBars, QCPFinancial, QCPColorMap, QCPGraph, QCPStatisticalBox, and QCPCurve.
+ +
+
|
+ +pure virtual | +
Returns the coordinate range that the data points in the specified key range (inKeyRange) span in the value axis dimension. For logarithmic plots, one can set inSignDomain to either QCP::sdNegative or QCP::sdPositive in order to restrict the returned range to that sign domain. E.g. when only negative range is wanted, set inSignDomain to QCP::sdNegative and all positive points will be ignored for range calculation. For no restriction, just set inSignDomain to QCP::sdBoth (default). foundRange is an output parameter that indicates whether a range could be found or not. If this is false, you shouldn't use the returned range (e.g. no points in data).
+If inKeyRange has both lower and upper bound set to zero (is equal to QCPRange()), all data points are considered, without any restriction on the keys.
Note that foundRange is not the same as QCPRange::validRange, since the range returned by this function may have size zero (e.g. when there is only one data point). In this case foundRange would return true, but the returned range is not a valid range in terms of QCPRange::validRange.
+Implemented in QCPBars, QCPErrorBars, QCPFinancial, QCPColorMap, QCPGraph, QCPStatisticalBox, and QCPCurve.
+ +| void QCPAbstractPlottable::coordsToPixels | +( | +double | +key, | +
| + | + | double | +value, | +
| + | + | double & | +x, | +
| + | + | double & | +y | +
| + | ) | +const | +
Convenience function for transforming a key/value pair to pixels on the QCustomPlot surface, taking the orientations of the axes associated with this plottable into account (e.g. whether key represents x or y).
+key and value are transformed to the coodinates in pixels and are written to x and y.
+| const QPointF QCPAbstractPlottable::coordsToPixels | +( | +double | +key, | +
| + | + | double | +value | +
| + | ) | +const | +
This is an overloaded function.
+Transforms the given key and value to pixel coordinates and returns them in a QPointF.
+ +| void QCPAbstractPlottable::pixelsToCoords | +( | +double | +x, | +
| + | + | double | +y, | +
| + | + | double & | +key, | +
| + | + | double & | +value | +
| + | ) | +const | +
Convenience function for transforming a x/y pixel pair on the QCustomPlot surface to plot coordinates, taking the orientations of the axes associated with this plottable into account (e.g. whether key represents x or y).
+x and y are transformed to the plot coodinates and are written to key and value.
+| void QCPAbstractPlottable::pixelsToCoords | +( | +const QPointF & | +pixelPos, | +
| + | + | double & | +key, | +
| + | + | double & | +value | +
| + | ) | +const | +
This is an overloaded function.
+Returns the pixel input pixelPos as plot coordinates key and value.
+ +| void QCPAbstractPlottable::rescaleAxes | +( | +bool | +onlyEnlarge = false | ) | +const | +
Rescales the key and value axes associated with this plottable to contain all displayed data, so the whole plottable is visible. If the scaling of an axis is logarithmic, rescaleAxes will make sure not to rescale to an illegal range i.e. a range containing different signs and/or zero. Instead it will stay in the current sign domain and ignore all parts of the plottable that lie outside of that domain.
+onlyEnlarge makes sure the ranges are only expanded, never reduced. So it's possible to show multiple plottables in their entirety by multiple calls to rescaleAxes where the first call has onlyEnlarge set to false (the default), and all subsequent set to true.
+ + +| void QCPAbstractPlottable::rescaleKeyAxis | +( | +bool | +onlyEnlarge = false | ) | +const | +
Rescales the key axis of the plottable so the whole plottable is visible.
+See rescaleAxes for detailed behaviour.
+ +| void QCPAbstractPlottable::rescaleValueAxis | +( | +bool | +onlyEnlarge = false, |
+
| + | + | bool | +inKeyRange = false |
+
| + | ) | +const | +
Rescales the value axis of the plottable so the whole plottable is visible. If inKeyRange is set to true, only the data points which are in the currently visible key axis range are considered.
+Returns true if the axis was actually scaled. This might not be the case if this plottable has an invalid range, e.g. because it has no data points.
+See rescaleAxes for detailed behaviour.
+ +| bool QCPAbstractPlottable::addToLegend | +( | +QCPLegend * | +legend | ) | ++ |
This is an overloaded function.
+Adds this plottable to the specified legend.
+Creates a QCPPlottableLegendItem which is inserted into the legend. Returns true on success, i.e. when the legend exists and a legend item associated with this plottable isn't already in the legend.
+If the plottable needs a more specialized representation in the legend, you can create a corresponding subclass of QCPPlottableLegendItem and add it to the legend manually instead of calling this method.
+| bool QCPAbstractPlottable::addToLegend | +( | +) | ++ |
This is an overloaded function.
+Adds this plottable to the legend of the parent QCustomPlot (QCustomPlot::legend).
+| bool QCPAbstractPlottable::removeFromLegend | +( | +QCPLegend * | +legend | ) | +const | +
This is an overloaded function.
+Removes the plottable from the specifed legend. This means the QCPPlottableLegendItem that is associated with this plottable is removed.
+Returns true on success, i.e. if the legend exists and a legend item associated with this plottable was found and removed.
+| bool QCPAbstractPlottable::removeFromLegend | +( | +) | +const | +
This is an overloaded function.
+Removes the plottable from the legend of the parent QCustomPlot.
+
+
|
+ +signal | +
This signal is emitted when the selection state of this plottable has changed, either by user interaction or by a direct call to setSelection. The parameter selected indicates whether there are any points selected or not.
+ + +
+
|
+ +signal | +
This signal is emitted when the selection state of this plottable has changed, either by user interaction or by a direct call to setSelection. The parameter selection holds the currently selected data ranges.
+
+
|
+ +signal | +
This signal is emitted when the selectability of this plottable has changed.
+
+
|
+ +protectedvirtual | +
Returns the clipping rectangle of this layerable object. By default, this is the viewport of the parent QCustomPlot. Specific subclasses may reimplement this function to provide different clipping rects.
+The returned clipping rect is set on the painter before the draw function of the respective object is called.
+ +Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedpure virtual | +
This function draws the layerable with the specified painter. It is only called by QCustomPlot, if the layerable is visible (setVisible).
+Before this function is called, the painter's antialiasing state is set via applyDefaultAntialiasingHint, see the documentation there. Further, the clipping rectangle was set to clipRect.
+ +Implements QCPLayerable.
+ +Implemented in QCPBars, QCPColorMap, QCPFinancial, QCPErrorBars, QCPGraph, QCPStatisticalBox, and QCPCurve.
+ +
+
|
+ +protectedvirtual | +
Returns the selection category this layerable shall belong to. The selection category is used in conjunction with QCustomPlot::setInteractions to control which objects are selectable and which aren't.
+Subclasses that don't fit any of the normal QCP::Interaction values can use QCP::iSelectOther. This is what the default implementation returns.
+Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
A convenience function to easily set the QPainter::Antialiased hint on the provided painter before drawing plottable lines.
+This is the antialiasing state the painter passed to the draw method is in by default.
+This function takes into account the local setting of the antialiasing flag as well as the overrides set with QCustomPlot::setAntialiasedElements and QCustomPlot::setNotAntialiasedElements.
+For general information about this virtual method, see the base class implementation.
+ + +Implements QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
This event is called when the layerable shall be selected, as a consequence of a click by the user. Subclasses should react to it by setting their selection state appropriately. The default implementation does nothing.
+event is the mouse event that caused the selection. additive indicates, whether the user was holding the multi-select-modifier while performing the selection (see QCustomPlot::setMultiSelectModifier). if additive is true, the selection state must be toggled (i.e. become selected when unselected and unselected when selected).
+Every selectEvent is preceded by a call to selectTest, which has returned positively (i.e. returned a value greater than 0 and less than the selection tolerance of the parent QCustomPlot). The details data you output from selectTest is fed back via details here. You may use it to transport any kind of information from the selectTest to the possibly subsequent selectEvent. Usually details is used to transfer which part was clicked, if it is a layerable that has multiple individually selectable parts (like QCPAxis). This way selectEvent doesn't need to do the calculation again to find out which part was actually clicked.
+selectionStateChanged is an output parameter. If the pointer is non-null, this function must set the value either to true or false, depending on whether the selection state of this layerable was actually changed. For layerables that only are selectable as a whole and not in parts, this is simple: if additive is true, selectionStateChanged must also be set to true, because the selection toggles. If additive is false, selectionStateChanged is only set to true, if the layerable was previously unselected and now is switched to the selected state.
+Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
This event is called when the layerable shall be deselected, either as consequence of a user interaction or a call to QCustomPlot::deselectAll. Subclasses should react to it by unsetting their selection appropriately.
+just as in selectEvent, the output parameter selectionStateChanged (if non-null), must return true or false when the selection state of this layerable has changed or not changed, respectively.
+Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedpure virtual | +
called by QCPLegend::draw (via QCPPlottableLegendItem::draw) to create a graphical representation of this plottable inside rect, next to the plottable name.
+The passed painter has its cliprect set to rect, so painting outside of rect won't appear outside the legend icon border.
+ +Implemented in QCPBars, QCPColorMap, QCPFinancial, QCPErrorBars, QCPGraph, QCPStatisticalBox, and QCPCurve.
+ +
+
|
+ +protected | +
A convenience function to easily set the QPainter::Antialiased hint on the provided painter before drawing plottable fills.
+This function takes into account the local setting of the antialiasing flag as well as the overrides set with QCustomPlot::setAntialiasedElements and QCustomPlot::setNotAntialiasedElements.
+ + +
+
|
+ +protected | +
A convenience function to easily set the QPainter::Antialiased hint on the provided painter before drawing plottable scatter points.
+This function takes into account the local setting of the antialiasing flag as well as the overrides set with QCustomPlot::setAntialiasedElements and QCustomPlot::setNotAntialiasedElements.
+ + +A template base class for plottables with one-dimensional data. + More...
+
+Public Functions | |
| QCPAbstractPlottable1D (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
| virtual int | dataCount () const |
| virtual double | dataMainKey (int index) const |
| virtual double | dataSortKey (int index) const |
| virtual double | dataMainValue (int index) const |
| virtual QCPRange | dataValueRange (int index) const |
| virtual QPointF | dataPixelPosition (int index) const |
| virtual bool | sortKeyIsMainKey () const |
| virtual QCPDataSelection | selectTestRect (const QRectF &rect, bool onlySelectable) const |
| virtual int | findBegin (double sortKey, bool expandedRange=true) const |
| virtual int | findEnd (double sortKey, bool expandedRange=true) const |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
| virtual QCPPlottableInterface1D * | interface1D () |
Public Functions inherited from QCPAbstractPlottable | |
| QCPAbstractPlottable (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
| +QString | name () const |
| +bool | antialiasedFill () const |
| +bool | antialiasedScatters () const |
| +QPen | pen () const |
| +QBrush | brush () const |
| +QCPAxis * | keyAxis () const |
| +QCPAxis * | valueAxis () const |
| +QCP::SelectionType | selectable () const |
| bool | selected () const |
| QCPDataSelection | selection () const |
| QCPSelectionDecorator * | selectionDecorator () const |
| void | setName (const QString &name) |
| void | setAntialiasedFill (bool enabled) |
| void | setAntialiasedScatters (bool enabled) |
| void | setPen (const QPen &pen) |
| void | setBrush (const QBrush &brush) |
| void | setKeyAxis (QCPAxis *axis) |
| void | setValueAxis (QCPAxis *axis) |
| Q_SLOT void | setSelectable (QCP::SelectionType selectable) |
| Q_SLOT void | setSelection (QCPDataSelection selection) |
| void | setSelectionDecorator (QCPSelectionDecorator *decorator) |
| virtual QCPRange | getKeyRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const =0 |
| virtual QCPRange | getValueRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const =0 |
| void | coordsToPixels (double key, double value, double &x, double &y) const |
| const QPointF | coordsToPixels (double key, double value) const |
| void | pixelsToCoords (double x, double y, double &key, double &value) const |
| void | pixelsToCoords (const QPointF &pixelPos, double &key, double &value) const |
| void | rescaleAxes (bool onlyEnlarge=false) const |
| void | rescaleKeyAxis (bool onlyEnlarge=false) const |
| void | rescaleValueAxis (bool onlyEnlarge=false, bool inKeyRange=false) const |
| bool | addToLegend (QCPLegend *legend) |
| bool | addToLegend () |
| bool | removeFromLegend (QCPLegend *legend) const |
| bool | removeFromLegend () const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Protected Functions | |
| void | getDataSegments (QList< QCPDataRange > &selectedSegments, QList< QCPDataRange > &unselectedSegments) const |
| void | drawPolyline (QCPPainter *painter, const QVector< QPointF > &lineData) const |
Protected Functions inherited from QCPAbstractPlottable | |
| virtual QRect | clipRect () const |
| virtual void | draw (QCPPainter *painter)=0 |
| virtual QCP::Interaction | selectionCategory () const |
| void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| virtual void | drawLegendIcon (QCPPainter *painter, const QRectF &rect) const =0 |
| void | applyFillAntialiasingHint (QCPPainter *painter) const |
| void | applyScattersAntialiasingHint (QCPPainter *painter) const |
Protected Functions inherited from QCPLayerable | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Additional Inherited Members | |
Signals inherited from QCPAbstractPlottable | |
| void | selectionChanged (bool selected) |
| void | selectionChanged (const QCPDataSelection &selection) |
| void | selectableChanged (QCP::SelectionType selectable) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
A template base class for plottables with one-dimensional data.
+This template class derives from QCPAbstractPlottable and from the abstract interface QCPPlottableInterface1D. It serves as a base class for all one-dimensional data (i.e. data with one key dimension), such as QCPGraph and QCPCurve.
+The template parameter DataType is the type of the data points of this plottable (e.g. QCPGraphData or QCPCurveData). The main purpose of this base class is to provide the member mDataContainer (a shared pointer to a QCPDataContainer<DataType>) and implement the according virtual methods of the QCPPlottableInterface1D, such that most subclassed plottables don't need to worry about this anymore.
+Further, it provides a convenience method for retrieving selected/unselected data segments via getDataSegments. This is useful when subclasses implement their draw method and need to draw selected segments with a different pen/brush than unselected segments (also see QCPSelectionDecorator).
+This class implements basic functionality of QCPAbstractPlottable::selectTest and QCPPlottableInterface1D::selectTestRect, assuming point-like data points, based on the 1D data interface. In spite of that, most plottable subclasses will want to reimplement those methods again, to provide a more accurate hit test based on their specific data visualization geometry.
+| QCPAbstractPlottable1D< DataType >::QCPAbstractPlottable1D | +( | +QCPAxis * | +keyAxis, | +
| + | + | QCPAxis * | +valueAxis | +
| + | ) | ++ |
Forwards keyAxis and valueAxis to the QCPAbstractPlottable constructor and allocates the mDataContainer.
+ +
+
|
+ +virtual | +
Returns the number of data points of the plottable.
+ +Implements QCPPlottableInterface1D.
+ +
+
|
+ +virtual | +
Returns the main key of the data point at the given index.
+What the main key is, is defined by the plottable's data type. See the QCPDataContainer DataType documentation for details about this naming convention.
+ +Implements QCPPlottableInterface1D.
+ +
+
|
+ +virtual | +
Returns the sort key of the data point at the given index.
+What the sort key is, is defined by the plottable's data type. See the QCPDataContainer DataType documentation for details about this naming convention.
+ +Implements QCPPlottableInterface1D.
+ +
+
|
+ +virtual | +
Returns the main value of the data point at the given index.
+What the main value is, is defined by the plottable's data type. See the QCPDataContainer DataType documentation for details about this naming convention.
+ +Implements QCPPlottableInterface1D.
+ +
+
|
+ +virtual | +
Returns the value range of the data point at the given index.
+What the value range is, is defined by the plottable's data type. See the QCPDataContainer DataType documentation for details about this naming convention.
+ +Implements QCPPlottableInterface1D.
+ +
+
|
+ +virtual | +
Returns the pixel position on the widget surface at which the data point at the given index appears.
+Usually this corresponds to the point of dataMainKey/dataMainValue, in pixel coordinates. However, depending on the plottable, this might be a different apparent position than just a coord-to-pixel transform of those values. For example, QCPBars apparent data values can be shifted depending on their stacking, bar grouping or configured base value.
+ +Implements QCPPlottableInterface1D.
+ +Reimplemented in QCPBars.
+ +
+
|
+ +virtual | +
Returns whether the sort key (dataSortKey) is identical to the main key (dataMainKey).
+What the sort and main keys are, is defined by the plottable's data type. See the QCPDataContainer DataType documentation for details about this naming convention.
+ +Implements QCPPlottableInterface1D.
+ +
+
|
+ +virtual | +
Implements a rect-selection algorithm assuming the data (accessed via the 1D data interface) is point-like. Most subclasses will want to reimplement this method again, to provide a more accurate hit test based on the true data visualization geometry.
+For general information about this virtual method, see the base class implementation.
+ +Implements QCPPlottableInterface1D.
+ +Reimplemented in QCPBars, QCPFinancial, and QCPStatisticalBox.
+ +
+
|
+ +virtual | +
Returns the index of the data point with a (sort-)key that is equal to, just below, or just above sortKey. If expandedRange is true, the data point just below sortKey will be considered, otherwise the one just above.
+This can be used in conjunction with findEnd to iterate over data points within a given key range, including or excluding the bounding data points that are just beyond the specified range.
+If expandedRange is true but there are no data points below sortKey, 0 is returned.
+If the container is empty, returns 0 (in that case, findEnd will also return 0, so a loop using these methods will not iterate over the index 0).
+Implements QCPPlottableInterface1D.
+ +
+
|
+ +virtual | +
Returns the index one after the data point with a (sort-)key that is equal to, just above, or just below sortKey. If expandedRange is true, the data point just above sortKey will be considered, otherwise the one just below.
+This can be used in conjunction with findBegin to iterate over data points within a given key range, including the bounding data points that are just below and above the specified range.
+If expandedRange is true but there are no data points above sortKey, the index just above the highest data point is returned.
+If the container is empty, returns 0.
+Implements QCPPlottableInterface1D.
+ +
+
|
+ +virtual | +
Implements a point-selection algorithm assuming the data (accessed via the 1D data interface) is point-like. Most subclasses will want to reimplement this method again, to provide a more accurate hit test based on the true data visualization geometry.
+If details is not 0, it will be set to a QCPDataSelection, describing the closest data point to pos.
+For general information about this virtual method, see the base class implementation.
+ +Implements QCPAbstractPlottable.
+ +Reimplemented in QCPBars, QCPFinancial, QCPGraph, QCPStatisticalBox, and QCPCurve.
+ +
+
|
+ +inlinevirtual | +
Returns a QCPPlottableInterface1D pointer to this plottable, providing access to its 1D interface.
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPAbstractPlottable.
+ +
+
|
+ +protected | +
Splits all data into selected and unselected segments and outputs them via selectedSegments and unselectedSegments, respectively.
+This is useful when subclasses implement their draw method and need to draw selected segments with a different pen/brush than unselected segments (also see QCPSelectionDecorator).
+
+
|
+ +protected | +
A helper method which draws a line with the passed painter, according to the pixel data in lineData. NaN points create gaps in the line, as expected from QCustomPlot's plottables (this is the main difference to QPainter's regular drawPolyline, which handles NaNs by lagging or crashing).
+Further it uses a faster line drawing technique based on QCPPainter::drawLine rather than QPainter::drawPolyline if the configured QCustomPlot::setPlottingHints() and painter style allows.
Manages a single axis inside a QCustomPlot. + More...
+
+Public Types | |
| enum | AxisType |
| enum | LabelSide |
| enum | ScaleType |
| enum | SelectablePart |
+Public Functions | |
| QCPAxis (QCPAxisRect *parent, AxisType type) | |
| +AxisType | axisType () const |
| +QCPAxisRect * | axisRect () const |
| +ScaleType | scaleType () const |
| +const QCPRange | range () const |
| +bool | rangeReversed () const |
| QSharedPointer< QCPAxisTicker > | ticker () const |
| +bool | ticks () const |
| +bool | tickLabels () const |
| +int | tickLabelPadding () const |
| +QFont | tickLabelFont () const |
| +QColor | tickLabelColor () const |
| +double | tickLabelRotation () const |
| +LabelSide | tickLabelSide () const |
| +QString | numberFormat () const |
| +int | numberPrecision () const |
| +QVector< double > | tickVector () const |
| +QVector< QString > | tickVectorLabels () const |
| +int | tickLengthIn () const |
| +int | tickLengthOut () const |
| +bool | subTicks () const |
| +int | subTickLengthIn () const |
| +int | subTickLengthOut () const |
| +QPen | basePen () const |
| +QPen | tickPen () const |
| +QPen | subTickPen () const |
| +QFont | labelFont () const |
| +QColor | labelColor () const |
| +QString | label () const |
| +int | labelPadding () const |
| +int | padding () const |
| +int | offset () const |
| +SelectableParts | selectedParts () const |
| +SelectableParts | selectableParts () const |
| +QFont | selectedTickLabelFont () const |
| +QFont | selectedLabelFont () const |
| +QColor | selectedTickLabelColor () const |
| +QColor | selectedLabelColor () const |
| +QPen | selectedBasePen () const |
| +QPen | selectedTickPen () const |
| +QPen | selectedSubTickPen () const |
| +QCPLineEnding | lowerEnding () const |
| +QCPLineEnding | upperEnding () const |
| QCPGrid * | grid () const |
| Q_SLOT void | setScaleType (QCPAxis::ScaleType type) |
| Q_SLOT void | setRange (const QCPRange &range) |
| void | setRange (double lower, double upper) |
| void | setRange (double position, double size, Qt::AlignmentFlag alignment) |
| void | setRangeLower (double lower) |
| void | setRangeUpper (double upper) |
| void | setRangeReversed (bool reversed) |
| void | setTicker (QSharedPointer< QCPAxisTicker > ticker) |
| void | setTicks (bool show) |
| void | setTickLabels (bool show) |
| void | setTickLabelPadding (int padding) |
| void | setTickLabelFont (const QFont &font) |
| void | setTickLabelColor (const QColor &color) |
| void | setTickLabelRotation (double degrees) |
| void | setTickLabelSide (LabelSide side) |
| void | setNumberFormat (const QString &formatCode) |
| void | setNumberPrecision (int precision) |
| void | setTickLength (int inside, int outside=0) |
| void | setTickLengthIn (int inside) |
| void | setTickLengthOut (int outside) |
| void | setSubTicks (bool show) |
| void | setSubTickLength (int inside, int outside=0) |
| void | setSubTickLengthIn (int inside) |
| void | setSubTickLengthOut (int outside) |
| void | setBasePen (const QPen &pen) |
| void | setTickPen (const QPen &pen) |
| void | setSubTickPen (const QPen &pen) |
| void | setLabelFont (const QFont &font) |
| void | setLabelColor (const QColor &color) |
| void | setLabel (const QString &str) |
| void | setLabelPadding (int padding) |
| void | setPadding (int padding) |
| void | setOffset (int offset) |
| void | setSelectedTickLabelFont (const QFont &font) |
| void | setSelectedLabelFont (const QFont &font) |
| void | setSelectedTickLabelColor (const QColor &color) |
| void | setSelectedLabelColor (const QColor &color) |
| void | setSelectedBasePen (const QPen &pen) |
| void | setSelectedTickPen (const QPen &pen) |
| void | setSelectedSubTickPen (const QPen &pen) |
| Q_SLOT void | setSelectableParts (const QCPAxis::SelectableParts &selectableParts) |
| Q_SLOT void | setSelectedParts (const QCPAxis::SelectableParts &selectedParts) |
| void | setLowerEnding (const QCPLineEnding &ending) |
| void | setUpperEnding (const QCPLineEnding &ending) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
| Qt::Orientation | orientation () const |
| int | pixelOrientation () const |
| void | moveRange (double diff) |
| void | scaleRange (double factor) |
| void | scaleRange (double factor, double center) |
| void | setScaleRatio (const QCPAxis *otherAxis, double ratio=1.0) |
| void | rescale (bool onlyVisiblePlottables=false) |
| double | pixelToCoord (double value) const |
| double | coordToPixel (double value) const |
| SelectablePart | getPartAt (const QPointF &pos) const |
| QList< QCPAbstractPlottable * > | plottables () const |
| QList< QCPGraph * > | graphs () const |
| QList< QCPAbstractItem * > | items () const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Signals | |
| void | rangeChanged (const QCPRange &newRange) |
| void | rangeChanged (const QCPRange &newRange, const QCPRange &oldRange) |
| void | scaleTypeChanged (QCPAxis::ScaleType scaleType) |
| void | selectionChanged (const QCPAxis::SelectableParts &parts) |
| void | selectableChanged (const QCPAxis::SelectableParts &parts) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
+Static Public Functions | |
| static AxisType | marginSideToAxisType (QCP::MarginSide side) |
| static Qt::Orientation | orientation (AxisType type) |
| static AxisType | opposite (AxisType type) |
+Protected Functions | |
| virtual int | calculateMargin () |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | draw (QCPPainter *painter) |
| virtual QCP::Interaction | selectionCategory () const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | setupTickVectors () |
| QPen | getBasePen () const |
| QPen | getTickPen () const |
| QPen | getSubTickPen () const |
| QFont | getTickLabelFont () const |
| QFont | getLabelFont () const |
| QColor | getTickLabelColor () const |
| QColor | getLabelColor () const |
Protected Functions inherited from QCPLayerable | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual QRect | clipRect () const |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
Manages a single axis inside a QCustomPlot.
+Usually doesn't need to be instantiated externally. Access QCustomPlot's default four axes via QCustomPlot::xAxis (bottom), QCustomPlot::yAxis (left), QCustomPlot::xAxis2 (top) and QCustomPlot::yAxis2 (right).
+Axes are always part of an axis rect, see QCPAxisRect.
+
+
+Each axis holds an instance of QCPAxisTicker which is used to generate the tick coordinates and tick labels. You can access the currently installed ticker or set a new one (possibly one of the specialized subclasses, or your own subclass) via setTicker. For details, see the documentation of QCPAxisTicker.
+| enum QCPAxis::AxisType | +
Defines at which side of the axis rect the axis will appear. This also affects how the tick marks are drawn, on which side the labels are placed etc.
+| enum QCPAxis::LabelSide | +
Defines on which side of the axis the tick labels (numbers) shall appear.
+| Enumerator | |
|---|---|
| lsInside | Tick labels will be displayed inside the axis rect and clipped to the inner axis rect. + |
| lsOutside | Tick labels will be displayed outside the axis rect. + |
| enum QCPAxis::ScaleType | +
Defines the scale of an axis.
| Enumerator | |
|---|---|
| stLinear | Linear scaling. + |
| stLogarithmic | Logarithmic scaling with correspondingly transformed axis coordinates (possibly also setTicker to a QCPAxisTickerLog instance). + |
| enum QCPAxis::SelectablePart | +
Defines the selectable parts of an axis.
+
|
+ +explicit | +
Constructs an Axis instance of Type type for the axis rect parent.
+Usually it isn't necessary to instantiate axes directly, because you can let QCustomPlot create them for you with QCPAxisRect::addAxis. If you want to use own QCPAxis-subclasses however, create them manually and then inject them also via QCPAxisRect::addAxis.
+ +
+
|
+ +inline | +
Returns a modifiable shared pointer to the currently installed axis ticker. The axis ticker is responsible for generating the tick positions and tick labels of this axis. You can access the QCPAxisTicker with this method and modify basic properties such as the approximate tick count (QCPAxisTicker::setTickCount).
+You can gain more control over the axis ticks by setting a different QCPAxisTicker subclass, see the documentation there. A new axis ticker can be set with setTicker.
+Since the ticker is stored in the axis as a shared pointer, multiple axes may share the same axis ticker simply by passing the same shared pointer to multiple axes.
+
+
|
+ +inline | +
Returns the QCPGrid instance belonging to this axis. Access it to set details about the way the grid is displayed.
+ +| void QCPAxis::setScaleType | +( | +QCPAxis::ScaleType | +type | ) | ++ |
Sets whether the axis uses a linear scale or a logarithmic scale.
+Note that this method controls the coordinate transformation. For logarithmic scales, you will likely also want to use a logarithmic tick spacing and labeling, which can be achieved by setting the axis ticker to an instance of QCPAxisTickerLog :
+See the documentation of QCPAxisTickerLog about the details of logarithmic axis tick creation.
+ + +| void QCPAxis::setRange | +( | +const QCPRange & | +range | ) | ++ |
Sets the range of the axis.
+This slot may be connected with the rangeChanged signal of another axis so this axis is always synchronized with the other axis range, when it changes.
+To invert the direction of an axis, use setRangeReversed.
+ +| void QCPAxis::setRange | +( | +double | +lower, | +
| + | + | double | +upper | +
| + | ) | ++ |
This is an overloaded function.
+Sets the lower and upper bound of the axis range.
+To invert the direction of an axis, use setRangeReversed.
+There is also a slot to set a range, see setRange(const QCPRange &range).
+ +| void QCPAxis::setRange | +( | +double | +position, | +
| + | + | double | +size, | +
| + | + | Qt::AlignmentFlag | +alignment | +
| + | ) | ++ |
This is an overloaded function.
+Sets the range of the axis.
+The position coordinate indicates together with the alignment parameter, where the new range will be positioned. size defines the size of the new axis range. alignment may be Qt::AlignLeft, Qt::AlignRight or Qt::AlignCenter. This will cause the left border, right border, or center of the range to be aligned with position. Any other values of alignment will default to Qt::AlignCenter.
+ +| void QCPAxis::setRangeLower | +( | +double | +lower | ) | ++ |
Sets the lower bound of the axis range. The upper bound is not changed.
| void QCPAxis::setRangeUpper | +( | +double | +upper | ) | ++ |
Sets the upper bound of the axis range. The lower bound is not changed.
| void QCPAxis::setRangeReversed | +( | +bool | +reversed | ) | ++ |
Sets whether the axis range (direction) is displayed reversed. Normally, the values on horizontal axes increase left to right, on vertical axes bottom to top. When reversed is set to true, the direction of increasing values is inverted.
+Note that the range and data interface stays the same for reversed axes, e.g. the lower part of the setRange interface will still reference the mathematically smaller number than the upper part.
+ +| void QCPAxis::setTicker | +( | +QSharedPointer< QCPAxisTicker > | +ticker | ) | ++ |
The axis ticker is responsible for generating the tick positions and tick labels. See the documentation of QCPAxisTicker for details on how to work with axis tickers.
+You can change the tick positioning/labeling behaviour of this axis by setting a different QCPAxisTicker subclass using this method. If you only wish to modify the currently installed axis ticker, access it via ticker.
+Since the ticker is stored in the axis as a shared pointer, multiple axes may share the same axis ticker simply by passing the same shared pointer to multiple axes.
+| void QCPAxis::setTicks | +( | +bool | +show | ) | ++ |
Sets whether tick marks are displayed.
+Note that setting show to false does not imply that tick labels are invisible, too. To achieve that, see setTickLabels.
+| void QCPAxis::setTickLabels | +( | +bool | +show | ) | ++ |
Sets whether tick labels are displayed. Tick labels are the numbers drawn next to tick marks.
+ +| void QCPAxis::setTickLabelPadding | +( | +int | +padding | ) | ++ |
Sets the distance between the axis base line (including any outward ticks) and the tick labels.
| void QCPAxis::setTickLabelFont | +( | +const QFont & | +font | ) | ++ |
Sets the font of the tick labels.
+| void QCPAxis::setTickLabelColor | +( | +const QColor & | +color | ) | ++ |
Sets the color of the tick labels.
+| void QCPAxis::setTickLabelRotation | +( | +double | +degrees | ) | ++ |
Sets the rotation of the tick labels. If degrees is zero, the labels are drawn normally. Else, the tick labels are drawn rotated by degrees clockwise. The specified angle is bound to values from -90 to 90 degrees.
+If degrees is exactly -90, 0 or 90, the tick labels are centered on the tick coordinate. For other angles, the label is drawn with an offset such that it seems to point toward or away from the tick mark.
+ +| void QCPAxis::setTickLabelSide | +( | +LabelSide | +side | ) | ++ |
Sets whether the tick labels (numbers) shall appear inside or outside the axis rect.
+The usual and default setting is lsOutside. Very compact plots sometimes require tick labels to be inside the axis rect, to save space. If side is set to lsInside, the tick labels appear on the inside are additionally clipped to the axis rect.
+ +| void QCPAxis::setNumberFormat | +( | +const QString & | +formatCode | ) | ++ |
Sets the number format for the numbers in tick labels. This formatCode is an extended version of the format code used e.g. by QString::number() and QLocale::toString(). For reference about that, see the "Argument Formats" section in the detailed description of the QString class.
+formatCode is a string of one, two or three characters. The first character is identical to the normal format code used by Qt. In short, this means: 'e'/'E' scientific format, 'f' fixed format, 'g'/'G' scientific or fixed, whichever is shorter.
+The second and third characters are optional and specific to QCustomPlot:
+If the first char was 'e' or 'g', numbers are/might be displayed in the scientific format, e.g. "5.5e9", which is ugly in a plot. So when the second char of formatCode is set to 'b' (for "beautiful"), those exponential numbers are formatted in a more natural way, i.e. "5.5
+[multiplication sign] 10 [superscript] 9". By default, the multiplication sign is a centered dot. If instead a cross should be shown (as is usual in the USA), the third char of formatCode can be set to 'c'. The inserted multiplication signs are the UTF-8 characters 215 (0xD7) for the cross and 183 (0xB7) for the dot.
Examples for formatCode:
g normal format code behaviour. If number is small, fixed format is used, if number is large, normal scientific format is used gb If number is small, fixed format is used, if number is large, scientific format is used with beautifully typeset decimal powers and a dot as multiplication sign ebc All numbers are in scientific format with beautifully typeset decimal power and a cross as multiplication sign fb illegal format code, since fixed format doesn't support (or need) beautifully typeset decimal powers. Format code will be reduced to 'f'. hello illegal format code, since first char is not 'e', 'E', 'f', 'g' or 'G'. Current format code will not be changed. | void QCPAxis::setNumberPrecision | +( | +int | +precision | ) | ++ |
Sets the precision of the tick label numbers. See QLocale::toString(double i, char f, int prec) for details. The effect of precisions are most notably for number Formats starting with 'e', see setNumberFormat
+ +| void QCPAxis::setTickLength | +( | +int | +inside, | +
| + | + | int | +outside = 0 |
+
| + | ) | ++ |
Sets the length of the ticks in pixels. inside is the length the ticks will reach inside the plot and outside is the length they will reach outside the plot. If outside is greater than zero, the tick labels and axis label will increase their distance to the axis accordingly, so they won't collide with the ticks.
+| void QCPAxis::setTickLengthIn | +( | +int | +inside | ) | ++ |
Sets the length of the inward ticks in pixels. inside is the length the ticks will reach inside the plot.
+| void QCPAxis::setTickLengthOut | +( | +int | +outside | ) | ++ |
Sets the length of the outward ticks in pixels. outside is the length the ticks will reach outside the plot. If outside is greater than zero, the tick labels and axis label will increase their distance to the axis accordingly, so they won't collide with the ticks.
+| void QCPAxis::setSubTicks | +( | +bool | +show | ) | ++ |
| void QCPAxis::setSubTickLength | +( | +int | +inside, | +
| + | + | int | +outside = 0 |
+
| + | ) | ++ |
Sets the length of the subticks in pixels. inside is the length the subticks will reach inside the plot and outside is the length they will reach outside the plot. If outside is greater than zero, the tick labels and axis label will increase their distance to the axis accordingly, so they won't collide with the ticks.
+ + +| void QCPAxis::setSubTickLengthIn | +( | +int | +inside | ) | ++ |
Sets the length of the inward subticks in pixels. inside is the length the subticks will reach inside the plot.
+| void QCPAxis::setSubTickLengthOut | +( | +int | +outside | ) | ++ |
Sets the length of the outward subticks in pixels. outside is the length the subticks will reach outside the plot. If outside is greater than zero, the tick labels will increase their distance to the axis accordingly, so they won't collide with the ticks.
+| void QCPAxis::setBasePen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen, the axis base line is drawn with.
+| void QCPAxis::setTickPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen, tick marks will be drawn with.
+| void QCPAxis::setSubTickPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen, subtick marks will be drawn with.
+| void QCPAxis::setLabelFont | +( | +const QFont & | +font | ) | ++ |
Sets the font of the axis label.
+| void QCPAxis::setLabelColor | +( | +const QColor & | +color | ) | ++ |
Sets the color of the axis label.
+| void QCPAxis::setLabel | +( | +const QString & | +str | ) | ++ |
Sets the text of the axis label that will be shown below/above or next to the axis, depending on its orientation. To disable axis labels, pass an empty string as str.
+ +| void QCPAxis::setLabelPadding | +( | +int | +padding | ) | ++ |
Sets the distance between the tick labels and the axis label.
+| void QCPAxis::setPadding | +( | +int | +padding | ) | ++ |
Sets the padding of the axis.
+When QCPAxisRect::setAutoMargins is enabled, the padding is the additional outer most space, that is left blank.
+The axis padding has no meaning if QCPAxisRect::setAutoMargins is disabled.
+| void QCPAxis::setOffset | +( | +int | +offset | ) | ++ |
Sets the offset the axis has to its axis rect side.
+If an axis rect side has multiple axes and automatic margin calculation is enabled for that side, only the offset of the inner most axis has meaning (even if it is set to be invisible). The offset of the other, outer axes is controlled automatically, to place them at appropriate positions.
+ +| void QCPAxis::setSelectedTickLabelFont | +( | +const QFont & | +font | ) | ++ |
Sets the font that is used for tick labels when they are selected.
+ + +| void QCPAxis::setSelectedLabelFont | +( | +const QFont & | +font | ) | ++ |
Sets the font that is used for the axis label when it is selected.
+ + +| void QCPAxis::setSelectedTickLabelColor | +( | +const QColor & | +color | ) | ++ |
Sets the color that is used for tick labels when they are selected.
+ + +| void QCPAxis::setSelectedLabelColor | +( | +const QColor & | +color | ) | ++ |
Sets the color that is used for the axis label when it is selected.
+ + +| void QCPAxis::setSelectedBasePen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen that is used to draw the axis base line when selected.
+ + +| void QCPAxis::setSelectedTickPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen that is used to draw the (major) ticks when selected.
+ + +| void QCPAxis::setSelectedSubTickPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen that is used to draw the subticks when selected.
+ + +| void QCPAxis::setSelectableParts | +( | +const QCPAxis::SelectableParts & | +selectableParts | ) | ++ |
Sets whether the user can (de-)select the parts in selectable by clicking on the QCustomPlot surface. (When QCustomPlot::setInteractions contains iSelectAxes.)
+However, even when selectable is set to a value not allowing the selection of a specific part, it is still possible to set the selection of this part manually, by calling setSelectedParts directly.
+| void QCPAxis::setSelectedParts | +( | +const QCPAxis::SelectableParts & | +selectedParts | ) | ++ |
Sets the selected state of the respective axis parts described by SelectablePart. When a part is selected, it uses a different pen/font.
+The entire selection mechanism for axes is handled automatically when QCustomPlot::setInteractions contains iSelectAxes. You only need to call this function when you wish to change the selection state manually.
+This function can change the selection state of a part, independent of the setSelectableParts setting.
+emits the selectionChanged signal when selected is different from the previous selection state.
+ + +| void QCPAxis::setLowerEnding | +( | +const QCPLineEnding & | +ending | ) | ++ |
Sets the style for the lower axis ending. See the documentation of QCPLineEnding for available styles.
+For horizontal axes, this method refers to the left ending, for vertical axes the bottom ending. Note that this meaning does not change when the axis range is reversed with setRangeReversed.
+| void QCPAxis::setUpperEnding | +( | +const QCPLineEnding & | +ending | ) | ++ |
Sets the style for the upper axis ending. See the documentation of QCPLineEnding for available styles.
+For horizontal axes, this method refers to the right ending, for vertical axes the top ending. Note that this meaning does not change when the axis range is reversed with setRangeReversed.
+
+
|
+ +virtual | +
This function is used to decide whether a click hits a layerable object or not.
+pos is a point in pixel coordinates on the QCustomPlot surface. This function returns the shortest pixel distance of this point to the object. If the object is either invisible or the distance couldn't be determined, -1.0 is returned. Further, if onlySelectable is true and the object is not selectable, -1.0 is returned, too.
+If the object is represented not by single lines but by an area like a QCPItemText or the bars of a QCPBars plottable, a click inside the area should also be considered a hit. In these cases this function thus returns a constant value greater zero but still below the parent plot's selection tolerance. (typically the selectionTolerance multiplied by 0.99).
+Providing a constant value for area objects allows selecting line objects even when they are obscured by such area objects, by clicking close to the lines (i.e. closer than 0.99*selectionTolerance).
+The actual setting of the selection state is not done by this function. This is handled by the parent QCustomPlot when the mouseReleaseEvent occurs, and the finally selected object is notified via the selectEvent/deselectEvent methods.
+details is an optional output parameter. Every layerable subclass may place any information in details. This information will be passed to selectEvent when the parent QCustomPlot decides on the basis of this selectTest call, that the object was successfully selected. The subsequent call to selectEvent will carry the details. This is useful for multi-part objects (like QCPAxis). This way, a possibly complex calculation to decide which part was clicked is only done once in selectTest. The result (i.e. the actually clicked part) can then be placed in details. So in the subsequent selectEvent, the decision which part was selected doesn't have to be done a second time for a single selection operation.
+In the case of 1D Plottables (QCPAbstractPlottable1D, like QCPGraph or QCPBars) details will be set to a QCPDataSelection, describing the closest data point to pos.
+You may pass 0 as details to indicate that you are not interested in those selection details.
+Reimplemented from QCPLayerable.
+ +
+
|
+ +inline | +
Returns the orientation of this axis. The axis orientation (horizontal or vertical) is deduced from the axis type (left, top, right or bottom).
+ + +
+
|
+ +inline | +
Returns which direction points towards higher coordinate values/keys, in pixel space.
+This method returns either 1 or -1. If it returns 1, then going in the positive direction along the orientation of the axis in pixels corresponds to going from lower to higher axis coordinates. On the other hand, if this method returns -1, going to smaller pixel values corresponds to going from lower to higher axis coordinates.
+For example, this is useful to easily shift axis coordinates by a certain amount given in pixels, without having to care about reversed or vertically aligned axes:
+newKey will then contain a key that is ten pixels towards higher keys, starting from oldKey.
+ +| void QCPAxis::moveRange | +( | +double | +diff | ) | ++ |
If the scale type (setScaleType) is stLinear, diff is added to the lower and upper bounds of the range. The range is simply moved by diff.
+If the scale type is stLogarithmic, the range bounds are multiplied by diff. This corresponds to an apparent "linear" move in logarithmic scaling by a distance of log(diff).
+ +| void QCPAxis::scaleRange | +( | +double | +factor | ) | ++ |
Scales the range of this axis by factor around the center of the current axis range. For example, if factor is 2.0, then the axis range will double its size, and the point at the axis range center won't have changed its position in the QCustomPlot widget (i.e. coordinates around the center will have moved symmetrically closer).
+If you wish to scale around a different coordinate than the current axis range center, use the overload scaleRange(double factor, double center).
+ +| void QCPAxis::scaleRange | +( | +double | +factor, | +
| + | + | double | +center | +
| + | ) | ++ |
This is an overloaded function.
+Scales the range of this axis by factor around the coordinate center. For example, if factor is 2.0, center is 1.0, then the axis range will double its size, and the point at coordinate 1.0 won't have changed its position in the QCustomPlot widget (i.e. coordinates around 1.0 will have moved symmetrically closer to 1.0).
+| void QCPAxis::setScaleRatio | +( | +const QCPAxis * | +otherAxis, | +
| + | + | double | +ratio = 1.0 |
+
| + | ) | ++ |
Scales the range of this axis to have a certain scale ratio to otherAxis. The scaling will be done around the center of the current axis range.
+For example, if ratio is 1, this axis is the yAxis and otherAxis is xAxis, graphs plotted with those axes will appear in a 1:1 aspect ratio, independent of the aspect ratio the axis rect has.
+This is an operation that changes the range of this axis once, it doesn't fix the scale ratio indefinitely. Note that calling this function in the constructor of the QCustomPlot's parent won't have the desired effect, since the widget dimensions aren't defined yet, and a resizeEvent will follow.
+ +| void QCPAxis::rescale | +( | +bool | +onlyVisiblePlottables = false | ) | ++ |
Changes the axis range such that all plottables associated with this axis are fully visible in that dimension.
+ + +| double QCPAxis::pixelToCoord | +( | +double | +value | ) | +const | +
Transforms value, in pixel coordinates of the QCustomPlot widget, to axis coordinates.
+ +| double QCPAxis::coordToPixel | +( | +double | +value | ) | +const | +
Transforms value, in coordinates of the axis, to pixel coordinates of the QCustomPlot widget.
+ +| QCPAxis::SelectablePart QCPAxis::getPartAt | +( | +const QPointF & | +pos | ) | +const | +
Returns the part of the axis that is hit by pos (in pixels). The return value of this function is independent of the user-selectable parts defined with setSelectableParts. Further, this function does not change the current selection state of the axis.
+If the axis is not visible (setVisible), this function always returns spNone.
+ + +| QList< QCPAbstractPlottable * > QCPAxis::plottables | +( | +) | +const | +
| QList< QCPGraph * > QCPAxis::graphs | +( | +) | +const | +
Returns a list of all the graphs that have this axis as key or value axis.
+| QList< QCPAbstractItem * > QCPAxis::items | +( | +) | +const | +
Returns a list of all the items that are associated with this axis. An item is considered associated with an axis if at least one of its positions uses the axis as key or value axis.
+
+
|
+ +static | +
Transforms a margin side to the logically corresponding axis type. (QCP::msLeft to QCPAxis::atLeft, QCP::msRight to QCPAxis::atRight, etc.)
+ +
+
|
+ +inlinestatic | +
Returns the orientation of the specified axis type
+
+
|
+ +static | +
Returns the axis type that describes the opposite axis of an axis with the specified type.
+ +
+
|
+ +signal | +
This signal is emitted when the range of this axis has changed. You can connect it to the setRange slot of another axis to communicate the new range to the other axis, in order for it to be synchronized.
+You may also manipulate/correct the range with setRange in a slot connected to this signal. This is useful if for example a maximum range span shall not be exceeded, or if the lower/upper range shouldn't go beyond certain values (see QCPRange::bounded). For example, the following slot would limit the x axis to ranges between 0 and 10:
+
|
+ +signal | +
This is an overloaded function.
+Additionally to the new range, this signal also provides the previous range held by the axis as oldRange.
+ +
+
|
+ +signal | +
This signal is emitted when the scale type changes, by calls to setScaleType
+ +
+
|
+ +signal | +
This signal is emitted when the selection state of this axis has changed, either by user interaction or by a direct call to setSelectedParts.
+ +
+
|
+ +signal | +
This signal is emitted when the selectability changes, by calls to setSelectableParts
+ +
+
|
+ +protectedvirtual | +
Returns the appropriate outward margin for this axis. It is needed if QCPAxisRect::setAutoMargins is set to true on the parent axis rect. An axis with axis type atLeft will return an appropriate left margin, atBottom will return an appropriate bottom margin and so forth. For the calculation, this function goes through similar steps as draw, so changing one function likely requires the modification of the other one as well.
+The margin consists of the outward tick length, tick label padding, tick label size, label padding, label size, and padding.
+The margin is cached internally, so repeated calls while leaving the axis range, fonts, etc. unchanged are very fast.
+ +
+
|
+ +protectedvirtual | +
A convenience function to easily set the QPainter::Antialiased hint on the provided painter before drawing axis lines.
+This is the antialiasing state the painter passed to the draw method is in by default.
+This function takes into account the local setting of the antialiasing flag as well as the overrides set with QCustomPlot::setAntialiasedElements and QCustomPlot::setNotAntialiasedElements.
+For general information about this virtual method, see the base class implementation.
+Implements QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
Draws the axis with the specified painter, using the internal QCPAxisPainterPrivate instance.
+For general information about this virtual method, see the base class implementation.
+ +Implements QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
Returns the selection category this layerable shall belong to. The selection category is used in conjunction with QCustomPlot::setInteractions to control which objects are selectable and which aren't.
+Subclasses that don't fit any of the normal QCP::Interaction values can use QCP::iSelectOther. This is what the default implementation returns.
+Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
This event is called when the layerable shall be selected, as a consequence of a click by the user. Subclasses should react to it by setting their selection state appropriately. The default implementation does nothing.
+event is the mouse event that caused the selection. additive indicates, whether the user was holding the multi-select-modifier while performing the selection (see QCustomPlot::setMultiSelectModifier). if additive is true, the selection state must be toggled (i.e. become selected when unselected and unselected when selected).
+Every selectEvent is preceded by a call to selectTest, which has returned positively (i.e. returned a value greater than 0 and less than the selection tolerance of the parent QCustomPlot). The details data you output from selectTest is fed back via details here. You may use it to transport any kind of information from the selectTest to the possibly subsequent selectEvent. Usually details is used to transfer which part was clicked, if it is a layerable that has multiple individually selectable parts (like QCPAxis). This way selectEvent doesn't need to do the calculation again to find out which part was actually clicked.
+selectionStateChanged is an output parameter. If the pointer is non-null, this function must set the value either to true or false, depending on whether the selection state of this layerable was actually changed. For layerables that only are selectable as a whole and not in parts, this is simple: if additive is true, selectionStateChanged must also be set to true, because the selection toggles. If additive is false, selectionStateChanged is only set to true, if the layerable was previously unselected and now is switched to the selected state.
+Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
This event is called when the layerable shall be deselected, either as consequence of a user interaction or a call to QCustomPlot::deselectAll. Subclasses should react to it by unsetting their selection appropriately.
+just as in selectEvent, the output parameter selectionStateChanged (if non-null), must return true or false when the selection state of this layerable has changed or not changed, respectively.
+Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
This mouse event reimplementation provides the functionality to let the user drag individual axes exclusively, by startig the drag on top of the axis.
+For the axis to accept this event and perform the single axis drag, the parent QCPAxisRect must be configured accordingly, i.e. it must allow range dragging in the orientation of this axis (QCPAxisRect::setRangeDrag) and this axis must be a draggable axis (QCPAxisRect::setRangeDragAxes)
+For general information about this virtual method, see the base class implementation.
+Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
This mouse event reimplementation provides the functionality to let the user drag individual axes exclusively, by startig the drag on top of the axis.
+For general information about this virtual method, see the base class implementation.
+Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
This mouse event reimplementation provides the functionality to let the user drag individual axes exclusively, by startig the drag on top of the axis.
+For general information about this virtual method, see the base class implementation.
+Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
This mouse event reimplementation provides the functionality to let the user zoom individual axes exclusively, by performing the wheel event on top of the axis.
+For the axis to accept this event and perform the single axis zoom, the parent QCPAxisRect must be configured accordingly, i.e. it must allow range zooming in the orientation of this axis (QCPAxisRect::setRangeZoom) and this axis must be a zoomable axis (QCPAxisRect::setRangeZoomAxes)
+For general information about this virtual method, see the base class implementation.
+Reimplemented from QCPLayerable.
+ +
+
|
+ +protected | +
Prepares the internal tick vector, sub tick vector and tick label vector. This is done by calling QCPAxisTicker::generate on the currently installed ticker.
+If a change in the label text/count is detected, the cached axis margin is invalidated to make sure the next margin calculation recalculates the label sizes and returns an up-to-date value.
+ +
+
|
+ +protected | +
Returns the pen that is used to draw the axis base line. Depending on the selection state, this is either mSelectedBasePen or mBasePen.
+ +
+
|
+ +protected | +
Returns the pen that is used to draw the (major) ticks. Depending on the selection state, this is either mSelectedTickPen or mTickPen.
+ +
+
|
+ +protected | +
Returns the pen that is used to draw the subticks. Depending on the selection state, this is either mSelectedSubTickPen or mSubTickPen.
+ +
+
|
+ +protected | +
Returns the font that is used to draw the tick labels. Depending on the selection state, this is either mSelectedTickLabelFont or mTickLabelFont.
+ +
+
|
+ +protected | +
Returns the font that is used to draw the axis label. Depending on the selection state, this is either mSelectedLabelFont or mLabelFont.
+ +
+
|
+ +protected | +
Returns the color that is used to draw the tick labels. Depending on the selection state, this is either mSelectedTickLabelColor or mTickLabelColor.
+ +
+
|
+ +protected | +
Returns the color that is used to draw the axis label. Depending on the selection state, this is either mSelectedLabelColor or mLabelColor.
+ +Holds multiple axes and arranges them in a rectangular shape. + More...
+
+Public Functions | |
| QCPAxisRect (QCustomPlot *parentPlot, bool setupDefaultAxes=true) | |
| +QPixmap | background () const |
| +QBrush | backgroundBrush () const |
| +bool | backgroundScaled () const |
| +Qt::AspectRatioMode | backgroundScaledMode () const |
| +Qt::Orientations | rangeDrag () const |
| +Qt::Orientations | rangeZoom () const |
| QCPAxis * | rangeDragAxis (Qt::Orientation orientation) |
| QCPAxis * | rangeZoomAxis (Qt::Orientation orientation) |
| QList< QCPAxis * > | rangeDragAxes (Qt::Orientation orientation) |
| QList< QCPAxis * > | rangeZoomAxes (Qt::Orientation orientation) |
| double | rangeZoomFactor (Qt::Orientation orientation) |
| void | setBackground (const QPixmap &pm) |
| void | setBackground (const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding) |
| void | setBackground (const QBrush &brush) |
| void | setBackgroundScaled (bool scaled) |
| void | setBackgroundScaledMode (Qt::AspectRatioMode mode) |
| void | setRangeDrag (Qt::Orientations orientations) |
| void | setRangeZoom (Qt::Orientations orientations) |
| void | setRangeDragAxes (QCPAxis *horizontal, QCPAxis *vertical) |
| void | setRangeDragAxes (QList< QCPAxis *> axes) |
| void | setRangeDragAxes (QList< QCPAxis *> horizontal, QList< QCPAxis *> vertical) |
| void | setRangeZoomAxes (QCPAxis *horizontal, QCPAxis *vertical) |
| void | setRangeZoomAxes (QList< QCPAxis *> axes) |
| void | setRangeZoomAxes (QList< QCPAxis *> horizontal, QList< QCPAxis *> vertical) |
| void | setRangeZoomFactor (double horizontalFactor, double verticalFactor) |
| void | setRangeZoomFactor (double factor) |
| int | axisCount (QCPAxis::AxisType type) const |
| QCPAxis * | axis (QCPAxis::AxisType type, int index=0) const |
| QList< QCPAxis * > | axes (QCPAxis::AxisTypes types) const |
| QList< QCPAxis * > | axes () const |
| QCPAxis * | addAxis (QCPAxis::AxisType type, QCPAxis *axis=0) |
| QList< QCPAxis * > | addAxes (QCPAxis::AxisTypes types) |
| bool | removeAxis (QCPAxis *axis) |
| QCPLayoutInset * | insetLayout () const |
| void | zoom (const QRectF &pixelRect) |
| void | zoom (const QRectF &pixelRect, const QList< QCPAxis *> &affectedAxes) |
| void | setupFullAxesBox (bool connectRanges=false) |
| QList< QCPAbstractPlottable * > | plottables () const |
| QList< QCPGraph * > | graphs () const |
| QList< QCPAbstractItem * > | items () const |
| int | left () const |
| int | right () const |
| int | top () const |
| int | bottom () const |
| int | width () const |
| int | height () const |
| QSize | size () const |
| QPoint | topLeft () const |
| QPoint | topRight () const |
| QPoint | bottomLeft () const |
| QPoint | bottomRight () const |
| QPoint | center () const |
| virtual void | update (UpdatePhase phase) |
| virtual QList< QCPLayoutElement * > | elements (bool recursive) const |
Public Functions inherited from QCPLayoutElement | |
| QCPLayoutElement (QCustomPlot *parentPlot=0) | |
| QCPLayout * | layout () const |
| QRect | rect () const |
| QRect | outerRect () const |
| +QMargins | margins () const |
| +QMargins | minimumMargins () const |
| +QCP::MarginSides | autoMargins () const |
| +QSize | minimumSize () const |
| +QSize | maximumSize () const |
| +SizeConstraintRect | sizeConstraintRect () const |
| +QCPMarginGroup * | marginGroup (QCP::MarginSide side) const |
| +QHash< QCP::MarginSide, QCPMarginGroup * > | marginGroups () const |
| void | setOuterRect (const QRect &rect) |
| void | setMargins (const QMargins &margins) |
| void | setMinimumMargins (const QMargins &margins) |
| void | setAutoMargins (QCP::MarginSides sides) |
| void | setMinimumSize (const QSize &size) |
| void | setMinimumSize (int width, int height) |
| void | setMaximumSize (const QSize &size) |
| void | setMaximumSize (int width, int height) |
| void | setSizeConstraintRect (SizeConstraintRect constraintRect) |
| void | setMarginGroup (QCP::MarginSides sides, QCPMarginGroup *group) |
| virtual QSize | minimumOuterSizeHint () const |
| virtual QSize | maximumOuterSizeHint () const |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Protected Functions | |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | draw (QCPPainter *painter) |
| virtual int | calculateAutoMargin (QCP::MarginSide side) |
| virtual void | layoutChanged () |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | drawBackground (QCPPainter *painter) |
| void | updateAxesOffset (QCPAxis::AxisType type) |
Protected Functions inherited from QCPLayoutElement | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
Protected Functions inherited from QCPLayerable | |
| virtual QCP::Interaction | selectionCategory () const |
| virtual QRect | clipRect () const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Additional Inherited Members | |
Public Types inherited from QCPLayoutElement | |
| enum | UpdatePhase |
| enum | SizeConstraintRect |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
Holds multiple axes and arranges them in a rectangular shape.
+This class represents an axis rect, a rectangular area that is bounded on all sides with an arbitrary number of axes.
+Initially QCustomPlot has one axis rect, accessible via QCustomPlot::axisRect(). However, the layout system allows to have multiple axis rects, e.g. arranged in a grid layout (QCustomPlot::plotLayout).
+By default, QCPAxisRect comes with four axes, at bottom, top, left and right. They can be accessed via axis by providing the respective axis type (QCPAxis::AxisType) and index. If you need all axes in the axis rect, use axes. The top and right axes are set to be invisible initially (QCPAxis::setVisible). To add more axes to a side, use addAxis or addAxes. To remove an axis, use removeAxis.
+The axis rect layerable itself only draws a background pixmap or color, if specified (setBackground). It is placed on the "background" layer initially (see QCPLayer for an explanation of the QCustomPlot layer system). The axes that are held by the axis rect can be placed on other layers, independently of the axis rect.
+Every axis rect has a child layout of type QCPLayoutInset. It is accessible via insetLayout and can be used to have other layout elements (or even other layouts with multiple elements) hovering inside the axis rect.
+If an axis rect is clicked and dragged, it processes this by moving certain axis ranges. The behaviour can be controlled with setRangeDrag and setRangeDragAxes. If the mouse wheel is scrolled while the cursor is on the axis rect, certain axes are scaled. This is controllable via setRangeZoom, setRangeZoomAxes and setRangeZoomFactor. These interactions are only enabled if QCustomPlot::setInteractions contains QCP::iRangeDrag and QCP::iRangeZoom.
+
+
+
|
+ +explicit | +
Creates a QCPAxisRect instance and sets default values. An axis is added for each of the four sides, the top and right axes are set invisible initially.
+ +| QCPAxis * QCPAxisRect::rangeDragAxis | +( | +Qt::Orientation | +orientation | ) | ++ |
Returns the range drag axis of the orientation provided. If multiple axes were set, returns the first one (use rangeDragAxes to retrieve a list with all set axes).
+| QCPAxis * QCPAxisRect::rangeZoomAxis | +( | +Qt::Orientation | +orientation | ) | ++ |
Returns the range zoom axis of the orientation provided. If multiple axes were set, returns the first one (use rangeZoomAxes to retrieve a list with all set axes).
+| QList< QCPAxis * > QCPAxisRect::rangeDragAxes | +( | +Qt::Orientation | +orientation | ) | ++ |
Returns all range drag axes of the orientation provided.
+| QList< QCPAxis * > QCPAxisRect::rangeZoomAxes | +( | +Qt::Orientation | +orientation | ) | ++ |
Returns all range zoom axes of the orientation provided.
+| double QCPAxisRect::rangeZoomFactor | +( | +Qt::Orientation | +orientation | ) | ++ |
Returns the range zoom factor of the orientation provided.
+| void QCPAxisRect::setBackground | +( | +const QPixmap & | +pm | ) | ++ |
Sets pm as the axis background pixmap. The axis background pixmap will be drawn inside the axis rect. Since axis rects place themselves on the "background" layer by default, the axis rect backgrounds are usually drawn below everything else.
+For cases where the provided pixmap doesn't have the same size as the axis rect, scaling can be enabled with setBackgroundScaled and the scaling mode (i.e. whether and how the aspect ratio is preserved) can be set with setBackgroundScaledMode. To set all these options in one call, consider using the overloaded version of this function.
+Below the pixmap, the axis rect may be optionally filled with a brush, if specified with setBackground(const QBrush &brush).
+ + +| void QCPAxisRect::setBackground | +( | +const QPixmap & | +pm, | +
| + | + | bool | +scaled, | +
| + | + | Qt::AspectRatioMode | +mode = Qt::KeepAspectRatioByExpanding |
+
| + | ) | ++ |
This is an overloaded function.
+Allows setting the background pixmap of the axis rect, whether it shall be scaled and how it shall be scaled in one call.
+ + +| void QCPAxisRect::setBackground | +( | +const QBrush & | +brush | ) | ++ |
This is an overloaded function.
+Sets brush as the background brush. The axis rect background will be filled with this brush. Since axis rects place themselves on the "background" layer by default, the axis rect backgrounds are usually drawn below everything else.
+The brush will be drawn before (under) any background pixmap, which may be specified with setBackground(const QPixmap &pm).
+To disable drawing of a background brush, set brush to Qt::NoBrush.
+| void QCPAxisRect::setBackgroundScaled | +( | +bool | +scaled | ) | ++ |
Sets whether the axis background pixmap shall be scaled to fit the 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 setBackgroundScaledMode.
+Note that the scaled version of the original pixmap is buffered, so there is no performance penalty on replots. (Except when the axis rect dimensions are changed continuously.)
+| void QCPAxisRect::setBackgroundScaledMode | +( | +Qt::AspectRatioMode | +mode | ) | ++ |
If scaling of the axis background pixmap is enabled (setBackgroundScaled), use this function to define whether and how the aspect ratio of the original pixmap passed to setBackground is preserved.
| void QCPAxisRect::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 QCP::iRangeDrag from QCustomPlot::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 QCustomPlot::setInteractions contains QCP::iRangeDrag to enable the range dragging interaction.
+ + +| void QCPAxisRect::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 QCP::iRangeZoom from QCustomPlot::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 QCustomPlot::setInteractions contains QCP::iRangeZoom to enable the range zooming interaction.
+| void QCPAxisRect::setRangeDragAxes | +( | +QCPAxis * | +horizontal, | +
| + | + | QCPAxis * | +vertical | +
| + | ) | ++ |
This is an overloaded function.
+Sets the axes whose range will be dragged when setRangeDrag enables mouse range dragging on the QCustomPlot widget. Pass 0 if no axis shall be dragged in the respective orientation.
+Use the overload taking a list of axes, if multiple axes (more than one per orientation) shall react to dragging interactions.
+| void QCPAxisRect::setRangeDragAxes | +( | +QList< QCPAxis *> | +axes | ) | ++ |
This is an overloaded function.
+This method allows to set up multiple axes to react to horizontal and vertical dragging. The drag orientation that the respective axis will react to is deduced from its orientation (QCPAxis::orientation).
+In the unusual case that you wish to e.g. drag a vertically oriented axis with a horizontal drag motion, use the overload taking two separate lists for horizontal and vertical dragging.
+ +| void QCPAxisRect::setRangeDragAxes | +( | +QList< QCPAxis *> | +horizontal, | +
| + | + | QList< QCPAxis *> | +vertical | +
| + | ) | ++ |
This is an overloaded function.
+This method allows to set multiple axes up to react to horizontal and vertical dragging, and define specifically which axis reacts to which drag orientation (irrespective of the axis orientation).
+ +| void QCPAxisRect::setRangeZoomAxes | +( | +QCPAxis * | +horizontal, | +
| + | + | QCPAxis * | +vertical | +
| + | ) | ++ |
Sets the axes whose range will be zoomed when setRangeZoom enables mouse wheel zooming on the QCustomPlot widget. Pass 0 if no axis shall be zoomed in the respective orientation.
+The two axes can be zoomed with different strengths, when different factors are passed to setRangeZoomFactor(double horizontalFactor, double verticalFactor).
+Use the overload taking a list of axes, if multiple axes (more than one per orientation) shall react to zooming interactions.
+| void QCPAxisRect::setRangeZoomAxes | +( | +QList< QCPAxis *> | +axes | ) | ++ |
This is an overloaded function.
+This method allows to set up multiple axes to react to horizontal and vertical range zooming. The zoom orientation that the respective axis will react to is deduced from its orientation (QCPAxis::orientation).
+In the unusual case that you wish to e.g. zoom a vertically oriented axis with a horizontal zoom interaction, use the overload taking two separate lists for horizontal and vertical zooming.
+ +| void QCPAxisRect::setRangeZoomAxes | +( | +QList< QCPAxis *> | +horizontal, | +
| + | + | QList< QCPAxis *> | +vertical | +
| + | ) | ++ |
This is an overloaded function.
+This method allows to set multiple axes up to react to horizontal and vertical zooming, and define specifically which axis reacts to which zoom orientation (irrespective of the axis orientation).
+ +| void QCPAxisRect::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 QCPAxisRect::setRangeZoomFactor | +( | +double | +factor | ) | ++ |
This is an overloaded function.
+Sets both the horizontal and vertical zoom factor.
+ +| int QCPAxisRect::axisCount | +( | +QCPAxis::AxisType | +type | ) | +const | +
Returns the number of axes on the axis rect side specified with type.
+| QCPAxis * QCPAxisRect::axis | +( | +QCPAxis::AxisType | +type, | +
| + | + | int | +index = 0 |
+
| + | ) | +const | +
| QList< QCPAxis * > QCPAxisRect::axes | +( | +QCPAxis::AxisTypes | +types | ) | +const | +
Returns all axes on the axis rect sides specified with types.
+types may be a single QCPAxis::AxisType or an or-combination, to get the axes of multiple sides.
| QList< QCPAxis * > QCPAxisRect::axes | +( | +) | +const | +
This is an overloaded function.
+Returns all axes of this axis rect.
+ +| QCPAxis * QCPAxisRect::addAxis | +( | +QCPAxis::AxisType | +type, | +
| + | + | QCPAxis * | +axis = 0 |
+
| + | ) | ++ |
Adds a new axis to the axis rect side specified with type, and returns it. If axis is 0, a new QCPAxis instance is created internally. QCustomPlot owns the returned axis, so if you want to remove an axis, use removeAxis instead of deleting it manually.
+You may inject QCPAxis instances (or subclasses of QCPAxis) by setting axis to an axis that was previously created outside QCustomPlot. It is important to note that QCustomPlot takes ownership of the axis, so you may not delete it afterwards. Further, the axis must have been created with this axis rect as parent and with the same axis type as specified in type. If this is not the case, a debug output is generated, the axis is not added, and the method returns 0.
+This method can not be used to move axis between axis rects. The same axis instance must not be added multiple times to the same or different axis rects.
+If an axis rect side already contains one or more axes, the lower and upper endings of the new axis (QCPAxis::setLowerEnding, QCPAxis::setUpperEnding) are set to QCPLineEnding::esHalfBar.
+| QList< QCPAxis * > QCPAxisRect::addAxes | +( | +QCPAxis::AxisTypes | +types | ) | ++ |
Adds a new axis with addAxis to each axis rect side specified in types. This may be an or-combination of QCPAxis::AxisType, so axes can be added to multiple sides at once.
Returns a list of the added axes.
+| bool QCPAxisRect::removeAxis | +( | +QCPAxis * | +axis | ) | ++ |
Removes the specified axis from the axis rect and deletes it.
+Returns true on success, i.e. if axis was a valid axis in this axis rect.
+
+
|
+ +inline | +
Returns the inset layout of this axis rect. It can be used to place other layout elements (or even layouts with multiple other elements) inside/on top of an axis rect.
+| void QCPAxisRect::zoom | +( | +const QRectF & | +pixelRect | ) | ++ |
Zooms in (or out) to the passed rectangular region pixelRect, given in pixel coordinates.
+All axes of this axis rect will have their range zoomed accordingly. If you only wish to zoom specific axes, use the overloaded version of this method.
+ + +| void QCPAxisRect::zoom | +( | +const QRectF & | +pixelRect, | +
| + | + | const QList< QCPAxis *> & | +affectedAxes | +
| + | ) | ++ |
This is an overloaded function.
+Zooms in (or out) to the passed rectangular region pixelRect, given in pixel coordinates.
+Only the axes passed in affectedAxes will have their ranges zoomed accordingly.
+ + +| void QCPAxisRect::setupFullAxesBox | +( | +bool | +connectRanges = false | ) | ++ |
Convenience function to create an axis on each side that doesn't have any axes yet and set their visibility to true. Further, the top/right axes are assigned the following properties of the bottom/left axes:
+Tick label visibility (QCPAxis::setTickLabels) of the right and top axes are set to false.
+If connectRanges is true, the rangeChanged signals of the bottom and left axes are connected to the QCPAxis::setRange slots of the top and right axes.
+ +| QList< QCPAbstractPlottable * > QCPAxisRect::plottables | +( | +) | +const | +
| QList< QCPGraph * > QCPAxisRect::graphs | +( | +) | +const | +
Returns a list of all the graphs that are associated with this axis rect.
+A graph is considered associated with an axis rect if its key or value axis (or both) is in this axis rect.
+| QList< QCPAbstractItem * > QCPAxisRect::items | +( | +) | +const | +
Returns a list of all the items that are associated with this axis rect.
+An item is considered associated with an axis rect if any of its positions has key or value axis set to an axis that is in this axis rect, or if any of its positions has QCPItemPosition::setAxisRect set to the axis rect, or if the clip axis rect (QCPAbstractItem::setClipAxisRect) is set to this axis rect.
+
+
|
+ +inline | +
Returns the pixel position of the left border of this axis rect. Margins are not taken into account here, so the returned value is with respect to the inner rect.
+ +
+
|
+ +inline | +
Returns the pixel position of the right border of this axis rect. Margins are not taken into account here, so the returned value is with respect to the inner rect.
+ +
+
|
+ +inline | +
Returns the pixel position of the top border of this axis rect. Margins are not taken into account here, so the returned value is with respect to the inner rect.
+ +
+
|
+ +inline | +
Returns the pixel position of the bottom border of this axis rect. Margins are not taken into account here, so the returned value is with respect to the inner rect.
+ +
+
|
+ +inline | +
Returns the pixel width of this axis rect. Margins are not taken into account here, so the returned value is with respect to the inner rect.
+ +
+
|
+ +inline | +
Returns the pixel height of this axis rect. Margins are not taken into account here, so the returned value is with respect to the inner rect.
+ +
+
|
+ +inline | +
Returns the pixel size of this axis rect. Margins are not taken into account here, so the returned value is with respect to the inner rect.
+ +
+
|
+ +inline | +
Returns the top left corner of this axis rect in pixels. Margins are not taken into account here, so the returned value is with respect to the inner rect.
+ +
+
|
+ +inline | +
Returns the top right corner of this axis rect in pixels. Margins are not taken into account here, so the returned value is with respect to the inner rect.
+ +
+
|
+ +inline | +
Returns the bottom left corner of this axis rect in pixels. Margins are not taken into account here, so the returned value is with respect to the inner rect.
+ +
+
|
+ +inline | +
Returns the bottom right corner of this axis rect in pixels. Margins are not taken into account here, so the returned value is with respect to the inner rect.
+ +
+
|
+ +inline | +
Returns the center of this axis rect in pixels. Margins are not taken into account here, so the returned value is with respect to the inner rect.
+ +
+
|
+ +virtual | +
This method is called automatically upon replot and doesn't need to be called by users of QCPAxisRect.
+Calls the base class implementation to update the margins (see QCPLayoutElement::update), and finally passes the rect to the inset layout (insetLayout) and calls its QCPInsetLayout::update function.
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPLayoutElement.
+ +
+
|
+ +virtual | +
Returns a list of all child elements in this layout element. If recursive is true, all sub-child elements are included in the list, too.
+Reimplemented from QCPLayoutElement.
+ +
+
|
+ +protectedvirtual | +
This function applies the default antialiasing setting to the specified painter, using the function applyAntialiasingHint. It is the antialiasing state the painter is put in, when draw is called on the layerable. If the layerable has multiple entities whose antialiasing setting may be specified individually, this function should set the antialiasing state of the most prominent entity. In this case however, the draw function usually calls the specialized versions of this function before drawing each entity, effectively overriding the setting of the default antialiasing hint.
+First example: QCPGraph has multiple entities that have an antialiasing setting: The graph line, fills and scatters. Those can be configured via QCPGraph::setAntialiased, QCPGraph::setAntialiasedFill and QCPGraph::setAntialiasedScatters. Consequently, there isn't only the QCPGraph::applyDefaultAntialiasingHint function (which corresponds to the graph line's antialiasing), but specialized ones like QCPGraph::applyFillAntialiasingHint and QCPGraph::applyScattersAntialiasingHint. So before drawing one of those entities, QCPGraph::draw calls the respective specialized applyAntialiasingHint function.
+Second example: QCPItemLine consists only of a line so there is only one antialiasing setting which can be controlled with QCPItemLine::setAntialiased. (This function is inherited by all layerables. The specialized functions, as seen on QCPGraph, must be added explicitly to the respective layerable subclass.) Consequently it only has the normal QCPItemLine::applyDefaultAntialiasingHint. The QCPItemLine::draw function doesn't need to care about setting any antialiasing states, because the default antialiasing hint is already set on the painter when the draw function is called, and that's the state it wants to draw the line with.
+ +Reimplemented from QCPLayoutElement.
+ +
+
|
+ +protectedvirtual | +
This function draws the layerable with the specified painter. It is only called by QCustomPlot, if the layerable is visible (setVisible).
+Before this function is called, the painter's antialiasing state is set via applyDefaultAntialiasingHint, see the documentation there. Further, the clipping rectangle was set to clipRect.
+ +Reimplemented from QCPLayoutElement.
+ +
+
|
+ +protectedvirtual | +
Returns the margin size for this side. It is used if automatic margins is enabled for this side (see setAutoMargins). If a minimum margin was set with setMinimumMargins, the returned value will not be smaller than the specified minimum margin.
+The default implementation just returns the respective manual margin (setMargins) or the minimum margin, whichever is larger.
+ +Reimplemented from QCPLayoutElement.
+ +
+
|
+ +protectedvirtual | +
Reacts to a change in layout to potentially set the convenience axis pointers QCustomPlot::xAxis, QCustomPlot::yAxis, etc. of the parent QCustomPlot to the respective axes of this axis rect. This is only done if the respective convenience pointer is currently zero and if there is no QCPAxisRect at position (0, 0) of the plot layout.
+This automation makes it simpler to replace the main axis rect with a newly created one, without the need to manually reset the convenience pointers.
+ +Reimplemented from QCPLayoutElement.
+ +
+
|
+ +protectedvirtual | +
Event handler for when a mouse button is pressed on the axis rect. If the left mouse button is pressed, the range dragging interaction is initialized (the actual range manipulation happens in the mouseMoveEvent).
+The mDragging flag is set to true and some anchor points are set that are needed to determine the distance the mouse was dragged in the mouse move/release events later.
+Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
Event handler for when the mouse is moved on the axis rect. If range dragging was activated in a preceding mousePressEvent, the range is moved accordingly.
+Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
This event gets called when the user releases the mouse button, after this layerable has become the mouse grabber by accepting the preceding mousePressEvent.
+The current pixel position of the cursor on the QCustomPlot widget is accessible via event->pos(). The parameter startPos indicates the position where the initial mousePressEvent occured, that started the mouse interaction.
The default implementation does nothing.
+ + +Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
Event handler for mouse wheel events. If rangeZoom is Qt::Horizontal, Qt::Vertical or both, the ranges of the axes defined as rangeZoomHorzAxis and rangeZoomVertAxis are scaled. The center of the scaling operation is the current cursor position inside the axis rect. The scaling factor is dependent on the mouse wheel delta (which direction the wheel was rotated) to provide a natural zooming feel. The Strength of the zoom can be controlled via setRangeZoomFactor.
+Note, that event->delta() is usually +/-120 for single rotation steps. However, if the mouse wheel is turned rapidly, many steps may bunch up to one event, so the event->delta() may then be multiples of 120. This is taken into account here, by calculating wheelSteps and using it as exponent of the range zoom factor. This takes care of the wheel direction automatically, by inverting the factor, when the wheel step is negative (f^-1 = 1/f).
+ +Reimplemented from QCPLayerable.
+ +
+
|
+ +protected | +
Draws the background of this axis rect. It may consist of a background fill (a QBrush) and a pixmap.
+If a brush was given via setBackground(const QBrush &brush), this function first draws an according filling inside the axis rect with the provided painter.
+Then, if a pixmap was provided via setBackground, this function buffers the scaled version depending on setBackgroundScaled and setBackgroundScaledMode and then draws it inside the axis rect with the provided painter. The scaled version is buffered in mScaledBackgroundPixmap to prevent expensive rescaling at every redraw. It is only updated, when the axis rect has changed in a way that requires a rescale of the background pixmap (this is dependent on the setBackgroundScaledMode), or when a differend axis background pixmap was set.
+ + +
+
|
+ +protected | +
This function makes sure multiple axes on the side specified with type don't collide, but are distributed according to their respective space requirement (QCPAxis::calculateMargin).
+It does this by setting an appropriate offset (QCPAxis::setOffset) on all axes except the one with index zero.
+This function is called by calculateAutoMargin.
+ +The base class tick generator used by QCPAxis to create tick positions and tick labels. + More...
+
+Public Types | |
| enum | TickStepStrategy |
+Public Functions | |
| QCPAxisTicker () | |
| +TickStepStrategy | tickStepStrategy () const |
| +int | tickCount () const |
| +double | tickOrigin () const |
| void | setTickStepStrategy (TickStepStrategy strategy) |
| void | setTickCount (int count) |
| void | setTickOrigin (double origin) |
| virtual void | generate (const QCPRange &range, const QLocale &locale, QChar formatChar, int precision, QVector< double > &ticks, QVector< double > *subTicks, QVector< QString > *tickLabels) |
+Protected Functions | |
| virtual double | getTickStep (const QCPRange &range) |
| virtual int | getSubTickCount (double tickStep) |
| virtual QString | getTickLabel (double tick, const QLocale &locale, QChar formatChar, int precision) |
| virtual QVector< double > | createTickVector (double tickStep, const QCPRange &range) |
| virtual QVector< double > | createSubTickVector (int subTickCount, const QVector< double > &ticks) |
| virtual QVector< QString > | createLabelVector (const QVector< double > &ticks, const QLocale &locale, QChar formatChar, int precision) |
| void | trimTicks (const QCPRange &range, QVector< double > &ticks, bool keepOneOutlier) const |
| double | pickClosest (double target, const QVector< double > &candidates) const |
| double | getMantissa (double input, double *magnitude=0) const |
| double | cleanMantissa (double input) const |
The base class tick generator used by QCPAxis to create tick positions and tick labels.
+Each QCPAxis has an internal QCPAxisTicker (or a subclass) in order to generate tick positions and tick labels for the current axis range. The ticker of an axis can be set via QCPAxis::setTicker. Since that method takes a QSharedPointer<QCPAxisTicker>, multiple axes can share the same ticker instance.
This base class generates normal tick coordinates and numeric labels for linear axes. It picks a reasonable tick step (the separation between ticks) which results in readable tick labels. The number of ticks that should be approximately generated can be set via setTickCount. Depending on the current tick step strategy (setTickStepStrategy), the algorithm either sacrifices readability to better match the specified tick count (QCPAxisTicker::tssMeetTickCount) or relaxes the tick count in favor of better tick steps (QCPAxisTicker::tssReadability), which is the default.
+The following more specialized axis ticker subclasses are available, see details in the respective class documentation:
+| QCPAxisTickerFixed |
+
+
+ |
| QCPAxisTickerLog |
+
+
+ |
| QCPAxisTickerPi |
+
+
+ |
| QCPAxisTickerText |
+
+
+ |
| QCPAxisTickerDateTime |
+
+
+ |
| QCPAxisTickerTime |
+
+
+
+
+
+ |
Creating own axis tickers can be achieved very easily by sublassing QCPAxisTicker and reimplementing some or all of the available virtual methods.
+In the simplest case you might wish to just generate different tick steps than the other tickers, so you only reimplement the method getTickStep. If you additionally want control over the string that will be shown as tick label, reimplement getTickLabel.
+If you wish to have complete control, you can generate the tick vectors and tick label vectors yourself by reimplementing createTickVector and createLabelVector. The default implementations use the previously mentioned virtual methods getTickStep and getTickLabel, but your reimplementations don't necessarily need to do so. For example in the case of unequal tick steps, the method getTickStep loses its usefulness and can be ignored.
+The sub tick count between major ticks can be controlled with getSubTickCount. Full sub tick placement control is obtained by reimplementing createSubTickVector.
+See the documentation of all these virtual methods in QCPAxisTicker for detailed information about the parameters and expected return values.
+| enum QCPAxisTicker::TickStepStrategy | +
Defines the strategies that the axis ticker may follow when choosing the size of the tick step.
+| Enumerator | |
|---|---|
| tssReadability | A nicely readable tick step is prioritized over matching the requested number of ticks (see setTickCount) + |
| tssMeetTickCount | Less readable tick steps are allowed which in turn facilitates getting closer to the requested tick count. + |
| QCPAxisTicker::QCPAxisTicker | +( | +) | ++ |
Constructs the ticker and sets reasonable default values. Axis tickers are commonly created managed by a QSharedPointer, which then can be passed to QCPAxis::setTicker.
+ +| void QCPAxisTicker::setTickStepStrategy | +( | +QCPAxisTicker::TickStepStrategy | +strategy | ) | ++ |
Sets which strategy the axis ticker follows when choosing the size of the tick step. For the available strategies, see TickStepStrategy.
+ +| void QCPAxisTicker::setTickCount | +( | +int | +count | ) | ++ |
Sets how many ticks this ticker shall aim to generate across the axis range. Note that count is not guaranteed to be matched exactly, as generating readable tick intervals may conflict with the requested number of ticks.
+Whether the readability has priority over meeting the requested count can be specified with setTickStepStrategy.
+ +| void QCPAxisTicker::setTickOrigin | +( | +double | +origin | ) | ++ |
Sets the mathematical coordinate (or "offset") of the zeroth tick. This tick coordinate is just a concept and doesn't need to be inside the currently visible axis range.
+By default origin is zero, which for example yields ticks {-5, 0, 5, 10, 15,...} when the tick step is five. If origin is now set to 1 instead, the correspondingly generated ticks would be {-4, 1, 6, 11, 16,...}.
+ +
+
|
+ +virtual | +
This is the method called by QCPAxis in order to actually generate tick coordinates (ticks), tick label strings (tickLabels) and sub tick coordinates (subTicks).
+The ticks are generated for the specified range. The generated labels typically follow the specified locale, formatChar and number precision, however this might be different (or even irrelevant) for certain QCPAxisTicker subclasses.
+The output parameter ticks is filled with the generated tick positions in axis coordinates. The output parameters subTicks and tickLabels are optional (set them to 0 if not needed) and are respectively filled with sub tick coordinates, and tick label strings belonging to ticks by index.
+ +
+
|
+ +protectedvirtual | +
Takes the entire currently visible axis range and returns a sensible tick step in order to provide readable tick labels as well as a reasonable number of tick counts (see setTickCount, setTickStepStrategy).
+If a QCPAxisTicker subclass only wants a different tick step behaviour than the default implementation, it should reimplement this method. See cleanMantissa for a possible helper function.
+ +Reimplemented in QCPAxisTickerPi, QCPAxisTickerTime, QCPAxisTickerFixed, QCPAxisTickerDateTime, QCPAxisTickerText, and QCPAxisTickerLog.
+ +
+
|
+ +protectedvirtual | +
Takes the tickStep, i.e. the distance between two consecutive ticks, and returns an appropriate number of sub ticks for that specific tick step.
+Note that a returned sub tick count of e.g. 4 will split each tick interval into 5 sections.
+ +Reimplemented in QCPAxisTickerPi, QCPAxisTickerTime, QCPAxisTickerDateTime, QCPAxisTickerText, and QCPAxisTickerLog.
+ +
+
|
+ +protectedvirtual | +
This method returns the tick label string as it should be printed under the tick coordinate. If a textual number is returned, it should respect the provided locale, formatChar and precision.
+If the returned value contains exponentials of the form "2e5" and beautifully typeset powers is enabled in the QCPAxis number format (QCPAxis::setNumberFormat), the exponential part will be formatted accordingly using multiplication symbol and superscript during rendering of the label automatically.
+ +Reimplemented in QCPAxisTickerPi, QCPAxisTickerTime, QCPAxisTickerDateTime, and QCPAxisTickerText.
+ +
+
|
+ +protectedvirtual | +
Returns a vector containing all coordinates of ticks that should be drawn. The default implementation generates ticks with a spacing of tickStep (mathematically starting at the tick step origin, see setTickOrigin) distributed over the passed range.
+In order for the axis ticker to generate proper sub ticks, it is necessary that the first and last tick coordinates returned by this method are just below/above the provided range. Otherwise the outer intervals won't contain any sub ticks.
+If a QCPAxisTicker subclass needs maximal control over the generated ticks, it should reimplement this method. Depending on the purpose of the subclass it doesn't necessarily need to base its result on tickStep, e.g. when the ticks are spaced unequally like in the case of QCPAxisTickerLog.
+ +Reimplemented in QCPAxisTickerDateTime, QCPAxisTickerText, and QCPAxisTickerLog.
+ +
+
|
+ +protectedvirtual | +
Returns a vector containing all coordinates of sub ticks that should be drawn. It generates subTickCount sub ticks between each tick pair given in ticks.
+If a QCPAxisTicker subclass needs maximal control over the generated sub ticks, it should reimplement this method. Depending on the purpose of the subclass it doesn't necessarily need to base its result on subTickCount or ticks.
+ +
+
|
+ +protectedvirtual | +
Returns a vector containing all tick label strings corresponding to the tick coordinates provided in ticks. The default implementation calls getTickLabel to generate the respective strings.
+It is possible but uncommon for QCPAxisTicker subclasses to reimplement this method, as reimplementing getTickLabel often achieves the intended result easier.
+ +
+
|
+ +protected | +
Removes tick coordinates from ticks which lie outside the specified range. If keepOneOutlier is true, it preserves one tick just outside the range on both sides, if present.
+The passed ticks must be sorted in ascending order.
+ +
+
|
+ +protected | +
Returns the coordinate contained in candidates which is closest to the provided target.
+This method assumes candidates is not empty and sorted in ascending order.
+ +
+
|
+ +protected | +
Returns the decimal mantissa of input. Optionally, if magnitude is not set to zero, it also returns the magnitude of input as a power of 10.
+For example, an input of 142.6 will return a mantissa of 1.426 and a magnitude of 100.
+ +
+
|
+ +protected | +
Returns a number that is close to input but has a clean, easier human readable mantissa. How strongly the mantissa is altered, and thus how strong the result deviates from the original input, depends on the current tick step strategy (see setTickStepStrategy).
+ +Specialized axis ticker for calendar dates and times as axis ticks. + More...
+
+Public Functions | |
| QCPAxisTickerDateTime () | |
| +QString | dateTimeFormat () const |
| +Qt::TimeSpec | dateTimeSpec () const |
| void | setDateTimeFormat (const QString &format) |
| void | setDateTimeSpec (Qt::TimeSpec spec) |
| void | setTickOrigin (double origin) |
| void | setTickOrigin (const QDateTime &origin) |
Public Functions inherited from QCPAxisTicker | |
| QCPAxisTicker () | |
| +TickStepStrategy | tickStepStrategy () const |
| +int | tickCount () const |
| +double | tickOrigin () const |
| void | setTickStepStrategy (TickStepStrategy strategy) |
| void | setTickCount (int count) |
| void | setTickOrigin (double origin) |
| virtual void | generate (const QCPRange &range, const QLocale &locale, QChar formatChar, int precision, QVector< double > &ticks, QVector< double > *subTicks, QVector< QString > *tickLabels) |
+Static Public Functions | |
| static QDateTime | keyToDateTime (double key) |
| static double | dateTimeToKey (const QDateTime dateTime) |
| static double | dateTimeToKey (const QDate date) |
+Protected Types | |
| enum | DateStrategy |
+Protected Functions | |
| virtual double | getTickStep (const QCPRange &range) |
| virtual int | getSubTickCount (double tickStep) |
| virtual QString | getTickLabel (double tick, const QLocale &locale, QChar formatChar, int precision) |
| virtual QVector< double > | createTickVector (double tickStep, const QCPRange &range) |
Protected Functions inherited from QCPAxisTicker | |
| virtual QVector< double > | createSubTickVector (int subTickCount, const QVector< double > &ticks) |
| virtual QVector< QString > | createLabelVector (const QVector< double > &ticks, const QLocale &locale, QChar formatChar, int precision) |
| void | trimTicks (const QCPRange &range, QVector< double > &ticks, bool keepOneOutlier) const |
| double | pickClosest (double target, const QVector< double > &candidates) const |
| double | getMantissa (double input, double *magnitude=0) const |
| double | cleanMantissa (double input) const |
+Additional Inherited Members | |
Public Types inherited from QCPAxisTicker | |
| enum | TickStepStrategy |
Specialized axis ticker for calendar dates and times as axis ticks.
+
+This QCPAxisTicker subclass generates ticks that correspond to real calendar dates and times. The plot axis coordinate is interpreted as Unix Time, so seconds since Epoch (January 1, 1970, 00:00 UTC). This is also used for example by QDateTime in the toTime_t()/setTime_t() methods with a precision of one second. Since Qt 4.7, millisecond accuracy can be obtained from QDateTime by using QDateTime::fromMSecsSinceEpoch()/1000.0. The static methods dateTimeToKey and keyToDateTime conveniently perform this conversion achieving a precision of one millisecond on all Qt versions.
The format of the date/time display in the tick labels is controlled with setDateTimeFormat. If a different time spec (time zone) shall be used, see setDateTimeSpec.
+This ticker produces unequal tick spacing in order to provide intuitive date and time-of-day ticks. For example, if the axis range spans a few years such that there is one tick per year, ticks will be positioned on 1. January of every year. This is intuitive but, due to leap years, will result in slightly unequal tick intervals (visually unnoticeable). The same can be seen in the image above: even though the number of days varies month by month, this ticker generates ticks on the same day of each month.
+If you would like to change the date/time that is used as a (mathematical) starting date for the ticks, use the setTickOrigin(const QDateTime &origin) method overload, which takes a QDateTime. If you pass 15. July, 9:45 to this method, the yearly ticks will end up on 15. July at 9:45 of every year.
+The ticker can be created and assigned to an axis like this:
| QCPAxisTickerDateTime::QCPAxisTickerDateTime | +( | +) | ++ |
Constructs the ticker and sets reasonable default values. Axis tickers are commonly created managed by a QSharedPointer, which then can be passed to QCPAxis::setTicker.
+ +| void QCPAxisTickerDateTime::setDateTimeFormat | +( | +const QString & | +format | ) | ++ |
Sets the format in which dates and times are displayed as tick labels. For details about the format string, see the documentation of QDateTime::toString().
+Newlines can be inserted with "\n".
+| void QCPAxisTickerDateTime::setDateTimeSpec | +( | +Qt::TimeSpec | +spec | ) | ++ |
Sets the time spec that is used for creating the tick labels from corresponding dates/times.
+The default value of QDateTime objects (and also QCPAxisTickerDateTime) is Qt::LocalTime. However, if the date time values passed to QCustomPlot (e.g. in the form of axis ranges or keys of a plottable) are given in the UTC spec, set spec to Qt::UTC to get the correct axis labels.
| void QCPAxisTickerDateTime::setTickOrigin | +( | +double | +origin | ) | ++ |
Sets the tick origin (see QCPAxisTicker::setTickOrigin) in seconds since Epoch (1. Jan 1970, 00:00 UTC). For the date time ticker it might be more intuitive to use the overload which directly takes a QDateTime, see setTickOrigin(const QDateTime &origin).
+This is useful to define the month/day/time recurring at greater tick interval steps. For example, If you pass 15. July, 9:45 to this method and the tick interval happens to be one tick per year, the ticks will end up on 15. July at 9:45 of every year.
+ +| void QCPAxisTickerDateTime::setTickOrigin | +( | +const QDateTime & | +origin | ) | ++ |
Sets the tick origin (see QCPAxisTicker::setTickOrigin) as a QDateTime origin.
+This is useful to define the month/day/time recurring at greater tick interval steps. For example, If you pass 15. July, 9:45 to this method and the tick interval happens to be one tick per year, the ticks will end up on 15. July at 9:45 of every year.
+ +
+
|
+ +static | +
A convenience method which turns key (in seconds since Epoch 1. Jan 1970, 00:00 UTC) into a QDateTime object. This can be used to turn axis coordinates to actual QDateTimes.
+The accuracy achieved by this method is one millisecond, irrespective of the used Qt version (it works around the lack of a QDateTime::fromMSecsSinceEpoch in Qt 4.6)
+
+
|
+ +static | +
This is an overloaded function.
+A convenience method which turns a QDateTime object into a double value that corresponds to seconds since Epoch (1. Jan 1970, 00:00 UTC). This is the format used as axis coordinates by QCPAxisTickerDateTime.
+The accuracy achieved by this method is one millisecond, irrespective of the used Qt version (it works around the lack of a QDateTime::toMSecsSinceEpoch in Qt 4.6)
+
+
|
+ +static | +
This is an overloaded function.
+A convenience method which turns a QDate object into a double value that corresponds to seconds since Epoch (1. Jan 1970, 00:00 UTC). This is the format used as axis coordinates by QCPAxisTickerDateTime.
+
+
|
+ +protectedvirtual | +
Returns a sensible tick step with intervals appropriate for a date-time-display, such as weekly, monthly, bi-monthly, etc.
+Note that this tick step isn't used exactly when generating the tick vector in createTickVector, but only as a guiding value requiring some correction for each individual tick interval. Otherwise this would lead to unintuitive date displays, e.g. jumping between first day in the month to the last day in the previous month from tick to tick, due to the non-uniform length of months. The same problem arises with leap years.
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPAxisTicker.
+ +
+
|
+ +protectedvirtual | +
Returns a sensible sub tick count with intervals appropriate for a date-time-display, such as weekly, monthly, bi-monthly, etc.
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPAxisTicker.
+ +
+
|
+ +protectedvirtual | +
Generates a date/time tick label for tick coordinate tick, based on the currently set format (setDateTimeFormat) and time spec (setDateTimeSpec).
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPAxisTicker.
+ +
+
|
+ +protectedvirtual | +
Uses the passed tickStep as a guiding value and applies corrections in order to obtain non-uniform tick intervals but intuitive tick labels, e.g. falling on the same day of each month.
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPAxisTicker.
+ +Specialized axis ticker with a fixed tick step. + More...
+
+Public Types | |
| enum | ScaleStrategy |
Public Types inherited from QCPAxisTicker | |
| enum | TickStepStrategy |
+Public Functions | |
| QCPAxisTickerFixed () | |
| +double | tickStep () const |
| +ScaleStrategy | scaleStrategy () const |
| void | setTickStep (double step) |
| void | setScaleStrategy (ScaleStrategy strategy) |
Public Functions inherited from QCPAxisTicker | |
| QCPAxisTicker () | |
| +TickStepStrategy | tickStepStrategy () const |
| +int | tickCount () const |
| +double | tickOrigin () const |
| void | setTickStepStrategy (TickStepStrategy strategy) |
| void | setTickCount (int count) |
| void | setTickOrigin (double origin) |
| virtual void | generate (const QCPRange &range, const QLocale &locale, QChar formatChar, int precision, QVector< double > &ticks, QVector< double > *subTicks, QVector< QString > *tickLabels) |
+Protected Functions | |
| virtual double | getTickStep (const QCPRange &range) |
Protected Functions inherited from QCPAxisTicker | |
| virtual int | getSubTickCount (double tickStep) |
| virtual QString | getTickLabel (double tick, const QLocale &locale, QChar formatChar, int precision) |
| virtual QVector< double > | createTickVector (double tickStep, const QCPRange &range) |
| virtual QVector< double > | createSubTickVector (int subTickCount, const QVector< double > &ticks) |
| virtual QVector< QString > | createLabelVector (const QVector< double > &ticks, const QLocale &locale, QChar formatChar, int precision) |
| void | trimTicks (const QCPRange &range, QVector< double > &ticks, bool keepOneOutlier) const |
| double | pickClosest (double target, const QVector< double > &candidates) const |
| double | getMantissa (double input, double *magnitude=0) const |
| double | cleanMantissa (double input) const |
Specialized axis ticker with a fixed tick step.
+
+This QCPAxisTicker subclass generates ticks with a fixed tick step set with setTickStep. It is also possible to allow integer multiples and integer powers of the specified tick step with setScaleStrategy.
+A typical application of this ticker is to make an axis only display integers, by setting the tick step of the ticker to 1.0 and the scale strategy to ssMultiples.
+Another case is when a certain number has a special meaning and axis ticks should only appear at multiples of that value. In this case you might also want to consider QCPAxisTickerPi because despite the name it is not limited to only pi symbols/values.
+The ticker can be created and assigned to an axis like this:
| enum QCPAxisTickerFixed::ScaleStrategy | +
Defines how the axis ticker may modify the specified tick step (setTickStep) in order to control the number of ticks in the axis range.
+| Enumerator | |
|---|---|
| ssNone | Modifications are not allowed, the specified tick step is absolutely fixed. This might cause a high tick density and overlapping labels if the axis range is zoomed out. + |
| ssMultiples | An integer multiple of the specified tick step is allowed. The used factor follows the base class properties of setTickStepStrategy and setTickCount. + |
| ssPowers | An integer power of the specified tick step is allowed. + |
| QCPAxisTickerFixed::QCPAxisTickerFixed | +( | +) | ++ |
Constructs the ticker and sets reasonable default values. Axis tickers are commonly created managed by a QSharedPointer, which then can be passed to QCPAxis::setTicker.
+ +| void QCPAxisTickerFixed::setTickStep | +( | +double | +step | ) | ++ |
Sets the fixed tick interval to step.
+The axis ticker will only use this tick step when generating axis ticks. This might cause a very high tick density and overlapping labels if the axis range is zoomed out. Using setScaleStrategy it is possible to relax the fixed step and also allow multiples or powers of step. This will enable the ticker to reduce the number of ticks to a reasonable amount (see setTickCount).
+ +| void QCPAxisTickerFixed::setScaleStrategy | +( | +QCPAxisTickerFixed::ScaleStrategy | +strategy | ) | ++ |
Sets whether the specified tick step (setTickStep) is absolutely fixed or whether modifications may be applied to it before calculating the finally used tick step, such as permitting multiples or powers. See ScaleStrategy for details.
+The default strategy is ssNone, which means the tick step is absolutely fixed.
+ +
+
|
+ +protectedvirtual | +
Determines the actually used tick step from the specified tick step and scale strategy (setTickStep, setScaleStrategy).
+This method either returns the specified tick step exactly, or, if the scale strategy is not ssNone, a modification of it to allow varying the number of ticks in the current axis range.
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPAxisTicker.
+ +Specialized axis ticker suited for logarithmic axes. + More...
+
+Public Functions | |
| QCPAxisTickerLog () | |
| +double | logBase () const |
| +int | subTickCount () const |
| void | setLogBase (double base) |
| void | setSubTickCount (int subTicks) |
Public Functions inherited from QCPAxisTicker | |
| QCPAxisTicker () | |
| +TickStepStrategy | tickStepStrategy () const |
| +int | tickCount () const |
| +double | tickOrigin () const |
| void | setTickStepStrategy (TickStepStrategy strategy) |
| void | setTickCount (int count) |
| void | setTickOrigin (double origin) |
| virtual void | generate (const QCPRange &range, const QLocale &locale, QChar formatChar, int precision, QVector< double > &ticks, QVector< double > *subTicks, QVector< QString > *tickLabels) |
+Protected Functions | |
| virtual double | getTickStep (const QCPRange &range) |
| virtual int | getSubTickCount (double tickStep) |
| virtual QVector< double > | createTickVector (double tickStep, const QCPRange &range) |
Protected Functions inherited from QCPAxisTicker | |
| virtual QString | getTickLabel (double tick, const QLocale &locale, QChar formatChar, int precision) |
| virtual QVector< double > | createSubTickVector (int subTickCount, const QVector< double > &ticks) |
| virtual QVector< QString > | createLabelVector (const QVector< double > &ticks, const QLocale &locale, QChar formatChar, int precision) |
| void | trimTicks (const QCPRange &range, QVector< double > &ticks, bool keepOneOutlier) const |
| double | pickClosest (double target, const QVector< double > &candidates) const |
| double | getMantissa (double input, double *magnitude=0) const |
| double | cleanMantissa (double input) const |
+Additional Inherited Members | |
Public Types inherited from QCPAxisTicker | |
| enum | TickStepStrategy |
Specialized axis ticker suited for logarithmic axes.
+
+This QCPAxisTicker subclass generates ticks with unequal tick intervals suited for logarithmic axis scales. The ticks are placed at powers of the specified log base (setLogBase).
+Especially in the case of a log base equal to 10 (the default), it might be desirable to have tick labels in the form of powers of ten without mantissa display. To achieve this, set the number precision (QCPAxis::setNumberPrecision) to zero and the number format (QCPAxis::setNumberFormat) to scientific (exponential) display with beautifully typeset decimal powers, so a format string of "eb". This will result in the following axis tick labels:
+The ticker can be created and assigned to an axis like this:
| QCPAxisTickerLog::QCPAxisTickerLog | +( | +) | ++ |
Constructs the ticker and sets reasonable default values. Axis tickers are commonly created managed by a QSharedPointer, which then can be passed to QCPAxis::setTicker.
+ +| void QCPAxisTickerLog::setLogBase | +( | +double | +base | ) | ++ |
Sets the logarithm base used for tick coordinate generation. The ticks will be placed at integer powers of base.
+ +| void QCPAxisTickerLog::setSubTickCount | +( | +int | +subTicks | ) | ++ |
Sets the number of sub ticks in a tick interval. Within each interval, the sub ticks are spaced linearly to provide a better visual guide, so the sub tick density increases toward the higher tick.
+Note that subTicks is the number of sub ticks (not sub intervals) in one tick interval. So in the case of logarithm base 10 an intuitive sub tick spacing would be achieved with eight sub ticks (the default). This means e.g. between the ticks 10 and 100 there will be eight ticks, namely at 20, 30, 40, 50, 60, 70, 80 and 90.
+ +
+
|
+ +protectedvirtual | +
Since logarithmic tick steps are necessarily different for each tick interval, this method does nothing in the case of QCPAxisTickerLog
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPAxisTicker.
+ +
+
|
+ +protectedvirtual | +
Returns the sub tick count specified in setSubTickCount. For QCPAxisTickerLog, there is no automatic sub tick count calculation necessary.
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPAxisTicker.
+ +
+
|
+ +protectedvirtual | +
Creates ticks with a spacing given by the logarithm base and an increasing integer power in the provided range. The step in which the power increases tick by tick is chosen in order to keep the total number of ticks as close as possible to the tick count (setTickCount). The parameter tickStep is ignored for QCPAxisTickerLog
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPAxisTicker.
+ +Specialized axis ticker to display ticks in units of an arbitrary constant, for example pi. + More...
+
+Public Types | |
| enum | FractionStyle |
Public Types inherited from QCPAxisTicker | |
| enum | TickStepStrategy |
+Public Functions | |
| QCPAxisTickerPi () | |
| +QString | piSymbol () const |
| +double | piValue () const |
| +bool | periodicity () const |
| +FractionStyle | fractionStyle () const |
| void | setPiSymbol (QString symbol) |
| void | setPiValue (double pi) |
| void | setPeriodicity (int multiplesOfPi) |
| void | setFractionStyle (FractionStyle style) |
Public Functions inherited from QCPAxisTicker | |
| QCPAxisTicker () | |
| +TickStepStrategy | tickStepStrategy () const |
| +int | tickCount () const |
| +double | tickOrigin () const |
| void | setTickStepStrategy (TickStepStrategy strategy) |
| void | setTickCount (int count) |
| void | setTickOrigin (double origin) |
| virtual void | generate (const QCPRange &range, const QLocale &locale, QChar formatChar, int precision, QVector< double > &ticks, QVector< double > *subTicks, QVector< QString > *tickLabels) |
+Protected Functions | |
| virtual double | getTickStep (const QCPRange &range) |
| virtual int | getSubTickCount (double tickStep) |
| virtual QString | getTickLabel (double tick, const QLocale &locale, QChar formatChar, int precision) |
| void | simplifyFraction (int &numerator, int &denominator) const |
| QString | fractionToString (int numerator, int denominator) const |
| QString | unicodeFraction (int numerator, int denominator) const |
| QString | unicodeSuperscript (int number) const |
| QString | unicodeSubscript (int number) const |
Protected Functions inherited from QCPAxisTicker | |
| virtual QVector< double > | createTickVector (double tickStep, const QCPRange &range) |
| virtual QVector< double > | createSubTickVector (int subTickCount, const QVector< double > &ticks) |
| virtual QVector< QString > | createLabelVector (const QVector< double > &ticks, const QLocale &locale, QChar formatChar, int precision) |
| void | trimTicks (const QCPRange &range, QVector< double > &ticks, bool keepOneOutlier) const |
| double | pickClosest (double target, const QVector< double > &candidates) const |
| double | getMantissa (double input, double *magnitude=0) const |
| double | cleanMantissa (double input) const |
Specialized axis ticker to display ticks in units of an arbitrary constant, for example pi.
+
+This QCPAxisTicker subclass generates ticks that are expressed with respect to a given symbolic constant with a numerical value specified with setPiValue and an appearance in the tick labels specified with setPiSymbol.
+Ticks may be generated at fractions of the symbolic constant. How these fractions appear in the tick label can be configured with setFractionStyle.
+The ticker can be created and assigned to an axis like this:
| enum QCPAxisTickerPi::FractionStyle | +
Defines how fractions should be displayed in tick labels.
+| QCPAxisTickerPi::QCPAxisTickerPi | +( | +) | ++ |
Constructs the ticker and sets reasonable default values. Axis tickers are commonly created managed by a QSharedPointer, which then can be passed to QCPAxis::setTicker.
+ +| void QCPAxisTickerPi::setPiSymbol | +( | +QString | +symbol | ) | ++ |
Sets how the symbol part (which is always a suffix to the number) shall appear in the axis tick label.
+If a space shall appear between the number and the symbol, make sure the space is contained in symbol.
+ +| void QCPAxisTickerPi::setPiValue | +( | +double | +pi | ) | ++ |
Sets the numerical value that the symbolic constant has.
+This will be used to place the appropriate fractions of the symbol at the respective axis coordinates.
+ +| void QCPAxisTickerPi::setPeriodicity | +( | +int | +multiplesOfPi | ) | ++ |
Sets whether the axis labels shall appear periodicly and if so, at which multiplicity of the symbolic constant.
+To disable periodicity, set multiplesOfPi to zero.
+For example, an axis that identifies 0 with 2pi would set multiplesOfPi to two.
+ +| void QCPAxisTickerPi::setFractionStyle | +( | +QCPAxisTickerPi::FractionStyle | +style | ) | ++ |
Sets how the numerical/fractional part preceding the symbolic constant is displayed in tick labels. See FractionStyle for the various options.
+ +
+
|
+ +protectedvirtual | +
Returns the tick step, using the constant's value (setPiValue) as base unit. In consequence the numerical/fractional part preceding the symbolic constant is made to have a readable mantissa.
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPAxisTicker.
+ +
+
|
+ +protectedvirtual | +
Returns the sub tick count, using the constant's value (setPiValue) as base unit. In consequence the sub ticks divide the numerical/fractional part preceding the symbolic constant reasonably, and not the total tick coordinate.
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPAxisTicker.
+ +
+
|
+ +protectedvirtual | +
Returns the tick label as a fractional/numerical part and a symbolic string as suffix. The formatting of the fraction is done according to the specified setFractionStyle. The appended symbol is specified with setPiSymbol.
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPAxisTicker.
+ +
+
|
+ +protected | +
Takes the fraction given by numerator and denominator and modifies the values to make sure the fraction is in irreducible form, i.e. numerator and denominator don't share any common factors which could be cancelled.
+ +
+
|
+ +protected | +
Takes the fraction given by numerator and denominator and returns a string representation. The result depends on the configured fraction style (setFractionStyle).
+This method is used to format the numerical/fractional part when generating tick labels. It simplifies the passed fraction to an irreducible form using simplifyFraction and factors out any integer parts of the fraction (e.g. "10/4" becomes "2 1/2").
+ +
+
|
+ +protected | +
Returns the unicode string representation of the fraction given by numerator and denominator. This is the representation used in fractionToString when the fraction style (setFractionStyle) is fsUnicodeFractions.
+This method doesn't use the single-character common fractions but builds each fraction from a superscript unicode number, the unicode fraction character, and a subscript unicode number.
+ +
+
|
+ +protected | +
Returns the unicode string representing number as superscript. This is used to build unicode fractions in unicodeFraction.
+ +
+
|
+ +protected | +
Returns the unicode string representing number as subscript. This is used to build unicode fractions in unicodeFraction.
+ +Specialized axis ticker which allows arbitrary labels at specified coordinates. + More...
+
+Public Functions | |
| QCPAxisTickerText () | |
| QMap< double, QString > & | ticks () |
| +int | subTickCount () const |
| void | setTicks (const QMap< double, QString > &ticks) |
| void | setTicks (const QVector< double > &positions, const QVector< QString > &labels) |
| void | setSubTickCount (int subTicks) |
| void | clear () |
| void | addTick (double position, const QString &label) |
| void | addTicks (const QMap< double, QString > &ticks) |
| void | addTicks (const QVector< double > &positions, const QVector< QString > &labels) |
Public Functions inherited from QCPAxisTicker | |
| QCPAxisTicker () | |
| +TickStepStrategy | tickStepStrategy () const |
| +int | tickCount () const |
| +double | tickOrigin () const |
| void | setTickStepStrategy (TickStepStrategy strategy) |
| void | setTickCount (int count) |
| void | setTickOrigin (double origin) |
| virtual void | generate (const QCPRange &range, const QLocale &locale, QChar formatChar, int precision, QVector< double > &ticks, QVector< double > *subTicks, QVector< QString > *tickLabels) |
+Protected Functions | |
| virtual double | getTickStep (const QCPRange &range) |
| virtual int | getSubTickCount (double tickStep) |
| virtual QString | getTickLabel (double tick, const QLocale &locale, QChar formatChar, int precision) |
| virtual QVector< double > | createTickVector (double tickStep, const QCPRange &range) |
Protected Functions inherited from QCPAxisTicker | |
| virtual QVector< double > | createSubTickVector (int subTickCount, const QVector< double > &ticks) |
| virtual QVector< QString > | createLabelVector (const QVector< double > &ticks, const QLocale &locale, QChar formatChar, int precision) |
| void | trimTicks (const QCPRange &range, QVector< double > &ticks, bool keepOneOutlier) const |
| double | pickClosest (double target, const QVector< double > &candidates) const |
| double | getMantissa (double input, double *magnitude=0) const |
| double | cleanMantissa (double input) const |
+Additional Inherited Members | |
Public Types inherited from QCPAxisTicker | |
| enum | TickStepStrategy |
Specialized axis ticker which allows arbitrary labels at specified coordinates.
+
+This QCPAxisTicker subclass generates ticks which can be directly specified by the user as coordinates and associated strings. They can be passed as a whole with setTicks or one at a time with addTick. Alternatively you can directly access the internal storage via ticks and modify the tick/label data there.
+This is useful for cases where the axis represents categories rather than numerical values.
+If you are updating the ticks of this ticker regularly and in a dynamic fasion (e.g. dependent on the axis range), it is a sign that you should probably create an own ticker by subclassing QCPAxisTicker, instead of using this one.
+The ticker can be created and assigned to an axis like this:
| QCPAxisTickerText::QCPAxisTickerText | +( | +) | ++ |
Constructs the ticker and sets reasonable default values. Axis tickers are commonly created managed by a QSharedPointer, which then can be passed to QCPAxis::setTicker.
+ +
+
|
+ +inline | +
Returns a non-const reference to the internal map which stores the tick coordinates and their labels.
+You can access the map directly in order to add, remove or manipulate ticks, as an alternative to using the methods provided by QCPAxisTickerText, such as setTicks and addTick.
+ +| void QCPAxisTickerText::setTicks | +( | +const QMap< double, QString > & | +ticks | ) | ++ |
This is an overloaded function.
+Sets the ticks that shall appear on the axis. The map key of ticks corresponds to the axis coordinate, and the map value is the string that will appear as tick label.
+An alternative to manipulate ticks is to directly access the internal storage with the ticks getter.
+ + +| void QCPAxisTickerText::setTicks | +( | +const QVector< double > & | +positions, | +
| + | + | const QVector< QString > & | +labels | +
| + | ) | ++ |
| void QCPAxisTickerText::setSubTickCount | +( | +int | +subTicks | ) | ++ |
Sets the number of sub ticks that shall appear between ticks. For QCPAxisTickerText, there is no automatic sub tick count calculation. So if sub ticks are needed, they must be configured with this method.
+ +| void QCPAxisTickerText::clear | +( | +) | ++ |
| void QCPAxisTickerText::addTick | +( | +double | +position, | +
| + | + | const QString & | +label | +
| + | ) | ++ |
| void QCPAxisTickerText::addTicks | +( | +const QMap< double, QString > & | +ticks | ) | ++ |
This is an overloaded function.
+Adds the provided ticks to the ones already existing. The map key of ticks corresponds to the axis coordinate, and the map value is the string that will appear as tick label.
+An alternative to manipulate ticks is to directly access the internal storage with the ticks getter.
+ + +| void QCPAxisTickerText::addTicks | +( | +const QVector< double > & | +positions, | +
| + | + | const QVector< QString > & | +labels | +
| + | ) | ++ |
This is an overloaded function.
+Adds the provided ticks to the ones already existing. The entries of positions correspond to the axis coordinates, and the entries of labels are the respective strings that will appear as tick labels.
+An alternative to manipulate ticks is to directly access the internal storage with the ticks getter.
+ + +
+
|
+ +protectedvirtual | +
Since the tick coordinates are provided externally, this method implementation does nothing.
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPAxisTicker.
+ +
+
|
+ +protectedvirtual | +
Returns the sub tick count that was configured with setSubTickCount.
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPAxisTicker.
+ +
+
|
+ +protectedvirtual | +
Returns the tick label which corresponds to the key tick in the internal tick storage. Since the labels are provided externally, locale, formatChar, and precision are ignored.
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPAxisTicker.
+ +
+
|
+ +protectedvirtual | +
Returns the externally provided tick coordinates which are in the specified range. If available, one tick above and below the range is provided in addition, to allow possible sub tick calculation. The parameter tickStep is ignored.
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPAxisTicker.
+ +Specialized axis ticker for time spans in units of milliseconds to days. + More...
+
+Public Types | |
| enum | TimeUnit |
Public Types inherited from QCPAxisTicker | |
| enum | TickStepStrategy |
+Public Functions | |
| QCPAxisTickerTime () | |
| +QString | timeFormat () const |
| +int | fieldWidth (TimeUnit unit) const |
| void | setTimeFormat (const QString &format) |
| void | setFieldWidth (TimeUnit unit, int width) |
Public Functions inherited from QCPAxisTicker | |
| QCPAxisTicker () | |
| +TickStepStrategy | tickStepStrategy () const |
| +int | tickCount () const |
| +double | tickOrigin () const |
| void | setTickStepStrategy (TickStepStrategy strategy) |
| void | setTickCount (int count) |
| void | setTickOrigin (double origin) |
| virtual void | generate (const QCPRange &range, const QLocale &locale, QChar formatChar, int precision, QVector< double > &ticks, QVector< double > *subTicks, QVector< QString > *tickLabels) |
+Protected Functions | |
| virtual double | getTickStep (const QCPRange &range) |
| virtual int | getSubTickCount (double tickStep) |
| virtual QString | getTickLabel (double tick, const QLocale &locale, QChar formatChar, int precision) |
| void | replaceUnit (QString &text, TimeUnit unit, int value) const |
Protected Functions inherited from QCPAxisTicker | |
| virtual QVector< double > | createTickVector (double tickStep, const QCPRange &range) |
| virtual QVector< double > | createSubTickVector (int subTickCount, const QVector< double > &ticks) |
| virtual QVector< QString > | createLabelVector (const QVector< double > &ticks, const QLocale &locale, QChar formatChar, int precision) |
| void | trimTicks (const QCPRange &range, QVector< double > &ticks, bool keepOneOutlier) const |
| double | pickClosest (double target, const QVector< double > &candidates) const |
| double | getMantissa (double input, double *magnitude=0) const |
| double | cleanMantissa (double input) const |
Specialized axis ticker for time spans in units of milliseconds to days.
+
+This QCPAxisTicker subclass generates ticks that corresponds to time intervals.
+The format of the time display in the tick labels is controlled with setTimeFormat and setFieldWidth. The time coordinate is in the unit of seconds with respect to the time coordinate zero. Unlike with QCPAxisTickerDateTime, the ticks don't correspond to a specific calendar date and time.
+The time can be displayed in milliseconds, seconds, minutes, hours and days. Depending on the largest available unit in the format specified with setTimeFormat, any time spans above will be carried in that largest unit. So for example if the format string is "%m:%s" and a tick at coordinate value 7815 (being 2 hours, 10 minutes and 15 seconds) is created, the resulting tick label will show "130:15" (130 minutes, 15 seconds). If the format string is "%h:%m:%s", the hour unit will be used and the label will thus be "02:10:15". Negative times with respect to the axis zero will carry a leading minus sign.
+The ticker can be created and assigned to an axis like this:
Here is an example of a time axis providing time information in days, hours and minutes. Due to the axis range spanning a few days and the wanted tick count (setTickCount), the ticker decided to use tick steps of 12 hours:
+
+The format string for this example is
| enum QCPAxisTickerTime::TimeUnit | +
Defines the logical units in which fractions of time spans can be expressed.
+| Enumerator | |
|---|---|
| tuMilliseconds | Milliseconds, one thousandth of a second (%z in setTimeFormat) + |
| tuSeconds | Seconds (%s in setTimeFormat) + |
| tuMinutes | Minutes (%m in setTimeFormat) + |
| tuHours | Hours (%h in setTimeFormat) + |
| tuDays | Days (%d in setTimeFormat) + |
| QCPAxisTickerTime::QCPAxisTickerTime | +( | +) | ++ |
Constructs the ticker and sets reasonable default values. Axis tickers are commonly created managed by a QSharedPointer, which then can be passed to QCPAxis::setTicker.
+ +| void QCPAxisTickerTime::setTimeFormat | +( | +const QString & | +format | ) | ++ |
Sets the format that will be used to display time in the tick labels.
+The available patterns are:
The field width (zero padding) can be controlled for each unit with setFieldWidth.
+The largest unit that appears in format will carry all the remaining time of a certain tick coordinate, even if it overflows the natural limit of the unit. For example, if %m is the largest unit it might become larger than 59 in order to consume larger time values. If on the other hand %h is available, the minutes will wrap around to zero after 59 and the time will carry to the hour digit.
+ +| void QCPAxisTickerTime::setFieldWidth | +( | +QCPAxisTickerTime::TimeUnit | +unit, | +
| + | + | int | +width | +
| + | ) | ++ |
Sets the field widh of the specified unit to be width digits, when displayed in the tick label. If the number for the specific unit is shorter than width, it will be padded with an according number of zeros to the left in order to reach the field width.
+
+
|
+ +protectedvirtual | +
Returns the tick step appropriate for time displays, depending on the provided range and the smallest available time unit in the current format (setTimeFormat). For example if the unit of seconds isn't available in the format, this method will not generate steps (like 2.5 minutes) that require sub-minute precision to be displayed correctly.
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPAxisTicker.
+ +
+
|
+ +protectedvirtual | +
Returns the sub tick count appropriate for the provided tickStep and time displays.
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPAxisTicker.
+ +
+
|
+ +protectedvirtual | +
Returns the tick label corresponding to the provided tick and the configured format and field widths (setTimeFormat, setFieldWidth).
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPAxisTicker.
+ +
+
|
+ +protected | +
Replaces all occurrences of the format pattern belonging to unit in text with the specified value, using the field width as specified with setFieldWidth for the unit.
+ +A plottable representing a bar chart in a plot. + More...
+
+Public Types | |
| enum | WidthType |
+Public Functions | |
| QCPBars (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
| +double | width () const |
| +WidthType | widthType () const |
| +QCPBarsGroup * | barsGroup () const |
| +double | baseValue () const |
| +double | stackingGap () const |
| QCPBars * | barBelow () const |
| QCPBars * | barAbove () const |
| QSharedPointer< QCPBarsDataContainer > | data () const |
| void | setData (QSharedPointer< QCPBarsDataContainer > data) |
| void | setData (const QVector< double > &keys, const QVector< double > &values, bool alreadySorted=false) |
| void | setWidth (double width) |
| void | setWidthType (WidthType widthType) |
| void | setBarsGroup (QCPBarsGroup *barsGroup) |
| void | setBaseValue (double baseValue) |
| void | setStackingGap (double pixels) |
| void | addData (const QVector< double > &keys, const QVector< double > &values, bool alreadySorted=false) |
| void | addData (double key, double value) |
| void | moveBelow (QCPBars *bars) |
| void | moveAbove (QCPBars *bars) |
| virtual QCPDataSelection | selectTestRect (const QRectF &rect, bool onlySelectable) const |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
| virtual QCPRange | getKeyRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const |
| virtual QCPRange | getValueRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const |
| virtual QPointF | dataPixelPosition (int index) const |
Public Functions inherited from QCPAbstractPlottable1D< QCPBarsData > | |
| QCPAbstractPlottable1D (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
| virtual int | dataCount () const |
| virtual double | dataMainKey (int index) const |
| virtual double | dataSortKey (int index) const |
| virtual double | dataMainValue (int index) const |
| virtual QCPRange | dataValueRange (int index) const |
| virtual bool | sortKeyIsMainKey () const |
| virtual int | findBegin (double sortKey, bool expandedRange=true) const |
| virtual int | findEnd (double sortKey, bool expandedRange=true) const |
| virtual QCPPlottableInterface1D * | interface1D () |
Public Functions inherited from QCPAbstractPlottable | |
| QCPAbstractPlottable (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
| +QString | name () const |
| +bool | antialiasedFill () const |
| +bool | antialiasedScatters () const |
| +QPen | pen () const |
| +QBrush | brush () const |
| +QCPAxis * | keyAxis () const |
| +QCPAxis * | valueAxis () const |
| +QCP::SelectionType | selectable () const |
| bool | selected () const |
| QCPDataSelection | selection () const |
| QCPSelectionDecorator * | selectionDecorator () const |
| void | setName (const QString &name) |
| void | setAntialiasedFill (bool enabled) |
| void | setAntialiasedScatters (bool enabled) |
| void | setPen (const QPen &pen) |
| void | setBrush (const QBrush &brush) |
| void | setKeyAxis (QCPAxis *axis) |
| void | setValueAxis (QCPAxis *axis) |
| Q_SLOT void | setSelectable (QCP::SelectionType selectable) |
| Q_SLOT void | setSelection (QCPDataSelection selection) |
| void | setSelectionDecorator (QCPSelectionDecorator *decorator) |
| void | coordsToPixels (double key, double value, double &x, double &y) const |
| const QPointF | coordsToPixels (double key, double value) const |
| void | pixelsToCoords (double x, double y, double &key, double &value) const |
| void | pixelsToCoords (const QPointF &pixelPos, double &key, double &value) const |
| void | rescaleAxes (bool onlyEnlarge=false) const |
| void | rescaleKeyAxis (bool onlyEnlarge=false) const |
| void | rescaleValueAxis (bool onlyEnlarge=false, bool inKeyRange=false) const |
| bool | addToLegend (QCPLegend *legend) |
| bool | addToLegend () |
| bool | removeFromLegend (QCPLegend *legend) const |
| bool | removeFromLegend () const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Protected Functions | |
| virtual void | draw (QCPPainter *painter) |
| virtual void | drawLegendIcon (QCPPainter *painter, const QRectF &rect) const |
| void | getVisibleDataBounds (QCPBarsDataContainer::const_iterator &begin, QCPBarsDataContainer::const_iterator &end) const |
| QRectF | getBarRect (double key, double value) const |
| void | getPixelWidth (double key, double &lower, double &upper) const |
| double | getStackedBaseValue (double key, bool positive) const |
Protected Functions inherited from QCPAbstractPlottable1D< QCPBarsData > | |
| void | getDataSegments (QList< QCPDataRange > &selectedSegments, QList< QCPDataRange > &unselectedSegments) const |
| void | drawPolyline (QCPPainter *painter, const QVector< QPointF > &lineData) const |
Protected Functions inherited from QCPAbstractPlottable | |
| virtual QRect | clipRect () const |
| virtual QCP::Interaction | selectionCategory () const |
| void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| void | applyFillAntialiasingHint (QCPPainter *painter) const |
| void | applyScattersAntialiasingHint (QCPPainter *painter) const |
Protected Functions inherited from QCPLayerable | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Protected Static Functions | |
| static void | connectBars (QCPBars *lower, QCPBars *upper) |
+Additional Inherited Members | |
Signals inherited from QCPAbstractPlottable | |
| void | selectionChanged (bool selected) |
| void | selectionChanged (const QCPDataSelection &selection) |
| void | selectableChanged (QCP::SelectionType selectable) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
A plottable representing a bar chart in a plot.
+
+To plot data, assign it with the setData or addData functions.
+The appearance of the bars is determined by the pen and the brush (setPen, setBrush). The width of the individual bars can be controlled with setWidthType and setWidth.
+Bar charts are stackable. This means, two QCPBars plottables can be placed on top of each other (see QCPBars::moveAbove). So when two bars are at the same key position, they will appear stacked.
+If you would like to group multiple QCPBars plottables together so they appear side by side as shown below, use QCPBarsGroup.
+
+Like all data representing objects in QCustomPlot, the QCPBars is a plottable (QCPAbstractPlottable). So the plottable-interface of QCustomPlot applies (QCustomPlot::plottable, QCustomPlot::removePlottable, etc.)
+Usually, you first create an instance:
which registers it with the QCustomPlot instance of the passed axes. Note that this QCustomPlot instance takes ownership of the plottable, so do not delete it manually but use QCustomPlot::removePlottable() instead. The newly created plottable can be modified, e.g.:
| enum QCPBars::WidthType | +
Defines the ways the width of the bar can be specified. Thus it defines what the number passed to setWidth actually means.
+
+
|
+ +explicit | +
Constructs a bar chart which uses keyAxis as its key axis ("x") and valueAxis as its value axis ("y"). keyAxis and valueAxis must reside in the same QCustomPlot instance and not have the same orientation. If either of these restrictions is violated, a corresponding message is printed to the debug output (qDebug), the construction is not aborted, though.
+The created QCPBars is automatically registered with the QCustomPlot instance inferred from keyAxis. This QCustomPlot instance takes ownership of the QCPBars, so do not delete it manually but use QCustomPlot::removePlottable() instead.
+ +
+
|
+ +inline | +
+
|
+ +inline | +
+
|
+ +inline | +
Returns a shared pointer to the internal data storage of type QCPBarsDataContainer. You may use it to directly manipulate the data, which may be more convenient and faster than using the regular setData or addData methods.
+ +| void QCPBars::setData | +( | +QSharedPointer< QCPBarsDataContainer > | +data | ) | ++ |
This is an overloaded function.
+Replaces the current data container with the provided data container.
+Since a QSharedPointer is used, multiple QCPBars may share the same data container safely. Modifying the data in the container will then affect all bars that share the container. Sharing can be achieved by simply exchanging the data containers wrapped in shared pointers:
If you do not wish to share containers, but create a copy from an existing container, rather use the QCPDataContainer<DataType>::set method on the bar's data container directly:
| void QCPBars::setData | +( | +const QVector< double > & | +keys, | +
| + | + | const QVector< double > & | +values, | +
| + | + | bool | +alreadySorted = false |
+
| + | ) | ++ |
This is an overloaded function.
+Replaces the current data with the provided points in keys and values. The provided vectors should have equal length. Else, the number of added points will be the size of the smallest vector.
+If you can guarantee that the passed data points are sorted by keys in ascending order, you can set alreadySorted to true, to improve performance by saving a sorting run.
+| void QCPBars::setWidth | +( | +double | +width | ) | ++ |
Sets the width of the bars.
+How the number passed as width is interpreted (e.g. screen pixels, plot coordinates,...), depends on the currently set width type, see setWidthType and WidthType.
+ +| void QCPBars::setWidthType | +( | +QCPBars::WidthType | +widthType | ) | ++ |
Sets how the width of the bars is defined. See the documentation of WidthType for an explanation of the possible values for widthType.
+The default value is wtPlotCoords.
+| void QCPBars::setBarsGroup | +( | +QCPBarsGroup * | +barsGroup | ) | ++ |
Sets to which QCPBarsGroup this QCPBars instance belongs to. Alternatively, you can also use QCPBarsGroup::append.
+To remove this QCPBars from any group, set barsGroup to 0.
+ +| void QCPBars::setBaseValue | +( | +double | +baseValue | ) | ++ |
Sets the base value of this bars plottable.
+The base value defines where on the value coordinate the bars start. How far the bars extend from the base value is given by their individual value data. For example, if the base value is set to 1, a bar with data value 2 will have its lowest point at value coordinate 1 and highest point at 3.
+For stacked bars, only the base value of the bottom-most QCPBars has meaning.
+The default base value is 0.
+ +| void QCPBars::setStackingGap | +( | +double | +pixels | ) | ++ |
If this bars plottable is stacked on top of another bars plottable (moveAbove), this method allows specifying a distance in pixels, by which the drawn bar rectangles will be separated by the bars below it.
+ +| void QCPBars::addData | +( | +const QVector< double > & | +keys, | +
| + | + | const QVector< double > & | +values, | +
| + | + | bool | +alreadySorted = false |
+
| + | ) | ++ |
This is an overloaded function.
+Adds the provided points in keys and values to the current data. The provided vectors should have equal length. Else, the number of added points will be the size of the smallest vector.
+If you can guarantee that the passed data points are sorted by keys in ascending order, you can set alreadySorted to true, to improve performance by saving a sorting run.
+Alternatively, you can also access and modify the data directly via the data method, which returns a pointer to the internal data container.
+ +| void QCPBars::addData | +( | +double | +key, | +
| + | + | double | +value | +
| + | ) | ++ |
This is an overloaded function. Adds the provided data point as key and value to the current data.
+Alternatively, you can also access and modify the data directly via the data method, which returns a pointer to the internal data container.
+ +| void QCPBars::moveBelow | +( | +QCPBars * | +bars | ) | ++ |
Moves this bars plottable below bars. In other words, the bars of this plottable will appear below the bars of bars. The move target bars must use the same key and value axis as this plottable.
+Inserting into and removing from existing bar stacking is handled gracefully. If bars already has a bars object below itself, this bars object is inserted between the two. If this bars object is already between two other bars, the two other bars will be stacked on top of each other after the operation.
+To remove this bars plottable from any stacking, set bars to 0.
+ + +| void QCPBars::moveAbove | +( | +QCPBars * | +bars | ) | ++ |
Moves this bars plottable above bars. In other words, the bars of this plottable will appear above the bars of bars. The move target bars must use the same key and value axis as this plottable.
+Inserting into and removing from existing bar stacking is handled gracefully. If bars already has a bars object above itself, this bars object is inserted between the two. If this bars object is already between two other bars, the two other bars will be stacked on top of each other after the operation.
+To remove this bars plottable from any stacking, set bars to 0.
+ + +
+
|
+ +virtual | +
Returns a data selection containing all the data points of this plottable which are contained (or hit by) rect. This is used mainly in the selection rect interaction for data selection (data selection mechanism).
+If onlySelectable is true, an empty QCPDataSelection is returned if this plottable is not selectable (i.e. if QCPAbstractPlottable::setSelectable is QCP::stNone).
+QRect::normalized() when passing a rect which might not be normalized. Reimplemented from QCPAbstractPlottable1D< QCPBarsData >.
+ +
+
|
+ +virtual | +
Implements a selectTest specific to this plottable's point geometry.
+If details is not 0, it will be set to a QCPDataSelection, describing the closest data point to pos.
+For general information about this virtual method, see the base class implementation. QCPAbstractPlottable::selectTest
+ +Reimplemented from QCPAbstractPlottable1D< QCPBarsData >.
+ +
+
|
+ +virtual | +
Returns the coordinate range that all data in this plottable span in the key axis dimension. For logarithmic plots, one can set inSignDomain to either QCP::sdNegative or QCP::sdPositive in order to restrict the returned range to that sign domain. E.g. when only negative range is wanted, set inSignDomain to QCP::sdNegative and all positive points will be ignored for range calculation. For no restriction, just set inSignDomain to QCP::sdBoth (default). foundRange is an output parameter that indicates whether a range could be found or not. If this is false, you shouldn't use the returned range (e.g. no points in data).
+Note that foundRange is not the same as QCPRange::validRange, since the range returned by this function may have size zero (e.g. when there is only one data point). In this case foundRange would return true, but the returned range is not a valid range in terms of QCPRange::validRange.
+Implements QCPAbstractPlottable.
+ +
+
|
+ +virtual | +
Returns the coordinate range that the data points in the specified key range (inKeyRange) span in the value axis dimension. For logarithmic plots, one can set inSignDomain to either QCP::sdNegative or QCP::sdPositive in order to restrict the returned range to that sign domain. E.g. when only negative range is wanted, set inSignDomain to QCP::sdNegative and all positive points will be ignored for range calculation. For no restriction, just set inSignDomain to QCP::sdBoth (default). foundRange is an output parameter that indicates whether a range could be found or not. If this is false, you shouldn't use the returned range (e.g. no points in data).
+If inKeyRange has both lower and upper bound set to zero (is equal to QCPRange()), all data points are considered, without any restriction on the keys.
Note that foundRange is not the same as QCPRange::validRange, since the range returned by this function may have size zero (e.g. when there is only one data point). In this case foundRange would return true, but the returned range is not a valid range in terms of QCPRange::validRange.
+Implements QCPAbstractPlottable.
+ +
+
|
+ +virtual | +
Returns the pixel position on the widget surface at which the data point at the given index appears.
+Usually this corresponds to the point of dataMainKey/dataMainValue, in pixel coordinates. However, depending on the plottable, this might be a different apparent position than just a coord-to-pixel transform of those values. For example, QCPBars apparent data values can be shifted depending on their stacking, bar grouping or configured base value.
+ +Reimplemented from QCPAbstractPlottable1D< QCPBarsData >.
+ +
+
|
+ +protectedvirtual | +
This function draws the layerable with the specified painter. It is only called by QCustomPlot, if the layerable is visible (setVisible).
+Before this function is called, the painter's antialiasing state is set via applyDefaultAntialiasingHint, see the documentation there. Further, the clipping rectangle was set to clipRect.
+ +Implements QCPAbstractPlottable.
+ +
+
|
+ +protectedvirtual | +
called by QCPLegend::draw (via QCPPlottableLegendItem::draw) to create a graphical representation of this plottable inside rect, next to the plottable name.
+The passed painter has its cliprect set to rect, so painting outside of rect won't appear outside the legend icon border.
+ +Implements QCPAbstractPlottable.
+ +
+
|
+ +protected | +
called by draw to determine which data (key) range is visible at the current key axis range setting, so only that needs to be processed. It also takes into account the bar width.
+begin returns an iterator to the lowest data point that needs to be taken into account when plotting. Note that in order to get a clean plot all the way to the edge of the axis rect, lower may still be just outside the visible range.
+end returns an iterator one higher than the highest visible data point. Same as before, end may also lie just outside of the visible range.
+if the plottable contains no data, both begin and end point to constEnd.
+ +
+
|
+ +protected | +
Returns the rect in pixel coordinates of a single bar with the specified key and value. The rect is shifted according to the bar stacking (see moveAbove) and base value (see setBaseValue), and to have non-overlapping border lines with the bars stacked below.
+ +
+
|
+ +protected | +
This function is used to determine the width of the bar at coordinate key, according to the specified width (setWidth) and width type (setWidthType).
+The output parameters lower and upper return the number of pixels the bar extends to lower and higher keys, relative to the key coordinate (so with a non-reversed horizontal axis, lower is negative and upper positive).
+ +
+
|
+ +protected | +
This function is called to find at which value to start drawing the base of a bar at key, when it is stacked on top of another QCPBars (e.g. with moveAbove).
+positive and negative bars are separated per stack (positive are stacked above baseValue upwards, negative are stacked below baseValue downwards). This can be indicated with positive. So if the bar for which we need the base value is negative, set positive to false.
+ +
+
|
+ +staticprotected | +
Connects below and above to each other via their mBarAbove/mBarBelow properties. The bar(s) currently above lower and below upper will become disconnected to lower/upper.
+If lower is zero, upper will be disconnected at the bottom. If upper is zero, lower will be disconnected at the top.
+ +Holds the data of one single data point (one bar) for QCPBars. + More...
++Public Functions | |
| QCPBarsData () | |
| QCPBarsData (double key, double value) | |
| double | sortKey () const |
| double | mainKey () const |
| double | mainValue () const |
| QCPRange | valueRange () const |
+Public Members | |
| +double | key |
| +double | value |
+Static Public Functions | |
| static QCPBarsData | fromSortKey (double sortKey) |
| static bool | sortKeyIsMainKey () |
Holds the data of one single data point (one bar) for QCPBars.
+The stored data is:
The container for storing multiple data points is QCPBarsDataContainer. It is a typedef for QCPDataContainer with QCPBarsData as the DataType template parameter. See the documentation there for an explanation regarding the data type's generic methods.
+| QCPBarsData::QCPBarsData | +( | +) | ++ |
Constructs a bar data point with key and value set to zero.
+ +| QCPBarsData::QCPBarsData | +( | +double | +key, | +
| + | + | double | +value | +
| + | ) | ++ |
Constructs a bar data point with the specified key and value.
+ +
+
|
+ +inline | +
Returns the key member of this data point.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +
+
|
+ +inlinestatic | +
Returns a data point with the specified sortKey. All other members are set to zero.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +
+
|
+ +inlinestatic | +
Since the member key is both the data point key coordinate and the data ordering parameter, this method returns true.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +
+
|
+ +inline | +
Returns the key member of this data point.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +
+
|
+ +inline | +
Returns the value member of this data point.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +
+
|
+ +inline | +
Returns a QCPRange with both lower and upper boundary set to value of this data point.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +Groups multiple QCPBars together so they appear side by side. + More...
+ +Inherits QObject.
++Public Types | |
| enum | SpacingType |
+Public Functions | |
| QCPBarsGroup (QCustomPlot *parentPlot) | |
| +SpacingType | spacingType () const |
| +double | spacing () const |
| void | setSpacingType (SpacingType spacingType) |
| void | setSpacing (double spacing) |
| QList< QCPBars * > | bars () const |
| QCPBars * | bars (int index) const |
| int | size () const |
| bool | isEmpty () const |
| void | clear () |
| bool | contains (QCPBars *bars) const |
| void | append (QCPBars *bars) |
| void | insert (int i, QCPBars *bars) |
| void | remove (QCPBars *bars) |
+Protected Functions | |
| void | registerBars (QCPBars *bars) |
| void | unregisterBars (QCPBars *bars) |
| double | keyPixelOffset (const QCPBars *bars, double keyCoord) |
| double | getPixelSpacing (const QCPBars *bars, double keyCoord) |
Groups multiple QCPBars together so they appear side by side.
+
+When showing multiple QCPBars in one plot which have bars at identical keys, it may be desirable to have them appearing next to each other at each key. This is what adding the respective QCPBars plottables to a QCPBarsGroup achieves. (An alternative approach is to stack them on top of each other, see QCPBars::moveAbove.)
+To add a QCPBars plottable to the group, create a new group and then add the respective bars intances:
Alternatively to appending to the group like shown above, you can also set the group on the QCPBars plottable via QCPBars::setBarsGroup.
+The spacing between the bars can be configured via setSpacingType and setSpacing. The bars in this group appear in the plot in the order they were appended. To insert a bars plottable at a certain index position, or to reposition a bars plottable which is already in the group, use insert.
+To remove specific bars from the group, use either remove or call QCPBars::setBarsGroup(0) on the respective bars plottable.
+To clear the entire group, call clear, or simply delete the group.
+The image above is generated with the following code:
| enum QCPBarsGroup::SpacingType | +
Defines the ways the spacing between bars in the group can be specified. Thus it defines what the number passed to setSpacing actually means.
+
+
|
+ +explicit | +
Constructs a new bars group for the specified QCustomPlot instance.
+ +| void QCPBarsGroup::setSpacingType | +( | +SpacingType | +spacingType | ) | ++ |
Sets how the spacing between adjacent bars is interpreted. See SpacingType.
+The actual spacing can then be specified with setSpacing.
+| void QCPBarsGroup::setSpacing | +( | +double | +spacing | ) | ++ |
Sets the spacing between adjacent bars. What the number passed as spacing actually means, is defined by the current SpacingType, which can be set with setSpacingType.
+
+
|
+ +inline | +
Returns all bars currently in this group.
+| QCPBars * QCPBarsGroup::bars | +( | +int | +index | ) | +const | +
+
|
+ +inline | +
Returns the number of QCPBars plottables that are part of this group.
+ +
+
|
+ +inline | +
Returns whether this bars group is empty.
+| void QCPBarsGroup::clear | +( | +) | ++ |
+
|
+ +inline | +
Returns whether the specified bars plottable is part of this group.
+ +| void QCPBarsGroup::append | +( | +QCPBars * | +bars | ) | ++ |
Adds the specified bars plottable to this group. Alternatively, you can also use QCPBars::setBarsGroup on the bars instance.
+ + +| void QCPBarsGroup::insert | +( | +int | +i, | +
| + | + | QCPBars * | +bars | +
| + | ) | ++ |
| void QCPBarsGroup::remove | +( | +QCPBars * | +bars | ) | ++ |
+
|
+ +protected | +
Adds the specified bars to the internal mBars list of bars. This method does not change the barsGroup property on bars.
+
+
|
+ +protected | +
Removes the specified bars from the internal mBars list of bars. This method does not change the barsGroup property on bars.
+
+
|
+ +protected | +
Returns the pixel offset in the key dimension the specified bars plottable should have at the given key coordinate keyCoord. The offset is relative to the pixel position of the key coordinate keyCoord.
+ +
+
|
+ +protected | +
Returns the spacing in pixels which is between this bars and the following one, both at the key coordinate keyCoord.
+Defines a color gradient for use with e.g. QCPColorMap. + More...
++Public Types | |
| enum | ColorInterpolation |
| enum | GradientPreset |
+Public Functions | |
| QCPColorGradient () | |
| QCPColorGradient (GradientPreset preset) | |
| +bool | operator== (const QCPColorGradient &other) const |
| +bool | operator!= (const QCPColorGradient &other) const |
| +int | levelCount () const |
| +QMap< double, QColor > | colorStops () const |
| +ColorInterpolation | colorInterpolation () const |
| +bool | periodic () const |
| void | setLevelCount (int n) |
| void | setColorStops (const QMap< double, QColor > &colorStops) |
| void | setColorStopAt (double position, const QColor &color) |
| void | setColorInterpolation (ColorInterpolation interpolation) |
| void | setPeriodic (bool enabled) |
| void | colorize (const double *data, const QCPRange &range, QRgb *scanLine, int n, int dataIndexFactor=1, bool logarithmic=false) |
| void | colorize (const double *data, const unsigned char *alpha, const QCPRange &range, QRgb *scanLine, int n, int dataIndexFactor=1, bool logarithmic=false) |
| QRgb | color (double position, const QCPRange &range, bool logarithmic=false) |
| void | loadPreset (GradientPreset preset) |
| void | clearColorStops () |
| QCPColorGradient | inverted () const |
+Protected Functions | |
| bool | stopsUseAlpha () const |
| void | updateColorBuffer () |
Defines a color gradient for use with e.g. QCPColorMap.
+This class describes a color gradient which can be used to encode data with color. For example, QCPColorMap and QCPColorScale have setGradient methods which take an instance of this class. Colors are set with setColorStopAt(double position, const QColor &color) with a position from 0 to 1. In between these defined color positions, the color will be interpolated linearly either in RGB or HSV space, see setColorInterpolation.
+Alternatively, load one of the preset color gradients shown in the image below, with loadPreset, or by directly specifying the preset in the constructor.
+Apart from red, green and blue components, the gradient also interpolates the alpha values of the configured color stops. This allows to display some portions of the data range as transparent in the plot.
+
+The ructor allows directly converting a GradientPreset to a QCPColorGradient. This means that you can directly pass GradientPreset to all the setGradient methods, e.g.:
The total number of levels used in the gradient can be set with setLevelCount. Whether the color gradient shall be applied periodically (wrapping around) to data values that lie outside the data range specified on the plottable instance can be controlled with setPeriodic.
+| enum QCPColorGradient::ColorInterpolation | +
Defines the color spaces in which color interpolation between gradient stops can be performed.
+| enum QCPColorGradient::GradientPreset | +
Defines the available presets that can be loaded with loadPreset. See the documentation there for an image of the presets.
+| Enumerator | |
|---|---|
| gpGrayscale | Continuous lightness from black to white (suited for non-biased data representation) + |
| gpHot | Continuous lightness from black over firey colors to white (suited for non-biased data representation) + |
| gpCold | Continuous lightness from black over icey colors to white (suited for non-biased data representation) + |
| gpNight | Continuous lightness from black over weak blueish colors to white (suited for non-biased data representation) + |
| gpCandy | Blue over pink to white. + |
| gpGeography | Colors suitable to represent different elevations on geographical maps. + |
| gpIon | Half hue spectrum from black over purple to blue and finally green (creates banding illusion but allows more precise magnitude estimates) + |
| gpThermal | Colors suitable for thermal imaging, ranging from dark blue over purple to orange, yellow and white. + |
| gpPolar | Colors suitable to emphasize polarity around the center, with blue for negative, black in the middle and red for positive values. + |
| gpSpectrum | An approximation of the visible light spectrum (creates banding illusion but allows more precise magnitude estimates) + |
| gpJet | Hue variation similar to a spectrum, often used in numerical visualization (creates banding illusion but allows more precise magnitude estimates) + |
| gpHues | Full hue cycle, with highest and lowest color red (suitable for periodic data, such as angles and phases, see setPeriodic) + |
| QCPColorGradient::QCPColorGradient | +( | +) | ++ |
Constructs a new, empty QCPColorGradient with no predefined color stops. You can add own color stops with setColorStopAt.
+The color level count is initialized to 350.
+ +| QCPColorGradient::QCPColorGradient | +( | +GradientPreset | +preset | ) | ++ |
Constructs a new QCPColorGradient initialized with the colors and color interpolation according to preset.
+The color level count is initialized to 350.
+ +| void QCPColorGradient::setLevelCount | +( | +int | +n | ) | ++ |
Sets the number of discretization levels of the color gradient to n. The default is 350 which is typically enough to create a smooth appearance. The minimum number of levels is 2.
+
+| void QCPColorGradient::setColorStops | +( | +const QMap< double, QColor > & | +colorStops | ) | ++ |
Sets at which positions from 0 to 1 which color shall occur. The positions are the keys, the colors are the values of the passed QMap colorStops. In between these color stops, the color is interpolated according to setColorInterpolation.
+A more convenient way to create a custom gradient may be to clear all color stops with clearColorStops (or creating a new, empty QCPColorGradient) and then adding them one by one with setColorStopAt.
+| void QCPColorGradient::setColorStopAt | +( | +double | +position, | +
| + | + | const QColor & | +color | +
| + | ) | ++ |
Sets the color the gradient will have at the specified position (from 0 to 1). In between these color stops, the color is interpolated according to setColorInterpolation.
+| void QCPColorGradient::setColorInterpolation | +( | +QCPColorGradient::ColorInterpolation | +interpolation | ) | ++ |
Sets whether the colors in between the configured color stops (see setColorStopAt) shall be interpolated linearly in RGB or in HSV color space.
+For example, a sweep in RGB space from red to green will have a muddy brown intermediate color, whereas in HSV space the intermediate color is yellow.
+ +| void QCPColorGradient::setPeriodic | +( | +bool | +enabled | ) | ++ |
Sets whether data points that are outside the configured data range (e.g. QCPColorMap::setDataRange) are colored by periodically repeating the color gradient or whether they all have the same color, corresponding to the respective gradient boundary color.
+
+As shown in the image above, gradients that have the same start and end color are especially suitable for a periodic gradient mapping, since they produce smooth color transitions throughout the color map. A preset that has this property is gpHues.
+In practice, using periodic color gradients makes sense when the data corresponds to a periodic dimension, such as an angle or a phase. If this is not the case, the color encoding might become ambiguous, because multiple different data values are shown as the same color.
+ +| void QCPColorGradient::colorize | +( | +const double * | +data, | +
| + | + | const QCPRange & | +range, | +
| + | + | QRgb * | +scanLine, | +
| + | + | int | +n, | +
| + | + | int | +dataIndexFactor = 1, |
+
| + | + | bool | +logarithmic = false |
+
| + | ) | ++ |
This is an overloaded function.
+This method is used to quickly convert a data array to colors. The colors will be output in the array scanLine. Both data and scanLine must have the length n when passed to this function. The data range that shall be used for mapping the data value to the gradient is passed in range. logarithmic indicates whether the data values shall be mapped to colors logarithmically.
+if data actually contains 2D-data linearized via [row*columnCount + column], you can set dataIndexFactor to columnCount to convert a column instead of a row of the data array, in scanLine. scanLine will remain a regular (1D) array. This works because data is addressed data[i*dataIndexFactor].
Use the overloaded method to additionally provide alpha map data.
+The QRgb values that are placed in scanLine have their r, g and b components premultiplied with alpha (see QImage::Format_ARGB32_Premultiplied).
+ +| void QCPColorGradient::colorize | +( | +const double * | +data, | +
| + | + | const unsigned char * | +alpha, | +
| + | + | const QCPRange & | +range, | +
| + | + | QRgb * | +scanLine, | +
| + | + | int | +n, | +
| + | + | int | +dataIndexFactor = 1, |
+
| + | + | bool | +logarithmic = false |
+
| + | ) | ++ |
This is an overloaded function.
+Additionally to the other overload of colorize, this method takes the array alpha, which has the same size and structure as data and encodes the alpha information per data point.
+The QRgb values that are placed in scanLine have their r, g and b components premultiplied with alpha (see QImage::Format_ARGB32_Premultiplied).
+ +| QRgb QCPColorGradient::color | +( | +double | +position, | +
| + | + | const QCPRange & | +range, | +
| + | + | bool | +logarithmic = false |
+
| + | ) | ++ |
This method is used to colorize a single data value given in position, to colors. The data range that shall be used for mapping the data value to the gradient is passed in range. logarithmic indicates whether the data value shall be mapped to a color logarithmically.
+If an entire array of data values shall be converted, rather use colorize, for better performance.
+The returned QRgb has its r, g and b components premultiplied with alpha (see QImage::Format_ARGB32_Premultiplied).
+ +| void QCPColorGradient::loadPreset | +( | +GradientPreset | +preset | ) | ++ |
Clears the current color stops and loads the specified preset. A preset consists of predefined color stops and the corresponding color interpolation method.
+The available presets are:
+| void QCPColorGradient::clearColorStops | +( | +) | ++ |
Clears all color stops.
+| QCPColorGradient QCPColorGradient::inverted | +( | +) | +const | +
Returns an inverted gradient. The inverted gradient has all properties as this QCPColorGradient, but the order of the color stops is inverted.
+
+
|
+ +protected | +
Returns true if the color gradient uses transparency, i.e. if any of the configured color stops has an alpha value below 255.
+ +
+
|
+ +protected | +
A plottable representing a two-dimensional color map in a plot. + More...
+
+Public Functions | |
| QCPColorMap (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
| QCPColorMapData * | data () const |
| +QCPRange | dataRange () const |
| +QCPAxis::ScaleType | dataScaleType () const |
| +bool | interpolate () const |
| +bool | tightBoundary () const |
| +QCPColorGradient | gradient () const |
| +QCPColorScale * | colorScale () const |
| void | setData (QCPColorMapData *data, bool copy=false) |
| Q_SLOT void | setDataRange (const QCPRange &dataRange) |
| Q_SLOT void | setDataScaleType (QCPAxis::ScaleType scaleType) |
| Q_SLOT void | setGradient (const QCPColorGradient &gradient) |
| void | setInterpolate (bool enabled) |
| void | setTightBoundary (bool enabled) |
| void | setColorScale (QCPColorScale *colorScale) |
| void | rescaleDataRange (bool recalculateDataBounds=false) |
| Q_SLOT void | updateLegendIcon (Qt::TransformationMode transformMode=Qt::SmoothTransformation, const QSize &thumbSize=QSize(32, 18)) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
| virtual QCPRange | getKeyRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const |
| virtual QCPRange | getValueRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const |
Public Functions inherited from QCPAbstractPlottable | |
| QCPAbstractPlottable (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
| +QString | name () const |
| +bool | antialiasedFill () const |
| +bool | antialiasedScatters () const |
| +QPen | pen () const |
| +QBrush | brush () const |
| +QCPAxis * | keyAxis () const |
| +QCPAxis * | valueAxis () const |
| +QCP::SelectionType | selectable () const |
| bool | selected () const |
| QCPDataSelection | selection () const |
| QCPSelectionDecorator * | selectionDecorator () const |
| void | setName (const QString &name) |
| void | setAntialiasedFill (bool enabled) |
| void | setAntialiasedScatters (bool enabled) |
| void | setPen (const QPen &pen) |
| void | setBrush (const QBrush &brush) |
| void | setKeyAxis (QCPAxis *axis) |
| void | setValueAxis (QCPAxis *axis) |
| Q_SLOT void | setSelectable (QCP::SelectionType selectable) |
| Q_SLOT void | setSelection (QCPDataSelection selection) |
| void | setSelectionDecorator (QCPSelectionDecorator *decorator) |
| virtual QCPPlottableInterface1D * | interface1D () |
| void | coordsToPixels (double key, double value, double &x, double &y) const |
| const QPointF | coordsToPixels (double key, double value) const |
| void | pixelsToCoords (double x, double y, double &key, double &value) const |
| void | pixelsToCoords (const QPointF &pixelPos, double &key, double &value) const |
| void | rescaleAxes (bool onlyEnlarge=false) const |
| void | rescaleKeyAxis (bool onlyEnlarge=false) const |
| void | rescaleValueAxis (bool onlyEnlarge=false, bool inKeyRange=false) const |
| bool | addToLegend (QCPLegend *legend) |
| bool | addToLegend () |
| bool | removeFromLegend (QCPLegend *legend) const |
| bool | removeFromLegend () const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Signals | |
| void | dataRangeChanged (const QCPRange &newRange) |
| void | dataScaleTypeChanged (QCPAxis::ScaleType scaleType) |
| void | gradientChanged (const QCPColorGradient &newGradient) |
Signals inherited from QCPAbstractPlottable | |
| void | selectionChanged (bool selected) |
| void | selectionChanged (const QCPDataSelection &selection) |
| void | selectableChanged (QCP::SelectionType selectable) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
+Protected Functions | |
| virtual void | updateMapImage () |
| virtual void | draw (QCPPainter *painter) |
| virtual void | drawLegendIcon (QCPPainter *painter, const QRectF &rect) const |
Protected Functions inherited from QCPAbstractPlottable | |
| virtual QRect | clipRect () const |
| virtual QCP::Interaction | selectionCategory () const |
| void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| void | applyFillAntialiasingHint (QCPPainter *painter) const |
| void | applyScattersAntialiasingHint (QCPPainter *painter) const |
Protected Functions inherited from QCPLayerable | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
A plottable representing a two-dimensional color map in a plot.
+
+The data is stored in the class QCPColorMapData, which can be accessed via the data() method.
+A color map has three dimensions to represent a data point: The key dimension, the value dimension and the data dimension. As with other plottables such as graphs, key and value correspond to two orthogonal axes on the QCustomPlot surface that you specify in the QCPColorMap constructor. The data dimension however is encoded as the color of the point at (key, value).
+Set the number of points (or cells) in the key/value dimension via QCPColorMapData::setSize. The plot coordinate range over which these points will be displayed is specified via QCPColorMapData::setRange. The first cell will be centered on the lower range boundary and the last cell will be centered on the upper range boundary. The data can be set by either accessing the cells directly with QCPColorMapData::setCell or by addressing the cells via their plot coordinates with QCPColorMapData::setData. If possible, you should prefer setCell, since it doesn't need to do any coordinate transformation and thus performs a bit better.
+The cell with index (0, 0) is at the bottom left, if the color map uses normal (i.e. not reversed) key and value axes.
+To show the user which colors correspond to which data values, a QCPColorScale is typically placed to the right of the axis rect. See the documentation there for details on how to add and use a color scale.
+The central part of the appearance is the color gradient, which can be specified via setGradient. See the documentation of QCPColorGradient for details on configuring a color gradient.
+The data range that is mapped to the colors of the gradient can be specified with setDataRange. To make the data range encompass the whole data set minimum to maximum, call rescaleDataRange.
+Transparency in color maps can be achieved by two mechanisms. On one hand, you can specify alpha values for color stops of the QCPColorGradient, via the regular QColor interface. This will cause the color map data which gets mapped to colors around those color stops to appear with the accordingly interpolated transparency.
+On the other hand you can also directly apply an alpha value to each cell independent of its data, by using the alpha map feature of QCPColorMapData. The relevant methods are QCPColorMapData::setAlpha, QCPColorMapData::fillAlpha and QCPColorMapData::clearAlpha().
+The two transparencies will be joined together in the plot and otherwise not interfere with each other. They are mixed in a multiplicative matter, so an alpha of e.g. 50% (128/255) in both modes simultaneously, will result in a total transparency of 25% (64/255).
+Like all data representing objects in QCustomPlot, the QCPColorMap is a plottable (QCPAbstractPlottable). So the plottable-interface of QCustomPlot applies (QCustomPlot::plottable, QCustomPlot::removePlottable, etc.)
+Usually, you first create an instance:
which registers it with the QCustomPlot instance of the passed axes. Note that this QCustomPlot instance takes ownership of the plottable, so do not delete it manually but use QCustomPlot::removePlottable() instead. The newly created plottable can be modified, e.g.:
+
|
+ +explicit | +
Constructs a color map with the specified keyAxis and valueAxis.
+The created QCPColorMap is automatically registered with the QCustomPlot instance inferred from keyAxis. This QCustomPlot instance takes ownership of the QCPColorMap, so do not delete it manually but use QCustomPlot::removePlottable() instead.
+ +
+
|
+ +inline | +
Returns a pointer to the internal data storage of type QCPColorMapData. Access this to modify data points (cells) and the color map key/value range.
+| void QCPColorMap::setData | +( | +QCPColorMapData * | +data, | +
| + | + | bool | +copy = false |
+
| + | ) | ++ |
Replaces the current data with the provided data.
+If copy is set to true, the data object will only be copied. if false, the color map takes ownership of the passed data and replaces the internal data pointer with it. This is significantly faster than copying for large datasets.
+ +| void QCPColorMap::setDataRange | +( | +const QCPRange & | +dataRange | ) | ++ |
Sets the data range of this color map to dataRange. The data range defines which data values are mapped to the color gradient.
+To make the data range span the full range of the data set, use rescaleDataRange.
+| void QCPColorMap::setDataScaleType | +( | +QCPAxis::ScaleType | +scaleType | ) | ++ |
Sets whether the data is correlated with the color gradient linearly or logarithmically.
+| void QCPColorMap::setGradient | +( | +const QCPColorGradient & | +gradient | ) | ++ |
Sets the color gradient that is used to represent the data. For more details on how to create an own gradient or use one of the preset gradients, see QCPColorGradient.
+The colors defined by the gradient will be used to represent data values in the currently set data range, see setDataRange. Data points that are outside this data range will either be colored uniformly with the respective gradient boundary color, or the gradient will repeat, depending on QCPColorGradient::setPeriodic.
+| void QCPColorMap::setInterpolate | +( | +bool | +enabled | ) | ++ |
Sets whether the color map image shall use bicubic interpolation when displaying the color map shrinked or expanded, and not at a 1:1 pixel-to-data scale.
+
+| void QCPColorMap::setTightBoundary | +( | +bool | +enabled | ) | ++ |
Sets whether the outer most data rows and columns are clipped to the specified key and value range (see QCPColorMapData::setKeyRange, QCPColorMapData::setValueRange).
+if enabled is set to false, the data points at the border of the color map are drawn with the same width and height as all other data points. Since the data points are represented by rectangles of one color centered on the data coordinate, this means that the shown color map extends by half a data point over the specified key/value range in each direction.
+
+| void QCPColorMap::setColorScale | +( | +QCPColorScale * | +colorScale | ) | ++ |
Associates the color scale colorScale with this color map.
+This means that both the color scale and the color map synchronize their gradient, data range and data scale type (setGradient, setDataRange, setDataScaleType). Multiple color maps can be associated with one single color scale. This causes the color maps to also synchronize those properties, via the mutual color scale.
+This function causes the color map to adopt the current color gradient, data range and data scale type of colorScale. After this call, you may change these properties at either the color map or the color scale, and the setting will be applied to both.
+Pass 0 as colorScale to disconnect the color scale from this color map again.
+ +| void QCPColorMap::rescaleDataRange | +( | +bool | +recalculateDataBounds = false | ) | ++ |
Sets the data range (setDataRange) to span the minimum and maximum values that occur in the current data set. This corresponds to the rescaleKeyAxis or rescaleValueAxis methods, only for the third data dimension of the color map.
+The minimum and maximum values of the data set are buffered in the internal QCPColorMapData instance (data). As data is updated via its QCPColorMapData::setCell or QCPColorMapData::setData, the buffered minimum and maximum values are updated, too. For performance reasons, however, they are only updated in an expanding fashion. So the buffered maximum can only increase and the buffered minimum can only decrease. In consequence, changes to the data that actually lower the maximum of the data set (by overwriting the cell holding the current maximum with a smaller value), aren't recognized and the buffered maximum overestimates the true maximum of the data set. The same happens for the buffered minimum. To recalculate the true minimum and maximum by explicitly looking at each cell, the method QCPColorMapData::recalculateDataBounds can be used. For convenience, setting the parameter recalculateDataBounds calls this method before setting the data range to the buffered minimum and maximum.
+| void QCPColorMap::updateLegendIcon | +( | +Qt::TransformationMode | +transformMode = Qt::SmoothTransformation, |
+
| + | + | const QSize & | +thumbSize = QSize(32, 18) |
+
| + | ) | ++ |
Takes the current appearance of the color map and updates the legend icon, which is used to represent this color map in the legend (see QCPLegend).
+The transformMode specifies whether the rescaling is done by a faster, low quality image scaling algorithm (Qt::FastTransformation) or by a slower, higher quality algorithm (Qt::SmoothTransformation).
+The current color map appearance is scaled down to thumbSize. Ideally, this should be equal to the size of the legend icon (see QCPLegend::setIconSize). If it isn't exactly the configured legend icon size, the thumb will be rescaled during drawing of the legend item.
+
+
|
+ +virtual | +
This function is used to decide whether a click hits a layerable object or not.
+pos is a point in pixel coordinates on the QCustomPlot surface. This function returns the shortest pixel distance of this point to the object. If the object is either invisible or the distance couldn't be determined, -1.0 is returned. Further, if onlySelectable is true and the object is not selectable, -1.0 is returned, too.
+If the object is represented not by single lines but by an area like a QCPItemText or the bars of a QCPBars plottable, a click inside the area should also be considered a hit. In these cases this function thus returns a constant value greater zero but still below the parent plot's selection tolerance. (typically the selectionTolerance multiplied by 0.99).
+Providing a constant value for area objects allows selecting line objects even when they are obscured by such area objects, by clicking close to the lines (i.e. closer than 0.99*selectionTolerance).
+The actual setting of the selection state is not done by this function. This is handled by the parent QCustomPlot when the mouseReleaseEvent occurs, and the finally selected object is notified via the selectEvent/deselectEvent methods.
+details is an optional output parameter. Every layerable subclass may place any information in details. This information will be passed to selectEvent when the parent QCustomPlot decides on the basis of this selectTest call, that the object was successfully selected. The subsequent call to selectEvent will carry the details. This is useful for multi-part objects (like QCPAxis). This way, a possibly complex calculation to decide which part was clicked is only done once in selectTest. The result (i.e. the actually clicked part) can then be placed in details. So in the subsequent selectEvent, the decision which part was selected doesn't have to be done a second time for a single selection operation.
+In the case of 1D Plottables (QCPAbstractPlottable1D, like QCPGraph or QCPBars) details will be set to a QCPDataSelection, describing the closest data point to pos.
+You may pass 0 as details to indicate that you are not interested in those selection details.
+Implements QCPAbstractPlottable.
+ +
+
|
+ +virtual | +
Returns the coordinate range that all data in this plottable span in the key axis dimension. For logarithmic plots, one can set inSignDomain to either QCP::sdNegative or QCP::sdPositive in order to restrict the returned range to that sign domain. E.g. when only negative range is wanted, set inSignDomain to QCP::sdNegative and all positive points will be ignored for range calculation. For no restriction, just set inSignDomain to QCP::sdBoth (default). foundRange is an output parameter that indicates whether a range could be found or not. If this is false, you shouldn't use the returned range (e.g. no points in data).
+Note that foundRange is not the same as QCPRange::validRange, since the range returned by this function may have size zero (e.g. when there is only one data point). In this case foundRange would return true, but the returned range is not a valid range in terms of QCPRange::validRange.
+Implements QCPAbstractPlottable.
+ +
+
|
+ +virtual | +
Returns the coordinate range that the data points in the specified key range (inKeyRange) span in the value axis dimension. For logarithmic plots, one can set inSignDomain to either QCP::sdNegative or QCP::sdPositive in order to restrict the returned range to that sign domain. E.g. when only negative range is wanted, set inSignDomain to QCP::sdNegative and all positive points will be ignored for range calculation. For no restriction, just set inSignDomain to QCP::sdBoth (default). foundRange is an output parameter that indicates whether a range could be found or not. If this is false, you shouldn't use the returned range (e.g. no points in data).
+If inKeyRange has both lower and upper bound set to zero (is equal to QCPRange()), all data points are considered, without any restriction on the keys.
Note that foundRange is not the same as QCPRange::validRange, since the range returned by this function may have size zero (e.g. when there is only one data point). In this case foundRange would return true, but the returned range is not a valid range in terms of QCPRange::validRange.
+Implements QCPAbstractPlottable.
+ +
+
|
+ +signal | +
This signal is emitted when the data range changes.
+
+
|
+ +signal | +
This signal is emitted when the data scale type changes.
+
+
|
+ +signal | +
This signal is emitted when the gradient changes.
+
+
|
+ +protectedvirtual | +
Updates the internal map image buffer by going through the internal QCPColorMapData and turning the data values into color pixels with QCPColorGradient::colorize.
+This method is called by QCPColorMap::draw if either the data has been modified or the map image has been invalidated for a different reason (e.g. a change of the data range with setDataRange).
+If the map cell count is low, the image created will be oversampled in order to avoid a QPainter::drawImage bug which makes inner pixel boundaries jitter when stretch-drawing images without smooth transform enabled. Accordingly, oversampling isn't performed if setInterpolate is true.
+ +
+
|
+ +protectedvirtual | +
This function draws the layerable with the specified painter. It is only called by QCustomPlot, if the layerable is visible (setVisible).
+Before this function is called, the painter's antialiasing state is set via applyDefaultAntialiasingHint, see the documentation there. Further, the clipping rectangle was set to clipRect.
+ +Implements QCPAbstractPlottable.
+ +
+
|
+ +protectedvirtual | +
called by QCPLegend::draw (via QCPPlottableLegendItem::draw) to create a graphical representation of this plottable inside rect, next to the plottable name.
+The passed painter has its cliprect set to rect, so painting outside of rect won't appear outside the legend icon border.
+ +Implements QCPAbstractPlottable.
+ +Holds the two-dimensional data of a QCPColorMap plottable. + More...
++Public Functions | |
| QCPColorMapData (int keySize, int valueSize, const QCPRange &keyRange, const QCPRange &valueRange) | |
| QCPColorMapData (const QCPColorMapData &other) | |
| QCPColorMapData & | operator= (const QCPColorMapData &other) |
| +int | keySize () const |
| +int | valueSize () const |
| +QCPRange | keyRange () const |
| +QCPRange | valueRange () const |
| +QCPRange | dataBounds () const |
| +double | data (double key, double value) |
| +double | cell (int keyIndex, int valueIndex) |
| unsigned char | alpha (int keyIndex, int valueIndex) |
| void | setSize (int keySize, int valueSize) |
| void | setKeySize (int keySize) |
| void | setValueSize (int valueSize) |
| void | setRange (const QCPRange &keyRange, const QCPRange &valueRange) |
| void | setKeyRange (const QCPRange &keyRange) |
| void | setValueRange (const QCPRange &valueRange) |
| void | setData (double key, double value, double z) |
| void | setCell (int keyIndex, int valueIndex, double z) |
| void | setAlpha (int keyIndex, int valueIndex, unsigned char alpha) |
| void | recalculateDataBounds () |
| void | clear () |
| void | clearAlpha () |
| void | fill (double z) |
| void | fillAlpha (unsigned char alpha) |
| bool | isEmpty () const |
| void | coordToCell (double key, double value, int *keyIndex, int *valueIndex) const |
| void | cellToCoord (int keyIndex, int valueIndex, double *key, double *value) const |
+Protected Functions | |
| bool | createAlpha (bool initializeOpaque=true) |
Holds the two-dimensional data of a QCPColorMap plottable.
+This class is a data storage for QCPColorMap. It holds a two-dimensional array, which QCPColorMap then displays as a 2D image in the plot, where the array values are represented by a color, depending on the value.
+The size of the array can be controlled via setSize (or setKeySize, setValueSize). Which plot coordinates these cells correspond to can be configured with setRange (or setKeyRange, setValueRange).
+The data cells can be accessed in two ways: They can be directly addressed by an integer index with setCell. This is the fastest method. Alternatively, they can be addressed by their plot coordinate with setData. plot coordinate to cell index transformations and vice versa are provided by the functions coordToCell and cellToCoord.
+A QCPColorMapData also holds an on-demand two-dimensional array of alpha values which (if allocated) has the same size as the data map. It can be accessed via setAlpha, fillAlpha and clearAlpha. The memory for the alpha map is only allocated if needed, i.e. on the first call of setAlpha. clearAlpha restores full opacity and frees the alpha map.
+This class also buffers the minimum and maximum values that are in the data set, to provide QCPColorMap::rescaleDataRange with the necessary information quickly. Setting a cell to a value that is greater than the current maximum increases this maximum to the new value. However, setting the cell that currently holds the maximum value to a smaller value doesn't decrease the maximum again, because finding the true new maximum would require going through the entire data array, which might be time consuming. The same holds for the data minimum. This functionality is given by recalculateDataBounds, such that you can decide when it is sensible to find the true current minimum and maximum. The method QCPColorMap::rescaleDataRange offers a convenience parameter recalculateDataBounds which may be set to true to automatically call recalculateDataBounds internally.
+| QCPColorMapData::QCPColorMapData | +( | +int | +keySize, | +
| + | + | int | +valueSize, | +
| + | + | const QCPRange & | +keyRange, | +
| + | + | const QCPRange & | +valueRange | +
| + | ) | ++ |
Constructs a new QCPColorMapData instance. The instance has keySize cells in the key direction and valueSize cells in the value direction. These cells will be displayed by the QCPColorMap at the coordinates keyRange and valueRange.
+| QCPColorMapData::QCPColorMapData | +( | +const QCPColorMapData & | +other | ) | ++ |
Constructs a new QCPColorMapData instance copying the data and range of other.
+ +| QCPColorMapData & QCPColorMapData::operator= | +( | +const QCPColorMapData & | +other | ) | ++ |
Overwrites this color map data instance with the data stored in other. The alpha map state is transferred, too.
+ +| unsigned char QCPColorMapData::alpha | +( | +int | +keyIndex, | +
| + | + | int | +valueIndex | +
| + | ) | ++ |
Returns the alpha map value of the cell with the indices keyIndex and valueIndex.
+If this color map data doesn't have an alpha map (because setAlpha was never called after creation or after a call to clearAlpha), returns 255, which corresponds to full opacity.
+| void QCPColorMapData::setSize | +( | +int | +keySize, | +
| + | + | int | +valueSize | +
| + | ) | ++ |
Resizes the data array to have keySize cells in the key dimension and valueSize cells in the value dimension.
+The current data is discarded and the map cells are set to 0, unless the map had already the requested size.
+Setting at least one of keySize or valueSize to zero frees the internal data array and isEmpty returns true.
+| void QCPColorMapData::setKeySize | +( | +int | +keySize | ) | ++ |
Resizes the data array to have keySize cells in the key dimension.
+The current data is discarded and the map cells are set to 0, unless the map had already the requested size.
+Setting keySize to zero frees the internal data array and isEmpty returns true.
+| void QCPColorMapData::setValueSize | +( | +int | +valueSize | ) | ++ |
Resizes the data array to have valueSize cells in the value dimension.
+The current data is discarded and the map cells are set to 0, unless the map had already the requested size.
+Setting valueSize to zero frees the internal data array and isEmpty returns true.
+| void QCPColorMapData::setRange | +( | +const QCPRange & | +keyRange, | +
| + | + | const QCPRange & | +valueRange | +
| + | ) | ++ |
Sets the coordinate ranges the data shall be distributed over. This defines the rectangular area covered by the color map in plot coordinates.
+The outer cells will be centered on the range boundaries given to this function. For example, if the key size (setKeySize) is 3 and keyRange is set to QCPRange(2, 3) there will be cells centered on the key coordinates 2, 2.5 and 3.
| void QCPColorMapData::setKeyRange | +( | +const QCPRange & | +keyRange | ) | ++ |
Sets the coordinate range the data shall be distributed over in the key dimension. Together with the value range, This defines the rectangular area covered by the color map in plot coordinates.
+The outer cells will be centered on the range boundaries given to this function. For example, if the key size (setKeySize) is 3 and keyRange is set to QCPRange(2, 3) there will be cells centered on the key coordinates 2, 2.5 and 3.
| void QCPColorMapData::setValueRange | +( | +const QCPRange & | +valueRange | ) | ++ |
Sets the coordinate range the data shall be distributed over in the value dimension. Together with the key range, This defines the rectangular area covered by the color map in plot coordinates.
+The outer cells will be centered on the range boundaries given to this function. For example, if the value size (setValueSize) is 3 and valueRange is set to QCPRange(2, 3) there will be cells centered on the value coordinates 2, 2.5 and 3.
| void QCPColorMapData::setData | +( | +double | +key, | +
| + | + | double | +value, | +
| + | + | double | +z | +
| + | ) | ++ |
Sets the data of the cell, which lies at the plot coordinates given by key and value, to z.
+| void QCPColorMapData::setCell | +( | +int | +keyIndex, | +
| + | + | int | +valueIndex, | +
| + | + | double | +z | +
| + | ) | ++ |
Sets the data of the cell with indices keyIndex and valueIndex to z. The indices enumerate the cells starting from zero, up to the map's size-1 in the respective dimension (see setSize).
+In the standard plot configuration (horizontal key axis and vertical value axis, both not range-reversed), the cell with indices (0, 0) is in the bottom left corner and the cell with indices (keySize-1, valueSize-1) is in the top right corner of the color map.
+ + +| void QCPColorMapData::setAlpha | +( | +int | +keyIndex, | +
| + | + | int | +valueIndex, | +
| + | + | unsigned char | +alpha | +
| + | ) | ++ |
Sets the alpha of the color map cell given by keyIndex and valueIndex to alpha. A value of 0 for alpha results in a fully transparent cell, and a value of 255 results in a fully opaque cell.
+If an alpha map doesn't exist yet for this color map data, it will be created here. If you wish to restore full opacity and free any allocated memory of the alpha map, call clearAlpha.
+Note that the cell-wise alpha which can be configured here is independent of any alpha configured in the color map's gradient (QCPColorGradient). If a cell is affected both by the cell-wise and gradient alpha, the alpha values will be blended accordingly during rendering of the color map.
+| void QCPColorMapData::recalculateDataBounds | +( | +) | ++ |
Goes through the data and updates the buffered minimum and maximum data values.
+Calling this method is only advised if you are about to call QCPColorMap::rescaleDataRange and can not guarantee that the cells holding the maximum or minimum data haven't been overwritten with a smaller or larger value respectively, since the buffered maximum/minimum values have been updated the last time. Why this is the case is explained in the class description (QCPColorMapData).
+Note that the method QCPColorMap::rescaleDataRange provides a parameter recalculateDataBounds for convenience. Setting this to true will call this method for you, before doing the rescale.
+ +| void QCPColorMapData::clear | +( | +) | ++ |
Frees the internal data memory.
+This is equivalent to calling setSize(0, 0).
+ +| void QCPColorMapData::clearAlpha | +( | +) | ++ |
Frees the internal alpha map. The color map will have full opacity again.
+ +| void QCPColorMapData::fill | +( | +double | +z | ) | ++ |
Sets all cells to the value z.
+ +| void QCPColorMapData::fillAlpha | +( | +unsigned char | +alpha | ) | ++ |
Sets the opacity of all color map cells to alpha. A value of 0 for alpha results in a fully transparent color map, and a value of 255 results in a fully opaque color map.
+If you wish to restore opacity to 100% and free any used memory for the alpha map, rather use clearAlpha.
+
+
|
+ +inline | +
Returns whether this instance carries no data. This is equivalent to having a size where at least one of the dimensions is 0 (see setSize).
+ +| void QCPColorMapData::coordToCell | +( | +double | +key, | +
| + | + | double | +value, | +
| + | + | int * | +keyIndex, | +
| + | + | int * | +valueIndex | +
| + | ) | +const | +
Transforms plot coordinates given by key and value to cell indices of this QCPColorMapData instance. The resulting cell indices are returned via the output parameters keyIndex and valueIndex.
+The retrieved key/value cell indices can then be used for example with setCell.
+If you are only interested in a key or value index, you may pass 0 as valueIndex or keyIndex.
+| void QCPColorMapData::cellToCoord | +( | +int | +keyIndex, | +
| + | + | int | +valueIndex, | +
| + | + | double * | +key, | +
| + | + | double * | +value | +
| + | ) | +const | +
Transforms cell indices given by keyIndex and valueIndex to cell indices of this QCPColorMapData instance. The resulting coordinates are returned via the output parameters key and value.
+If you are only interested in a key or value coordinate, you may pass 0 as key or value.
+
+
|
+ +protected | +
Allocates the internal alpha map with the current data map key/value size and, if initializeOpaque is true, initializes all values to 255. If initializeOpaque is false, the values are not initialized at all. In this case, the alpha map should be initialized manually, e.g. with fillAlpha.
+If an alpha map exists already, it is deleted first. If this color map is empty (has either key or value size zero, see isEmpty), the alpha map is cleared.
+The return value indicates the existence of the alpha map after the call. So this method returns true if the data map isn't empty and an alpha map was successfully allocated.
+ +A color scale for use with color coding data such as QCPColorMap. + More...
+
+Public Functions | |
| QCPColorScale (QCustomPlot *parentPlot) | |
| QCPAxis * | axis () const |
| +QCPAxis::AxisType | type () const |
| +QCPRange | dataRange () const |
| +QCPAxis::ScaleType | dataScaleType () const |
| +QCPColorGradient | gradient () const |
| +QString | label () const |
| +int | barWidth () const |
| +bool | rangeDrag () const |
| +bool | rangeZoom () const |
| void | setType (QCPAxis::AxisType type) |
| Q_SLOT void | setDataRange (const QCPRange &dataRange) |
| Q_SLOT void | setDataScaleType (QCPAxis::ScaleType scaleType) |
| Q_SLOT void | setGradient (const QCPColorGradient &gradient) |
| void | setLabel (const QString &str) |
| void | setBarWidth (int width) |
| void | setRangeDrag (bool enabled) |
| void | setRangeZoom (bool enabled) |
| QList< QCPColorMap * > | colorMaps () const |
| void | rescaleDataRange (bool onlyVisibleMaps) |
| virtual void | update (UpdatePhase phase) |
Public Functions inherited from QCPLayoutElement | |
| QCPLayoutElement (QCustomPlot *parentPlot=0) | |
| QCPLayout * | layout () const |
| QRect | rect () const |
| QRect | outerRect () const |
| +QMargins | margins () const |
| +QMargins | minimumMargins () const |
| +QCP::MarginSides | autoMargins () const |
| +QSize | minimumSize () const |
| +QSize | maximumSize () const |
| +SizeConstraintRect | sizeConstraintRect () const |
| +QCPMarginGroup * | marginGroup (QCP::MarginSide side) const |
| +QHash< QCP::MarginSide, QCPMarginGroup * > | marginGroups () const |
| void | setOuterRect (const QRect &rect) |
| void | setMargins (const QMargins &margins) |
| void | setMinimumMargins (const QMargins &margins) |
| void | setAutoMargins (QCP::MarginSides sides) |
| void | setMinimumSize (const QSize &size) |
| void | setMinimumSize (int width, int height) |
| void | setMaximumSize (const QSize &size) |
| void | setMaximumSize (int width, int height) |
| void | setSizeConstraintRect (SizeConstraintRect constraintRect) |
| void | setMarginGroup (QCP::MarginSides sides, QCPMarginGroup *group) |
| virtual QSize | minimumOuterSizeHint () const |
| virtual QSize | maximumOuterSizeHint () const |
| virtual QList< QCPLayoutElement * > | elements (bool recursive) const |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Signals | |
| void | dataRangeChanged (const QCPRange &newRange) |
| void | dataScaleTypeChanged (QCPAxis::ScaleType scaleType) |
| void | gradientChanged (const QCPColorGradient &newGradient) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
+Protected Functions | |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | wheelEvent (QWheelEvent *event) |
Protected Functions inherited from QCPLayoutElement | |
| virtual int | calculateAutoMargin (QCP::MarginSide side) |
| virtual void | layoutChanged () |
| virtual void | draw (QCPPainter *painter) |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
Protected Functions inherited from QCPLayerable | |
| virtual QCP::Interaction | selectionCategory () const |
| virtual QRect | clipRect () const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Additional Inherited Members | |
Public Types inherited from QCPLayoutElement | |
| enum | UpdatePhase |
| enum | SizeConstraintRect |
A color scale for use with color coding data such as QCPColorMap.
+This layout element can be placed on the plot to correlate a color gradient with data values. It is usually used in combination with one or multiple QCPColorMaps.
+
+The color scale can be either horizontal or vertical, as shown in the image above. The orientation and the side where the numbers appear is controlled with setType.
+Use QCPColorMap::setColorScale to connect a color map with a color scale. Once they are connected, they share their gradient, data range and data scale type (setGradient, setDataRange, setDataScaleType). Multiple color maps may be associated with a single color scale, to make them all synchronize these properties.
+To have finer control over the number display and axis behaviour, you can directly access the axis. See the documentation of QCPAxis for details about configuring axes. For example, if you want to change the number of automatically generated ticks, call
Placing a color scale next to the main axis rect works like with any other layout element:
In this case we have placed it to the right of the default axis rect, so it wasn't necessary to call setType, since QCPAxis::atRight is already the default. The text next to the color scale can be set with setLabel.
+For optimum appearance (like in the image above), it may be desirable to line up the axis rect and the borders of the color scale. Use a QCPMarginGroup to achieve this:
Color scales are initialized with a non-zero minimum top and bottom margin (setMinimumMargins), because vertical color scales are most common and the minimum top/bottom margin makes sure it keeps some distance to the top/bottom widget border. So if you change to a horizontal color scale by setting setType to QCPAxis::atBottom or QCPAxis::atTop, you might want to also change the minimum margins accordingly, e.g. setMinimumMargins(QMargins(6, 0, 6, 0)).
+
|
+ +explicit | +
Constructs a new QCPColorScale.
+ +
+
|
+ +inline | +
Returns the internal QCPAxis instance of this color scale. You can access it to alter the appearance and behaviour of the axis. QCPColorScale duplicates some properties in its interface for convenience. Those are setDataRange (QCPAxis::setRange), setDataScaleType (QCPAxis::setScaleType), and the method setLabel (QCPAxis::setLabel). As they each are connected, it does not matter whether you use the method on the QCPColorScale or on its QCPAxis.
+If the type of the color scale is changed with setType, the axis returned by this method will change, too, to either the left, right, bottom or top axis, depending on which type was set.
+ +| void QCPColorScale::setType | +( | +QCPAxis::AxisType | +type | ) | ++ |
Sets at which side of the color scale the axis is placed, and thus also its orientation.
+Note that after setting type to a different value, the axis returned by axis() will be a different one. The new axis will adopt the following properties from the previous axis: The range, scale type, label and ticker (the latter will be shared and not copied).
+ +| void QCPColorScale::setDataRange | +( | +const QCPRange & | +dataRange | ) | ++ |
Sets the range spanned by the color gradient and that is shown by the axis in the color scale.
+It is equivalent to calling QCPColorMap::setDataRange on any of the connected color maps. It is also equivalent to directly accessing the axis and setting its range with QCPAxis::setRange.
+| void QCPColorScale::setDataScaleType | +( | +QCPAxis::ScaleType | +scaleType | ) | ++ |
Sets the scale type of the color scale, i.e. whether values are associated with colors linearly or logarithmically.
+It is equivalent to calling QCPColorMap::setDataScaleType on any of the connected color maps. It is also equivalent to directly accessing the axis and setting its scale type with QCPAxis::setScaleType.
+Note that this method controls the coordinate transformation. For logarithmic scales, you will likely also want to use a logarithmic tick spacing and labeling, which can be achieved by setting the color scale's axis ticker to an instance of QCPAxisTickerLog :
+See the documentation of QCPAxisTickerLog about the details of logarithmic axis tick creation.
+| void QCPColorScale::setGradient | +( | +const QCPColorGradient & | +gradient | ) | ++ |
Sets the color gradient that will be used to represent data values.
+It is equivalent to calling QCPColorMap::setGradient on any of the connected color maps.
+| void QCPColorScale::setLabel | +( | +const QString & | +str | ) | ++ |
Sets the axis label of the color scale. This is equivalent to calling QCPAxis::setLabel on the internal axis.
+ +| void QCPColorScale::setBarWidth | +( | +int | +width | ) | ++ |
Sets the width (or height, for horizontal color scales) the bar where the gradient is displayed will have.
+ +| void QCPColorScale::setRangeDrag | +( | +bool | +enabled | ) | ++ |
Sets whether the user can drag the data range (setDataRange).
+Note that QCP::iRangeDrag must be in the QCustomPlot's interactions (QCustomPlot::setInteractions) to allow range dragging.
+ +| void QCPColorScale::setRangeZoom | +( | +bool | +enabled | ) | ++ |
Sets whether the user can zoom the data range (setDataRange) by scrolling the mouse wheel.
+Note that QCP::iRangeZoom must be in the QCustomPlot's interactions (QCustomPlot::setInteractions) to allow range dragging.
+ +| QList< QCPColorMap * > QCPColorScale::colorMaps | +( | +) | +const | +
Returns a list of all the color maps associated with this color scale.
+ +| void QCPColorScale::rescaleDataRange | +( | +bool | +onlyVisibleMaps | ) | ++ |
Changes the data range such that all color maps associated with this color scale are fully mapped to the gradient in the data dimension.
+
+
|
+ +virtual | +
Updates the layout element and sub-elements. This function is automatically called before every replot by the parent layout element. It is called multiple times, once for every UpdatePhase. The phases are run through in the order of the enum values. For details about what happens at the different phases, see the documentation of UpdatePhase.
+Layout elements that have child elements should call the update method of their child elements, and pass the current phase unchanged.
+The default implementation executes the automatic margin mechanism in the upMargins phase. Subclasses should make sure to call the base class implementation.
+ +Reimplemented from QCPLayoutElement.
+ +
+
|
+ +signal | +
This signal is emitted when the data range changes.
+
+
|
+ +signal | +
This signal is emitted when the data scale type changes.
+
+
|
+ +signal | +
This signal is emitted when the gradient changes.
+
+
|
+ +protectedvirtual | +
This function applies the default antialiasing setting to the specified painter, using the function applyAntialiasingHint. It is the antialiasing state the painter is put in, when draw is called on the layerable. If the layerable has multiple entities whose antialiasing setting may be specified individually, this function should set the antialiasing state of the most prominent entity. In this case however, the draw function usually calls the specialized versions of this function before drawing each entity, effectively overriding the setting of the default antialiasing hint.
+First example: QCPGraph has multiple entities that have an antialiasing setting: The graph line, fills and scatters. Those can be configured via QCPGraph::setAntialiased, QCPGraph::setAntialiasedFill and QCPGraph::setAntialiasedScatters. Consequently, there isn't only the QCPGraph::applyDefaultAntialiasingHint function (which corresponds to the graph line's antialiasing), but specialized ones like QCPGraph::applyFillAntialiasingHint and QCPGraph::applyScattersAntialiasingHint. So before drawing one of those entities, QCPGraph::draw calls the respective specialized applyAntialiasingHint function.
+Second example: QCPItemLine consists only of a line so there is only one antialiasing setting which can be controlled with QCPItemLine::setAntialiased. (This function is inherited by all layerables. The specialized functions, as seen on QCPGraph, must be added explicitly to the respective layerable subclass.) Consequently it only has the normal QCPItemLine::applyDefaultAntialiasingHint. The QCPItemLine::draw function doesn't need to care about setting any antialiasing states, because the default antialiasing hint is already set on the painter when the draw function is called, and that's the state it wants to draw the line with.
+ +Reimplemented from QCPLayoutElement.
+ +
+
|
+ +protectedvirtual | +
This event gets called when the user presses a mouse button while the cursor is over the layerable. Whether a cursor is over the layerable is decided by a preceding call to selectTest.
+The current pixel position of the cursor on the QCustomPlot widget is accessible via event->pos(). The parameter details contains layerable-specific details about the hit, which were generated in the previous call to selectTest. For example, One-dimensional plottables like QCPGraph or QCPBars convey the clicked data point in the details parameter, as QCPDataSelection packed as QVariant. Multi-part objects convey the specific SelectablePart that was hit (e.g. QCPAxis::SelectablePart in the case of axes).
QCustomPlot uses an event propagation system that works the same as Qt's system. If your layerable doesn't reimplement the mousePressEvent or explicitly calls event->ignore() in its reimplementation, the event will be propagated to the next layerable in the stacking order.
Once a layerable has accepted the mousePressEvent, it is considered the mouse grabber and will receive all following calls to mouseMoveEvent or mouseReleaseEvent for this mouse interaction (a "mouse interaction" in this context ends with the release).
+The default implementation does nothing except explicitly ignoring the event with event->ignore().
Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
This event gets called when the user moves the mouse while holding a mouse button, after this layerable has become the mouse grabber by accepting the preceding mousePressEvent.
+The current pixel position of the cursor on the QCustomPlot widget is accessible via event->pos(). The parameter startPos indicates the position where the initial mousePressEvent occured, that started the mouse interaction.
The default implementation does nothing.
+ + +Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
This event gets called when the user releases the mouse button, after this layerable has become the mouse grabber by accepting the preceding mousePressEvent.
+The current pixel position of the cursor on the QCustomPlot widget is accessible via event->pos(). The parameter startPos indicates the position where the initial mousePressEvent occured, that started the mouse interaction.
The default implementation does nothing.
+ + +Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
This event gets called when the user turns the mouse scroll wheel while the cursor is over the layerable. Whether a cursor is over the layerable is decided by a preceding call to selectTest.
+The current pixel position of the cursor on the QCustomPlot widget is accessible via event->pos().
The event->delta() indicates how far the mouse wheel was turned, which is usually +/- 120 for single rotation steps. However, if the mouse wheel is turned rapidly, multiple steps may accumulate to one event, making event->delta() larger. On the other hand, if the wheel has very smooth steps or none at all, the delta may be smaller.
The default implementation does nothing.
+ + +Reimplemented from QCPLayerable.
+ +A plottable representing a parametric curve in a plot. + More...
+
+Public Types | |
| enum | LineStyle |
+Public Functions | |
| QCPCurve (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
| QSharedPointer< QCPCurveDataContainer > | data () const |
| +QCPScatterStyle | scatterStyle () const |
| +int | scatterSkip () const |
| +LineStyle | lineStyle () const |
| void | setData (QSharedPointer< QCPCurveDataContainer > data) |
| void | setData (const QVector< double > &t, const QVector< double > &keys, const QVector< double > &values, bool alreadySorted=false) |
| void | setData (const QVector< double > &keys, const QVector< double > &values) |
| void | setScatterStyle (const QCPScatterStyle &style) |
| void | setScatterSkip (int skip) |
| void | setLineStyle (LineStyle style) |
| void | addData (const QVector< double > &t, const QVector< double > &keys, const QVector< double > &values, bool alreadySorted=false) |
| void | addData (const QVector< double > &keys, const QVector< double > &values) |
| void | addData (double t, double key, double value) |
| void | addData (double key, double value) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
| virtual QCPRange | getKeyRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const |
| virtual QCPRange | getValueRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const |
Public Functions inherited from QCPAbstractPlottable1D< QCPCurveData > | |
| QCPAbstractPlottable1D (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
| virtual int | dataCount () const |
| virtual double | dataMainKey (int index) const |
| virtual double | dataSortKey (int index) const |
| virtual double | dataMainValue (int index) const |
| virtual QCPRange | dataValueRange (int index) const |
| virtual QPointF | dataPixelPosition (int index) const |
| virtual bool | sortKeyIsMainKey () const |
| virtual QCPDataSelection | selectTestRect (const QRectF &rect, bool onlySelectable) const |
| virtual int | findBegin (double sortKey, bool expandedRange=true) const |
| virtual int | findEnd (double sortKey, bool expandedRange=true) const |
| virtual QCPPlottableInterface1D * | interface1D () |
Public Functions inherited from QCPAbstractPlottable | |
| QCPAbstractPlottable (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
| +QString | name () const |
| +bool | antialiasedFill () const |
| +bool | antialiasedScatters () const |
| +QPen | pen () const |
| +QBrush | brush () const |
| +QCPAxis * | keyAxis () const |
| +QCPAxis * | valueAxis () const |
| +QCP::SelectionType | selectable () const |
| bool | selected () const |
| QCPDataSelection | selection () const |
| QCPSelectionDecorator * | selectionDecorator () const |
| void | setName (const QString &name) |
| void | setAntialiasedFill (bool enabled) |
| void | setAntialiasedScatters (bool enabled) |
| void | setPen (const QPen &pen) |
| void | setBrush (const QBrush &brush) |
| void | setKeyAxis (QCPAxis *axis) |
| void | setValueAxis (QCPAxis *axis) |
| Q_SLOT void | setSelectable (QCP::SelectionType selectable) |
| Q_SLOT void | setSelection (QCPDataSelection selection) |
| void | setSelectionDecorator (QCPSelectionDecorator *decorator) |
| void | coordsToPixels (double key, double value, double &x, double &y) const |
| const QPointF | coordsToPixels (double key, double value) const |
| void | pixelsToCoords (double x, double y, double &key, double &value) const |
| void | pixelsToCoords (const QPointF &pixelPos, double &key, double &value) const |
| void | rescaleAxes (bool onlyEnlarge=false) const |
| void | rescaleKeyAxis (bool onlyEnlarge=false) const |
| void | rescaleValueAxis (bool onlyEnlarge=false, bool inKeyRange=false) const |
| bool | addToLegend (QCPLegend *legend) |
| bool | addToLegend () |
| bool | removeFromLegend (QCPLegend *legend) const |
| bool | removeFromLegend () const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Protected Functions | |
| virtual void | draw (QCPPainter *painter) |
| virtual void | drawLegendIcon (QCPPainter *painter, const QRectF &rect) const |
| virtual void | drawCurveLine (QCPPainter *painter, const QVector< QPointF > &lines) const |
| virtual void | drawScatterPlot (QCPPainter *painter, const QVector< QPointF > &points, const QCPScatterStyle &style) const |
| void | getCurveLines (QVector< QPointF > *lines, const QCPDataRange &dataRange, double penWidth) const |
| void | getScatters (QVector< QPointF > *scatters, const QCPDataRange &dataRange, double scatterWidth) const |
| int | getRegion (double key, double value, double keyMin, double valueMax, double keyMax, double valueMin) const |
| QPointF | getOptimizedPoint (int prevRegion, double prevKey, double prevValue, double key, double value, double keyMin, double valueMax, double keyMax, double valueMin) const |
| QVector< QPointF > | getOptimizedCornerPoints (int prevRegion, int currentRegion, double prevKey, double prevValue, double key, double value, double keyMin, double valueMax, double keyMax, double valueMin) const |
| bool | mayTraverse (int prevRegion, int currentRegion) const |
| bool | getTraverse (double prevKey, double prevValue, double key, double value, double keyMin, double valueMax, double keyMax, double valueMin, QPointF &crossA, QPointF &crossB) const |
| void | getTraverseCornerPoints (int prevRegion, int currentRegion, double keyMin, double valueMax, double keyMax, double valueMin, QVector< QPointF > &beforeTraverse, QVector< QPointF > &afterTraverse) const |
| double | pointDistance (const QPointF &pixelPoint, QCPCurveDataContainer::const_iterator &closestData) const |
Protected Functions inherited from QCPAbstractPlottable1D< QCPCurveData > | |
| void | getDataSegments (QList< QCPDataRange > &selectedSegments, QList< QCPDataRange > &unselectedSegments) const |
| void | drawPolyline (QCPPainter *painter, const QVector< QPointF > &lineData) const |
Protected Functions inherited from QCPAbstractPlottable | |
| virtual QRect | clipRect () const |
| virtual QCP::Interaction | selectionCategory () const |
| void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| void | applyFillAntialiasingHint (QCPPainter *painter) const |
| void | applyScattersAntialiasingHint (QCPPainter *painter) const |
Protected Functions inherited from QCPLayerable | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Additional Inherited Members | |
Signals inherited from QCPAbstractPlottable | |
| void | selectionChanged (bool selected) |
| void | selectionChanged (const QCPDataSelection &selection) |
| void | selectableChanged (QCP::SelectionType selectable) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
A plottable representing a parametric curve in a plot.
+
+Unlike QCPGraph, plottables of this type may have multiple points with the same key coordinate, so their visual representation can have loops. This is realized by introducing a third coordinate t, which defines the order of the points described by the other two coordinates x and y.
+To plot data, assign it with the setData or addData functions. Alternatively, you can also access and modify the curve's data via the data method, which returns a pointer to the internal QCPCurveDataContainer.
+Gaps in the curve can be created by adding data points with NaN as key and value (qQNaN() or std::numeric_limits<double>::quiet_NaN()) in between the two data points that shall be separated.
The appearance of the curve is determined by the pen and the brush (setPen, setBrush).
+Like all data representing objects in QCustomPlot, the QCPCurve is a plottable (QCPAbstractPlottable). So the plottable-interface of QCustomPlot applies (QCustomPlot::plottable, QCustomPlot::removePlottable, etc.)
+Usually, you first create an instance:
which registers it with the QCustomPlot instance of the passed axes. Note that this QCustomPlot instance takes ownership of the plottable, so do not delete it manually but use QCustomPlot::removePlottable() instead. The newly created plottable can be modified, e.g.:
| enum QCPCurve::LineStyle | +
Defines how the curve's line is represented visually in the plot. The line is drawn with the current pen of the curve (setPen).
| Enumerator | |
|---|---|
| lsNone | No line is drawn between data points (e.g. only scatters) + |
| lsLine | Data points are connected with a straight line. + |
+
|
+ +explicit | +
Constructs a curve which uses keyAxis as its key axis ("x") and valueAxis as its value axis ("y"). keyAxis and valueAxis must reside in the same QCustomPlot instance and not have the same orientation. If either of these restrictions is violated, a corresponding message is printed to the debug output (qDebug), the construction is not aborted, though.
+The created QCPCurve is automatically registered with the QCustomPlot instance inferred from keyAxis. This QCustomPlot instance takes ownership of the QCPCurve, so do not delete it manually but use QCustomPlot::removePlottable() instead.
+ +
+
|
+ +inline | +
Returns a shared pointer to the internal data storage of type QCPCurveDataContainer. You may use it to directly manipulate the data, which may be more convenient and faster than using the regular setData or addData methods.
+ +| void QCPCurve::setData | +( | +QSharedPointer< QCPCurveDataContainer > | +data | ) | ++ |
This is an overloaded function.
+Replaces the current data container with the provided data container.
+Since a QSharedPointer is used, multiple QCPCurves may share the same data container safely. Modifying the data in the container will then affect all curves that share the container. Sharing can be achieved by simply exchanging the data containers wrapped in shared pointers:
If you do not wish to share containers, but create a copy from an existing container, rather use the QCPDataContainer<DataType>::set method on the curve's data container directly:
| void QCPCurve::setData | +( | +const QVector< double > & | +t, | +
| + | + | const QVector< double > & | +keys, | +
| + | + | const QVector< double > & | +values, | +
| + | + | bool | +alreadySorted = false |
+
| + | ) | ++ |
This is an overloaded function.
+Replaces the current data with the provided points in t, keys and values. The provided vectors should have equal length. Else, the number of added points will be the size of the smallest vector.
+If you can guarantee that the passed data points are sorted by t in ascending order, you can set alreadySorted to true, to improve performance by saving a sorting run.
+| void QCPCurve::setData | +( | +const QVector< double > & | +keys, | +
| + | + | const QVector< double > & | +values | +
| + | ) | ++ |
This is an overloaded function.
+Replaces the current data with the provided points in keys and values. The provided vectors should have equal length. Else, the number of added points will be the size of the smallest vector.
+The t parameter of each data point will be set to the integer index of the respective key/value pair.
+| void QCPCurve::setScatterStyle | +( | +const QCPScatterStyle & | +style | ) | ++ |
Sets the visual appearance of single data points in the plot. If set to QCPScatterStyle::ssNone, no scatter points are drawn (e.g. for line-only plots with appropriate line style).
+| void QCPCurve::setScatterSkip | +( | +int | +skip | ) | ++ |
If scatters are displayed (scatter style not QCPScatterStyle::ssNone), skip number of scatter points are skipped/not drawn after every drawn scatter point.
+This can be used to make the data appear sparser while for example still having a smooth line, and to improve performance for very high density plots.
+If skip is set to 0 (default), all scatter points are drawn.
+| void QCPCurve::setLineStyle | +( | +QCPCurve::LineStyle | +style | ) | ++ |
Sets how the single data points are connected in the plot or how they are represented visually apart from the scatter symbol. For scatter-only plots, set style to lsNone and setScatterStyle to the desired scatter style.
+| void QCPCurve::addData | +( | +const QVector< double > & | +t, | +
| + | + | const QVector< double > & | +keys, | +
| + | + | const QVector< double > & | +values, | +
| + | + | bool | +alreadySorted = false |
+
| + | ) | ++ |
This is an overloaded function.
+Adds the provided points in t, keys and values to the current data. The provided vectors should have equal length. Else, the number of added points will be the size of the smallest vector.
+If you can guarantee that the passed data points are sorted by keys in ascending order, you can set alreadySorted to true, to improve performance by saving a sorting run.
+Alternatively, you can also access and modify the data directly via the data method, which returns a pointer to the internal data container.
+ +| void QCPCurve::addData | +( | +const QVector< double > & | +keys, | +
| + | + | const QVector< double > & | +values | +
| + | ) | ++ |
This is an overloaded function.
+Adds the provided points in keys and values to the current data. The provided vectors should have equal length. Else, the number of added points will be the size of the smallest vector.
+The t parameter of each data point will be set to the integer index of the respective key/value pair.
+Alternatively, you can also access and modify the data directly via the data method, which returns a pointer to the internal data container.
+ +| void QCPCurve::addData | +( | +double | +t, | +
| + | + | double | +key, | +
| + | + | double | +value | +
| + | ) | ++ |
This is an overloaded function. Adds the provided data point as t, key and value to the current data.
+Alternatively, you can also access and modify the data directly via the data method, which returns a pointer to the internal data container.
+ +| void QCPCurve::addData | +( | +double | +key, | +
| + | + | double | +value | +
| + | ) | ++ |
This is an overloaded function.
+Adds the provided data point as key and value to the current data.
+The t parameter is generated automatically by increments of 1 for each point, starting at the highest t of previously existing data or 0, if the curve data is empty.
+Alternatively, you can also access and modify the data directly via the data method, which returns a pointer to the internal data container.
+ +
+
|
+ +virtual | +
Implements a selectTest specific to this plottable's point geometry.
+If details is not 0, it will be set to a QCPDataSelection, describing the closest data point to pos.
+For general information about this virtual method, see the base class implementation. QCPAbstractPlottable::selectTest
+ +Reimplemented from QCPAbstractPlottable1D< QCPCurveData >.
+ +
+
|
+ +virtual | +
Returns the coordinate range that all data in this plottable span in the key axis dimension. For logarithmic plots, one can set inSignDomain to either QCP::sdNegative or QCP::sdPositive in order to restrict the returned range to that sign domain. E.g. when only negative range is wanted, set inSignDomain to QCP::sdNegative and all positive points will be ignored for range calculation. For no restriction, just set inSignDomain to QCP::sdBoth (default). foundRange is an output parameter that indicates whether a range could be found or not. If this is false, you shouldn't use the returned range (e.g. no points in data).
+Note that foundRange is not the same as QCPRange::validRange, since the range returned by this function may have size zero (e.g. when there is only one data point). In this case foundRange would return true, but the returned range is not a valid range in terms of QCPRange::validRange.
+Implements QCPAbstractPlottable.
+ +
+
|
+ +virtual | +
Returns the coordinate range that the data points in the specified key range (inKeyRange) span in the value axis dimension. For logarithmic plots, one can set inSignDomain to either QCP::sdNegative or QCP::sdPositive in order to restrict the returned range to that sign domain. E.g. when only negative range is wanted, set inSignDomain to QCP::sdNegative and all positive points will be ignored for range calculation. For no restriction, just set inSignDomain to QCP::sdBoth (default). foundRange is an output parameter that indicates whether a range could be found or not. If this is false, you shouldn't use the returned range (e.g. no points in data).
+If inKeyRange has both lower and upper bound set to zero (is equal to QCPRange()), all data points are considered, without any restriction on the keys.
Note that foundRange is not the same as QCPRange::validRange, since the range returned by this function may have size zero (e.g. when there is only one data point). In this case foundRange would return true, but the returned range is not a valid range in terms of QCPRange::validRange.
+Implements QCPAbstractPlottable.
+ +
+
|
+ +protectedvirtual | +
This function draws the layerable with the specified painter. It is only called by QCustomPlot, if the layerable is visible (setVisible).
+Before this function is called, the painter's antialiasing state is set via applyDefaultAntialiasingHint, see the documentation there. Further, the clipping rectangle was set to clipRect.
+ +Implements QCPAbstractPlottable.
+ +
+
|
+ +protectedvirtual | +
called by QCPLegend::draw (via QCPPlottableLegendItem::draw) to create a graphical representation of this plottable inside rect, next to the plottable name.
+The passed painter has its cliprect set to rect, so painting outside of rect won't appear outside the legend icon border.
+ +Implements QCPAbstractPlottable.
+ +
+
|
+ +protectedvirtual | +
Draws lines between the points in lines, given in pixel coordinates.
+
+
|
+ +protectedvirtual | +
Draws scatter symbols at every point passed in points, given in pixel coordinates. The scatters will be drawn with painter and have the appearance as specified in style.
+
+
|
+ +protected | +
Called by draw to generate points in pixel coordinates which represent the line of the curve.
+Line segments that aren't visible in the current axis rect are handled in an optimized way. They are projected onto a rectangle slightly larger than the visible axis rect and simplified regarding point count. The algorithm makes sure to preserve appearance of lines and fills inside the visible axis rect by generating new temporary points on the outer rect if necessary.
+lines will be filled with points in pixel coordinates, that can be drawn with drawCurveLine.
+dataRange specifies the beginning and ending data indices that will be taken into account for conversion. In this function, the specified range may exceed the total data bounds without harm: a correspondingly trimmed data range will be used. This takes the burden off the user of this function to check for valid indices in dataRange, e.g. when extending ranges coming from getDataSegments.
+penWidth specifies the pen width that will be used to later draw the lines generated by this function. This is needed here to calculate an accordingly wider margin around the axis rect when performing the line optimization.
+Methods that are also involved in the algorithm are: getRegion, getOptimizedPoint, getOptimizedCornerPoints mayTraverse, getTraverse, getTraverseCornerPoints.
+
+
|
+ +protected | +
Called by draw to generate points in pixel coordinates which represent the scatters of the curve. If a scatter skip is configured (setScatterSkip), the returned points are accordingly sparser.
+Scatters that aren't visible in the current axis rect are optimized away.
+scatters will be filled with points in pixel coordinates, that can be drawn with drawScatterPlot.
+dataRange specifies the beginning and ending data indices that will be taken into account for conversion.
+scatterWidth specifies the scatter width that will be used to later draw the scatters at pixel coordinates generated by this function. This is needed here to calculate an accordingly wider margin around the axis rect when performing the data point reduction.
+
+
|
+ +protected | +
This function is part of the curve optimization algorithm of getCurveLines.
+It returns the region of the given point (key, value) with respect to a rectangle defined by keyMin, keyMax, valueMin, and valueMax.
+The regions are enumerated from top to bottom (valueMin to valueMax) and left to right (keyMin to keyMax):
+| 1 | 4 | 7 |
| 2 | 5 | 8 |
| 3 | 6 | 9 |
With the rectangle being region 5, and the outer regions extending infinitely outwards. In the curve optimization algorithm, region 5 is considered to be the visible portion of the plot.
+ +
+
|
+ +protected | +
This function is part of the curve optimization algorithm of getCurveLines.
+This method is used in case the current segment passes from inside the visible rect (region 5, see getRegion) to any of the outer regions (otherRegion). The current segment is given by the line connecting (key, value) with (otherKey, otherValue).
+It returns the intersection point of the segment with the border of region 5.
+For this function it doesn't matter whether (key, value) is the point inside region 5 or whether it's (otherKey, otherValue), i.e. whether the segment is coming from region 5 or leaving it. It is important though that otherRegion correctly identifies the other region not equal to 5.
+ +
+
|
+ +protected | +
This function is part of the curve optimization algorithm of getCurveLines.
+In situations where a single segment skips over multiple regions it might become necessary to add extra points at the corners of region 5 (see getRegion) such that the optimized segment doesn't unintentionally cut through the visible area of the axis rect and create plot artifacts. This method provides these points that must be added, assuming the original segment doesn't start, end, or traverse region 5. (Corner points where region 5 is traversed are calculated by getTraverseCornerPoints.)
+For example, consider a segment which directly goes from region 4 to 2 but originally is far out to the top left such that it doesn't cross region 5. Naively optimizing these points by projecting them on the top and left borders of region 5 will create a segment that surely crosses 5, creating a visual artifact in the plot. This method prevents this by providing extra points at the top left corner, making the optimized curve correctly pass from region 4 to 1 to 2 without traversing 5.
+ +
+
|
+ +protected | +
This function is part of the curve optimization algorithm of getCurveLines.
+This method returns whether a segment going from prevRegion to currentRegion (see getRegion) may traverse the visible region 5. This function assumes that neither prevRegion nor currentRegion is 5 itself.
+If this method returns false, the segment for sure doesn't pass region 5. If it returns true, the segment may or may not pass region 5 and a more fine-grained calculation must be used (getTraverse).
+ +
+
|
+ +protected | +
This function is part of the curve optimization algorithm of getCurveLines.
+This method assumes that the mayTraverse test has returned true, so there is a chance the segment defined by (prevKey, prevValue) and (key, value) goes through the visible region 5.
+The return value of this method indicates whether the segment actually traverses region 5 or not.
+If the segment traverses 5, the output parameters crossA and crossB indicate the entry and exit points of region 5. They will become the optimized points for that segment.
+ +
+
|
+ +protected | +
This function is part of the curve optimization algorithm of getCurveLines.
+This method assumes that the getTraverse test has returned true, so the segment definitely traverses the visible region 5 when going from prevRegion to currentRegion.
+In certain situations it is not sufficient to merely generate the entry and exit points of the segment into/out of region 5, as getTraverse provides. It may happen that a single segment, in addition to traversing region 5, skips another region outside of region 5, which makes it necessary to add an optimized corner point there (very similar to the job getOptimizedCornerPoints does for segments that are completely in outside regions and don't traverse 5).
+As an example, consider a segment going from region 1 to region 6, traversing the lower left corner of region 5. In this configuration, the segment additionally crosses the border between region 1 and 2 before entering region 5. This makes it necessary to add an additional point in the top left corner, before adding the optimized traverse points. So in this case, the output parameter beforeTraverse will contain the top left corner point, and afterTraverse will be empty.
+In some cases, such as when going from region 1 to 9, it may even be necessary to add additional corner points before and after the traverse. Then both beforeTraverse and afterTraverse return the respective corner points.
+ +
+
|
+ +protected | +
Calculates the (minimum) distance (in pixels) the curve's representation has from the given pixelPoint in pixels. This is used to determine whether the curve was clicked or not, e.g. in selectTest. The closest data point to pixelPoint is returned in closestData. Note that if the curve has a line representation, the returned distance may be smaller than the distance to the closestData point, since the distance to the curve line is also taken into account.
+If either the curve has no data or if the line style is lsNone and the scatter style's shape is QCPScatterStyle::ssNone (i.e. there is no visual representation of the curve), returns -1.0.
+ +Holds the data of one single data point for QCPCurve. + More...
++Public Functions | |
| QCPCurveData () | |
| QCPCurveData (double t, double key, double value) | |
| double | sortKey () const |
| double | mainKey () const |
| double | mainValue () const |
| QCPRange | valueRange () const |
+Public Members | |
| +double | t |
| +double | key |
| +double | value |
+Static Public Functions | |
| static QCPCurveData | fromSortKey (double sortKey) |
| static bool | sortKeyIsMainKey () |
Holds the data of one single data point for QCPCurve.
+The stored data is:
The container for storing multiple data points is QCPCurveDataContainer. It is a typedef for QCPDataContainer with QCPCurveData as the DataType template parameter. See the documentation there for an explanation regarding the data type's generic methods.
+| QCPCurveData::QCPCurveData | +( | +) | ++ |
Constructs a curve data point with t, key and value set to zero.
+ +| QCPCurveData::QCPCurveData | +( | +double | +t, | +
| + | + | double | +key, | +
| + | + | double | +value | +
| + | ) | ++ |
Constructs a curve data point with the specified t, key and value.
+ +
+
|
+ +inline | +
Returns the t member of this data point.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +
+
|
+ +inlinestatic | +
Returns a data point with the specified sortKey (assigned to the data point's t member). All other members are set to zero.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +
+
|
+ +inlinestatic | +
Since the member key is the data point key coordinate and the member t is the data ordering parameter, this method returns false.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +
+
|
+ +inline | +
Returns the key member of this data point.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +
+
|
+ +inline | +
Returns the value member of this data point.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +
+
|
+ +inline | +
Returns a QCPRange with both lower and upper boundary set to value of this data point.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +The generic data container for one-dimensional plottables. + More...
++Public Types | |
| +typedef QVector< DataType >::const_iterator | const_iterator |
| +typedef QVector< DataType >::iterator | iterator |
+Public Functions | |
| QCPDataContainer () | |
| int | size () const |
| bool | isEmpty () const |
| +bool | autoSqueeze () const |
| void | setAutoSqueeze (bool enabled) |
| void | set (const QCPDataContainer< DataType > &data) |
| void | set (const QVector< DataType > &data, bool alreadySorted=false) |
| void | add (const QCPDataContainer< DataType > &data) |
| void | add (const QVector< DataType > &data, bool alreadySorted=false) |
| void | add (const DataType &data) |
| void | removeBefore (double sortKey) |
| void | removeAfter (double sortKey) |
| void | remove (double sortKeyFrom, double sortKeyTo) |
| void | remove (double sortKey) |
| void | clear () |
| void | sort () |
| void | squeeze (bool preAllocation=true, bool postAllocation=true) |
| const_iterator | constBegin () const |
| const_iterator | constEnd () const |
| iterator | begin () |
| iterator | end () |
| const_iterator | findBegin (double sortKey, bool expandedRange=true) const |
| const_iterator | findEnd (double sortKey, bool expandedRange=true) const |
| const_iterator | at (int index) const |
| QCPRange | keyRange (bool &foundRange, QCP::SignDomain signDomain=QCP::sdBoth) |
| QCPRange | valueRange (bool &foundRange, QCP::SignDomain signDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) |
| QCPDataRange | dataRange () const |
| void | limitIteratorsToDataRange (const_iterator &begin, const_iterator &end, const QCPDataRange &dataRange) const |
+Protected Functions | |
| void | preallocateGrow (int minimumPreallocSize) |
| void | performAutoSqueeze () |
+Related Non-Members | |
(Note that these are not member functions.) + | |
| template<class DataType > | |
| bool | qcpLessThanSortKey (const DataType &a, const DataType &b) |
The generic data container for one-dimensional plottables.
+This class template provides a fast container for data storage of one-dimensional data. The data type is specified as template parameter (called DataType in the following) and must provide some methods as described in the next section.
+The data is stored in a sorted fashion, which allows very quick lookups by the sorted key as well as retrieval of ranges (see findBegin, findEnd, keyRange) using binary search. The container uses a preallocation and a postallocation scheme, such that appending and prepending data (with respect to the sort key) is very fast and minimizes reallocations. If data is added which needs to be inserted between existing keys, the merge usually can be done quickly too, using the fact that existing data is always sorted. The user can further improve performance by specifying that added data is already itself sorted by key, if he can guarantee that this is the case (see for example add(const QVector<DataType> &data, bool alreadySorted)).
+The data can be accessed with the provided const iterators (constBegin, constEnd). If it is necessary to alter existing data in-place, the non-const iterators can be used (begin, end). Changing data members that are not the sort key (for most data types called key) is safe from the container's perspective.
+Great care must be taken however if the sort key is modified through the non-const iterators. For performance reasons, the iterators don't automatically cause a re-sorting upon their manipulation. It is thus the responsibility of the user to leave the container in a sorted state when finished with the data manipulation, before calling any other methods on the container. A complete re-sort (e.g. after finishing all sort key manipulation) can be done by calling sort. Failing to do so can not be detected by the container efficiently and will cause both rendering artifacts and potential data loss.
+Implementing one-dimensional plottables that make use of a QCPDataContainer<T> is usually done by subclassing from QCPAbstractPlottable1D<T>, which introduces an according mDataContainer member and some convenience methods.
+The template parameter DataType is the type of the stored data points. It must be trivially copyable and have the following public methods, preferably inline:
double sortKey() conststatic DataType fromSortKey(double sortKey)static bool sortKeyIsMainKey()mainKey below). For most plottables this is the case. It is not the case for example for QCPCurve, which uses t as sort key and key as main key. This is the reason why QCPCurve unlike QCPGraph can display parametric curves with loops.double mainKey() constdouble mainValue() constQCPRange valueRange() const| QCPDataContainer< DataType >::QCPDataContainer | +( | +) | ++ |
Constructs a QCPDataContainer used for plottable classes that represent a series of key-sorted data
+ +
+
|
+ +inline | +
Returns the number of data points in the container.
+ +
+
|
+ +inline | +
Returns whether this container holds no data points.
+ +| void QCPDataContainer< DataType >::setAutoSqueeze | +( | +bool | +enabled | ) | ++ |
Sets whether the container automatically decides when to release memory from its post- and preallocation pools when data points are removed. By default this is enabled and for typical applications shouldn't be changed.
+If auto squeeze is disabled, you can manually decide when to release pre-/postallocation with squeeze.
+ +| void QCPDataContainer< DataType >::set | +( | +const QCPDataContainer< DataType > & | +data | ) | ++ |
| void QCPDataContainer< DataType >::set | +( | +const QVector< DataType > & | +data, | +
| + | + | bool | +alreadySorted = false |
+
| + | ) | ++ |
This is an overloaded function.
+Replaces the current data in this container with the provided data
+If you can guarantee that the data points in data have ascending order with respect to the DataType's sort key, set alreadySorted to true to avoid an unnecessary sorting run.
+ + +| void QCPDataContainer< DataType >::add | +( | +const QCPDataContainer< DataType > & | +data | ) | ++ |
| void QCPDataContainer< DataType >::add | +( | +const QVector< DataType > & | +data, | +
| + | + | bool | +alreadySorted = false |
+
| + | ) | ++ |
| void QCPDataContainer< DataType >::add | +( | +const DataType & | +data | ) | ++ |
This is an overloaded function.
+Adds the provided single data point to the current data.
+| void QCPDataContainer< DataType >::removeBefore | +( | +double | +sortKey | ) | ++ |
Removes all data points with (sort-)keys smaller than or equal to sortKey.
+| void QCPDataContainer< DataType >::removeAfter | +( | +double | +sortKey | ) | ++ |
Removes all data points with (sort-)keys greater than or equal to sortKey.
+| void QCPDataContainer< DataType >::remove | +( | +double | +sortKeyFrom, | +
| + | + | double | +sortKeyTo | +
| + | ) | ++ |
Removes all data points with (sort-)keys between sortKeyFrom and sortKeyTo. if sortKeyFrom is greater or equal to sortKeyTo, the function does nothing. To remove a single data point with known (sort-)key, use remove(double sortKey).
+| void QCPDataContainer< DataType >::remove | +( | +double | +sortKey | ) | ++ |
This is an overloaded function.
+Removes a single data point at sortKey. If the position is not known with absolute (binary) precision, consider using remove(double sortKeyFrom, double sortKeyTo) with a small fuzziness interval around the suspected position, depeding on the precision with which the (sort-)key is known.
+| void QCPDataContainer< DataType >::clear | +( | +) | ++ |
Removes all data points.
+| void QCPDataContainer< DataType >::sort | +( | +) | ++ |
Re-sorts all data points in the container by their sort key.
+When setting, adding or removing points using the QCPDataContainer interface (set, add, remove, etc.), the container makes sure to always stay in a sorted state such that a full resort is never necessary. However, if you choose to directly manipulate the sort key on data points by accessing and modifying it through the non-const iterators (begin, end), it is your responsibility to bring the container back into a sorted state before any other methods are called on it. This can be achieved by calling this method immediately after finishing the sort key manipulation.
+ +| void QCPDataContainer< DataType >::squeeze | +( | +bool | +preAllocation = true, |
+
| + | + | bool | +postAllocation = true |
+
| + | ) | ++ |
Frees all unused memory that is currently in the preallocation and postallocation pools.
+Note that QCPDataContainer automatically decides whether squeezing is necessary, if setAutoSqueeze is left enabled. It should thus not be necessary to use this method for typical applications.
+The parameters preAllocation and postAllocation control whether pre- and/or post allocation should be freed, respectively.
+ +
+
|
+ +inline | +
Returns a const iterator to the first data point in this container.
+ +
+
|
+ +inline | +
Returns a const iterator to the element past the last data point in this container.
+ +
+
|
+ +inline | +
Returns a non-const iterator to the first data point in this container.
+You can manipulate the data points in-place through the non-const iterators, but great care must be taken when manipulating the sort key of a data point, see sort, or the detailed description of this class.
+ +
+
|
+ +inline | +
Returns a non-const iterator to the element past the last data point in this container.
+You can manipulate the data points in-place through the non-const iterators, but great care must be taken when manipulating the sort key of a data point, see sort, or the detailed description of this class.
+ +| QCPDataContainer< DataType >::const_iterator QCPDataContainer< DataType >::findBegin | +( | +double | +sortKey, | +
| + | + | bool | +expandedRange = true |
+
| + | ) | +const | +
Returns an iterator to the data point with a (sort-)key that is equal to, just below, or just above sortKey. If expandedRange is true, the data point just below sortKey will be considered, otherwise the one just above.
+This can be used in conjunction with findEnd to iterate over data points within a given key range, including or excluding the bounding data points that are just beyond the specified range.
+If expandedRange is true but there are no data points below sortKey, constBegin is returned.
+If the container is empty, returns constEnd.
+ + +| QCPDataContainer< DataType >::const_iterator QCPDataContainer< DataType >::findEnd | +( | +double | +sortKey, | +
| + | + | bool | +expandedRange = true |
+
| + | ) | +const | +
Returns an iterator to the element after the data point with a (sort-)key that is equal to, just above or just below sortKey. If expandedRange is true, the data point just above sortKey will be considered, otherwise the one just below.
+This can be used in conjunction with findBegin to iterate over data points within a given key range, including the bounding data points that are just below and above the specified range.
+If expandedRange is true but there are no data points above sortKey, constEnd is returned.
+If the container is empty, constEnd is returned.
+ + +
+
|
+ +inline | +
Returns a const iterator to the element with the specified index. If index points beyond the available elements in this container, returns constEnd, i.e. an iterator past the last valid element.
+You can use this method to easily obtain iterators from a QCPDataRange, see the data selection page for an example.
+ +| QCPRange QCPDataContainer< DataType >::keyRange | +( | +bool & | +foundRange, | +
| + | + | QCP::SignDomain | +signDomain = QCP::sdBoth |
+
| + | ) | ++ |
Returns the range encompassed by the (main-)key coordinate of all data points. The output parameter foundRange indicates whether a sensible range was found. If this is false, you should not use the returned QCPRange (e.g. the data container is empty or all points have the same key).
+Use signDomain to control which sign of the key coordinates should be considered. This is relevant e.g. for logarithmic plots which can mathematically only display one sign domain at a time.
+If the DataType reports that its main key is equal to the sort key (sortKeyIsMainKey), as is the case for most plottables, this method uses this fact and finds the range very quickly.
+| QCPRange QCPDataContainer< DataType >::valueRange | +( | +bool & | +foundRange, | +
| + | + | QCP::SignDomain | +signDomain = QCP::sdBoth, |
+
| + | + | const QCPRange & | +inKeyRange = QCPRange() |
+
| + | ) | ++ |
Returns the range encompassed by the value coordinates of the data points in the specified key range (inKeyRange), using the full DataType::valueRange reported by the data points. The output parameter foundRange indicates whether a sensible range was found. If this is false, you should not use the returned QCPRange (e.g. the data container is empty or all points have the same value).
+If inKeyRange has both lower and upper bound set to zero (is equal to QCPRange()), all data points are considered, without any restriction on the keys.
Use signDomain to control which sign of the value coordinates should be considered. This is relevant e.g. for logarithmic plots which can mathematically only display one sign domain at a time.
+
+
|
+ +inline | +
Returns a QCPDataRange encompassing the entire data set of this container. This means the begin index of the returned range is 0, and the end index is size.
+ +| void QCPDataContainer< DataType >::limitIteratorsToDataRange | +( | +const_iterator & | +begin, | +
| + | + | const_iterator & | +end, | +
| + | + | const QCPDataRange & | +dataRange | +
| + | ) | +const | +
Makes sure begin and end mark a data range that is both within the bounds of this data container's data, as well as within the specified dataRange. The initial range described by the passed iterators begin and end is never expanded, only contracted if necessary.
+This function doesn't require for dataRange to be within the bounds of this data container's valid range.
+ +
+
|
+ +protected | +
Increases the preallocation pool to have a size of at least minimumPreallocSize. Depending on the preallocation history, the container will grow by more than requested, to speed up future consecutive size increases.
+if minimumPreallocSize is smaller than or equal to the current preallocation pool size, this method does nothing.
+ +
+
|
+ +protected | +
This method decides, depending on the total allocation size and the size of the unused pre- and postallocation pools, whether it is sensible to reduce the pools in order to free up unused memory. It then possibly calls squeeze to do the deallocation.
+If setAutoSqueeze is enabled, this method is called automatically each time data points are removed from the container (e.g. remove).
+
+
|
+ +related | +
Returns whether the sort key of a is less than the sort key of b.
+Describes a data range given by begin and end index. + More...
++Public Functions | |
| QCPDataRange () | |
| QCPDataRange (int begin, int end) | |
| +bool | operator== (const QCPDataRange &other) const |
| +bool | operator!= (const QCPDataRange &other) const |
| +int | begin () const |
| +int | end () const |
| int | size () const |
| int | length () const |
| void | setBegin (int begin) |
| void | setEnd (int end) |
| bool | isValid () const |
| bool | isEmpty () const |
| QCPDataRange | bounded (const QCPDataRange &other) const |
| QCPDataRange | expanded (const QCPDataRange &other) const |
| QCPDataRange | intersection (const QCPDataRange &other) const |
| QCPDataRange | adjusted (int changeBegin, int changeEnd) const |
| bool | intersects (const QCPDataRange &other) const |
| bool | contains (const QCPDataRange &other) const |
+Related Non-Members | |
(Note that these are not member functions.) + | |
| QDebug | operator<< (QDebug d, const QCPDataRange &dataRange) |
Describes a data range given by begin and end index.
+QCPDataRange holds two integers describing the begin (setBegin) and end (setEnd) index of a contiguous set of data points. The end index points to the data point just after the last data point that's part of the data range, similarly to the nomenclature used in standard iterators.
+Data Ranges are not bound to a certain plottable, thus they can be freely exchanged, created and modified. If a non-contiguous data set shall be described, the class QCPDataSelection is used, which holds and manages multiple instances of QCPDataRange. In most situations, QCPDataSelection is thus used.
+Both QCPDataRange and QCPDataSelection offer convenience methods to work with them, e.g. bounded, expanded, intersects, intersection, adjusted, contains. Further, addition and subtraction operators (defined in QCPDataSelection) can be used to join/subtract data ranges and data selections (or mixtures), to retrieve a corresponding QCPDataSelection.
+QCustomPlot's data selection mechanism is based on QCPDataSelection and QCPDataRange.
+| QCPDataRange::QCPDataRange | +( | +) | ++ |
Creates an empty QCPDataRange, with begin and end set to 0.
+ +| QCPDataRange::QCPDataRange | +( | +int | +begin, | +
| + | + | int | +end | +
| + | ) | ++ |
Creates a QCPDataRange, initialized with the specified begin and end.
+No checks or corrections are made to ensure the resulting range is valid (isValid).
+ +
+
|
+ +inline | +
Returns the number of data points described by this data range. This is equal to the end index minus the begin index.
+
+
|
+ +inline | +
Returns the number of data points described by this data range. Equivalent to size.
+ +
+
|
+ +inline | +
+
|
+ +inline | +
+
|
+ +inline | +
Returns whether this range is valid. A valid range has a begin index greater or equal to 0, and an end index greater or equal to the begin index.
+
+
|
+ +inline | +
| QCPDataRange QCPDataRange::bounded | +( | +const QCPDataRange & | +other | ) | +const | +
Returns a data range that matches this data range, except that parts exceeding other are excluded.
+This method is very similar to intersection, with one distinction: If this range and the other range share no intersection, the returned data range will be empty with begin and end set to the respective boundary side of other, at which this range is residing. (intersection would just return a range with begin and end set to 0.)
+ +| QCPDataRange QCPDataRange::expanded | +( | +const QCPDataRange & | +other | ) | +const | +
Returns a data range that contains both this data range as well as other.
+ +| QCPDataRange QCPDataRange::intersection | +( | +const QCPDataRange & | +other | ) | +const | +
Returns the data range which is contained in both this data range and other.
+This method is very similar to bounded, with one distinction: If this range and the other range share no intersection, the returned data range will be empty with begin and end set to 0. (bounded would return a range with begin and end set to one of the boundaries of other, depending on which side this range is on.)
+
+
|
+ +inline | +
Returns a data range where changeBegin and changeEnd were added to the begin and end indices, respectively.
+ +| bool QCPDataRange::intersects | +( | +const QCPDataRange & | +other | ) | +const | +
Returns whether this data range and other share common data points.
+| bool QCPDataRange::contains | +( | +const QCPDataRange & | +other | ) | +const | +
Returns whether all data points of other are also contained inside this data range.
+
+
|
+ +related | +
Prints dataRange in a human readable format to the qDebug output.
+ +Describes a data set by holding multiple QCPDataRange instances. + More...
++Friends | |
| const QCPDataSelection | operator+ (const QCPDataSelection &a, const QCPDataSelection &b) |
| const QCPDataSelection | operator+ (const QCPDataRange &a, const QCPDataSelection &b) |
| const QCPDataSelection | operator+ (const QCPDataSelection &a, const QCPDataRange &b) |
| const QCPDataSelection | operator+ (const QCPDataRange &a, const QCPDataRange &b) |
| const QCPDataSelection | operator- (const QCPDataSelection &a, const QCPDataSelection &b) |
| const QCPDataSelection | operator- (const QCPDataRange &a, const QCPDataSelection &b) |
| const QCPDataSelection | operator- (const QCPDataSelection &a, const QCPDataRange &b) |
| const QCPDataSelection | operator- (const QCPDataRange &a, const QCPDataRange &b) |
+Related Non-Members | |
(Note that these are not member functions.) + | |
| QDebug | operator<< (QDebug d, const QCPDataSelection &selection) |
Describes a data set by holding multiple QCPDataRange instances.
+QCPDataSelection manages multiple instances of QCPDataRange in order to represent any (possibly disjoint) set of data selection.
+The data selection can be modified with addition and subtraction operators which take QCPDataSelection and QCPDataRange instances, as well as methods such as addDataRange and clear. Read access is provided by dataRange, dataRanges, dataRangeCount, etc.
+The method simplify is used to join directly adjacent or even overlapping QCPDataRange instances. QCPDataSelection automatically simplifies when using the addition/subtraction operators. The only case when simplify is left to the user, is when calling addDataRange, with the parameter simplify explicitly set to false. This is useful if many data ranges will be added to the selection successively and the overhead for simplifying after each iteration shall be avoided. In this case, you should make sure to call simplify after completing the operation.
+Use enforceType to bring the data selection into a state complying with the constraints for selections defined in QCP::SelectionType.
+QCustomPlot's data selection mechanism is based on QCPDataSelection and QCPDataRange.
+As an example, the following code snippet calculates the average value of a graph's data selection:
+
+
|
+ +explicit | +
Creates an empty QCPDataSelection.
+ +
+
|
+ +explicit | +
Creates a QCPDataSelection containing the provided range.
+ +| bool QCPDataSelection::operator== | +( | +const QCPDataSelection & | +other | ) | +const | +
Returns true if this selection is identical (contains the same data ranges with the same begin and end indices) to other.
+Note that both data selections must be in simplified state (the usual state of the selection, see simplify) for this operator to return correct results.
+ +| QCPDataSelection & QCPDataSelection::operator+= | +( | +const QCPDataSelection & | +other | ) | ++ |
Adds the data selection of other to this data selection, and then simplifies this data selection (see simplify).
+ +| QCPDataSelection & QCPDataSelection::operator+= | +( | +const QCPDataRange & | +other | ) | ++ |
Adds the data range other to this data selection, and then simplifies this data selection (see simplify).
+ +| QCPDataSelection & QCPDataSelection::operator-= | +( | +const QCPDataSelection & | +other | ) | ++ |
Removes all data point indices that are described by other from this data selection.
+ +| QCPDataSelection & QCPDataSelection::operator-= | +( | +const QCPDataRange & | +other | ) | ++ |
Removes all data point indices that are described by other from this data selection.
+ +
+
|
+ +inline | +
Returns the number of ranges that make up the data selection. The ranges can be accessed by dataRange via their index.
+| int QCPDataSelection::dataPointCount | +( | +) | +const | +
Returns the total number of data points contained in all data ranges that make up this data selection.
+ +| QCPDataRange QCPDataSelection::dataRange | +( | +int | +index = 0 | ) | +const | +
Returns the data range with the specified index.
+If the data selection is simplified (the usual state of the selection, see simplify), the ranges are sorted by ascending data point index.
+
+
|
+ +inline | +
| QCPDataRange QCPDataSelection::span | +( | +) | +const | +
Returns a QCPDataRange which spans the entire data selection, including possible intermediate segments which are not part of the original data selection.
+ +| void QCPDataSelection::addDataRange | +( | +const QCPDataRange & | +dataRange, | +
| + | + | bool | +simplify = true |
+
| + | ) | ++ |
Adds the given dataRange to this data selection. This is equivalent to the += operator but allows disabling immediate simplification by setting simplify to false. This can improve performance if adding a very large amount of data ranges successively. In this case, make sure to call simplify manually, after the operation.
+ +| void QCPDataSelection::clear | +( | +) | ++ |
Removes all data ranges. The data selection then contains no data points.
+ + +
+
|
+ +inline | +
Returns true if there are no data ranges, and thus no data points, in this QCPDataSelection instance.
+| void QCPDataSelection::simplify | +( | +) | ++ |
Sorts all data ranges by range begin index in ascending order, and then joins directly adjacent or overlapping ranges. This can reduce the number of individual data ranges in the selection, and prevents possible double-counting when iterating over the data points held by the data ranges.
+This method is automatically called when using the addition/subtraction operators. The only case when simplify is left to the user, is when calling addDataRange, with the parameter simplify explicitly set to false.
+ +| void QCPDataSelection::enforceType | +( | +QCP::SelectionType | +type | ) | ++ |
Makes sure this data selection conforms to the specified type selection type. Before the type is enforced, simplify is called.
+Depending on type, enforcing means adding new data points that were previously not part of the selection, or removing data points from the selection. If the current selection already conforms to type, the data selection is not changed.
+| bool QCPDataSelection::contains | +( | +const QCPDataSelection & | +other | ) | +const | +
Returns true if the data selection other is contained entirely in this data selection, i.e. all data point indices that are in other are also in this data selection.
+| QCPDataSelection QCPDataSelection::intersection | +( | +const QCPDataRange & | +other | ) | +const | +
Returns a data selection containing the points which are both in this data selection and in the data range other.
+A common use case is to limit an unknown data selection to the valid range of a data container, using QCPDataContainer::dataRange as other. One can then safely iterate over the returned data selection without exceeding the data container's bounds.
+ +| QCPDataSelection QCPDataSelection::intersection | +( | +const QCPDataSelection & | +other | ) | +const | +
Returns a data selection containing the points which are both in this data selection and in the data selection other.
+ +| QCPDataSelection QCPDataSelection::inverse | +( | +const QCPDataRange & | +outerRange | ) | +const | +
Returns a data selection which is the exact inverse of this data selection, with outerRange defining the base range on which to invert. If outerRange is smaller than the span of this data selection, it is expanded accordingly.
+For example, this method can be used to retrieve all unselected segments by setting outerRange to the full data range of the plottable, and calling this method on a data selection holding the selected segments.
+ +
+
|
+ +friend | +
Return a QCPDataSelection with the data points in a joined with the data points in b. The resulting data selection is already simplified (see QCPDataSelection::simplify).
+ +
+
|
+ +friend | +
Return a QCPDataSelection with the data points in a joined with the data points in b. The resulting data selection is already simplified (see QCPDataSelection::simplify).
+ +
+
|
+ +friend | +
Return a QCPDataSelection with the data points in a joined with the data points in b. The resulting data selection is already simplified (see QCPDataSelection::simplify).
+ +
+
|
+ +friend | +
Return a QCPDataSelection with the data points in a joined with the data points in b. The resulting data selection is already simplified (see QCPDataSelection::simplify).
+ +
+
|
+ +friend | +
Return a QCPDataSelection with the data points which are in a but not in b.
+ +
+
|
+ +friend | +
Return a QCPDataSelection with the data points which are in a but not in b.
+ +
+
|
+ +friend | +
Return a QCPDataSelection with the data points which are in a but not in b.
+ +
+
|
+ +friend | +
Return a QCPDataSelection with the data points which are in a but not in b.
+ +
+
|
+ +related | +
Prints selection in a human readable format to the qDebug output.
+ +A plottable that adds a set of error bars to other plottables. + More...
+
+Public Types | |
| enum | ErrorType |
+Public Functions | |
| QCPErrorBars (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
| QSharedPointer< QCPErrorBarsDataContainer > | data () const |
| +QCPAbstractPlottable * | dataPlottable () const |
| +ErrorType | errorType () const |
| +double | whiskerWidth () const |
| +double | symbolGap () const |
| void | setData (QSharedPointer< QCPErrorBarsDataContainer > data) |
| void | setData (const QVector< double > &error) |
| void | setData (const QVector< double > &errorMinus, const QVector< double > &errorPlus) |
| void | setDataPlottable (QCPAbstractPlottable *plottable) |
| void | setErrorType (ErrorType type) |
| void | setWhiskerWidth (double pixels) |
| void | setSymbolGap (double pixels) |
| void | addData (const QVector< double > &error) |
| void | addData (const QVector< double > &errorMinus, const QVector< double > &errorPlus) |
| void | addData (double error) |
| void | addData (double errorMinus, double errorPlus) |
| virtual int | dataCount () const |
| virtual double | dataMainKey (int index) const |
| virtual double | dataSortKey (int index) const |
| virtual double | dataMainValue (int index) const |
| virtual QCPRange | dataValueRange (int index) const |
| virtual QPointF | dataPixelPosition (int index) const |
| virtual bool | sortKeyIsMainKey () const |
| virtual QCPDataSelection | selectTestRect (const QRectF &rect, bool onlySelectable) const |
| virtual int | findBegin (double sortKey, bool expandedRange=true) const |
| virtual int | findEnd (double sortKey, bool expandedRange=true) const |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
| virtual QCPPlottableInterface1D * | interface1D () |
Public Functions inherited from QCPAbstractPlottable | |
| QCPAbstractPlottable (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
| +QString | name () const |
| +bool | antialiasedFill () const |
| +bool | antialiasedScatters () const |
| +QPen | pen () const |
| +QBrush | brush () const |
| +QCPAxis * | keyAxis () const |
| +QCPAxis * | valueAxis () const |
| +QCP::SelectionType | selectable () const |
| bool | selected () const |
| QCPDataSelection | selection () const |
| QCPSelectionDecorator * | selectionDecorator () const |
| void | setName (const QString &name) |
| void | setAntialiasedFill (bool enabled) |
| void | setAntialiasedScatters (bool enabled) |
| void | setPen (const QPen &pen) |
| void | setBrush (const QBrush &brush) |
| void | setKeyAxis (QCPAxis *axis) |
| void | setValueAxis (QCPAxis *axis) |
| Q_SLOT void | setSelectable (QCP::SelectionType selectable) |
| Q_SLOT void | setSelection (QCPDataSelection selection) |
| void | setSelectionDecorator (QCPSelectionDecorator *decorator) |
| void | coordsToPixels (double key, double value, double &x, double &y) const |
| const QPointF | coordsToPixels (double key, double value) const |
| void | pixelsToCoords (double x, double y, double &key, double &value) const |
| void | pixelsToCoords (const QPointF &pixelPos, double &key, double &value) const |
| void | rescaleAxes (bool onlyEnlarge=false) const |
| void | rescaleKeyAxis (bool onlyEnlarge=false) const |
| void | rescaleValueAxis (bool onlyEnlarge=false, bool inKeyRange=false) const |
| bool | addToLegend (QCPLegend *legend) |
| bool | addToLegend () |
| bool | removeFromLegend (QCPLegend *legend) const |
| bool | removeFromLegend () const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Protected Functions | |
| virtual void | draw (QCPPainter *painter) |
| virtual void | drawLegendIcon (QCPPainter *painter, const QRectF &rect) const |
| virtual QCPRange | getKeyRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const |
| virtual QCPRange | getValueRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const |
| void | getErrorBarLines (QCPErrorBarsDataContainer::const_iterator it, QVector< QLineF > &backbones, QVector< QLineF > &whiskers) const |
| void | getVisibleDataBounds (QCPErrorBarsDataContainer::const_iterator &begin, QCPErrorBarsDataContainer::const_iterator &end, const QCPDataRange &rangeRestriction) const |
| double | pointDistance (const QPointF &pixelPoint, QCPErrorBarsDataContainer::const_iterator &closestData) const |
| void | getDataSegments (QList< QCPDataRange > &selectedSegments, QList< QCPDataRange > &unselectedSegments) const |
| bool | errorBarVisible (int index) const |
| bool | rectIntersectsLine (const QRectF &pixelRect, const QLineF &line) const |
Protected Functions inherited from QCPAbstractPlottable | |
| virtual QRect | clipRect () const |
| virtual QCP::Interaction | selectionCategory () const |
| void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| void | applyFillAntialiasingHint (QCPPainter *painter) const |
| void | applyScattersAntialiasingHint (QCPPainter *painter) const |
Protected Functions inherited from QCPLayerable | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Additional Inherited Members | |
Signals inherited from QCPAbstractPlottable | |
| void | selectionChanged (bool selected) |
| void | selectionChanged (const QCPDataSelection &selection) |
| void | selectableChanged (QCP::SelectionType selectable) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
A plottable that adds a set of error bars to other plottables.
+
+The QCPErrorBars plottable can be attached to other one-dimensional plottables (e.g. QCPGraph, QCPCurve, QCPBars, etc.) and equips them with error bars.
+Use setDataPlottable to define for which plottable the QCPErrorBars shall display the error bars. The orientation of the error bars can be controlled with setErrorType.
+By using setData, you can supply the actual error data, either as symmetric error or plus/minus asymmetric errors. QCPErrorBars only stores the error data. The absolute key/value position of each error bar will be adopted from the configured data plottable. The error data of the QCPErrorBars are associated one-to-one via their index to the data points of the data plottable. You can directly access and manipulate the error bar data via data.
+Set either of the plus/minus errors to NaN (qQNaN() or std::numeric_limits<double>::quiet_NaN()) to not show the respective error bar on the data point at that index.
The appearance of the error bars is defined by the pen (setPen), and the width of the whiskers (setWhiskerWidth). Further, the error bar backbones may leave a gap around the data point center to prevent that error bars are drawn too close to or even through scatter points. This gap size can be controlled via setSymbolGap.
+| enum QCPErrorBars::ErrorType | +
Defines in which orientation the error bars shall appear. If your data needs both error dimensions, create two QCPErrorBars with different ErrorType.
+| Enumerator | |
|---|---|
| etKeyError | The errors are for the key dimension (bars appear parallel to the key axis) + |
| etValueError | The errors are for the value dimension (bars appear parallel to the value axis) + |
+
|
+ +explicit | +
Constructs an error bars plottable which uses keyAxis as its key axis ("x") and valueAxis as its value axis ("y"). keyAxis and valueAxis must reside in the same QCustomPlot instance and not have the same orientation. If either of these restrictions is violated, a corresponding message is printed to the debug output (qDebug), the construction is not aborted, though.
+It is also important that the keyAxis and valueAxis are the same for the error bars plottable and the data plottable that the error bars shall be drawn on (setDataPlottable).
+The created QCPErrorBars is automatically registered with the QCustomPlot instance inferred from keyAxis. This QCustomPlot instance takes ownership of the QCPErrorBars, so do not delete it manually but use QCustomPlot::removePlottable() instead.
+ +
+
|
+ +inline | +
Returns a shared pointer to the internal data storage of type QCPErrorBarsDataContainer. You may use it to directly manipulate the error values, which may be more convenient and faster than using the regular setData methods.
+ +| void QCPErrorBars::setData | +( | +QSharedPointer< QCPErrorBarsDataContainer > | +data | ) | ++ |
This is an overloaded function.
+Replaces the current data container with the provided data container.
+Since a QSharedPointer is used, multiple QCPErrorBars instances may share the same data container safely. Modifying the data in the container will then affect all QCPErrorBars instances that share the container. Sharing can be achieved by simply exchanging the data containers wrapped in shared pointers:
If you do not wish to share containers, but create a copy from an existing container, assign the data containers directly:
(This uses different notation compared with other plottables, because the QCPErrorBars uses a QVector<QCPErrorBarsData> as its data container, instead of a QCPDataContainer.)
| void QCPErrorBars::setData | +( | +const QVector< double > & | +error | ) | ++ |
This is an overloaded function.
+Sets symmetrical error values as specified in error. The errors will be associated one-to-one by the data point index to the associated data plottable (setDataPlottable).
+You can directly access and manipulate the error bar data via data.
+| void QCPErrorBars::setData | +( | +const QVector< double > & | +errorMinus, | +
| + | + | const QVector< double > & | +errorPlus | +
| + | ) | ++ |
This is an overloaded function.
+Sets asymmetrical errors as specified in errorMinus and errorPlus. The errors will be associated one-to-one by the data point index to the associated data plottable (setDataPlottable).
+You can directly access and manipulate the error bar data via data.
+| void QCPErrorBars::setDataPlottable | +( | +QCPAbstractPlottable * | +plottable | ) | ++ |
Sets the data plottable to which the error bars will be applied. The error values specified e.g. via setData will be associated one-to-one by the data point index to the data points of plottable. This means that the error bars will adopt the key/value coordinates of the data point with the same index.
+The passed plottable must be a one-dimensional plottable, i.e. it must implement the QCPPlottableInterface1D. Further, it must not be a QCPErrorBars instance itself. If either of these restrictions is violated, a corresponding qDebug output is generated, and the data plottable of this QCPErrorBars instance is set to zero.
+For proper display, care must also be taken that the key and value axes of the plottable match those configured for this QCPErrorBars instance.
+ +| void QCPErrorBars::setErrorType | +( | +ErrorType | +type | ) | ++ |
Sets in which orientation the error bars shall appear on the data points. If your data needs both error dimensions, create two QCPErrorBars with different type.
+ +| void QCPErrorBars::setWhiskerWidth | +( | +double | +pixels | ) | ++ |
Sets the width of the whiskers (the short bars at the end of the actual error bar backbones) to pixels.
+ +| void QCPErrorBars::setSymbolGap | +( | +double | +pixels | ) | ++ |
Sets the gap diameter around the data points that will be left out when drawing the error bar backbones. This gap prevents that error bars are drawn too close to or even through scatter points.
+ +| void QCPErrorBars::addData | +( | +const QVector< double > & | +error | ) | ++ |
This is an overloaded function.
+Adds symmetrical error values as specified in error. The errors will be associated one-to-one by the data point index to the associated data plottable (setDataPlottable).
+You can directly access and manipulate the error bar data via data.
+| void QCPErrorBars::addData | +( | +const QVector< double > & | +errorMinus, | +
| + | + | const QVector< double > & | +errorPlus | +
| + | ) | ++ |
This is an overloaded function.
+Adds asymmetrical errors as specified in errorMinus and errorPlus. The errors will be associated one-to-one by the data point index to the associated data plottable (setDataPlottable).
+You can directly access and manipulate the error bar data via data.
+| void QCPErrorBars::addData | +( | +double | +error | ) | ++ |
This is an overloaded function.
+Adds a single symmetrical error bar as specified in error. The errors will be associated one-to-one by the data point index to the associated data plottable (setDataPlottable).
+You can directly access and manipulate the error bar data via data.
+| void QCPErrorBars::addData | +( | +double | +errorMinus, | +
| + | + | double | +errorPlus | +
| + | ) | ++ |
This is an overloaded function.
+Adds a single asymmetrical error bar as specified in errorMinus and errorPlus. The errors will be associated one-to-one by the data point index to the associated data plottable (setDataPlottable).
+You can directly access and manipulate the error bar data via data.
+
+
|
+ +virtual | +
Returns the number of data points of the plottable.
+ +Implements QCPPlottableInterface1D.
+ +
+
|
+ +virtual | +
Returns the main key of the data point at the given index.
+What the main key is, is defined by the plottable's data type. See the QCPDataContainer DataType documentation for details about this naming convention.
+ +Implements QCPPlottableInterface1D.
+ +
+
|
+ +virtual | +
Returns the sort key of the data point at the given index.
+What the sort key is, is defined by the plottable's data type. See the QCPDataContainer DataType documentation for details about this naming convention.
+ +Implements QCPPlottableInterface1D.
+ +
+
|
+ +virtual | +
Returns the main value of the data point at the given index.
+What the main value is, is defined by the plottable's data type. See the QCPDataContainer DataType documentation for details about this naming convention.
+ +Implements QCPPlottableInterface1D.
+ +
+
|
+ +virtual | +
Returns the value range of the data point at the given index.
+What the value range is, is defined by the plottable's data type. See the QCPDataContainer DataType documentation for details about this naming convention.
+ +Implements QCPPlottableInterface1D.
+ +
+
|
+ +virtual | +
Returns the pixel position on the widget surface at which the data point at the given index appears.
+Usually this corresponds to the point of dataMainKey/dataMainValue, in pixel coordinates. However, depending on the plottable, this might be a different apparent position than just a coord-to-pixel transform of those values. For example, QCPBars apparent data values can be shifted depending on their stacking, bar grouping or configured base value.
+ +Implements QCPPlottableInterface1D.
+ +
+
|
+ +virtual | +
Returns whether the sort key (dataSortKey) is identical to the main key (dataMainKey).
+What the sort and main keys are, is defined by the plottable's data type. See the QCPDataContainer DataType documentation for details about this naming convention.
+ +Implements QCPPlottableInterface1D.
+ +
+
|
+ +virtual | +
Returns a data selection containing all the data points of this plottable which are contained (or hit by) rect. This is used mainly in the selection rect interaction for data selection (data selection mechanism).
+If onlySelectable is true, an empty QCPDataSelection is returned if this plottable is not selectable (i.e. if QCPAbstractPlottable::setSelectable is QCP::stNone).
+QRect::normalized() when passing a rect which might not be normalized. Implements QCPPlottableInterface1D.
+ +
+
|
+ +virtual | +
Returns the index of the data point with a (sort-)key that is equal to, just below, or just above sortKey. If expandedRange is true, the data point just below sortKey will be considered, otherwise the one just above.
+This can be used in conjunction with findEnd to iterate over data points within a given key range, including or excluding the bounding data points that are just beyond the specified range.
+If expandedRange is true but there are no data points below sortKey, 0 is returned.
+If the container is empty, returns 0 (in that case, findEnd will also return 0, so a loop using these methods will not iterate over the index 0).
+Implements QCPPlottableInterface1D.
+ +
+
|
+ +virtual | +
Returns the index one after the data point with a (sort-)key that is equal to, just above, or just below sortKey. If expandedRange is true, the data point just above sortKey will be considered, otherwise the one just below.
+This can be used in conjunction with findBegin to iterate over data points within a given key range, including the bounding data points that are just below and above the specified range.
+If expandedRange is true but there are no data points above sortKey, the index just above the highest data point is returned.
+If the container is empty, returns 0.
+Implements QCPPlottableInterface1D.
+ +
+
|
+ +virtual | +
Implements a selectTest specific to this plottable's point geometry.
+If details is not 0, it will be set to a QCPDataSelection, describing the closest data point to pos.
+For general information about this virtual method, see the base class implementation. QCPAbstractPlottable::selectTest
+ +Implements QCPAbstractPlottable.
+ +
+
|
+ +inlinevirtual | +
If this plottable is a one-dimensional plottable, i.e. it implements the QCPPlottableInterface1D, returns the this pointer with that type. Otherwise (e.g. in the case of a QCPColorMap) returns zero.
+You can use this method to gain read access to data coordinates while holding a pointer to the abstract base class only.
+ +Reimplemented from QCPAbstractPlottable.
+ +
+
|
+ +protectedvirtual | +
This function draws the layerable with the specified painter. It is only called by QCustomPlot, if the layerable is visible (setVisible).
+Before this function is called, the painter's antialiasing state is set via applyDefaultAntialiasingHint, see the documentation there. Further, the clipping rectangle was set to clipRect.
+ +Implements QCPAbstractPlottable.
+ +
+
|
+ +protectedvirtual | +
called by QCPLegend::draw (via QCPPlottableLegendItem::draw) to create a graphical representation of this plottable inside rect, next to the plottable name.
+The passed painter has its cliprect set to rect, so painting outside of rect won't appear outside the legend icon border.
+ +Implements QCPAbstractPlottable.
+ +
+
|
+ +protectedvirtual | +
Returns the coordinate range that all data in this plottable span in the key axis dimension. For logarithmic plots, one can set inSignDomain to either QCP::sdNegative or QCP::sdPositive in order to restrict the returned range to that sign domain. E.g. when only negative range is wanted, set inSignDomain to QCP::sdNegative and all positive points will be ignored for range calculation. For no restriction, just set inSignDomain to QCP::sdBoth (default). foundRange is an output parameter that indicates whether a range could be found or not. If this is false, you shouldn't use the returned range (e.g. no points in data).
+Note that foundRange is not the same as QCPRange::validRange, since the range returned by this function may have size zero (e.g. when there is only one data point). In this case foundRange would return true, but the returned range is not a valid range in terms of QCPRange::validRange.
+Implements QCPAbstractPlottable.
+ +
+
|
+ +protectedvirtual | +
Returns the coordinate range that the data points in the specified key range (inKeyRange) span in the value axis dimension. For logarithmic plots, one can set inSignDomain to either QCP::sdNegative or QCP::sdPositive in order to restrict the returned range to that sign domain. E.g. when only negative range is wanted, set inSignDomain to QCP::sdNegative and all positive points will be ignored for range calculation. For no restriction, just set inSignDomain to QCP::sdBoth (default). foundRange is an output parameter that indicates whether a range could be found or not. If this is false, you shouldn't use the returned range (e.g. no points in data).
+If inKeyRange has both lower and upper bound set to zero (is equal to QCPRange()), all data points are considered, without any restriction on the keys.
Note that foundRange is not the same as QCPRange::validRange, since the range returned by this function may have size zero (e.g. when there is only one data point). In this case foundRange would return true, but the returned range is not a valid range in terms of QCPRange::validRange.
+Implements QCPAbstractPlottable.
+ +
+
|
+ +protected | +
Calculates the lines that make up the error bar belonging to the data point it.
+The resulting lines are added to backbones and whiskers. The vectors are not cleared, so calling this method with different it but the same backbones and whiskers allows to accumulate lines for multiple data points.
+This method assumes that it is a valid iterator within the bounds of this QCPErrorBars instance and within the bounds of the associated data plottable.
+ +
+
|
+ +protected | +
This method outputs the currently visible data range via begin and end. The returned range will also never exceed rangeRestriction.
+Since error bars with type etKeyError may extend to arbitrarily positive and negative key coordinates relative to their data point key, this method checks all outer error bars whether they truly don't reach into the visible portion of the axis rect, by calling errorBarVisible. On the other hand error bars with type etValueError that are associated with data plottables whose sort key is equal to the main key (see QCPDataContainer DataType) can be handled very efficiently by finding the visible range of error bars through binary search (QCPPlottableInterface1D::findBegin and QCPPlottableInterface1D::findEnd).
+If the plottable's sort key is not equal to the main key, this method returns the full data range, only restricted by rangeRestriction. Drawing optimization then has to be done on a point-by-point basis in the draw method.
+ +
+
|
+ +protected | +
Calculates the minimum distance in pixels the error bars' representation has from the given pixelPoint. This is used to determine whether the error bar was clicked or not, e.g. in selectTest. The closest data point to pixelPoint is returned in closestData.
+ +
+
|
+ +protected | +
+
|
+ +protected | +
Returns whether the error bar at the specified index is visible within the current key axis range.
+This method assumes for performance reasons without checking that the key axis, the value axis, and the data plottable (setDataPlottable) are not zero and that index is within valid bounds of this QCPErrorBars instance and the bounds of the data plottable.
+ +
+
|
+ +protected | +
Returns whether line intersects (or is contained in) pixelRect.
+line is assumed to be either perfectly horizontal or perfectly vertical, as is the case for error bar lines.
+ +Holds the data of one single error bar for QCPErrorBars. + More...
++Public Functions | |
| QCPErrorBarsData () | |
| QCPErrorBarsData (double error) | |
| QCPErrorBarsData (double errorMinus, double errorPlus) | |
+Public Members | |
| +double | errorMinus |
| +double | errorPlus |
Holds the data of one single error bar for QCPErrorBars.
+The stored data is:
The container for storing the error bar information is QCPErrorBarsDataContainer. It is a typedef for QVector<QCPErrorBarsData>.
| QCPErrorBarsData::QCPErrorBarsData | +( | +) | ++ |
Constructs an error bar with errors set to zero.
+ +
+
|
+ +explicit | +
Constructs an error bar with equal error in both negative and positive direction.
+ +| QCPErrorBarsData::QCPErrorBarsData | +( | +double | +errorMinus, | +
| + | + | double | +errorPlus | +
| + | ) | ++ |
Constructs an error bar with negative and positive errors set to errorMinus and errorPlus, respectively.
+ +A plottable representing a financial stock chart. + More...
+
+Public Types | |
| enum | WidthType |
| enum | ChartStyle |
+Public Functions | |
| QCPFinancial (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
| QSharedPointer< QCPFinancialDataContainer > | data () const |
| +ChartStyle | chartStyle () const |
| +double | width () const |
| +WidthType | widthType () const |
| +bool | twoColored () const |
| +QBrush | brushPositive () const |
| +QBrush | brushNegative () const |
| +QPen | penPositive () const |
| +QPen | penNegative () const |
| void | setData (QSharedPointer< QCPFinancialDataContainer > data) |
| void | setData (const QVector< double > &keys, const QVector< double > &open, const QVector< double > &high, const QVector< double > &low, const QVector< double > &close, bool alreadySorted=false) |
| void | setChartStyle (ChartStyle style) |
| void | setWidth (double width) |
| void | setWidthType (WidthType widthType) |
| void | setTwoColored (bool twoColored) |
| void | setBrushPositive (const QBrush &brush) |
| void | setBrushNegative (const QBrush &brush) |
| void | setPenPositive (const QPen &pen) |
| void | setPenNegative (const QPen &pen) |
| void | addData (const QVector< double > &keys, const QVector< double > &open, const QVector< double > &high, const QVector< double > &low, const QVector< double > &close, bool alreadySorted=false) |
| void | addData (double key, double open, double high, double low, double close) |
| virtual QCPDataSelection | selectTestRect (const QRectF &rect, bool onlySelectable) const |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
| virtual QCPRange | getKeyRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const |
| virtual QCPRange | getValueRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const |
Public Functions inherited from QCPAbstractPlottable1D< QCPFinancialData > | |
| QCPAbstractPlottable1D (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
| virtual int | dataCount () const |
| virtual double | dataMainKey (int index) const |
| virtual double | dataSortKey (int index) const |
| virtual double | dataMainValue (int index) const |
| virtual QCPRange | dataValueRange (int index) const |
| virtual QPointF | dataPixelPosition (int index) const |
| virtual bool | sortKeyIsMainKey () const |
| virtual int | findBegin (double sortKey, bool expandedRange=true) const |
| virtual int | findEnd (double sortKey, bool expandedRange=true) const |
| virtual QCPPlottableInterface1D * | interface1D () |
Public Functions inherited from QCPAbstractPlottable | |
| QCPAbstractPlottable (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
| +QString | name () const |
| +bool | antialiasedFill () const |
| +bool | antialiasedScatters () const |
| +QPen | pen () const |
| +QBrush | brush () const |
| +QCPAxis * | keyAxis () const |
| +QCPAxis * | valueAxis () const |
| +QCP::SelectionType | selectable () const |
| bool | selected () const |
| QCPDataSelection | selection () const |
| QCPSelectionDecorator * | selectionDecorator () const |
| void | setName (const QString &name) |
| void | setAntialiasedFill (bool enabled) |
| void | setAntialiasedScatters (bool enabled) |
| void | setPen (const QPen &pen) |
| void | setBrush (const QBrush &brush) |
| void | setKeyAxis (QCPAxis *axis) |
| void | setValueAxis (QCPAxis *axis) |
| Q_SLOT void | setSelectable (QCP::SelectionType selectable) |
| Q_SLOT void | setSelection (QCPDataSelection selection) |
| void | setSelectionDecorator (QCPSelectionDecorator *decorator) |
| void | coordsToPixels (double key, double value, double &x, double &y) const |
| const QPointF | coordsToPixels (double key, double value) const |
| void | pixelsToCoords (double x, double y, double &key, double &value) const |
| void | pixelsToCoords (const QPointF &pixelPos, double &key, double &value) const |
| void | rescaleAxes (bool onlyEnlarge=false) const |
| void | rescaleKeyAxis (bool onlyEnlarge=false) const |
| void | rescaleValueAxis (bool onlyEnlarge=false, bool inKeyRange=false) const |
| bool | addToLegend (QCPLegend *legend) |
| bool | addToLegend () |
| bool | removeFromLegend (QCPLegend *legend) const |
| bool | removeFromLegend () const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Static Public Functions | |
| static QCPFinancialDataContainer | timeSeriesToOhlc (const QVector< double > &time, const QVector< double > &value, double timeBinSize, double timeBinOffset=0) |
+Protected Functions | |
| virtual void | draw (QCPPainter *painter) |
| virtual void | drawLegendIcon (QCPPainter *painter, const QRectF &rect) const |
| void | drawOhlcPlot (QCPPainter *painter, const QCPFinancialDataContainer::const_iterator &begin, const QCPFinancialDataContainer::const_iterator &end, bool isSelected) |
| void | drawCandlestickPlot (QCPPainter *painter, const QCPFinancialDataContainer::const_iterator &begin, const QCPFinancialDataContainer::const_iterator &end, bool isSelected) |
| double | getPixelWidth (double key, double keyPixel) const |
| double | ohlcSelectTest (const QPointF &pos, const QCPFinancialDataContainer::const_iterator &begin, const QCPFinancialDataContainer::const_iterator &end, QCPFinancialDataContainer::const_iterator &closestDataPoint) const |
| double | candlestickSelectTest (const QPointF &pos, const QCPFinancialDataContainer::const_iterator &begin, const QCPFinancialDataContainer::const_iterator &end, QCPFinancialDataContainer::const_iterator &closestDataPoint) const |
| void | getVisibleDataBounds (QCPFinancialDataContainer::const_iterator &begin, QCPFinancialDataContainer::const_iterator &end) const |
| QRectF | selectionHitBox (QCPFinancialDataContainer::const_iterator it) const |
Protected Functions inherited from QCPAbstractPlottable1D< QCPFinancialData > | |
| void | getDataSegments (QList< QCPDataRange > &selectedSegments, QList< QCPDataRange > &unselectedSegments) const |
| void | drawPolyline (QCPPainter *painter, const QVector< QPointF > &lineData) const |
Protected Functions inherited from QCPAbstractPlottable | |
| virtual QRect | clipRect () const |
| virtual QCP::Interaction | selectionCategory () const |
| void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| void | applyFillAntialiasingHint (QCPPainter *painter) const |
| void | applyScattersAntialiasingHint (QCPPainter *painter) const |
Protected Functions inherited from QCPLayerable | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Additional Inherited Members | |
Signals inherited from QCPAbstractPlottable | |
| void | selectionChanged (bool selected) |
| void | selectionChanged (const QCPDataSelection &selection) |
| void | selectableChanged (QCP::SelectionType selectable) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
A plottable representing a financial stock chart.
+
+This plottable represents time series data binned to certain intervals, mainly used for stock charts. The two common representations OHLC (Open-High-Low-Close) bars and Candlesticks can be set via setChartStyle.
+The data is passed via setData as a set of open/high/low/close values at certain keys (typically times). This means the data must be already binned appropriately. If data is only available as a series of values (e.g. price against time), you can use the static convenience function timeSeriesToOhlc to generate binned OHLC-data which can then be passed to setData.
+The width of the OHLC bars/candlesticks can be controlled with setWidth and setWidthType. A typical choice is to set the width type to wtPlotCoords (the default) and the width to (or slightly less than) one time bin interval width.
+Charts can be either single- or two-colored (setTwoColored). If set to be single-colored, lines are drawn with the plottable's pen (setPen) and fills with the brush (setBrush).
+If set to two-colored, positive changes of the value during an interval (close >= open) are represented with a different pen and brush than negative changes (close < open). These can be configured with setPenPositive, setPenNegative, setBrushPositive, and setBrushNegative. In two-colored mode, the normal plottable pen/brush is ignored. Upon selection however, the normal selected pen/brush (provided by the selectionDecorator) is used, irrespective of whether the chart is single- or two-colored.
+Like all data representing objects in QCustomPlot, the QCPFinancial is a plottable (QCPAbstractPlottable). So the plottable-interface of QCustomPlot applies (QCustomPlot::plottable, QCustomPlot::removePlottable, etc.)
+Usually, you first create an instance:
+which registers it with the QCustomPlot instance of the passed axes. Note that this QCustomPlot instance takes ownership of the plottable, so do not delete it manually but use QCustomPlot::removePlottable() instead. The newly created plottable can be modified, e.g.:
+Here we have used the static helper method timeSeriesToOhlc, to turn a time-price data series into a 24-hour binned open-high-low-close data series as QCPFinancial uses.
+| enum QCPFinancial::WidthType | +
Defines the ways the width of the financial bar can be specified. Thus it defines what the number passed to setWidth actually means.
+| enum QCPFinancial::ChartStyle | +
Defines the possible representations of OHLC data in the plot.
+| Enumerator | |
|---|---|
| csOhlc | Open-High-Low-Close bar representation. + |
| csCandlestick | Candlestick representation. + |
+
|
+ +explicit | +
Constructs a financial chart which uses keyAxis as its key axis ("x") and valueAxis as its value axis ("y"). keyAxis and valueAxis must reside in the same QCustomPlot instance and not have the same orientation. If either of these restrictions is violated, a corresponding message is printed to the debug output (qDebug), the construction is not aborted, though.
+The created QCPFinancial is automatically registered with the QCustomPlot instance inferred from keyAxis. This QCustomPlot instance takes ownership of the QCPFinancial, so do not delete it manually but use QCustomPlot::removePlottable() instead.
+ +
+
|
+ +inline | +
Returns a pointer to the internal data storage of type QCPFinancialDataContainer. You may use it to directly manipulate the data, which may be more convenient and faster than using the regular setData or addData methods, in certain situations.
+ +| void QCPFinancial::setData | +( | +QSharedPointer< QCPFinancialDataContainer > | +data | ) | ++ |
This is an overloaded function.
+Replaces the current data container with the provided data container.
+Since a QSharedPointer is used, multiple QCPFinancials may share the same data container safely. Modifying the data in the container will then affect all financials that share the container. Sharing can be achieved by simply exchanging the data containers wrapped in shared pointers:
If you do not wish to share containers, but create a copy from an existing container, rather use the QCPDataContainer<DataType>::set method on the financial's data container directly:
| void QCPFinancial::setData | +( | +const QVector< double > & | +keys, | +
| + | + | const QVector< double > & | +open, | +
| + | + | const QVector< double > & | +high, | +
| + | + | const QVector< double > & | +low, | +
| + | + | const QVector< double > & | +close, | +
| + | + | bool | +alreadySorted = false |
+
| + | ) | ++ |
This is an overloaded function.
+Replaces the current data with the provided points in keys, open, high, low and close. The provided vectors should have equal length. Else, the number of added points will be the size of the smallest vector.
+If you can guarantee that the passed data points are sorted by keys in ascending order, you can set alreadySorted to true, to improve performance by saving a sorting run.
+| void QCPFinancial::setChartStyle | +( | +QCPFinancial::ChartStyle | +style | ) | ++ |
Sets which representation style shall be used to display the OHLC data.
+ +| void QCPFinancial::setWidth | +( | +double | +width | ) | ++ |
Sets the width of the individual bars/candlesticks to width in plot key coordinates.
+A typical choice is to set it to (or slightly less than) one bin interval width.
+ +| void QCPFinancial::setWidthType | +( | +QCPFinancial::WidthType | +widthType | ) | ++ |
Sets how the width of the financial bars is defined. See the documentation of WidthType for an explanation of the possible values for widthType.
+The default value is wtPlotCoords.
+| void QCPFinancial::setTwoColored | +( | +bool | +twoColored | ) | ++ |
| void QCPFinancial::setBrushPositive | +( | +const QBrush & | +brush | ) | ++ |
If setTwoColored is set to true, this function controls the brush that is used to draw fills of data points with a positive trend (i.e. bars/candlesticks with close >= open).
+If twoColored is false, the normal plottable's pen and brush are used (setPen, setBrush).
+| void QCPFinancial::setBrushNegative | +( | +const QBrush & | +brush | ) | ++ |
If setTwoColored is set to true, this function controls the brush that is used to draw fills of data points with a negative trend (i.e. bars/candlesticks with close < open).
+If twoColored is false, the normal plottable's pen and brush are used (setPen, setBrush).
+| void QCPFinancial::setPenPositive | +( | +const QPen & | +pen | ) | ++ |
If setTwoColored is set to true, this function controls the pen that is used to draw outlines of data points with a positive trend (i.e. bars/candlesticks with close >= open).
+If twoColored is false, the normal plottable's pen and brush are used (setPen, setBrush).
+| void QCPFinancial::setPenNegative | +( | +const QPen & | +pen | ) | ++ |
If setTwoColored is set to true, this function controls the pen that is used to draw outlines of data points with a negative trend (i.e. bars/candlesticks with close < open).
+If twoColored is false, the normal plottable's pen and brush are used (setPen, setBrush).
+| void QCPFinancial::addData | +( | +const QVector< double > & | +keys, | +
| + | + | const QVector< double > & | +open, | +
| + | + | const QVector< double > & | +high, | +
| + | + | const QVector< double > & | +low, | +
| + | + | const QVector< double > & | +close, | +
| + | + | bool | +alreadySorted = false |
+
| + | ) | ++ |
This is an overloaded function.
+Adds the provided points in keys, open, high, low and close to the current data. The provided vectors should have equal length. Else, the number of added points will be the size of the smallest vector.
+If you can guarantee that the passed data points are sorted by keys in ascending order, you can set alreadySorted to true, to improve performance by saving a sorting run.
+Alternatively, you can also access and modify the data directly via the data method, which returns a pointer to the internal data container.
+| void QCPFinancial::addData | +( | +double | +key, | +
| + | + | double | +open, | +
| + | + | double | +high, | +
| + | + | double | +low, | +
| + | + | double | +close | +
| + | ) | ++ |
This is an overloaded function.
+Adds the provided data point as key, open, high, low and close to the current data.
+Alternatively, you can also access and modify the data directly via the data method, which returns a pointer to the internal data container.
+
+
|
+ +virtual | +
Returns a data selection containing all the data points of this plottable which are contained (or hit by) rect. This is used mainly in the selection rect interaction for data selection (data selection mechanism).
+If onlySelectable is true, an empty QCPDataSelection is returned if this plottable is not selectable (i.e. if QCPAbstractPlottable::setSelectable is QCP::stNone).
+QRect::normalized() when passing a rect which might not be normalized. Reimplemented from QCPAbstractPlottable1D< QCPFinancialData >.
+ +
+
|
+ +virtual | +
Implements a selectTest specific to this plottable's point geometry.
+If details is not 0, it will be set to a QCPDataSelection, describing the closest data point to pos.
+For general information about this virtual method, see the base class implementation. QCPAbstractPlottable::selectTest
+ +Reimplemented from QCPAbstractPlottable1D< QCPFinancialData >.
+ +
+
|
+ +virtual | +
Returns the coordinate range that all data in this plottable span in the key axis dimension. For logarithmic plots, one can set inSignDomain to either QCP::sdNegative or QCP::sdPositive in order to restrict the returned range to that sign domain. E.g. when only negative range is wanted, set inSignDomain to QCP::sdNegative and all positive points will be ignored for range calculation. For no restriction, just set inSignDomain to QCP::sdBoth (default). foundRange is an output parameter that indicates whether a range could be found or not. If this is false, you shouldn't use the returned range (e.g. no points in data).
+Note that foundRange is not the same as QCPRange::validRange, since the range returned by this function may have size zero (e.g. when there is only one data point). In this case foundRange would return true, but the returned range is not a valid range in terms of QCPRange::validRange.
+Implements QCPAbstractPlottable.
+ +
+
|
+ +virtual | +
Returns the coordinate range that the data points in the specified key range (inKeyRange) span in the value axis dimension. For logarithmic plots, one can set inSignDomain to either QCP::sdNegative or QCP::sdPositive in order to restrict the returned range to that sign domain. E.g. when only negative range is wanted, set inSignDomain to QCP::sdNegative and all positive points will be ignored for range calculation. For no restriction, just set inSignDomain to QCP::sdBoth (default). foundRange is an output parameter that indicates whether a range could be found or not. If this is false, you shouldn't use the returned range (e.g. no points in data).
+If inKeyRange has both lower and upper bound set to zero (is equal to QCPRange()), all data points are considered, without any restriction on the keys.
Note that foundRange is not the same as QCPRange::validRange, since the range returned by this function may have size zero (e.g. when there is only one data point). In this case foundRange would return true, but the returned range is not a valid range in terms of QCPRange::validRange.
+Implements QCPAbstractPlottable.
+ +
+
|
+ +static | +
A convenience function that converts time series data (value against time) to OHLC binned data points. The return value can then be passed on to QCPFinancialDataContainer::set(const QCPFinancialDataContainer&).
+The size of the bins can be controlled with timeBinSize in the same units as time is given. For example, if the unit of time is seconds and single OHLC/Candlesticks should span an hour each, set timeBinSize to 3600.
+timeBinOffset allows to control precisely at what time coordinate a bin should start. The value passed as timeBinOffset doesn't need to be in the range encompassed by the time keys. It merely defines the mathematical offset/phase of the bins that will be used to process the data.
+ +
+
|
+ +protectedvirtual | +
This function draws the layerable with the specified painter. It is only called by QCustomPlot, if the layerable is visible (setVisible).
+Before this function is called, the painter's antialiasing state is set via applyDefaultAntialiasingHint, see the documentation there. Further, the clipping rectangle was set to clipRect.
+ +Implements QCPAbstractPlottable.
+ +
+
|
+ +protectedvirtual | +
called by QCPLegend::draw (via QCPPlottableLegendItem::draw) to create a graphical representation of this plottable inside rect, next to the plottable name.
+The passed painter has its cliprect set to rect, so painting outside of rect won't appear outside the legend icon border.
+ +Implements QCPAbstractPlottable.
+ +
+
|
+ +protected | +
+
|
+ +protected | +
Draws the data from begin to end-1 as Candlesticks with the provided painter.
+This method is a helper function for draw. It is used when the chart style is csCandlestick.
+ +
+
|
+ +protected | +
This function is used to determine the width of the bar at coordinate key, according to the specified width (setWidth) and width type (setWidthType). Provide the pixel position of key in keyPixel (because usually this was already calculated via QCPAxis::coordToPixel when this function is called).
+It returns the number of pixels the bar extends to higher keys, relative to the key coordinate. So with a non-reversed horizontal axis, the return value is positive. With a reversed horizontal axis, the return value is negative. This is important so the open/close flags on the csOhlc bar are drawn to the correct side.
+ +
+
|
+ +protected | +
This method is a helper function for selectTest. It is used to test for selection when the chart style is csOhlc. It only tests against the data points between begin and end.
+Like selectTest, this method returns the shortest distance of pos to the graphical representation of the plottable, and closestDataPoint will point to the respective data point.
+ +
+
|
+ +protected | +
This method is a helper function for selectTest. It is used to test for selection when the chart style is csCandlestick. It only tests against the data points between begin and end.
+Like selectTest, this method returns the shortest distance of pos to the graphical representation of the plottable, and closestDataPoint will point to the respective data point.
+ +
+
|
+ +protected | +
called by the drawing methods to determine which data (key) range is visible at the current key axis range setting, so only that needs to be processed.
+begin returns an iterator to the lowest data point that needs to be taken into account when plotting. Note that in order to get a clean plot all the way to the edge of the axis rect, begin may still be just outside the visible range.
+end returns the iterator just above the highest data point that needs to be taken into account. Same as before, end may also lie just outside of the visible range
+if the plottable contains no data, both begin and end point to constEnd.
+
|
+ +protected | +
Returns the hit box in pixel coordinates that will be used for data selection with the selection rect (selectTestRect), of the data point given by it.
+ +Holds the data of one single data point for QCPFinancial. + More...
++Public Functions | |
| QCPFinancialData () | |
| QCPFinancialData (double key, double open, double high, double low, double close) | |
| double | sortKey () const |
| double | mainKey () const |
| double | mainValue () const |
| QCPRange | valueRange () const |
+Public Members | |
| +double | key |
| +double | open |
| +double | high |
| +double | low |
| +double | close |
+Static Public Functions | |
| static QCPFinancialData | fromSortKey (double sortKey) |
| static bool | sortKeyIsMainKey () |
Holds the data of one single data point for QCPFinancial.
+The stored data is:
The container for storing multiple data points is QCPFinancialDataContainer. It is a typedef for QCPDataContainer with QCPFinancialData as the DataType template parameter. See the documentation there for an explanation regarding the data type's generic methods.
+| QCPFinancialData::QCPFinancialData | +( | +) | ++ |
Constructs a data point with key and all values set to zero.
+ +| QCPFinancialData::QCPFinancialData | +( | +double | +key, | +
| + | + | double | +open, | +
| + | + | double | +high, | +
| + | + | double | +low, | +
| + | + | double | +close | +
| + | ) | ++ |
Constructs a data point with the specified key and OHLC values.
+ +
+
|
+ +inline | +
Returns the key member of this data point.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +
+
|
+ +inlinestatic | +
Returns a data point with the specified sortKey. All other members are set to zero.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +
+
|
+ +inlinestatic | +
Since the member key is both the data point key coordinate and the data ordering parameter, this method returns true.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +
+
|
+ +inline | +
Returns the key member of this data point.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +
+
|
+ +inline | +
Returns the open member of this data point.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +
+
|
+ +inline | +
Returns a QCPRange spanning from the low to the high value of this data point.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +A plottable representing a graph in a plot. + More...
+
+Public Types | |
| enum | LineStyle |
+Public Functions | |
| QCPGraph (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
| QSharedPointer< QCPGraphDataContainer > | data () const |
| +LineStyle | lineStyle () const |
| +QCPScatterStyle | scatterStyle () const |
| +int | scatterSkip () const |
| +QCPGraph * | channelFillGraph () const |
| +bool | adaptiveSampling () const |
| void | setData (QSharedPointer< QCPGraphDataContainer > data) |
| void | setData (const QVector< double > &keys, const QVector< double > &values, bool alreadySorted=false) |
| void | setLineStyle (LineStyle ls) |
| void | setScatterStyle (const QCPScatterStyle &style) |
| void | setScatterSkip (int skip) |
| void | setChannelFillGraph (QCPGraph *targetGraph) |
| void | setAdaptiveSampling (bool enabled) |
| void | addData (const QVector< double > &keys, const QVector< double > &values, bool alreadySorted=false) |
| void | addData (double key, double value) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
| virtual QCPRange | getKeyRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const |
| virtual QCPRange | getValueRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const |
Public Functions inherited from QCPAbstractPlottable1D< QCPGraphData > | |
| QCPAbstractPlottable1D (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
| virtual int | dataCount () const |
| virtual double | dataMainKey (int index) const |
| virtual double | dataSortKey (int index) const |
| virtual double | dataMainValue (int index) const |
| virtual QCPRange | dataValueRange (int index) const |
| virtual QPointF | dataPixelPosition (int index) const |
| virtual bool | sortKeyIsMainKey () const |
| virtual QCPDataSelection | selectTestRect (const QRectF &rect, bool onlySelectable) const |
| virtual int | findBegin (double sortKey, bool expandedRange=true) const |
| virtual int | findEnd (double sortKey, bool expandedRange=true) const |
| virtual QCPPlottableInterface1D * | interface1D () |
Public Functions inherited from QCPAbstractPlottable | |
| QCPAbstractPlottable (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
| +QString | name () const |
| +bool | antialiasedFill () const |
| +bool | antialiasedScatters () const |
| +QPen | pen () const |
| +QBrush | brush () const |
| +QCPAxis * | keyAxis () const |
| +QCPAxis * | valueAxis () const |
| +QCP::SelectionType | selectable () const |
| bool | selected () const |
| QCPDataSelection | selection () const |
| QCPSelectionDecorator * | selectionDecorator () const |
| void | setName (const QString &name) |
| void | setAntialiasedFill (bool enabled) |
| void | setAntialiasedScatters (bool enabled) |
| void | setPen (const QPen &pen) |
| void | setBrush (const QBrush &brush) |
| void | setKeyAxis (QCPAxis *axis) |
| void | setValueAxis (QCPAxis *axis) |
| Q_SLOT void | setSelectable (QCP::SelectionType selectable) |
| Q_SLOT void | setSelection (QCPDataSelection selection) |
| void | setSelectionDecorator (QCPSelectionDecorator *decorator) |
| void | coordsToPixels (double key, double value, double &x, double &y) const |
| const QPointF | coordsToPixels (double key, double value) const |
| void | pixelsToCoords (double x, double y, double &key, double &value) const |
| void | pixelsToCoords (const QPointF &pixelPos, double &key, double &value) const |
| void | rescaleAxes (bool onlyEnlarge=false) const |
| void | rescaleKeyAxis (bool onlyEnlarge=false) const |
| void | rescaleValueAxis (bool onlyEnlarge=false, bool inKeyRange=false) const |
| bool | addToLegend (QCPLegend *legend) |
| bool | addToLegend () |
| bool | removeFromLegend (QCPLegend *legend) const |
| bool | removeFromLegend () const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Protected Functions | |
| virtual void | draw (QCPPainter *painter) |
| virtual void | drawLegendIcon (QCPPainter *painter, const QRectF &rect) const |
| virtual void | drawFill (QCPPainter *painter, QVector< QPointF > *lines) const |
| virtual void | drawScatterPlot (QCPPainter *painter, const QVector< QPointF > &scatters, const QCPScatterStyle &style) const |
| virtual void | drawLinePlot (QCPPainter *painter, const QVector< QPointF > &lines) const |
| virtual void | drawImpulsePlot (QCPPainter *painter, const QVector< QPointF > &lines) const |
| virtual void | getOptimizedLineData (QVector< QCPGraphData > *lineData, const QCPGraphDataContainer::const_iterator &begin, const QCPGraphDataContainer::const_iterator &end) const |
| virtual void | getOptimizedScatterData (QVector< QCPGraphData > *scatterData, QCPGraphDataContainer::const_iterator begin, QCPGraphDataContainer::const_iterator end) const |
| void | getVisibleDataBounds (QCPGraphDataContainer::const_iterator &begin, QCPGraphDataContainer::const_iterator &end, const QCPDataRange &rangeRestriction) const |
| void | getLines (QVector< QPointF > *lines, const QCPDataRange &dataRange) const |
| void | getScatters (QVector< QPointF > *scatters, const QCPDataRange &dataRange) const |
| QVector< QPointF > | dataToLines (const QVector< QCPGraphData > &data) const |
| QVector< QPointF > | dataToStepLeftLines (const QVector< QCPGraphData > &data) const |
| QVector< QPointF > | dataToStepRightLines (const QVector< QCPGraphData > &data) const |
| QVector< QPointF > | dataToStepCenterLines (const QVector< QCPGraphData > &data) const |
| QVector< QPointF > | dataToImpulseLines (const QVector< QCPGraphData > &data) const |
| QVector< QCPDataRange > | getNonNanSegments (const QVector< QPointF > *lineData, Qt::Orientation keyOrientation) const |
| QVector< QPair< QCPDataRange, QCPDataRange > > | getOverlappingSegments (QVector< QCPDataRange > thisSegments, const QVector< QPointF > *thisData, QVector< QCPDataRange > otherSegments, const QVector< QPointF > *otherData) const |
| bool | segmentsIntersect (double aLower, double aUpper, double bLower, double bUpper, int &bPrecedence) const |
| QPointF | getFillBasePoint (QPointF matchingDataPoint) const |
| const QPolygonF | getFillPolygon (const QVector< QPointF > *lineData, QCPDataRange segment) const |
| const QPolygonF | getChannelFillPolygon (const QVector< QPointF > *lineData, QCPDataRange thisSegment, const QVector< QPointF > *otherData, QCPDataRange otherSegment) const |
| int | findIndexBelowX (const QVector< QPointF > *data, double x) const |
| int | findIndexAboveX (const QVector< QPointF > *data, double x) const |
| int | findIndexBelowY (const QVector< QPointF > *data, double y) const |
| int | findIndexAboveY (const QVector< QPointF > *data, double y) const |
| double | pointDistance (const QPointF &pixelPoint, QCPGraphDataContainer::const_iterator &closestData) const |
Protected Functions inherited from QCPAbstractPlottable1D< QCPGraphData > | |
| void | getDataSegments (QList< QCPDataRange > &selectedSegments, QList< QCPDataRange > &unselectedSegments) const |
| void | drawPolyline (QCPPainter *painter, const QVector< QPointF > &lineData) const |
Protected Functions inherited from QCPAbstractPlottable | |
| virtual QRect | clipRect () const |
| virtual QCP::Interaction | selectionCategory () const |
| void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| void | applyFillAntialiasingHint (QCPPainter *painter) const |
| void | applyScattersAntialiasingHint (QCPPainter *painter) const |
Protected Functions inherited from QCPLayerable | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Additional Inherited Members | |
Signals inherited from QCPAbstractPlottable | |
| void | selectionChanged (bool selected) |
| void | selectionChanged (const QCPDataSelection &selection) |
| void | selectableChanged (QCP::SelectionType selectable) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
A plottable representing a graph in a plot.
+
+Usually you create new graphs by calling QCustomPlot::addGraph. The resulting instance can be accessed via QCustomPlot::graph.
+To plot data, assign it with the setData or addData functions. Alternatively, you can also access and modify the data via the data method, which returns a pointer to the internal QCPGraphDataContainer.
+Graphs are used to display single-valued data. Single-valued means that there should only be one data point per unique key coordinate. In other words, the graph can't have loops. If you do want to plot non-single-valued curves, rather use the QCPCurve plottable.
+Gaps in the graph line can be created by adding data points with NaN as value (qQNaN() or std::numeric_limits<double>::quiet_NaN()) in between the two data points that shall be separated.
The appearance of the graph is mainly determined by the line style, scatter style, brush and pen of the graph (setLineStyle, setScatterStyle, setBrush, setPen).
+QCPGraph knows two types of fills: Normal graph fills towards the zero-value-line parallel to the key axis of the graph, and fills between two graphs, called channel fills. To enable a fill, just set a brush with setBrush which is neither Qt::NoBrush nor fully transparent.
+By default, a normal fill towards the zero-value-line will be drawn. To set up a channel fill between this graph and another one, call setChannelFillGraph with the other graph as parameter.
+| enum QCPGraph::LineStyle | +
Defines how the graph's line is represented visually in the plot. The line is drawn with the current pen of the graph (setPen).
| Enumerator | |
|---|---|
| lsNone | data points are not connected with any lines (e.g. data only represented with symbols according to the scatter style, see setScatterStyle) + |
| lsLine | data points are connected by a straight line + |
| lsStepLeft | line is drawn as steps where the step height is the value of the left data point + |
| lsStepRight | line is drawn as steps where the step height is the value of the right data point + |
| lsStepCenter | line is drawn as steps where the step is in between two data points + |
| lsImpulse | each data point is represented by a line parallel to the value axis, which reaches from the data point to the zero-value-line + |
+
|
+ +explicit | +
Constructs a graph which uses keyAxis as its key axis ("x") and valueAxis as its value axis ("y"). keyAxis and valueAxis must reside in the same QCustomPlot instance and not have the same orientation. If either of these restrictions is violated, a corresponding message is printed to the debug output (qDebug), the construction is not aborted, though.
+The created QCPGraph is automatically registered with the QCustomPlot instance inferred from keyAxis. This QCustomPlot instance takes ownership of the QCPGraph, so do not delete it manually but use QCustomPlot::removePlottable() instead.
+To directly create a graph inside a plot, you can also use the simpler QCustomPlot::addGraph function.
+ +
+
|
+ +inline | +
Returns a shared pointer to the internal data storage of type QCPGraphDataContainer. You may use it to directly manipulate the data, which may be more convenient and faster than using the regular setData or addData methods.
+ +| void QCPGraph::setData | +( | +QSharedPointer< QCPGraphDataContainer > | +data | ) | ++ |
This is an overloaded function.
+Replaces the current data container with the provided data container.
+Since a QSharedPointer is used, multiple QCPGraphs may share the same data container safely. Modifying the data in the container will then affect all graphs that share the container. Sharing can be achieved by simply exchanging the data containers wrapped in shared pointers:
If you do not wish to share containers, but create a copy from an existing container, rather use the QCPDataContainer<DataType>::set method on the graph's data container directly:
| void QCPGraph::setData | +( | +const QVector< double > & | +keys, | +
| + | + | const QVector< double > & | +values, | +
| + | + | bool | +alreadySorted = false |
+
| + | ) | ++ |
This is an overloaded function.
+Replaces the current data with the provided points in keys and values. The provided vectors should have equal length. Else, the number of added points will be the size of the smallest vector.
+If you can guarantee that the passed data points are sorted by keys in ascending order, you can set alreadySorted to true, to improve performance by saving a sorting run.
+| void QCPGraph::setLineStyle | +( | +LineStyle | +ls | ) | ++ |
Sets how the single data points are connected in the plot. For scatter-only plots, set ls to lsNone and setScatterStyle to the desired scatter style.
+| void QCPGraph::setScatterStyle | +( | +const QCPScatterStyle & | +style | ) | ++ |
Sets the visual appearance of single data points in the plot. If set to QCPScatterStyle::ssNone, no scatter points are drawn (e.g. for line-only-plots with appropriate line style).
+| void QCPGraph::setScatterSkip | +( | +int | +skip | ) | ++ |
If scatters are displayed (scatter style not QCPScatterStyle::ssNone), skip number of scatter points are skipped/not drawn after every drawn scatter point.
+This can be used to make the data appear sparser while for example still having a smooth line, and to improve performance for very high density plots.
+If skip is set to 0 (default), all scatter points are drawn.
+| void QCPGraph::setChannelFillGraph | +( | +QCPGraph * | +targetGraph | ) | ++ |
| void QCPGraph::setAdaptiveSampling | +( | +bool | +enabled | ) | ++ |
Sets whether adaptive sampling shall be used when plotting this graph. QCustomPlot's adaptive sampling technique can drastically improve the replot performance for graphs with a larger number of points (e.g. above 10,000), without notably changing the appearance of the graph.
+By default, adaptive sampling is enabled. Even if enabled, QCustomPlot decides whether adaptive sampling shall actually be used on a per-graph basis. So leaving adaptive sampling enabled has no disadvantage in almost all cases.
+
+As can be seen, line plots experience no visual degradation from adaptive sampling. Outliers are reproduced reliably, as well as the overall shape of the data set. The replot time reduces dramatically though. This allows QCustomPlot to display large amounts of data in realtime.
+
+Care must be taken when using high-density scatter plots in combination with adaptive sampling. The adaptive sampling algorithm treats scatter plots more carefully than line plots which still gives a significant reduction of replot times, but not quite as much as for line plots. This is because scatter plots inherently need more data points to be preserved in order to still resemble the original, non-adaptive-sampling plot. As shown above, the results still aren't quite identical, as banding occurs for the outer data points. This is in fact intentional, such that the boundaries of the data cloud stay visible to the viewer. How strong the banding appears, depends on the point density, i.e. the number of points in the plot.
+For some situations with scatter plots it might thus be desirable to manually turn adaptive sampling off. For example, when saving the plot to disk. This can be achieved by setting enabled to false before issuing a command like QCustomPlot::savePng, and setting enabled back to true afterwards.
+ +| void QCPGraph::addData | +( | +const QVector< double > & | +keys, | +
| + | + | const QVector< double > & | +values, | +
| + | + | bool | +alreadySorted = false |
+
| + | ) | ++ |
This is an overloaded function.
+Adds the provided points in keys and values to the current data. The provided vectors should have equal length. Else, the number of added points will be the size of the smallest vector.
+If you can guarantee that the passed data points are sorted by keys in ascending order, you can set alreadySorted to true, to improve performance by saving a sorting run.
+Alternatively, you can also access and modify the data directly via the data method, which returns a pointer to the internal data container.
+ +| void QCPGraph::addData | +( | +double | +key, | +
| + | + | double | +value | +
| + | ) | ++ |
This is an overloaded function.
+Adds the provided data point as key and value to the current data.
+Alternatively, you can also access and modify the data directly via the data method, which returns a pointer to the internal data container.
+ +
+
|
+ +virtual | +
Implements a selectTest specific to this plottable's point geometry.
+If details is not 0, it will be set to a QCPDataSelection, describing the closest data point to pos.
+For general information about this virtual method, see the base class implementation. QCPAbstractPlottable::selectTest
+ +Reimplemented from QCPAbstractPlottable1D< QCPGraphData >.
+ +
+
|
+ +virtual | +
Returns the coordinate range that all data in this plottable span in the key axis dimension. For logarithmic plots, one can set inSignDomain to either QCP::sdNegative or QCP::sdPositive in order to restrict the returned range to that sign domain. E.g. when only negative range is wanted, set inSignDomain to QCP::sdNegative and all positive points will be ignored for range calculation. For no restriction, just set inSignDomain to QCP::sdBoth (default). foundRange is an output parameter that indicates whether a range could be found or not. If this is false, you shouldn't use the returned range (e.g. no points in data).
+Note that foundRange is not the same as QCPRange::validRange, since the range returned by this function may have size zero (e.g. when there is only one data point). In this case foundRange would return true, but the returned range is not a valid range in terms of QCPRange::validRange.
+Implements QCPAbstractPlottable.
+ +
+
|
+ +virtual | +
Returns the coordinate range that the data points in the specified key range (inKeyRange) span in the value axis dimension. For logarithmic plots, one can set inSignDomain to either QCP::sdNegative or QCP::sdPositive in order to restrict the returned range to that sign domain. E.g. when only negative range is wanted, set inSignDomain to QCP::sdNegative and all positive points will be ignored for range calculation. For no restriction, just set inSignDomain to QCP::sdBoth (default). foundRange is an output parameter that indicates whether a range could be found or not. If this is false, you shouldn't use the returned range (e.g. no points in data).
+If inKeyRange has both lower and upper bound set to zero (is equal to QCPRange()), all data points are considered, without any restriction on the keys.
Note that foundRange is not the same as QCPRange::validRange, since the range returned by this function may have size zero (e.g. when there is only one data point). In this case foundRange would return true, but the returned range is not a valid range in terms of QCPRange::validRange.
+Implements QCPAbstractPlottable.
+ +
+
|
+ +protectedvirtual | +
This function draws the layerable with the specified painter. It is only called by QCustomPlot, if the layerable is visible (setVisible).
+Before this function is called, the painter's antialiasing state is set via applyDefaultAntialiasingHint, see the documentation there. Further, the clipping rectangle was set to clipRect.
+ +Implements QCPAbstractPlottable.
+ +
+
|
+ +protectedvirtual | +
called by QCPLegend::draw (via QCPPlottableLegendItem::draw) to create a graphical representation of this plottable inside rect, next to the plottable name.
+The passed painter has its cliprect set to rect, so painting outside of rect won't appear outside the legend icon border.
+ +Implements QCPAbstractPlottable.
+ +
+
|
+ +protectedvirtual | +
Draws the fill of the graph using the specified painter, with the currently set brush.
+Depending on whether a normal fill or a channel fill (setChannelFillGraph) is needed, getFillPolygon or getChannelFillPolygon are used to find the according fill polygons.
+In order to handle NaN Data points correctly (the fill needs to be split into disjoint areas), this method first determines a list of non-NaN segments with getNonNanSegments, on which to operate. In the channel fill case, getOverlappingSegments is used to consolidate the non-NaN segments of the two involved graphs, before passing the overlapping pairs to getChannelFillPolygon.
+Pass the points of this graph's line as lines, in pixel coordinates.
+
+
|
+ +protectedvirtual | +
Draws scatter symbols at every point passed in scatters, given in pixel coordinates. The scatters will be drawn with painter and have the appearance as specified in style.
+
+
|
+ +protectedvirtual | +
Draws lines between the points in lines, given in pixel coordinates.
+ + +
+
|
+ +protectedvirtual | +
Draws impulses from the provided data, i.e. it connects all line pairs in lines, given in pixel coordinates. The lines necessary for impulses are generated by dataToImpulseLines from the regular graph data points.
+
+
|
+ +protectedvirtual | +
Returns via lineData the data points that need to be visualized for this graph when plotting graph lines, taking into consideration the currently visible axis ranges and, if setAdaptiveSampling is enabled, local point densities. The considered data can be restricted further by begin and end, e.g. to only plot a certain segment of the data (see getDataSegments).
+This method is used by getLines to retrieve the basic working set of data.
+
+
|
+ +protectedvirtual | +
Returns via scatterData the data points that need to be visualized for this graph when plotting scatter points, taking into consideration the currently visible axis ranges and, if setAdaptiveSampling is enabled, local point densities. The considered data can be restricted further by begin and end, e.g. to only plot a certain segment of the data (see getDataSegments).
+This method is used by getScatters to retrieve the basic working set of data.
+
+
|
+ +protected | +
This method outputs the currently visible data range via begin and end. The returned range will also never exceed rangeRestriction.
+This method takes into account that the drawing of data lines at the axis rect border always requires the points just outside the visible axis range. So begin and end may actually indicate a range that contains one additional data point to the left and right of the visible axis range.
+ +
+
|
+ +protected | +
This method retrieves an optimized set of data points via getOptimizedLineData, an branches out to the line style specific functions such as dataToLines, dataToStepLeftLines, etc. according to the line style of the graph.
+lines will be filled with points in pixel coordinates, that can be drawn with the according draw functions like drawLinePlot and drawImpulsePlot. The points returned in lines aren't necessarily the original data points. For example, step line styles require additional points to form the steps when drawn. If the line style of the graph is lsNone, the lines vector will be empty.
+dataRange specifies the beginning and ending data indices that will be taken into account for conversion. In this function, the specified range may exceed the total data bounds without harm: a correspondingly trimmed data range will be used. This takes the burden off the user of this function to check for valid indices in dataRange, e.g. when extending ranges coming from getDataSegments.
+
+
|
+ +protected | +
This method retrieves an optimized set of data points via getOptimizedScatterData and then converts them to pixel coordinates. The resulting points are returned in scatters, and can be passed to drawScatterPlot.
+dataRange specifies the beginning and ending data indices that will be taken into account for conversion. In this function, the specified range may exceed the total data bounds without harm: a correspondingly trimmed data range will be used. This takes the burden off the user of this function to check for valid indices in dataRange, e.g. when extending ranges coming from getDataSegments.
+ +
+
|
+ +protected | +
Takes raw data points in plot coordinates as data, and returns a vector containing pixel coordinate points which are suitable for drawing the line style lsLine.
+The source of data is usually getOptimizedLineData, and this method is called in getLines if the line style is set accordingly.
+ + +
+
|
+ +protected | +
Takes raw data points in plot coordinates as data, and returns a vector containing pixel coordinate points which are suitable for drawing the line style lsStepLeft.
+The source of data is usually getOptimizedLineData, and this method is called in getLines if the line style is set accordingly.
+ + +
+
|
+ +protected | +
Takes raw data points in plot coordinates as data, and returns a vector containing pixel coordinate points which are suitable for drawing the line style lsStepRight.
+The source of data is usually getOptimizedLineData, and this method is called in getLines if the line style is set accordingly.
+ + +
+
|
+ +protected | +
Takes raw data points in plot coordinates as data, and returns a vector containing pixel coordinate points which are suitable for drawing the line style lsStepCenter.
+The source of data is usually getOptimizedLineData, and this method is called in getLines if the line style is set accordingly.
+ + +
+
|
+ +protected | +
Takes raw data points in plot coordinates as data, and returns a vector containing pixel coordinate points which are suitable for drawing the line style lsImpulse.
+The source of data is usually getOptimizedLineData, and this method is called in getLines if the line style is set accordingly.
+ + +
+
|
+ +protected | +
This method goes through the passed points in lineData and returns a list of the segments which don't contain NaN data points.
+keyOrientation defines whether the x or y member of the passed QPointF is used to check for NaN. If keyOrientation is Qt::Horizontal, the y member is checked, if it is Qt::Vertical, the x member is checked.
+
|
+ +protected | +
This method takes two segment lists (e.g. created by getNonNanSegments) thisSegments and otherSegments, and their associated point data thisData and otherData.
+It returns all pairs of segments (the first from thisSegments, the second from otherSegments), which overlap in plot coordinates.
+This method is useful in the case of a channel fill between two graphs, when only those non-NaN segments which actually overlap in their key coordinate shall be considered for drawing a channel fill polygon.
+It is assumed that the passed segments in thisSegments are ordered ascending by index, and that the segments don't overlap themselves. The same is assumed for the segments in otherSegments. This is fulfilled when the segments are obtained via getNonNanSegments.
+ + +
+
|
+ +protected | +
Returns whether the segments defined by the coordinates (aLower, aUpper) and (bLower, bUpper) have overlap.
+The output parameter bPrecedence indicates whether the b segment reaches farther than the a segment or not. If bPrecedence returns 1, segment b reaches the farthest to higher coordinates (i.e. bUpper > aUpper). If it returns -1, segment a reaches the farthest. Only if both segment's upper bounds are identical, 0 is returned as bPrecedence.
+It is assumed that the lower bounds always have smaller or equal values than the upper bounds.
+
+
|
+ +protected | +
Returns the point which closes the fill polygon on the zero-value-line parallel to the key axis. The logarithmic axis scale case is a bit special, since the zero-value-line in pixel coordinates is in positive or negative infinity. So this case is handled separately by just closing the fill polygon on the axis which lies in the direction towards the zero value.
+matchingDataPoint will provide the key (in pixels) of the returned point. Depending on whether the key axis of this graph is horizontal or vertical, matchingDataPoint will provide the x or y value of the returned point, respectively.
+ +
+
|
+ +protected | +
Returns the polygon needed for drawing normal fills between this graph and the key axis.
+Pass the graph's data points (in pixel coordinates) as lineData, and specify the segment which shall be used for the fill. The collection of lineData points described by segment must not contain NaN data points (see getNonNanSegments).
+The returned fill polygon will be closed at the key axis (the zero-value line) for linear value axes. For logarithmic value axes the polygon will reach just beyond the corresponding axis rect side (see getFillBasePoint).
+For increased performance (due to implicit sharing), keep the returned QPolygonF const.
+
+
|
+ +protected | +
Returns the polygon needed for drawing (partial) channel fills between this graph and the graph specified by setChannelFillGraph.
+The data points of this graph are passed as pixel coordinates via thisData, the data of the other graph as otherData. The returned polygon will be calculated for the specified data segments thisSegment and otherSegment, pertaining to the respective thisData and otherData, respectively.
+The passed thisSegment and otherSegment should correspond to the segment pairs returned by getOverlappingSegments, to make sure only segments that actually have key coordinate overlap need to be processed here.
+For increased performance due to implicit sharing, keep the returned QPolygonF const.
+
+
|
+ +protected | +
Finds the highest index of data, whose points x value is just below x. Assumes x values in data points are ordered ascending, as is ensured by getLines/getScatters if the key axis is horizontal.
+Used to calculate the channel fill polygon, see getChannelFillPolygon.
+ +
+
|
+ +protected | +
Finds the smallest index of data, whose points x value is just above x. Assumes x values in data points are ordered ascending, as is ensured by getLines/getScatters if the key axis is horizontal.
+Used to calculate the channel fill polygon, see getChannelFillPolygon.
+ +
+
|
+ +protected | +
Finds the highest index of data, whose points y value is just below y. Assumes y values in data points are ordered ascending, as is ensured by getLines/getScatters if the key axis is vertical.
+Used to calculate the channel fill polygon, see getChannelFillPolygon.
+ +
+
|
+ +protected | +
Finds the smallest index of data, whose points y value is just above y. Assumes y values in data points are ordered ascending, as is ensured by getLines/getScatters if the key axis is vertical.
+Used to calculate the channel fill polygon, see getChannelFillPolygon.
+ +
+
|
+ +protected | +
Calculates the minimum distance in pixels the graph's representation has from the given pixelPoint. This is used to determine whether the graph was clicked or not, e.g. in selectTest. The closest data point to pixelPoint is returned in closestData. Note that if the graph has a line representation, the returned distance may be smaller than the distance to the closestData point, since the distance to the graph line is also taken into account.
+If either the graph has no data or if the line style is lsNone and the scatter style's shape is QCPScatterStyle::ssNone (i.e. there is no visual representation of the graph), returns -1.0.
+ +Holds the data of one single data point for QCPGraph. + More...
++Public Functions | |
| QCPGraphData () | |
| QCPGraphData (double key, double value) | |
| double | sortKey () const |
| double | mainKey () const |
| double | mainValue () const |
| QCPRange | valueRange () const |
+Public Members | |
| +double | key |
| +double | value |
+Static Public Functions | |
| static QCPGraphData | fromSortKey (double sortKey) |
| static bool | sortKeyIsMainKey () |
Holds the data of one single data point for QCPGraph.
+The stored data is:
The container for storing multiple data points is QCPGraphDataContainer. It is a typedef for QCPDataContainer with QCPGraphData as the DataType template parameter. See the documentation there for an explanation regarding the data type's generic methods.
+| QCPGraphData::QCPGraphData | +( | +) | ++ |
Constructs a data point with key and value set to zero.
+ +| QCPGraphData::QCPGraphData | +( | +double | +key, | +
| + | + | double | +value | +
| + | ) | ++ |
Constructs a data point with the specified key and value.
+ +
+
|
+ +inline | +
Returns the key member of this data point.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +
+
|
+ +inlinestatic | +
Returns a data point with the specified sortKey. All other members are set to zero.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +
+
|
+ +inlinestatic | +
Since the member key is both the data point key coordinate and the data ordering parameter, this method returns true.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +
+
|
+ +inline | +
Returns the key member of this data point.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +
+
|
+ +inline | +
Returns the value member of this data point.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +
+
|
+ +inline | +
Returns a QCPRange with both lower and upper boundary set to value of this data point.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +Responsible for drawing the grid of a QCPAxis. + More...
+
+Public Functions | |
| QCPGrid (QCPAxis *parentAxis) | |
| +bool | subGridVisible () const |
| +bool | antialiasedSubGrid () const |
| +bool | antialiasedZeroLine () const |
| +QPen | pen () const |
| +QPen | subGridPen () const |
| +QPen | zeroLinePen () const |
| void | setSubGridVisible (bool visible) |
| void | setAntialiasedSubGrid (bool enabled) |
| void | setAntialiasedZeroLine (bool enabled) |
| void | setPen (const QPen &pen) |
| void | setSubGridPen (const QPen &pen) |
| void | setZeroLinePen (const QPen &pen) |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
| bool | realVisibility () const |
+Protected Functions | |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | draw (QCPPainter *painter) |
| void | drawGridLines (QCPPainter *painter) const |
| void | drawSubGridLines (QCPPainter *painter) const |
Protected Functions inherited from QCPLayerable | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual QCP::Interaction | selectionCategory () const |
| virtual QRect | clipRect () const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Additional Inherited Members | |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
Responsible for drawing the grid of a QCPAxis.
+This class is tightly bound to QCPAxis. Every axis owns a grid instance and uses it to draw the grid lines, sub grid lines and zero-line. You can interact with the grid of an axis via QCPAxis::grid. Normally, you don't need to create an instance of QCPGrid yourself.
+The axis and grid drawing was split into two classes to allow them to be placed on different layers (both QCPAxis and QCPGrid inherit from QCPLayerable). Thus it is possible to have the grid in the background and the axes in the foreground, and any plottables/items in between. This described situation is the default setup, see the QCPLayer documentation.
+
+
|
+ +explicit | +
| void QCPGrid::setSubGridVisible | +( | +bool | +visible | ) | ++ |
Sets whether grid lines at sub tick marks are drawn.
+| void QCPGrid::setAntialiasedSubGrid | +( | +bool | +enabled | ) | ++ |
Sets whether sub grid lines are drawn antialiased.
+ +| void QCPGrid::setAntialiasedZeroLine | +( | +bool | +enabled | ) | ++ |
Sets whether zero lines are drawn antialiased.
+ +| void QCPGrid::setPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen with which (major) grid lines are drawn.
+ +| void QCPGrid::setSubGridPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen with which sub grid lines are drawn.
+ +| void QCPGrid::setZeroLinePen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen with which zero lines are drawn.
+Zero lines are lines at value coordinate 0 which may be drawn with a different pen than other grid lines. To disable zero lines and just draw normal grid lines at zero, set pen to Qt::NoPen.
+ +
+
|
+ +protectedvirtual | +
A convenience function to easily set the QPainter::Antialiased hint on the provided painter before drawing the major grid lines.
+This is the antialiasing state the painter passed to the draw method is in by default.
+This function takes into account the local setting of the antialiasing flag as well as the overrides set with QCustomPlot::setAntialiasedElements and QCustomPlot::setNotAntialiasedElements.
+Implements QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
Draws grid lines and sub grid lines at the positions of (sub) ticks of the parent axis, spanning over the complete axis rect. Also draws the zero line, if appropriate (setZeroLinePen).
+ +Implements QCPLayerable.
+ +
+
|
+ +protected | +
Draws the main grid lines and possibly a zero line with the specified painter.
+This is a helper function called by draw.
+ +
+
|
+ +protected | +
Draws the sub grid lines with the specified painter.
+This is a helper function called by draw.
+ +An anchor of an item to which positions can be attached to. + More...
+
+Public Functions | |
| QCPItemAnchor (QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString &name, int anchorId=-1) | |
| +QString | name () const |
| virtual QPointF | pixelPosition () const |
+Protected Functions | |
| virtual QCPItemPosition * | toQCPItemPosition () |
| void | addChildX (QCPItemPosition *pos) |
| void | removeChildX (QCPItemPosition *pos) |
| void | addChildY (QCPItemPosition *pos) |
| void | removeChildY (QCPItemPosition *pos) |
An anchor of an item to which positions can be attached to.
+An item (QCPAbstractItem) may have one or more anchors. Unlike QCPItemPosition, an anchor doesn't control anything on its item, but provides a way to tie other items via their positions to the anchor.
+For example, a QCPItemRect is defined by its positions topLeft and bottomRight. Additionally it has various anchors like top, topRight or bottomLeft etc. So you can attach the start (which is a QCPItemPosition) of a QCPItemLine to one of the anchors by calling QCPItemPosition::setParentAnchor on start, passing the wanted anchor of the QCPItemRect. This way the start of the line will now always follow the respective anchor location on the rect item.
+Note that QCPItemPosition derives from QCPItemAnchor, so every position can also serve as an anchor to other positions.
+To learn how to provide anchors in your own item subclasses, see the subclassing section of the QCPAbstractItem documentation.
+| QCPItemAnchor::QCPItemAnchor | +( | +QCustomPlot * | +parentPlot, | +
| + | + | QCPAbstractItem * | +parentItem, | +
| + | + | const QString & | +name, | +
| + | + | int | +anchorId = -1 |
+
| + | ) | ++ |
Creates a new QCPItemAnchor. You shouldn't create QCPItemAnchor instances directly, even if you want to make a new item subclass. Use QCPAbstractItem::createAnchor instead, as explained in the subclassing section of the QCPAbstractItem documentation.
+ +
+
|
+ +virtual | +
Returns the final absolute pixel position of the QCPItemAnchor on the QCustomPlot surface.
+The pixel information is internally retrieved via QCPAbstractItem::anchorPixelPosition of the parent item, QCPItemAnchor is just an intermediary.
+ +Reimplemented in QCPItemPosition.
+ +
+
|
+ +inlineprotectedvirtual | +
Returns 0 if this instance is merely a QCPItemAnchor, and a valid pointer of type QCPItemPosition* if it actually is a QCPItemPosition (which is a subclass of QCPItemAnchor).
+This safe downcast functionality could also be achieved with a dynamic_cast. However, QCustomPlot avoids dynamic_cast to work with projects that don't have RTTI support enabled (e.g. -fno-rtti flag with gcc compiler).
+ +Reimplemented in QCPItemPosition.
+ +
+
|
+ +protected | +
Adds pos to the childX list of this anchor, which keeps track of which children use this anchor as parent anchor for the respective coordinate. This is necessary to notify the children prior to destruction of the anchor.
+Note that this function does not change the parent setting in pos.
+ +
+
|
+ +protected | +
Removes pos from the childX list of this anchor.
+Note that this function does not change the parent setting in pos.
+ +
+
|
+ +protected | +
Adds pos to the childY list of this anchor, which keeps track of which children use this anchor as parent anchor for the respective coordinate. This is necessary to notify the children prior to destruction of the anchor.
+Note that this function does not change the parent setting in pos.
+ +
+
|
+ +protected | +
Removes pos from the childY list of this anchor.
+Note that this function does not change the parent setting in pos.
+ +A bracket for referencing/highlighting certain parts in the plot. + More...
+
+Public Types | |
| enum | BracketStyle |
+Public Functions | |
| QCPItemBracket (QCustomPlot *parentPlot) | |
| +QPen | pen () const |
| +QPen | selectedPen () const |
| +double | length () const |
| +BracketStyle | style () const |
| void | setPen (const QPen &pen) |
| void | setSelectedPen (const QPen &pen) |
| void | setLength (double length) |
| void | setStyle (BracketStyle style) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
Public Functions inherited from QCPAbstractItem | |
| QCPAbstractItem (QCustomPlot *parentPlot) | |
| +bool | clipToAxisRect () const |
| +QCPAxisRect * | clipAxisRect () const |
| +bool | selectable () const |
| +bool | selected () const |
| void | setClipToAxisRect (bool clip) |
| void | setClipAxisRect (QCPAxisRect *rect) |
| Q_SLOT void | setSelectable (bool selectable) |
| Q_SLOT void | setSelected (bool selected) |
| QList< QCPItemPosition * > | positions () const |
| QList< QCPItemAnchor * > | anchors () const |
| QCPItemPosition * | position (const QString &name) const |
| QCPItemAnchor * | anchor (const QString &name) const |
| bool | hasAnchor (const QString &name) const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Public Members | |
| +QCPItemPosition *const | left |
| +QCPItemPosition *const | right |
| +QCPItemAnchor *const | center |
+Protected Types | |
| enum | AnchorIndex |
+Protected Functions | |
| virtual void | draw (QCPPainter *painter) |
| virtual QPointF | anchorPixelPosition (int anchorId) const |
| QPen | mainPen () const |
Protected Functions inherited from QCPAbstractItem | |
| virtual QCP::Interaction | selectionCategory () const |
| virtual QRect | clipRect () const |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| double | rectDistance (const QRectF &rect, const QPointF &pos, bool filledRect) const |
| QCPItemPosition * | createPosition (const QString &name) |
| QCPItemAnchor * | createAnchor (const QString &name, int anchorId) |
Protected Functions inherited from QCPLayerable | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Additional Inherited Members | |
Signals inherited from QCPAbstractItem | |
| void | selectionChanged (bool selected) |
| +void | selectableChanged (bool selectable) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
A bracket for referencing/highlighting certain parts in the plot.
+
+It has two positions, left and right, which define the span of the bracket. If left is actually farther to the left than right, the bracket is opened to the bottom, as shown in the example image.
+The bracket supports multiple styles via setStyle. The length, i.e. how far the bracket stretches away from the embraced span, can be controlled with setLength.
+
+It provides an anchor center, to allow connection of other items, e.g. an arrow (QCPItemLine or QCPItemCurve) or a text label (QCPItemText), to the bracket.
+| enum QCPItemBracket::BracketStyle | +
Defines the various visual shapes of the bracket item. The appearance can be further modified by setLength and setPen.
+
+
|
+ +explicit | +
Creates a bracket item and sets default values.
+The created item is automatically registered with parentPlot. This QCustomPlot instance takes ownership of the item, so do not delete it manually but use QCustomPlot::removeItem() instead.
+ +| void QCPItemBracket::setPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen that will be used to draw the bracket.
+Note that when the style is bsCalligraphic, only the color will be taken from the pen, the stroke and width are ignored. To change the apparent stroke width of a calligraphic bracket, use setLength, which has a similar effect.
+| void QCPItemBracket::setSelectedPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen that will be used to draw the bracket when selected
+| void QCPItemBracket::setLength | +( | +double | +length | ) | ++ |
Sets the length in pixels how far the bracket extends in the direction towards the embraced span of the bracket (i.e. perpendicular to the left-right-direction)
+
+| void QCPItemBracket::setStyle | +( | +QCPItemBracket::BracketStyle | +style | ) | ++ |
Sets the style of the bracket, i.e. the shape/visual appearance.
+
+
|
+ +virtual | +
This function is used to decide whether a click hits a layerable object or not.
+pos is a point in pixel coordinates on the QCustomPlot surface. This function returns the shortest pixel distance of this point to the object. If the object is either invisible or the distance couldn't be determined, -1.0 is returned. Further, if onlySelectable is true and the object is not selectable, -1.0 is returned, too.
+If the object is represented not by single lines but by an area like a QCPItemText or the bars of a QCPBars plottable, a click inside the area should also be considered a hit. In these cases this function thus returns a constant value greater zero but still below the parent plot's selection tolerance. (typically the selectionTolerance multiplied by 0.99).
+Providing a constant value for area objects allows selecting line objects even when they are obscured by such area objects, by clicking close to the lines (i.e. closer than 0.99*selectionTolerance).
+The actual setting of the selection state is not done by this function. This is handled by the parent QCustomPlot when the mouseReleaseEvent occurs, and the finally selected object is notified via the selectEvent/deselectEvent methods.
+details is an optional output parameter. Every layerable subclass may place any information in details. This information will be passed to selectEvent when the parent QCustomPlot decides on the basis of this selectTest call, that the object was successfully selected. The subsequent call to selectEvent will carry the details. This is useful for multi-part objects (like QCPAxis). This way, a possibly complex calculation to decide which part was clicked is only done once in selectTest. The result (i.e. the actually clicked part) can then be placed in details. So in the subsequent selectEvent, the decision which part was selected doesn't have to be done a second time for a single selection operation.
+In the case of 1D Plottables (QCPAbstractPlottable1D, like QCPGraph or QCPBars) details will be set to a QCPDataSelection, describing the closest data point to pos.
+You may pass 0 as details to indicate that you are not interested in those selection details.
+Implements QCPAbstractItem.
+ +
+
|
+ +protectedvirtual | +
Draws this item with the provided painter.
+The cliprect of the provided painter is set to the rect returned by clipRect before this function is called. The clipRect depends on the clipping settings defined by setClipToAxisRect and setClipAxisRect.
+ +Implements QCPAbstractItem.
+ +
+
|
+ +protectedvirtual | +
Returns the pixel position of the anchor with Id anchorId. This function must be reimplemented in item subclasses if they want to provide anchors (QCPItemAnchor).
+For example, if the item has two anchors with id 0 and 1, this function takes one of these anchor ids and returns the respective pixel points of the specified anchor.
+Reimplemented from QCPAbstractItem.
+ +
+
|
+ +protected | +
Returns the pen that should be used for drawing lines. Returns mPen when the item is not selected and mSelectedPen when it is.
+ +A curved line from one point to another. + More...
+
+Public Functions | |
| QCPItemCurve (QCustomPlot *parentPlot) | |
| +QPen | pen () const |
| +QPen | selectedPen () const |
| +QCPLineEnding | head () const |
| +QCPLineEnding | tail () const |
| void | setPen (const QPen &pen) |
| void | setSelectedPen (const QPen &pen) |
| void | setHead (const QCPLineEnding &head) |
| void | setTail (const QCPLineEnding &tail) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
Public Functions inherited from QCPAbstractItem | |
| QCPAbstractItem (QCustomPlot *parentPlot) | |
| +bool | clipToAxisRect () const |
| +QCPAxisRect * | clipAxisRect () const |
| +bool | selectable () const |
| +bool | selected () const |
| void | setClipToAxisRect (bool clip) |
| void | setClipAxisRect (QCPAxisRect *rect) |
| Q_SLOT void | setSelectable (bool selectable) |
| Q_SLOT void | setSelected (bool selected) |
| QList< QCPItemPosition * > | positions () const |
| QList< QCPItemAnchor * > | anchors () const |
| QCPItemPosition * | position (const QString &name) const |
| QCPItemAnchor * | anchor (const QString &name) const |
| bool | hasAnchor (const QString &name) const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Public Members | |
| +QCPItemPosition *const | start |
| +QCPItemPosition *const | startDir |
| +QCPItemPosition *const | endDir |
| +QCPItemPosition *const | end |
+Protected Functions | |
| virtual void | draw (QCPPainter *painter) |
| QPen | mainPen () const |
Protected Functions inherited from QCPAbstractItem | |
| virtual QCP::Interaction | selectionCategory () const |
| virtual QRect | clipRect () const |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| virtual QPointF | anchorPixelPosition (int anchorId) const |
| double | rectDistance (const QRectF &rect, const QPointF &pos, bool filledRect) const |
| QCPItemPosition * | createPosition (const QString &name) |
| QCPItemAnchor * | createAnchor (const QString &name, int anchorId) |
Protected Functions inherited from QCPLayerable | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Additional Inherited Members | |
Signals inherited from QCPAbstractItem | |
| void | selectionChanged (bool selected) |
| +void | selectableChanged (bool selectable) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
A curved line from one point to another.
+
+It has four positions, start and end, which define the end points of the line, and two control points which define the direction the line exits from the start and the direction from which it approaches the end: startDir and endDir.
+With setHead and setTail you may set different line ending styles, e.g. to create an arrow.
+Often it is desirable for the control points to stay at fixed relative positions to the start/end point. This can be achieved by setting the parent anchor e.g. of startDir simply to start, and then specify the desired pixel offset with QCPItemPosition::setCoords on startDir.
+
+
|
+ +explicit | +
Creates a curve item and sets default values.
+The created item is automatically registered with parentPlot. This QCustomPlot instance takes ownership of the item, so do not delete it manually but use QCustomPlot::removeItem() instead.
+ +| void QCPItemCurve::setPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen that will be used to draw the line
+| void QCPItemCurve::setSelectedPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen that will be used to draw the line when selected
+| void QCPItemCurve::setHead | +( | +const QCPLineEnding & | +head | ) | ++ |
Sets the line ending style of the head. The head corresponds to the end position.
+Note that due to the overloaded QCPLineEnding constructor, you may directly specify a QCPLineEnding::EndingStyle here, e.g.
| void QCPItemCurve::setTail | +( | +const QCPLineEnding & | +tail | ) | ++ |
Sets the line ending style of the tail. The tail corresponds to the start position.
+Note that due to the overloaded QCPLineEnding constructor, you may directly specify a QCPLineEnding::EndingStyle here, e.g.
+
|
+ +virtual | +
This function is used to decide whether a click hits a layerable object or not.
+pos is a point in pixel coordinates on the QCustomPlot surface. This function returns the shortest pixel distance of this point to the object. If the object is either invisible or the distance couldn't be determined, -1.0 is returned. Further, if onlySelectable is true and the object is not selectable, -1.0 is returned, too.
+If the object is represented not by single lines but by an area like a QCPItemText or the bars of a QCPBars plottable, a click inside the area should also be considered a hit. In these cases this function thus returns a constant value greater zero but still below the parent plot's selection tolerance. (typically the selectionTolerance multiplied by 0.99).
+Providing a constant value for area objects allows selecting line objects even when they are obscured by such area objects, by clicking close to the lines (i.e. closer than 0.99*selectionTolerance).
+The actual setting of the selection state is not done by this function. This is handled by the parent QCustomPlot when the mouseReleaseEvent occurs, and the finally selected object is notified via the selectEvent/deselectEvent methods.
+details is an optional output parameter. Every layerable subclass may place any information in details. This information will be passed to selectEvent when the parent QCustomPlot decides on the basis of this selectTest call, that the object was successfully selected. The subsequent call to selectEvent will carry the details. This is useful for multi-part objects (like QCPAxis). This way, a possibly complex calculation to decide which part was clicked is only done once in selectTest. The result (i.e. the actually clicked part) can then be placed in details. So in the subsequent selectEvent, the decision which part was selected doesn't have to be done a second time for a single selection operation.
+In the case of 1D Plottables (QCPAbstractPlottable1D, like QCPGraph or QCPBars) details will be set to a QCPDataSelection, describing the closest data point to pos.
+You may pass 0 as details to indicate that you are not interested in those selection details.
+Implements QCPAbstractItem.
+ +
+
|
+ +protectedvirtual | +
Draws this item with the provided painter.
+The cliprect of the provided painter is set to the rect returned by clipRect before this function is called. The clipRect depends on the clipping settings defined by setClipToAxisRect and setClipAxisRect.
+ +Implements QCPAbstractItem.
+ +
+
|
+ +protected | +
Returns the pen that should be used for drawing lines. Returns mPen when the item is not selected and mSelectedPen when it is.
+ +An ellipse. + More...
+
+Public Functions | |
| QCPItemEllipse (QCustomPlot *parentPlot) | |
| +QPen | pen () const |
| +QPen | selectedPen () const |
| +QBrush | brush () const |
| +QBrush | selectedBrush () const |
| void | setPen (const QPen &pen) |
| void | setSelectedPen (const QPen &pen) |
| void | setBrush (const QBrush &brush) |
| void | setSelectedBrush (const QBrush &brush) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
Public Functions inherited from QCPAbstractItem | |
| QCPAbstractItem (QCustomPlot *parentPlot) | |
| +bool | clipToAxisRect () const |
| +QCPAxisRect * | clipAxisRect () const |
| +bool | selectable () const |
| +bool | selected () const |
| void | setClipToAxisRect (bool clip) |
| void | setClipAxisRect (QCPAxisRect *rect) |
| Q_SLOT void | setSelectable (bool selectable) |
| Q_SLOT void | setSelected (bool selected) |
| QList< QCPItemPosition * > | positions () const |
| QList< QCPItemAnchor * > | anchors () const |
| QCPItemPosition * | position (const QString &name) const |
| QCPItemAnchor * | anchor (const QString &name) const |
| bool | hasAnchor (const QString &name) const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Public Members | |
| +QCPItemPosition *const | topLeft |
| +QCPItemPosition *const | bottomRight |
| +QCPItemAnchor *const | topLeftRim |
| +QCPItemAnchor *const | top |
| +QCPItemAnchor *const | topRightRim |
| +QCPItemAnchor *const | right |
| +QCPItemAnchor *const | bottomRightRim |
| +QCPItemAnchor *const | bottom |
| +QCPItemAnchor *const | bottomLeftRim |
| +QCPItemAnchor *const | left |
| +QCPItemAnchor *const | center |
+Protected Types | |
| enum | AnchorIndex |
+Protected Functions | |
| virtual void | draw (QCPPainter *painter) |
| virtual QPointF | anchorPixelPosition (int anchorId) const |
| QPen | mainPen () const |
| QBrush | mainBrush () const |
Protected Functions inherited from QCPAbstractItem | |
| virtual QCP::Interaction | selectionCategory () const |
| virtual QRect | clipRect () const |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| double | rectDistance (const QRectF &rect, const QPointF &pos, bool filledRect) const |
| QCPItemPosition * | createPosition (const QString &name) |
| QCPItemAnchor * | createAnchor (const QString &name, int anchorId) |
Protected Functions inherited from QCPLayerable | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Additional Inherited Members | |
Signals inherited from QCPAbstractItem | |
| void | selectionChanged (bool selected) |
| +void | selectableChanged (bool selectable) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
An ellipse.
+
+It has two positions, topLeft and bottomRight, which define the rect the ellipse will be drawn in.
+
+
|
+ +explicit | +
Creates an ellipse item and sets default values.
+The created item is automatically registered with parentPlot. This QCustomPlot instance takes ownership of the item, so do not delete it manually but use QCustomPlot::removeItem() instead.
+ +| void QCPItemEllipse::setPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen that will be used to draw the line of the ellipse
+| void QCPItemEllipse::setSelectedPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen that will be used to draw the line of the ellipse when selected
+| void QCPItemEllipse::setBrush | +( | +const QBrush & | +brush | ) | ++ |
Sets the brush that will be used to fill the ellipse. To disable filling, set brush to Qt::NoBrush.
+| void QCPItemEllipse::setSelectedBrush | +( | +const QBrush & | +brush | ) | ++ |
Sets the brush that will be used to fill the ellipse when selected. To disable filling, set brush to Qt::NoBrush.
+
+
|
+ +virtual | +
This function is used to decide whether a click hits a layerable object or not.
+pos is a point in pixel coordinates on the QCustomPlot surface. This function returns the shortest pixel distance of this point to the object. If the object is either invisible or the distance couldn't be determined, -1.0 is returned. Further, if onlySelectable is true and the object is not selectable, -1.0 is returned, too.
+If the object is represented not by single lines but by an area like a QCPItemText or the bars of a QCPBars plottable, a click inside the area should also be considered a hit. In these cases this function thus returns a constant value greater zero but still below the parent plot's selection tolerance. (typically the selectionTolerance multiplied by 0.99).
+Providing a constant value for area objects allows selecting line objects even when they are obscured by such area objects, by clicking close to the lines (i.e. closer than 0.99*selectionTolerance).
+The actual setting of the selection state is not done by this function. This is handled by the parent QCustomPlot when the mouseReleaseEvent occurs, and the finally selected object is notified via the selectEvent/deselectEvent methods.
+details is an optional output parameter. Every layerable subclass may place any information in details. This information will be passed to selectEvent when the parent QCustomPlot decides on the basis of this selectTest call, that the object was successfully selected. The subsequent call to selectEvent will carry the details. This is useful for multi-part objects (like QCPAxis). This way, a possibly complex calculation to decide which part was clicked is only done once in selectTest. The result (i.e. the actually clicked part) can then be placed in details. So in the subsequent selectEvent, the decision which part was selected doesn't have to be done a second time for a single selection operation.
+In the case of 1D Plottables (QCPAbstractPlottable1D, like QCPGraph or QCPBars) details will be set to a QCPDataSelection, describing the closest data point to pos.
+You may pass 0 as details to indicate that you are not interested in those selection details.
+Implements QCPAbstractItem.
+ +
+
|
+ +protectedvirtual | +
Draws this item with the provided painter.
+The cliprect of the provided painter is set to the rect returned by clipRect before this function is called. The clipRect depends on the clipping settings defined by setClipToAxisRect and setClipAxisRect.
+ +Implements QCPAbstractItem.
+ +
+
|
+ +protectedvirtual | +
Returns the pixel position of the anchor with Id anchorId. This function must be reimplemented in item subclasses if they want to provide anchors (QCPItemAnchor).
+For example, if the item has two anchors with id 0 and 1, this function takes one of these anchor ids and returns the respective pixel points of the specified anchor.
+Reimplemented from QCPAbstractItem.
+ +
+
|
+ +protected | +
Returns the pen that should be used for drawing lines. Returns mPen when the item is not selected and mSelectedPen when it is.
+ +
+
|
+ +protected | +
Returns the brush that should be used for drawing fills of the item. Returns mBrush when the item is not selected and mSelectedBrush when it is.
+ +A line from one point to another. + More...
+
+Public Functions | |
| QCPItemLine (QCustomPlot *parentPlot) | |
| +QPen | pen () const |
| +QPen | selectedPen () const |
| +QCPLineEnding | head () const |
| +QCPLineEnding | tail () const |
| void | setPen (const QPen &pen) |
| void | setSelectedPen (const QPen &pen) |
| void | setHead (const QCPLineEnding &head) |
| void | setTail (const QCPLineEnding &tail) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
Public Functions inherited from QCPAbstractItem | |
| QCPAbstractItem (QCustomPlot *parentPlot) | |
| +bool | clipToAxisRect () const |
| +QCPAxisRect * | clipAxisRect () const |
| +bool | selectable () const |
| +bool | selected () const |
| void | setClipToAxisRect (bool clip) |
| void | setClipAxisRect (QCPAxisRect *rect) |
| Q_SLOT void | setSelectable (bool selectable) |
| Q_SLOT void | setSelected (bool selected) |
| QList< QCPItemPosition * > | positions () const |
| QList< QCPItemAnchor * > | anchors () const |
| QCPItemPosition * | position (const QString &name) const |
| QCPItemAnchor * | anchor (const QString &name) const |
| bool | hasAnchor (const QString &name) const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Public Members | |
| +QCPItemPosition *const | start |
| +QCPItemPosition *const | end |
+Protected Functions | |
| virtual void | draw (QCPPainter *painter) |
| QLineF | getRectClippedLine (const QCPVector2D &start, const QCPVector2D &end, const QRect &rect) const |
| QPen | mainPen () const |
Protected Functions inherited from QCPAbstractItem | |
| virtual QCP::Interaction | selectionCategory () const |
| virtual QRect | clipRect () const |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| virtual QPointF | anchorPixelPosition (int anchorId) const |
| double | rectDistance (const QRectF &rect, const QPointF &pos, bool filledRect) const |
| QCPItemPosition * | createPosition (const QString &name) |
| QCPItemAnchor * | createAnchor (const QString &name, int anchorId) |
Protected Functions inherited from QCPLayerable | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Additional Inherited Members | |
Signals inherited from QCPAbstractItem | |
| void | selectionChanged (bool selected) |
| +void | selectableChanged (bool selectable) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
A line from one point to another.
+
+It has two positions, start and end, which define the end points of the line.
+With setHead and setTail you may set different line ending styles, e.g. to create an arrow.
+
+
|
+ +explicit | +
Creates a line item and sets default values.
+The created item is automatically registered with parentPlot. This QCustomPlot instance takes ownership of the item, so do not delete it manually but use QCustomPlot::removeItem() instead.
+ +| void QCPItemLine::setPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen that will be used to draw the line
+| void QCPItemLine::setSelectedPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen that will be used to draw the line when selected
+| void QCPItemLine::setHead | +( | +const QCPLineEnding & | +head | ) | ++ |
Sets the line ending style of the head. The head corresponds to the end position.
+Note that due to the overloaded QCPLineEnding constructor, you may directly specify a QCPLineEnding::EndingStyle here, e.g.
| void QCPItemLine::setTail | +( | +const QCPLineEnding & | +tail | ) | ++ |
Sets the line ending style of the tail. The tail corresponds to the start position.
+Note that due to the overloaded QCPLineEnding constructor, you may directly specify a QCPLineEnding::EndingStyle here, e.g.
+
|
+ +virtual | +
This function is used to decide whether a click hits a layerable object or not.
+pos is a point in pixel coordinates on the QCustomPlot surface. This function returns the shortest pixel distance of this point to the object. If the object is either invisible or the distance couldn't be determined, -1.0 is returned. Further, if onlySelectable is true and the object is not selectable, -1.0 is returned, too.
+If the object is represented not by single lines but by an area like a QCPItemText or the bars of a QCPBars plottable, a click inside the area should also be considered a hit. In these cases this function thus returns a constant value greater zero but still below the parent plot's selection tolerance. (typically the selectionTolerance multiplied by 0.99).
+Providing a constant value for area objects allows selecting line objects even when they are obscured by such area objects, by clicking close to the lines (i.e. closer than 0.99*selectionTolerance).
+The actual setting of the selection state is not done by this function. This is handled by the parent QCustomPlot when the mouseReleaseEvent occurs, and the finally selected object is notified via the selectEvent/deselectEvent methods.
+details is an optional output parameter. Every layerable subclass may place any information in details. This information will be passed to selectEvent when the parent QCustomPlot decides on the basis of this selectTest call, that the object was successfully selected. The subsequent call to selectEvent will carry the details. This is useful for multi-part objects (like QCPAxis). This way, a possibly complex calculation to decide which part was clicked is only done once in selectTest. The result (i.e. the actually clicked part) can then be placed in details. So in the subsequent selectEvent, the decision which part was selected doesn't have to be done a second time for a single selection operation.
+In the case of 1D Plottables (QCPAbstractPlottable1D, like QCPGraph or QCPBars) details will be set to a QCPDataSelection, describing the closest data point to pos.
+You may pass 0 as details to indicate that you are not interested in those selection details.
+Implements QCPAbstractItem.
+ +
+
|
+ +protectedvirtual | +
Draws this item with the provided painter.
+The cliprect of the provided painter is set to the rect returned by clipRect before this function is called. The clipRect depends on the clipping settings defined by setClipToAxisRect and setClipAxisRect.
+ +Implements QCPAbstractItem.
+ +
+
|
+ +protected | +
Returns the section of the line defined by start and end, that is visible in the specified rect.
+This is a helper function for draw.
+ +
+
|
+ +protected | +
Returns the pen that should be used for drawing lines. Returns mPen when the item is not selected and mSelectedPen when it is.
+ +An arbitrary pixmap. + More...
+
+Public Functions | |
| QCPItemPixmap (QCustomPlot *parentPlot) | |
| +QPixmap | pixmap () const |
| +bool | scaled () const |
| +Qt::AspectRatioMode | aspectRatioMode () const |
| +Qt::TransformationMode | transformationMode () const |
| +QPen | pen () const |
| +QPen | selectedPen () const |
| void | setPixmap (const QPixmap &pixmap) |
| void | setScaled (bool scaled, Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio, Qt::TransformationMode transformationMode=Qt::SmoothTransformation) |
| void | setPen (const QPen &pen) |
| void | setSelectedPen (const QPen &pen) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
Public Functions inherited from QCPAbstractItem | |
| QCPAbstractItem (QCustomPlot *parentPlot) | |
| +bool | clipToAxisRect () const |
| +QCPAxisRect * | clipAxisRect () const |
| +bool | selectable () const |
| +bool | selected () const |
| void | setClipToAxisRect (bool clip) |
| void | setClipAxisRect (QCPAxisRect *rect) |
| Q_SLOT void | setSelectable (bool selectable) |
| Q_SLOT void | setSelected (bool selected) |
| QList< QCPItemPosition * > | positions () const |
| QList< QCPItemAnchor * > | anchors () const |
| QCPItemPosition * | position (const QString &name) const |
| QCPItemAnchor * | anchor (const QString &name) const |
| bool | hasAnchor (const QString &name) const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Public Members | |
| +QCPItemPosition *const | topLeft |
| +QCPItemPosition *const | bottomRight |
| +QCPItemAnchor *const | top |
| +QCPItemAnchor *const | topRight |
| +QCPItemAnchor *const | right |
| +QCPItemAnchor *const | bottom |
| +QCPItemAnchor *const | bottomLeft |
| +QCPItemAnchor *const | left |
+Protected Types | |
| enum | AnchorIndex |
+Protected Functions | |
| virtual void | draw (QCPPainter *painter) |
| virtual QPointF | anchorPixelPosition (int anchorId) const |
| void | updateScaledPixmap (QRect finalRect=QRect(), bool flipHorz=false, bool flipVert=false) |
| QRect | getFinalRect (bool *flippedHorz=0, bool *flippedVert=0) const |
| QPen | mainPen () const |
Protected Functions inherited from QCPAbstractItem | |
| virtual QCP::Interaction | selectionCategory () const |
| virtual QRect | clipRect () const |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| double | rectDistance (const QRectF &rect, const QPointF &pos, bool filledRect) const |
| QCPItemPosition * | createPosition (const QString &name) |
| QCPItemAnchor * | createAnchor (const QString &name, int anchorId) |
Protected Functions inherited from QCPLayerable | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Additional Inherited Members | |
Signals inherited from QCPAbstractItem | |
| void | selectionChanged (bool selected) |
| +void | selectableChanged (bool selectable) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
An arbitrary pixmap.
+
+It has two positions, topLeft and bottomRight, which define the rectangle the pixmap will be drawn in. Depending on the scale setting (setScaled), the pixmap will be either scaled to fit the rectangle or be drawn aligned to the topLeft position.
+If scaling is enabled and topLeft is further to the bottom/right than bottomRight (as shown on the right side of the example image), the pixmap will be flipped in the respective orientations.
+
+
|
+ +explicit | +
Creates a rectangle item and sets default values.
+The created item is automatically registered with parentPlot. This QCustomPlot instance takes ownership of the item, so do not delete it manually but use QCustomPlot::removeItem() instead.
+ +| void QCPItemPixmap::setPixmap | +( | +const QPixmap & | +pixmap | ) | ++ |
Sets the pixmap that will be displayed.
+ +| void QCPItemPixmap::setScaled | +( | +bool | +scaled, | +
| + | + | Qt::AspectRatioMode | +aspectRatioMode = Qt::KeepAspectRatio, |
+
| + | + | Qt::TransformationMode | +transformationMode = Qt::SmoothTransformation |
+
| + | ) | ++ |
Sets whether the pixmap will be scaled to fit the rectangle defined by the topLeft and bottomRight positions.
+ +| void QCPItemPixmap::setPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen that will be used to draw a border around the pixmap.
+| void QCPItemPixmap::setSelectedPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen that will be used to draw a border around the pixmap when selected
+
+
|
+ +virtual | +
This function is used to decide whether a click hits a layerable object or not.
+pos is a point in pixel coordinates on the QCustomPlot surface. This function returns the shortest pixel distance of this point to the object. If the object is either invisible or the distance couldn't be determined, -1.0 is returned. Further, if onlySelectable is true and the object is not selectable, -1.0 is returned, too.
+If the object is represented not by single lines but by an area like a QCPItemText or the bars of a QCPBars plottable, a click inside the area should also be considered a hit. In these cases this function thus returns a constant value greater zero but still below the parent plot's selection tolerance. (typically the selectionTolerance multiplied by 0.99).
+Providing a constant value for area objects allows selecting line objects even when they are obscured by such area objects, by clicking close to the lines (i.e. closer than 0.99*selectionTolerance).
+The actual setting of the selection state is not done by this function. This is handled by the parent QCustomPlot when the mouseReleaseEvent occurs, and the finally selected object is notified via the selectEvent/deselectEvent methods.
+details is an optional output parameter. Every layerable subclass may place any information in details. This information will be passed to selectEvent when the parent QCustomPlot decides on the basis of this selectTest call, that the object was successfully selected. The subsequent call to selectEvent will carry the details. This is useful for multi-part objects (like QCPAxis). This way, a possibly complex calculation to decide which part was clicked is only done once in selectTest. The result (i.e. the actually clicked part) can then be placed in details. So in the subsequent selectEvent, the decision which part was selected doesn't have to be done a second time for a single selection operation.
+In the case of 1D Plottables (QCPAbstractPlottable1D, like QCPGraph or QCPBars) details will be set to a QCPDataSelection, describing the closest data point to pos.
+You may pass 0 as details to indicate that you are not interested in those selection details.
+Implements QCPAbstractItem.
+ +
+
|
+ +protectedvirtual | +
Draws this item with the provided painter.
+The cliprect of the provided painter is set to the rect returned by clipRect before this function is called. The clipRect depends on the clipping settings defined by setClipToAxisRect and setClipAxisRect.
+ +Implements QCPAbstractItem.
+ +
+
|
+ +protectedvirtual | +
Returns the pixel position of the anchor with Id anchorId. This function must be reimplemented in item subclasses if they want to provide anchors (QCPItemAnchor).
+For example, if the item has two anchors with id 0 and 1, this function takes one of these anchor ids and returns the respective pixel points of the specified anchor.
+Reimplemented from QCPAbstractItem.
+ +
+
|
+ +protected | +
Creates the buffered scaled image (mScaledPixmap) to fit the specified finalRect. The parameters flipHorz and flipVert control whether the resulting image shall be flipped horizontally or vertically. (This is used when topLeft is further to the bottom/right than bottomRight.)
+This function only creates the scaled pixmap when the buffered pixmap has a different size than the expected result, so calling this function repeatedly, e.g. in the draw function, does not cause expensive rescaling every time.
+If scaling is disabled, sets mScaledPixmap to a null QPixmap.
+ +
+
|
+ +protected | +
Returns the final (tight) rect the pixmap is drawn in, depending on the current item positions and scaling settings.
+The output parameters flippedHorz and flippedVert return whether the pixmap should be drawn flipped horizontally or vertically in the returned rect. (The returned rect itself is always normalized, i.e. the top left corner of the rect is actually further to the top/left than the bottom right corner). This is the case when the item position topLeft is further to the bottom/right than bottomRight.
+If scaling is disabled, returns a rect with size of the original pixmap and the top left corner aligned with the item position topLeft. The position bottomRight is ignored.
+ +
+
|
+ +protected | +
Returns the pen that should be used for drawing lines. Returns mPen when the item is not selected and mSelectedPen when it is.
+ +Manages the position of an item. + More...
+
+Public Types | |
| enum | PositionType |
+Public Functions | |
| QCPItemPosition (QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString &name) | |
| PositionType | type () const |
| +PositionType | typeX () const |
| +PositionType | typeY () const |
| QCPItemAnchor * | parentAnchor () const |
| +QCPItemAnchor * | parentAnchorX () const |
| +QCPItemAnchor * | parentAnchorY () const |
| +double | key () const |
| +double | value () const |
| +QPointF | coords () const |
| +QCPAxis * | keyAxis () const |
| +QCPAxis * | valueAxis () const |
| +QCPAxisRect * | axisRect () const |
| virtual QPointF | pixelPosition () const |
| void | setType (PositionType type) |
| void | setTypeX (PositionType type) |
| void | setTypeY (PositionType type) |
| bool | setParentAnchor (QCPItemAnchor *parentAnchor, bool keepPixelPosition=false) |
| bool | setParentAnchorX (QCPItemAnchor *parentAnchor, bool keepPixelPosition=false) |
| bool | setParentAnchorY (QCPItemAnchor *parentAnchor, bool keepPixelPosition=false) |
| void | setCoords (double key, double value) |
| void | setCoords (const QPointF &coords) |
| void | setAxes (QCPAxis *keyAxis, QCPAxis *valueAxis) |
| void | setAxisRect (QCPAxisRect *axisRect) |
| void | setPixelPosition (const QPointF &pixelPosition) |
Public Functions inherited from QCPItemAnchor | |
| QCPItemAnchor (QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString &name, int anchorId=-1) | |
| +QString | name () const |
+Protected Functions | |
| virtual QCPItemPosition * | toQCPItemPosition () |
Protected Functions inherited from QCPItemAnchor | |
| void | addChildX (QCPItemPosition *pos) |
| void | removeChildX (QCPItemPosition *pos) |
| void | addChildY (QCPItemPosition *pos) |
| void | removeChildY (QCPItemPosition *pos) |
Manages the position of an item.
+Every item has at least one public QCPItemPosition member pointer which provides ways to position the item on the QCustomPlot surface. Some items have multiple positions, for example QCPItemRect has two: topLeft and bottomRight.
+QCPItemPosition has a type (PositionType) that can be set with setType. This type defines how coordinates passed to setCoords are to be interpreted, e.g. as absolute pixel coordinates, as plot coordinates of certain axes, etc. For more advanced plots it is also possible to assign different types per X/Y coordinate of the position (see setTypeX, setTypeY). This way an item could be positioned at a fixed pixel distance from the top in the Y direction, while following a plot coordinate in the X direction.
+A QCPItemPosition may have a parent QCPItemAnchor, see setParentAnchor. This way you can tie multiple items together. If the QCPItemPosition has a parent, its coordinates (setCoords) are considered to be absolute pixels in the reference frame of the parent anchor, where (0, 0) means directly ontop of the parent anchor. For example, You could attach the start position of a QCPItemLine to the bottom anchor of a QCPItemText to make the starting point of the line always be centered under the text label, no matter where the text is moved to. For more advanced plots, it is possible to assign different parent anchors per X/Y coordinate of the position, see setParentAnchorX, setParentAnchorY. This way an item could follow another item in the X direction but stay at a fixed position in the Y direction. Or even follow item A in X, and item B in Y.
+Note that every QCPItemPosition inherits from QCPItemAnchor and thus can itself be used as parent anchor for other positions.
+To set the apparent pixel position on the QCustomPlot surface directly, use setPixelPosition. This works no matter what type this QCPItemPosition is or what parent-child situation it is in, as setPixelPosition transforms the coordinates appropriately, to make the position appear at the specified pixel values.
+| enum QCPItemPosition::PositionType | +
Defines the ways an item position can be specified. Thus it defines what the numbers passed to setCoords actually mean.
+| Enumerator | |
|---|---|
| ptAbsolute | Static positioning in pixels, starting from the top left corner of the viewport/widget. + |
| ptViewportRatio | Static positioning given by a fraction of the viewport size. For example, if you call setCoords(0, 0), the position will be at the top left corner of the viewport/widget. setCoords(1, 1) will be at the bottom right corner, setCoords(0.5, 0) will be horizontally centered and vertically at the top of the viewport/widget, etc. + |
| ptAxisRectRatio | Static positioning given by a fraction of the axis rect size (see setAxisRect). For example, if you call setCoords(0, 0), the position will be at the top left corner of the axis rect. setCoords(1, 1) will be at the bottom right corner, setCoords(0.5, 0) will be horizontally centered and vertically at the top of the axis rect, etc. You can also go beyond the axis rect by providing negative coordinates or coordinates larger than 1. + |
| ptPlotCoords | Dynamic positioning at a plot coordinate defined by two axes (see setAxes). + |
| QCPItemPosition::QCPItemPosition | +( | +QCustomPlot * | +parentPlot, | +
| + | + | QCPAbstractItem * | +parentItem, | +
| + | + | const QString & | +name | +
| + | ) | ++ |
Creates a new QCPItemPosition. You shouldn't create QCPItemPosition instances directly, even if you want to make a new item subclass. Use QCPAbstractItem::createPosition instead, as explained in the subclassing section of the QCPAbstractItem documentation.
+ +
+
|
+ +inline | +
+
|
+ +inline | +
Returns the current parent anchor.
+If different parent anchors were set for X and Y (setParentAnchorX, setParentAnchorY), this method returns the parent anchor of the Y coordinate. In that case rather use parentAnchorX() and parentAnchorY().
+
+
|
+ +virtual | +
Returns the final absolute pixel position of the QCPItemPosition on the QCustomPlot surface. It includes all effects of type (setType) and possible parent anchors (setParentAnchor).
+Reimplemented from QCPItemAnchor.
+ +| void QCPItemPosition::setType | +( | +QCPItemPosition::PositionType | +type | ) | ++ |
Sets the type of the position. The type defines how the coordinates passed to setCoords should be handled and how the QCPItemPosition should behave in the plot.
+The possible values for type can be separated in two main categories:
+Note that the position type ptPlotCoords is only available (and sensible) when the position has no parent anchor (setParentAnchor).
+If the type is changed, the apparent pixel position on the plot is preserved. This means the coordinates as retrieved with coords() and set with setCoords may change in the process.
+This method sets the type for both X and Y directions. It is also possible to set different types for X and Y, see setTypeX, setTypeY.
+ +| void QCPItemPosition::setTypeX | +( | +QCPItemPosition::PositionType | +type | ) | ++ |
| void QCPItemPosition::setTypeY | +( | +QCPItemPosition::PositionType | +type | ) | ++ |
| bool QCPItemPosition::setParentAnchor | +( | +QCPItemAnchor * | +parentAnchor, | +
| + | + | bool | +keepPixelPosition = false |
+
| + | ) | ++ |
Sets the parent of this QCPItemPosition to parentAnchor. This means the position will now follow any position changes of the anchor. The local coordinate system of positions with a parent anchor always is absolute pixels, with (0, 0) being exactly on top of the parent anchor. (Hence the type shouldn't be set to ptPlotCoords for positions with parent anchors.)
+if keepPixelPosition is true, the current pixel position of the QCPItemPosition is preserved during reparenting. If it's set to false, the coordinates are set to (0, 0), i.e. the position will be exactly on top of the parent anchor.
+To remove this QCPItemPosition from any parent anchor, set parentAnchor to 0.
+If the QCPItemPosition previously had no parent and the type is ptPlotCoords, the type is set to ptAbsolute, to keep the position in a valid state.
+This method sets the parent anchor for both X and Y directions. It is also possible to set different parents for X and Y, see setParentAnchorX, setParentAnchorY.
+ +| bool QCPItemPosition::setParentAnchorX | +( | +QCPItemAnchor * | +parentAnchor, | +
| + | + | bool | +keepPixelPosition = false |
+
| + | ) | ++ |
This method sets the parent anchor of the X coordinate to parentAnchor.
+For a detailed description of what a parent anchor is, see the documentation of setParentAnchor.
+| bool QCPItemPosition::setParentAnchorY | +( | +QCPItemAnchor * | +parentAnchor, | +
| + | + | bool | +keepPixelPosition = false |
+
| + | ) | ++ |
This method sets the parent anchor of the Y coordinate to parentAnchor.
+For a detailed description of what a parent anchor is, see the documentation of setParentAnchor.
+| void QCPItemPosition::setCoords | +( | +double | +key, | +
| + | + | double | +value | +
| + | ) | ++ |
Sets the coordinates of this QCPItemPosition. What the coordinates mean, is defined by the type (setType, setTypeX, setTypeY).
+For example, if the type is ptAbsolute, key and value mean the x and y pixel position on the QCustomPlot surface. In that case the origin (0, 0) is in the top left corner of the QCustomPlot viewport. If the type is ptPlotCoords, key and value mean a point in the plot coordinate system defined by the axes set by setAxes. By default those are the QCustomPlot's xAxis and yAxis. See the documentation of setType for other available coordinate types and their meaning.
+If different types were configured for X and Y (setTypeX, setTypeY), key and value must also be provided in the different coordinate systems. Here, the X type refers to key, and the Y type refers to value.
+| void QCPItemPosition::setCoords | +( | +const QPointF & | +pos | ) | ++ |
This is an overloaded function.
+Sets the coordinates as a QPointF pos where pos.x has the meaning of key and pos.y the meaning of value of the setCoords(double key, double value) method.
+ +| void QCPItemPosition::setAxes | +( | +QCPAxis * | +keyAxis, | +
| + | + | QCPAxis * | +valueAxis | +
| + | ) | ++ |
When setType is ptPlotCoords, this function may be used to specify the axes the coordinates set with setCoords relate to. By default they are set to the initial xAxis and yAxis of the QCustomPlot.
+ +| void QCPItemPosition::setAxisRect | +( | +QCPAxisRect * | +axisRect | ) | ++ |
When setType is ptAxisRectRatio, this function may be used to specify the axis rect the coordinates set with setCoords relate to. By default this is set to the main axis rect of the QCustomPlot.
+ +| void QCPItemPosition::setPixelPosition | +( | +const QPointF & | +pixelPosition | ) | ++ |
Sets the apparent pixel position. This works no matter what type (setType) this QCPItemPosition is or what parent-child situation it is in, as coordinates are transformed appropriately, to make the position finally appear at the specified pixel values.
+Only if the type is ptAbsolute and no parent anchor is set, this function's effect is identical to that of setCoords.
+
+
|
+ +inlineprotectedvirtual | +
Returns 0 if this instance is merely a QCPItemAnchor, and a valid pointer of type QCPItemPosition* if it actually is a QCPItemPosition (which is a subclass of QCPItemAnchor).
+This safe downcast functionality could also be achieved with a dynamic_cast. However, QCustomPlot avoids dynamic_cast to work with projects that don't have RTTI support enabled (e.g. -fno-rtti flag with gcc compiler).
+ +Reimplemented from QCPItemAnchor.
+ +A rectangle. + More...
+
+Public Functions | |
| QCPItemRect (QCustomPlot *parentPlot) | |
| +QPen | pen () const |
| +QPen | selectedPen () const |
| +QBrush | brush () const |
| +QBrush | selectedBrush () const |
| void | setPen (const QPen &pen) |
| void | setSelectedPen (const QPen &pen) |
| void | setBrush (const QBrush &brush) |
| void | setSelectedBrush (const QBrush &brush) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
Public Functions inherited from QCPAbstractItem | |
| QCPAbstractItem (QCustomPlot *parentPlot) | |
| +bool | clipToAxisRect () const |
| +QCPAxisRect * | clipAxisRect () const |
| +bool | selectable () const |
| +bool | selected () const |
| void | setClipToAxisRect (bool clip) |
| void | setClipAxisRect (QCPAxisRect *rect) |
| Q_SLOT void | setSelectable (bool selectable) |
| Q_SLOT void | setSelected (bool selected) |
| QList< QCPItemPosition * > | positions () const |
| QList< QCPItemAnchor * > | anchors () const |
| QCPItemPosition * | position (const QString &name) const |
| QCPItemAnchor * | anchor (const QString &name) const |
| bool | hasAnchor (const QString &name) const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Public Members | |
| +QCPItemPosition *const | topLeft |
| +QCPItemPosition *const | bottomRight |
| +QCPItemAnchor *const | top |
| +QCPItemAnchor *const | topRight |
| +QCPItemAnchor *const | right |
| +QCPItemAnchor *const | bottom |
| +QCPItemAnchor *const | bottomLeft |
| +QCPItemAnchor *const | left |
+Protected Types | |
| enum | AnchorIndex |
+Protected Functions | |
| virtual void | draw (QCPPainter *painter) |
| virtual QPointF | anchorPixelPosition (int anchorId) const |
| QPen | mainPen () const |
| QBrush | mainBrush () const |
Protected Functions inherited from QCPAbstractItem | |
| virtual QCP::Interaction | selectionCategory () const |
| virtual QRect | clipRect () const |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| double | rectDistance (const QRectF &rect, const QPointF &pos, bool filledRect) const |
| QCPItemPosition * | createPosition (const QString &name) |
| QCPItemAnchor * | createAnchor (const QString &name, int anchorId) |
Protected Functions inherited from QCPLayerable | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Additional Inherited Members | |
Signals inherited from QCPAbstractItem | |
| void | selectionChanged (bool selected) |
| +void | selectableChanged (bool selectable) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
A rectangle.
+
+It has two positions, topLeft and bottomRight, which define the rectangle.
+
+
|
+ +explicit | +
Creates a rectangle item and sets default values.
+The created item is automatically registered with parentPlot. This QCustomPlot instance takes ownership of the item, so do not delete it manually but use QCustomPlot::removeItem() instead.
+ +| void QCPItemRect::setPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen that will be used to draw the line of the rectangle
+| void QCPItemRect::setSelectedPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen that will be used to draw the line of the rectangle when selected
+| void QCPItemRect::setBrush | +( | +const QBrush & | +brush | ) | ++ |
Sets the brush that will be used to fill the rectangle. To disable filling, set brush to Qt::NoBrush.
+| void QCPItemRect::setSelectedBrush | +( | +const QBrush & | +brush | ) | ++ |
Sets the brush that will be used to fill the rectangle when selected. To disable filling, set brush to Qt::NoBrush.
+
+
|
+ +virtual | +
This function is used to decide whether a click hits a layerable object or not.
+pos is a point in pixel coordinates on the QCustomPlot surface. This function returns the shortest pixel distance of this point to the object. If the object is either invisible or the distance couldn't be determined, -1.0 is returned. Further, if onlySelectable is true and the object is not selectable, -1.0 is returned, too.
+If the object is represented not by single lines but by an area like a QCPItemText or the bars of a QCPBars plottable, a click inside the area should also be considered a hit. In these cases this function thus returns a constant value greater zero but still below the parent plot's selection tolerance. (typically the selectionTolerance multiplied by 0.99).
+Providing a constant value for area objects allows selecting line objects even when they are obscured by such area objects, by clicking close to the lines (i.e. closer than 0.99*selectionTolerance).
+The actual setting of the selection state is not done by this function. This is handled by the parent QCustomPlot when the mouseReleaseEvent occurs, and the finally selected object is notified via the selectEvent/deselectEvent methods.
+details is an optional output parameter. Every layerable subclass may place any information in details. This information will be passed to selectEvent when the parent QCustomPlot decides on the basis of this selectTest call, that the object was successfully selected. The subsequent call to selectEvent will carry the details. This is useful for multi-part objects (like QCPAxis). This way, a possibly complex calculation to decide which part was clicked is only done once in selectTest. The result (i.e. the actually clicked part) can then be placed in details. So in the subsequent selectEvent, the decision which part was selected doesn't have to be done a second time for a single selection operation.
+In the case of 1D Plottables (QCPAbstractPlottable1D, like QCPGraph or QCPBars) details will be set to a QCPDataSelection, describing the closest data point to pos.
+You may pass 0 as details to indicate that you are not interested in those selection details.
+Implements QCPAbstractItem.
+ +
+
|
+ +protectedvirtual | +
Draws this item with the provided painter.
+The cliprect of the provided painter is set to the rect returned by clipRect before this function is called. The clipRect depends on the clipping settings defined by setClipToAxisRect and setClipAxisRect.
+ +Implements QCPAbstractItem.
+ +
+
|
+ +protectedvirtual | +
Returns the pixel position of the anchor with Id anchorId. This function must be reimplemented in item subclasses if they want to provide anchors (QCPItemAnchor).
+For example, if the item has two anchors with id 0 and 1, this function takes one of these anchor ids and returns the respective pixel points of the specified anchor.
+Reimplemented from QCPAbstractItem.
+ +
+
|
+ +protected | +
Returns the pen that should be used for drawing lines. Returns mPen when the item is not selected and mSelectedPen when it is.
+ +
+
|
+ +protected | +
Returns the brush that should be used for drawing fills of the item. Returns mBrush when the item is not selected and mSelectedBrush when it is.
+ +A straight line that spans infinitely in both directions. + More...
+
+Public Functions | |
| QCPItemStraightLine (QCustomPlot *parentPlot) | |
| +QPen | pen () const |
| +QPen | selectedPen () const |
| void | setPen (const QPen &pen) |
| void | setSelectedPen (const QPen &pen) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
Public Functions inherited from QCPAbstractItem | |
| QCPAbstractItem (QCustomPlot *parentPlot) | |
| +bool | clipToAxisRect () const |
| +QCPAxisRect * | clipAxisRect () const |
| +bool | selectable () const |
| +bool | selected () const |
| void | setClipToAxisRect (bool clip) |
| void | setClipAxisRect (QCPAxisRect *rect) |
| Q_SLOT void | setSelectable (bool selectable) |
| Q_SLOT void | setSelected (bool selected) |
| QList< QCPItemPosition * > | positions () const |
| QList< QCPItemAnchor * > | anchors () const |
| QCPItemPosition * | position (const QString &name) const |
| QCPItemAnchor * | anchor (const QString &name) const |
| bool | hasAnchor (const QString &name) const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Public Members | |
| +QCPItemPosition *const | point1 |
| +QCPItemPosition *const | point2 |
+Protected Functions | |
| virtual void | draw (QCPPainter *painter) |
| QLineF | getRectClippedStraightLine (const QCPVector2D &point1, const QCPVector2D &vec, const QRect &rect) const |
| QPen | mainPen () const |
Protected Functions inherited from QCPAbstractItem | |
| virtual QCP::Interaction | selectionCategory () const |
| virtual QRect | clipRect () const |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| virtual QPointF | anchorPixelPosition (int anchorId) const |
| double | rectDistance (const QRectF &rect, const QPointF &pos, bool filledRect) const |
| QCPItemPosition * | createPosition (const QString &name) |
| QCPItemAnchor * | createAnchor (const QString &name, int anchorId) |
Protected Functions inherited from QCPLayerable | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Additional Inherited Members | |
Signals inherited from QCPAbstractItem | |
| void | selectionChanged (bool selected) |
| +void | selectableChanged (bool selectable) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
A straight line that spans infinitely in both directions.
+
+It has two positions, point1 and point2, which define the straight line.
+
+
|
+ +explicit | +
Creates a straight line item and sets default values.
+The created item is automatically registered with parentPlot. This QCustomPlot instance takes ownership of the item, so do not delete it manually but use QCustomPlot::removeItem() instead.
+ +| void QCPItemStraightLine::setPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen that will be used to draw the line
+| void QCPItemStraightLine::setSelectedPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen that will be used to draw the line when selected
+
+
|
+ +virtual | +
This function is used to decide whether a click hits a layerable object or not.
+pos is a point in pixel coordinates on the QCustomPlot surface. This function returns the shortest pixel distance of this point to the object. If the object is either invisible or the distance couldn't be determined, -1.0 is returned. Further, if onlySelectable is true and the object is not selectable, -1.0 is returned, too.
+If the object is represented not by single lines but by an area like a QCPItemText or the bars of a QCPBars plottable, a click inside the area should also be considered a hit. In these cases this function thus returns a constant value greater zero but still below the parent plot's selection tolerance. (typically the selectionTolerance multiplied by 0.99).
+Providing a constant value for area objects allows selecting line objects even when they are obscured by such area objects, by clicking close to the lines (i.e. closer than 0.99*selectionTolerance).
+The actual setting of the selection state is not done by this function. This is handled by the parent QCustomPlot when the mouseReleaseEvent occurs, and the finally selected object is notified via the selectEvent/deselectEvent methods.
+details is an optional output parameter. Every layerable subclass may place any information in details. This information will be passed to selectEvent when the parent QCustomPlot decides on the basis of this selectTest call, that the object was successfully selected. The subsequent call to selectEvent will carry the details. This is useful for multi-part objects (like QCPAxis). This way, a possibly complex calculation to decide which part was clicked is only done once in selectTest. The result (i.e. the actually clicked part) can then be placed in details. So in the subsequent selectEvent, the decision which part was selected doesn't have to be done a second time for a single selection operation.
+In the case of 1D Plottables (QCPAbstractPlottable1D, like QCPGraph or QCPBars) details will be set to a QCPDataSelection, describing the closest data point to pos.
+You may pass 0 as details to indicate that you are not interested in those selection details.
+Implements QCPAbstractItem.
+ +
+
|
+ +protectedvirtual | +
Draws this item with the provided painter.
+The cliprect of the provided painter is set to the rect returned by clipRect before this function is called. The clipRect depends on the clipping settings defined by setClipToAxisRect and setClipAxisRect.
+ +Implements QCPAbstractItem.
+ +
+
|
+ +protected | +
Returns the section of the straight line defined by base and direction vector vec, that is visible in the specified rect.
+This is a helper function for draw.
+ +
+
|
+ +protected | +
Returns the pen that should be used for drawing lines. Returns mPen when the item is not selected and mSelectedPen when it is.
+ +A text label. + More...
+
+Public Functions | |
| QCPItemText (QCustomPlot *parentPlot) | |
| +QColor | color () const |
| +QColor | selectedColor () const |
| +QPen | pen () const |
| +QPen | selectedPen () const |
| +QBrush | brush () const |
| +QBrush | selectedBrush () const |
| +QFont | font () const |
| +QFont | selectedFont () const |
| +QString | text () const |
| +Qt::Alignment | positionAlignment () const |
| +Qt::Alignment | textAlignment () const |
| +double | rotation () const |
| +QMargins | padding () const |
| void | setColor (const QColor &color) |
| void | setSelectedColor (const QColor &color) |
| void | setPen (const QPen &pen) |
| void | setSelectedPen (const QPen &pen) |
| void | setBrush (const QBrush &brush) |
| void | setSelectedBrush (const QBrush &brush) |
| void | setFont (const QFont &font) |
| void | setSelectedFont (const QFont &font) |
| void | setText (const QString &text) |
| void | setPositionAlignment (Qt::Alignment alignment) |
| void | setTextAlignment (Qt::Alignment alignment) |
| void | setRotation (double degrees) |
| void | setPadding (const QMargins &padding) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
Public Functions inherited from QCPAbstractItem | |
| QCPAbstractItem (QCustomPlot *parentPlot) | |
| +bool | clipToAxisRect () const |
| +QCPAxisRect * | clipAxisRect () const |
| +bool | selectable () const |
| +bool | selected () const |
| void | setClipToAxisRect (bool clip) |
| void | setClipAxisRect (QCPAxisRect *rect) |
| Q_SLOT void | setSelectable (bool selectable) |
| Q_SLOT void | setSelected (bool selected) |
| QList< QCPItemPosition * > | positions () const |
| QList< QCPItemAnchor * > | anchors () const |
| QCPItemPosition * | position (const QString &name) const |
| QCPItemAnchor * | anchor (const QString &name) const |
| bool | hasAnchor (const QString &name) const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Public Members | |
| +QCPItemPosition *const | position |
| +QCPItemAnchor *const | topLeft |
| +QCPItemAnchor *const | top |
| +QCPItemAnchor *const | topRight |
| +QCPItemAnchor *const | right |
| +QCPItemAnchor *const | bottomRight |
| +QCPItemAnchor *const | bottom |
| +QCPItemAnchor *const | bottomLeft |
| +QCPItemAnchor *const | left |
+Protected Types | |
| enum | AnchorIndex |
+Protected Functions | |
| virtual void | draw (QCPPainter *painter) |
| virtual QPointF | anchorPixelPosition (int anchorId) const |
| QPointF | getTextDrawPoint (const QPointF &pos, const QRectF &rect, Qt::Alignment positionAlignment) const |
| QFont | mainFont () const |
| QColor | mainColor () const |
| QPen | mainPen () const |
| QBrush | mainBrush () const |
Protected Functions inherited from QCPAbstractItem | |
| virtual QCP::Interaction | selectionCategory () const |
| virtual QRect | clipRect () const |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| double | rectDistance (const QRectF &rect, const QPointF &pos, bool filledRect) const |
| QCPItemPosition * | createPosition (const QString &name) |
| QCPItemAnchor * | createAnchor (const QString &name, int anchorId) |
Protected Functions inherited from QCPLayerable | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Additional Inherited Members | |
Signals inherited from QCPAbstractItem | |
| void | selectionChanged (bool selected) |
| +void | selectableChanged (bool selectable) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
A text label.
+
+Its position is defined by the member position and the setting of setPositionAlignment. The latter controls which part of the text rect shall be aligned with position.
+The text alignment itself (i.e. left, center, right) can be controlled with setTextAlignment.
+The text may be rotated around the position point with setRotation.
+
+
|
+ +explicit | +
Creates a text item and sets default values.
+The created item is automatically registered with parentPlot. This QCustomPlot instance takes ownership of the item, so do not delete it manually but use QCustomPlot::removeItem() instead.
+ +| void QCPItemText::setColor | +( | +const QColor & | +color | ) | ++ |
Sets the color of the text.
+ +| void QCPItemText::setSelectedColor | +( | +const QColor & | +color | ) | ++ |
Sets the color of the text that will be used when the item is selected.
+ +| void QCPItemText::setPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen that will be used do draw a rectangular border around the text. To disable the border, set pen to Qt::NoPen.
+| void QCPItemText::setSelectedPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen that will be used do draw a rectangular border around the text, when the item is selected. To disable the border, set pen to Qt::NoPen.
+| void QCPItemText::setBrush | +( | +const QBrush & | +brush | ) | ++ |
Sets the brush that will be used do fill the background of the text. To disable the background, set brush to Qt::NoBrush.
+| void QCPItemText::setSelectedBrush | +( | +const QBrush & | +brush | ) | ++ |
Sets the brush that will be used do fill the background of the text, when the item is selected. To disable the background, set brush to Qt::NoBrush.
+| void QCPItemText::setFont | +( | +const QFont & | +font | ) | ++ |
Sets the font of the text.
+| void QCPItemText::setSelectedFont | +( | +const QFont & | +font | ) | ++ |
Sets the font of the text that will be used when the item is selected.
+| void QCPItemText::setText | +( | +const QString & | +text | ) | ++ |
Sets the text that will be displayed. Multi-line texts are supported by inserting a line break character, e.g. '
+'.
| void QCPItemText::setPositionAlignment | +( | +Qt::Alignment | +alignment | ) | ++ |
Sets which point of the text rect shall be aligned with position.
+Examples:
Qt::AlignHCenter | Qt::AlignTop, the text will be positioned such that the top of the text rect will be horizontally centered on position. Qt::AlignLeft | Qt::AlignBottom, position will indicate the bottom left corner of the text rect.If you want to control the alignment of (multi-lined) text within the text rect, use setTextAlignment.
+ +| void QCPItemText::setTextAlignment | +( | +Qt::Alignment | +alignment | ) | ++ |
Controls how (multi-lined) text is aligned inside the text rect (typically Qt::AlignLeft, Qt::AlignCenter or Qt::AlignRight).
+ +| void QCPItemText::setRotation | +( | +double | +degrees | ) | ++ |
Sets the angle in degrees by which the text (and the text rectangle, if visible) will be rotated around position.
+ +| void QCPItemText::setPadding | +( | +const QMargins & | +padding | ) | ++ |
+
|
+ +virtual | +
This function is used to decide whether a click hits a layerable object or not.
+pos is a point in pixel coordinates on the QCustomPlot surface. This function returns the shortest pixel distance of this point to the object. If the object is either invisible or the distance couldn't be determined, -1.0 is returned. Further, if onlySelectable is true and the object is not selectable, -1.0 is returned, too.
+If the object is represented not by single lines but by an area like a QCPItemText or the bars of a QCPBars plottable, a click inside the area should also be considered a hit. In these cases this function thus returns a constant value greater zero but still below the parent plot's selection tolerance. (typically the selectionTolerance multiplied by 0.99).
+Providing a constant value for area objects allows selecting line objects even when they are obscured by such area objects, by clicking close to the lines (i.e. closer than 0.99*selectionTolerance).
+The actual setting of the selection state is not done by this function. This is handled by the parent QCustomPlot when the mouseReleaseEvent occurs, and the finally selected object is notified via the selectEvent/deselectEvent methods.
+details is an optional output parameter. Every layerable subclass may place any information in details. This information will be passed to selectEvent when the parent QCustomPlot decides on the basis of this selectTest call, that the object was successfully selected. The subsequent call to selectEvent will carry the details. This is useful for multi-part objects (like QCPAxis). This way, a possibly complex calculation to decide which part was clicked is only done once in selectTest. The result (i.e. the actually clicked part) can then be placed in details. So in the subsequent selectEvent, the decision which part was selected doesn't have to be done a second time for a single selection operation.
+In the case of 1D Plottables (QCPAbstractPlottable1D, like QCPGraph or QCPBars) details will be set to a QCPDataSelection, describing the closest data point to pos.
+You may pass 0 as details to indicate that you are not interested in those selection details.
+Implements QCPAbstractItem.
+ +
+
|
+ +protectedvirtual | +
Draws this item with the provided painter.
+The cliprect of the provided painter is set to the rect returned by clipRect before this function is called. The clipRect depends on the clipping settings defined by setClipToAxisRect and setClipAxisRect.
+ +Implements QCPAbstractItem.
+ +
+
|
+ +protectedvirtual | +
Returns the pixel position of the anchor with Id anchorId. This function must be reimplemented in item subclasses if they want to provide anchors (QCPItemAnchor).
+For example, if the item has two anchors with id 0 and 1, this function takes one of these anchor ids and returns the respective pixel points of the specified anchor.
+Reimplemented from QCPAbstractItem.
+ +
+
|
+ +protected | +
Returns the point that must be given to the QPainter::drawText function (which expects the top left point of the text rect), according to the position pos, the text bounding box rect and the requested positionAlignment.
+For example, if positionAlignment is Qt::AlignLeft | Qt::AlignBottom the returned point will be shifted upward by the height of rect, starting from pos. So if the text is finally drawn at that point, the lower left corner of the resulting text rect is at pos.
+
|
+ +protected | +
Returns the font that should be used for drawing text. Returns mFont when the item is not selected and mSelectedFont when it is.
+ +
+
|
+ +protected | +
Returns the color that should be used for drawing text. Returns mColor when the item is not selected and mSelectedColor when it is.
+ +
+
|
+ +protected | +
Returns the pen that should be used for drawing lines. Returns mPen when the item is not selected and mSelectedPen when it is.
+ +
+
|
+ +protected | +
Returns the brush that should be used for drawing fills of the item. Returns mBrush when the item is not selected and mSelectedBrush when it is.
+ +Item that sticks to QCPGraph data points. + More...
+
+Public Types | |
| enum | TracerStyle |
+Public Functions | |
| QCPItemTracer (QCustomPlot *parentPlot) | |
| +QPen | pen () const |
| +QPen | selectedPen () const |
| +QBrush | brush () const |
| +QBrush | selectedBrush () const |
| +double | size () const |
| +TracerStyle | style () const |
| +QCPGraph * | graph () const |
| +double | graphKey () const |
| +bool | interpolating () const |
| void | setPen (const QPen &pen) |
| void | setSelectedPen (const QPen &pen) |
| void | setBrush (const QBrush &brush) |
| void | setSelectedBrush (const QBrush &brush) |
| void | setSize (double size) |
| void | setStyle (TracerStyle style) |
| void | setGraph (QCPGraph *graph) |
| void | setGraphKey (double key) |
| void | setInterpolating (bool enabled) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
| void | updatePosition () |
Public Functions inherited from QCPAbstractItem | |
| QCPAbstractItem (QCustomPlot *parentPlot) | |
| +bool | clipToAxisRect () const |
| +QCPAxisRect * | clipAxisRect () const |
| +bool | selectable () const |
| +bool | selected () const |
| void | setClipToAxisRect (bool clip) |
| void | setClipAxisRect (QCPAxisRect *rect) |
| Q_SLOT void | setSelectable (bool selectable) |
| Q_SLOT void | setSelected (bool selected) |
| QList< QCPItemPosition * > | positions () const |
| QList< QCPItemAnchor * > | anchors () const |
| QCPItemPosition * | position (const QString &name) const |
| QCPItemAnchor * | anchor (const QString &name) const |
| bool | hasAnchor (const QString &name) const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Public Members | |
| +QCPItemPosition *const | position |
+Protected Functions | |
| virtual void | draw (QCPPainter *painter) |
| QPen | mainPen () const |
| QBrush | mainBrush () const |
Protected Functions inherited from QCPAbstractItem | |
| virtual QCP::Interaction | selectionCategory () const |
| virtual QRect | clipRect () const |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| virtual QPointF | anchorPixelPosition (int anchorId) const |
| double | rectDistance (const QRectF &rect, const QPointF &pos, bool filledRect) const |
| QCPItemPosition * | createPosition (const QString &name) |
| QCPItemAnchor * | createAnchor (const QString &name, int anchorId) |
Protected Functions inherited from QCPLayerable | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Additional Inherited Members | |
Signals inherited from QCPAbstractItem | |
| void | selectionChanged (bool selected) |
| +void | selectableChanged (bool selectable) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
Item that sticks to QCPGraph data points.
+
+The tracer can be connected with a QCPGraph via setGraph. Then it will automatically adopt the coordinate axes of the graph and update its position to be on the graph's data. This means the key stays controllable via setGraphKey, but the value will follow the graph data. If a QCPGraph is connected, note that setting the coordinates of the tracer item directly via position will have no effect because they will be overriden in the next redraw (this is when the coordinate update happens).
+If the specified key in setGraphKey is outside the key bounds of the graph, the tracer will stay at the corresponding end of the graph.
+With setInterpolating you may specify whether the tracer may only stay exactly on data points or whether it interpolates data points linearly, if given a key that lies between two data points of the graph.
+The tracer has different visual styles, see setStyle. It is also possible to make the tracer have no own visual appearance (set the style to tsNone), and just connect other item positions to the tracer position (used as an anchor) via QCPItemPosition::setParentAnchor.
+| enum QCPItemTracer::TracerStyle | +
The different visual appearances a tracer item can have. Some styles size may be controlled with setSize.
+
+
|
+ +explicit | +
Creates a tracer item and sets default values.
+The created item is automatically registered with parentPlot. This QCustomPlot instance takes ownership of the item, so do not delete it manually but use QCustomPlot::removeItem() instead.
+ +| void QCPItemTracer::setPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen that will be used to draw the line of the tracer
+| void QCPItemTracer::setSelectedPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen that will be used to draw the line of the tracer when selected
+| void QCPItemTracer::setBrush | +( | +const QBrush & | +brush | ) | ++ |
Sets the brush that will be used to draw any fills of the tracer
+| void QCPItemTracer::setSelectedBrush | +( | +const QBrush & | +brush | ) | ++ |
Sets the brush that will be used to draw any fills of the tracer, when selected.
+| void QCPItemTracer::setSize | +( | +double | +size | ) | ++ |
Sets the size of the tracer in pixels, if the style supports setting a size (e.g. tsSquare does, tsCrosshair does not).
+ +| void QCPItemTracer::setStyle | +( | +QCPItemTracer::TracerStyle | +style | ) | ++ |
Sets the style/visual appearance of the tracer.
+If you only want to use the tracer position as an anchor for other items, set style to tsNone.
+ +| void QCPItemTracer::setGraph | +( | +QCPGraph * | +graph | ) | ++ |
Sets the QCPGraph this tracer sticks to. The tracer position will be set to type QCPItemPosition::ptPlotCoords and the axes will be set to the axes of graph.
+To free the tracer from any graph, set graph to 0. The tracer position can then be placed freely like any other item position. This is the state the tracer will assume when its graph gets deleted while still attached to it.
+| void QCPItemTracer::setGraphKey | +( | +double | +key | ) | ++ |
Sets the key of the graph's data point the tracer will be positioned at. This is the only free coordinate of a tracer when attached to a graph.
+Depending on setInterpolating, the tracer will be either positioned on the data point closest to key, or will stay exactly at key and interpolate the value linearly.
+| void QCPItemTracer::setInterpolating | +( | +bool | +enabled | ) | ++ |
Sets whether the value of the graph's data points shall be interpolated, when positioning the tracer.
+If enabled is set to false and a key is given with setGraphKey, the tracer is placed on the data point of the graph which is closest to the key, but which is not necessarily exactly there. If enabled is true, the tracer will be positioned exactly at the specified key, and the appropriate value will be interpolated from the graph's data points linearly.
+
+
|
+ +virtual | +
This function is used to decide whether a click hits a layerable object or not.
+pos is a point in pixel coordinates on the QCustomPlot surface. This function returns the shortest pixel distance of this point to the object. If the object is either invisible or the distance couldn't be determined, -1.0 is returned. Further, if onlySelectable is true and the object is not selectable, -1.0 is returned, too.
+If the object is represented not by single lines but by an area like a QCPItemText or the bars of a QCPBars plottable, a click inside the area should also be considered a hit. In these cases this function thus returns a constant value greater zero but still below the parent plot's selection tolerance. (typically the selectionTolerance multiplied by 0.99).
+Providing a constant value for area objects allows selecting line objects even when they are obscured by such area objects, by clicking close to the lines (i.e. closer than 0.99*selectionTolerance).
+The actual setting of the selection state is not done by this function. This is handled by the parent QCustomPlot when the mouseReleaseEvent occurs, and the finally selected object is notified via the selectEvent/deselectEvent methods.
+details is an optional output parameter. Every layerable subclass may place any information in details. This information will be passed to selectEvent when the parent QCustomPlot decides on the basis of this selectTest call, that the object was successfully selected. The subsequent call to selectEvent will carry the details. This is useful for multi-part objects (like QCPAxis). This way, a possibly complex calculation to decide which part was clicked is only done once in selectTest. The result (i.e. the actually clicked part) can then be placed in details. So in the subsequent selectEvent, the decision which part was selected doesn't have to be done a second time for a single selection operation.
+In the case of 1D Plottables (QCPAbstractPlottable1D, like QCPGraph or QCPBars) details will be set to a QCPDataSelection, describing the closest data point to pos.
+You may pass 0 as details to indicate that you are not interested in those selection details.
+Implements QCPAbstractItem.
+ +| void QCPItemTracer::updatePosition | +( | +) | ++ |
If the tracer is connected with a graph (setGraph), this function updates the tracer's position to reside on the graph data, depending on the configured key (setGraphKey).
+It is called automatically on every redraw and normally doesn't need to be called manually. One exception is when you want to read the tracer coordinates via position and are not sure that the graph's data (or the tracer key with setGraphKey) hasn't changed since the last redraw. In that situation, call this function before accessing position, to make sure you don't get out-of-date coordinates.
+If there is no graph set on this tracer, this function does nothing.
+ +
+
|
+ +protectedvirtual | +
Draws this item with the provided painter.
+The cliprect of the provided painter is set to the rect returned by clipRect before this function is called. The clipRect depends on the clipping settings defined by setClipToAxisRect and setClipAxisRect.
+ +Implements QCPAbstractItem.
+ +
+
|
+ +protected | +
Returns the pen that should be used for drawing lines. Returns mPen when the item is not selected and mSelectedPen when it is.
+ +
+
|
+ +protected | +
Returns the brush that should be used for drawing fills of the item. Returns mBrush when the item is not selected and mSelectedBrush when it is.
+ +A layer that may contain objects, to control the rendering order. + More...
+ +Inherits QObject.
++Public Types | |
| enum | LayerMode |
+Public Functions | |
| QCPLayer (QCustomPlot *parentPlot, const QString &layerName) | |
| +QCustomPlot * | parentPlot () const |
| +QString | name () const |
| int | index () const |
| QList< QCPLayerable * > | children () const |
| +bool | visible () const |
| +LayerMode | mode () const |
| void | setVisible (bool visible) |
| void | setMode (LayerMode mode) |
| void | replot () |
+Protected Functions | |
| void | draw (QCPPainter *painter) |
| void | drawToPaintBuffer () |
| void | addChild (QCPLayerable *layerable, bool prepend) |
| void | removeChild (QCPLayerable *layerable) |
A layer that may contain objects, to control the rendering order.
+The Layering system of QCustomPlot is the mechanism to control the rendering order of the elements inside the plot.
+It is based on the two classes QCPLayer and QCPLayerable. QCustomPlot holds an ordered list of one or more instances of QCPLayer (see QCustomPlot::addLayer, QCustomPlot::layer, QCustomPlot::moveLayer, etc.). When replotting, QCustomPlot goes through the list of layers bottom to top and successively draws the layerables of the layers into the paint buffer(s).
+A QCPLayer contains an ordered list of QCPLayerable instances. QCPLayerable is an abstract base class from which almost all visible objects derive, like axes, grids, graphs, items, etc.
+Initially, QCustomPlot has six layers: "background", "grid", "main", "axes", "legend" and "overlay" (in that order). On top is the "overlay" layer, which only contains the QCustomPlot's selection rect (QCustomPlot::selectionRect). The next two layers "axes" and "legend" contain the default axes and legend, so they will be drawn above plottables. In the middle, there is the "main" layer. It is initially empty and set as the current layer (see QCustomPlot::setCurrentLayer). This means, all new plottables, items etc. are created on this layer by default. Then comes the "grid" layer which contains the QCPGrid instances (which belong tightly to QCPAxis, see QCPAxis::grid). The Axis rect background shall be drawn behind everything else, thus the default QCPAxisRect instance is placed on the "background" layer. Of course, the layer affiliation of the individual objects can be changed as required (QCPLayerable::setLayer).
+Controlling the ordering of layerables in the plot is easy: Create a new layer in the position you want the layerable to be in, e.g. above "main", with QCustomPlot::addLayer. Then set the current layer with QCustomPlot::setCurrentLayer to that new layer and finally create the objects normally. They will be placed on the new layer automatically, due to the current layer setting. Alternatively you could have also ignored the current layer setting and just moved the objects with QCPLayerable::setLayer to the desired layer after creating them.
+It is also possible to move whole layers. For example, If you want the grid to be shown in front of all plottables/items on the "main" layer, just move it above "main" with QCustomPlot::moveLayer.
+The rendering order within one layer is simply by order of creation or insertion. The item created last (or added last to the layer), is drawn on top of all other objects on that layer.
+When a layer is deleted, the objects on it are not deleted with it, but fall on the layer below the deleted layer, see QCustomPlot::removeLayer.
+If the layer mode (setMode) is set to lmBuffered, you can replot only this specific layer by calling replot. In certain situations this can provide better replot performance, compared with a full replot of all layers. Upon creation of a new layer, the layer mode is initialized to lmLogical. The only layer that is set to lmBuffered in a new QCustomPlot instance is the "overlay" layer, containing the selection rect.
+| enum QCPLayer::LayerMode | +
Defines the different rendering modes of a layer. Depending on the mode, certain layers can be replotted individually, without the need to replot (possibly complex) layerables on other layers.
+| Enumerator | |
|---|---|
| lmLogical | Layer is used only for rendering order, and shares paint buffer with all other adjacent logical layers. + |
| lmBuffered | Layer has its own paint buffer and may be replotted individually (see replot). + |
| QCPLayer::QCPLayer | +( | +QCustomPlot * | +parentPlot, | +
| + | + | const QString & | +layerName | +
| + | ) | ++ |
Creates a new QCPLayer instance.
+Normally you shouldn't directly instantiate layers, use QCustomPlot::addLayer instead.
+
+
|
+ +inline | +
Returns the index this layer has in the QCustomPlot. The index is the integer number by which this layer can be accessed via QCustomPlot::layer.
+Layers with higher indices will be drawn above layers with lower indices.
+ +
+
|
+ +inline | +
Returns a list of all layerables on this layer. The order corresponds to the rendering order: layerables with higher indices are drawn above layerables with lower indices.
+ +| void QCPLayer::setVisible | +( | +bool | +visible | ) | ++ |
Sets whether this layer is visible or not. If visible is set to false, all layerables on this layer will be invisible.
+This function doesn't change the visibility property of the layerables (QCPLayerable::setVisible), but the QCPLayerable::realVisibility of each layerable takes the visibility of the parent layer into account.
+ +| void QCPLayer::setMode | +( | +QCPLayer::LayerMode | +mode | ) | ++ |
Sets the rendering mode of this layer.
+If mode is set to lmBuffered for a layer, it will be given a dedicated paint buffer by the parent QCustomPlot instance. This means it may be replotted individually by calling QCPLayer::replot, without needing to replot all other layers.
+Layers which are set to lmLogical (the default) are used only to define the rendering order and can't be replotted individually.
+Note that each layer which is set to lmBuffered requires additional paint buffers for the layers below, above and for the layer itself. This increases the memory consumption and (slightly) decreases the repainting speed because multiple paint buffers need to be joined. So you should carefully choose which layers benefit from having their own paint buffer. A typical example would be a layer which contains certain layerables (e.g. items) that need to be changed and thus replotted regularly, while all other layerables on other layers stay static. By default, only the topmost layer called "overlay" is in mode lmBuffered, and contains the selection rect.
+| void QCPLayer::replot | +( | +) | ++ |
If the layer mode (setMode) is set to lmBuffered, this method allows replotting only the layerables on this specific layer, without the need to replot all other layers (as a call to QCustomPlot::replot would do).
+If the layer mode is lmLogical however, this method simply calls QCustomPlot::replot on the parent QCustomPlot instance.
+QCustomPlot also makes sure to replot all layers instead of only this one, if the layer ordering has changed since the last full replot and the other paint buffers were thus invalidated.
+
+
|
+ +protected | +
Draws the contents of this layer with the provided painter.
+
+
|
+ +protected | +
Draws the contents of this layer into the paint buffer which is associated with this layer. The association is established by the parent QCustomPlot, which manages all paint buffers (see QCustomPlot::setupPaintBuffers).
+
+
|
+ +protected | +
Adds the layerable to the list of this layer. If prepend is set to true, the layerable will be prepended to the list, i.e. be drawn beneath the other layerables already in the list.
+This function does not change the mLayer member of layerable to this layer. (Use QCPLayerable::setLayer to change the layer of an object, not this function.)
+
+
|
+ +protected | +
Removes the layerable from the list of this layer.
+This function does not change the mLayer member of layerable. (Use QCPLayerable::setLayer to change the layer of an object, not this function.)
+Base class for all drawable objects. + More...
+
+Public Functions | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
| bool | realVisibility () const |
+Signals | |
| void | layerChanged (QCPLayer *newLayer) |
+Protected Functions | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual QCP::Interaction | selectionCategory () const |
| virtual QRect | clipRect () const |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const =0 |
| virtual void | draw (QCPPainter *painter)=0 |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
Base class for all drawable objects.
+This is the abstract base class most visible objects derive from, e.g. plottables, axes, grid etc.
+Every layerable is on a layer (QCPLayer) which allows controlling the rendering order by stacking the layers accordingly.
+For details about the layering mechanism, see the QCPLayer documentation.
+| QCPLayerable::QCPLayerable | +( | +QCustomPlot * | +plot, | +
| + | + | QString | +targetLayer = QString(), |
+
| + | + | QCPLayerable * | +parentLayerable = 0 |
+
| + | ) | ++ |
Creates a new QCPLayerable instance.
+Since QCPLayerable is an abstract base class, it can't be instantiated directly. Use one of the derived classes.
+If plot is provided, it automatically places itself on the layer named targetLayer. If targetLayer is an empty string, it places itself on the current layer of the plot (see QCustomPlot::setCurrentLayer).
+It is possible to provide 0 as plot. In that case, you should assign a parent plot at a later time with initializeParentPlot.
+The layerable's parent layerable is set to parentLayerable, if provided. Direct layerable parents are mainly used to control visibility in a hierarchy of layerables. This means a layerable is only drawn, if all its ancestor layerables are also visible. Note that parentLayerable does not become the QObject-parent (for memory management) of this layerable, plot does. It is not uncommon to set the QObject-parent to something else in the constructors of QCPLayerable subclasses, to guarantee a working destruction hierarchy.
+ +
+
|
+ +inline | +
Returns the parent layerable of this layerable. The parent layerable is used to provide visibility hierarchies in conjunction with the method realVisibility. This way, layerables only get drawn if their parent layerables are visible, too.
+Note that a parent layerable is not necessarily also the QObject parent for memory management. Further, a layerable doesn't always have a parent layerable, so this function may return 0.
+A parent layerable is set implicitly when placed inside layout elements and doesn't need to be set manually by the user.
+ +| void QCPLayerable::setVisible | +( | +bool | +on | ) | ++ |
Sets the visibility of this layerable object. If an object is not visible, it will not be drawn on the QCustomPlot surface, and user interaction with it (e.g. click and selection) is not possible.
+ +| bool QCPLayerable::setLayer | +( | +QCPLayer * | +layer | ) | ++ |
Sets the layer of this layerable object. The object will be placed on top of the other objects already on layer.
+If layer is 0, this layerable will not be on any layer and thus not appear in the plot (or interact/receive events).
+Returns true if the layer of this layerable was successfully changed to layer.
+ +| bool QCPLayerable::setLayer | +( | +const QString & | +layerName | ) | ++ |
This is an overloaded function. Sets the layer of this layerable object by name
+Returns true on success, i.e. if layerName is a valid layer name.
+ +| void QCPLayerable::setAntialiased | +( | +bool | +enabled | ) | ++ |
Sets whether this object will be drawn antialiased or not.
+Note that antialiasing settings may be overridden by QCustomPlot::setAntialiasedElements and QCustomPlot::setNotAntialiasedElements.
+ +
+
|
+ +virtual | +
This function is used to decide whether a click hits a layerable object or not.
+pos is a point in pixel coordinates on the QCustomPlot surface. This function returns the shortest pixel distance of this point to the object. If the object is either invisible or the distance couldn't be determined, -1.0 is returned. Further, if onlySelectable is true and the object is not selectable, -1.0 is returned, too.
+If the object is represented not by single lines but by an area like a QCPItemText or the bars of a QCPBars plottable, a click inside the area should also be considered a hit. In these cases this function thus returns a constant value greater zero but still below the parent plot's selection tolerance. (typically the selectionTolerance multiplied by 0.99).
+Providing a constant value for area objects allows selecting line objects even when they are obscured by such area objects, by clicking close to the lines (i.e. closer than 0.99*selectionTolerance).
+The actual setting of the selection state is not done by this function. This is handled by the parent QCustomPlot when the mouseReleaseEvent occurs, and the finally selected object is notified via the selectEvent/deselectEvent methods.
+details is an optional output parameter. Every layerable subclass may place any information in details. This information will be passed to selectEvent when the parent QCustomPlot decides on the basis of this selectTest call, that the object was successfully selected. The subsequent call to selectEvent will carry the details. This is useful for multi-part objects (like QCPAxis). This way, a possibly complex calculation to decide which part was clicked is only done once in selectTest. The result (i.e. the actually clicked part) can then be placed in details. So in the subsequent selectEvent, the decision which part was selected doesn't have to be done a second time for a single selection operation.
+In the case of 1D Plottables (QCPAbstractPlottable1D, like QCPGraph or QCPBars) details will be set to a QCPDataSelection, describing the closest data point to pos.
+You may pass 0 as details to indicate that you are not interested in those selection details.
+Reimplemented in QCPLayoutInset, QCPAxis, QCPLegend, QCPBars, QCPAbstractItem, QCPLayoutElement, QCPFinancial, QCPAbstractPlottable, QCPColorMap, QCPErrorBars, QCPGraph, QCPStatisticalBox, QCPCurve, QCPItemTracer, QCPItemText, QCPTextElement, QCPItemBracket, QCPAbstractPlottable1D< DataType >, QCPAbstractPlottable1D< QCPFinancialData >, QCPAbstractPlottable1D< QCPStatisticalBoxData >, QCPAbstractPlottable1D< QCPGraphData >, QCPAbstractPlottable1D< QCPBarsData >, QCPAbstractPlottable1D< QCPCurveData >, QCPAbstractLegendItem, QCPItemPixmap, QCPItemCurve, QCPItemLine, QCPItemEllipse, QCPItemRect, and QCPItemStraightLine.
+ +| bool QCPLayerable::realVisibility | +( | +) | +const | +
Returns whether this layerable is visible, taking the visibility of the layerable parent and the visibility of this layerable's layer into account. This is the method that is consulted to decide whether a layerable shall be drawn or not.
+If this layerable has a direct layerable parent (usually set via hierarchies implemented in subclasses, like in the case of QCPLayoutElement), this function returns true only if this layerable has its visibility set to true and the parent layerable's realVisibility returns true.
+ +
+
|
+ +signal | +
This signal is emitted when the layer of this layerable changes, i.e. this layerable is moved to a different layer.
+
+
|
+ +protectedvirtual | +
This function is called by initializeParentPlot, to allow subclasses to react on the setting of a parent plot. This is the case when 0 was passed as parent plot in the constructor, and the parent plot is set at a later time.
+For example, QCPLayoutElement/QCPLayout hierarchies may be created independently of any QCustomPlot at first. When they are then added to a layout inside the QCustomPlot, the top level element of the hierarchy gets its parent plot initialized with initializeParentPlot. To propagate the parent plot to all the children of the hierarchy, the top level element then uses this function to pass the parent plot on to its child elements.
+The default implementation does nothing.
+Reimplemented in QCPLegend, and QCPLayoutElement.
+ +
+
|
+ +protectedvirtual | +
Returns the selection category this layerable shall belong to. The selection category is used in conjunction with QCustomPlot::setInteractions to control which objects are selectable and which aren't.
+Subclasses that don't fit any of the normal QCP::Interaction values can use QCP::iSelectOther. This is what the default implementation returns.
+Reimplemented in QCPAxis, QCPLegend, QCPAbstractItem, QCPAbstractPlottable, and QCPAbstractLegendItem.
+ +
+
|
+ +protectedvirtual | +
Returns the clipping rectangle of this layerable object. By default, this is the viewport of the parent QCustomPlot. Specific subclasses may reimplement this function to provide different clipping rects.
+The returned clipping rect is set on the painter before the draw function of the respective object is called.
+ +Reimplemented in QCPAbstractItem, QCPAbstractPlottable, and QCPAbstractLegendItem.
+ +
+
|
+ +protectedpure virtual | +
This function applies the default antialiasing setting to the specified painter, using the function applyAntialiasingHint. It is the antialiasing state the painter is put in, when draw is called on the layerable. If the layerable has multiple entities whose antialiasing setting may be specified individually, this function should set the antialiasing state of the most prominent entity. In this case however, the draw function usually calls the specialized versions of this function before drawing each entity, effectively overriding the setting of the default antialiasing hint.
+First example: QCPGraph has multiple entities that have an antialiasing setting: The graph line, fills and scatters. Those can be configured via QCPGraph::setAntialiased, QCPGraph::setAntialiasedFill and QCPGraph::setAntialiasedScatters. Consequently, there isn't only the QCPGraph::applyDefaultAntialiasingHint function (which corresponds to the graph line's antialiasing), but specialized ones like QCPGraph::applyFillAntialiasingHint and QCPGraph::applyScattersAntialiasingHint. So before drawing one of those entities, QCPGraph::draw calls the respective specialized applyAntialiasingHint function.
+Second example: QCPItemLine consists only of a line so there is only one antialiasing setting which can be controlled with QCPItemLine::setAntialiased. (This function is inherited by all layerables. The specialized functions, as seen on QCPGraph, must be added explicitly to the respective layerable subclass.) Consequently it only has the normal QCPItemLine::applyDefaultAntialiasingHint. The QCPItemLine::draw function doesn't need to care about setting any antialiasing states, because the default antialiasing hint is already set on the painter when the draw function is called, and that's the state it wants to draw the line with.
+ +Implemented in QCPAxis, QCPLegend, QCPAbstractItem, QCPAbstractPlottable, QCPLayoutElement, QCPAxisRect, QCPColorScale, QCPTextElement, QCPAbstractLegendItem, QCPGrid, and QCPSelectionRect.
+ +
+
|
+ +protectedpure virtual | +
This function draws the layerable with the specified painter. It is only called by QCustomPlot, if the layerable is visible (setVisible).
+Before this function is called, the painter's antialiasing state is set via applyDefaultAntialiasingHint, see the documentation there. Further, the clipping rectangle was set to clipRect.
+ +Implemented in QCPAxis, QCPLegend, QCPBars, QCPAbstractItem, QCPAbstractPlottable, QCPColorMap, QCPLayoutElement, QCPFinancial, QCPAxisRect, QCPErrorBars, QCPGraph, QCPStatisticalBox, QCPCurve, QCPPlottableLegendItem, QCPItemText, QCPItemTracer, QCPTextElement, QCPAbstractLegendItem, QCPItemPixmap, QCPItemBracket, QCPGrid, QCPItemEllipse, QCPItemRect, QCPSelectionRect, QCPItemCurve, QCPItemLine, and QCPItemStraightLine.
+ +
+
|
+ +protectedvirtual | +
This event is called when the layerable shall be selected, as a consequence of a click by the user. Subclasses should react to it by setting their selection state appropriately. The default implementation does nothing.
+event is the mouse event that caused the selection. additive indicates, whether the user was holding the multi-select-modifier while performing the selection (see QCustomPlot::setMultiSelectModifier). if additive is true, the selection state must be toggled (i.e. become selected when unselected and unselected when selected).
+Every selectEvent is preceded by a call to selectTest, which has returned positively (i.e. returned a value greater than 0 and less than the selection tolerance of the parent QCustomPlot). The details data you output from selectTest is fed back via details here. You may use it to transport any kind of information from the selectTest to the possibly subsequent selectEvent. Usually details is used to transfer which part was clicked, if it is a layerable that has multiple individually selectable parts (like QCPAxis). This way selectEvent doesn't need to do the calculation again to find out which part was actually clicked.
+selectionStateChanged is an output parameter. If the pointer is non-null, this function must set the value either to true or false, depending on whether the selection state of this layerable was actually changed. For layerables that only are selectable as a whole and not in parts, this is simple: if additive is true, selectionStateChanged must also be set to true, because the selection toggles. If additive is false, selectionStateChanged is only set to true, if the layerable was previously unselected and now is switched to the selected state.
+Reimplemented in QCPAxis, QCPLegend, QCPAbstractItem, QCPAbstractPlottable, QCPTextElement, and QCPAbstractLegendItem.
+ +
+
|
+ +protectedvirtual | +
This event is called when the layerable shall be deselected, either as consequence of a user interaction or a call to QCustomPlot::deselectAll. Subclasses should react to it by unsetting their selection appropriately.
+just as in selectEvent, the output parameter selectionStateChanged (if non-null), must return true or false when the selection state of this layerable has changed or not changed, respectively.
+Reimplemented in QCPAxis, QCPLegend, QCPAbstractItem, QCPAbstractPlottable, QCPTextElement, and QCPAbstractLegendItem.
+ +
+
|
+ +protectedvirtual | +
This event gets called when the user presses a mouse button while the cursor is over the layerable. Whether a cursor is over the layerable is decided by a preceding call to selectTest.
+The current pixel position of the cursor on the QCustomPlot widget is accessible via event->pos(). The parameter details contains layerable-specific details about the hit, which were generated in the previous call to selectTest. For example, One-dimensional plottables like QCPGraph or QCPBars convey the clicked data point in the details parameter, as QCPDataSelection packed as QVariant. Multi-part objects convey the specific SelectablePart that was hit (e.g. QCPAxis::SelectablePart in the case of axes).
QCustomPlot uses an event propagation system that works the same as Qt's system. If your layerable doesn't reimplement the mousePressEvent or explicitly calls event->ignore() in its reimplementation, the event will be propagated to the next layerable in the stacking order.
Once a layerable has accepted the mousePressEvent, it is considered the mouse grabber and will receive all following calls to mouseMoveEvent or mouseReleaseEvent for this mouse interaction (a "mouse interaction" in this context ends with the release).
+The default implementation does nothing except explicitly ignoring the event with event->ignore().
Reimplemented in QCPAxis, QCPAxisRect, QCPColorScale, and QCPTextElement.
+ +
+
|
+ +protectedvirtual | +
This event gets called when the user moves the mouse while holding a mouse button, after this layerable has become the mouse grabber by accepting the preceding mousePressEvent.
+The current pixel position of the cursor on the QCustomPlot widget is accessible via event->pos(). The parameter startPos indicates the position where the initial mousePressEvent occured, that started the mouse interaction.
The default implementation does nothing.
+ + +Reimplemented in QCPAxis, QCPAxisRect, and QCPColorScale.
+ +
+
|
+ +protectedvirtual | +
This event gets called when the user releases the mouse button, after this layerable has become the mouse grabber by accepting the preceding mousePressEvent.
+The current pixel position of the cursor on the QCustomPlot widget is accessible via event->pos(). The parameter startPos indicates the position where the initial mousePressEvent occured, that started the mouse interaction.
The default implementation does nothing.
+ + +Reimplemented in QCPAxis, QCPAxisRect, QCPColorScale, and QCPTextElement.
+ +
+
|
+ +protectedvirtual | +
This event gets called when the user presses the mouse button a second time in a double-click, while the cursor is over the layerable. Whether a cursor is over the layerable is decided by a preceding call to selectTest.
+The mouseDoubleClickEvent is called instead of the second mousePressEvent. So in the case of a double-click, the event succession is pressEvent – releaseEvent – doubleClickEvent – releaseEvent.
+The current pixel position of the cursor on the QCustomPlot widget is accessible via event->pos(). The parameter details contains layerable-specific details about the hit, which were generated in the previous call to selectTest. For example, One-dimensional plottables like QCPGraph or QCPBars convey the clicked data point in the details parameter, as QCPDataSelection packed as QVariant. Multi-part objects convey the specific SelectablePart that was hit (e.g. QCPAxis::SelectablePart in the case of axes).
Similarly to mousePressEvent, once a layerable has accepted the mouseDoubleClickEvent, it is considered the mouse grabber and will receive all following calls to mouseMoveEvent and mouseReleaseEvent for this mouse interaction (a "mouse interaction" in this context ends with the release).
+The default implementation does nothing except explicitly ignoring the event with event->ignore().
Reimplemented in QCPTextElement.
+ +
+
|
+ +protectedvirtual | +
This event gets called when the user turns the mouse scroll wheel while the cursor is over the layerable. Whether a cursor is over the layerable is decided by a preceding call to selectTest.
+The current pixel position of the cursor on the QCustomPlot widget is accessible via event->pos().
The event->delta() indicates how far the mouse wheel was turned, which is usually +/- 120 for single rotation steps. However, if the mouse wheel is turned rapidly, multiple steps may accumulate to one event, making event->delta() larger. On the other hand, if the wheel has very smooth steps or none at all, the delta may be smaller.
The default implementation does nothing.
+ + +Reimplemented in QCPAxis, QCPAxisRect, and QCPColorScale.
+ +
+
|
+ +protected | +
Sets the parent plot of this layerable. Use this function once to set the parent plot if you have passed 0 in the constructor. It can not be used to move a layerable from one QCustomPlot to another one.
+Note that, unlike when passing a non-null parent plot in the constructor, this function does not make parentPlot the QObject-parent of this layerable. If you want this, call QObject::setParent(parentPlot) in addition to this function.
+Further, you will probably want to set a layer (setLayer) after calling this function, to make the layerable appear on the QCustomPlot.
+The parent plot change will be propagated to subclasses via a call to parentPlotInitialized so they can react accordingly (e.g. also initialize the parent plot of child layerables, like QCPLayout does).
+ +
+
|
+ +protected | +
Sets the parent layerable of this layerable to parentLayerable. Note that parentLayerable does not become the QObject-parent (for memory management) of this layerable.
+The parent layerable has influence on the return value of the realVisibility method. Only layerables with a fully visible parent tree will return true for realVisibility, and thus be drawn.
+
+
|
+ +protected | +
Moves this layerable object to layer. If prepend is true, this object will be prepended to the new layer's list, i.e. it will be drawn below the objects already on the layer. If it is false, the object will be appended.
+Returns true on success, i.e. if layer is a valid layer.
+ +
+
|
+ +protected | +
Sets the QCPainter::setAntialiasing state on the provided painter, depending on the localAntialiased value as well as the overrides QCustomPlot::setAntialiasedElements and QCustomPlot::setNotAntialiasedElements. Which override enum this function takes into account is controlled via overrideElement.
+ +The abstract base class for layouts. + More...
+
+Public Functions | |
| QCPLayout () | |
| virtual void | update (UpdatePhase phase) |
| virtual QList< QCPLayoutElement * > | elements (bool recursive) const |
| virtual int | elementCount () const =0 |
| virtual QCPLayoutElement * | elementAt (int index) const =0 |
| virtual QCPLayoutElement * | takeAt (int index)=0 |
| virtual bool | take (QCPLayoutElement *element)=0 |
| virtual void | simplify () |
| bool | removeAt (int index) |
| bool | remove (QCPLayoutElement *element) |
| void | clear () |
Public Functions inherited from QCPLayoutElement | |
| QCPLayoutElement (QCustomPlot *parentPlot=0) | |
| QCPLayout * | layout () const |
| QRect | rect () const |
| QRect | outerRect () const |
| +QMargins | margins () const |
| +QMargins | minimumMargins () const |
| +QCP::MarginSides | autoMargins () const |
| +QSize | minimumSize () const |
| +QSize | maximumSize () const |
| +SizeConstraintRect | sizeConstraintRect () const |
| +QCPMarginGroup * | marginGroup (QCP::MarginSide side) const |
| +QHash< QCP::MarginSide, QCPMarginGroup * > | marginGroups () const |
| void | setOuterRect (const QRect &rect) |
| void | setMargins (const QMargins &margins) |
| void | setMinimumMargins (const QMargins &margins) |
| void | setAutoMargins (QCP::MarginSides sides) |
| void | setMinimumSize (const QSize &size) |
| void | setMinimumSize (int width, int height) |
| void | setMaximumSize (const QSize &size) |
| void | setMaximumSize (int width, int height) |
| void | setSizeConstraintRect (SizeConstraintRect constraintRect) |
| void | setMarginGroup (QCP::MarginSides sides, QCPMarginGroup *group) |
| virtual QSize | minimumOuterSizeHint () const |
| virtual QSize | maximumOuterSizeHint () const |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Protected Functions | |
| virtual void | updateLayout () |
| void | sizeConstraintsChanged () const |
| void | adoptElement (QCPLayoutElement *el) |
| void | releaseElement (QCPLayoutElement *el) |
| QVector< int > | getSectionSizes (QVector< int > maxSizes, QVector< int > minSizes, QVector< double > stretchFactors, int totalSize) const |
Protected Functions inherited from QCPLayoutElement | |
| virtual int | calculateAutoMargin (QCP::MarginSide side) |
| virtual void | layoutChanged () |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | draw (QCPPainter *painter) |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
Protected Functions inherited from QCPLayerable | |
| virtual QCP::Interaction | selectionCategory () const |
| virtual QRect | clipRect () const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Protected Static Functions | |
| static QSize | getFinalMinimumOuterSize (const QCPLayoutElement *el) |
| static QSize | getFinalMaximumOuterSize (const QCPLayoutElement *el) |
+Additional Inherited Members | |
Public Types inherited from QCPLayoutElement | |
| enum | UpdatePhase |
| enum | SizeConstraintRect |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
The abstract base class for layouts.
+This is an abstract base class for layout elements whose main purpose is to define the position and size of other child layout elements. In most cases, layouts don't draw anything themselves (but there are exceptions to this, e.g. QCPLegend).
+QCPLayout derives from QCPLayoutElement, and thus can itself be nested in other layouts.
+QCPLayout introduces a common interface for accessing and manipulating the child elements. Those functions are most notably elementCount, elementAt, takeAt, take, simplify, removeAt, remove and clear. Individual subclasses may add more functions to this interface which are more specialized to the form of the layout. For example, QCPLayoutGrid adds functions that take row and column indices to access cells of the layout grid more conveniently.
+Since this is an abstract base class, you can't instantiate it directly. Rather use one of its subclasses like QCPLayoutGrid or QCPLayoutInset.
+For a general introduction to the layout system, see the dedicated documentation page The Layout System.
+
+
|
+ +explicit | +
+
|
+ +virtual | +
If phase is upLayout, calls updateLayout, which subclasses may reimplement to reposition and resize their cells.
+Finally, the call is propagated down to all child QCPLayoutElements.
+For details about this method and the update phases, see the documentation of QCPLayoutElement::update.
+ +Reimplemented from QCPLayoutElement.
+ +
+
|
+ +virtual | +
Returns a list of all child elements in this layout element. If recursive is true, all sub-child elements are included in the list, too.
+Reimplemented from QCPLayoutElement.
+ +Reimplemented in QCPLayoutGrid.
+ +
+
|
+ +pure virtual | +
Returns the number of elements/cells in the layout.
+ + +Implemented in QCPLayoutInset, and QCPLayoutGrid.
+ +
+
|
+ +pure virtual | +
Returns the element in the cell with the given index. If index is invalid, returns 0.
+Note that even if index is valid, the respective cell may be empty in some layouts (e.g. QCPLayoutGrid), so this function may return 0 in those cases. You may use this function to check whether a cell is empty or not.
+Implemented in QCPLayoutInset, and QCPLayoutGrid.
+ +
+
|
+ +pure virtual | +
Removes the element with the given index from the layout and returns it.
+If the index is invalid or the cell with that index is empty, returns 0.
+Note that some layouts don't remove the respective cell right away but leave an empty cell after successful removal of the layout element. To collapse empty cells, use simplify.
+ + +Implemented in QCPLayoutInset, and QCPLayoutGrid.
+ +
+
|
+ +pure virtual | +
Removes the specified element from the layout and returns true on success.
+If the element isn't in this layout, returns false.
+Note that some layouts don't remove the respective cell right away but leave an empty cell after successful removal of the layout element. To collapse empty cells, use simplify.
+Implemented in QCPLayoutInset, and QCPLayoutGrid.
+ +
+
|
+ +virtual | +
Simplifies the layout by collapsing empty cells. The exact behavior depends on subclasses, the default implementation does nothing.
+Not all layouts need simplification. For example, QCPLayoutInset doesn't use explicit simplification while QCPLayoutGrid does.
+ +Reimplemented in QCPLayoutInset, and QCPLayoutGrid.
+ +| bool QCPLayout::removeAt | +( | +int | +index | ) | ++ |
Removes and deletes the element at the provided index. Returns true on success. If index is invalid or points to an empty cell, returns false.
+This function internally uses takeAt to remove the element from the layout and then deletes the returned element. Note that some layouts don't remove the respective cell right away but leave an empty cell after successful removal of the layout element. To collapse empty cells, use simplify.
+ + +| bool QCPLayout::remove | +( | +QCPLayoutElement * | +element | ) | ++ |
Removes and deletes the provided element. Returns true on success. If element is not in the layout, returns false.
+This function internally uses takeAt to remove the element from the layout and then deletes the element. Note that some layouts don't remove the respective cell right away but leave an empty cell after successful removal of the layout element. To collapse empty cells, use simplify.
+ + +| void QCPLayout::clear | +( | +) | ++ |
+
|
+ +protectedvirtual | +
Subclasses reimplement this method to update the position and sizes of the child elements/cells via calling their QCPLayoutElement::setOuterRect. The default implementation does nothing.
+The geometry used as a reference is the inner rect of this layout. Child elements should stay within that rect.
+getSectionSizes may help with the reimplementation of this function.
+Reimplemented in QCPLayoutInset, and QCPLayoutGrid.
+ +
+
|
+ +protected | +
Subclasses call this method to report changed (minimum/maximum) size constraints.
+If the parent of this layout is again a QCPLayout, forwards the call to the parent's sizeConstraintsChanged. If the parent is a QWidget (i.e. is the QCustomPlot::plotLayout of QCustomPlot), calls QWidget::updateGeometry, so if the QCustomPlot widget is inside a Qt QLayout, it may update itself and resize cells accordingly.
+ +
+
|
+ +protected | +
Associates el with this layout. This is done by setting the QCPLayoutElement::layout, the QCPLayerable::parentLayerable and the QObject parent to this layout.
+Further, if el didn't previously have a parent plot, calls QCPLayerable::initializeParentPlot on el to set the paret plot.
+This method is used by subclass specific methods that add elements to the layout. Note that this method only changes properties in el. The removal from the old layout and the insertion into the new layout must be done additionally.
+ +
+
|
+ +protected | +
Disassociates el from this layout. This is done by setting the QCPLayoutElement::layout and the QCPLayerable::parentLayerable to zero. The QObject parent is set to the parent QCustomPlot.
+This method is used by subclass specific methods that remove elements from the layout (e.g. take or takeAt). Note that this method only changes properties in el. The removal from the old layout must be done additionally.
+ +
+
|
+ +protected | +
This is a helper function for the implementation of updateLayout in subclasses.
+It calculates the sizes of one-dimensional sections with provided constraints on maximum section sizes, minimum section sizes, relative stretch factors and the final total size of all sections.
+The QVector entries refer to the sections. Thus all QVectors must have the same size.
+maxSizes gives the maximum allowed size of each section. If there shall be no maximum size imposed, set all vector values to Qt's QWIDGETSIZE_MAX.
+minSizes gives the minimum allowed size of each section. If there shall be no minimum size imposed, set all vector values to zero. If the minSizes entries add up to a value greater than totalSize, sections will be scaled smaller than the proposed minimum sizes. (In other words, not exceeding the allowed total size is taken to be more important than not going below minimum section sizes.)
+stretchFactors give the relative proportions of the sections to each other. If all sections shall be scaled equally, set all values equal. If the first section shall be double the size of each individual other section, set the first number of stretchFactors to double the value of the other individual values (e.g. {2, 1, 1, 1}).
+totalSize is the value that the final section sizes will add up to. Due to rounding, the actual sum may differ slightly. If you want the section sizes to sum up to exactly that value, you could distribute the remaining difference on the sections.
+The return value is a QVector containing the section sizes.
+ +
+
|
+ +staticprotected | +
This is a helper function for the implementation of subclasses.
+It returns the minimum size that should finally be used for the outer rect of the passed layout element el.
+It takes into account whether a manual minimum size is set (QCPLayoutElement::setMinimumSize), which size constraint is set (QCPLayoutElement::setSizeConstraintRect), as well as the minimum size hint, if no manual minimum size was set (QCPLayoutElement::minimumOuterSizeHint).
+ +
+
|
+ +staticprotected | +
This is a helper function for the implementation of subclasses.
+It returns the maximum size that should finally be used for the outer rect of the passed layout element el.
+It takes into account whether a manual maximum size is set (QCPLayoutElement::setMaximumSize), which size constraint is set (QCPLayoutElement::setSizeConstraintRect), as well as the maximum size hint, if no manual maximum size was set (QCPLayoutElement::maximumOuterSizeHint).
+ +The abstract base class for all objects that form the layout system. + More...
+
+Public Types | |
| enum | UpdatePhase |
| enum | SizeConstraintRect |
+Public Functions | |
| QCPLayoutElement (QCustomPlot *parentPlot=0) | |
| QCPLayout * | layout () const |
| QRect | rect () const |
| QRect | outerRect () const |
| +QMargins | margins () const |
| +QMargins | minimumMargins () const |
| +QCP::MarginSides | autoMargins () const |
| +QSize | minimumSize () const |
| +QSize | maximumSize () const |
| +SizeConstraintRect | sizeConstraintRect () const |
| +QCPMarginGroup * | marginGroup (QCP::MarginSide side) const |
| +QHash< QCP::MarginSide, QCPMarginGroup * > | marginGroups () const |
| void | setOuterRect (const QRect &rect) |
| void | setMargins (const QMargins &margins) |
| void | setMinimumMargins (const QMargins &margins) |
| void | setAutoMargins (QCP::MarginSides sides) |
| void | setMinimumSize (const QSize &size) |
| void | setMinimumSize (int width, int height) |
| void | setMaximumSize (const QSize &size) |
| void | setMaximumSize (int width, int height) |
| void | setSizeConstraintRect (SizeConstraintRect constraintRect) |
| void | setMarginGroup (QCP::MarginSides sides, QCPMarginGroup *group) |
| virtual void | update (UpdatePhase phase) |
| virtual QSize | minimumOuterSizeHint () const |
| virtual QSize | maximumOuterSizeHint () const |
| virtual QList< QCPLayoutElement * > | elements (bool recursive) const |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Protected Functions | |
| virtual int | calculateAutoMargin (QCP::MarginSide side) |
| virtual void | layoutChanged () |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | draw (QCPPainter *painter) |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
Protected Functions inherited from QCPLayerable | |
| virtual QCP::Interaction | selectionCategory () const |
| virtual QRect | clipRect () const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Additional Inherited Members | |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
The abstract base class for all objects that form the layout system.
+This is an abstract base class. As such, it can't be instantiated directly, rather use one of its subclasses.
+A Layout element is a rectangular object which can be placed in layouts. It has an outer rect (QCPLayoutElement::outerRect) and an inner rect (QCPLayoutElement::rect). The difference between outer and inner rect is called its margin. The margin can either be set to automatic or manual (setAutoMargins) on a per-side basis. If a side is set to manual, that margin can be set explicitly with setMargins and will stay fixed at that value. If it's set to automatic, the layout element subclass will control the value itself (via calculateAutoMargin).
+Layout elements can be placed in layouts (base class QCPLayout) like QCPLayoutGrid. The top level layout is reachable via QCustomPlot::plotLayout, and is a QCPLayoutGrid. Since QCPLayout itself derives from QCPLayoutElement, layouts can be nested.
+Thus in QCustomPlot one can divide layout elements into two categories: The ones that are invisible by themselves, because they don't draw anything. Their only purpose is to manage the position and size of other layout elements. This category of layout elements usually use QCPLayout as base class. Then there is the category of layout elements which actually draw something. For example, QCPAxisRect, QCPLegend and QCPTextElement are of this category. This does not necessarily mean that the latter category can't have child layout elements. QCPLegend for instance, actually derives from QCPLayoutGrid and the individual legend items are child layout elements in the grid layout.
+| enum QCPLayoutElement::UpdatePhase | +
Defines the phases of the update process, that happens just before a replot. At each phase, update is called with the according UpdatePhase value.
+| enum QCPLayoutElement::SizeConstraintRect | +
Defines to which rect of a layout element the size constraints that can be set via setMinimumSize and setMaximumSize apply. The outer rect (outerRect) includes the margins (e.g. in the case of a QCPAxisRect the axis labels), whereas the inner rect (rect) does not.
+| Enumerator | |
|---|---|
| scrInnerRect | Minimum/Maximum size constraints apply to inner rect. + |
| scrOuterRect | Minimum/Maximum size constraints apply to outer rect, thus include layout element margins. + |
+
|
+ +explicit | +
Creates an instance of QCPLayoutElement and sets default values.
+ +
+
|
+ +inline | +
Returns the parent layout of this layout element.
+ +
+
|
+ +inline | +
Returns the inner rect of this layout element. The inner rect is the outer rect (outerRect, setOuterRect) shrinked by the margins (setMargins, setAutoMargins).
+In some cases, the area between outer and inner rect is left blank. In other cases the margin area is used to display peripheral graphics while the main content is in the inner rect. This is where automatic margin calculation becomes interesting because it allows the layout element to adapt the margins to the peripheral graphics it wants to draw. For example, QCPAxisRect draws the axis labels and tick labels in the margin area, thus needs to adjust the margins (if setAutoMargins is enabled) according to the space required by the labels of the axes.
+
+
|
+ +inline | +
Returns the outer rect of this layout element. The outer rect is the inner rect expanded by the margins (setMargins, setAutoMargins). The outer rect is used (and set via setOuterRect) by the parent QCPLayout to control the size of this layout element.
+| void QCPLayoutElement::setOuterRect | +( | +const QRect & | +rect | ) | ++ |
Sets the outer rect of this layout element. If the layout element is inside a layout, the layout sets the position and size of this layout element using this function.
+Calling this function externally has no effect, since the layout will overwrite any changes to the outer rect upon the next replot.
+The layout element will adapt its inner rect by applying the margins inward to the outer rect.
+| void QCPLayoutElement::setMargins | +( | +const QMargins & | +margins | ) | ++ |
Sets the margins of this layout element. If setAutoMargins is disabled for some or all sides, this function is used to manually set the margin on those sides. Sides that are still set to be handled automatically are ignored and may have any value in margins.
+The margin is the distance between the outer rect (controlled by the parent layout via setOuterRect) and the inner rect (which usually contains the main content of this layout element).
+| void QCPLayoutElement::setMinimumMargins | +( | +const QMargins & | +margins | ) | ++ |
If setAutoMargins is enabled on some or all margins, this function is used to provide minimum values for those margins.
+The minimum values are not enforced on margin sides that were set to be under manual control via setAutoMargins.
+| void QCPLayoutElement::setAutoMargins | +( | +QCP::MarginSides | +sides | ) | ++ |
Sets on which sides the margin shall be calculated automatically. If a side is calculated automatically, a minimum margin value may be provided with setMinimumMargins. If a side is set to be controlled manually, the value may be specified with setMargins.
+Margin sides that are under automatic control may participate in a QCPMarginGroup (see setMarginGroup), to synchronize (align) it with other layout elements in the plot.
+| void QCPLayoutElement::setMinimumSize | +( | +const QSize & | +size | ) | ++ |
Sets the minimum size of this layout element. A parent layout tries to respect the size here by changing row/column sizes in the layout accordingly.
+If the parent layout size is not sufficient to satisfy all minimum size constraints of its child layout elements, the layout may set a size that is actually smaller than size. QCustomPlot propagates the layout's size constraints to the outside by setting its own minimum QWidget size accordingly, so violations of size should be exceptions.
+Whether this constraint applies to the inner or the outer rect can be specified with setSizeConstraintRect (see rect and outerRect).
+ +| void QCPLayoutElement::setMinimumSize | +( | +int | +width, | +
| + | + | int | +height | +
| + | ) | ++ |
This is an overloaded function.
+Sets the minimum size of this layout element.
+Whether this constraint applies to the inner or the outer rect can be specified with setSizeConstraintRect (see rect and outerRect).
+ +| void QCPLayoutElement::setMaximumSize | +( | +const QSize & | +size | ) | ++ |
Sets the maximum size of this layout element. A parent layout tries to respect the size here by changing row/column sizes in the layout accordingly.
+Whether this constraint applies to the inner or the outer rect can be specified with setSizeConstraintRect (see rect and outerRect).
+ +| void QCPLayoutElement::setMaximumSize | +( | +int | +width, | +
| + | + | int | +height | +
| + | ) | ++ |
This is an overloaded function.
+Sets the maximum size of this layout element.
+Whether this constraint applies to the inner or the outer rect can be specified with setSizeConstraintRect (see rect and outerRect).
+ +| void QCPLayoutElement::setSizeConstraintRect | +( | +SizeConstraintRect | +constraintRect | ) | ++ |
Sets to which rect of a layout element the size constraints apply. Size constraints can be set via setMinimumSize and setMaximumSize.
+The outer rect (outerRect) includes the margins (e.g. in the case of a QCPAxisRect the axis labels), whereas the inner rect (rect) does not.
+| void QCPLayoutElement::setMarginGroup | +( | +QCP::MarginSides | +sides, | +
| + | + | QCPMarginGroup * | +group | +
| + | ) | ++ |
Sets the margin group of the specified margin sides.
+Margin groups allow synchronizing specified margins across layout elements, see the documentation of QCPMarginGroup.
+To unset the margin group of sides, set group to 0.
+Note that margin groups only work for margin sides that are set to automatic (setAutoMargins).
+
+
|
+ +virtual | +
Updates the layout element and sub-elements. This function is automatically called before every replot by the parent layout element. It is called multiple times, once for every UpdatePhase. The phases are run through in the order of the enum values. For details about what happens at the different phases, see the documentation of UpdatePhase.
+Layout elements that have child elements should call the update method of their child elements, and pass the current phase unchanged.
+The default implementation executes the automatic margin mechanism in the upMargins phase. Subclasses should make sure to call the base class implementation.
+ +Reimplemented in QCPLayout, QCPAxisRect, and QCPColorScale.
+ +
+
|
+ +virtual | +
Returns the suggested minimum size this layout element (the outerRect) may be compressed to, if no manual minimum size is set.
+if a minimum size (setMinimumSize) was not set manually, parent layouts use the returned size (usually indirectly through QCPLayout::getFinalMinimumOuterSize) to determine the minimum allowed size of this layout element.
+A manual minimum size is considered set if it is non-zero.
+The default implementation simply returns the sum of the horizontal margins for the width and the sum of the vertical margins for the height. Reimplementations may use their detailed knowledge about the layout element's content to provide size hints.
+ +Reimplemented in QCPLayoutGrid, QCPPlottableLegendItem, and QCPTextElement.
+ +
+
|
+ +virtual | +
Returns the suggested maximum size this layout element (the outerRect) may be expanded to, if no manual maximum size is set.
+if a maximum size (setMaximumSize) was not set manually, parent layouts use the returned size (usually indirectly through QCPLayout::getFinalMaximumOuterSize) to determine the maximum allowed size of this layout element.
+A manual maximum size is considered set if it is smaller than Qt's QWIDGETSIZE_MAX.
The default implementation simply returns QWIDGETSIZE_MAX for both width and height, implying no suggested maximum size. Reimplementations may use their detailed knowledge about the layout element's content to provide size hints.
Reimplemented in QCPLayoutGrid, and QCPTextElement.
+ +
+
|
+ +virtual | +
Returns a list of all child elements in this layout element. If recursive is true, all sub-child elements are included in the list, too.
+Reimplemented in QCPLayoutGrid, QCPLayout, and QCPAxisRect.
+ +
+
|
+ +virtual | +
Layout elements are sensitive to events inside their outer rect. If pos is within the outer rect, this method returns a value corresponding to 0.99 times the parent plot's selection tolerance. However, layout elements are not selectable by default. So if onlySelectable is true, -1.0 is returned.
+See QCPLayerable::selectTest for a general explanation of this virtual method.
+QCPLayoutElement subclasses may reimplement this method to provide more specific selection test behaviour.
+ +Reimplemented from QCPLayerable.
+ +Reimplemented in QCPLayoutInset, QCPLegend, QCPTextElement, and QCPAbstractLegendItem.
+ +
+
|
+ +protectedvirtual | +
Returns the margin size for this side. It is used if automatic margins is enabled for this side (see setAutoMargins). If a minimum margin was set with setMinimumMargins, the returned value will not be smaller than the specified minimum margin.
+The default implementation just returns the respective manual margin (setMargins) or the minimum margin, whichever is larger.
+ +Reimplemented in QCPAxisRect.
+ +
+
|
+ +protectedvirtual | +
This virtual method is called when this layout element was moved to a different QCPLayout, or when this layout element has changed its logical position (e.g. row and/or column) within the same QCPLayout. Subclasses may use this to react accordingly.
+Since this method is called after the completion of the move, you can access the new parent layout via layout().
+The default implementation does nothing.
+ +Reimplemented in QCPAxisRect.
+ +
+
|
+ +inlineprotectedvirtual | +
This function applies the default antialiasing setting to the specified painter, using the function applyAntialiasingHint. It is the antialiasing state the painter is put in, when draw is called on the layerable. If the layerable has multiple entities whose antialiasing setting may be specified individually, this function should set the antialiasing state of the most prominent entity. In this case however, the draw function usually calls the specialized versions of this function before drawing each entity, effectively overriding the setting of the default antialiasing hint.
+First example: QCPGraph has multiple entities that have an antialiasing setting: The graph line, fills and scatters. Those can be configured via QCPGraph::setAntialiased, QCPGraph::setAntialiasedFill and QCPGraph::setAntialiasedScatters. Consequently, there isn't only the QCPGraph::applyDefaultAntialiasingHint function (which corresponds to the graph line's antialiasing), but specialized ones like QCPGraph::applyFillAntialiasingHint and QCPGraph::applyScattersAntialiasingHint. So before drawing one of those entities, QCPGraph::draw calls the respective specialized applyAntialiasingHint function.
+Second example: QCPItemLine consists only of a line so there is only one antialiasing setting which can be controlled with QCPItemLine::setAntialiased. (This function is inherited by all layerables. The specialized functions, as seen on QCPGraph, must be added explicitly to the respective layerable subclass.) Consequently it only has the normal QCPItemLine::applyDefaultAntialiasingHint. The QCPItemLine::draw function doesn't need to care about setting any antialiasing states, because the default antialiasing hint is already set on the painter when the draw function is called, and that's the state it wants to draw the line with.
+ +Implements QCPLayerable.
+ +Reimplemented in QCPLegend, QCPAxisRect, QCPColorScale, QCPTextElement, and QCPAbstractLegendItem.
+ +
+
|
+ +inlineprotectedvirtual | +
This function draws the layerable with the specified painter. It is only called by QCustomPlot, if the layerable is visible (setVisible).
+Before this function is called, the painter's antialiasing state is set via applyDefaultAntialiasingHint, see the documentation there. Further, the clipping rectangle was set to clipRect.
+ +Implements QCPLayerable.
+ +Reimplemented in QCPLegend, QCPAxisRect, QCPPlottableLegendItem, QCPTextElement, and QCPAbstractLegendItem.
+ +
+
|
+ +protectedvirtual | +
propagates the parent plot initialization to all child elements, by calling QCPLayerable::initializeParentPlot on them.
+ +Reimplemented from QCPLayerable.
+ +Reimplemented in QCPLegend.
+ +A layout that arranges child elements in a grid. + More...
+
+Public Types | |
| enum | FillOrder |
Public Types inherited from QCPLayoutElement | |
| enum | UpdatePhase |
| enum | SizeConstraintRect |
+Public Functions | |
| QCPLayoutGrid () | |
| int | rowCount () const |
| int | columnCount () const |
| +QList< double > | columnStretchFactors () const |
| +QList< double > | rowStretchFactors () const |
| +int | columnSpacing () const |
| +int | rowSpacing () const |
| +int | wrap () const |
| +FillOrder | fillOrder () const |
| void | setColumnStretchFactor (int column, double factor) |
| void | setColumnStretchFactors (const QList< double > &factors) |
| void | setRowStretchFactor (int row, double factor) |
| void | setRowStretchFactors (const QList< double > &factors) |
| void | setColumnSpacing (int pixels) |
| void | setRowSpacing (int pixels) |
| void | setWrap (int count) |
| void | setFillOrder (FillOrder order, bool rearrange=true) |
| virtual void | updateLayout () |
| virtual int | elementCount () const |
| virtual QCPLayoutElement * | elementAt (int index) const |
| virtual QCPLayoutElement * | takeAt (int index) |
| virtual bool | take (QCPLayoutElement *element) |
| virtual QList< QCPLayoutElement * > | elements (bool recursive) const |
| virtual void | simplify () |
| virtual QSize | minimumOuterSizeHint () const |
| virtual QSize | maximumOuterSizeHint () const |
| QCPLayoutElement * | element (int row, int column) const |
| bool | addElement (int row, int column, QCPLayoutElement *element) |
| bool | addElement (QCPLayoutElement *element) |
| bool | hasElement (int row, int column) |
| void | expandTo (int newRowCount, int newColumnCount) |
| void | insertRow (int newIndex) |
| void | insertColumn (int newIndex) |
| int | rowColToIndex (int row, int column) const |
| void | indexToRowCol (int index, int &row, int &column) const |
Public Functions inherited from QCPLayout | |
| QCPLayout () | |
| virtual void | update (UpdatePhase phase) |
| bool | removeAt (int index) |
| bool | remove (QCPLayoutElement *element) |
| void | clear () |
Public Functions inherited from QCPLayoutElement | |
| QCPLayoutElement (QCustomPlot *parentPlot=0) | |
| QCPLayout * | layout () const |
| QRect | rect () const |
| QRect | outerRect () const |
| +QMargins | margins () const |
| +QMargins | minimumMargins () const |
| +QCP::MarginSides | autoMargins () const |
| +QSize | minimumSize () const |
| +QSize | maximumSize () const |
| +SizeConstraintRect | sizeConstraintRect () const |
| +QCPMarginGroup * | marginGroup (QCP::MarginSide side) const |
| +QHash< QCP::MarginSide, QCPMarginGroup * > | marginGroups () const |
| void | setOuterRect (const QRect &rect) |
| void | setMargins (const QMargins &margins) |
| void | setMinimumMargins (const QMargins &margins) |
| void | setAutoMargins (QCP::MarginSides sides) |
| void | setMinimumSize (const QSize &size) |
| void | setMinimumSize (int width, int height) |
| void | setMaximumSize (const QSize &size) |
| void | setMaximumSize (int width, int height) |
| void | setSizeConstraintRect (SizeConstraintRect constraintRect) |
| void | setMarginGroup (QCP::MarginSides sides, QCPMarginGroup *group) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Protected Functions | |
| void | getMinimumRowColSizes (QVector< int > *minColWidths, QVector< int > *minRowHeights) const |
| void | getMaximumRowColSizes (QVector< int > *maxColWidths, QVector< int > *maxRowHeights) const |
Protected Functions inherited from QCPLayout | |
| void | sizeConstraintsChanged () const |
| void | adoptElement (QCPLayoutElement *el) |
| void | releaseElement (QCPLayoutElement *el) |
| QVector< int > | getSectionSizes (QVector< int > maxSizes, QVector< int > minSizes, QVector< double > stretchFactors, int totalSize) const |
Protected Functions inherited from QCPLayoutElement | |
| virtual int | calculateAutoMargin (QCP::MarginSide side) |
| virtual void | layoutChanged () |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | draw (QCPPainter *painter) |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
Protected Functions inherited from QCPLayerable | |
| virtual QCP::Interaction | selectionCategory () const |
| virtual QRect | clipRect () const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Additional Inherited Members | |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
Protected Static Functions inherited from QCPLayout | |
| static QSize | getFinalMinimumOuterSize (const QCPLayoutElement *el) |
| static QSize | getFinalMaximumOuterSize (const QCPLayoutElement *el) |
A layout that arranges child elements in a grid.
+Elements are laid out in a grid with configurable stretch factors (setColumnStretchFactor, setRowStretchFactor) and spacing (setColumnSpacing, setRowSpacing).
+Elements can be added to cells via addElement. The grid is expanded if the specified row or column doesn't exist yet. Whether a cell contains a valid layout element can be checked with hasElement, that element can be retrieved with element. If rows and columns that only have empty cells shall be removed, call simplify. Removal of elements is either done by just adding the element to a different layout or by using the QCPLayout interface take or remove.
+If you use addElement(QCPLayoutElement*) without explicit parameters for row and column, the grid layout will choose the position according to the current setFillOrder and the wrapping (setWrap).
+Row and column insertion can be performed with insertRow and insertColumn.
+| enum QCPLayoutGrid::FillOrder | +
Defines in which direction the grid is filled when using addElement(QCPLayoutElement*). The column/row at which wrapping into the next row/column occurs can be specified with setWrap.
+| Enumerator | |
|---|---|
| foRowsFirst | Rows are filled first, and a new element is wrapped to the next column if the row count would exceed setWrap. + |
| foColumnsFirst | Columns are filled first, and a new element is wrapped to the next row if the column count would exceed setWrap. + |
+
|
+ +explicit | +
Creates an instance of QCPLayoutGrid and sets default values.
+ +
+
|
+ +inline | +
Returns the number of rows in the layout.
+
+
|
+ +inline | +
Returns the number of columns in the layout.
+| void QCPLayoutGrid::setColumnStretchFactor | +( | +int | +column, | +
| + | + | double | +factor | +
| + | ) | ++ |
Sets the stretch factor of column.
+Stretch factors control the relative sizes of rows and columns. Cells will not be resized beyond their minimum and maximum widths/heights, regardless of the stretch factor. (see QCPLayoutElement::setMinimumSize, QCPLayoutElement::setMaximumSize, QCPLayoutElement::setSizeConstraintRect.)
+The default stretch factor of newly created rows/columns is 1.
+ + +| void QCPLayoutGrid::setColumnStretchFactors | +( | +const QList< double > & | +factors | ) | ++ |
Sets the stretch factors of all columns. factors must have the size columnCount.
+Stretch factors control the relative sizes of rows and columns. Cells will not be resized beyond their minimum and maximum widths/heights, regardless of the stretch factor. (see QCPLayoutElement::setMinimumSize, QCPLayoutElement::setMaximumSize, QCPLayoutElement::setSizeConstraintRect.)
+The default stretch factor of newly created rows/columns is 1.
+ + +| void QCPLayoutGrid::setRowStretchFactor | +( | +int | +row, | +
| + | + | double | +factor | +
| + | ) | ++ |
Sets the stretch factor of row.
+Stretch factors control the relative sizes of rows and columns. Cells will not be resized beyond their minimum and maximum widths/heights, regardless of the stretch factor. (see QCPLayoutElement::setMinimumSize, QCPLayoutElement::setMaximumSize, QCPLayoutElement::setSizeConstraintRect.)
+The default stretch factor of newly created rows/columns is 1.
+ + +| void QCPLayoutGrid::setRowStretchFactors | +( | +const QList< double > & | +factors | ) | ++ |
Sets the stretch factors of all rows. factors must have the size rowCount.
+Stretch factors control the relative sizes of rows and columns. Cells will not be resized beyond their minimum and maximum widths/heights, regardless of the stretch factor. (see QCPLayoutElement::setMinimumSize, QCPLayoutElement::setMaximumSize, QCPLayoutElement::setSizeConstraintRect.)
+The default stretch factor of newly created rows/columns is 1.
+ + +| void QCPLayoutGrid::setColumnSpacing | +( | +int | +pixels | ) | ++ |
Sets the gap that is left blank between columns to pixels.
+| void QCPLayoutGrid::setRowSpacing | +( | +int | +pixels | ) | ++ |
Sets the gap that is left blank between rows to pixels.
+| void QCPLayoutGrid::setWrap | +( | +int | +count | ) | ++ |
Sets the maximum number of columns or rows that are used, before new elements added with addElement(QCPLayoutElement*) will start to fill the next row or column, respectively. It depends on setFillOrder, whether rows or columns are wrapped.
+If count is set to zero, no wrapping will ever occur.
+If you wish to re-wrap the elements currently in the layout, call setFillOrder with rearrange set to true (the actual fill order doesn't need to be changed for the rearranging to be done).
+Note that the method addElement(int row, int column, QCPLayoutElement *element) with explicitly stated row and column is not subject to wrapping and can place elements even beyond the specified wrapping point.
+| void QCPLayoutGrid::setFillOrder | +( | +FillOrder | +order, | +
| + | + | bool | +rearrange = true |
+
| + | ) | ++ |
Sets the filling order and wrapping behaviour that is used when adding new elements with the method addElement(QCPLayoutElement*).
+The specified order defines whether rows or columns are filled first. Using setWrap, you can control at which row/column count wrapping into the next column/row will occur. If you set it to zero, no wrapping will ever occur. Changing the fill order also changes the meaning of the linear index used e.g. in elementAt and takeAt. The default fill order for QCPLayoutGrid is foColumnsFirst.
+If you want to have all current elements arranged in the new order, set rearrange to true. The elements will be rearranged in a way that tries to preserve their linear index. However, empty cells are skipped during build-up of the new cell order, which shifts the succeeding element's index. The rearranging is performed even if the specified order is already the current fill order. Thus this method can be used to re-wrap the current elements.
+If rearrange is false, the current element arrangement is not changed, which means the linear indexes change (because the linear index is dependent on the fill order).
+Note that the method addElement(int row, int column, QCPLayoutElement *element) with explicitly stated row and column is not subject to wrapping and can place elements even beyond the specified wrapping point.
+
+
|
+ +virtual | +
Subclasses reimplement this method to update the position and sizes of the child elements/cells via calling their QCPLayoutElement::setOuterRect. The default implementation does nothing.
+The geometry used as a reference is the inner rect of this layout. Child elements should stay within that rect.
+getSectionSizes may help with the reimplementation of this function.
+Reimplemented from QCPLayout.
+ +
+
|
+ +inlinevirtual | +
+
|
+ +virtual | +
For general information about this virtual method, see the base class implementation.
+Note that the association of the linear index to the row/column based cells depends on the current setting of setFillOrder.
+Implements QCPLayout.
+ +
+
|
+ +virtual | +
For general information about this virtual method, see the base class implementation.
+Note that the association of the linear index to the row/column based cells depends on the current setting of setFillOrder.
+Implements QCPLayout.
+ +
+
|
+ +virtual | +
Removes the specified element from the layout and returns true on success.
+If the element isn't in this layout, returns false.
+Note that some layouts don't remove the respective cell right away but leave an empty cell after successful removal of the layout element. To collapse empty cells, use simplify.
+Implements QCPLayout.
+ +
+
|
+ +virtual | +
Returns a list of all child elements in this layout element. If recursive is true, all sub-child elements are included in the list, too.
+Reimplemented from QCPLayout.
+ +
+
|
+ +virtual | +
Simplifies the layout by collapsing rows and columns which only contain empty cells.
+ +Reimplemented from QCPLayout.
+ +
+
|
+ +virtual | +
Returns the suggested minimum size this layout element (the outerRect) may be compressed to, if no manual minimum size is set.
+if a minimum size (setMinimumSize) was not set manually, parent layouts use the returned size (usually indirectly through QCPLayout::getFinalMinimumOuterSize) to determine the minimum allowed size of this layout element.
+A manual minimum size is considered set if it is non-zero.
+The default implementation simply returns the sum of the horizontal margins for the width and the sum of the vertical margins for the height. Reimplementations may use their detailed knowledge about the layout element's content to provide size hints.
+ +Reimplemented from QCPLayoutElement.
+ +
+
|
+ +virtual | +
Returns the suggested maximum size this layout element (the outerRect) may be expanded to, if no manual maximum size is set.
+if a maximum size (setMaximumSize) was not set manually, parent layouts use the returned size (usually indirectly through QCPLayout::getFinalMaximumOuterSize) to determine the maximum allowed size of this layout element.
+A manual maximum size is considered set if it is smaller than Qt's QWIDGETSIZE_MAX.
The default implementation simply returns QWIDGETSIZE_MAX for both width and height, implying no suggested maximum size. Reimplementations may use their detailed knowledge about the layout element's content to provide size hints.
Reimplemented from QCPLayoutElement.
+ +| QCPLayoutElement * QCPLayoutGrid::element | +( | +int | +row, | +
| + | + | int | +column | +
| + | ) | +const | +
Returns the element in the cell in row and column.
+Returns 0 if either the row/column is invalid or if the cell is empty. In those cases, a qDebug message is printed. To check whether a cell exists and isn't empty, use hasElement.
+| bool QCPLayoutGrid::addElement | +( | +int | +row, | +
| + | + | int | +column, | +
| + | + | QCPLayoutElement * | +element | +
| + | ) | ++ |
This is an overloaded function.
+Adds the element to cell with row and column. If element is already in a layout, it is first removed from there. If row or column don't exist yet, the layout is expanded accordingly.
+Returns true if the element was added successfully, i.e. if the cell at row and column didn't already have an element.
+Use the overload of this method without explicit row/column index to place the element according to the configured fill order and wrapping settings.
+| bool QCPLayoutGrid::addElement | +( | +QCPLayoutElement * | +element | ) | ++ |
This is an overloaded function.
+Adds the element to the next empty cell according to the current fill order (setFillOrder) and wrapping (setWrap). If element is already in a layout, it is first removed from there. If necessary, the layout is expanded to hold the new element.
+Returns true if the element was added successfully.
+| bool QCPLayoutGrid::hasElement | +( | +int | +row, | +
| + | + | int | +column | +
| + | ) | ++ |
Returns whether the cell at row and column exists and contains a valid element, i.e. isn't empty.
+| void QCPLayoutGrid::expandTo | +( | +int | +newRowCount, | +
| + | + | int | +newColumnCount | +
| + | ) | ++ |
Expands the layout to have newRowCount rows and newColumnCount columns. So the last valid row index will be newRowCount-1, the last valid column index will be newColumnCount-1.
+If the current column/row count is already larger or equal to newColumnCount/newRowCount, this function does nothing in that dimension.
+Newly created cells are empty, new rows and columns have the stretch factor 1.
+Note that upon a call to addElement, the layout is expanded automatically to contain the specified row and column, using this function.
+| void QCPLayoutGrid::insertRow | +( | +int | +newIndex | ) | ++ |
Inserts a new row with empty cells at the row index newIndex. Valid values for newIndex range from 0 (inserts a row at the top) to rowCount (appends a row at the bottom).
+| void QCPLayoutGrid::insertColumn | +( | +int | +newIndex | ) | ++ |
Inserts a new column with empty cells at the column index newIndex. Valid values for newIndex range from 0 (inserts a column at the left) to columnCount (appends a column at the right).
+| int QCPLayoutGrid::rowColToIndex | +( | +int | +row, | +
| + | + | int | +column | +
| + | ) | +const | +
Converts the given row and column to the linear index used by some methods of QCPLayoutGrid and QCPLayout.
+The way the cells are indexed depends on setFillOrder. If it is foRowsFirst, the indices increase left to right and then top to bottom. If it is foColumnsFirst, the indices increase top to bottom and then left to right.
+For the returned index to be valid, row and column must be valid indices themselves, i.e. greater or equal to zero and smaller than the current rowCount/columnCount.
+| void QCPLayoutGrid::indexToRowCol | +( | +int | +index, | +
| + | + | int & | +row, | +
| + | + | int & | +column | +
| + | ) | +const | +
Converts the linear index to row and column indices and writes the result to row and column.
+The way the cells are indexed depends on setFillOrder. If it is foRowsFirst, the indices increase left to right and then top to bottom. If it is foColumnsFirst, the indices increase top to bottom and then left to right.
+If there are no cells (i.e. column or row count is zero), sets row and column to -1.
+For the retrieved row and column to be valid, the passed index must be valid itself, i.e. greater or equal to zero and smaller than the current elementCount.
+
+
|
+ +protected | +
Places the minimum column widths and row heights into minColWidths and minRowHeights respectively.
+The minimum height of a row is the largest minimum height of any element's outer rect in that row. The minimum width of a column is the largest minimum width of any element's outer rect in that column.
+This is a helper function for updateLayout.
+
+
|
+ +protected | +
Places the maximum column widths and row heights into maxColWidths and maxRowHeights respectively.
+The maximum height of a row is the smallest maximum height of any element's outer rect in that row. The maximum width of a column is the smallest maximum width of any element's outer rect in that column.
+This is a helper function for updateLayout.
+A layout that places child elements aligned to the border or arbitrarily positioned. + More...
+
+Public Types | |
| enum | InsetPlacement |
Public Types inherited from QCPLayoutElement | |
| enum | UpdatePhase |
| enum | SizeConstraintRect |
+Public Functions | |
| QCPLayoutInset () | |
| InsetPlacement | insetPlacement (int index) const |
| Qt::Alignment | insetAlignment (int index) const |
| QRectF | insetRect (int index) const |
| void | setInsetPlacement (int index, InsetPlacement placement) |
| void | setInsetAlignment (int index, Qt::Alignment alignment) |
| void | setInsetRect (int index, const QRectF &rect) |
| virtual void | updateLayout () |
| virtual int | elementCount () const |
| virtual QCPLayoutElement * | elementAt (int index) const |
| virtual QCPLayoutElement * | takeAt (int index) |
| virtual bool | take (QCPLayoutElement *element) |
| virtual void | simplify () |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
| void | addElement (QCPLayoutElement *element, Qt::Alignment alignment) |
| void | addElement (QCPLayoutElement *element, const QRectF &rect) |
Public Functions inherited from QCPLayout | |
| QCPLayout () | |
| virtual void | update (UpdatePhase phase) |
| virtual QList< QCPLayoutElement * > | elements (bool recursive) const |
| bool | removeAt (int index) |
| bool | remove (QCPLayoutElement *element) |
| void | clear () |
Public Functions inherited from QCPLayoutElement | |
| QCPLayoutElement (QCustomPlot *parentPlot=0) | |
| QCPLayout * | layout () const |
| QRect | rect () const |
| QRect | outerRect () const |
| +QMargins | margins () const |
| +QMargins | minimumMargins () const |
| +QCP::MarginSides | autoMargins () const |
| +QSize | minimumSize () const |
| +QSize | maximumSize () const |
| +SizeConstraintRect | sizeConstraintRect () const |
| +QCPMarginGroup * | marginGroup (QCP::MarginSide side) const |
| +QHash< QCP::MarginSide, QCPMarginGroup * > | marginGroups () const |
| void | setOuterRect (const QRect &rect) |
| void | setMargins (const QMargins &margins) |
| void | setMinimumMargins (const QMargins &margins) |
| void | setAutoMargins (QCP::MarginSides sides) |
| void | setMinimumSize (const QSize &size) |
| void | setMinimumSize (int width, int height) |
| void | setMaximumSize (const QSize &size) |
| void | setMaximumSize (int width, int height) |
| void | setSizeConstraintRect (SizeConstraintRect constraintRect) |
| void | setMarginGroup (QCP::MarginSides sides, QCPMarginGroup *group) |
| virtual QSize | minimumOuterSizeHint () const |
| virtual QSize | maximumOuterSizeHint () const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Additional Inherited Members | |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
Protected Functions inherited from QCPLayout | |
| void | sizeConstraintsChanged () const |
| void | adoptElement (QCPLayoutElement *el) |
| void | releaseElement (QCPLayoutElement *el) |
| QVector< int > | getSectionSizes (QVector< int > maxSizes, QVector< int > minSizes, QVector< double > stretchFactors, int totalSize) const |
Protected Functions inherited from QCPLayoutElement | |
| virtual int | calculateAutoMargin (QCP::MarginSide side) |
| virtual void | layoutChanged () |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | draw (QCPPainter *painter) |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
Protected Functions inherited from QCPLayerable | |
| virtual QCP::Interaction | selectionCategory () const |
| virtual QRect | clipRect () const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
Protected Static Functions inherited from QCPLayout | |
| static QSize | getFinalMinimumOuterSize (const QCPLayoutElement *el) |
| static QSize | getFinalMaximumOuterSize (const QCPLayoutElement *el) |
A layout that places child elements aligned to the border or arbitrarily positioned.
+Elements are placed either aligned to the border or at arbitrary position in the area of the layout. Which placement applies is controlled with the InsetPlacement (setInsetPlacement).
+Elements are added via addElement(QCPLayoutElement *element, Qt::Alignment alignment) or addElement(QCPLayoutElement *element, const QRectF &rect). If the first method is used, the inset placement will default to ipBorderAligned and the element will be aligned according to the alignment parameter. The second method defaults to ipFree and allows placing elements at arbitrary position and size, defined by rect.
+The alignment or rect can be set via setInsetAlignment or setInsetRect, respectively.
+This is the layout that every QCPAxisRect has as QCPAxisRect::insetLayout.
+| enum QCPLayoutInset::InsetPlacement | +
Defines how the placement and sizing is handled for a certain element in a QCPLayoutInset.
+| Enumerator | |
|---|---|
| ipFree | The element may be positioned/sized arbitrarily, see setInsetRect. + |
| ipBorderAligned | The element is aligned to one of the layout sides, see setInsetAlignment. + |
+
|
+ +explicit | +
Creates an instance of QCPLayoutInset and sets default values.
+ +| QCPLayoutInset::InsetPlacement QCPLayoutInset::insetPlacement | +( | +int | +index | ) | +const | +
Returns the placement type of the element with the specified index.
+ +| Qt::Alignment QCPLayoutInset::insetAlignment | +( | +int | +index | ) | +const | +
Returns the alignment of the element with the specified index. The alignment only has a meaning, if the inset placement (setInsetPlacement) is ipBorderAligned.
+ +| QRectF QCPLayoutInset::insetRect | +( | +int | +index | ) | +const | +
Returns the rect of the element with the specified index. The rect only has a meaning, if the inset placement (setInsetPlacement) is ipFree.
+ +| void QCPLayoutInset::setInsetPlacement | +( | +int | +index, | +
| + | + | QCPLayoutInset::InsetPlacement | +placement | +
| + | ) | ++ |
Sets the inset placement type of the element with the specified index to placement.
+| void QCPLayoutInset::setInsetAlignment | +( | +int | +index, | +
| + | + | Qt::Alignment | +alignment | +
| + | ) | ++ |
If the inset placement (setInsetPlacement) is ipBorderAligned, this function is used to set the alignment of the element with the specified index to alignment.
+alignment is an or combination of the following alignment flags: Qt::AlignLeft, Qt::AlignHCenter, Qt::AlighRight, Qt::AlignTop, Qt::AlignVCenter, Qt::AlignBottom. Any other alignment flags will be ignored.
+ +| void QCPLayoutInset::setInsetRect | +( | +int | +index, | +
| + | + | const QRectF & | +rect | +
| + | ) | ++ |
If the inset placement (setInsetPlacement) is ipFree, this function is used to set the position and size of the element with the specified index to rect.
+rect is given in fractions of the whole inset layout rect. So an inset with rect (0, 0, 1, 1) will span the entire layout. An inset with rect (0.6, 0.1, 0.35, 0.35) will be in the top right corner of the layout, with 35% width and height of the parent layout.
+Note that the minimum and maximum sizes of the embedded element (QCPLayoutElement::setMinimumSize, QCPLayoutElement::setMaximumSize) are enforced.
+ +
+
|
+ +virtual | +
Subclasses reimplement this method to update the position and sizes of the child elements/cells via calling their QCPLayoutElement::setOuterRect. The default implementation does nothing.
+The geometry used as a reference is the inner rect of this layout. Child elements should stay within that rect.
+getSectionSizes may help with the reimplementation of this function.
+Reimplemented from QCPLayout.
+ +
+
|
+ +virtual | +
+
|
+ +virtual | +
Returns the element in the cell with the given index. If index is invalid, returns 0.
+Note that even if index is valid, the respective cell may be empty in some layouts (e.g. QCPLayoutGrid), so this function may return 0 in those cases. You may use this function to check whether a cell is empty or not.
+Implements QCPLayout.
+ +
+
|
+ +virtual | +
Removes the element with the given index from the layout and returns it.
+If the index is invalid or the cell with that index is empty, returns 0.
+Note that some layouts don't remove the respective cell right away but leave an empty cell after successful removal of the layout element. To collapse empty cells, use simplify.
+ + +Implements QCPLayout.
+ +
+
|
+ +virtual | +
Removes the specified element from the layout and returns true on success.
+If the element isn't in this layout, returns false.
+Note that some layouts don't remove the respective cell right away but leave an empty cell after successful removal of the layout element. To collapse empty cells, use simplify.
+Implements QCPLayout.
+ +
+
|
+ +inlinevirtual | +
The QCPInsetLayout does not need simplification since it can never have empty cells due to its linear index structure. This method does nothing.
+ +Reimplemented from QCPLayout.
+ +
+
|
+ +virtual | +
The inset layout is sensitive to events only at areas where its (visible) child elements are sensitive. If the selectTest method of any of the child elements returns a positive number for pos, this method returns a value corresponding to 0.99 times the parent plot's selection tolerance. The inset layout is not selectable itself by default. So if onlySelectable is true, -1.0 is returned.
+See QCPLayerable::selectTest for a general explanation of this virtual method.
+ +Reimplemented from QCPLayoutElement.
+ +| void QCPLayoutInset::addElement | +( | +QCPLayoutElement * | +element, | +
| + | + | Qt::Alignment | +alignment | +
| + | ) | ++ |
Adds the specified element to the layout as an inset aligned at the border (setInsetAlignment is initialized with ipBorderAligned). The alignment is set to alignment.
+alignment is an or combination of the following alignment flags: Qt::AlignLeft, Qt::AlignHCenter, Qt::AlighRight, Qt::AlignTop, Qt::AlignVCenter, Qt::AlignBottom. Any other alignment flags will be ignored.
+ + +| void QCPLayoutInset::addElement | +( | +QCPLayoutElement * | +element, | +
| + | + | const QRectF & | +rect | +
| + | ) | ++ |
Adds the specified element to the layout as an inset with free positioning/sizing (setInsetAlignment is initialized with ipFree). The position and size is set to rect.
+rect is given in fractions of the whole inset layout rect. So an inset with rect (0, 0, 1, 1) will span the entire layout. An inset with rect (0.6, 0.1, 0.35, 0.35) will be in the top right corner of the layout, with 35% width and height of the parent layout.
+ + +Manages a legend inside a QCustomPlot. + More...
+
+Public Types | |
| enum | SelectablePart |
Public Types inherited from QCPLayoutGrid | |
| enum | FillOrder |
Public Types inherited from QCPLayoutElement | |
| enum | UpdatePhase |
| enum | SizeConstraintRect |
+Public Functions | |
| QCPLegend () | |
| +QPen | borderPen () const |
| +QBrush | brush () const |
| +QFont | font () const |
| +QColor | textColor () const |
| +QSize | iconSize () const |
| +int | iconTextPadding () const |
| +QPen | iconBorderPen () const |
| +SelectableParts | selectableParts () const |
| +SelectableParts | selectedParts () const |
| +QPen | selectedBorderPen () const |
| +QPen | selectedIconBorderPen () const |
| +QBrush | selectedBrush () const |
| +QFont | selectedFont () const |
| +QColor | selectedTextColor () const |
| void | setBorderPen (const QPen &pen) |
| void | setBrush (const QBrush &brush) |
| void | setFont (const QFont &font) |
| void | setTextColor (const QColor &color) |
| void | setIconSize (const QSize &size) |
| void | setIconSize (int width, int height) |
| void | setIconTextPadding (int padding) |
| void | setIconBorderPen (const QPen &pen) |
| Q_SLOT void | setSelectableParts (const SelectableParts &selectableParts) |
| Q_SLOT void | setSelectedParts (const SelectableParts &selectedParts) |
| void | setSelectedBorderPen (const QPen &pen) |
| void | setSelectedIconBorderPen (const QPen &pen) |
| void | setSelectedBrush (const QBrush &brush) |
| void | setSelectedFont (const QFont &font) |
| void | setSelectedTextColor (const QColor &color) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
| QCPAbstractLegendItem * | item (int index) const |
| QCPPlottableLegendItem * | itemWithPlottable (const QCPAbstractPlottable *plottable) const |
| int | itemCount () const |
| bool | hasItem (QCPAbstractLegendItem *item) const |
| bool | hasItemWithPlottable (const QCPAbstractPlottable *plottable) const |
| bool | addItem (QCPAbstractLegendItem *item) |
| bool | removeItem (int index) |
| bool | removeItem (QCPAbstractLegendItem *item) |
| void | clearItems () |
| QList< QCPAbstractLegendItem * > | selectedItems () const |
Public Functions inherited from QCPLayoutGrid | |
| QCPLayoutGrid () | |
| int | rowCount () const |
| int | columnCount () const |
| +QList< double > | columnStretchFactors () const |
| +QList< double > | rowStretchFactors () const |
| +int | columnSpacing () const |
| +int | rowSpacing () const |
| +int | wrap () const |
| +FillOrder | fillOrder () const |
| void | setColumnStretchFactor (int column, double factor) |
| void | setColumnStretchFactors (const QList< double > &factors) |
| void | setRowStretchFactor (int row, double factor) |
| void | setRowStretchFactors (const QList< double > &factors) |
| void | setColumnSpacing (int pixels) |
| void | setRowSpacing (int pixels) |
| void | setWrap (int count) |
| void | setFillOrder (FillOrder order, bool rearrange=true) |
| virtual void | updateLayout () |
| virtual int | elementCount () const |
| virtual QCPLayoutElement * | elementAt (int index) const |
| virtual QCPLayoutElement * | takeAt (int index) |
| virtual bool | take (QCPLayoutElement *element) |
| virtual QList< QCPLayoutElement * > | elements (bool recursive) const |
| virtual void | simplify () |
| virtual QSize | minimumOuterSizeHint () const |
| virtual QSize | maximumOuterSizeHint () const |
| QCPLayoutElement * | element (int row, int column) const |
| bool | addElement (int row, int column, QCPLayoutElement *element) |
| bool | addElement (QCPLayoutElement *element) |
| bool | hasElement (int row, int column) |
| void | expandTo (int newRowCount, int newColumnCount) |
| void | insertRow (int newIndex) |
| void | insertColumn (int newIndex) |
| int | rowColToIndex (int row, int column) const |
| void | indexToRowCol (int index, int &row, int &column) const |
Public Functions inherited from QCPLayout | |
| QCPLayout () | |
| virtual void | update (UpdatePhase phase) |
| bool | removeAt (int index) |
| bool | remove (QCPLayoutElement *element) |
| void | clear () |
Public Functions inherited from QCPLayoutElement | |
| QCPLayoutElement (QCustomPlot *parentPlot=0) | |
| QCPLayout * | layout () const |
| QRect | rect () const |
| QRect | outerRect () const |
| +QMargins | margins () const |
| +QMargins | minimumMargins () const |
| +QCP::MarginSides | autoMargins () const |
| +QSize | minimumSize () const |
| +QSize | maximumSize () const |
| +SizeConstraintRect | sizeConstraintRect () const |
| +QCPMarginGroup * | marginGroup (QCP::MarginSide side) const |
| +QHash< QCP::MarginSide, QCPMarginGroup * > | marginGroups () const |
| void | setOuterRect (const QRect &rect) |
| void | setMargins (const QMargins &margins) |
| void | setMinimumMargins (const QMargins &margins) |
| void | setAutoMargins (QCP::MarginSides sides) |
| void | setMinimumSize (const QSize &size) |
| void | setMinimumSize (int width, int height) |
| void | setMaximumSize (const QSize &size) |
| void | setMaximumSize (int width, int height) |
| void | setSizeConstraintRect (SizeConstraintRect constraintRect) |
| void | setMarginGroup (QCP::MarginSides sides, QCPMarginGroup *group) |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Signals | |
| void | selectionChanged (QCPLegend::SelectableParts parts) |
| +void | selectableChanged (QCPLegend::SelectableParts parts) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
+Protected Functions | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual QCP::Interaction | selectionCategory () const |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | draw (QCPPainter *painter) |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| QPen | getBorderPen () const |
| QBrush | getBrush () const |
Protected Functions inherited from QCPLayoutGrid | |
| void | getMinimumRowColSizes (QVector< int > *minColWidths, QVector< int > *minRowHeights) const |
| void | getMaximumRowColSizes (QVector< int > *maxColWidths, QVector< int > *maxRowHeights) const |
Protected Functions inherited from QCPLayout | |
| void | sizeConstraintsChanged () const |
| void | adoptElement (QCPLayoutElement *el) |
| void | releaseElement (QCPLayoutElement *el) |
| QVector< int > | getSectionSizes (QVector< int > maxSizes, QVector< int > minSizes, QVector< double > stretchFactors, int totalSize) const |
Protected Functions inherited from QCPLayoutElement | |
| virtual int | calculateAutoMargin (QCP::MarginSide side) |
| virtual void | layoutChanged () |
Protected Functions inherited from QCPLayerable | |
| virtual QRect | clipRect () const |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Additional Inherited Members | |
Protected Static Functions inherited from QCPLayout | |
| static QSize | getFinalMinimumOuterSize (const QCPLayoutElement *el) |
| static QSize | getFinalMaximumOuterSize (const QCPLayoutElement *el) |
Manages a legend inside a QCustomPlot.
+A legend is a small box somewhere in the plot which lists plottables with their name and icon.
+A legend is populated with legend items by calling QCPAbstractPlottable::addToLegend on the plottable, for which a legend item shall be created. In the case of the main legend (QCustomPlot::legend), simply adding plottables to the plot while QCustomPlot::setAutoAddPlottableToLegend is set to true (the default) creates corresponding legend items. The legend item associated with a certain plottable can be removed with QCPAbstractPlottable::removeFromLegend. However, QCPLegend also offers an interface to add and manipulate legend items directly: item, itemWithPlottable, itemCount, addItem, removeItem, etc.
+Since QCPLegend derives from QCPLayoutGrid, it can be placed in any position a QCPLayoutElement may be positioned. The legend items are themselves QCPLayoutElements which are placed in the grid layout of the legend. QCPLegend only adds an interface specialized for handling child elements of type QCPAbstractLegendItem, as mentioned above. In principle, any other layout elements may also be added to a legend via the normal QCPLayoutGrid interface. See the special page about The Layout System for examples on how to add other elements to the legend and move it outside the axis rect.
+Use the methods setFillOrder and setWrap inherited from QCPLayoutGrid to control in which order (column first or row first) the legend is filled up when calling addItem, and at which column or row wrapping occurs. The default fill order for legends is foRowsFirst.
+By default, every QCustomPlot has one legend (QCustomPlot::legend) which is placed in the inset layout of the main axis rect (QCPAxisRect::insetLayout). To move the legend to another position inside the axis rect, use the methods of the QCPLayoutInset. To move the legend outside of the axis rect, place it anywhere else with the QCPLayout/QCPLayoutElement interface.
+| enum QCPLegend::SelectablePart | +
Defines the selectable parts of a legend
+| Enumerator | |
|---|---|
| spNone |
|
| spLegendBox |
|
| spItems |
|
+
|
+ +explicit | +
Constructs a new QCPLegend instance with default values.
+Note that by default, QCustomPlot already contains a legend ready to be used as QCustomPlot::legend
+ +| void QCPLegend::setBorderPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen, the border of the entire legend is drawn with.
+ +| void QCPLegend::setBrush | +( | +const QBrush & | +brush | ) | ++ |
Sets the brush of the legend background.
+ +| void QCPLegend::setFont | +( | +const QFont & | +font | ) | ++ |
Sets the default font of legend text. Legend items that draw text (e.g. the name of a graph) will use this font by default. However, a different font can be specified on a per-item-basis by accessing the specific legend item.
+This function will also set font on all already existing legend items.
+| void QCPLegend::setTextColor | +( | +const QColor & | +color | ) | ++ |
Sets the default color of legend text. Legend items that draw text (e.g. the name of a graph) will use this color by default. However, a different colors can be specified on a per-item-basis by accessing the specific legend item.
+This function will also set color on all already existing legend items.
+ + +| void QCPLegend::setIconSize | +( | +const QSize & | +size | ) | ++ |
Sets the size of legend icons. Legend items that draw an icon (e.g. a visual representation of the graph) will use this size by default.
+ +| void QCPLegend::setIconSize | +( | +int | +width, | +
| + | + | int | +height | +
| + | ) | ++ |
This is an overloaded function.
+ +| void QCPLegend::setIconTextPadding | +( | +int | +padding | ) | ++ |
Sets the horizontal space in pixels between the legend icon and the text next to it. Legend items that draw an icon (e.g. a visual representation of the graph) and text (e.g. the name of the graph) will use this space by default.
+ +| void QCPLegend::setIconBorderPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen used to draw a border around each legend icon. Legend items that draw an icon (e.g. a visual representation of the graph) will use this pen by default.
+If no border is wanted, set this to Qt::NoPen.
+ +| void QCPLegend::setSelectableParts | +( | +const SelectableParts & | +selectable | ) | ++ |
Sets whether the user can (de-)select the parts in selectable by clicking on the QCustomPlot surface. (When QCustomPlot::setInteractions contains QCP::iSelectLegend.)
+However, even when selectable is set to a value not allowing the selection of a specific part, it is still possible to set the selection of this part manually, by calling setSelectedParts directly.
+| void QCPLegend::setSelectedParts | +( | +const SelectableParts & | +selected | ) | ++ |
Sets the selected state of the respective legend parts described by SelectablePart. When a part is selected, it uses a different pen/font and brush. If some legend items are selected and selected doesn't contain spItems, those items become deselected.
+The entire selection mechanism is handled automatically when QCustomPlot::setInteractions contains iSelectLegend. You only need to call this function when you wish to change the selection state manually.
+This function can change the selection state of a part even when setSelectableParts was set to a value that actually excludes the part.
+emits the selectionChanged signal when selected is different from the previous selection state.
+Note that it doesn't make sense to set the selected state spItems here when it wasn't set before, because there's no way to specify which exact items to newly select. Do this by calling QCPAbstractLegendItem::setSelected directly on the legend item you wish to select.
+ + +| void QCPLegend::setSelectedBorderPen | +( | +const QPen & | +pen | ) | ++ |
When the legend box is selected, this pen is used to draw the border instead of the normal pen set via setBorderPen.
+ + +| void QCPLegend::setSelectedIconBorderPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen legend items will use to draw their icon borders, when they are selected.
+ + +| void QCPLegend::setSelectedBrush | +( | +const QBrush & | +brush | ) | ++ |
When the legend box is selected, this brush is used to draw the legend background instead of the normal brush set via setBrush.
+ + +| void QCPLegend::setSelectedFont | +( | +const QFont & | +font | ) | ++ |
Sets the default font that is used by legend items when they are selected.
+This function will also set font on all already existing legend items.
+ + +| void QCPLegend::setSelectedTextColor | +( | +const QColor & | +color | ) | ++ |
Sets the default text color that is used by legend items when they are selected.
+This function will also set color on all already existing legend items.
+ + +
+
|
+ +virtual | +
Layout elements are sensitive to events inside their outer rect. If pos is within the outer rect, this method returns a value corresponding to 0.99 times the parent plot's selection tolerance. However, layout elements are not selectable by default. So if onlySelectable is true, -1.0 is returned.
+See QCPLayerable::selectTest for a general explanation of this virtual method.
+QCPLayoutElement subclasses may reimplement this method to provide more specific selection test behaviour.
+ +Reimplemented from QCPLayoutElement.
+ +| QCPAbstractLegendItem * QCPLegend::item | +( | +int | +index | ) | +const | +
Returns the item with index i.
+Note that the linear index depends on the current fill order (setFillOrder).
+| QCPPlottableLegendItem * QCPLegend::itemWithPlottable | +( | +const QCPAbstractPlottable * | +plottable | ) | +const | +
Returns the QCPPlottableLegendItem which is associated with plottable (e.g. a QCPGraph*). If such an item isn't in the legend, returns 0.
+| int QCPLegend::itemCount | +( | +) | +const | +
Returns the number of items currently in the legend.
+Note that if empty cells are in the legend (e.g. by calling methods of the QCPLayoutGrid base class which allows creating empty cells), they are included in the returned count.
+| bool QCPLegend::hasItem | +( | +QCPAbstractLegendItem * | +item | ) | +const | +
Returns whether the legend contains item.
+| bool QCPLegend::hasItemWithPlottable | +( | +const QCPAbstractPlottable * | +plottable | ) | +const | +
Returns whether the legend contains a QCPPlottableLegendItem which is associated with plottable (e.g. a QCPGraph*). If such an item isn't in the legend, returns false.
+| bool QCPLegend::addItem | +( | +QCPAbstractLegendItem * | +item | ) | ++ |
Adds item to the legend, if it's not present already. The element is arranged according to the current fill order (setFillOrder) and wrapping (setWrap).
+Returns true on sucess, i.e. if the item wasn't in the list already and has been successfuly added.
+The legend takes ownership of the item.
+| bool QCPLegend::removeItem | +( | +int | +index | ) | ++ |
This is an overloaded function.
+Removes the item with the specified index from the legend and deletes it.
+After successful removal, the legend is reordered according to the current fill order (setFillOrder) and wrapping (setWrap), so no empty cell remains where the removed item was. If you don't want this, rather use the raw element interface of QCPLayoutGrid.
+Returns true, if successful. Unlike QCPLayoutGrid::removeAt, this method only removes elements derived from QCPAbstractLegendItem.
+| bool QCPLegend::removeItem | +( | +QCPAbstractLegendItem * | +item | ) | ++ |
This is an overloaded function.
+Removes item from the legend and deletes it.
+After successful removal, the legend is reordered according to the current fill order (setFillOrder) and wrapping (setWrap), so no empty cell remains where the removed item was. If you don't want this, rather use the raw element interface of QCPLayoutGrid.
+Returns true, if successful.
+| void QCPLegend::clearItems | +( | +) | ++ |
Removes all items from the legend.
+ +| QList< QCPAbstractLegendItem * > QCPLegend::selectedItems | +( | +) | +const | +
Returns the legend items that are currently selected. If no items are selected, the list is empty.
+
+
|
+ +signal | +
This signal is emitted when the selection state of this legend has changed.
+
+
|
+ +protectedvirtual | +
propagates the parent plot initialization to all child elements, by calling QCPLayerable::initializeParentPlot on them.
+ +Reimplemented from QCPLayoutElement.
+ +
+
|
+ +protectedvirtual | +
Returns the selection category this layerable shall belong to. The selection category is used in conjunction with QCustomPlot::setInteractions to control which objects are selectable and which aren't.
+Subclasses that don't fit any of the normal QCP::Interaction values can use QCP::iSelectOther. This is what the default implementation returns.
+Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
A convenience function to easily set the QPainter::Antialiased hint on the provided painter before drawing main legend elements.
+This is the antialiasing state the painter passed to the draw method is in by default.
+This function takes into account the local setting of the antialiasing flag as well as the overrides set with QCustomPlot::setAntialiasedElements and QCustomPlot::setNotAntialiasedElements.
+For general information about this virtual method, see the base class implementation.
+Reimplemented from QCPLayoutElement.
+ +
+
|
+ +protectedvirtual | +
Draws the legend box with the provided painter. The individual legend items are layerables themselves, thus are drawn independently.
+ +Reimplemented from QCPLayoutElement.
+ +
+
|
+ +protectedvirtual | +
This event is called when the layerable shall be selected, as a consequence of a click by the user. Subclasses should react to it by setting their selection state appropriately. The default implementation does nothing.
+event is the mouse event that caused the selection. additive indicates, whether the user was holding the multi-select-modifier while performing the selection (see QCustomPlot::setMultiSelectModifier). if additive is true, the selection state must be toggled (i.e. become selected when unselected and unselected when selected).
+Every selectEvent is preceded by a call to selectTest, which has returned positively (i.e. returned a value greater than 0 and less than the selection tolerance of the parent QCustomPlot). The details data you output from selectTest is fed back via details here. You may use it to transport any kind of information from the selectTest to the possibly subsequent selectEvent. Usually details is used to transfer which part was clicked, if it is a layerable that has multiple individually selectable parts (like QCPAxis). This way selectEvent doesn't need to do the calculation again to find out which part was actually clicked.
+selectionStateChanged is an output parameter. If the pointer is non-null, this function must set the value either to true or false, depending on whether the selection state of this layerable was actually changed. For layerables that only are selectable as a whole and not in parts, this is simple: if additive is true, selectionStateChanged must also be set to true, because the selection toggles. If additive is false, selectionStateChanged is only set to true, if the layerable was previously unselected and now is switched to the selected state.
+Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
This event is called when the layerable shall be deselected, either as consequence of a user interaction or a call to QCustomPlot::deselectAll. Subclasses should react to it by unsetting their selection appropriately.
+just as in selectEvent, the output parameter selectionStateChanged (if non-null), must return true or false when the selection state of this layerable has changed or not changed, respectively.
+Reimplemented from QCPLayerable.
+ +
+
|
+ +protected | +
Returns the pen used to paint the border of the legend, taking into account the selection state of the legend box.
+ +
+
|
+ +protected | +
Returns the brush used to paint the background of the legend, taking into account the selection state of the legend box.
+ +Handles the different ending decorations for line-like items. + More...
++Public Types | |
| enum | EndingStyle |
+Public Functions | |
| QCPLineEnding () | |
| QCPLineEnding (EndingStyle style, double width=8, double length=10, bool inverted=false) | |
| +EndingStyle | style () const |
| +double | width () const |
| +double | length () const |
| +bool | inverted () const |
| void | setStyle (EndingStyle style) |
| void | setWidth (double width) |
| void | setLength (double length) |
| void | setInverted (bool inverted) |
| double | boundingDistance () const |
| double | realLength () const |
| void | draw (QCPPainter *painter, const QCPVector2D &pos, const QCPVector2D &dir) const |
| void | draw (QCPPainter *painter, const QCPVector2D &pos, double angle) const |
Handles the different ending decorations for line-like items.
+
+For every ending a line-like item has, an instance of this class exists. For example, QCPItemLine has two endings which can be set with QCPItemLine::setHead and QCPItemLine::setTail.
+The styles themselves are defined via the enum QCPLineEnding::EndingStyle. Most decorations can be modified regarding width and length, see setWidth and setLength. The direction of the ending decoration (e.g. direction an arrow is pointing) is controlled by the line-like item. For example, when both endings of a QCPItemLine are set to be arrows, they will point to opposite directions, e.g. "outward". This can be changed by setInverted, which would make the respective arrow point inward.
+Note that due to the overloaded QCPLineEnding constructor, you may directly specify a QCPLineEnding::EndingStyle where actually a QCPLineEnding is expected, e.g.
| enum QCPLineEnding::EndingStyle | +
Defines the type of ending decoration for line-like items, e.g. an arrow.
+
+The width and length of these decorations can be controlled with the functions setWidth and setLength. Some decorations like esDisc, esSquare, esDiamond and esBar only support a width, the length property is ignored.
+| Enumerator | |
|---|---|
| esNone | No ending decoration. + |
| esFlatArrow | A filled arrow head with a straight/flat back (a triangle) + |
| esSpikeArrow | A filled arrow head with an indented back. + |
| esLineArrow | A non-filled arrow head with open back. + |
| esDisc | A filled circle. + |
| esSquare | A filled square. + |
| esDiamond | A filled diamond (45 degrees rotated square) + |
| esBar | A bar perpendicular to the line. + |
| esHalfBar | A bar perpendicular to the line, pointing out to only one side (to which side can be changed with setInverted) + |
| esSkewedBar | A bar that is skewed (skew controllable via setLength) + |
| QCPLineEnding::QCPLineEnding | +( | +) | ++ |
Creates a QCPLineEnding instance with default values (style esNone).
+ +| QCPLineEnding::QCPLineEnding | +( | +QCPLineEnding::EndingStyle | +style, | +
| + | + | double | +width = 8, |
+
| + | + | double | +length = 10, |
+
| + | + | bool | +inverted = false |
+
| + | ) | ++ |
Creates a QCPLineEnding instance with the specified values.
+ +| void QCPLineEnding::setStyle | +( | +QCPLineEnding::EndingStyle | +style | ) | ++ |
Sets the style of the ending decoration.
+ +| void QCPLineEnding::setWidth | +( | +double | +width | ) | ++ |
Sets the width of the ending decoration, if the style supports it. On arrows, for example, the width defines the size perpendicular to the arrow's pointing direction.
+| void QCPLineEnding::setLength | +( | +double | +length | ) | ++ |
Sets the length of the ending decoration, if the style supports it. On arrows, for example, the length defines the size in pointing direction.
+| void QCPLineEnding::setInverted | +( | +bool | +inverted | ) | ++ |
Sets whether the ending decoration shall be inverted. For example, an arrow decoration will point inward when inverted is set to true.
+Note that also the width direction is inverted. For symmetrical ending styles like arrows or discs, this doesn't make a difference. However, asymmetric styles like esHalfBar are affected by it, which can be used to control to which side the half bar points to.
+ +| double QCPLineEnding::boundingDistance | +( | +) | +const | +
Returns the maximum pixel radius the ending decoration might cover, starting from the position the decoration is drawn at (typically a line ending/QCPItemPosition of an item).
+This is relevant for clipping. Only omit painting of the decoration when the position where the decoration is supposed to be drawn is farther away from the clipping rect than the returned distance.
+ +| double QCPLineEnding::realLength | +( | +) | +const | +
Starting from the origin of this line ending (which is style specific), returns the length covered by the line ending symbol, in backward direction.
+For example, the esSpikeArrow has a shorter real length than a esFlatArrow, even if both have the same setLength value, because the spike arrow has an inward curved back, which reduces the length along its center axis (the drawing origin for arrows is at the tip).
+This function is used for precise, style specific placement of line endings, for example in QCPAxes.
+ +| void QCPLineEnding::draw | +( | +QCPPainter * | +painter, | +
| + | + | const QCPVector2D & | +pos, | +
| + | + | const QCPVector2D & | +dir | +
| + | ) | +const | +
Draws the line ending with the specified painter at the position pos. The direction of the line ending is controlled with dir.
+ +| void QCPLineEnding::draw | +( | +QCPPainter * | +painter, | +
| + | + | const QCPVector2D & | +pos, | +
| + | + | double | +angle | +
| + | ) | +const | +
This is an overloaded function.
+Draws the line ending. The direction is controlled with the angle parameter in radians.
+ +A margin group allows synchronization of margin sides if working with multiple layout elements. + More...
+ +Inherits QObject.
++Public Functions | |
| QCPMarginGroup (QCustomPlot *parentPlot) | |
| QList< QCPLayoutElement * > | elements (QCP::MarginSide side) const |
| bool | isEmpty () const |
| void | clear () |
+Protected Functions | |
| virtual int | commonMargin (QCP::MarginSide side) const |
| void | addChild (QCP::MarginSide side, QCPLayoutElement *element) |
| void | removeChild (QCP::MarginSide side, QCPLayoutElement *element) |
A margin group allows synchronization of margin sides if working with multiple layout elements.
+QCPMarginGroup allows you to tie a margin side of two or more layout elements together, such that they will all have the same size, based on the largest required margin in the group.
+
+
+
+ In certain situations it is desirable that margins at specific sides are synchronized across layout elements. For example, if one QCPAxisRect is below another one in a grid layout, it will provide a cleaner look to the user if the left and right margins of the two axis rects are of the same size. The left axis of the top axis rect will then be at the same horizontal position as the left axis of the lower axis rect, making them appear aligned. The same applies for the right axes. This is what QCPMarginGroup makes possible.
To add/remove a specific side of a layout element to/from a margin group, use the QCPLayoutElement::setMarginGroup method. To completely break apart the margin group, either call clear, or just delete the margin group.
+First create a margin group:
Then set this group on the layout element sides:
Here, we've used the first two axis rects of the plot and synchronized their left margins with each other and their right margins with each other.
+
+
|
+ +explicit | +
Creates a new QCPMarginGroup instance in parentPlot.
+ +
+
|
+ +inline | +
Returns a list of all layout elements that have their margin side associated with this margin group.
+ +| bool QCPMarginGroup::isEmpty | +( | +) | +const | +
Returns whether this margin group is empty. If this function returns true, no layout elements use this margin group to synchronize margin sides.
+ +| void QCPMarginGroup::clear | +( | +) | ++ |
Clears this margin group. The synchronization of the margin sides that use this margin group is lifted and they will use their individual margin sizes again.
+ +
+
|
+ +protectedvirtual | +
Returns the synchronized common margin for side. This is the margin value that will be used by the layout element on the respective side, if it is part of this margin group.
+The common margin is calculated by requesting the automatic margin (QCPLayoutElement::calculateAutoMargin) of each element associated with side in this margin group, and choosing the largest returned value. (QCPLayoutElement::minimumMargins is taken into account, too.)
+ +
+
|
+ +protected | +
Adds element to the internal list of child elements, for the margin side.
+This function does not modify the margin group property of element.
+ +
+
|
+ +protected | +
Removes element from the internal list of child elements, for the margin side.
+This function does not modify the margin group property of element.
+ +A paint buffer based on OpenGL frame buffers objects, using hardware accelerated rendering. + More...
+
+Public Functions | |
| QCPPaintBufferGlFbo (const QSize &size, double devicePixelRatio, QWeakPointer< QOpenGLContext > glContext, QWeakPointer< QOpenGLPaintDevice > glPaintDevice) | |
| virtual QCPPainter * | startPainting () |
| virtual void | donePainting () |
| virtual void | draw (QCPPainter *painter) const |
| void | clear (const QColor &color) |
Public Functions inherited from QCPAbstractPaintBuffer | |
| QCPAbstractPaintBuffer (const QSize &size, double devicePixelRatio) | |
| +QSize | size () const |
| +bool | invalidated () const |
| +double | devicePixelRatio () const |
| void | setSize (const QSize &size) |
| void | setInvalidated (bool invalidated=true) |
| void | setDevicePixelRatio (double ratio) |
+Protected Functions | |
| virtual void | reallocateBuffer () |
A paint buffer based on OpenGL frame buffers objects, using hardware accelerated rendering.
+This paint buffer is one of the OpenGL paint buffers which facilitate hardware accelerated plot rendering. It is based on OpenGL frame buffer objects (fbo) and is used in Qt versions 5.0 and higher. (See QCPPaintBufferGlPbuffer used in older Qt versions.)
+The OpenGL paint buffers are used if QCustomPlot::setOpenGl is set to true, and if they are supported by the system.
+
+
|
+ +explicit | +
Creates a QCPPaintBufferGlFbo instance with the specified size and devicePixelRatio, if applicable.
+All frame buffer objects shall share one OpenGL context and paint device, which need to be set up externally and passed via glContext and glPaintDevice. The set-up is done in QCustomPlot::setupOpenGl and the context and paint device are managed by the parent QCustomPlot instance.
+ +
+
|
+ +virtual | +
Returns a QCPPainter which is ready to draw to this buffer. The ownership and thus the responsibility to delete the painter after the painting operations are complete is given to the caller of this method.
+Once you are done using the painter, delete the painter and call donePainting.
+While a painter generated with this method is active, you must not call setSize, setDevicePixelRatio or clear.
+This method may return 0, if a painter couldn't be activated on the buffer. This usually indicates a problem with the respective painting backend.
+ +Implements QCPAbstractPaintBuffer.
+ +
+
|
+ +virtual | +
If you have acquired a QCPPainter to paint onto this paint buffer via startPainting, call this method as soon as you are done with the painting operations and have deleted the painter.
+paint buffer subclasses may use this method to perform any type of cleanup that is necessary. The default implementation does nothing.
+ +Reimplemented from QCPAbstractPaintBuffer.
+ +
+
|
+ +virtual | +
Draws the contents of this buffer with the provided painter. This is the method that is used to finally join all paint buffers and draw them onto the screen.
+ +Implements QCPAbstractPaintBuffer.
+ +
+
|
+ +virtual | +
Fills the entire buffer with the provided color. To have an empty transparent buffer, use the named color Qt::transparent.
This method must not be called if there is currently a painter (acquired with startPainting) active.
+ +Implements QCPAbstractPaintBuffer.
+ +
+
|
+ +protectedvirtual | +
Reallocates the internal buffer with the currently configured size (setSize) and device pixel ratio, if applicable (setDevicePixelRatio). It is called as soon as any of those properties are changed on this paint buffer.
+Implements QCPAbstractPaintBuffer.
+ +A paint buffer based on OpenGL pixel buffers, using hardware accelerated rendering. + More...
+
+Public Functions | |
| QCPPaintBufferGlPbuffer (const QSize &size, double devicePixelRatio, int multisamples) | |
| virtual QCPPainter * | startPainting () |
| virtual void | draw (QCPPainter *painter) const |
| void | clear (const QColor &color) |
Public Functions inherited from QCPAbstractPaintBuffer | |
| QCPAbstractPaintBuffer (const QSize &size, double devicePixelRatio) | |
| +QSize | size () const |
| +bool | invalidated () const |
| +double | devicePixelRatio () const |
| void | setSize (const QSize &size) |
| void | setInvalidated (bool invalidated=true) |
| void | setDevicePixelRatio (double ratio) |
| virtual void | donePainting () |
+Protected Functions | |
| virtual void | reallocateBuffer () |
A paint buffer based on OpenGL pixel buffers, using hardware accelerated rendering.
+This paint buffer is one of the OpenGL paint buffers which facilitate hardware accelerated plot rendering. It is based on OpenGL pixel buffers (pbuffer) and is used in Qt versions before 5.0. (See QCPPaintBufferGlFbo used in newer Qt versions.)
+The OpenGL paint buffers are used if QCustomPlot::setOpenGl is set to true, and if they are supported by the system.
+
+
|
+ +explicit | +
Creates a QCPPaintBufferGlPbuffer instance with the specified size and devicePixelRatio, if applicable.
+The parameter multisamples defines how many samples are used per pixel. Higher values thus result in higher quality antialiasing. If the specified multisamples value exceeds the capability of the graphics hardware, the highest supported multisampling is used.
+ +
+
|
+ +virtual | +
Returns a QCPPainter which is ready to draw to this buffer. The ownership and thus the responsibility to delete the painter after the painting operations are complete is given to the caller of this method.
+Once you are done using the painter, delete the painter and call donePainting.
+While a painter generated with this method is active, you must not call setSize, setDevicePixelRatio or clear.
+This method may return 0, if a painter couldn't be activated on the buffer. This usually indicates a problem with the respective painting backend.
+ +Implements QCPAbstractPaintBuffer.
+ +
+
|
+ +virtual | +
Draws the contents of this buffer with the provided painter. This is the method that is used to finally join all paint buffers and draw them onto the screen.
+ +Implements QCPAbstractPaintBuffer.
+ +
+
|
+ +virtual | +
Fills the entire buffer with the provided color. To have an empty transparent buffer, use the named color Qt::transparent.
This method must not be called if there is currently a painter (acquired with startPainting) active.
+ +Implements QCPAbstractPaintBuffer.
+ +
+
|
+ +protectedvirtual | +
Reallocates the internal buffer with the currently configured size (setSize) and device pixel ratio, if applicable (setDevicePixelRatio). It is called as soon as any of those properties are changed on this paint buffer.
+Implements QCPAbstractPaintBuffer.
+ +A paint buffer based on QPixmap, using software raster rendering. + More...
+
+Public Functions | |
| QCPPaintBufferPixmap (const QSize &size, double devicePixelRatio) | |
| virtual QCPPainter * | startPainting () |
| virtual void | draw (QCPPainter *painter) const |
| void | clear (const QColor &color) |
Public Functions inherited from QCPAbstractPaintBuffer | |
| QCPAbstractPaintBuffer (const QSize &size, double devicePixelRatio) | |
| +QSize | size () const |
| +bool | invalidated () const |
| +double | devicePixelRatio () const |
| void | setSize (const QSize &size) |
| void | setInvalidated (bool invalidated=true) |
| void | setDevicePixelRatio (double ratio) |
| virtual void | donePainting () |
+Protected Functions | |
| virtual void | reallocateBuffer () |
A paint buffer based on QPixmap, using software raster rendering.
+This paint buffer is the default and fall-back paint buffer which uses software rendering and QPixmap as internal buffer. It is used if QCustomPlot::setOpenGl is false.
+
+
|
+ +explicit | +
Creates a pixmap paint buffer instancen with the specified size and devicePixelRatio, if applicable.
+ +
+
|
+ +virtual | +
Returns a QCPPainter which is ready to draw to this buffer. The ownership and thus the responsibility to delete the painter after the painting operations are complete is given to the caller of this method.
+Once you are done using the painter, delete the painter and call donePainting.
+While a painter generated with this method is active, you must not call setSize, setDevicePixelRatio or clear.
+This method may return 0, if a painter couldn't be activated on the buffer. This usually indicates a problem with the respective painting backend.
+ +Implements QCPAbstractPaintBuffer.
+ +
+
|
+ +virtual | +
Draws the contents of this buffer with the provided painter. This is the method that is used to finally join all paint buffers and draw them onto the screen.
+ +Implements QCPAbstractPaintBuffer.
+ +
+
|
+ +virtual | +
Fills the entire buffer with the provided color. To have an empty transparent buffer, use the named color Qt::transparent.
This method must not be called if there is currently a painter (acquired with startPainting) active.
+ +Implements QCPAbstractPaintBuffer.
+ +
+
|
+ +protectedvirtual | +
Reallocates the internal buffer with the currently configured size (setSize) and device pixel ratio, if applicable (setDevicePixelRatio). It is called as soon as any of those properties are changed on this paint buffer.
+Implements QCPAbstractPaintBuffer.
+ +QPainter subclass used internally. + More...
+ +Inherits QPainter.
++Public Types | |
| enum | PainterMode |
+Public Functions | |
| QCPPainter () | |
| QCPPainter (QPaintDevice *device) | |
| +bool | antialiasing () const |
| +PainterModes | modes () const |
| void | setAntialiasing (bool enabled) |
| void | setMode (PainterMode mode, bool enabled=true) |
| void | setModes (PainterModes modes) |
| bool | begin (QPaintDevice *device) |
| void | setPen (const QPen &pen) |
| void | setPen (const QColor &color) |
| void | setPen (Qt::PenStyle penStyle) |
| void | drawLine (const QLineF &line) |
| +void | drawLine (const QPointF &p1, const QPointF &p2) |
| void | save () |
| void | restore () |
| void | makeNonCosmetic () |
QPainter subclass used internally.
+This QPainter subclass is used to provide some extended functionality e.g. for tweaking position consistency between antialiased and non-antialiased painting. Further it provides workarounds for QPainter quirks.
+| enum QCPPainter::PainterMode | +
Defines special modes the painter can operate in. They disable or enable certain subsets of features/fixes/workarounds, depending on whether they are wanted on the respective output device.
+| QCPPainter::QCPPainter | +( | +) | ++ |
Creates a new QCPPainter instance and sets default values
+ +
+
|
+ +explicit | +
Creates a new QCPPainter instance on the specified paint device and sets default values. Just like the analogous QPainter constructor, begins painting on device immediately.
+Like begin, this method sets QPainter::NonCosmeticDefaultPen in Qt versions before Qt5.
+ +| void QCPPainter::setAntialiasing | +( | +bool | +enabled | ) | ++ |
Sets whether painting uses antialiasing or not. Use this method instead of using setRenderHint with QPainter::Antialiasing directly, as it allows QCPPainter to regain pixel exactness between antialiased and non-antialiased painting (Since Qt < 5.0 uses slightly different coordinate systems for AA/Non-AA painting).
+ +| void QCPPainter::setMode | +( | +QCPPainter::PainterMode | +mode, | +
| + | + | bool | +enabled = true |
+
| + | ) | ++ |
This is an overloaded function.
+Sets the mode of the painter. This controls whether the painter shall adjust its fixes/workarounds optimized for certain output devices.
+ +| void QCPPainter::setModes | +( | +PainterModes | +modes | ) | ++ |
Sets the mode of the painter. This controls whether the painter shall adjust its fixes/workarounds optimized for certain output devices.
+ +| bool QCPPainter::begin | +( | +QPaintDevice * | +device | ) | ++ |
Sets the QPainter::NonCosmeticDefaultPen in Qt versions before Qt5 after beginning painting on device. This is necessary to get cosmetic pen consistency across Qt versions, because since Qt5, all pens are non-cosmetic by default, and in Qt4 this render hint must be set to get that behaviour.
+The Constructor QCPPainter(QPaintDevice *device) which directly starts painting also sets the render hint as appropriate.
+| void QCPPainter::setPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen of the painter and applies certain fixes to it, depending on the mode of this QCPPainter.
+| void QCPPainter::setPen | +( | +const QColor & | +color | ) | ++ |
This is an overloaded function.
+Sets the pen (by color) of the painter and applies certain fixes to it, depending on the mode of this QCPPainter.
+| void QCPPainter::setPen | +( | +Qt::PenStyle | +penStyle | ) | ++ |
This is an overloaded function.
+Sets the pen (by style) of the painter and applies certain fixes to it, depending on the mode of this QCPPainter.
+| void QCPPainter::drawLine | +( | +const QLineF & | +line | ) | ++ |
This is an overloaded function.
+Works around a Qt bug introduced with Qt 4.8 which makes drawing QLineF unpredictable when antialiasing is disabled. Thus when antialiasing is disabled, it rounds the line to integer coordinates and then passes it to the original drawLine.
+| void QCPPainter::save | +( | +) | ++ |
Saves the painter (see QPainter::save). Since QCPPainter adds some new internal state to QPainter, the save/restore functions are reimplemented to also save/restore those members.
+| void QCPPainter::restore | +( | +) | ++ |
Restores the painter (see QPainter::restore). Since QCPPainter adds some new internal state to QPainter, the save/restore functions are reimplemented to also save/restore those members.
+| void QCPPainter::makeNonCosmetic | +( | +) | ++ |
Changes the pen width to 1 if it currently is 0. This function is called in the setPen overrides when the pmNonCosmetic mode is set.
+ +Defines an abstract interface for one-dimensional plottables. + More...
+
+Public Functions | |
| virtual int | dataCount () const =0 |
| virtual double | dataMainKey (int index) const =0 |
| virtual double | dataSortKey (int index) const =0 |
| virtual double | dataMainValue (int index) const =0 |
| virtual QCPRange | dataValueRange (int index) const =0 |
| virtual QPointF | dataPixelPosition (int index) const =0 |
| virtual bool | sortKeyIsMainKey () const =0 |
| virtual QCPDataSelection | selectTestRect (const QRectF &rect, bool onlySelectable) const =0 |
| virtual int | findBegin (double sortKey, bool expandedRange=true) const =0 |
| virtual int | findEnd (double sortKey, bool expandedRange=true) const =0 |
Defines an abstract interface for one-dimensional plottables.
+This class contains only pure virtual methods which define a common interface to the data of one-dimensional plottables.
+For example, it is implemented by the template class QCPAbstractPlottable1D (the preferred base class for one-dimensional plottables). So if you use that template class as base class of your one-dimensional plottable, you won't have to care about implementing the 1d interface yourself.
+If your plottable doesn't derive from QCPAbstractPlottable1D but still wants to provide a 1d interface (e.g. like QCPErrorBars does), you should inherit from both QCPAbstractPlottable and QCPPlottableInterface1D and accordingly reimplement the pure virtual methods of the 1d interface, matching your data container. Also, reimplement QCPAbstractPlottable::interface1D to return the this pointer.
If you have a QCPAbstractPlottable pointer, you can check whether it implements this interface by calling QCPAbstractPlottable::interface1D and testing it for a non-zero return value. If it indeed implements this interface, you may use it to access the plottable's data without needing to know the exact type of the plottable or its data point type.
+
+
|
+ +pure virtual | +
Returns the number of data points of the plottable.
+ +Implemented in QCPErrorBars, QCPAbstractPlottable1D< DataType >, QCPAbstractPlottable1D< QCPFinancialData >, QCPAbstractPlottable1D< QCPStatisticalBoxData >, QCPAbstractPlottable1D< QCPGraphData >, QCPAbstractPlottable1D< QCPBarsData >, and QCPAbstractPlottable1D< QCPCurveData >.
+ +
+
|
+ +pure virtual | +
Returns the main key of the data point at the given index.
+What the main key is, is defined by the plottable's data type. See the QCPDataContainer DataType documentation for details about this naming convention.
+ +Implemented in QCPErrorBars, QCPAbstractPlottable1D< DataType >, QCPAbstractPlottable1D< QCPFinancialData >, QCPAbstractPlottable1D< QCPStatisticalBoxData >, QCPAbstractPlottable1D< QCPGraphData >, QCPAbstractPlottable1D< QCPBarsData >, and QCPAbstractPlottable1D< QCPCurveData >.
+ +
+
|
+ +pure virtual | +
Returns the sort key of the data point at the given index.
+What the sort key is, is defined by the plottable's data type. See the QCPDataContainer DataType documentation for details about this naming convention.
+ +Implemented in QCPErrorBars, QCPAbstractPlottable1D< DataType >, QCPAbstractPlottable1D< QCPFinancialData >, QCPAbstractPlottable1D< QCPStatisticalBoxData >, QCPAbstractPlottable1D< QCPGraphData >, QCPAbstractPlottable1D< QCPBarsData >, and QCPAbstractPlottable1D< QCPCurveData >.
+ +
+
|
+ +pure virtual | +
Returns the main value of the data point at the given index.
+What the main value is, is defined by the plottable's data type. See the QCPDataContainer DataType documentation for details about this naming convention.
+ +Implemented in QCPErrorBars, QCPAbstractPlottable1D< DataType >, QCPAbstractPlottable1D< QCPFinancialData >, QCPAbstractPlottable1D< QCPStatisticalBoxData >, QCPAbstractPlottable1D< QCPGraphData >, QCPAbstractPlottable1D< QCPBarsData >, and QCPAbstractPlottable1D< QCPCurveData >.
+ +
+
|
+ +pure virtual | +
Returns the value range of the data point at the given index.
+What the value range is, is defined by the plottable's data type. See the QCPDataContainer DataType documentation for details about this naming convention.
+ +Implemented in QCPErrorBars, QCPAbstractPlottable1D< DataType >, QCPAbstractPlottable1D< QCPFinancialData >, QCPAbstractPlottable1D< QCPStatisticalBoxData >, QCPAbstractPlottable1D< QCPGraphData >, QCPAbstractPlottable1D< QCPBarsData >, and QCPAbstractPlottable1D< QCPCurveData >.
+ +
+
|
+ +pure virtual | +
Returns the pixel position on the widget surface at which the data point at the given index appears.
+Usually this corresponds to the point of dataMainKey/dataMainValue, in pixel coordinates. However, depending on the plottable, this might be a different apparent position than just a coord-to-pixel transform of those values. For example, QCPBars apparent data values can be shifted depending on their stacking, bar grouping or configured base value.
+ +Implemented in QCPBars, QCPErrorBars, QCPAbstractPlottable1D< DataType >, QCPAbstractPlottable1D< QCPFinancialData >, QCPAbstractPlottable1D< QCPStatisticalBoxData >, QCPAbstractPlottable1D< QCPGraphData >, QCPAbstractPlottable1D< QCPBarsData >, and QCPAbstractPlottable1D< QCPCurveData >.
+ +
+
|
+ +pure virtual | +
Returns whether the sort key (dataSortKey) is identical to the main key (dataMainKey).
+What the sort and main keys are, is defined by the plottable's data type. See the QCPDataContainer DataType documentation for details about this naming convention.
+ +Implemented in QCPErrorBars, QCPAbstractPlottable1D< DataType >, QCPAbstractPlottable1D< QCPFinancialData >, QCPAbstractPlottable1D< QCPStatisticalBoxData >, QCPAbstractPlottable1D< QCPGraphData >, QCPAbstractPlottable1D< QCPBarsData >, and QCPAbstractPlottable1D< QCPCurveData >.
+ +
+
|
+ +pure virtual | +
Returns a data selection containing all the data points of this plottable which are contained (or hit by) rect. This is used mainly in the selection rect interaction for data selection (data selection mechanism).
+If onlySelectable is true, an empty QCPDataSelection is returned if this plottable is not selectable (i.e. if QCPAbstractPlottable::setSelectable is QCP::stNone).
+QRect::normalized() when passing a rect which might not be normalized. Implemented in QCPBars, QCPFinancial, QCPErrorBars, QCPStatisticalBox, QCPAbstractPlottable1D< DataType >, QCPAbstractPlottable1D< QCPFinancialData >, QCPAbstractPlottable1D< QCPStatisticalBoxData >, QCPAbstractPlottable1D< QCPGraphData >, QCPAbstractPlottable1D< QCPBarsData >, and QCPAbstractPlottable1D< QCPCurveData >.
+ +
+
|
+ +pure virtual | +
Returns the index of the data point with a (sort-)key that is equal to, just below, or just above sortKey. If expandedRange is true, the data point just below sortKey will be considered, otherwise the one just above.
+This can be used in conjunction with findEnd to iterate over data points within a given key range, including or excluding the bounding data points that are just beyond the specified range.
+If expandedRange is true but there are no data points below sortKey, 0 is returned.
+If the container is empty, returns 0 (in that case, findEnd will also return 0, so a loop using these methods will not iterate over the index 0).
+Implemented in QCPErrorBars, QCPAbstractPlottable1D< DataType >, QCPAbstractPlottable1D< QCPFinancialData >, QCPAbstractPlottable1D< QCPStatisticalBoxData >, QCPAbstractPlottable1D< QCPGraphData >, QCPAbstractPlottable1D< QCPBarsData >, and QCPAbstractPlottable1D< QCPCurveData >.
+ +
+
|
+ +pure virtual | +
Returns the index one after the data point with a (sort-)key that is equal to, just above, or just below sortKey. If expandedRange is true, the data point just above sortKey will be considered, otherwise the one just below.
+This can be used in conjunction with findBegin to iterate over data points within a given key range, including the bounding data points that are just below and above the specified range.
+If expandedRange is true but there are no data points above sortKey, the index just above the highest data point is returned.
+If the container is empty, returns 0.
+Implemented in QCPErrorBars, QCPAbstractPlottable1D< DataType >, QCPAbstractPlottable1D< QCPFinancialData >, QCPAbstractPlottable1D< QCPStatisticalBoxData >, QCPAbstractPlottable1D< QCPGraphData >, QCPAbstractPlottable1D< QCPBarsData >, and QCPAbstractPlottable1D< QCPCurveData >.
+ +A legend item representing a plottable with an icon and the plottable name. + More...
+
+Public Functions | |
| QCPPlottableLegendItem (QCPLegend *parent, QCPAbstractPlottable *plottable) | |
| +QCPAbstractPlottable * | plottable () |
Public Functions inherited from QCPAbstractLegendItem | |
| QCPAbstractLegendItem (QCPLegend *parent) | |
| +QCPLegend * | parentLegend () const |
| +QFont | font () const |
| +QColor | textColor () const |
| +QFont | selectedFont () const |
| +QColor | selectedTextColor () const |
| +bool | selectable () const |
| +bool | selected () const |
| void | setFont (const QFont &font) |
| void | setTextColor (const QColor &color) |
| void | setSelectedFont (const QFont &font) |
| void | setSelectedTextColor (const QColor &color) |
| Q_SLOT void | setSelectable (bool selectable) |
| Q_SLOT void | setSelected (bool selected) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
Public Functions inherited from QCPLayoutElement | |
| QCPLayoutElement (QCustomPlot *parentPlot=0) | |
| QCPLayout * | layout () const |
| QRect | rect () const |
| QRect | outerRect () const |
| +QMargins | margins () const |
| +QMargins | minimumMargins () const |
| +QCP::MarginSides | autoMargins () const |
| +QSize | minimumSize () const |
| +QSize | maximumSize () const |
| +SizeConstraintRect | sizeConstraintRect () const |
| +QCPMarginGroup * | marginGroup (QCP::MarginSide side) const |
| +QHash< QCP::MarginSide, QCPMarginGroup * > | marginGroups () const |
| void | setOuterRect (const QRect &rect) |
| void | setMargins (const QMargins &margins) |
| void | setMinimumMargins (const QMargins &margins) |
| void | setAutoMargins (QCP::MarginSides sides) |
| void | setMinimumSize (const QSize &size) |
| void | setMinimumSize (int width, int height) |
| void | setMaximumSize (const QSize &size) |
| void | setMaximumSize (int width, int height) |
| void | setSizeConstraintRect (SizeConstraintRect constraintRect) |
| void | setMarginGroup (QCP::MarginSides sides, QCPMarginGroup *group) |
| virtual void | update (UpdatePhase phase) |
| virtual QSize | maximumOuterSizeHint () const |
| virtual QList< QCPLayoutElement * > | elements (bool recursive) const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Protected Functions | |
| virtual void | draw (QCPPainter *painter) |
| virtual QSize | minimumOuterSizeHint () const |
| QPen | getIconBorderPen () const |
| QColor | getTextColor () const |
| QFont | getFont () const |
Protected Functions inherited from QCPAbstractLegendItem | |
| virtual QCP::Interaction | selectionCategory () const |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual QRect | clipRect () const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
Protected Functions inherited from QCPLayoutElement | |
| virtual int | calculateAutoMargin (QCP::MarginSide side) |
| virtual void | layoutChanged () |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
Protected Functions inherited from QCPLayerable | |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Additional Inherited Members | |
Public Types inherited from QCPLayoutElement | |
| enum | UpdatePhase |
| enum | SizeConstraintRect |
Signals inherited from QCPAbstractLegendItem | |
| void | selectionChanged (bool selected) |
| +void | selectableChanged (bool selectable) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
A legend item representing a plottable with an icon and the plottable name.
+This is the standard legend item for plottables. It displays an icon of the plottable next to the plottable name. The icon is drawn by the respective plottable itself (QCPAbstractPlottable::drawLegendIcon), and tries to give an intuitive symbol for the plottable. For example, the QCPGraph draws a centered horizontal line and/or a single scatter point in the middle.
+Legend items of this type are always associated with one plottable (retrievable via the plottable() function and settable with the constructor). You may change the font of the plottable name with setFont. Icon padding and border pen is taken from the parent QCPLegend, see QCPLegend::setIconBorderPen and QCPLegend::setIconTextPadding.
+The function QCPAbstractPlottable::addToLegend/QCPAbstractPlottable::removeFromLegend creates/removes legend items of this type.
+Since QCPLegend is based on QCPLayoutGrid, a legend item itself is just a subclass of QCPLayoutElement. While it could be added to a legend (or any other layout) via the normal layout interface, QCPLegend has specialized functions for handling legend items conveniently, see the documentation of QCPLegend.
+| QCPPlottableLegendItem::QCPPlottableLegendItem | +( | +QCPLegend * | +parent, | +
| + | + | QCPAbstractPlottable * | +plottable | +
| + | ) | ++ |
Creates a new legend item associated with plottable.
+Once it's created, it can be added to the legend via QCPLegend::addItem.
+A more convenient way of adding/removing a plottable to/from the legend is via the functions QCPAbstractPlottable::addToLegend and QCPAbstractPlottable::removeFromLegend.
+ +
+
|
+ +protectedvirtual | +
Draws the item with painter. The size and position of the drawn legend item is defined by the parent layout (typically a QCPLegend) and the minimumOuterSizeHint and maximumOuterSizeHint of this legend item.
+ +Implements QCPAbstractLegendItem.
+ +
+
|
+ +protectedvirtual | +
Calculates and returns the size of this item. This includes the icon, the text and the padding in between.
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPLayoutElement.
+ +
+
|
+ +protected | +
Returns the pen that shall be used to draw the icon border, taking into account the selection state of this item.
+ +
+
|
+ +protected | +
Returns the text color that shall be used to draw text, taking into account the selection state of this item.
+ +
+
|
+ +protected | +
Returns the font that shall be used to draw text, taking into account the selection state of this item.
+ +Represents the range an axis is encompassing. + More...
++Public Functions | |
| QCPRange () | |
| QCPRange (double lower, double upper) | |
| +bool | operator== (const QCPRange &other) const |
| +bool | operator!= (const QCPRange &other) const |
| QCPRange & | operator+= (const double &value) |
| QCPRange & | operator-= (const double &value) |
| QCPRange & | operator*= (const double &value) |
| QCPRange & | operator/= (const double &value) |
| double | size () const |
| double | center () const |
| void | normalize () |
| void | expand (const QCPRange &otherRange) |
| void | expand (double includeCoord) |
| QCPRange | expanded (const QCPRange &otherRange) const |
| QCPRange | expanded (double includeCoord) const |
| QCPRange | bounded (double lowerBound, double upperBound) const |
| QCPRange | sanitizedForLogScale () const |
| QCPRange | sanitizedForLinScale () const |
| bool | contains (double value) const |
+Public Members | |
| +double | lower |
| +double | upper |
+Static Public Functions | |
| static bool | validRange (double lower, double upper) |
| static bool | validRange (const QCPRange &range) |
+Static Public Members | |
| static const double | minRange = 1e-280 |
| static const double | maxRange = 1e250 |
+Friends | |
| const QCPRange | operator+ (const QCPRange &, double) |
| const QCPRange | operator+ (double, const QCPRange &) |
| const QCPRange | operator- (const QCPRange &range, double value) |
| const QCPRange | operator* (const QCPRange &range, double value) |
| const QCPRange | operator* (double value, const QCPRange &range) |
| const QCPRange | operator/ (const QCPRange &range, double value) |
+Related Non-Members | |
(Note that these are not member functions.) + | |
| QDebug | operator<< (QDebug d, const QCPRange &range) |
Represents the range an axis is encompassing.
+contains a lower and upper double value and provides convenience input, output and modification functions.
+| QCPRange::QCPRange | +( | +) | ++ |
Constructs a range with lower and upper set to zero.
+ +| QCPRange::QCPRange | +( | +double | +lower, | +
| + | + | double | +upper | +
| + | ) | ++ |
This is an overloaded function.
+Constructs a range with the specified lower and upper values.
+The resulting range will be normalized (see normalize), so if lower is not numerically smaller than upper, they will be swapped.
+ +
+
|
+ +inline | +
Adds value to both boundaries of the range.
+ +
+
|
+ +inline | +
Subtracts value from both boundaries of the range.
+ +
+
|
+ +inline | +
Multiplies both boundaries of the range by value.
+ +
+
|
+ +inline | +
Divides both boundaries of the range by value.
+ +
+
|
+ +inline | +
Returns the size of the range, i.e. upper-lower
+ +
+
|
+ +inline | +
Returns the center of the range, i.e. (upper+lower)*0.5
+ +
+
|
+ +inline | +
Makes sure lower is numerically smaller than upper. If this is not the case, the values are swapped.
+ +| void QCPRange::expand | +( | +const QCPRange & | +otherRange | ) | ++ |
This is an overloaded function.
+Expands this range such that otherRange is contained in the new range. It is assumed that both this range and otherRange are normalized (see normalize).
+If this range contains NaN as lower or upper bound, it will be replaced by the respective bound of otherRange.
+If otherRange is already inside the current range, this function does nothing.
+| void QCPRange::expand | +( | +double | +includeCoord | ) | ++ |
This is an overloaded function.
+Expands this range such that includeCoord is contained in the new range. It is assumed that this range is normalized (see normalize).
+If this range contains NaN as lower or upper bound, the respective bound will be set to includeCoord.
+If includeCoord is already inside the current range, this function does nothing.
+This is an overloaded function.
+Returns an expanded range that contains this and otherRange. It is assumed that both this range and otherRange are normalized (see normalize).
+If this range contains NaN as lower or upper bound, the returned range's bound will be taken from otherRange.
+| QCPRange QCPRange::expanded | +( | +double | +includeCoord | ) | +const | +
| QCPRange QCPRange::bounded | +( | +double | +lowerBound, | +
| + | + | double | +upperBound | +
| + | ) | +const | +
Returns this range, possibly modified to not exceed the bounds provided as lowerBound and upperBound. If possible, the size of the current range is preserved in the process.
+If the range shall only be bounded at the lower side, you can set upperBound to QCPRange::maxRange. If it shall only be bounded at the upper side, set lowerBound to -QCPRange::maxRange.
+ +| QCPRange QCPRange::sanitizedForLogScale | +( | +) | +const | +
Returns a sanitized version of the range. Sanitized means for logarithmic scales, that the range won't span the positive and negative sign domain, i.e. contain zero. Further lower will always be numerically smaller (or equal) to upper.
+If the original range does span positive and negative sign domains or contains zero, the returned range will try to approximate the original range as good as possible. If the positive interval of the original range is wider than the negative interval, the returned range will only contain the positive interval, with lower bound set to rangeFac or rangeFac *upper, whichever is closer to zero. Same procedure is used if the negative interval is wider than the positive interval, this time by changing the upper bound.
+ +| QCPRange QCPRange::sanitizedForLinScale | +( | +) | +const | +
Returns a sanitized version of the range. Sanitized means for linear scales, that lower will always be numerically smaller (or equal) to upper.
+ +
+
|
+ +inline | +
Returns true when value lies within or exactly on the borders of the range.
+ +
+
|
+ +static | +
Checks, whether the specified range is within valid bounds, which are defined as QCPRange::maxRange and QCPRange::minRange. A valid range means:
+
|
+ +static | +
This is an overloaded function. Checks, whether the specified range is within valid bounds, which are defined as QCPRange::maxRange and QCPRange::minRange. A valid range means:
+
|
+ +static | +
Minimum range size (upper - lower) the range changing functions will accept. Smaller intervals would cause errors due to the 11-bit exponent of double precision numbers, corresponding to a minimum magnitude of roughly 1e-308.
+
+
|
+ +static | +
Maximum values (negative and positive) the range will accept in range-changing functions. Larger absolute values would cause errors due to the 11-bit exponent of double precision numbers, corresponding to a maximum magnitude of roughly 1e308.
+
+
|
+ +friend | +
Adds value to both boundaries of the range.
+ +
+
|
+ +friend | +
Adds value to both boundaries of the range.
+ +
+
|
+ +friend | +
Subtracts value from both boundaries of the range.
+ +
+
|
+ +friend | +
Multiplies both boundaries of the range by value.
+ +
+
|
+ +friend | +
Multiplies both boundaries of the range by value.
+ +
+
|
+ +friend | +
Divides both boundaries of the range by value.
+ +
+
|
+ +related | +
Prints range in a human readable format to the qDebug output.
+ +Represents the visual appearance of scatter points. + More...
++Public Types | |
| enum | ScatterProperty |
| enum | ScatterShape |
+Public Functions | |
| QCPScatterStyle () | |
| QCPScatterStyle (ScatterShape shape, double size=6) | |
| QCPScatterStyle (ScatterShape shape, const QColor &color, double size) | |
| QCPScatterStyle (ScatterShape shape, const QColor &color, const QColor &fill, double size) | |
| QCPScatterStyle (ScatterShape shape, const QPen &pen, const QBrush &brush, double size) | |
| QCPScatterStyle (const QPixmap &pixmap) | |
| QCPScatterStyle (const QPainterPath &customPath, const QPen &pen, const QBrush &brush=Qt::NoBrush, double size=6) | |
| +double | size () const |
| +ScatterShape | shape () const |
| +QPen | pen () const |
| +QBrush | brush () const |
| +QPixmap | pixmap () const |
| +QPainterPath | customPath () const |
| void | setFromOther (const QCPScatterStyle &other, ScatterProperties properties) |
| void | setSize (double size) |
| void | setShape (ScatterShape shape) |
| void | setPen (const QPen &pen) |
| void | setBrush (const QBrush &brush) |
| void | setPixmap (const QPixmap &pixmap) |
| void | setCustomPath (const QPainterPath &customPath) |
| bool | isNone () const |
| bool | isPenDefined () const |
| void | undefinePen () |
| void | applyTo (QCPPainter *painter, const QPen &defaultPen) const |
| void | drawShape (QCPPainter *painter, const QPointF &pos) const |
| void | drawShape (QCPPainter *painter, double x, double y) const |
Represents the visual appearance of scatter points.
+This class holds information about shape, color and size of scatter points. In plottables like QCPGraph it is used to store how scatter points shall be drawn. For example, QCPGraph::setScatterStyle takes a QCPScatterStyle instance.
+A scatter style consists of a shape (setShape), a line color (setPen) and possibly a fill (setBrush), if the shape provides a fillable area. Further, the size of the shape can be controlled with setSize.
+You can set all these configurations either by calling the respective functions on an instance:
Or you can use one of the various constructors that take different parameter combinations, making it easy to specify a scatter style in a single call, like so:
There are two constructors which leave the pen undefined: QCPScatterStyle() and QCPScatterStyle(ScatterShape shape, double size). If those constructors are used, a call to isPenDefined will return false. It leads to scatter points that inherit the pen from the plottable that uses the scatter style. Thus, if such a scatter style is passed to QCPGraph, the line color of the graph (QCPGraph::setPen) will be used by the scatter points. This makes it very convenient to set up typical scatter settings:
+Notice that it wasn't even necessary to explicitly call a QCPScatterStyle constructor. This works because QCPScatterStyle provides a constructor that can transform a ScatterShape directly into a QCPScatterStyle instance (that's the QCPScatterStyle(ScatterShape shape, double size) constructor with a default for size). In those cases, C++ allows directly supplying a ScatterShape, where actually a QCPScatterStyle is expected.
+QCPScatterStyle supports drawing custom shapes and arbitrary pixmaps as scatter points.
+For custom shapes, you can provide a QPainterPath with the desired shape to the setCustomPath function or call the constructor that takes a painter path. The scatter shape will automatically be set to ssCustom.
+For pixmaps, you call setPixmap with the desired QPixmap. Alternatively you can use the constructor that takes a QPixmap. The scatter shape will automatically be set to ssPixmap. Note that setSize does not influence the appearance of the pixmap.
+| enum QCPScatterStyle::ScatterProperty | +
Represents the various properties of a scatter style instance. For example, this enum is used to specify which properties of QCPSelectionDecorator::setScatterStyle will be used when highlighting selected data points.
+Specific scatter properties can be transferred between QCPScatterStyle instances via setFromOther.
+| Enumerator | |
|---|---|
| spNone |
|
| spPen |
|
| spBrush |
|
| spSize |
|
| spShape |
|
| spAll |
|
| enum QCPScatterStyle::ScatterShape | +
Defines the shape used for scatter points.
+On plottables/items that draw scatters, the sizes of these visualizations (with exception of ssDot and ssPixmap) can be controlled with the setSize function. Scatters are drawn with the pen and brush specified with setPen and setBrush.
+| Enumerator | |
|---|---|
| ssNone | no scatter symbols are drawn (e.g. in QCPGraph, data only represented with lines) + |
| ssDot |
+
+
+a single pixel (use ssDisc or ssCircle if you want a round shape with a certain radius) + |
| ssCross |
+
+
+a cross + |
| ssPlus |
+
+
+a plus + |
| ssCircle |
+
+
+a circle + |
| ssDisc |
+
+
+a circle which is filled with the pen's color (not the brush as with ssCircle) + |
| ssSquare |
+
+
+a square + |
| ssDiamond |
+
+
+a diamond + |
| ssStar |
+
+
+a star with eight arms, i.e. a combination of cross and plus + |
| ssTriangle |
+
+
+an equilateral triangle, standing on baseline + |
| ssTriangleInverted |
+
+
+an equilateral triangle, standing on corner + |
| ssCrossSquare |
+
+
+a square with a cross inside + |
| ssPlusSquare |
+
+
+a square with a plus inside + |
| ssCrossCircle |
+
+
+a circle with a cross inside + |
| ssPlusCircle |
+
+
+a circle with a plus inside + |
| ssPeace |
+
+
+a circle, with one vertical and two downward diagonal lines + |
| ssPixmap | a custom pixmap specified by setPixmap, centered on the data point coordinates + |
| ssCustom | custom painter operations are performed per scatter (As QPainterPath, see setCustomPath) + |
| QCPScatterStyle::QCPScatterStyle | +( | +) | ++ |
Creates a new QCPScatterStyle instance with size set to 6. No shape, pen or brush is defined.
+Since the pen is undefined (isPenDefined returns false), the scatter color will be inherited from the plottable that uses this scatter style.
+ +| QCPScatterStyle::QCPScatterStyle | +( | +ScatterShape | +shape, | +
| + | + | double | +size = 6 |
+
| + | ) | ++ |
Creates a new QCPScatterStyle instance with shape set to shape and size to size. No pen or brush is defined.
+Since the pen is undefined (isPenDefined returns false), the scatter color will be inherited from the plottable that uses this scatter style.
+ +| QCPScatterStyle::QCPScatterStyle | +( | +ScatterShape | +shape, | +
| + | + | const QColor & | +color, | +
| + | + | double | +size | +
| + | ) | ++ |
Creates a new QCPScatterStyle instance with shape set to shape, the pen color set to color, and size to size. No brush is defined, i.e. the scatter point will not be filled.
+ +| QCPScatterStyle::QCPScatterStyle | +( | +ScatterShape | +shape, | +
| + | + | const QColor & | +color, | +
| + | + | const QColor & | +fill, | +
| + | + | double | +size | +
| + | ) | ++ |
Creates a new QCPScatterStyle instance with shape set to shape, the pen color set to color, the brush color to fill (with a solid pattern), and size to size.
+ +| QCPScatterStyle::QCPScatterStyle | +( | +ScatterShape | +shape, | +
| + | + | const QPen & | +pen, | +
| + | + | const QBrush & | +brush, | +
| + | + | double | +size | +
| + | ) | ++ |
Creates a new QCPScatterStyle instance with shape set to shape, the pen set to pen, the brush to brush, and size to size.
+Qt::NoPen as pen and a color like Qt::blue as brush. Notice however, that the corresponding callQCPScatterStyle(QCPScatterShape::ssCircle, Qt::NoPen, Qt::blue, 5)Qt::NoPen for a QColor and use the QCPScatterStyle(ScatterShape shape, const QColor &color, const QColor &fill, double size) constructor instead (which will lead to an unexpected look of the scatter points). To prevent this, be more explicit with the parameter types. For example, use QBrush(Qt::blue) instead of just Qt::blue, to clearly point out to the compiler that this constructor is wanted. | QCPScatterStyle::QCPScatterStyle | +( | +const QPixmap & | +pixmap | ) | ++ |
Creates a new QCPScatterStyle instance which will show the specified pixmap. The scatter shape is set to ssPixmap.
+ +| QCPScatterStyle::QCPScatterStyle | +( | +const QPainterPath & | +customPath, | +
| + | + | const QPen & | +pen, | +
| + | + | const QBrush & | +brush = Qt::NoBrush, |
+
| + | + | double | +size = 6 |
+
| + | ) | ++ |
Creates a new QCPScatterStyle instance with a custom shape that is defined via customPath. The scatter shape is set to ssCustom.
+The custom shape line will be drawn with pen and filled with brush. The size has a slightly different meaning than for built-in scatter points: The custom path will be drawn scaled by a factor of size/6.0. Since the default size is 6, the custom path will appear in its original size by default. To for example double the size of the path, set size to 12.
+ +| void QCPScatterStyle::setFromOther | +( | +const QCPScatterStyle & | +other, | +
| + | + | ScatterProperties | +properties | +
| + | ) | ++ |
Copies the specified properties from the other scatter style to this scatter style.
+ +| void QCPScatterStyle::setSize | +( | +double | +size | ) | ++ |
Sets the size (pixel diameter) of the drawn scatter points to size.
+| void QCPScatterStyle::setShape | +( | +QCPScatterStyle::ScatterShape | +shape | ) | ++ |
Sets the shape to shape.
+Note that the calls setPixmap and setCustomPath automatically set the shape to ssPixmap and ssCustom, respectively.
+| void QCPScatterStyle::setPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen that will be used to draw scatter points to pen.
+If the pen was previously undefined (see isPenDefined), the pen is considered defined after a call to this function, even if pen is Qt::NoPen. If you have defined a pen previously by calling this function and now wish to undefine the pen, call undefinePen.
| void QCPScatterStyle::setBrush | +( | +const QBrush & | +brush | ) | ++ |
| void QCPScatterStyle::setPixmap | +( | +const QPixmap & | +pixmap | ) | ++ |
| void QCPScatterStyle::setCustomPath | +( | +const QPainterPath & | +customPath | ) | ++ |
Sets the custom shape that will be drawn as scatter point to customPath.
+The scatter shape is automatically set to ssCustom.
+ +
+
|
+ +inline | +
+
|
+ +inline | +
Returns whether a pen has been defined for this scatter style.
+The pen is undefined if a constructor is called that does not carry pen as parameter. Those are QCPScatterStyle() and QCPScatterStyle(ScatterShape shape, double size). If the pen is undefined, the pen of the respective plottable will be used for drawing scatters.
+If a pen was defined for this scatter style instance, and you now wish to undefine the pen, call undefinePen.
+| void QCPScatterStyle::undefinePen | +( | +) | ++ |
Sets this scatter style to have an undefined pen (see isPenDefined for what an undefined pen implies).
+A call to setPen will define a pen.
+ +| void QCPScatterStyle::applyTo | +( | +QCPPainter * | +painter, | +
| + | + | const QPen & | +defaultPen | +
| + | ) | +const | +
Applies the pen and the brush of this scatter style to painter. If this scatter style has an undefined pen (isPenDefined), sets the pen of painter to defaultPen instead.
+This function is used by plottables (or any class that wants to draw scatters) just before a number of scatters with this style shall be drawn with the painter.
+| void QCPScatterStyle::drawShape | +( | +QCPPainter * | +painter, | +
| + | + | const QPointF & | +pos | +
| + | ) | +const | +
| void QCPScatterStyle::drawShape | +( | +QCPPainter * | +painter, | +
| + | + | double | +x, | +
| + | + | double | +y | +
| + | ) | +const | +
This is an overloaded function. Draws the scatter shape with painter at position x and y.
+ +Controls how a plottable's data selection is drawn. + More...
+
+Public Functions | |
| QCPSelectionDecorator () | |
| +QPen | pen () const |
| +QBrush | brush () const |
| +QCPScatterStyle | scatterStyle () const |
| +QCPScatterStyle::ScatterProperties | usedScatterProperties () const |
| void | setPen (const QPen &pen) |
| void | setBrush (const QBrush &brush) |
| void | setScatterStyle (const QCPScatterStyle &scatterStyle, QCPScatterStyle::ScatterProperties usedProperties=QCPScatterStyle::spPen) |
| void | setUsedScatterProperties (const QCPScatterStyle::ScatterProperties &properties) |
| void | applyPen (QCPPainter *painter) const |
| void | applyBrush (QCPPainter *painter) const |
| QCPScatterStyle | getFinalScatterStyle (const QCPScatterStyle &unselectedStyle) const |
| virtual void | copyFrom (const QCPSelectionDecorator *other) |
| virtual void | drawDecoration (QCPPainter *painter, QCPDataSelection selection) |
+Protected Functions | |
| virtual bool | registerWithPlottable (QCPAbstractPlottable *plottable) |
Controls how a plottable's data selection is drawn.
+Each QCPAbstractPlottable instance has one QCPSelectionDecorator (accessible via QCPAbstractPlottable::selectionDecorator) and uses it when drawing selected segments of its data.
+The selection decorator controls both pen (setPen) and brush (setBrush), as well as the scatter style (setScatterStyle) if the plottable draws scatters. Since a QCPScatterStyle is itself composed of different properties such as color shape and size, the decorator allows specifying exactly which of those properties shall be used for the selected data point, via setUsedScatterProperties.
+A QCPSelectionDecorator subclass instance can be passed to a plottable via QCPAbstractPlottable::setSelectionDecorator, allowing greater customizability of the appearance of selected segments.
+Use copyFrom to easily transfer the settings of one decorator to another one. This is especially useful since plottables take ownership of the passed selection decorator, and thus the same decorator instance can not be passed to multiple plottables.
+Selection decorators can also themselves perform drawing operations by reimplementing drawDecoration, which is called by the plottable's draw method. The base class QCPSelectionDecorator does not make use of this however. For example, QCPSelectionDecoratorBracket draws brackets around selected data segments.
+| QCPSelectionDecorator::QCPSelectionDecorator | +( | +) | ++ |
Creates a new QCPSelectionDecorator instance with default values
+ +| void QCPSelectionDecorator::setPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen that will be used by the parent plottable to draw selected data segments.
+ +| void QCPSelectionDecorator::setBrush | +( | +const QBrush & | +brush | ) | ++ |
Sets the brush that will be used by the parent plottable to draw selected data segments.
+ +| void QCPSelectionDecorator::setScatterStyle | +( | +const QCPScatterStyle & | +scatterStyle, | +
| + | + | QCPScatterStyle::ScatterProperties | +usedProperties = QCPScatterStyle::spPen |
+
| + | ) | ++ |
Sets the scatter style that will be used by the parent plottable to draw scatters in selected data segments.
+usedProperties specifies which parts of the passed scatterStyle will be used by the plottable. The used properties can also be changed via setUsedScatterProperties.
+ +| void QCPSelectionDecorator::setUsedScatterProperties | +( | +const QCPScatterStyle::ScatterProperties & | +properties | ) | ++ |
Use this method to define which properties of the scatter style (set via setScatterStyle) will be used for selected data segments. All properties of the scatter style that are not specified in properties will remain as specified in the plottable's original scatter style.
+| void QCPSelectionDecorator::applyPen | +( | +QCPPainter * | +painter | ) | +const | +
Sets the pen of painter to the pen of this selection decorator.
+| void QCPSelectionDecorator::applyBrush | +( | +QCPPainter * | +painter | ) | +const | +
Sets the brush of painter to the brush of this selection decorator.
+| QCPScatterStyle QCPSelectionDecorator::getFinalScatterStyle | +( | +const QCPScatterStyle & | +unselectedStyle | ) | +const | +
Returns the scatter style that the parent plottable shall use for selected scatter points. The plottable's original (unselected) scatter style must be passed as unselectedStyle. Depending on the setting of setUsedScatterProperties, the returned scatter style is a mixture of this selecion decorator's scatter style (setScatterStyle), and unselectedStyle.
+
+
|
+ +virtual | +
Copies all properties (e.g. color, fill, scatter style) of the other selection decorator to this selection decorator.
+ +
+
|
+ +virtual | +
This method is called by all plottables' draw methods to allow custom selection decorations to be drawn. Use the passed painter to perform the drawing operations. selection carries the data selection for which the decoration shall be drawn.
+The default base class implementation of QCPSelectionDecorator has no special decoration, so this method does nothing.
+ +Reimplemented in QCPSelectionDecoratorBracket.
+ +
+
|
+ +protectedvirtual | +
This method is called as soon as a selection decorator is associated with a plottable, by a call to QCPAbstractPlottable::setSelectionDecorator. This way the selection decorator can obtain a pointer to the plottable that uses it (e.g. to access data points via the QCPAbstractPlottable::interface1D interface).
+If the selection decorator was already added to a different plottable before, this method aborts the registration and returns false.
+ +A selection decorator which draws brackets around each selected data segment. + More...
+
+Public Types | |
| enum | BracketStyle |
+Public Functions | |
| QCPSelectionDecoratorBracket () | |
| +QPen | bracketPen () const |
| +QBrush | bracketBrush () const |
| +int | bracketWidth () const |
| +int | bracketHeight () const |
| +BracketStyle | bracketStyle () const |
| +bool | tangentToData () const |
| +int | tangentAverage () const |
| void | setBracketPen (const QPen &pen) |
| void | setBracketBrush (const QBrush &brush) |
| void | setBracketWidth (int width) |
| void | setBracketHeight (int height) |
| void | setBracketStyle (BracketStyle style) |
| void | setTangentToData (bool enabled) |
| void | setTangentAverage (int pointCount) |
| virtual void | drawBracket (QCPPainter *painter, int direction) const |
| virtual void | drawDecoration (QCPPainter *painter, QCPDataSelection selection) |
Public Functions inherited from QCPSelectionDecorator | |
| QCPSelectionDecorator () | |
| +QPen | pen () const |
| +QBrush | brush () const |
| +QCPScatterStyle | scatterStyle () const |
| +QCPScatterStyle::ScatterProperties | usedScatterProperties () const |
| void | setPen (const QPen &pen) |
| void | setBrush (const QBrush &brush) |
| void | setScatterStyle (const QCPScatterStyle &scatterStyle, QCPScatterStyle::ScatterProperties usedProperties=QCPScatterStyle::spPen) |
| void | setUsedScatterProperties (const QCPScatterStyle::ScatterProperties &properties) |
| void | applyPen (QCPPainter *painter) const |
| void | applyBrush (QCPPainter *painter) const |
| QCPScatterStyle | getFinalScatterStyle (const QCPScatterStyle &unselectedStyle) const |
| virtual void | copyFrom (const QCPSelectionDecorator *other) |
+Protected Functions | |
| double | getTangentAngle (const QCPPlottableInterface1D *interface1d, int dataIndex, int direction) const |
| QPointF | getPixelCoordinates (const QCPPlottableInterface1D *interface1d, int dataIndex) const |
Protected Functions inherited from QCPSelectionDecorator | |
| virtual bool | registerWithPlottable (QCPAbstractPlottable *plottable) |
A selection decorator which draws brackets around each selected data segment.
+Additionally to the regular highlighting of selected segments via color, fill and scatter style, this QCPSelectionDecorator subclass draws markers at the begin and end of each selected data segment of the plottable.
+The shape of the markers can be controlled with setBracketStyle, setBracketWidth and setBracketHeight. The color/fill can be controlled with setBracketPen and setBracketBrush.
+To introduce custom bracket styles, it is only necessary to sublcass QCPSelectionDecoratorBracket and reimplement drawBracket. The rest will be managed by the base class.
+| enum QCPSelectionDecoratorBracket::BracketStyle | +
Defines which shape is drawn at the boundaries of selected data ranges.
+Some of the bracket styles further allow specifying a height and/or width, see setBracketHeight and setBracketWidth.
+| Enumerator | |
|---|---|
| bsSquareBracket | A square bracket is drawn. + |
| bsHalfEllipse | A half ellipse is drawn. The size of the ellipse is given by the bracket width/height properties. + |
| bsEllipse | An ellipse is drawn. The size of the ellipse is given by the bracket width/height properties. + |
| bsPlus | A plus is drawn. + |
| bsUserStyle | Start custom bracket styles at this index when subclassing and reimplementing drawBracket. + |
| QCPSelectionDecoratorBracket::QCPSelectionDecoratorBracket | +( | +) | ++ |
Creates a new QCPSelectionDecoratorBracket instance with default values.
+ +| void QCPSelectionDecoratorBracket::setBracketPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen that will be used to draw the brackets at the beginning and end of each selected data segment.
+ +| void QCPSelectionDecoratorBracket::setBracketBrush | +( | +const QBrush & | +brush | ) | ++ |
Sets the brush that will be used to draw the brackets at the beginning and end of each selected data segment.
+ +| void QCPSelectionDecoratorBracket::setBracketWidth | +( | +int | +width | ) | ++ |
Sets the width of the drawn bracket. The width dimension is always parallel to the key axis of the data, or the tangent direction of the current data slope, if setTangentToData is enabled.
+ +| void QCPSelectionDecoratorBracket::setBracketHeight | +( | +int | +height | ) | ++ |
Sets the height of the drawn bracket. The height dimension is always perpendicular to the key axis of the data, or the tangent direction of the current data slope, if setTangentToData is enabled.
+ +| void QCPSelectionDecoratorBracket::setBracketStyle | +( | +QCPSelectionDecoratorBracket::BracketStyle | +style | ) | ++ |
Sets the shape that the bracket/marker will have.
+| void QCPSelectionDecoratorBracket::setTangentToData | +( | +bool | +enabled | ) | ++ |
Sets whether the brackets will be rotated such that they align with the slope of the data at the position that they appear in.
+For noisy data, it might be more visually appealing to average the slope over multiple data points. This can be configured via setTangentAverage.
+ +| void QCPSelectionDecoratorBracket::setTangentAverage | +( | +int | +pointCount | ) | ++ |
Controls over how many data points the slope shall be averaged, when brackets shall be aligned with the data (if setTangentToData is true).
+From the position of the bracket, pointCount points towards the selected data range will be taken into account. The smallest value of pointCount is 1, which is effectively equivalent to disabling setTangentToData.
+ +
+
|
+ +virtual | +
Draws the bracket shape with painter. The parameter direction is either -1 or 1 and indicates whether the bracket shall point to the left or the right (i.e. is a closing or opening bracket, respectively).
+The passed painter already contains all transformations that are necessary to position and rotate the bracket appropriately. Painting operations can be performed as if drawing upright brackets on flat data with horizontal key axis, with (0, 0) being the center of the bracket.
+If you wish to sublcass QCPSelectionDecoratorBracket in order to provide custom bracket shapes (see QCPSelectionDecoratorBracket::bsUserStyle), this is the method you should reimplement.
+ +
+
|
+ +virtual | +
Draws the bracket decoration on the data points at the begin and end of each selected data segment given in seletion.
+It uses the method drawBracket to actually draw the shapes.
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPSelectionDecorator.
+ +
+
|
+ +protected | +
If setTangentToData is enabled, brackets need to be rotated according to the data slope. This method returns the angle in radians by which a bracket at the given dataIndex must be rotated.
+The parameter direction must be set to either -1 or 1, representing whether it is an opening or closing bracket. Since for slope calculation multiple data points are required, this defines the direction in which the algorithm walks, starting at dataIndex, to average those data points. (see setTangentToData and setTangentAverage)
+interface1d is the interface to the plottable's data which is used to query data coordinates.
+ +
+
|
+ +protected | +
Returns the pixel coordinates of the data point at dataIndex, using interface1d to access the data points.
+ +Provides rect/rubber-band data selection and range zoom interaction. + More...
+
+Public Functions | |
| QCPSelectionRect (QCustomPlot *parentPlot) | |
| +QRect | rect () const |
| QCPRange | range (const QCPAxis *axis) const |
| +QPen | pen () const |
| +QBrush | brush () const |
| bool | isActive () const |
| void | setPen (const QPen &pen) |
| void | setBrush (const QBrush &brush) |
| Q_SLOT void | cancel () |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
| bool | realVisibility () const |
+Signals | |
| void | started (QMouseEvent *event) |
| void | changed (const QRect &rect, QMouseEvent *event) |
| void | canceled (const QRect &rect, QInputEvent *event) |
| void | accepted (const QRect &rect, QMouseEvent *event) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
+Protected Functions | |
| virtual void | startSelection (QMouseEvent *event) |
| virtual void | moveSelection (QMouseEvent *event) |
| virtual void | endSelection (QMouseEvent *event) |
| virtual void | keyPressEvent (QKeyEvent *event) |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | draw (QCPPainter *painter) |
Protected Functions inherited from QCPLayerable | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual QCP::Interaction | selectionCategory () const |
| virtual QRect | clipRect () const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
Provides rect/rubber-band data selection and range zoom interaction.
+QCPSelectionRect is used by QCustomPlot when the QCustomPlot::setSelectionRectMode is not QCP::srmNone. When the user drags the mouse across the plot, the current selection rect instance (QCustomPlot::setSelectionRect) is forwarded these events and makes sure an according rect shape is drawn. At the begin, during, and after completion of the interaction, it emits the corresponding signals started, changed, canceled, and accepted.
+The QCustomPlot instance connects own slots to the current selection rect instance, in order to react to an accepted selection rect interaction accordingly.
+isActive can be used to check whether the selection rect is currently active. An ongoing selection interaction can be cancelled programmatically via calling cancel at any time.
+The appearance of the selection rect can be controlled via setPen and setBrush.
+If you wish to provide custom behaviour, e.g. a different visual representation of the selection rect (QCPSelectionRect::draw), you can subclass QCPSelectionRect and pass an instance of your subclass to QCustomPlot::setSelectionRect.
+
+
|
+ +explicit | +
Creates a new QCPSelectionRect instance. To make QCustomPlot use the selection rect instance, pass it to QCustomPlot::setSelectionRect. parentPlot should be set to the same QCustomPlot widget.
+ +A convenience function which returns the coordinate range of the provided axis, that this selection rect currently encompasses.
+ +
+
|
+ +inline | +
Returns true if there is currently a selection going on, i.e. the user has started dragging a selection rect, but hasn't released the mouse button yet.
+| void QCPSelectionRect::setPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen that will be used to draw the selection rect outline.
+| void QCPSelectionRect::setBrush | +( | +const QBrush & | +brush | ) | ++ |
Sets the brush that will be used to fill the selection rect. By default the selection rect is not filled, i.e. brush is Qt::NoBrush.
| void QCPSelectionRect::cancel | +( | +) | ++ |
+
|
+ +signal | +
This signal is emitted when a selection rect interaction was initiated, i.e. the user just started dragging the selection rect with the mouse.
+ +
+
|
+ +signal | +
This signal is emitted while the selection rect interaction is ongoing and the rect has changed its size due to the user moving the mouse.
+Note that rect may have a negative width or height, if the selection is being dragged to the upper or left side of the selection rect origin.
+ +
+
|
+ +signal | +
This signal is emitted when the selection interaction was cancelled. Note that event is 0 if the selection interaction was cancelled programmatically, by a call to cancel.
+The user may cancel the selection interaction by pressing the escape key. In this case, event holds the respective input event.
+Note that rect may have a negative width or height, if the selection is being dragged to the upper or left side of the selection rect origin.
+ +
+
|
+ +signal | +
This signal is emitted when the selection interaction was completed by the user releasing the mouse button.
+Note that rect may have a negative width or height, if the selection is being dragged to the upper or left side of the selection rect origin.
+ +
+
|
+ +protectedvirtual | +
This method is called by QCustomPlot to indicate that a selection rect interaction was initiated. The default implementation sets the selection rect to active, initializes the selection rect geometry and emits the started signal.
+ +
+
|
+ +protectedvirtual | +
This method is called by QCustomPlot to indicate that an ongoing selection rect interaction needs to update its geometry. The default implementation updates the rect and emits the changed signal.
+ +
+
|
+ +protectedvirtual | +
This method is called by QCustomPlot to indicate that an ongoing selection rect interaction has finished by the user releasing the mouse button. The default implementation deactivates the selection rect and emits the accepted signal.
+ +
+
|
+ +protectedvirtual | +
This method is called by QCustomPlot when a key has been pressed by the user while the selection rect interaction is active. The default implementation allows to cancel the interaction by hitting the escape key.
+ +
+
|
+ +protectedvirtual | +
This function applies the default antialiasing setting to the specified painter, using the function applyAntialiasingHint. It is the antialiasing state the painter is put in, when draw is called on the layerable. If the layerable has multiple entities whose antialiasing setting may be specified individually, this function should set the antialiasing state of the most prominent entity. In this case however, the draw function usually calls the specialized versions of this function before drawing each entity, effectively overriding the setting of the default antialiasing hint.
+First example: QCPGraph has multiple entities that have an antialiasing setting: The graph line, fills and scatters. Those can be configured via QCPGraph::setAntialiased, QCPGraph::setAntialiasedFill and QCPGraph::setAntialiasedScatters. Consequently, there isn't only the QCPGraph::applyDefaultAntialiasingHint function (which corresponds to the graph line's antialiasing), but specialized ones like QCPGraph::applyFillAntialiasingHint and QCPGraph::applyScattersAntialiasingHint. So before drawing one of those entities, QCPGraph::draw calls the respective specialized applyAntialiasingHint function.
+Second example: QCPItemLine consists only of a line so there is only one antialiasing setting which can be controlled with QCPItemLine::setAntialiased. (This function is inherited by all layerables. The specialized functions, as seen on QCPGraph, must be added explicitly to the respective layerable subclass.) Consequently it only has the normal QCPItemLine::applyDefaultAntialiasingHint. The QCPItemLine::draw function doesn't need to care about setting any antialiasing states, because the default antialiasing hint is already set on the painter when the draw function is called, and that's the state it wants to draw the line with.
+ +Implements QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
If the selection rect is active (isActive), draws the selection rect defined by mRect.
+For general information about this virtual method, see the base class implementation.
+ +Implements QCPLayerable.
+ +A plottable representing a single statistical box in a plot. + More...
+
+Public Functions | |
| QCPStatisticalBox (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
| QSharedPointer< QCPStatisticalBoxDataContainer > | data () const |
| +double | width () const |
| +double | whiskerWidth () const |
| +QPen | whiskerPen () const |
| +QPen | whiskerBarPen () const |
| +bool | whiskerAntialiased () const |
| +QPen | medianPen () const |
| +QCPScatterStyle | outlierStyle () const |
| void | setData (QSharedPointer< QCPStatisticalBoxDataContainer > data) |
| void | setData (const QVector< double > &keys, const QVector< double > &minimum, const QVector< double > &lowerQuartile, const QVector< double > &median, const QVector< double > &upperQuartile, const QVector< double > &maximum, bool alreadySorted=false) |
| void | setWidth (double width) |
| void | setWhiskerWidth (double width) |
| void | setWhiskerPen (const QPen &pen) |
| void | setWhiskerBarPen (const QPen &pen) |
| void | setWhiskerAntialiased (bool enabled) |
| void | setMedianPen (const QPen &pen) |
| void | setOutlierStyle (const QCPScatterStyle &style) |
| void | addData (const QVector< double > &keys, const QVector< double > &minimum, const QVector< double > &lowerQuartile, const QVector< double > &median, const QVector< double > &upperQuartile, const QVector< double > &maximum, bool alreadySorted=false) |
| void | addData (double key, double minimum, double lowerQuartile, double median, double upperQuartile, double maximum, const QVector< double > &outliers=QVector< double >()) |
| virtual QCPDataSelection | selectTestRect (const QRectF &rect, bool onlySelectable) const |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
| virtual QCPRange | getKeyRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const |
| virtual QCPRange | getValueRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const |
Public Functions inherited from QCPAbstractPlottable1D< QCPStatisticalBoxData > | |
| QCPAbstractPlottable1D (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
| virtual int | dataCount () const |
| virtual double | dataMainKey (int index) const |
| virtual double | dataSortKey (int index) const |
| virtual double | dataMainValue (int index) const |
| virtual QCPRange | dataValueRange (int index) const |
| virtual QPointF | dataPixelPosition (int index) const |
| virtual bool | sortKeyIsMainKey () const |
| virtual int | findBegin (double sortKey, bool expandedRange=true) const |
| virtual int | findEnd (double sortKey, bool expandedRange=true) const |
| virtual QCPPlottableInterface1D * | interface1D () |
Public Functions inherited from QCPAbstractPlottable | |
| QCPAbstractPlottable (QCPAxis *keyAxis, QCPAxis *valueAxis) | |
| +QString | name () const |
| +bool | antialiasedFill () const |
| +bool | antialiasedScatters () const |
| +QPen | pen () const |
| +QBrush | brush () const |
| +QCPAxis * | keyAxis () const |
| +QCPAxis * | valueAxis () const |
| +QCP::SelectionType | selectable () const |
| bool | selected () const |
| QCPDataSelection | selection () const |
| QCPSelectionDecorator * | selectionDecorator () const |
| void | setName (const QString &name) |
| void | setAntialiasedFill (bool enabled) |
| void | setAntialiasedScatters (bool enabled) |
| void | setPen (const QPen &pen) |
| void | setBrush (const QBrush &brush) |
| void | setKeyAxis (QCPAxis *axis) |
| void | setValueAxis (QCPAxis *axis) |
| Q_SLOT void | setSelectable (QCP::SelectionType selectable) |
| Q_SLOT void | setSelection (QCPDataSelection selection) |
| void | setSelectionDecorator (QCPSelectionDecorator *decorator) |
| void | coordsToPixels (double key, double value, double &x, double &y) const |
| const QPointF | coordsToPixels (double key, double value) const |
| void | pixelsToCoords (double x, double y, double &key, double &value) const |
| void | pixelsToCoords (const QPointF &pixelPos, double &key, double &value) const |
| void | rescaleAxes (bool onlyEnlarge=false) const |
| void | rescaleKeyAxis (bool onlyEnlarge=false) const |
| void | rescaleValueAxis (bool onlyEnlarge=false, bool inKeyRange=false) const |
| bool | addToLegend (QCPLegend *legend) |
| bool | addToLegend () |
| bool | removeFromLegend (QCPLegend *legend) const |
| bool | removeFromLegend () const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Protected Functions | |
| virtual void | draw (QCPPainter *painter) |
| virtual void | drawLegendIcon (QCPPainter *painter, const QRectF &rect) const |
| virtual void | drawStatisticalBox (QCPPainter *painter, QCPStatisticalBoxDataContainer::const_iterator it, const QCPScatterStyle &outlierStyle) const |
| void | getVisibleDataBounds (QCPStatisticalBoxDataContainer::const_iterator &begin, QCPStatisticalBoxDataContainer::const_iterator &end) const |
| QRectF | getQuartileBox (QCPStatisticalBoxDataContainer::const_iterator it) const |
| QVector< QLineF > | getWhiskerBackboneLines (QCPStatisticalBoxDataContainer::const_iterator it) const |
| QVector< QLineF > | getWhiskerBarLines (QCPStatisticalBoxDataContainer::const_iterator it) const |
Protected Functions inherited from QCPAbstractPlottable1D< QCPStatisticalBoxData > | |
| void | getDataSegments (QList< QCPDataRange > &selectedSegments, QList< QCPDataRange > &unselectedSegments) const |
| void | drawPolyline (QCPPainter *painter, const QVector< QPointF > &lineData) const |
Protected Functions inherited from QCPAbstractPlottable | |
| virtual QRect | clipRect () const |
| virtual QCP::Interaction | selectionCategory () const |
| void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| void | applyFillAntialiasingHint (QCPPainter *painter) const |
| void | applyScattersAntialiasingHint (QCPPainter *painter) const |
Protected Functions inherited from QCPLayerable | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Additional Inherited Members | |
Signals inherited from QCPAbstractPlottable | |
| void | selectionChanged (bool selected) |
| void | selectionChanged (const QCPDataSelection &selection) |
| void | selectableChanged (QCP::SelectionType selectable) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
A plottable representing a single statistical box in a plot.
+
+To plot data, assign it with the setData or addData functions. Alternatively, you can also access and modify the data via the data method, which returns a pointer to the internal QCPStatisticalBoxDataContainer.
+Additionally each data point can itself have a list of outliers, drawn as scatter points at the key coordinate of the respective statistical box data point. They can either be set by using the respective addData method or accessing the individual data points through data, and setting the QVector<double> outliers of the data points directly.
The appearance of each data point box, ranging from the lower to the upper quartile, is controlled via setPen and setBrush. You may change the width of the boxes with setWidth in plot coordinates.
+Each data point's visual representation also consists of two whiskers. Whiskers are the lines which reach from the upper quartile to the maximum, and from the lower quartile to the minimum. The appearance of the whiskers can be modified with: setWhiskerPen, setWhiskerBarPen, setWhiskerWidth. The whisker width is the width of the bar perpendicular to the whisker at the top (for maximum) and bottom (for minimum). If the whisker pen is changed, make sure to set the capStyle to Qt::FlatCap. Otherwise the backbone line might exceed the whisker bars by a few pixels due to the pen cap being not perfectly flat.
The median indicator line inside the box has its own pen, setMedianPen.
+The outlier data points are drawn as normal scatter points. Their look can be controlled with setOutlierStyle
+Like all data representing objects in QCustomPlot, the QCPStatisticalBox is a plottable (QCPAbstractPlottable). So the plottable-interface of QCustomPlot applies (QCustomPlot::plottable, QCustomPlot::removePlottable, etc.)
+Usually, you first create an instance:
which registers it with the QCustomPlot instance of the passed axes. Note that this QCustomPlot instance takes ownership of the plottable, so do not delete it manually but use QCustomPlot::removePlottable() instead. The newly created plottable can be modified, e.g.:
+
|
+ +explicit | +
Constructs a statistical box which uses keyAxis as its key axis ("x") and valueAxis as its value axis ("y"). keyAxis and valueAxis must reside in the same QCustomPlot instance and not have the same orientation. If either of these restrictions is violated, a corresponding message is printed to the debug output (qDebug), the construction is not aborted, though.
+The created QCPStatisticalBox is automatically registered with the QCustomPlot instance inferred from keyAxis. This QCustomPlot instance takes ownership of the QCPStatisticalBox, so do not delete it manually but use QCustomPlot::removePlottable() instead.
+ +
+
|
+ +inline | +
Returns a shared pointer to the internal data storage of type QCPStatisticalBoxDataContainer. You may use it to directly manipulate the data, which may be more convenient and faster than using the regular setData or addData methods.
+ +| void QCPStatisticalBox::setData | +( | +QSharedPointer< QCPStatisticalBoxDataContainer > | +data | ) | ++ |
This is an overloaded function.
+Replaces the current data container with the provided data container.
+Since a QSharedPointer is used, multiple QCPStatisticalBoxes may share the same data container safely. Modifying the data in the container will then affect all statistical boxes that share the container. Sharing can be achieved by simply exchanging the data containers wrapped in shared pointers:
If you do not wish to share containers, but create a copy from an existing container, rather use the QCPDataContainer<DataType>::set method on the statistical box data container directly:
| void QCPStatisticalBox::setData | +( | +const QVector< double > & | +keys, | +
| + | + | const QVector< double > & | +minimum, | +
| + | + | const QVector< double > & | +lowerQuartile, | +
| + | + | const QVector< double > & | +median, | +
| + | + | const QVector< double > & | +upperQuartile, | +
| + | + | const QVector< double > & | +maximum, | +
| + | + | bool | +alreadySorted = false |
+
| + | ) | ++ |
This is an overloaded function.
+Replaces the current data with the provided points in keys, minimum, lowerQuartile, median, upperQuartile and maximum. The provided vectors should have equal length. Else, the number of added points will be the size of the smallest vector.
+If you can guarantee that the passed data points are sorted by keys in ascending order, you can set alreadySorted to true, to improve performance by saving a sorting run.
+| void QCPStatisticalBox::setWidth | +( | +double | +width | ) | ++ |
Sets the width of the boxes in key coordinates.
+| void QCPStatisticalBox::setWhiskerWidth | +( | +double | +width | ) | ++ |
Sets the width of the whiskers in key coordinates.
+Whiskers are the lines which reach from the upper quartile to the maximum, and from the lower quartile to the minimum.
+| void QCPStatisticalBox::setWhiskerPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen used for drawing the whisker backbone.
+Whiskers are the lines which reach from the upper quartile to the maximum, and from the lower quartile to the minimum.
+Make sure to set the capStyle of the passed pen to Qt::FlatCap. Otherwise the backbone line might exceed the whisker bars by a few pixels due to the pen cap being not perfectly flat.
| void QCPStatisticalBox::setWhiskerBarPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen used for drawing the whisker bars. Those are the lines parallel to the key axis at each end of the whisker backbone.
+Whiskers are the lines which reach from the upper quartile to the maximum, and from the lower quartile to the minimum.
+| void QCPStatisticalBox::setWhiskerAntialiased | +( | +bool | +enabled | ) | ++ |
Sets whether the statistical boxes whiskers are drawn with antialiasing or not.
+Note that antialiasing settings may be overridden by QCustomPlot::setAntialiasedElements and QCustomPlot::setNotAntialiasedElements.
+ +| void QCPStatisticalBox::setMedianPen | +( | +const QPen & | +pen | ) | ++ |
Sets the pen used for drawing the median indicator line inside the statistical boxes.
+ +| void QCPStatisticalBox::setOutlierStyle | +( | +const QCPScatterStyle & | +style | ) | ++ |
Sets the appearance of the outlier data points.
+Outliers can be specified with the method addData(double key, double minimum, double lowerQuartile, double median, double upperQuartile, double maximum, const QVector<double> &outliers)
+ +| void QCPStatisticalBox::addData | +( | +const QVector< double > & | +keys, | +
| + | + | const QVector< double > & | +minimum, | +
| + | + | const QVector< double > & | +lowerQuartile, | +
| + | + | const QVector< double > & | +median, | +
| + | + | const QVector< double > & | +upperQuartile, | +
| + | + | const QVector< double > & | +maximum, | +
| + | + | bool | +alreadySorted = false |
+
| + | ) | ++ |
This is an overloaded function.
+Adds the provided points in keys, minimum, lowerQuartile, median, upperQuartile and maximum to the current data. The provided vectors should have equal length. Else, the number of added points will be the size of the smallest vector.
+If you can guarantee that the passed data points are sorted by keys in ascending order, you can set alreadySorted to true, to improve performance by saving a sorting run.
+Alternatively, you can also access and modify the data directly via the data method, which returns a pointer to the internal data container.
+ +| void QCPStatisticalBox::addData | +( | +double | +key, | +
| + | + | double | +minimum, | +
| + | + | double | +lowerQuartile, | +
| + | + | double | +median, | +
| + | + | double | +upperQuartile, | +
| + | + | double | +maximum, | +
| + | + | const QVector< double > & | +outliers = QVector<double>() |
+
| + | ) | ++ |
This is an overloaded function.
+Adds the provided data point as key, minimum, lowerQuartile, median, upperQuartile and maximum to the current data.
+Alternatively, you can also access and modify the data directly via the data method, which returns a pointer to the internal data container.
+ +
+
|
+ +virtual | +
Returns a data selection containing all the data points of this plottable which are contained (or hit by) rect. This is used mainly in the selection rect interaction for data selection (data selection mechanism).
+If onlySelectable is true, an empty QCPDataSelection is returned if this plottable is not selectable (i.e. if QCPAbstractPlottable::setSelectable is QCP::stNone).
+QRect::normalized() when passing a rect which might not be normalized. Reimplemented from QCPAbstractPlottable1D< QCPStatisticalBoxData >.
+ +
+
|
+ +virtual | +
Implements a selectTest specific to this plottable's point geometry.
+If details is not 0, it will be set to a QCPDataSelection, describing the closest data point to pos.
+For general information about this virtual method, see the base class implementation. QCPAbstractPlottable::selectTest
+ +Reimplemented from QCPAbstractPlottable1D< QCPStatisticalBoxData >.
+ +
+
|
+ +virtual | +
Returns the coordinate range that all data in this plottable span in the key axis dimension. For logarithmic plots, one can set inSignDomain to either QCP::sdNegative or QCP::sdPositive in order to restrict the returned range to that sign domain. E.g. when only negative range is wanted, set inSignDomain to QCP::sdNegative and all positive points will be ignored for range calculation. For no restriction, just set inSignDomain to QCP::sdBoth (default). foundRange is an output parameter that indicates whether a range could be found or not. If this is false, you shouldn't use the returned range (e.g. no points in data).
+Note that foundRange is not the same as QCPRange::validRange, since the range returned by this function may have size zero (e.g. when there is only one data point). In this case foundRange would return true, but the returned range is not a valid range in terms of QCPRange::validRange.
+Implements QCPAbstractPlottable.
+ +
+
|
+ +virtual | +
Returns the coordinate range that the data points in the specified key range (inKeyRange) span in the value axis dimension. For logarithmic plots, one can set inSignDomain to either QCP::sdNegative or QCP::sdPositive in order to restrict the returned range to that sign domain. E.g. when only negative range is wanted, set inSignDomain to QCP::sdNegative and all positive points will be ignored for range calculation. For no restriction, just set inSignDomain to QCP::sdBoth (default). foundRange is an output parameter that indicates whether a range could be found or not. If this is false, you shouldn't use the returned range (e.g. no points in data).
+If inKeyRange has both lower and upper bound set to zero (is equal to QCPRange()), all data points are considered, without any restriction on the keys.
Note that foundRange is not the same as QCPRange::validRange, since the range returned by this function may have size zero (e.g. when there is only one data point). In this case foundRange would return true, but the returned range is not a valid range in terms of QCPRange::validRange.
+Implements QCPAbstractPlottable.
+ +
+
|
+ +protectedvirtual | +
This function draws the layerable with the specified painter. It is only called by QCustomPlot, if the layerable is visible (setVisible).
+Before this function is called, the painter's antialiasing state is set via applyDefaultAntialiasingHint, see the documentation there. Further, the clipping rectangle was set to clipRect.
+ +Implements QCPAbstractPlottable.
+ +
+
|
+ +protectedvirtual | +
called by QCPLegend::draw (via QCPPlottableLegendItem::draw) to create a graphical representation of this plottable inside rect, next to the plottable name.
+The passed painter has its cliprect set to rect, so painting outside of rect won't appear outside the legend icon border.
+ +Implements QCPAbstractPlottable.
+ +
+
|
+ +protectedvirtual | +
Draws the graphical representation of a single statistical box with the data given by the iterator it with the provided painter.
+If the statistical box has a set of outlier data points, they are drawn with outlierStyle.
+ + +
+
|
+ +protected | +
called by draw to determine which data (key) range is visible at the current key axis range setting, so only that needs to be processed. It also takes into account the bar width.
+begin returns an iterator to the lowest data point that needs to be taken into account when plotting. Note that in order to get a clean plot all the way to the edge of the axis rect, lower may still be just outside the visible range.
+end returns an iterator one higher than the highest visible data point. Same as before, end may also lie just outside of the visible range.
+if the plottable contains no data, both begin and end point to constEnd.
+ +
+
|
+ +protected | +
Returns the box in plot coordinates (keys in x, values in y of the returned rect) that covers the value range from the lower to the upper quartile, of the data given by it.
+ + +
+
|
+ +protected | +
Returns the whisker backbones (keys in x, values in y of the returned lines) that cover the value range from the minimum to the lower quartile, and from the upper quartile to the maximum of the data given by it.
+ + +
+
|
+ +protected | +
Returns the whisker bars (keys in x, values in y of the returned lines) that are placed at the end of the whisker backbones, at the minimum and maximum of the data given by it.
+ + +Holds the data of one single data point for QCPStatisticalBox. + More...
++Public Functions | |
| QCPStatisticalBoxData () | |
| QCPStatisticalBoxData (double key, double minimum, double lowerQuartile, double median, double upperQuartile, double maximum, const QVector< double > &outliers=QVector< double >()) | |
| double | sortKey () const |
| double | mainKey () const |
| double | mainValue () const |
| QCPRange | valueRange () const |
+Public Members | |
| +double | key |
| +double | minimum |
| +double | lowerQuartile |
| +double | median |
| +double | upperQuartile |
| +double | maximum |
| +QVector< double > | outliers |
+Static Public Functions | |
| static QCPStatisticalBoxData | fromSortKey (double sortKey) |
| static bool | sortKeyIsMainKey () |
Holds the data of one single data point for QCPStatisticalBox.
+The stored data is:
+The container for storing multiple data points is QCPStatisticalBoxDataContainer. It is a typedef for QCPDataContainer with QCPStatisticalBoxData as the DataType template parameter. See the documentation there for an explanation regarding the data type's generic methods.
+| QCPStatisticalBoxData::QCPStatisticalBoxData | +( | +) | ++ |
Constructs a data point with key and all values set to zero.
+ +| QCPStatisticalBoxData::QCPStatisticalBoxData | +( | +double | +key, | +
| + | + | double | +minimum, | +
| + | + | double | +lowerQuartile, | +
| + | + | double | +median, | +
| + | + | double | +upperQuartile, | +
| + | + | double | +maximum, | +
| + | + | const QVector< double > & | +outliers = QVector<double>() |
+
| + | ) | ++ |
Constructs a data point with the specified key, minimum, lowerQuartile, median, upperQuartile, maximum and optionally a number of outliers.
+ +
+
|
+ +inline | +
Returns the key member of this data point.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +
+
|
+ +inlinestatic | +
Returns a data point with the specified sortKey. All other members are set to zero.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +
+
|
+ +inlinestatic | +
Since the member key is both the data point key coordinate and the data ordering parameter, this method returns true.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +
+
|
+ +inline | +
Returns the key member of this data point.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +
+
|
+ +inline | +
Returns the median member of this data point.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +
+
|
+ +inline | +
Returns a QCPRange spanning from the minimum to the maximum member of this statistical box data point, possibly further expanded by outliers.
+For a general explanation of what this method is good for in the context of the data container, see the documentation of QCPDataContainer.
+ +A layout element displaying a text. + More...
+
+Public Functions | |
| QCPTextElement (QCustomPlot *parentPlot) | |
| QCPTextElement (QCustomPlot *parentPlot, const QString &text) | |
| QCPTextElement (QCustomPlot *parentPlot, const QString &text, double pointSize) | |
| QCPTextElement (QCustomPlot *parentPlot, const QString &text, const QString &fontFamily, double pointSize) | |
| QCPTextElement (QCustomPlot *parentPlot, const QString &text, const QFont &font) | |
| +QString | text () const |
| +int | textFlags () const |
| +QFont | font () const |
| +QColor | textColor () const |
| +QFont | selectedFont () const |
| +QColor | selectedTextColor () const |
| +bool | selectable () const |
| +bool | selected () const |
| void | setText (const QString &text) |
| void | setTextFlags (int flags) |
| void | setFont (const QFont &font) |
| void | setTextColor (const QColor &color) |
| void | setSelectedFont (const QFont &font) |
| void | setSelectedTextColor (const QColor &color) |
| Q_SLOT void | setSelectable (bool selectable) |
| Q_SLOT void | setSelected (bool selected) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
Public Functions inherited from QCPLayoutElement | |
| QCPLayoutElement (QCustomPlot *parentPlot=0) | |
| QCPLayout * | layout () const |
| QRect | rect () const |
| QRect | outerRect () const |
| +QMargins | margins () const |
| +QMargins | minimumMargins () const |
| +QCP::MarginSides | autoMargins () const |
| +QSize | minimumSize () const |
| +QSize | maximumSize () const |
| +SizeConstraintRect | sizeConstraintRect () const |
| +QCPMarginGroup * | marginGroup (QCP::MarginSide side) const |
| +QHash< QCP::MarginSide, QCPMarginGroup * > | marginGroups () const |
| void | setOuterRect (const QRect &rect) |
| void | setMargins (const QMargins &margins) |
| void | setMinimumMargins (const QMargins &margins) |
| void | setAutoMargins (QCP::MarginSides sides) |
| void | setMinimumSize (const QSize &size) |
| void | setMinimumSize (int width, int height) |
| void | setMaximumSize (const QSize &size) |
| void | setMaximumSize (int width, int height) |
| void | setSizeConstraintRect (SizeConstraintRect constraintRect) |
| void | setMarginGroup (QCP::MarginSides sides, QCPMarginGroup *group) |
| virtual void | update (UpdatePhase phase) |
| virtual QList< QCPLayoutElement * > | elements (bool recursive) const |
Public Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| +bool | visible () const |
| +QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| +QCPLayer * | layer () const |
| +bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
+Signals | |
| void | selectionChanged (bool selected) |
| +void | selectableChanged (bool selectable) |
| void | clicked (QMouseEvent *event) |
| void | doubleClicked (QMouseEvent *event) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
+Protected Functions | |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual void | draw (QCPPainter *painter) |
| virtual QSize | minimumOuterSizeHint () const |
| virtual QSize | maximumOuterSizeHint () const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| QFont | mainFont () const |
| QColor | mainTextColor () const |
Protected Functions inherited from QCPLayoutElement | |
| virtual int | calculateAutoMargin (QCP::MarginSide side) |
| virtual void | layoutChanged () |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
Protected Functions inherited from QCPLayerable | |
| virtual QCP::Interaction | selectionCategory () const |
| virtual QRect | clipRect () const |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | wheelEvent (QWheelEvent *event) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
+Additional Inherited Members | |
Public Types inherited from QCPLayoutElement | |
| enum | UpdatePhase |
| enum | SizeConstraintRect |
A layout element displaying a text.
+The text may be specified with setText, the formatting can be controlled with setFont, setTextColor, and setTextFlags.
+A text element can be added as follows:
+
|
+ +explicit | +
This is an overloaded function.
+Creates a new QCPTextElement instance and sets default values. The initial text is empty (setText).
+ +| QCPTextElement::QCPTextElement | +( | +QCustomPlot * | +parentPlot, | +
| + | + | const QString & | +text | +
| + | ) | ++ |
This is an overloaded function.
+Creates a new QCPTextElement instance and sets default values.
+The initial text is set to text.
+ +| QCPTextElement::QCPTextElement | +( | +QCustomPlot * | +parentPlot, | +
| + | + | const QString & | +text, | +
| + | + | double | +pointSize | +
| + | ) | ++ |
This is an overloaded function.
+Creates a new QCPTextElement instance and sets default values.
+The initial text is set to text with pointSize.
+ +| QCPTextElement::QCPTextElement | +( | +QCustomPlot * | +parentPlot, | +
| + | + | const QString & | +text, | +
| + | + | const QString & | +fontFamily, | +
| + | + | double | +pointSize | +
| + | ) | ++ |
This is an overloaded function.
+Creates a new QCPTextElement instance and sets default values.
+The initial text is set to text with pointSize and the specified fontFamily.
+ +| QCPTextElement::QCPTextElement | +( | +QCustomPlot * | +parentPlot, | +
| + | + | const QString & | +text, | +
| + | + | const QFont & | +font | +
| + | ) | ++ |
This is an overloaded function.
+Creates a new QCPTextElement instance and sets default values.
+The initial text is set to text with the specified font.
+ +| void QCPTextElement::setText | +( | +const QString & | +text | ) | ++ |
Sets the text that will be displayed to text. Multiple lines can be created by insertion of "\n".
+| void QCPTextElement::setTextFlags | +( | +int | +flags | ) | ++ |
Sets options for text alignment and wrapping behaviour. flags is a bitwise OR-combination of Qt::AlignmentFlag and Qt::TextFlag enums.
Possible enums are:
| void QCPTextElement::setFont | +( | +const QFont & | +font | ) | ++ |
Sets the font of the text.
+| void QCPTextElement::setTextColor | +( | +const QColor & | +color | ) | ++ |
Sets the color of the text.
+| void QCPTextElement::setSelectedFont | +( | +const QFont & | +font | ) | ++ |
Sets the font of the text that will be used if the text element is selected (setSelected).
+| void QCPTextElement::setSelectedTextColor | +( | +const QColor & | +color | ) | ++ |
Sets the color of the text that will be used if the text element is selected (setSelected).
+| void QCPTextElement::setSelectable | +( | +bool | +selectable | ) | ++ |
Sets whether the user may select this text element.
+Note that even when selectable is set to false, the selection state may be changed programmatically via setSelected.
| void QCPTextElement::setSelected | +( | +bool | +selected | ) | ++ |
Sets the selection state of this text element to selected. If the selection has changed, selectionChanged is emitted.
+Note that this function can change the selection state independently of the current setSelectable state.
+ +
+
|
+ +virtual | +
Returns 0.99*selectionTolerance (see QCustomPlot::setSelectionTolerance) when pos is within the bounding box of the text element's text. Note that this bounding box is updated in the draw call.
+If pos is outside the text's bounding box or if onlySelectable is true and this text element is not selectable (setSelectable), returns -1.
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPLayoutElement.
+ +
+
|
+ +virtual | +
Accepts the mouse event in order to emit the according click signal in the mouseReleaseEvent.
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPLayerable.
+ +
+
|
+ +virtual | +
Emits the clicked signal if the cursor hasn't moved by more than a few pixels since the mousePressEvent.
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPLayerable.
+ +
+
|
+ +virtual | +
Emits the doubleClicked signal.
+For general information about this virtual method, see the base class implementation.
+ +Reimplemented from QCPLayerable.
+ +
+
|
+ +signal | +
This signal is emitted when the selection state has changed to selected, either by user interaction or by a direct call to setSelected.
+
+
|
+ +signal | +
This signal is emitted when the text element is clicked.
+
+
|
+ +signal | +
This signal is emitted when the text element is double clicked.
+
+
|
+ +protectedvirtual | +
This function applies the default antialiasing setting to the specified painter, using the function applyAntialiasingHint. It is the antialiasing state the painter is put in, when draw is called on the layerable. If the layerable has multiple entities whose antialiasing setting may be specified individually, this function should set the antialiasing state of the most prominent entity. In this case however, the draw function usually calls the specialized versions of this function before drawing each entity, effectively overriding the setting of the default antialiasing hint.
+First example: QCPGraph has multiple entities that have an antialiasing setting: The graph line, fills and scatters. Those can be configured via QCPGraph::setAntialiased, QCPGraph::setAntialiasedFill and QCPGraph::setAntialiasedScatters. Consequently, there isn't only the QCPGraph::applyDefaultAntialiasingHint function (which corresponds to the graph line's antialiasing), but specialized ones like QCPGraph::applyFillAntialiasingHint and QCPGraph::applyScattersAntialiasingHint. So before drawing one of those entities, QCPGraph::draw calls the respective specialized applyAntialiasingHint function.
+Second example: QCPItemLine consists only of a line so there is only one antialiasing setting which can be controlled with QCPItemLine::setAntialiased. (This function is inherited by all layerables. The specialized functions, as seen on QCPGraph, must be added explicitly to the respective layerable subclass.) Consequently it only has the normal QCPItemLine::applyDefaultAntialiasingHint. The QCPItemLine::draw function doesn't need to care about setting any antialiasing states, because the default antialiasing hint is already set on the painter when the draw function is called, and that's the state it wants to draw the line with.
+ +Reimplemented from QCPLayoutElement.
+ +
+
|
+ +protectedvirtual | +
This function draws the layerable with the specified painter. It is only called by QCustomPlot, if the layerable is visible (setVisible).
+Before this function is called, the painter's antialiasing state is set via applyDefaultAntialiasingHint, see the documentation there. Further, the clipping rectangle was set to clipRect.
+ +Reimplemented from QCPLayoutElement.
+ +
+
|
+ +protectedvirtual | +
Returns the suggested minimum size this layout element (the outerRect) may be compressed to, if no manual minimum size is set.
+if a minimum size (setMinimumSize) was not set manually, parent layouts use the returned size (usually indirectly through QCPLayout::getFinalMinimumOuterSize) to determine the minimum allowed size of this layout element.
+A manual minimum size is considered set if it is non-zero.
+The default implementation simply returns the sum of the horizontal margins for the width and the sum of the vertical margins for the height. Reimplementations may use their detailed knowledge about the layout element's content to provide size hints.
+ +Reimplemented from QCPLayoutElement.
+ +
+
|
+ +protectedvirtual | +
Returns the suggested maximum size this layout element (the outerRect) may be expanded to, if no manual maximum size is set.
+if a maximum size (setMaximumSize) was not set manually, parent layouts use the returned size (usually indirectly through QCPLayout::getFinalMaximumOuterSize) to determine the maximum allowed size of this layout element.
+A manual maximum size is considered set if it is smaller than Qt's QWIDGETSIZE_MAX.
The default implementation simply returns QWIDGETSIZE_MAX for both width and height, implying no suggested maximum size. Reimplementations may use their detailed knowledge about the layout element's content to provide size hints.
Reimplemented from QCPLayoutElement.
+ +
+
|
+ +protectedvirtual | +
This event is called when the layerable shall be selected, as a consequence of a click by the user. Subclasses should react to it by setting their selection state appropriately. The default implementation does nothing.
+event is the mouse event that caused the selection. additive indicates, whether the user was holding the multi-select-modifier while performing the selection (see QCustomPlot::setMultiSelectModifier). if additive is true, the selection state must be toggled (i.e. become selected when unselected and unselected when selected).
+Every selectEvent is preceded by a call to selectTest, which has returned positively (i.e. returned a value greater than 0 and less than the selection tolerance of the parent QCustomPlot). The details data you output from selectTest is fed back via details here. You may use it to transport any kind of information from the selectTest to the possibly subsequent selectEvent. Usually details is used to transfer which part was clicked, if it is a layerable that has multiple individually selectable parts (like QCPAxis). This way selectEvent doesn't need to do the calculation again to find out which part was actually clicked.
+selectionStateChanged is an output parameter. If the pointer is non-null, this function must set the value either to true or false, depending on whether the selection state of this layerable was actually changed. For layerables that only are selectable as a whole and not in parts, this is simple: if additive is true, selectionStateChanged must also be set to true, because the selection toggles. If additive is false, selectionStateChanged is only set to true, if the layerable was previously unselected and now is switched to the selected state.
+Reimplemented from QCPLayerable.
+ +
+
|
+ +protectedvirtual | +
This event is called when the layerable shall be deselected, either as consequence of a user interaction or a call to QCustomPlot::deselectAll. Subclasses should react to it by unsetting their selection appropriately.
+just as in selectEvent, the output parameter selectionStateChanged (if non-null), must return true or false when the selection state of this layerable has changed or not changed, respectively.
+Reimplemented from QCPLayerable.
+ +
+
|
+ +protected | +
Returns the main font to be used. This is mSelectedFont if setSelected is set to true, else mFont is returned.
+
|
+ +protected | +
Returns the main color to be used. This is mSelectedTextColor if setSelected is set to true, else mTextColor is returned.
Represents two doubles as a mathematical 2D vector. + More...
++Public Functions | |
| QCPVector2D () | |
| QCPVector2D (double x, double y) | |
| QCPVector2D (const QPoint &point) | |
| QCPVector2D (const QPointF &point) | |
| +double | x () const |
| +double | y () const |
| +double & | rx () |
| +double & | ry () |
| void | setX (double x) |
| void | setY (double y) |
| double | length () const |
| double | lengthSquared () const |
| QPoint | toPoint () const |
| QPointF | toPointF () const |
| bool | isNull () const |
| void | normalize () |
| QCPVector2D | normalized () const |
| QCPVector2D | perpendicular () const |
| double | dot (const QCPVector2D &vec) const |
| double | distanceSquaredToLine (const QCPVector2D &start, const QCPVector2D &end) const |
| double | distanceSquaredToLine (const QLineF &line) const |
| double | distanceToStraightLine (const QCPVector2D &base, const QCPVector2D &direction) const |
| QCPVector2D & | operator*= (double factor) |
| QCPVector2D & | operator/= (double divisor) |
| QCPVector2D & | operator+= (const QCPVector2D &vector) |
| QCPVector2D & | operator-= (const QCPVector2D &vector) |
+Friends | |
| +const QCPVector2D | operator* (double factor, const QCPVector2D &vec) |
| +const QCPVector2D | operator* (const QCPVector2D &vec, double factor) |
| +const QCPVector2D | operator/ (const QCPVector2D &vec, double divisor) |
| +const QCPVector2D | operator+ (const QCPVector2D &vec1, const QCPVector2D &vec2) |
| +const QCPVector2D | operator- (const QCPVector2D &vec1, const QCPVector2D &vec2) |
| +const QCPVector2D | operator- (const QCPVector2D &vec) |
+Related Non-Members | |
(Note that these are not member functions.) + | |
| QDebug | operator<< (QDebug d, const QCPVector2D &vec) |
Represents two doubles as a mathematical 2D vector.
+This class acts as a replacement for QVector2D with the advantage of double precision instead of single, and some convenience methods tailored for the QCustomPlot library.
+| QCPVector2D::QCPVector2D | +( | +) | ++ |
Creates a QCPVector2D object and initializes the x and y coordinates to 0.
+ +| QCPVector2D::QCPVector2D | +( | +double | +x, | +
| + | + | double | +y | +
| + | ) | ++ |
Creates a QCPVector2D object and initializes the x and y coordinates with the specified values.
+ +| QCPVector2D::QCPVector2D | +( | +const QPoint & | +point | ) | ++ |
Creates a QCPVector2D object and initializes the x and y coordinates respective coordinates of the specified point.
+ +| QCPVector2D::QCPVector2D | +( | +const QPointF & | +point | ) | ++ |
Creates a QCPVector2D object and initializes the x and y coordinates respective coordinates of the specified point.
+ +
+
|
+ +inline | +
Sets the x coordinate of this vector to x.
+
+
|
+ +inline | +
Sets the y coordinate of this vector to y.
+
+
|
+ +inline | +
Returns the length of this vector.
+
+
|
+ +inline | +
+
|
+ +inline | +
Returns a QPoint which has the x and y coordinates of this vector, truncating any floating point information.
+
+
|
+ +inline | +
Returns a QPointF which has the x and y coordinates of this vector.
+
+
|
+ +inline | +
Returns whether this vector is null. A vector is null if qIsNull returns true for both x and y coordinates, i.e. if both are binary equal to 0.
| void QCPVector2D::normalize | +( | +) | ++ |
Normalizes this vector. After this operation, the length of the vector is equal to 1.
+| QCPVector2D QCPVector2D::normalized | +( | +) | +const | +
Returns a normalized version of this vector. The length of the returned vector is equal to 1.
+
+
|
+ +inline | +
Returns a vector perpendicular to this vector, with the same length.
+ +
+
|
+ +inline | +
Returns the dot/scalar product of this vector with the specified vector vec.
+ +| double QCPVector2D::distanceSquaredToLine | +( | +const QCPVector2D & | +start, | +
| + | + | const QCPVector2D & | +end | +
| + | ) | +const | +
This is an overloaded function.
+Returns the squared shortest distance of this vector (interpreted as a point) to the finite line segment given by start and end.
+| double QCPVector2D::distanceSquaredToLine | +( | +const QLineF & | +line | ) | +const | +
This is an overloaded function.
+Returns the squared shortest distance of this vector (interpreted as a point) to the finite line segment given by line.
+| double QCPVector2D::distanceToStraightLine | +( | +const QCPVector2D & | +base, | +
| + | + | const QCPVector2D & | +direction | +
| + | ) | +const | +
Returns the shortest distance of this vector (interpreted as a point) to the infinite straight line given by a base point and a direction vector.
+| QCPVector2D & QCPVector2D::operator*= | +( | +double | +factor | ) | ++ |
Scales this vector by the given factor, i.e. the x and y components are multiplied by factor.
+ +| QCPVector2D & QCPVector2D::operator/= | +( | +double | +divisor | ) | ++ |
Scales this vector by the given divisor, i.e. the x and y components are divided by divisor.
+ +| QCPVector2D & QCPVector2D::operator+= | +( | +const QCPVector2D & | +vector | ) | ++ |
Adds the given vector to this vector component-wise.
+ +| QCPVector2D & QCPVector2D::operator-= | +( | +const QCPVector2D & | +vector | ) | ++ |
subtracts the given vector from this vector component-wise.
+ +
+
|
+ +related | +
Prints vec in a human readable format to the qDebug output.
+ +The central class of the library. This is the QWidget which displays the plot and interacts with the user. + More...
+ +Inherits QWidget.
++Public Types | |
| enum | LayerInsertMode |
| enum | RefreshPriority |
+Public Functions | |
| QCustomPlot (QWidget *parent=0) | |
| +QRect | viewport () const |
| +double | bufferDevicePixelRatio () const |
| +QPixmap | background () const |
| +bool | backgroundScaled () const |
| +Qt::AspectRatioMode | backgroundScaledMode () const |
| QCPLayoutGrid * | plotLayout () const |
| +QCP::AntialiasedElements | antialiasedElements () const |
| +QCP::AntialiasedElements | notAntialiasedElements () const |
| +bool | autoAddPlottableToLegend () const |
| +const QCP::Interactions | interactions () const |
| +int | selectionTolerance () const |
| +bool | noAntialiasingOnDrag () const |
| +QCP::PlottingHints | plottingHints () const |
| +Qt::KeyboardModifier | multiSelectModifier () const |
| +QCP::SelectionRectMode | selectionRectMode () const |
| QCPSelectionRect * | selectionRect () const |
| +bool | openGl () const |
| void | setViewport (const QRect &rect) |
| void | setBufferDevicePixelRatio (double ratio) |
| void | setBackground (const QPixmap &pm) |
| void | setBackground (const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding) |
| void | setBackground (const QBrush &brush) |
| void | setBackgroundScaled (bool scaled) |
| void | setBackgroundScaledMode (Qt::AspectRatioMode mode) |
| void | setAntialiasedElements (const QCP::AntialiasedElements &antialiasedElements) |
| void | setAntialiasedElement (QCP::AntialiasedElement antialiasedElement, bool enabled=true) |
| void | setNotAntialiasedElements (const QCP::AntialiasedElements ¬AntialiasedElements) |
| void | setNotAntialiasedElement (QCP::AntialiasedElement notAntialiasedElement, bool enabled=true) |
| void | setAutoAddPlottableToLegend (bool on) |
| void | setInteractions (const QCP::Interactions &interactions) |
| void | setInteraction (const QCP::Interaction &interaction, bool enabled=true) |
| void | setSelectionTolerance (int pixels) |
| void | setNoAntialiasingOnDrag (bool enabled) |
| void | setPlottingHints (const QCP::PlottingHints &hints) |
| void | setPlottingHint (QCP::PlottingHint hint, bool enabled=true) |
| void | setMultiSelectModifier (Qt::KeyboardModifier modifier) |
| void | setSelectionRectMode (QCP::SelectionRectMode mode) |
| void | setSelectionRect (QCPSelectionRect *selectionRect) |
| void | setOpenGl (bool enabled, int multisampling=16) |
| QCPAbstractPlottable * | plottable (int index) |
| QCPAbstractPlottable * | plottable () |
| bool | removePlottable (QCPAbstractPlottable *plottable) |
| bool | removePlottable (int index) |
| int | clearPlottables () |
| int | plottableCount () const |
| QList< QCPAbstractPlottable * > | selectedPlottables () const |
| QCPAbstractPlottable * | plottableAt (const QPointF &pos, bool onlySelectable=false) const |
| bool | hasPlottable (QCPAbstractPlottable *plottable) const |
| QCPGraph * | graph (int index) const |
| QCPGraph * | graph () const |
| QCPGraph * | addGraph (QCPAxis *keyAxis=0, QCPAxis *valueAxis=0) |
| bool | removeGraph (QCPGraph *graph) |
| bool | removeGraph (int index) |
| int | clearGraphs () |
| int | graphCount () const |
| QList< QCPGraph * > | selectedGraphs () const |
| QCPAbstractItem * | item (int index) const |
| QCPAbstractItem * | item () const |
| bool | removeItem (QCPAbstractItem *item) |
| bool | removeItem (int index) |
| int | clearItems () |
| int | itemCount () const |
| QList< QCPAbstractItem * > | selectedItems () const |
| QCPAbstractItem * | itemAt (const QPointF &pos, bool onlySelectable=false) const |
| bool | hasItem (QCPAbstractItem *item) const |
| QCPLayer * | layer (const QString &name) const |
| QCPLayer * | layer (int index) const |
| QCPLayer * | currentLayer () 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) |
| int | axisRectCount () const |
| QCPAxisRect * | axisRect (int index=0) const |
| QList< QCPAxisRect * > | axisRects () const |
| QCPLayoutElement * | layoutElementAt (const QPointF &pos) const |
| QCPAxisRect * | axisRectAt (const QPointF &pos) const |
| Q_SLOT void | rescaleAxes (bool onlyVisiblePlottables=false) |
| QList< QCPAxis * > | selectedAxes () const |
| QList< QCPLegend * > | selectedLegends () const |
| Q_SLOT void | deselectAll () |
| bool | savePdf (const QString &fileName, int width=0, int height=0, QCP::ExportPen exportPen=QCP::epAllowCosmetic, const QString &pdfCreator=QString(), const QString &pdfTitle=QString()) |
| bool | savePng (const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1, int resolution=96, QCP::ResolutionUnit resolutionUnit=QCP::ruDotsPerInch) |
| bool | saveJpg (const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1, int resolution=96, QCP::ResolutionUnit resolutionUnit=QCP::ruDotsPerInch) |
| bool | saveBmp (const QString &fileName, int width=0, int height=0, double scale=1.0, int resolution=96, QCP::ResolutionUnit resolutionUnit=QCP::ruDotsPerInch) |
| bool | saveRastered (const QString &fileName, int width, int height, double scale, const char *format, int quality=-1, int resolution=96, QCP::ResolutionUnit resolutionUnit=QCP::ruDotsPerInch) |
| QPixmap | toPixmap (int width=0, int height=0, double scale=1.0) |
| void | toPainter (QCPPainter *painter, int width=0, int height=0) |
| Q_SLOT void | replot (QCustomPlot::RefreshPriority refreshPriority=QCustomPlot::rpRefreshHint) |
+Public Members | |
| QCPAxis * | xAxis |
| QCPAxis * | yAxis |
| QCPAxis * | xAxis2 |
| QCPAxis * | yAxis2 |
| QCPLegend * | legend |
+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, int dataIndex, QMouseEvent *event) |
| void | plottableDoubleClick (QCPAbstractPlottable *plottable, int dataIndex, 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 | selectionChangedByUser () |
| void | beforeReplot () |
| void | afterReplot () |
+Protected Functions | |
| virtual QSize | minimumSizeHint () const |
| virtual QSize | sizeHint () 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 void | draw (QCPPainter *painter) |
| virtual void | updateLayout () |
| virtual void | axisRemoved (QCPAxis *axis) |
| virtual void | legendRemoved (QCPLegend *legend) |
| virtual Q_SLOT void | processRectSelection (QRect rect, QMouseEvent *event) |
| virtual Q_SLOT void | processRectZoom (QRect rect, QMouseEvent *event) |
| virtual Q_SLOT void | processPointSelection (QMouseEvent *event) |
| bool | registerPlottable (QCPAbstractPlottable *plottable) |
| bool | registerGraph (QCPGraph *graph) |
| bool | registerItem (QCPAbstractItem *item) |
| void | updateLayerIndices () const |
| QCPLayerable * | layerableAt (const QPointF &pos, bool onlySelectable, QVariant *selectionDetails=0) const |
| QList< QCPLayerable * > | layerableListAt (const QPointF &pos, bool onlySelectable, QList< QVariant > *selectionDetails=0) const |
| void | drawBackground (QCPPainter *painter) |
| void | setupPaintBuffers () |
| QCPAbstractPaintBuffer * | createPaintBuffer () |
| bool | hasInvalidatedPaintBuffers () |
| bool | setupOpenGl () |
| void | freeOpenGl () |
The central class of the library. This is the QWidget which displays the plot and interacts with the user.
+For tutorials on how to use QCustomPlot, see the website
+http://www.qcustomplot.com/
| enum QCustomPlot::LayerInsertMode | +
| enum QCustomPlot::RefreshPriority | +
Defines with what timing the QCustomPlot surface is refreshed after a replot.
+| Enumerator | |
|---|---|
| rpImmediateRefresh | Replots immediately and repaints the widget immediately by calling QWidget::repaint() after the replot. + |
| rpQueuedRefresh | Replots immediately, but queues the widget repaint, by calling QWidget::update() after the replot. This way multiple redundant widget repaints can be avoided. + |
| rpRefreshHint | Whether to use immediate or queued refresh depends on whether the plotting hint QCP::phImmediateRefresh is set, see setPlottingHints. + |
| rpQueuedReplot | Queues the entire replot for the next event loop iteration. This way multiple redundant replots can be avoided. The actual replot is then done with rpRefreshHint priority. + |
+
|
+ +explicit | +
Constructs a QCustomPlot and sets reasonable default values.
+ +
+
|
+ +inline | +
Returns the top level layout of this QCustomPlot instance. It is a QCPLayoutGrid, initially containing just one cell with the main QCPAxisRect inside.
+ +
+
|
+ +inline | +
Allows access to the currently used QCPSelectionRect instance (or subclass thereof), that is used to handle and draw selection rect interactions (see setSelectionRectMode).
+| void QCustomPlot::setViewport | +( | +const QRect & | +rect | ) | ++ |
Sets the viewport of this QCustomPlot. Usually users of QCustomPlot don't need to change the viewport manually.
+The viewport is the area in which the plot is drawn. 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 axis rect (QCustomPlot::axisRect). An axis rect is typically an area enclosed by four axes, where the graphs/plottables are drawn in. The viewport is larger and contains also the axes themselves, their tick numbers, their labels, or even additional axis rects, color scales and other layout elements.
+This function is used to allow arbitrary size exports with toPixmap, savePng, savePdf, etc. by temporarily changing the viewport size.
+ +| void QCustomPlot::setBufferDevicePixelRatio | +( | +double | +ratio | ) | ++ |
Sets the device pixel ratio used by the paint buffers of this QCustomPlot instance.
+Normally, this doesn't need to be set manually, because it is initialized with the regular QWidget::devicePixelRatio which is configured by Qt to fit the display device (e.g. 1 for normal displays, 2 for High-DPI displays).
+Device pixel ratios are supported by Qt only for Qt versions since 5.4. If this method is called when QCustomPlot is being used with older Qt versions, outputs an according qDebug message and leaves the internal buffer device pixel ratio at 1.0.
+ +| void QCustomPlot::setBackground | +( | +const QPixmap & | +pm | ) | ++ |
Sets pm as the viewport background pixmap (see setViewport). The pixmap is always drawn below all other objects in the plot.
+For cases where the provided pixmap doesn't have the same size as the viewport, scaling can be enabled with setBackgroundScaled and the scaling mode (whether and how the aspect ratio is preserved) can be set with setBackgroundScaledMode. To set all these options in one call, consider using the overloaded version of this function.
+If a background brush was set with setBackground(const QBrush &brush), the viewport will first be filled with that brush, before drawing the background pixmap. This can be useful for background pixmaps with translucent areas.
+ + +| void QCustomPlot::setBackground | +( | +const QPixmap & | +pm, | +
| + | + | bool | +scaled, | +
| + | + | Qt::AspectRatioMode | +mode = Qt::KeepAspectRatioByExpanding |
+
| + | ) | ++ |
This is an overloaded function.
+Allows setting the background pixmap of the viewport, whether it shall be scaled and how it shall be scaled in one call.
+ + +| void QCustomPlot::setBackground | +( | +const QBrush & | +brush | ) | ++ |
Sets the background brush of the viewport (see setViewport).
+Before drawing everything else, the background is filled with brush. If a background pixmap was set with setBackground(const QPixmap &pm), this brush will be used to fill the viewport before the background pixmap is drawn. This can be useful for background pixmaps with translucent areas.
+Set brush to Qt::NoBrush or Qt::Transparent to leave background transparent. This can be useful for exporting to image formats which support transparency, e.g. savePng.
+ + +| void QCustomPlot::setBackgroundScaled | +( | +bool | +scaled | ) | ++ |
Sets whether the viewport background pixmap shall be scaled to fit the viewport. If scaled is set to true, control whether and how the aspect ratio of the original pixmap is preserved with setBackgroundScaledMode.
+Note that the scaled version of the original pixmap is buffered, so there is no performance penalty on replots. (Except when the viewport dimensions are changed continuously.)
+| void QCustomPlot::setBackgroundScaledMode | +( | +Qt::AspectRatioMode | +mode | ) | ++ |
If scaling of the viewport background pixmap is enabled (setBackgroundScaled), use this function to define whether and how the aspect ratio of the original pixmap is preserved.
+| 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.
+if an element in antialiasedElements is already set in setNotAntialiasedElements, it is removed from there.
+| void QCustomPlot::setAntialiasedElement | +( | +QCP::AntialiasedElement | +antialiasedElement, | +
| + | + | bool | +enabled = true |
+
| + | ) | ++ |
Sets whether the specified antialiasedElement is forcibly drawn antialiased.
+See setAntialiasedElements for details.
+| 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.
+| void QCustomPlot::setNotAntialiasedElement | +( | +QCP::AntialiasedElement | +notAntialiasedElement, | +
| + | + | bool | +enabled = true |
+
| + | ) | ++ |
Sets whether the specified notAntialiasedElement is forcibly drawn not antialiased.
+See setNotAntialiasedElements for details.
+| void QCustomPlot::setAutoAddPlottableToLegend | +( | +bool | +on | ) | ++ |
If set to true, adding a plottable (e.g. a graph) to the QCustomPlot automatically also adds the plottable to the legend (QCustomPlot::legend).
+| void QCustomPlot::setInteractions | +( | +const QCP::Interactions & | +interactions | ) | ++ |
Sets the possible interactions of this QCustomPlot as an or-combination of QCP::Interaction enums. There are the following types of interactions:
+Axis range manipulation is controlled via QCP::iRangeDrag and QCP::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 QCPAxisRect::setRangeDrag, QCPAxisRect::setRangeZoom, QCPAxisRect::setRangeDragAxes, QCPAxisRect::setRangeZoomAxes.
+Plottable data selection is controlled by QCP::iSelectPlottables. If QCP::iSelectPlottables is set, the user may select plottables (graphs, curves, bars,...) and their data by clicking on them or in their vicinity (setSelectionTolerance). Whether the user can actually select a plottable and its data can further be restricted with the QCPAbstractPlottable::setSelectable method on the specific plottable. For details, see the special page about the data selection mechanism. 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 QCP::iSelectItems. If QCP::iSelectItems is set, the user may select items (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 QCP::iSelectAxes. If QCP::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::setSelectableParts 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::selectedParts().
+Legend selection is controlled with QCP::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::setSelectableParts. To find out whether the legend or any of its child items are selected, check the value of QCPLegend::selectedParts. To find out which child items are selected, call QCPLegend::selectedItems.
+All other selectable elements The selection of all other selectable objects (e.g. QCPTextElement, or your own layerable subclasses) is controlled with QCP::iSelectOther. If set, the user may select those objects by clicking on them. To find out which are currently selected, you need to check their selected state explicitly.
+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 selection modifier (setMultiSelectModifier), set the flag QCP::iMultiSelect.
+| void QCustomPlot::setInteraction | +( | +const QCP::Interaction & | +interaction, | +
| + | + | bool | +enabled = true |
+
| + | ) | ++ |
Sets the single interaction of this QCustomPlot to enabled.
+For details about the interaction system, see setInteractions.
+| void QCustomPlot::setSelectionTolerance | +( | +int | +pixels | ) | ++ |
Sets the tolerance that is used to decide whether a click selects an object (e.g. a plottable) or not.
+If the user clicks in the vicinity of the line of e.g. 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.
+| void QCustomPlot::setNoAntialiasingOnDrag | +( | +bool | +enabled | ) | ++ |
Sets whether antialiasing is disabled for this QCustomPlot while the user is dragging axes ranges. If many objects, especially plottables, are 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.
+ + +| void QCustomPlot::setPlottingHints | +( | +const QCP::PlottingHints & | +hints | ) | ++ |
Sets the plotting hints for this QCustomPlot instance as an or combination of QCP::PlottingHint.
+| void QCustomPlot::setPlottingHint | +( | +QCP::PlottingHint | +hint, | +
| + | + | bool | +enabled = true |
+
| + | ) | ++ |
Sets the specified plotting hint to enabled.
+| void QCustomPlot::setMultiSelectModifier | +( | +Qt::KeyboardModifier | +modifier | ) | ++ |
Sets the keyboard modifier that will be recognized as multi-select-modifier.
+If QCP::iMultiSelect is specified in setInteractions, the user may select multiple objects (or data points) by clicking on them one after the other while holding down modifier.
+By default the multi-select-modifier is set to Qt::ControlModifier.
+| void QCustomPlot::setSelectionRectMode | +( | +QCP::SelectionRectMode | +mode | ) | ++ |
Sets how QCustomPlot processes mouse click-and-drag interactions by the user.
+If mode is QCP::srmNone, the mouse drag is forwarded to the underlying objects. For example, QCPAxisRect may process a mouse drag by dragging axis ranges, see QCPAxisRect::setRangeDrag. If mode is not QCP::srmNone, the current selection rect (selectionRect) becomes activated and allows e.g. rect zooming and data point selection.
+If you wish to provide your user both with axis range dragging and data selection/range zooming, use this method to switch between the modes just before the interaction is processed, e.g. in reaction to the mousePress or mouseMove signals. For example you could check whether the user is holding a certain keyboard modifier, and then decide which mode shall be set.
+If a selection rect interaction is currently active, and mode is set to QCP::srmNone, the interaction is canceled (QCPSelectionRect::cancel). Switching between any of the other modes will keep the selection rect active. Upon completion of the interaction, the behaviour is as defined by the currently set mode, not the mode that was set when the interaction started.
+| void QCustomPlot::setSelectionRect | +( | +QCPSelectionRect * | +selectionRect | ) | ++ |
Sets the QCPSelectionRect instance that QCustomPlot will use if mode is not QCP::srmNone and the user performs a click-and-drag interaction. QCustomPlot takes ownership of the passed selectionRect. It can be accessed later via selectionRect.
+This method is useful if you wish to replace the default QCPSelectionRect instance with an instance of a QCPSelectionRect subclass, to introduce custom behaviour of the selection rect.
+| void QCustomPlot::setOpenGl | +( | +bool | +enabled, | +
| + | + | int | +multisampling = 16 |
+
| + | ) | ++ |
This method allows to enable OpenGL plot rendering, for increased plotting performance of graphically demanding plots (thick lines, translucent fills, etc.).
+If enabled is set to true, QCustomPlot will try to initialize OpenGL and, if successful, continue plotting with hardware acceleration. The parameter multisampling controls how many samples will be used per pixel, it essentially controls the antialiasing quality. If multisampling is set too high for the current graphics hardware, the maximum allowed value will be used.
+You can test whether switching to OpenGL rendering was successful by checking whether the according getter QCustomPlot::openGl() returns true. If the OpenGL initialization fails, rendering continues with the regular software rasterizer, and an according qDebug output is generated.
+If switching to OpenGL was successful, this method disables label caching (setPlottingHint(QCP::phCacheLabels, false)) and turns on QCustomPlot's antialiasing override for all elements (setAntialiasedElements(QCP::aeAll)), leading to a higher quality output. The antialiasing override allows for pixel-grid aligned drawing in the OpenGL paint device. As stated before, in OpenGL rendering the actual antialiasing of the plot is controlled with multisampling. If enabled is set to false, the antialiasing/label caching settings are restored to what they were before OpenGL was enabled, if they weren't altered in the meantime.
+QCUSTOMPLOT_USE_OPENGL defined. This define must be set before including the QCustomPlot header both during compilation of the QCustomPlot library as well as when compiling your application. It is best to just include the line DEFINES += QCUSTOMPLOT_USE_OPENGL in the respective qmake project files. QT variable in the qmake project files. For Qt versions 5.0 and higher, QCustomPlot switches to a newer OpenGL interface which is already in the "gui" module. | 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()
+| QCPAbstractPlottable * QCustomPlot::plottable | +( | +) | ++ |
This is an overloaded function.
+Returns the last plottable that was added to the plot. If there are no plottables in the plot, returns 0.
+| bool QCustomPlot::removePlottable | +( | +QCPAbstractPlottable * | +plottable | ) | ++ |
Removes the specified plottable from the plot and deletes it. If necessary, the corresponding legend item is also removed from the default legend (QCustomPlot::legend).
+Returns true on success.
+| bool QCustomPlot::removePlottable | +( | +int | +index | ) | ++ |
This is an overloaded function.
+Removes and deletes the plottable by its index.
+ +| int QCustomPlot::clearPlottables | +( | +) | ++ |
Removes all plottables from the plot and deletes them. Corresponding legend items are also removed from the default legend (QCustomPlot::legend).
+Returns the number of plottables removed.
+| int QCustomPlot::plottableCount | +( | +) | +const | +
Returns the number of currently existing plottables in the plot
+| 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.
+ + +| 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 (like 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.
+| bool QCustomPlot::hasPlottable | +( | +QCPAbstractPlottable * | +plottable | ) | +const | +
Returns whether this QCustomPlot instance contains the plottable.
+ +| 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()
+| QCPGraph * QCustomPlot::graph | +( | +) | +const | +
This is an overloaded function.
+Returns the last graph, that was created with addGraph. If there are no graphs in the plot, returns 0.
+| 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 axis. 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, or 0 if adding the graph failed.
+| bool QCustomPlot::removeGraph | +( | +QCPGraph * | +graph | ) | ++ |
Removes the specified graph from the plot and deletes it. If necessary, the corresponding legend item is also removed from the default legend (QCustomPlot::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.
+| bool QCustomPlot::removeGraph | +( | +int | +index | ) | ++ |
This is an overloaded function.
+Removes and deletes the graph by its index.
+ +| int QCustomPlot::clearGraphs | +( | +) | ++ |
Removes all graphs from the plot and deletes them. Corresponding legend items are also removed from the default legend (QCustomPlot::legend).
+Returns the number of graphs removed.
+| int QCustomPlot::graphCount | +( | +) | +const | +
| QList< QCPGraph * > QCustomPlot::selectedGraphs | +( | +) | +const | +
Returns a list of the selected graphs. If no graphs are currently selected, the list is empty.
+If you are not only interested in selected graphs but other plottables like QCPCurve, QCPBars, etc., use selectedPlottables.
+ + +| 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()
+| QCPAbstractItem * QCustomPlot::item | +( | +) | +const | +
This is an overloaded function.
+Returns the last item that was added to this plot. If there are no items in the plot, returns 0.
+| bool QCustomPlot::removeItem | +( | +QCPAbstractItem * | +item | ) | ++ |
Removes the specified item from the plot and deletes it.
+Returns true on success.
+| bool QCustomPlot::removeItem | +( | +int | +index | ) | ++ |
This is an overloaded function.
+Removes and deletes the item by its index.
+ +| int QCustomPlot::clearItems | +( | +) | ++ |
Removes all items from the plot and deletes them.
+Returns the number of items removed.
+| int QCustomPlot::itemCount | +( | +) | +const | +
Returns the number of currently existing items in the plot
+| QList< QCPAbstractItem * > QCustomPlot::selectedItems | +( | +) | +const | +
Returns a list of the selected items. If no items are currently selected, the list is empty.
+ + +| 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.
+| bool QCustomPlot::hasItem | +( | +QCPAbstractItem * | +item | ) | +const | +
Returns whether this QCustomPlot contains the item.
+| QCPLayer * QCustomPlot::layer | +( | +const QString & | +name | ) | +const | +
Returns the layer with the specified name. If there is no layer with the specified name, 0 is returned.
+Layer names are case-sensitive.
+| QCPLayer * QCustomPlot::layer | +( | +int | +index | ) | +const | +
This is an overloaded function.
+Returns the layer by index. If the index is invalid, 0 is returned.
+| QCPLayer * QCustomPlot::currentLayer | +( | +) | +const | +
Returns the layer that is set as current layer (see setCurrentLayer).
+ +| bool QCustomPlot::setCurrentLayer | +( | +const QString & | +name | ) | ++ |
Sets the layer with the specified name to be the current layer. All layerables (QCPLayerable), e.g. plottables and items, are created on the current layer.
+Returns true on success, i.e. if there is a layer with the specified name in the QCustomPlot.
+Layer names are case-sensitive.
+| bool QCustomPlot::setCurrentLayer | +( | +QCPLayer * | +layer | ) | ++ |
This is an overloaded function.
+Sets the provided layer to be the current layer.
+Returns true on success, i.e. when layer is a valid layer in the QCustomPlot.
+| int QCustomPlot::layerCount | +( | +) | +const | +
| 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. Depending on insertMode, it is positioned either below or above otherLayer.
+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.
+| 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.
+It is not possible to remove the last layer of the plot.
+ + +| bool QCustomPlot::moveLayer | +( | +QCPLayer * | +layer, | +
| + | + | QCPLayer * | +otherLayer, | +
| + | + | QCustomPlot::LayerInsertMode | +insertMode = limAbove |
+
| + | ) | ++ |
Moves the specified layer either above or below otherLayer. Whether it's placed above or below is controlled with insertMode.
+Returns true on success, i.e. when both layer and otherLayer are valid layers in the QCustomPlot.
+ + +| int QCustomPlot::axisRectCount | +( | +) | +const | +
Returns the number of axis rects in the plot.
+All axis rects can be accessed via QCustomPlot::axisRect().
+Initially, only one axis rect exists in the plot.
+ + +| QCPAxisRect * QCustomPlot::axisRect | +( | +int | +index = 0 | ) | +const | +
Returns the axis rect with index.
+Initially, only one axis rect (with index 0) exists in the plot. If multiple axis rects were added, all of them may be accessed with this function in a linear fashion (even when they are nested in a layout hierarchy or inside other axis rects via QCPAxisRect::insetLayout).
+The order of the axis rects is given by the fill order of the QCPLayout that is holding them. For example, if the axis rects are in the top level grid layout (accessible via QCustomPlot::plotLayout), they are ordered from left to right, top to bottom, if the layout's default setFillOrder of foColumnsFirst wasn't changed.
+If you want to access axis rects by their row and column index, use the layout interface. For example, use QCPLayoutGrid::element of the top level grid layout, and qobject_cast the returned layout element to QCPAxisRect. (See also The Layout System.)
| QList< QCPAxisRect * > QCustomPlot::axisRects | +( | +) | +const | +
Returns all axis rects in the plot.
+The order of the axis rects is given by the fill order of the QCPLayout that is holding them. For example, if the axis rects are in the top level grid layout (accessible via QCustomPlot::plotLayout), they are ordered from left to right, top to bottom, if the layout's default setFillOrder of foColumnsFirst wasn't changed.
+| QCPLayoutElement * QCustomPlot::layoutElementAt | +( | +const QPointF & | +pos | ) | +const | +
Returns the layout element at pixel position pos. If there is no element at that position, returns 0.
+Only visible elements are used. If QCPLayoutElement::setVisible on the element itself or on any of its parent elements is set to false, it will not be considered.
+| QCPAxisRect * QCustomPlot::axisRectAt | +( | +const QPointF & | +pos | ) | +const | +
Returns the layout element of type QCPAxisRect at pixel position pos. This method ignores other layout elements even if they are visually in front of the axis rect (e.g. a QCPLegend). If there is no axis rect at that position, returns 0.
+Only visible axis rects are used. If QCPLayoutElement::setVisible on the axis rect itself or on any of its parent elements is set to false, it will not be considered.
+| void QCustomPlot::rescaleAxes | +( | +bool | +onlyVisiblePlottables = false | ) | ++ |
Rescales the axes such that all plottables (like graphs) in the plot are fully visible.
+if onlyVisiblePlottables is set to true, only the plottables that have their visibility set to true (QCPLayerable::setVisible), will be used to rescale the axes.
+ + +| QList< QCPAxis * > QCustomPlot::selectedAxes | +( | +) | +const | +
Returns the axes that currently have selected parts, i.e. whose selection state is not QCPAxis::spNone.
+ + +| QList< QCPLegend * > QCustomPlot::selectedLegends | +( | +) | +const | +
Returns the legends that currently have selected parts, i.e. whose selection state is not QCPLegend::spNone.
+ + +| void QCustomPlot::deselectAll | +( | +) | ++ |
Deselects all layerables (plottables, items, axes, legends,...) of the QCustomPlot.
+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.
+ + +| bool QCustomPlot::savePdf | +( | +const QString & | +fileName, | +
| + | + | int | +width = 0, |
+
| + | + | int | +height = 0, |
+
| + | + | QCP::ExportPen | +exportPen = QCP::epAllowCosmetic, |
+
| + | + | const QString & | +pdfCreator = QString(), |
+
| + | + | const QString & | +pdfTitle = QString() |
+
| + | ) | ++ |
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.
+Setting exportPen to QCP::epNoCosmetic allows to disable 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 the QPainter and QPen documentation.
+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.
+QT_NO_PRINTER is set.| bool QCustomPlot::savePng | +( | +const QString & | +fileName, | +
| + | + | int | +width = 0, |
+
| + | + | int | +height = 0, |
+
| + | + | double | +scale = 1.0, |
+
| + | + | int | +quality = -1, |
+
| + | + | int | +resolution = 96, |
+
| + | + | QCP::ResolutionUnit | +resolutionUnit = QCP::ruDotsPerInch |
+
| + | ) | ++ |
Saves a PNG image file to fileName on disc. The output plot will have the dimensions width and height in pixels, multiplied by scale. If either width or height is zero, the current width and height of the QCustomPlot widget is used instead. 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.
+If you use a high scaling factor, it is recommended to enable antialiasing for all elements by temporarily setting QCustomPlot::setAntialiasedElements to QCP::aeAll as this allows QCustomPlot to place objects with sub-pixel accuracy.
+image compression can be controlled with the quality parameter which must be between 0 and 100 or -1 to use the default setting.
+The resolution will be written to the image file header and has no direct consequence for the quality or the pixel size. However, if opening the image with a tool which respects the metadata, it will be able to scale the image to match either a given size in real units of length (inch, centimeters, etc.), or the target display DPI. You can specify in which units resolution is given, by setting resolutionUnit. The resolution is converted to the format's expected resolution unit internally.
+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().
+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 PNG to have a transparent background, call setBackground(const QBrush &brush) with no brush (Qt::NoBrush) or a transparent color (Qt::transparent), before saving.
+| bool QCustomPlot::saveJpg | +( | +const QString & | +fileName, | +
| + | + | int | +width = 0, |
+
| + | + | int | +height = 0, |
+
| + | + | double | +scale = 1.0, |
+
| + | + | int | +quality = -1, |
+
| + | + | int | +resolution = 96, |
+
| + | + | QCP::ResolutionUnit | +resolutionUnit = QCP::ruDotsPerInch |
+
| + | ) | ++ |
Saves a JPEG image file to fileName on disc. The output plot will have the dimensions width and height in pixels, multiplied by scale. If either width or height is zero, the current width and height of the QCustomPlot widget is used instead. 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.
+If you use a high scaling factor, it is recommended to enable antialiasing for all elements by temporarily setting QCustomPlot::setAntialiasedElements to QCP::aeAll as this allows QCustomPlot to place objects with sub-pixel accuracy.
+image compression can be controlled with the quality parameter which must be between 0 and 100 or -1 to use the default setting.
+The resolution will be written to the image file header and has no direct consequence for the quality or the pixel size. However, if opening the image with a tool which respects the metadata, it will be able to scale the image to match either a given size in real units of length (inch, centimeters, etc.), or the target display DPI. You can specify in which units resolution is given, by setting resolutionUnit. The resolution is converted to the format's expected resolution unit internally.
+Returns true on success. If this function fails, most likely the JPEG format isn't supported by the system, see Qt docs about QImageWriter::supportedImageFormats().
+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.
+| bool QCustomPlot::saveBmp | +( | +const QString & | +fileName, | +
| + | + | int | +width = 0, |
+
| + | + | int | +height = 0, |
+
| + | + | double | +scale = 1.0, |
+
| + | + | int | +resolution = 96, |
+
| + | + | QCP::ResolutionUnit | +resolutionUnit = QCP::ruDotsPerInch |
+
| + | ) | ++ |
Saves a BMP image file to fileName on disc. The output plot will have the dimensions width and height in pixels, multiplied by scale. If either width or height is zero, the current width and height of the QCustomPlot widget is used instead. 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.
+If you use a high scaling factor, it is recommended to enable antialiasing for all elements by temporarily setting QCustomPlot::setAntialiasedElements to QCP::aeAll as this allows QCustomPlot to place objects with sub-pixel accuracy.
+The resolution will be written to the image file header and has no direct consequence for the quality or the pixel size. However, if opening the image with a tool which respects the metadata, it will be able to scale the image to match either a given size in real units of length (inch, centimeters, etc.), or the target display DPI. You can specify in which units resolution is given, by setting resolutionUnit. The resolution is converted to the format's expected resolution unit internally.
+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().
+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.
+| bool QCustomPlot::saveRastered | +( | +const QString & | +fileName, | +
| + | + | int | +width, | +
| + | + | int | +height, | +
| + | + | double | +scale, | +
| + | + | const char * | +format, | +
| + | + | int | +quality = -1, |
+
| + | + | int | +resolution = 96, |
+
| + | + | QCP::ResolutionUnit | +resolutionUnit = QCP::ruDotsPerInch |
+
| + | ) | ++ |
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().
+The resolution will be written to the image file header (if the file format supports this) and has no direct consequence for the quality or the pixel size. However, if opening the image with a tool which respects the metadata, it will be able to scale the image to match either a given size in real units of length (inch, centimeters, etc.), or the target display DPI. You can specify in which units resolution is given, by setting resolutionUnit. The resolution is converted to the format's expected resolution unit internally.
+ + +| QPixmap QCustomPlot::toPixmap | +( | +int | +width = 0, |
+
| + | + | int | +height = 0, |
+
| + | + | double | +scale = 1.0 |
+
| + | ) | ++ |
| void QCustomPlot::toPainter | +( | +QCPPainter * | +painter, | +
| + | + | int | +width = 0, |
+
| + | + | int | +height = 0 |
+
| + | ) | ++ |
Renders the plot using the passed painter.
+The plot is sized to width and height in pixels. If the painter's scale is not 1.0, the resulting plot will appear scaled accordingly.
+| void QCustomPlot::replot | +( | +QCustomPlot::RefreshPriority | +refreshPriority = QCustomPlot::rpRefreshHint | ) | ++ |
Causes a complete replot into the internal paint buffer(s). Finally, the widget surface is refreshed with the new buffer contents. This is the method that must be called to make changes to the plot, e.g. on the axis ranges or data points of graphs, visible.
+The parameter refreshPriority can be used to fine-tune the timing of the replot. For example if your application calls replot very quickly in succession (e.g. multiple independent functions change some aspects of the plot and each wants to make sure the change gets replotted), it is advisable to set refreshPriority to QCustomPlot::rpQueuedReplot. This way, the actual replotting is deferred to the next event loop iteration. Multiple successive calls of replot with this priority will only cause a single replot, avoiding redundant replots and improving performance.
+Under a few circumstances, QCustomPlot causes a replot by itself. Those are resize events of the QCustomPlot widget and user interactions (object selection and range dragging/zooming).
+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, it won't cause an infinite recursion.
+If a layer is in mode QCPLayer::lmBuffered (QCPLayer::setMode), it is also possible to replot only that specific layer via QCPLayer::replot. See the documentation there for details.
+ +
+
|
+ +signal | +
This signal is emitted when the QCustomPlot receives a mouse double click event.
+ +
+
|
+ +signal | +
This signal is emitted when the QCustomPlot receives a mouse press event.
+It is emitted before QCustomPlot handles any other mechanism like range dragging. So a slot connected to this signal can still influence the behaviour e.g. with QCPAxisRect::setRangeDrag or QCPAxisRect::setRangeDragAxes.
+ +
+
|
+ +signal | +
This signal is emitted when the QCustomPlot receives a mouse move event.
+It is emitted before QCustomPlot handles any other mechanism like range dragging. So a slot connected to this signal can still influence the behaviour e.g. with QCPAxisRect::setRangeDrag or QCPAxisRect::setRangeDragAxes.
+
+
|
+ +signal | +
This signal is emitted when the QCustomPlot receives a mouse release event.
+It is emitted before QCustomPlot handles any other mechanisms like object selection. So a slot connected to this signal can still influence the behaviour e.g. with setInteractions or QCPAbstractPlottable::setSelectable.
+ +
+
|
+ +signal | +
This signal is emitted when the QCustomPlot receives a mouse wheel event.
+It is emitted before QCustomPlot handles any other mechanisms like range zooming. So a slot connected to this signal can still influence the behaviour e.g. with QCPAxisRect::setRangeZoom, QCPAxisRect::setRangeZoomAxes or QCPAxisRect::setRangeZoomFactor.
+ +
+
|
+ +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. The parameter dataIndex indicates the data point that was closest to the click position.
+
+
|
+ +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. The parameter dataIndex indicates the data point that was closest to the click position.
+
+
|
+ +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.
+
+
|
+ +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.
+
+
|
+ +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.
+
+
|
+ +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.
+
+
|
+ +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. This happens for a click inside the legend padding or the space between two items.
+
+
|
+ +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. This happens for a click inside the legend padding or the space between two items.
+
+
|
+ +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 by a direct call to setSelected()/setSelection() on an object or by calling deselectAll.
In addition to this signal, selectable objects also provide individual signals, for example QCPAxis::selectionChanged or QCPAbstractPlottable::selectionChanged. Note that those signals are emitted even if the selection state is changed programmatically.
+See the documentation of setInteractions for details about the selection mechanism.
+ + +
+
|
+ +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, it won't cause an infinite recursion.
+
+
|
+ +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, it won't cause an infinite recursion.
+
+
|
+ +protectedvirtual | +
Returns a minimum size hint that corresponds to the minimum size of the top level layout (plotLayout). To prevent QCustomPlot from being collapsed to size/width zero, set a minimum size (setMinimumSize) either on the whole QCustomPlot or on any layout elements inside the plot. This is especially important, when placed in a QLayout where other components try to take in as much space as possible (e.g. QMdiArea).
+ +
+
|
+ +protectedvirtual | +
Returns a size hint that is the same as minimumSizeHint.
+ +
+
|
+ +protectedvirtual | +
Event handler for when the QCustomPlot widget needs repainting. This does not cause a replot, but draws the internal buffer on the widget surface.
+ +
+
|
+ +protectedvirtual | +
Event handler for a resize of the QCustomPlot widget. The viewport (which becomes the outer rect of mPlotLayout) is resized appropriately. Finally a replot is performed.
+ +
+
|
+ +protectedvirtual | +
Event handler for when a double click occurs. Emits the mouseDoubleClick signal, then determines the layerable under the cursor and forwards the event to it. Finally, emits the specialized signals when certain objecs are clicked (e.g. plottableDoubleClick, axisDoubleClick, etc.).
+
+
|
+ +protectedvirtual | +
Event handler for when a mouse button is pressed. Emits the mousePress signal.
+If the current setSelectionRectMode is not QCP::srmNone, passes the event to the selection rect. Otherwise determines the layerable under the cursor and forwards the event to it.
+
+
|
+ +protectedvirtual | +
Event handler for when the cursor is moved. Emits the mouseMove signal.
+If the selection rect (setSelectionRect) is currently active, the event is forwarded to it in order to update the rect geometry.
+Otherwise, if a layout element has mouse capture focus (a mousePressEvent happened on top of the layout element before), the mouseMoveEvent is forwarded to that element.
+
+
|
+ +protectedvirtual | +
Event handler for when a mouse button is released. Emits the mouseRelease signal.
+If the mouse was moved less than a certain threshold in any direction since the mousePressEvent, it is considered a click which causes the selection mechanism (if activated via setInteractions) to possibly change selection states accordingly. Further, specialized mouse click signals are emitted (e.g. plottableClick, axisClick, etc.)
+If a layerable is the mouse capturer (a mousePressEvent happened on top of the layerable before), the mouseReleaseEvent is forwarded to that element.
+
+
|
+ +protectedvirtual | +
Event handler for mouse wheel events. First, the mouseWheel signal is emitted. Then determines the affected layerable and forwards the event to it.
+ +
+
|
+ +protectedvirtual | +
This function draws the entire plot, including background pixmap, with the specified painter. It does not make use of the paint buffers like replot, so this is the function typically used by saving/exporting methods such as savePdf or toPainter.
+Note that it does not fill the background with the background brush (as the user may specify with setBackground(const QBrush &brush)), this is up to the respective functions calling this method.
+ +
+
|
+ +protectedvirtual | +
Performs the layout update steps defined by QCPLayoutElement::UpdatePhase, by calling QCPLayoutElement::update on the main plot layout.
+Here, the layout elements calculate their positions and margins, and prepare for the following draw call.
+ +
+
|
+ +protectedvirtual | +
This method is used by QCPAxisRect::removeAxis to report removed axes to the QCustomPlot so it may clear its QCustomPlot::xAxis, yAxis, xAxis2 and yAxis2 members accordingly.
+ +
+
|
+ +protectedvirtual | +
This method is used by the QCPLegend destructor to report legend removal to the QCustomPlot so it may clear its QCustomPlot::legend member accordingly.
+ +
+
|
+ +protectedvirtual | +
This slot is connected to the selection rect's QCPSelectionRect::accepted signal when setSelectionRectMode is set to QCP::srmSelect.
+First, it determines which axis rect was the origin of the selection rect judging by the starting point of the selection. Then it goes through the plottables (QCPAbstractPlottable1D to be precise) associated with that axis rect and finds the data points that are in rect. It does this by querying their QCPAbstractPlottable1D::selectTestRect method.
+Then, the actual selection is done by calling the plottables' QCPAbstractPlottable::selectEvent, placing the found selected data points in the details parameter as QVariant(QCPDataSelection). All plottables that weren't touched by rect receive a QCPAbstractPlottable::deselectEvent.
+
|
+ +protectedvirtual | +
This slot is connected to the selection rect's QCPSelectionRect::accepted signal when setSelectionRectMode is set to QCP::srmZoom.
+It determines which axis rect was the origin of the selection rect judging by the starting point of the selection, and then zooms the axes defined via QCPAxisRect::setRangeZoomAxes to the provided rect (see QCPAxisRect::zoom).
+
+
|
+ +protectedvirtual | +
This method is called when a simple left mouse click was detected on the QCustomPlot surface.
+It first determines the layerable that was hit by the click, and then calls its QCPLayerable::selectEvent. All other layerables receive a QCPLayerable::deselectEvent (unless the multi-select modifier was pressed, see setMultiSelectModifier).
+In this method the hit layerable is determined a second time using layerableAt (after the one in mousePressEvent), because we want onlySelectable set to true this time. This implies that the mouse event grabber (mMouseEventLayerable) may be a different one from the clicked layerable determined here. For example, if a non-selectable layerable is in front of a selectable layerable at the click position, the front layerable will receive mouse events but the selectable one in the back will receive the QCPLayerable::selectEvent.
+ + +
+
|
+ +protected | +
Registers the specified plottable with this QCustomPlot and, if setAutoAddPlottableToLegend is enabled, adds it to the legend (QCustomPlot::legend). QCustomPlot takes ownership of the plottable.
+Returns true on success, i.e. when plottable isn't already in this plot and the parent plot of plottable is this QCustomPlot.
+This method is called automatically in the QCPAbstractPlottable base class constructor.
+ +
+
|
+ +protected | +
In order to maintain the simplified graph interface of QCustomPlot, this method is called by the QCPGraph constructor to register itself with this QCustomPlot's internal graph list. Returns true on success, i.e. if graph is valid and wasn't already registered with this QCustomPlot.
+This graph specific registration happens in addition to the call to registerPlottable by the QCPAbstractPlottable base class.
+ +
+
|
+ +protected | +
Registers the specified item with this QCustomPlot. QCustomPlot takes ownership of the item.
+Returns true on success, i.e. when item wasn't already in the plot and the parent plot of item is this QCustomPlot.
+This method is called automatically in the QCPAbstractItem base class constructor.
+ +
+
|
+ +protected | +
Assigns all layers their index (QCPLayer::mIndex) in the mLayers list. This method is thus called after every operation that changes the layer indices, like layer removal, layer creation, layer moving.
+ +
+
|
+ +protected | +
Returns the top-most layerable at pixel position pos. If onlySelectable is set to true, only those layerables that are selectable will be considered. (Layerable subclasses communicate their selectability via the QCPLayerable::selectTest method, by returning -1.)
+selectionDetails is an output parameter that contains selection specifics of the affected layerable. This is useful if the respective layerable shall be given a subsequent QCPLayerable::selectEvent (like in mouseReleaseEvent). selectionDetails usually contains information about which part of the layerable was hit, in multi-part layerables (e.g. QCPAxis::SelectablePart). If the layerable is a plottable, selectionDetails contains a QCPDataSelection instance with the single data point which is closest to pos.
+
+
|
+ +protected | +
Returns the layerables at pixel position pos. If onlySelectable is set to true, only those layerables that are selectable will be considered. (Layerable subclasses communicate their selectability via the QCPLayerable::selectTest method, by returning -1.)
+The returned list is sorted by the layerable/drawing order. If you only need to know the top-most layerable, rather use layerableAt.
+selectionDetails is an output parameter that contains selection specifics of the affected layerable. This is useful if the respective layerable shall be given a subsequent QCPLayerable::selectEvent (like in mouseReleaseEvent). selectionDetails usually contains information about which part of the layerable was hit, in multi-part layerables (e.g. QCPAxis::SelectablePart). If the layerable is a plottable, selectionDetails contains a QCPDataSelection instance with the single data point which is closest to pos.
+
+
|
+ +protected | +
Draws the viewport background pixmap of the plot.
+If a pixmap was provided via setBackground, this function buffers the scaled version depending on setBackgroundScaled and setBackgroundScaledMode and then draws it inside the viewport with the provided painter. The scaled version is buffered in mScaledBackgroundPixmap to prevent expensive rescaling at every redraw. It is only updated, when the axis rect has changed in a way that requires a rescale of the background pixmap (this is dependent on the setBackgroundScaledMode), or when a differend axis background pixmap was set.
+Note that this function does not draw a fill with the background brush (setBackground(const QBrush &brush)) beneath the pixmap.
+ + +
+
|
+ +protected | +
Goes through the layers and makes sure this QCustomPlot instance holds the correct number of paint buffers and that they have the correct configuration (size, pixel ratio, etc.). Allocations, reallocations and deletions of paint buffers are performed as necessary. It also associates the paint buffers with the layers, so they draw themselves into the right buffer when QCPLayer::drawToPaintBuffer is called. This means it associates adjacent QCPLayer::lmLogical layers to a mutual paint buffer and creates dedicated paint buffers for layers in QCPLayer::lmBuffered mode.
+This method uses createPaintBuffer to create new paint buffers.
+After this method, the paint buffers are empty (filled with Qt::transparent) and invalidated (so an attempt to replot only a single buffered layer causes a full replot).
This method is called in every replot call, prior to actually drawing the layers (into their associated paint buffer). If the paint buffers don't need changing/reallocating, this method basically leaves them alone and thus finishes very fast.
+ +
+
|
+ +protected | +
This method is used by setupPaintBuffers when it needs to create new paint buffers.
+Depending on the current setting of setOpenGl, and the current Qt version, different backends (subclasses of QCPAbstractPaintBuffer) are created, initialized with the proper size and device pixel ratio, and returned.
+ +
+
|
+ +protected | +
This method returns whether any of the paint buffers held by this QCustomPlot instance are invalidated.
+If any buffer is invalidated, a partial replot (QCPLayer::replot) is not allowed and always causes a full replot (QCustomPlot::replot) of all layers. This is the case when for example the layer order has changed, new layers were added, layers were removed, or layer modes were changed (QCPLayer::setMode).
+ + +
+
|
+ +protected | +
When setOpenGl is set to true, this method is used to initialize OpenGL (create a context, surface, paint device).
+Returns true on success.
+If this method is successful, all paint buffers should be deleted and then reallocated by calling setupPaintBuffers, so the OpenGL-based paint buffer subclasses (QCPPaintBufferGlPbuffer, QCPPaintBufferGlFbo) are used for subsequent replots.
+
+
|
+ +protected | +
When setOpenGl is set to false, this method is used to deinitialize OpenGL (releases the context and frees resources).
+After OpenGL is disabled, all paint buffers should be deleted and then reallocated by calling setupPaintBuffers, so the standard software rendering paint buffer subclass (QCPPaintBufferPixmap) is used for subsequent replots.
+| QCPAxis * QCustomPlot::xAxis | +
A pointer to the primary x Axis (bottom) of the main axis rect of the plot.
+QCustomPlot offers convenient pointers to the axes (xAxis, yAxis, xAxis2, yAxis2) and the legend. They make it very easy working with plots that only have a single axis rect and at most one axis at each axis rect side. If you use the layout system to add multiple axis rects or multiple axes to one side, use the QCPAxisRect::axis interface to access the new axes. If one of the four default axes or the default legend is removed due to manipulation of the layout system (e.g. by removing the main axis rect), the corresponding pointers become 0.
+If an axis convenience pointer is currently zero and a new axis rect or a corresponding axis is added in the place of the main axis rect, QCustomPlot resets the convenience pointers to the according new axes. Similarly the legend convenience pointer will be reset if a legend is added after the main legend was removed before.
+ +| QCPAxis * QCustomPlot::yAxis | +
A pointer to the primary y Axis (left) of the main axis rect of the plot.
+QCustomPlot offers convenient pointers to the axes (xAxis, yAxis, xAxis2, yAxis2) and the legend. They make it very easy working with plots that only have a single axis rect and at most one axis at each axis rect side. If you use the layout system to add multiple axis rects or multiple axes to one side, use the QCPAxisRect::axis interface to access the new axes. If one of the four default axes or the default legend is removed due to manipulation of the layout system (e.g. by removing the main axis rect), the corresponding pointers become 0.
+If an axis convenience pointer is currently zero and a new axis rect or a corresponding axis is added in the place of the main axis rect, QCustomPlot resets the convenience pointers to the according new axes. Similarly the legend convenience pointer will be reset if a legend is added after the main legend was removed before.
+ +| QCPAxis * QCustomPlot::xAxis2 | +
A pointer to the secondary x Axis (top) of the main axis rect of the plot. Secondary axes are invisible by default. Use QCPAxis::setVisible to change this (or use QCPAxisRect::setupFullAxesBox).
+QCustomPlot offers convenient pointers to the axes (xAxis, yAxis, xAxis2, yAxis2) and the legend. They make it very easy working with plots that only have a single axis rect and at most one axis at each axis rect side. If you use the layout system to add multiple axis rects or multiple axes to one side, use the QCPAxisRect::axis interface to access the new axes. If one of the four default axes or the default legend is removed due to manipulation of the layout system (e.g. by removing the main axis rect), the corresponding pointers become 0.
+If an axis convenience pointer is currently zero and a new axis rect or a corresponding axis is added in the place of the main axis rect, QCustomPlot resets the convenience pointers to the according new axes. Similarly the legend convenience pointer will be reset if a legend is added after the main legend was removed before.
+ +| QCPAxis * QCustomPlot::yAxis2 | +
A pointer to the secondary y Axis (right) of the main axis rect of the plot. Secondary axes are invisible by default. Use QCPAxis::setVisible to change this (or use QCPAxisRect::setupFullAxesBox).
+QCustomPlot offers convenient pointers to the axes (xAxis, yAxis, xAxis2, yAxis2) and the legend. They make it very easy working with plots that only have a single axis rect and at most one axis at each axis rect side. If you use the layout system to add multiple axis rects or multiple axes to one side, use the QCPAxisRect::axis interface to access the new axes. If one of the four default axes or the default legend is removed due to manipulation of the layout system (e.g. by removing the main axis rect), the corresponding pointers become 0.
+If an axis convenience pointer is currently zero and a new axis rect or a corresponding axis is added in the place of the main axis rect, QCustomPlot resets the convenience pointers to the according new axes. Similarly the legend convenience pointer will be reset if a legend is added after the main legend was removed before.
+ +| QCPLegend * QCustomPlot::legend | +
A pointer to the default legend of the main axis rect. The legend is invisible by default. Use QCPLegend::setVisible to change this.
+QCustomPlot offers convenient pointers to the axes (xAxis, yAxis, xAxis2, yAxis2) and the legend. They make it very easy working with plots that only have a single axis rect and at most one axis at each axis rect side. If you use the layout system to add multiple legends to the plot, use the layout system interface to access the new legend. For example, legends can be placed inside an axis rect's inset layout, and must then also be accessed via the inset layout. If the default legend is removed due to manipulation of the layout system (e.g. by removing the main axis rect), the corresponding pointer becomes 0.
+If an axis convenience pointer is currently zero and a new axis rect or a corresponding axis is added in the place of the main axis rect, QCustomPlot resets the convenience pointers to the according new axes. Similarly the legend convenience pointer will be reset if a legend is added after the main legend was removed before.
+ +The following diagrams may help to gain a deeper understanding of the relationships between classes that make up the QCustomPlot library. The diagrams are not exhaustive, so only the classes deemed most relevant are shown.
+
+
++ + +
++Data Structures | |
| class | QCPDataContainer< DataType > |
| The generic data container for one-dimensional plottables. More... | |
In QCustomPlot, each plottable can be selected by the user, or programmatically. If the user shall be able to select data in any way, the interaction flag QCP::iSelectPlottables must be set in QCustomPlot::setInteractions.
+The selection granularity can be controlled via QCPAbstractPlottable::setSelectable, by specifying an according QCP::SelectionType. For example, when using QCP::stMultipleDataRanges, the user will have full freedom over which data points he selects and which not. On the other hand if we use QCP::stDataRange, the selection mechanism will enforce that the selected data is always one contiguous range. So if the user selects two distant data points (while holding the multi-select modifier, usually Ctrl), all data points in between those two points will also become selected.
These images show the effect of the different selection types, when the indicated selection rect was dragged:
+
+
+
+
+stNone |
+
+
+
+stWhole |
+
+
+
+stSingleData |
+
+
+
+stDataRange |
+
+
+
+stMultipleDataRanges |
The user can select data points in two ways:
+The first method is to click on the data points with the mouse cursor. In this case, if the user wants to select multiple data points one after the other, he has to press and hold the multi-select modifier (QCustomPlot::setMultiSelectModifier), and QCP::iMultiSelect must be set in QCustomPlot::setInteractions.
+The other method is by dragging a selection rect over the data points that shall be selected. This is possible if QCustomPlot::setSelectionRectMode is set to QCP::srmSelect. Note that while the selection rect mode is set (is not QCP::srmNone), mouse dragging will not be forwarded to underlying layout elements. This also means that axis ranges can't be dragged with the mouse anymore. If you wish to provide your user both with axis range dragging and data selection/range zooming, use QCustomPlot::setSelectionRectMode to switch between the modes just before the interaction is processed, e.g. in reaction to the QCustomPlot::mousePress or QCustomPlot::mouseMove signals. For example you could check whether the user is holding a certain keyboard modifier, and then decide which mode shall be set.
+Once the selection state of a plottable changes either by user interaction or programmatically, the affected plottable emits the signal QCPAbstractPlottable::selectionChanged, carrying the currently selected data points in the form of a QCPDataSelection. An overload of this signal is available, which just indicates in a bool whether the plottable has any selected data points.
By calling QCustomPlot::selectedPlottables you can retrieve a list of plottables which currently have selected data points. The current selection of a plottable can be retrieved via QCPAbstractPlottable::selection. There is also a method dedicated to QCPGraph plottables specifically, called QCustomPlot::selectedGraphs.
+A QCPDataSelection is a list of QCPDataRange instances, which themselves hold the begin and end index of the respective data range. In the case of a one-dimensional plottable (deriving from QCPAbstractPlottable1D, e.g. QCPGraph, QCPCurve, QCPBars, etc.) you can access the data points by index, using the data container's at(int index) method. Alternatively you can simply add the integer index to the data container's begin() iterator.
+As an example, the following code snippet calculates the average value of a graph's data selection:
Since QCPDataSelection instances are not tightly bound to a specific plottable, it is possible that the indices they contain exceed the valid data range of a plottable. The valid data range can be retrieved by accessing the plottable's data container and calling QCPDataContainer::dataRange. With this, you can check whether a given QCPDataSelection is contained in the valid range, and trim it if necessary, by using QCPDataSelection::contains, and QCPDataSelection::intersection, respectively.
+Of course, the data selections returned by QCPAbstractPlottable::selection are always within the plottable's data bounds, as long as they aren't changed after retrieving the selection.
+If you only want to find out which data point of a plottable is at or close to a given pixel position (without the need for a click or actual selection event), you can use QCPAbstractPlottable::selectTest. For example, the following code retrieves an iterator to the data point closest to a given QPoint in pixel coordinates:
+
+
+
+
+
+
+
+Directories |
+Files | |
| file | core.cpp |
| file | datacontainer.h |
| file | global.h |
+Files | |
| file | plottable-bars.h |
| file | plottable-curve.h |
| file | plottable-errorbar.h |
| file | plottable-financial.h |
| file | plottable-graph.h |
| file | plottable-statisticalbox.h |
| ▼ src | |
| ▼ plottables | |
| plottable-bars.h | |
| plottable-curve.h | |
| plottable-errorbar.h | |
| plottable-financial.h | |
| plottable-graph.h | |
| plottable-statisticalbox.h | |
| core.cpp | |
| datacontainer.h | |
| global.h |
+Namespaces | |
| QCP | |
+Macros | |
| +#define | QCP_DEVICEPIXELRATIO_SUPPORTED |
| +#define | QCP_DEVICEPIXELRATIO_FLOAT |
| +#define | QCUSTOMPLOT_VERSION_STR "2.0.1" |
| +#define | QCUSTOMPLOT_VERSION 0x020001 |
| +#define | QCP_LIB_DECL |
+Enumerations | |
| enum | QCP::ResolutionUnit |
| enum | QCP::ExportPen |
| enum | QCP::SignDomain |
| enum | QCP::MarginSide |
| enum | QCP::AntialiasedElement |
| enum | QCP::PlottingHint |
| enum | QCP::Interaction |
| enum | QCP::SelectionRectMode |
| enum | QCP::SelectionType |
+Functions | |
| bool | QCP::isInvalidData (double value) |
| bool | QCP::isInvalidData (double value1, double value2) |
| void | QCP::setMarginValue (QMargins &margins, QCP::MarginSide side, int value) |
| int | QCP::getMarginValue (const QMargins &margins, QCP::MarginSide side) |
+Variables | |
| +const QMetaObject | QCP::staticMetaObject |
| ▼CQCPAbstractPaintBuffer | The abstract base class for paint buffers, which define the rendering backend |
| CQCPPaintBufferGlFbo | A paint buffer based on OpenGL frame buffers objects, using hardware accelerated rendering |
| CQCPPaintBufferGlPbuffer | A paint buffer based on OpenGL pixel buffers, using hardware accelerated rendering |
| CQCPPaintBufferPixmap | A paint buffer based on QPixmap, using software raster rendering |
| ▼CQCPAxisTicker | The base class tick generator used by QCPAxis to create tick positions and tick labels |
| CQCPAxisTickerDateTime | Specialized axis ticker for calendar dates and times as axis ticks |
| CQCPAxisTickerFixed | Specialized axis ticker with a fixed tick step |
| CQCPAxisTickerLog | Specialized axis ticker suited for logarithmic axes |
| CQCPAxisTickerPi | Specialized axis ticker to display ticks in units of an arbitrary constant, for example pi |
| CQCPAxisTickerText | Specialized axis ticker which allows arbitrary labels at specified coordinates |
| CQCPAxisTickerTime | Specialized axis ticker for time spans in units of milliseconds to days |
| CQCPBarsData | Holds the data of one single data point (one bar) for QCPBars |
| CQCPBarsGroup | Groups multiple QCPBars together so they appear side by side |
| CQCPColorGradient | Defines a color gradient for use with e.g. QCPColorMap |
| CQCPColorMapData | Holds the two-dimensional data of a QCPColorMap plottable |
| CQCPCurveData | Holds the data of one single data point for QCPCurve |
| CQCPDataContainer< DataType > | The generic data container for one-dimensional plottables |
| CQCPDataRange | Describes a data range given by begin and end index |
| CQCPDataSelection | Describes a data set by holding multiple QCPDataRange instances |
| CQCPErrorBarsData | Holds the data of one single error bar for QCPErrorBars |
| CQCPFinancialData | Holds the data of one single data point for QCPFinancial |
| CQCPGraphData | Holds the data of one single data point for QCPGraph |
| ▼CQCPItemAnchor | An anchor of an item to which positions can be attached to |
| CQCPItemPosition | Manages the position of an item |
| CQCPLayer | A layer that may contain objects, to control the rendering order |
| ▼CQCPLayerable | Base class for all drawable objects |
| ▼CQCPAbstractItem | The abstract base class for all items in a plot |
| CQCPItemBracket | A bracket for referencing/highlighting certain parts in the plot |
| CQCPItemCurve | A curved line from one point to another |
| CQCPItemEllipse | An ellipse |
| CQCPItemLine | A line from one point to another |
| CQCPItemPixmap | An arbitrary pixmap |
| CQCPItemRect | A rectangle |
| CQCPItemStraightLine | A straight line that spans infinitely in both directions |
| CQCPItemText | A text label |
| CQCPItemTracer | Item that sticks to QCPGraph data points |
| ▼CQCPAbstractPlottable | The abstract base class for all data representing objects in a plot |
| CQCPAbstractPlottable1D< DataType > | A template base class for plottables with one-dimensional data |
| ▼CQCPAbstractPlottable1D< QCPBarsData > | |
| CQCPBars | A plottable representing a bar chart in a plot |
| ▼CQCPAbstractPlottable1D< QCPCurveData > | |
| CQCPCurve | A plottable representing a parametric curve in a plot |
| ▼CQCPAbstractPlottable1D< QCPFinancialData > | |
| CQCPFinancial | A plottable representing a financial stock chart |
| ▼CQCPAbstractPlottable1D< QCPGraphData > | |
| CQCPGraph | A plottable representing a graph in a plot |
| ▼CQCPAbstractPlottable1D< QCPStatisticalBoxData > | |
| CQCPStatisticalBox | A plottable representing a single statistical box in a plot |
| CQCPColorMap | A plottable representing a two-dimensional color map in a plot |
| CQCPErrorBars | A plottable that adds a set of error bars to other plottables |
| CQCPAxis | Manages a single axis inside a QCustomPlot |
| CQCPGrid | Responsible for drawing the grid of a QCPAxis |
| ▼CQCPLayoutElement | The abstract base class for all objects that form the layout system |
| ▼CQCPAbstractLegendItem | The abstract base class for all entries in a QCPLegend |
| CQCPPlottableLegendItem | A legend item representing a plottable with an icon and the plottable name |
| CQCPAxisRect | Holds multiple axes and arranges them in a rectangular shape |
| CQCPColorScale | A color scale for use with color coding data such as QCPColorMap |
| ▼CQCPLayout | The abstract base class for layouts |
| ▼CQCPLayoutGrid | A layout that arranges child elements in a grid |
| CQCPLegend | Manages a legend inside a QCustomPlot |
| CQCPLayoutInset | A layout that places child elements aligned to the border or arbitrarily positioned |
| CQCPTextElement | A layout element displaying a text |
| CQCPSelectionRect | Provides rect/rubber-band data selection and range zoom interaction |
| CQCPLineEnding | Handles the different ending decorations for line-like items |
| CQCPMarginGroup | A margin group allows synchronization of margin sides if working with multiple layout elements |
| CQCPPainter | QPainter subclass used internally |
| ▼CQCPPlottableInterface1D | Defines an abstract interface for one-dimensional plottables |
| CQCPAbstractPlottable1D< DataType > | A template base class for plottables with one-dimensional data |
| CQCPAbstractPlottable1D< QCPBarsData > | |
| CQCPAbstractPlottable1D< QCPCurveData > | |
| CQCPAbstractPlottable1D< QCPFinancialData > | |
| CQCPAbstractPlottable1D< QCPGraphData > | |
| CQCPAbstractPlottable1D< QCPStatisticalBoxData > | |
| CQCPErrorBars | A plottable that adds a set of error bars to other plottables |
| CQCPRange | Represents the range an axis is encompassing |
| CQCPScatterStyle | Represents the visual appearance of scatter points |
| ▼CQCPSelectionDecorator | Controls how a plottable's data selection is drawn |
| CQCPSelectionDecoratorBracket | A selection decorator which draws brackets around each selected data segment |
| CQCPStatisticalBoxData | Holds the data of one single data point for QCPStatisticalBox |
| CQCPVector2D | Represents two doubles as a mathematical 2D vector |
| CQCustomPlot | The central class of the library. This is the QWidget which displays the plot and interacts with the user |
+If you are new to QCustomPlot and just want to start using it, it's recommended to look at the tutorials and examples at
+ +This documentation is especially helpful as a reference, when you're familiar with the basics of data visualization with QCustomPlot and you wish to learn more about specific functionality or more advanced concepts. See the class overview for diagrams explaining the relationships between the most important classes of the QCustomPlot library.
+Plottables are classes that display any kind of data in QCustomPlot. They all derive from QCPAbstractPlottable. For example, QCPGraph is a plottable that displays a graph with different line styles, scatter styles, filling etc.
+Since plotting graphs is such a dominant use case, QCustomPlot has a special interface for working with QCPGraph plottables, that makes it very easy to handle them:
+ A new graph can be created with QCustomPlot::addGraph and accessed with QCustomPlot::graph.
For all other plottables, the normal plottable interface is used: First, an instance of the respective plottable is created and added to the QCustomPlot, e.g.
The properties of the newly created plottable can then be accessed via the newCurve pointer.
Plottables (including graphs) can be retrieved via QCustomPlot::plottable. Since the return type of that function is the abstract base class of all plottables, QCPAbstractPlottable, you will probably want to qobject_cast the returned pointer to the respective plottable subclass. As usual, the cast returns zero if the plottable wasn't of that specific subclass.
All further interfacing with plottables (e.g how to set data) is specific to the plottable type. See the documentations of the subclasses: QCPGraph, QCPCurve, QCPBars, QCPStatisticalBox, QCPColorMap, QCPFinancial.
+QCustomPlot has four default axes: xAxis (bottom), yAxis (left), xAxis2 (top), yAxis2 (right).
+Their range is handled by the simple QCPRange class which basically holds the lower and upper axis coordinate. You can set the range with the QCPAxis::setRange function. To change the axis scale type from a linear scale to a logarithmic scale, set QCPAxis::setScaleType to QCPAxis::stLogarithmic. In that case you will also want logarithmically spaced ticks and tick labels, so set the axis ticker with QCPAxis::setTicker to a QCPAxisTickerLog instance.
+Each axis can be given an axis label (e.g. "Voltage (mV)") with QCPAxis::setLabel.
+By default, an axis automatically creates and labels ticks in a sensible manner. See the various methods of the QCPAxis documentation for fine-tuning. Ticks can be disabled for an axis via QCPAxis::setTicks. If you only wish to hide tick labels (the numbers), use QCPAxis::setTickLabels. Note that the default right and top axes start out with hidden tick labels.
+The distance of an axis backbone to the respective viewport/widget border is called its margin. Normally, the margins are calculated automatically to fit the axis and tick labels. To change this, set QCPAxisRect::setAutoMargins to exclude the respective margin sides, and set the margins manually with QCPAxisRect::setMargins. The main axis rect can be accessed with QCustomPlot::axisRect(). A detailed explanation of the different margins/paddings/offset options is given in the QCPAxisRect and QCPAxis documentation.
+Every QCustomPlot has one QCPLegend (as QCustomPlot::legend) by default. A legend is a small layout element inside the plot which lists the plottables with an icon of the plottable line/symbol and a name (QCPAbstractPlottable::setName). Plottables can be added and removed from the legend via QCPAbstractPlottable::addToLegend and QCPAbstractPlottable::removeFromLegend. By default, adding a plottable to QCustomPlot automatically adds it to the legend, too. This behaviour can be changed with the QCustomPlot::setAutoAddPlottableToLegend property.
+QCPLegend provides an interface to access, add and remove legend items directly, too. See QCPLegend::item, QCPLegend::itemWithPlottable, QCPLegend::addItem, QCPLegend::removeItem for example.
+Multiple legends are supported via the layout system (since a QCPLegend is a normal layout element).
+QCustomPlot supports dragging axis ranges with the mouse (QCPAxisRect::setRangeDrag), zooming axis ranges with the mouse wheel (QCPAxisRect::setRangeZoom) and a complete selection mechanism with configurable granularity down to data points and data ranges.
+The availability of these interactions is controlled with QCustomPlot::setInteractions. For details about the interaction system, see the documentation there. The data selection is discussed in detail on the dedicated Data Selection Mechanism page.
+Further, QCustomPlot always emits corresponding signals, when objects are clicked or doubleClicked. See QCustomPlot::plottableClick, QCustomPlot::plottableDoubleClick and QCustomPlot::axisClick for example.
+Finally on the lowest level you can work with the QCPLayerable mouse event virtual methods in own subclasses, that the QCustomPlot instance calls on the affected layerable.
+Apart from plottables there is another category of plot objects that are important: Items. The base class of all items is QCPAbstractItem. An item sets itself apart from plottables in that it's not necessarily bound to any axes. This means it may also be positioned in absolute pixel coordinates or placed at a relative position on an axis rect. Further, it usually doesn't represent data directly, but acts as decoration, emphasis, description etc.
+Multiple items can be arranged in a parent-child-hierarchy allowing for dynamical behaviour. For example, you could place the head of an arrow at a fixed plot coordinate, so it always points to some important area in the plot. The tail of the arrow can be anchored to a text item which always resides in the top center of the axis rect, independent of where the user drags the axis ranges. This way the arrow stretches and turns so it always points from the label to the specified plot coordinate, without any further code necessary.
+For a more detailed introduction, see the QCPAbstractItem documentation, and from there the documentations of the individual standard items, to find out how to use them.
+QCustomPlot uses an internal layout system to provide dynamic sizing and positioning of objects like the axis rect(s), legends, color scales, and other layout elements. They are all based on QCPLayoutElement and are arranged by placing them inside a QCPLayout subclass, like QCPLayoutGrid.
+See the page about the layout system for details.
+QCustomPlot has multiple OpenGL backends to provide OpenGL hardware accelerated plotting across all supported Qt versions. If the computer supports OpenGL, you can enable it by compiling with QCUSTOMPLOT_USE_OPENGL and simply calling setOpenGl(true) on the respective QCustomPlot instance. More details are given in the documentation of that method.
Information on maximizing plot performance for demanding visualization tasks can be found on the dedicated page about Plot Performance Improvement.
+QCustomPlot understands some preprocessor defines that are useful for debugging and compilation. The flags must be defined before including the QCustomPlot header. Usually it's best to add them to your qmake project file, using e.g. DEFINES += QCUSTOMPLOT_USE_OPENGL
QCUSTOMPLOT_USE_OPENGL QCUSTOMPLOT_COMPILE_LIBRARY QCUSTOMPLOT_USE_LIBRARY QCUSTOMPLOT_CHECK_DATA See the page Special Qt Flags if your project uses QT_NO_CAST_FROM_ASCII, QT_NO_CAST_TO_ASCII or QT_NO_KEYWORDS.
+
+
+
+
+
+
+
+ |
+
+ |
+
+ |
+
+ |
+
+ |
+
+ |
+
+ |
+
+ |
+
+ |
+
+ |
+
+ |
+
+ |
+
+ |
+
+ |
+
+ |
+
+ |
+
+ |
+
+ |
+
+ |
+
+ |
+
+ |
+
+ |
+
+ |
+
+ |
+
+ |
| t |