QCPColorMap

Search for usage in LXR

Inheritance diagram for QCPColorMap:

Signals

void dataRangeChanged (const QCPRange &newRange)
 
void dataScaleTypeChanged (QCPAxis::ScaleType scaleType)
 
void gradientChanged (const QCPColorGradient &newGradient)
 
- Signals inherited from QCPAbstractPlottable
void selectableChanged (QCP::SelectionType selectable)
 
void selectionChanged (bool selected)
 
void selectionChanged (const QCPDataSelection &selection)
 
- Signals inherited from QCPLayerable
void layerChanged (QCPLayer *newLayer)
 

Public Member Functions

 QCPColorMap (QCPAxis *keyAxis, QCPAxis *valueAxis)
 
QCPColorScalecolorScale () const
 
QCPColorMapDatadata () const
 
QCPRange dataRange () const
 
QCPAxis::ScaleType dataScaleType () const
 
virtual QCPRange getKeyRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const override
 
virtual QCPRange getValueRange (bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const override
 
QCPColorGradient gradient () const
 
bool interpolate () const
 
void rescaleDataRange (bool recalculateDataBounds=false)
 
virtual double selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const override
 
void setColorScale (QCPColorScale *colorScale)
 
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)
 
bool tightBoundary () const
 
Q_SLOT void updateLegendIcon (Qt::TransformationMode transformMode=Qt::SmoothTransformation, const QSize &thumbSize=QSize(32, 18))
 
- Public Member Functions inherited from QCPAbstractPlottable
 QCPAbstractPlottable (QCPAxis *keyAxis, QCPAxis *valueAxis)
 
bool addToLegend ()
 
bool addToLegend (QCPLegend *legend)
 
bool antialiasedFill () const
 
bool antialiasedScatters () const
 
QBrush brush () const
 
const QPointF coordsToPixels (double key, double value) const
 
void coordsToPixels (double key, double value, double &x, double &y) const
 
virtual QCPPlottableInterface1Dinterface1D ()
 
QCPAxiskeyAxis () const
 
QString name () const
 
QPen pen () const
 
void pixelsToCoords (const QPointF &pixelPos, double &key, double &value) const
 
void pixelsToCoords (double x, double y, double &key, double &value) const
 
bool removeFromLegend () const
 
bool removeFromLegend (QCPLegend *legend) const
 
void rescaleAxes (bool onlyEnlarge=false) const
 
void rescaleKeyAxis (bool onlyEnlarge=false) const
 
void rescaleValueAxis (bool onlyEnlarge=false, bool inKeyRange=false) const
 
QCP::SelectionType selectable () const
 
bool selected () const
 
QCPDataSelection selection () const
 
QCPSelectionDecoratorselectionDecorator () const
 
void setAntialiasedFill (bool enabled)
 
void setAntialiasedScatters (bool enabled)
 
void setBrush (const QBrush &brush)
 
void setKeyAxis (QCPAxis *axis)
 
void setName (const QString &name)
 
void setPen (const QPen &pen)
 
Q_SLOT void setSelectable (QCP::SelectionType selectable)
 
Q_SLOT void setSelection (QCPDataSelection selection)
 
void setSelectionDecorator (QCPSelectionDecorator *decorator)
 
void setValueAxis (QCPAxis *axis)
 
QCPAxisvalueAxis () const
 
- Public Member Functions inherited from QCPLayerable
 QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=nullptr)
 
bool antialiased () const
 
QCPLayerlayer () const
 
QCPLayerableparentLayerable () const
 
QCustomPlotparentPlot () const
 
bool realVisibility () const
 
void setAntialiased (bool enabled)
 
bool setLayer (const QString &layerName)
 
Q_SLOT bool setLayer (QCPLayer *layer)
 
void setVisible (bool on)
 
bool visible () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
QBindable< QStringbindableObjectName ()
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo () const const
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isQuickItemType () const const
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_GADGET_EXPORT (EXPORT_MACRO)
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_MOC_INCLUDE Q_MOC_INCLUDE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setObjectName (QAnyStringView name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool setProperty (const char *name, QVariant &&value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds interval, Qt::TimerType timerType)
 
QThreadthread () const const
 

Protected Member Functions

virtual void draw (QCPPainter *painter) override
 
virtual void drawLegendIcon (QCPPainter *painter, const QRectF &rect) const override
 
virtual void updateMapImage ()
 
- Protected Member Functions inherited from QCPAbstractPlottable
void applyDefaultAntialiasingHint (QCPPainter *painter) const override
 
void applyFillAntialiasingHint (QCPPainter *painter) const
 
void applyScattersAntialiasingHint (QCPPainter *painter) const
 
virtual QRect clipRect () const override
 
virtual void deselectEvent (bool *selectionStateChanged) override
 
virtual void selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) override
 
virtual QCP::Interaction selectionCategory () const override
 
- Protected Member Functions inherited from QCPLayerable
void applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const
 
void initializeParentPlot (QCustomPlot *parentPlot)
 
virtual void mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details)
 
virtual void mouseMoveEvent (QMouseEvent *event, const QPointF &startPos)
 
virtual void mousePressEvent (QMouseEvent *event, const QVariant &details)
 
virtual void mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos)
 
bool moveToLayer (QCPLayer *layer, bool prepend)
 
virtual void parentPlotInitialized (QCustomPlot *parentPlot)
 
void setParentLayerable (QCPLayerable *parentLayerable)
 
virtual void wheelEvent (QWheelEvent *event)
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Protected Attributes

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

Additional Inherited Members

- Public Types inherited from QObject
typedef  QObjectList
 
- Properties inherited from QObject
 objectName
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 

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

Most important to 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. If your data may contain NaN values, use QCPColorGradient::setNanHandling to define how they are displayed.

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.

Definition at line 6079 of file qcustomplot.h.

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.

Definition at line 26443 of file qcustomplot.cpp.

◆ ~QCPColorMap()

QCPColorMap::~QCPColorMap ( )
overridevirtual

Definition at line 26454 of file qcustomplot.cpp.

Member Function Documentation

◆ colorScale()

QCPColorScale * QCPColorMap::colorScale ( ) const
inline

Definition at line 6101 of file qcustomplot.h.

◆ 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

Definition at line 6095 of file qcustomplot.h.

◆ dataRange()

QCPRange QCPColorMap::dataRange ( ) const
inline

Definition at line 6096 of file qcustomplot.h.

◆ dataRangeChanged

void QCPColorMap::dataRangeChanged ( const QCPRange & newRange)
signal

This signal is emitted when the data range changes.

See also
setDataRange

◆ dataScaleType()

QCPAxis::ScaleType QCPColorMap::dataScaleType ( ) const
inline

Definition at line 6097 of file qcustomplot.h.

◆ 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)
overrideprotectedvirtual

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.

Definition at line 26834 of file qcustomplot.cpp.

◆ drawLegendIcon()

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

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.

Definition at line 26903 of file qcustomplot.cpp.

◆ getKeyRange()

QCPRange QCPColorMap::getKeyRange ( bool & foundRange,
QCP::SignDomain inSignDomain = QCP::sdBoth ) const
overridevirtual

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.

Definition at line 26690 of file qcustomplot.cpp.

◆ getValueRange()

QCPRange QCPColorMap::getValueRange ( bool & foundRange,
QCP::SignDomain inSignDomain = QCP::sdBoth,
const QCPRange & inKeyRange = QCPRange() ) const
overridevirtual

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.

Definition at line 26712 of file qcustomplot.cpp.

◆ gradient()

QCPColorGradient QCPColorMap::gradient ( ) const
inline

Definition at line 6100 of file qcustomplot.h.

◆ gradientChanged

void QCPColorMap::gradientChanged ( const QCPColorGradient & newGradient)
signal

This signal is emitted when the gradient changes.

See also
setGradient

◆ interpolate()

bool QCPColorMap::interpolate ( ) const
inline

Definition at line 6098 of file qcustomplot.h.

◆ 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

Definition at line 26632 of file qcustomplot.cpp.

◆ selectTest()

double QCPColorMap::selectTest ( const QPointF & pos,
bool onlySelectable,
QVariant * details = nullptr ) const
overridevirtual

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 nullptr as details to indicate that you are not interested in those selection details.

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

Implements QCPAbstractPlottable.

Definition at line 26667 of file qcustomplot.cpp.

◆ 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 nullptr as colorScale to disconnect the color scale from this color map again.

Definition at line 26586 of file qcustomplot.cpp.

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

Definition at line 26466 of file qcustomplot.cpp.

◆ 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

Definition at line 26492 of file qcustomplot.cpp.

◆ setDataScaleType()

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

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

See also
QCPColorScale::setDataScaleType

Definition at line 26511 of file qcustomplot.cpp.

◆ 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

Definition at line 26534 of file qcustomplot.cpp.

◆ 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

Definition at line 26550 of file qcustomplot.cpp.

◆ 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

Definition at line 26567 of file qcustomplot.cpp.

◆ tightBoundary()

bool QCPColorMap::tightBoundary ( ) const
inline

Definition at line 6099 of file qcustomplot.h.

◆ 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

Definition at line 26653 of file qcustomplot.cpp.

◆ updateMapImage()

void QCPColorMap::updateMapImage ( )
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.

Definition at line 26756 of file qcustomplot.cpp.

Member Data Documentation

◆ mColorScale

QPointer<QCPColorScale> QCPColorMap::mColorScale
protected

Definition at line 6134 of file qcustomplot.h.

◆ mDataRange

QCPRange QCPColorMap::mDataRange
protected

Definition at line 6128 of file qcustomplot.h.

◆ mDataScaleType

QCPAxis::ScaleType QCPColorMap::mDataScaleType
protected

Definition at line 6129 of file qcustomplot.h.

◆ mGradient

QCPColorGradient QCPColorMap::mGradient
protected

Definition at line 6131 of file qcustomplot.h.

◆ mInterpolate

bool QCPColorMap::mInterpolate
protected

Definition at line 6132 of file qcustomplot.h.

◆ mLegendIcon

QPixmap QCPColorMap::mLegendIcon
protected

Definition at line 6138 of file qcustomplot.h.

◆ mMapData

QCPColorMapData* QCPColorMap::mMapData
protected

Definition at line 6130 of file qcustomplot.h.

◆ mMapImage

QImage QCPColorMap::mMapImage
protected

Definition at line 6137 of file qcustomplot.h.

◆ mMapImageInvalidated

bool QCPColorMap::mMapImageInvalidated
protected

Definition at line 6139 of file qcustomplot.h.

◆ mTightBoundary

bool QCPColorMap::mTightBoundary
protected

Definition at line 6133 of file qcustomplot.h.

◆ mUndersampledMapImage

QImage QCPColorMap::mUndersampledMapImage
protected

Definition at line 6137 of file qcustomplot.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 11 2024 12:15:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.