Class WAbstractColorMap
- java.lang.Object
-
- eu.webtoolkit.jwt.WObject
-
- eu.webtoolkit.jwt.chart.WAbstractColorMap
-
- Direct Known Subclasses:
WStandardColorMap
public abstract class WAbstractColorMap extends WObject
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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData
-
-
Field Summary
Fields Modifier and Type Field Description protected WStringformat_protected WFontlabelFont_protected doublemax_protected doublemin_protected inttickSpacing_
-
Constructor Summary
Constructors Constructor Description WAbstractColorMap(double min, double max)Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcreateStrip(WPainter painter)Paints the colormap as a colored strip.abstract voidcreateStrip(WPainter painter, WRectF area)Paints the colormap as a colored strip.WStringgetFormatString()Returns the format string.WFontgetLabelFont()Returns the font to be used when drawing the labels in the legend.doublegetMaximum()Returns the maximum of the colormap range.doublegetMinimum()Returns the minimum of the colormap range.intgetTickSpacing()Returns the tickspacing for the legend.voidpaintLegend(WPainter painter)Paints the colormap as a legend.abstract voidpaintLegend(WPainter painter, WRectF area)Paints the colormap as a legend.voidsetFormatString(java.lang.CharSequence format)Sets the format for the labels on the colormap-legend.voidsetLabelFont(WFont font)Sets the font to be used when drawing the labels in the legend.voidsetTickSpacing(int spacing)Sets the tickspacing for the legend as a number of line-heights.abstract WColortoColor(double value)Converts a numerical value to aWColor.-
Methods inherited from class eu.webtoolkit.jwt.WObject
getId, getObjectName, remove, setFormData, setObjectName, tr
-
-
-
-
Method Detail
-
createStrip
public abstract void createStrip(WPainter painter, WRectF area)
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.
-
createStrip
public final void createStrip(WPainter painter)
Paints the colormap as a colored strip.
-
paintLegend
public abstract void paintLegend(WPainter painter, WRectF area)
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.
-
paintLegend
public final void paintLegend(WPainter painter)
Paints the colormap as a legend.
-
getMinimum
public double getMinimum()
Returns the minimum of the colormap range.
-
getMaximum
public double getMaximum()
Returns the maximum of the colormap range.
-
setTickSpacing
public void 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.
-
getTickSpacing
public int getTickSpacing()
Returns the tickspacing for the legend.- See Also:
setTickSpacing(int spacing)
-
setFormatString
public void setFormatString(java.lang.CharSequence 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.
-
getFormatString
public WString getFormatString()
Returns the format string.- See Also:
setFormatString(CharSequence format)
-
setLabelFont
public void setLabelFont(WFont font)
Sets the font to be used when drawing the labels in the legend.The default is a default constructed
WFont.
-
getLabelFont
public WFont getLabelFont()
Returns the font to be used when drawing the labels in the legend.- See Also:
setLabelFont(WFont font)
-
-