OmronPID
Loading...
Searching...
No Matches
Signals | Public Member Functions | Protected Member Functions | Protected Attributes | Friends
QCPColorMap Class Reference

A plottable representing a two-dimensional color map in a plot. More...

Inheritance diagram for QCPColorMap:
QCPAbstractPlottable QCPLayerable

Signals

void dataRangeChanged (const QCPRange &newRange)
 This signal is emitted when the data range changes.
 
void dataScaleTypeChanged (QCPAxis::ScaleType scaleType)
 This signal is emitted when the data scale type changes.
 
void gradientChanged (const QCPColorGradient &newGradient)
 This signal is emitted when the gradient changes.
 
- Signals inherited from QCPAbstractPlottable
void selectionChanged (bool selected)
 This signal is emitted when the selection state of this plottable has changed, either by user interaction or by a direct call to setSelection.
 
void selectionChanged (const QCPDataSelection &selection)
 This signal is emitted when the selection state of this plottable has changed, either by user interaction or by a direct call to setSelection.
 
void selectableChanged (QCP::SelectionType selectable)
 This signal is emitted when the selectability of this plottable has changed.
 
- Signals inherited from QCPLayerable
void layerChanged (QCPLayer *newLayer)
 This signal is emitted when the layer of this layerable changes, i.e.
 

Public Member Functions

 QCPColorMap (QCPAxis *keyAxis, QCPAxis *valueAxis)
 Constructs a color map with the specified keyAxis and valueAxis.
 
QCPColorMapDatadata () const
 Returns a pointer to the internal data storage of type QCPColorMapData.
 
QCPRange dataRange () const
 
QCPAxis::ScaleType dataScaleType () const
 
bool interpolate () const
 
bool tightBoundary () const
 
QCPColorGradient gradient () const
 
QCPColorScalecolorScale () const
 
void setData (QCPColorMapData *data, bool copy=false)
 Replaces the current data with the provided data.
 
Q_SLOT void setDataRange (const QCPRange &dataRange)
 Sets the data range of this color map to dataRange.
 
Q_SLOT void setDataScaleType (QCPAxis::ScaleType scaleType)
 Sets whether the data is correlated with the color gradient linearly or logarithmically.
 
Q_SLOT void setGradient (const QCPColorGradient &gradient)
 Sets the color gradient that is used to represent the data.
 
void 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 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).
 
void setColorScale (QCPColorScale *colorScale)
 Associates the color scale colorScale with this color map.
 
void rescaleDataRange (bool recalculateDataBounds=false)
 Sets the data range (setDataRange) to span the minimum and maximum values that occur in the current data set.
 
Q_SLOT void 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).
 
virtual double selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE
 This function is used to decide whether a click hits a layerable object or not.
 
virtual QCPRange getKeyRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const Q_DECL_OVERRIDE
 Returns the coordinate range that all data in this plottable span in the key axis dimension.
 
virtual QCPRange getValueRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const Q_DECL_OVERRIDE
 Returns the coordinate range that the data points in the specified key range (inKeyRange) span in the value axis dimension.
 
- Public Member Functions inherited from 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").
 
QString name () const
 
bool antialiasedFill () const
 
bool antialiasedScatters () const
 
QPen pen () const
 
QBrush brush () const
 
QCPAxiskeyAxis () const
 
QCPAxisvalueAxis () const
 
QCP::SelectionType selectable () const
 
bool selected () const
 Returns true if there are any data points of the plottable currently selected.
 
QCPDataSelection selection () const
 Returns a QCPDataSelection encompassing all the data points that are currently selected on this plottable.
 
QCPSelectionDecoratorselectionDecorator () const
 Provides access to the selection decorator of this plottable.
 
void setName (const QString &name)
 The name is the textual representation of this plottable as it is displayed in the legend (QCPLegend).
 
void setAntialiasedFill (bool enabled)
 Sets whether fills of this plottable are drawn antialiased or not.
 
void setAntialiasedScatters (bool enabled)
 Sets whether the scatter symbols of this plottable are drawn antialiased or not.
 
void setPen (const QPen &pen)
 The pen is used to draw basic lines that make up the plottable representation in the plot.
 
void setBrush (const QBrush &brush)
 The brush is used to draw basic fills of the plottable representation in the plot.
 
void 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.
 
void 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.
 
Q_SLOT void setSelectable (QCP::SelectionType selectable)
 Sets whether and to which granularity this plottable can be selected.
 
Q_SLOT void setSelection (QCPDataSelection selection)
 Sets which data ranges of this plottable are selected.
 
void setSelectionDecorator (QCPSelectionDecorator *decorator)
 Use this method to set an own QCPSelectionDecorator (subclass) instance.
 
virtual double selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const =0
 This function is used to decide whether a click hits a layerable object or not.
 
virtual QCPPlottableInterface1Dinterface1D ()
 If this plottable is a one-dimensional plottable, i.e.
 
virtual QCPRange getKeyRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const =0
 Returns the coordinate range that all data in this plottable span in the key axis dimension.
 
virtual QCPRange getValueRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const =0
 Returns the coordinate range that the data points in the specified key range (inKeyRange) span in the value axis dimension.
 
void 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.
 
const QPointF coordsToPixels (double key, double value) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Transforms the given key and value to pixel coordinates and returns them in a QPointF.
 
void 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.
 
void pixelsToCoords (const QPointF &pixelPos, double &key, double &value) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the pixel input pixelPos as plot coordinates key and value.
 
void 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.
 
void rescaleKeyAxis (bool onlyEnlarge=false) const
 Rescales the key axis of the plottable so the whole plottable is visible.
 
void rescaleValueAxis (bool onlyEnlarge=false, bool inKeyRange=false) const
 Rescales the value axis of the plottable so the whole plottable is visible.
 
bool addToLegend (QCPLegend *legend)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Adds this plottable to the specified legend.
 
bool addToLegend ()
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Adds this plottable to the legend of the parent QCustomPlot (QCustomPlot::legend).
 
bool removeFromLegend (QCPLegend *legend) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Removes the plottable from the specifed legend.
 
bool removeFromLegend () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Removes the plottable from the legend of the parent QCustomPlot.
 
- Public Member Functions inherited from QCPLayerable
 QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0)
 Creates a new QCPLayerable instance.
 
bool visible () const
 
QCustomPlotparentPlot () const
 
QCPLayerableparentLayerable () const
 Returns the parent layerable of this layerable.
 
QCPLayerlayer () const
 
bool antialiased () const
 
void setVisible (bool on)
 Sets the visibility of this layerable object.
 
Q_SLOT bool setLayer (QCPLayer *layer)
 Sets the layer of this layerable object.
 
bool setLayer (const QString &layerName)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Sets the layer of this layerable object by name.
 
void setAntialiased (bool enabled)
 Sets whether this object will be drawn antialiased or not.
 
virtual double selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const
 This function is used to decide whether a click hits a layerable object or not.
 
bool 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.
 

Protected Member Functions

virtual void updateMapImage ()
 
virtual void draw (QCPPainter *painter) Q_DECL_OVERRIDE
 
virtual void drawLegendIcon (QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE
 
- Protected Member Functions inherited from QCPAbstractPlottable
virtual QRect clipRect () const Q_DECL_OVERRIDE
 
virtual void draw (QCPPainter *painter) Q_DECL_OVERRIDE=0
 
virtual QCP::Interaction selectionCategory () const Q_DECL_OVERRIDE
 
void applyDefaultAntialiasingHint (QCPPainter *painter) const Q_DECL_OVERRIDE
 
virtual void selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) Q_DECL_OVERRIDE
 
virtual void deselectEvent (bool *selectionStateChanged) Q_DECL_OVERRIDE
 
virtual void drawLegendIcon (QCPPainter *painter, const QRectF &rect) const =0
 
void applyFillAntialiasingHint (QCPPainter *painter) const
 
void applyScattersAntialiasingHint (QCPPainter *painter) const
 
- Protected Member Functions inherited from QCPLayerable
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)
 This event gets called when the user presses a mouse button while the cursor is over the layerable.
 
virtual void mouseMoveEvent (QMouseEvent *event, const QPointF &startPos)
 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.
 
virtual void mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos)
 This event gets called when the user releases the mouse button, after this layerable has become the mouse grabber by accepting the preceding mousePressEvent.
 
virtual void mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details)
 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.
 
virtual void wheelEvent (QWheelEvent *event)
 This event gets called when the user turns the mouse scroll wheel while the cursor is over the layerable.
 
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 Attributes

QCPRange mDataRange
 
QCPAxis::ScaleType mDataScaleType
 
QCPColorMapDatamMapData
 
QCPColorGradient mGradient
 
bool mInterpolate
 
bool mTightBoundary
 
QPointer< QCPColorScalemColorScale
 
QImage mMapImage
 
QImage mUndersampledMapImage
 
QPixmap mLegendIcon
 
bool mMapImageInvalidated
 
- Protected Attributes inherited from QCPAbstractPlottable
QString mName
 
bool mAntialiasedFill
 
bool mAntialiasedScatters
 
QPen mPen
 
QBrush mBrush
 
QPointer< QCPAxismKeyAxis
 
QPointer< QCPAxismValueAxis
 
QCP::SelectionType mSelectable
 
QCPDataSelection mSelection
 
QCPSelectionDecoratormSelectionDecorator
 
- Protected Attributes inherited from QCPLayerable
bool mVisible
 
QCustomPlotmParentPlot
 
QPointer< QCPLayerablemParentLayerable
 
QCPLayermLayer
 
bool mAntialiased
 

Friends

class QCustomPlot
 
class QCPLegend
 

Detailed Description

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.

Changing the appearance

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

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).

Usage

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.:

Note
The QCPColorMap always displays the data at equal key/value intervals, even if the key or value axis is set to a logarithmic scaling. If you want to use QCPColorMap with logarithmic axes, you shouldn't use the QCPColorMapData::setData method as it uses a linear transformation to determine the cell index. Rather directly access the cell index with QCPColorMapData::setCell.

Constructor & Destructor Documentation

◆ QCPColorMap()

QCPColorMap::QCPColorMap ( QCPAxis keyAxis,
QCPAxis valueAxis 
)
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.

Member Function Documentation

◆ data()

QCPColorMapData * QCPColorMap::data ( ) const
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.

See also
setData

◆ dataRangeChanged

void QCPColorMap::dataRangeChanged ( const QCPRange newRange)
signal

This signal is emitted when the data range changes.

See also
setDataRange

◆ dataScaleTypeChanged

void QCPColorMap::dataScaleTypeChanged ( QCPAxis::ScaleType  scaleType)
signal

This signal is emitted when the data scale type changes.

See also
setDataScaleType

◆ draw()

void QCPColorMap::draw ( QCPPainter painter)
protectedvirtual

Implements QCPAbstractPlottable.

◆ drawLegendIcon()

void QCPColorMap::drawLegendIcon ( QCPPainter painter,
const QRectF &  rect 
) const
protectedvirtual

Implements QCPAbstractPlottable.

◆ getKeyRange()

QCPRange QCPColorMap::getKeyRange ( bool &  foundRange,
QCP::SignDomain  inSignDomain = QCP::sdBoth 
) const
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.

See also
rescaleAxes, getValueRange

Implements QCPAbstractPlottable.

◆ getValueRange()

QCPRange QCPColorMap::getValueRange ( bool &  foundRange,
QCP::SignDomain  inSignDomain = QCP::sdBoth,
const QCPRange inKeyRange = QCPRange() 
) const
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.

See also
rescaleAxes, getKeyRange

Implements QCPAbstractPlottable.

◆ gradientChanged

void QCPColorMap::gradientChanged ( const QCPColorGradient newGradient)
signal

This signal is emitted when the gradient changes.

See also
setGradient

◆ rescaleDataRange()

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.

See also
setDataRange

◆ selectTest()

double QCPColorMap::selectTest ( const QPointF &  pos,
bool  onlySelectable,
QVariant *  details = 0 
) const
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.

You may pass 0 as details to indicate that you are not interested in those selection details.

See also
selectEvent, deselectEvent, mousePressEvent, wheelEvent, QCustomPlot::setInteractions

Implements QCPAbstractPlottable.

◆ setColorScale()

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.

◆ setData()

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.

◆ setDataRange()

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.

See also
QCPColorScale::setDataRange

◆ setDataScaleType()

void QCPColorMap::setDataScaleType ( QCPAxis::ScaleType  scaleType)

Sets whether the data is correlated with the color gradient linearly or logarithmically.

See also
QCPColorScale::setDataScaleType

◆ setGradient()

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.

See also
QCPColorScale::setGradient

◆ setInterpolate()

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.

A 10*10 color map, with interpolation and without interpolation enabled

◆ setTightBoundary()

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.

A color map, with tight boundary enabled and disabled

◆ updateLegendIcon()

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.

See also
setDataRange

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