Class QAccelPlot::Colormap¶
ClassList > QAccelPlot > Colormap
Maps data values to colors: a color ramp plus the rule that places a value on it. More...
#include <Colormap.hpp>
Inherits the following classes: QObject, QQmlParserStatus
Inheritance diagram¶
flowchart TB
classQAccelPlot_1_1Colormap["QAccelPlot::Colormap"]
external_base_classQAccelPlot_1_1Colormap_1["QObject"]
external_base_classQAccelPlot_1_1Colormap_1 --> classQAccelPlot_1_1Colormap
external_base_classQAccelPlot_1_1Colormap_2["QQmlParserStatus"]
external_base_classQAccelPlot_1_1Colormap_2 --> classQAccelPlot_1_1Colormap
Public Types¶
| Type | Name |
|---|---|
| enum | Preset Built-in color ramps. |
Public Properties¶
| Type | Name |
|---|---|
| property bool | logScale Whether values are placed on the ramp in log10 instead of linearly. Default: false . |
| property qreal | max Value at ramp position 1. Unset (NaN) resolves it from the data. Default: unset. |
| property qreal | min Value at ramp position 0. Unset (NaN) resolves it from the data. Default: unset. |
| property Preset | preset Built-in color ramp. Ignored when stops is non-empty. Default:Viridis . |
| property bool | reversed Whether the ramp runs from its last color to its first. Applies to preset andstops alike. Default:false . |
| property QQmlListProperty< QObject > | stops Custom ramp as a list of objects with position andcolor , such asGradientStop . Overridespreset when non-empty. Stops are read again once the component is complete. The ramp follows changes to a stop that notifies them, to aGradientStop inside aGradient , and to aGradientStop declared in this list. |
Public Signals¶
| Type | Name |
|---|---|
| signal void | colormapChanged Emitted when the ramp, its bounds, or logScale changes. |
Public Functions¶
| Type | Name |
|---|---|
| Colormap (QObject * parent=nullptr) Constructs a Colormap with the given__parent . |
|
| bool | logScale () const Returns true when values are placed on the ramp in log10. |
| qreal | max () const Returns the fixed upper bound, or NaN when it is resolved from the data. |
| qreal | min () const Returns the fixed lower bound, or NaN when it is resolved from the data. |
| Preset | preset () const Returns the built-in ramp. |
| const std::vector< GradientStopData > & | resolvedStops () const Returns the resolved ramp stops, in position order and covering [0, 1]. |
| bool | reversed () const Returns whether the ramp is reversed. |
| void | setLogScale (bool on) Sets log-scale placement to on . |
| void | setMax (qreal value) Sets the fixed upper bound to value . NaN resolves it from the data. |
| void | setMin (qreal value) Sets the fixed lower bound to value . NaN resolves it from the data. |
| void | setPreset (Preset preset) Sets the built-in ramp to preset . |
| Q_INVOKABLE void | setRange (qreal min, qreal max) Sets both bounds to min and__max with a single colormapChanged() . NaN unsets a bound. |
| void | setReversed (bool reversed) Sets whether the ramp is reversed to reversed . |
| QQmlListProperty< QObject > | stops () Returns the custom ramp stops, empty when the preset supplies the ramp. |
Protected Functions¶
| Type | Name |
|---|---|
| void | classBegin () override Does nothing; part of QQmlParserStatus . |
| void | componentComplete () override Reads the stops again after their bindings are evaluated. |
Detailed Description¶
A colormap has no geometry. It is a one-dimensional ramp addressed by a normalized coordinate in [0, 1], and logScale decides how a value reaches that coordinate. Series that color by value, such as PointCloud and HeatmapSeries, index the ramp with each value. Effects that paint a ramp across the plot, such as GradientFill and GradientStroke, supply the coordinate from a position instead and own that geometry themselves, so they use only the ramp.
The ramp comes from preset, or from stops when a custom ramp is given. min and max bound the value range; leaving either unset resolves it from the data, so one colormap can be shared between series that resolve different ranges. Each series reports what it resolved through ColormappedSeries::dataValueMin() and ColormappedSeries::dataValueMax().
See also: PointCloud, HeatmapSeries, BarSeries, GradientFill, GradientStroke
Public Types Documentation¶
enum Preset¶
Built-in color ramps.
The perceptually uniform ramps are sampled from the matplotlib originals. Prefer them over Rainbow, whose uneven lightness invents boundaries that are not in the data.
Public Properties Documentation¶
property logScale¶
Whether values are placed on the ramp in log10 instead of linearly. Default: false .
Values at or below zero are unmapped. A ColorBar showing the colormap gets decade ticks.
property max¶
Value at ramp position 1. Unset (NaN) resolves it from the data. Default: unset.
property min¶
Value at ramp position 0. Unset (NaN) resolves it from the data. Default: unset.
property preset¶
Built-in color ramp. Ignored when stops is non-empty. Default:Viridis .
property reversed¶
Whether the ramp runs from its last color to its first. Applies to preset andstops alike. Default:false .
property stops¶
Custom ramp as a list of objects with position andcolor , such asGradientStop . Overridespreset when non-empty. Stops are read again once the component is complete. The ramp follows changes to a stop that notifies them, to aGradientStop inside aGradient , and to aGradientStop declared in this list.
Public Signals Documentation¶
signal colormapChanged¶
Emitted when the ramp, its bounds, or logScale changes.
Public Functions Documentation¶
function Colormap¶
Constructs a Colormap with the given__parent .
function logScale¶
Returns true when values are placed on the ramp in log10.
function max¶
Returns the fixed upper bound, or NaN when it is resolved from the data.
function min¶
Returns the fixed lower bound, or NaN when it is resolved from the data.
function preset¶
Returns the built-in ramp.
function resolvedStops¶
Returns the resolved ramp stops, in position order and covering [0, 1].
Custom stops when set, otherwise the preset ramp, flipped when reversed is set.
function reversed¶
Returns whether the ramp is reversed.
function setLogScale¶
Sets log-scale placement to on .
function setMax¶
Sets the fixed upper bound to value . NaN resolves it from the data.
function setMin¶
Sets the fixed lower bound to value . NaN resolves it from the data.
function setPreset¶
Sets the built-in ramp to preset .
function setRange¶
Sets both bounds to min and__max with a singlecolormapChanged() . NaN unsets a bound.
function setReversed¶
Sets whether the ramp is reversed to reversed .
function stops¶
Returns the custom ramp stops, empty when the preset supplies the ramp.
Protected Functions Documentation¶
function classBegin¶
Does nothing; part of QQmlParserStatus .
function componentComplete¶
Reads the stops again after their bindings are evaluated.
The documentation for this class was generated from the following file QAccelPlot/src/QAccelPlot/effects/Colormap.hpp