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 |
![]() | |
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 () |
![]() | |
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 |
![]() | |
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 |
void | addFillBasePoints (QVector< QPointF > *lines) const |
void | removeFillBasePoints (QVector< QPointF > *lines) const |
QPointF | lowerFillBasePoint (double lowerKey) const |
QPointF | upperFillBasePoint (double upperKey) const |
const QPolygonF | getChannelFillPolygon (const QVector< QPointF > *lines) 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 |
![]() | |
void | getDataSegments (QList< QCPDataRange > &selectedSegments, QList< QCPDataRange > &unselectedSegments) const |
void | drawPolyline (QCPPainter *painter, const QVector< QPointF > &lineData) const |
![]() | |
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 |
![]() | |
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 | |
![]() | |
void | selectionChanged (bool selected) |
void | selectionChanged (const QCPDataSelection &selection) |
void | selectableChanged (QCP::SelectionType selectable) |
![]() | |
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 |
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 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.
For general information about this virtual method, see the base class implementation.
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.
lines contains the points of the graph line, in pixel coordinates.
If the fill is a normal fill towards the zero-value-line, only the points in lines are required and two extra points at the zero-value-line, which are added by addFillBasePoints and removed by removeFillBasePoints after the fill drawing is done.
On the other hand if the fill is a channel fill between this QCPGraph and another QCPGraph (mChannelFillGraph), the more complex polygon is calculated with the getChannelFillPolygon function, and then drawn.
|
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 |
The line vector generated by e.g. getLines describes only the line that connects the data points. If the graph needs to be filled, two additional points need to be added at the value-zero-line in the lower and upper key positions of the graph. This function calculates these points and adds them to the end of lineData. Since the fill is typically drawn before the line stroke, these added points need to be removed again after the fill is done, with the removeFillBasePoints function.
The expanding of lines by two points will not cause unnecessary memory reallocations, because the data vector generation functions (e.g. getLines) reserve two extra points when they allocate memory for lines.
|
protected |
removes the two points from lines that were added by addFillBasePoints.
|
protected |
called by addFillBasePoints to conveniently assign the point which closes the fill polygon on the lower side of 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.
lowerKey will be the the key (in pixels) of the returned point. Depending on whether the key axis is horizontal or vertical, lowerKey will end up as the x or y value of the returned point, respectively.
|
protected |
called by addFillBasePoints to conveniently assign the point which closes the fill polygon on the upper side of 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.
upperKey will be the the key (in pixels) of the returned point. Depending on whether the key axis is horizontal or vertical, upperKey will end up as the x or y value of the returned point, respectively.
|
protected |
Generates the polygon needed for drawing channel fills between this graph and the graph specified in mChannelFillGraph (see setChannelFillGraph). The data points representing the line of this graph in pixel coordinates must be passed in lines, the corresponding points of the other graph are generated by calling its getLines method.
This method may return an empty polygon if the key ranges of the two graphs have no overlap of if they don't have the same orientation (e.g. one key axis vertical, the other horizontal). For increased performance (due to implicit sharing), it is recommended to 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 the case when plotting with horizontal key axis.
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 the case when plotting with horizontal key axis.
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 descending, as is the case when plotting with vertical key axis (since keys are ordered ascending).
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 descending, as is the case when plotting with vertical key axis.
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.