|
Wt
4.10.0
|
Maps numerical values to colors. More...
#include <WAbstractColorMap.h>
Public Member Functions | |
| WAbstractColorMap (double min, double max) | |
| Constructor. | |
| virtual WColor | toColor (double value) const =0 |
| Converts a numerical value to a WColor. | |
| virtual void | createStrip (WPainter *painter, const WRectF &area=WRectF()) const =0 |
| Paints the colormap as a colored strip. | |
| virtual void | paintLegend (WPainter *painter, const WRectF &area=WRectF()) const =0 |
| Paints the colormap as a legend. | |
| double | minimum () const |
| Returns the minimum of the colormap range. | |
| double | maximum () const |
| Returns the maximum of the colormap range. | |
| void | setTickSpacing (int spacing) |
| Sets the tickspacing for the legend as a number of line-heights. | |
| int | tickSpacing () const |
| Returns the tickspacing for the legend. | |
| void | setFormatString (const WString &format) |
| Sets the format for the labels on the colormap-legend. | |
| const WString & | formatString () const |
| Returns the format string. | |
| void | setLabelFont (const WFont &font) |
| Sets the font to be used when drawing the labels in the legend. | |
| const WFont & | labelFont () |
| Returns the font to be used when drawing the labels in the legend. | |
Public Member Functions inherited from Wt::WObject | |
| void | addChild (std::unique_ptr< WObject > child) |
| Add a child WObject whose lifetime is determined by this WObject. | |
| template<typename Child > | |
| Child * | addChild (std::unique_ptr< Child > child) |
| Add a child WObject, returning a raw pointer. | |
| std::unique_ptr< WObject > | removeChild (WObject *child) |
| Remove a child WObject, so its lifetime is no longer determined by this WObject. | |
| template<typename Child > | |
| std::unique_ptr< Child > | removeChild (Child *child) |
| Remove a child WObject, so its lifetime is no longer determined by this WObject. | |
| virtual const std::string | id () const |
| Returns the (unique) identifier for this object. | |
| virtual void | setObjectName (const std::string &name) |
| Sets an object name. | |
| virtual std::string | objectName () const |
| Returns the object name. | |
| void | resetLearnedSlots () |
| Resets learned stateless slot implementations. | |
| template<class T > | |
| void | resetLearnedSlot (void(T::*method)()) |
| Resets a learned stateless slot implementation. | |
| template<class T > | |
| WStatelessSlot * | implementStateless (void(T::*method)()) |
| Declares a slot to be stateless and learn client-side behaviour on first invocation. | |
| template<class T > | |
| WStatelessSlot * | implementStateless (void(T::*method)(), void(T::*undoMethod)()) |
| Declares a slot to be stateless and learn client-side behaviour in advance. | |
| void | isNotStateless () |
| Marks the current function as not stateless. | |
| template<class T > | |
| WStatelessSlot * | implementJavaScript (void(T::*method)(), const std::string &jsCode) |
| Provides a JavaScript implementation for a method. | |
Public Member Functions inherited from Wt::Core::observable | |
| observable () noexcept | |
| Default constructor. | |
| virtual | ~observable () |
| Destructor. | |
| template<typename... Args, typename C > | |
| auto | bindSafe (void(C::*method)(Args...)) noexcept |
| Protects a method call against object destruction. | |
| template<typename... Args, typename C > | |
| auto | bindSafe (void(C::*method)(Args...) const) const noexcept |
| Protects a const method call against object destruction. | |
| template<typename Function > | |
| auto | bindSafe (const Function &function) noexcept |
| Protects a function against object destruction. | |
Additional Inherited Members | |
Public Types inherited from Wt::WObject | |
| typedef void(WObject::* | Method) () |
| Typedef for a WObject method without arguments. | |
Protected Member Functions inherited from Wt::WObject | |
| virtual WStatelessSlot * | getStateless (Method method) |
| On-demand stateless slot implementation. | |
Maps numerical values to colors.
The colormap has functionality to convert a numerical value to a WColor. For details on how, see the documentation of the implementations.
A colormap has a certain numerical range. When a colormap is painted as a colored strip or as a legend, this range is what will be presented, even if the colormap has the ability to convert values outside this range.
| Wt::Chart::WAbstractColorMap::WAbstractColorMap | ( | double | min, |
| double | max | ||
| ) |
Constructor.
Constructor taking a minimum and maximum value, determining the active range of the colormap. The default value for tickSpacing is 2 and the default label format is 2 decimal points.
|
pure virtual |
Paints the colormap as a colored strip.
This paints the colormap from the minimum to the maximum value in the provided area (default = fill the entire paintdevice). This is no legend with ticks and labels, only the colors are painted.
Implemented in Wt::Chart::WStandardColorMap.
| const WString & Wt::Chart::WAbstractColorMap::formatString | ( | ) | const |
Returns the format string.
| const WFont & Wt::Chart::WAbstractColorMap::labelFont | ( | ) |
Returns the font to be used when drawing the labels in the legend.
|
pure virtual |
Paints the colormap as a legend.
The colormap is painted as a legend with ticks and value-labels. The parameter area can be used to specify a part of the paintdevice where the legend should be drawn. When drawing the legend, the tickspacing, labelformat and labelfont are taken into account.
Implemented in Wt::Chart::WStandardColorMap.
| void Wt::Chart::WAbstractColorMap::setFormatString | ( | const WString & | format | ) |
Sets the format for the labels on the colormap-legend.
The format string is interpreted by snprintf(). The default is a float with two decimal places.
| void Wt::Chart::WAbstractColorMap::setLabelFont | ( | const WFont & | font | ) |
Sets the font to be used when drawing the labels in the legend.
The default is a default constructed WFont.
| void Wt::Chart::WAbstractColorMap::setTickSpacing | ( | int | spacing | ) |
Sets the tickspacing for the legend as a number of line-heights.
The tickspacing must be specified as an integer number of line-heigths. For example, the default value of 2 will leave two line-heights between the labels of the ticks.
| int Wt::Chart::WAbstractColorMap::tickSpacing | ( | ) | const |
Returns the tickspacing for the legend.