com.davisor.graphics.chart
Class PlotRenderAttributes

java.lang.Object
  extended bycom.davisor.graphics.RenderAttributes
      extended bycom.davisor.graphics.chart.LineRenderAttributes
          extended bycom.davisor.graphics.chart.DataRenderAttributes
              extended bycom.davisor.graphics.chart.PlotRenderAttributes
All Implemented Interfaces:
com.davisor.core.Dupable, java.io.Serializable

public class PlotRenderAttributes
extends DataRenderAttributes

PlotRenderAttributes represents attributes for chart plot area. Plot area attributes are divided into rendering attributes, magnitude visualization control attributes, and plot area space allocation attributes.

Render attributes

Plot area render attributes are inherited from LineRenderAttributes super-class, and they control the following plot area rendering aspects: The attributes cover two sets of rendering attributes, one for default point attributes, and another for default line attributes. The default attribute values will be used whenever a corresponding rendering attribute is otherwise unspecified, as described in attribute reference document.

Magnitude visualization control attributes

Most chart factories support data value magnituned visualization, where data values in spesific value range are mapped to a visual attribute like symbol size or color. This visual mapping is controlled by plot magnitude visualization attributes: Valid range values will affect corresponding magnitude visualization functionality in chart factories that support this feature.

For example, shape factories recognize a size channel that affects corresponding symbol sizes. If minSize is set, symbols corresponding to minimum size channel element values will be scaled with the given minimum size scalar factor.

Plot area space allocation

When symbols are drawn near plot area edges, parts of the symbols will cross plot area natural boundaries. Plot area enclose attribute controls if they are allowed to do so, or if some action is taken to prevent this. The available enclose options are: If the symbols are allowed to cross the plotting area boundaries, labels and other decorations around the plotting area will be moved away to make room for the parts of the symbols that stick out. If the symbols are to be enclosed within the plot area, the symbols will either be clipped agains the plotting area boundaries, or the axis value ranges are enlarge so that the symbols will not cross the boundaries.

Since:
JDK1.2
See Also:
AxisRenderAttributes, BackRenderAttributes, ChartAttributes, Serialized Form

Field Summary
static boolean DEBUG
           
static float DEFAULTMAXSIZE
          Default shape size range upper limit (2.0).
static float DEFAULTMINSIZE
          Default shape size range lower limit (0.5).
protected  java.util.Map M_channelAttributes
          Map for ChannelAttributes.
protected  java.lang.Boolean M_enclose
          Controls if shapes are to be enclosed inside plot area.
protected  java.awt.Color M_maxColor
          Maximum scaled color size.
protected  java.awt.Color M_maxPaint
          Maximum scaled paint size.
protected  java.lang.Float M_maxSize
          Maximum scaled shape size.
protected  java.awt.Color M_minColor
          Minimum scaled color size.
protected  java.awt.Color M_minPaint
          Minimum scaled paint size.
protected  java.lang.Float M_minSize
          Minimum scaled shape size.
 
Fields inherited from class com.davisor.graphics.chart.DataRenderAttributes
M_annotation, M_colorScale, M_dataFormat, M_lineSmoothness, M_paintScale, M_shapeScale, M_valueFormat
 
Fields inherited from class com.davisor.graphics.chart.LineRenderAttributes
BACK, DEFAULTS, LINE, NROFSETS, POINT, VALUE
 
Fields inherited from class com.davisor.graphics.RenderAttributes
ANTIALIASINDEX, ANTIALIASWORDS, AUTO, CEILING, CENTER, DIAGONAL, DOWN, FLOOR, FRONT, GRAPHICS, HORIZONTAL, INSIDE, LEFT, LEFTWALL, M_alignment, M_color, M_composite, M_defaultIndex, M_defaults, M_font, M_paint, M_shape, M_size, M_stroke, NE, NONE, NW, OFF, ON, OUTSIDE, RIGHT, RIGHTWALL, SE, SW, TEXT, THROUGH, UNSET, UP, VERTICAL
 
Constructor Summary
PlotRenderAttributes()
          Default constructor.
PlotRenderAttributes(java.awt.Paint[] colors, java.awt.Paint[] paints, java.awt.Stroke[] strokes, java.awt.Shape[] shapes, java.awt.Font[] fonts, int[] alignments, java.awt.Composite[] composites, RenderAttributes defaults, java.util.Properties annotation, java.lang.String dataFormat, java.lang.String valueFormat)
          Creates a render attributes set with the given initial attribute values.
PlotRenderAttributes(java.awt.Paint[] colors, java.awt.Paint[] paints, java.awt.Stroke[] strokes, java.awt.Shape[] shapes, java.awt.Font[] fonts, int[] alignments, java.awt.Composite[] composites, RenderAttributes defaults, java.util.Properties annotation, java.lang.String dataFormat, java.lang.String valueFormat, java.awt.Color minColor, java.awt.Color maxColor, java.awt.Color minPaint, java.awt.Color maxPaint, java.lang.Float minSize, java.lang.Float maxSize, java.lang.Boolean enclose)
          Creates a render attributes set with the given initial attribute values.
PlotRenderAttributes(java.awt.Paint color, java.awt.Paint paint, java.awt.Stroke stroke, java.awt.Shape shape, java.awt.Font font, int alignment, java.awt.Composite composite, RenderAttributes defaults, java.util.Properties annotation, java.lang.String dataFormat, java.lang.String valueFormat)
          Creates a render attributes set with the given initial default attribute values.
PlotRenderAttributes(java.awt.Paint color, java.awt.Paint paint, java.awt.Stroke stroke, java.awt.Shape shape, java.awt.Font font, int alignment, java.awt.Composite composite, RenderAttributes defaults, java.util.Properties annotation, java.lang.String dataFormat, java.lang.String valueFormat, java.awt.Color minColor, java.awt.Color maxColor, java.awt.Color minPaint, java.awt.Color maxPaint, java.lang.Float minSize, java.lang.Float maxSize, java.lang.Boolean enclose)
          Creates a render attributes set with the given initial default attribute values.
PlotRenderAttributes(PlotRenderAttributes pra)
          Shallow copy constructor.
PlotRenderAttributes(PlotRenderAttributes pra, PlotRenderAttributes defaults)
          Shallow copy constructor, with explicitly given default values.
 
Method Summary
 void addChannelAttributes(ChannelAttributes atts)
          Adds new ChannelAttributes to this ChartAttributes context.
 void addChannelAttributes(ChartData data)
          Implements a ChartAttributes interface method with a concrete implementation.
 void addChannelAttributes(java.lang.String id, ChannelAttributes atts)
          Adds new ChannelAttributes to this ChartAttributes context with the specified id.
 com.davisor.core.Dupable dup()
          Duplicates this object.
 java.lang.Boolean enclose()
          Tests if shapes are to be enclosed within plot area.
 boolean encloseDefault()
          Tests if shapes are to be enclosed within plot area.
 java.util.Map getChannelAttributes()
          Returns channel attributes map.
 java.awt.Color getMaxColor()
          Gets the color scale upper color.
 java.awt.Color getMaxPaint()
          Gets the paint scale upper color.
 java.lang.Float getMaxSize()
          Gets the upper limit of dynamically scaled shape size range.
 float getMaxSizeDefault()
          Gets the upper limit of dynamically scaled shape size range.
 java.awt.Color getMinColor()
          Gets the color scale lower color.
 java.awt.Color getMinPaint()
          Gets the paint scale lower color.
 java.lang.Float getMinSize()
          Gets the lower limit of dynamically scaled shape size range.
 float getMinSizeDefault()
          Gets the lower limit of dynamically scaled shape size range.
 java.lang.String getName(java.lang.String id)
          Method for ChartObjectAttributes to access name for give id
 boolean hasChannelAttributes(java.lang.String id)
          Tests if these attributes have channel attributes for a specific channel.
 boolean isSeries(java.lang.String id)
          Method for ChartObjectAttributes to check is series
 void setDefaults(PlotRenderAttributes defaults)
          This method sets this plot render attribute to default to another plot render attribtues.
 void setEnclose(java.lang.Boolean enclose)
          Sets if shapes are to be enclosed within plot area.
 void setMaxColor(java.awt.Color maxColor)
          Sets the color scale upper color.
 void setMaxPaint(java.awt.Color maxPaint)
          Sets the paint scale upper color.
 void setMaxSize(java.lang.Float maxSize)
          Sets the upper limit of dynamically scaled shape size range.
 void setMinColor(java.awt.Color minColor)
          Gets the color scale lower color.
 void setMinPaint(java.awt.Color minPaint)
          Gets the paint scale lower color.
 void setMinSize(java.lang.Float minSize)
          Sets the lower limit of dynamically scaled shape size range.
 java.lang.String toString()
          Gets rendering attributes XML representation.
 
Methods inherited from class com.davisor.graphics.chart.DataRenderAttributes
getAnnotationAttributes, getAnnotationAttributes, getAnnotationNames, getAnnotationValue, getColorScale, getColorScale, getDataFormat, getLineSmoothness, getPaintScale, getPaintScale, getShapeScale, getShapeScale, getValueFormat, setAnnotationAttributes, setAnnotationNameValue, setColorScale, setDataFormat, setLineSmoothness, setPaintScale, setShapeScale, setValueFormat, toString
 
Methods inherited from class com.davisor.graphics.RenderAttributes
equals, exchangeOrientation, getAlignment, getAlignment, getAlignment, getColor, getColor, getColor, getComposite, getComposite, getComposite, getDefaultAlignment, getDefaultColor, getDefaultComposite, getDefaultComposite, getDefaultFont, getDefaultPaint, getDefaults, getDefaultShape, getDefaultStroke, getDefaultStrokeWidth, getDiagonal, getFont, getFont, getFont, getHorizontal, getPaint, getPaint, getPaint, getShape, getShape, getShape, getStroke, getStroke, getStroke, getStrokeWidth, getStrokeWidth, getVertical, init, isDown, isHorizontal, isLeft, isRight, isUp, isVertical, next, setAlignment, setAlignment, setAlignment, setAlignment, setAlignment, setColor, setColor, setColor, setComposite, setComposite, setComposite, setDefaults, setFont, setFont, setFont, setPaint, setPaint, setPaint, setShape, setShape, setShape, setStroke, setStroke, setStroke, size, toAlignment, toAlignment, toAntialiasMode, toAntialiasMode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULTMAXSIZE

public static final float DEFAULTMAXSIZE
Default shape size range upper limit (2.0).

See Also:
Constant Field Values

DEFAULTMINSIZE

public static final float DEFAULTMINSIZE
Default shape size range lower limit (0.5).

See Also:
Constant Field Values

M_enclose

protected java.lang.Boolean M_enclose
Controls if shapes are to be enclosed inside plot area.


M_maxColor

protected java.awt.Color M_maxColor
Maximum scaled color size.


M_maxPaint

protected java.awt.Color M_maxPaint
Maximum scaled paint size.


M_maxSize

protected java.lang.Float M_maxSize
Maximum scaled shape size.


M_minColor

protected java.awt.Color M_minColor
Minimum scaled color size.


M_minPaint

protected java.awt.Color M_minPaint
Minimum scaled paint size.


M_minSize

protected java.lang.Float M_minSize
Minimum scaled shape size.


M_channelAttributes

protected java.util.Map M_channelAttributes
Map for ChannelAttributes.


DEBUG

public static final boolean DEBUG
See Also:
Constant Field Values
Constructor Detail

PlotRenderAttributes

public PlotRenderAttributes()
Default constructor.

See Also:
RenderAttributes.RenderAttributes(int)

PlotRenderAttributes

public PlotRenderAttributes(PlotRenderAttributes pra)
Shallow copy constructor.

Parameters:
pra - render attributes to be copied (may be null)
See Also:
RenderAttributes.RenderAttributes(RenderAttributes)

PlotRenderAttributes

public PlotRenderAttributes(PlotRenderAttributes pra,
                            PlotRenderAttributes defaults)
Shallow copy constructor, with explicitly given default values.

If given defaults are null, given principal render attributes defaults are used, if available. If not, default attributes remains unset. In any case, they may be later set with setDefaults(com.davisor.graphics.chart.PlotRenderAttributes).

If given principal render attributes source pra is null, render attributes set size is copied from given defaults, if possible. If both arguments are null, render attribute set size and defaults remain undetermined.

Parameters:
pra - render attributes to be copied (may be null)
defaults - default render attibutes (may be null)
See Also:
RenderAttributes.RenderAttributes(RenderAttributes,RenderAttributes)

PlotRenderAttributes

public PlotRenderAttributes(java.awt.Paint color,
                            java.awt.Paint paint,
                            java.awt.Stroke stroke,
                            java.awt.Shape shape,
                            java.awt.Font font,
                            int alignment,
                            java.awt.Composite composite,
                            RenderAttributes defaults,
                            java.util.Properties annotation,
                            java.lang.String dataFormat,
                            java.lang.String valueFormat)
Creates a render attributes set with the given initial default attribute values. All rendering attributes will be installed in slot zero. The default index is also set to zero, and exceptions are disabled. The result is that the attribute set will behave as if it had an equal value initially set for each slot.

Minimum and maximum shape size values, if set, will define the size range to which the sizes of dynamically scaled shapes will mapped.

Parameters:
color - initial color attribute values (may be null)
paint - initial paint attribute values (may be null)
stroke - initial stroke attribute values (may be null)
shape - initial shape attribute values (may be null)
font - initial font attribute values (may be null)
alignment - initial alignment attribute values (RenderAttributes alignment code)
composite - initial composite attribute values (may be null)
defaults - default attribute values (may be null)
annotation - annotation attributes (may be null)
dataFormat - single value format (may be null)
valueFormat - composite value format (may be null)
See Also:
PlotRenderAttributes(Paint,Paint,Stroke,Shape,Font,int,Composite, RenderAttributes,Properties,String,String, Color,Color,Color,Color,Float,Float,Boolean)

PlotRenderAttributes

public PlotRenderAttributes(java.awt.Paint[] colors,
                            java.awt.Paint[] paints,
                            java.awt.Stroke[] strokes,
                            java.awt.Shape[] shapes,
                            java.awt.Font[] fonts,
                            int[] alignments,
                            java.awt.Composite[] composites,
                            RenderAttributes defaults,
                            java.util.Properties annotation,
                            java.lang.String dataFormat,
                            java.lang.String valueFormat)
Creates a render attributes set with the given initial attribute values. A null value array will leave all attributes values as null (or UNSET).

Minimum and maximum shape size values, if set, will define the size range to which the sizes of dynamically scaled shapes will mapped.

Parameters:
colors - initial color attribute values (may be null)
paints - initial paint attribute values (may be null)
strokes - initial stroke attribute values (may be null)
shapes - initial shape attribute values (may be null)
fonts - initial font attribute values (may be null)
alignments - initial alignment attribute values (array of RenderAttributes alignment codes, may be null)
composites - initial composite attribute values (may be null)
defaults - default attribute values (may be null)
annotation - annotation information (may be null)
dataFormat - single value format (may be null)
valueFormat - composite value format (may be null)
See Also:
PlotRenderAttributes(Paint[],Paint[],Stroke[],Shape[], Font[],int[],Composite[],RenderAttributes, Properties,String,String,Color,Color,Color,Color, Float,Float,Boolean)

PlotRenderAttributes

public PlotRenderAttributes(java.awt.Paint color,
                            java.awt.Paint paint,
                            java.awt.Stroke stroke,
                            java.awt.Shape shape,
                            java.awt.Font font,
                            int alignment,
                            java.awt.Composite composite,
                            RenderAttributes defaults,
                            java.util.Properties annotation,
                            java.lang.String dataFormat,
                            java.lang.String valueFormat,
                            java.awt.Color minColor,
                            java.awt.Color maxColor,
                            java.awt.Color minPaint,
                            java.awt.Color maxPaint,
                            java.lang.Float minSize,
                            java.lang.Float maxSize,
                            java.lang.Boolean enclose)
Creates a render attributes set with the given initial default attribute values. All rendering attributes will be installed in slot zero. The default index is also set to zero, and exceptions are disabled. The result is that the attribute set will behave as if it had an equal value initially set for each slot.

Minimum and maximum shape size values, if set, will define the size range to which the sizes of dynamically scaled shapes will mapped.

Parameters:
color - initial color attribute values (may be null)
paint - initial paint attribute values (may be null)
stroke - initial stroke attribute values (may be null)
shape - initial shape attribute values (may be null)
font - initial font attribute values (may be null)
alignment - initial alignment attribute values (RenderAttributes alignment code)
composite - initial composite attribute values (may be null)
defaults - default attribute values (may be null)
annotation - annotation attributes (may be null)
dataFormat - single value format (may be null)
valueFormat - composite value format (may be null)
minColor - minimum scaled color (may be null)
maxColor - minimum scaled color (may be null)
minPaint - minimum scaled paint (may be null)
maxPaint - minimum scaled paint (may be null)
minSize - minimum scaled shape size (may be null)
maxSize - minimum scaled shape size (may be null)
enclose - enclose shapes within plot area, or not (may be null)
See Also:
DataRenderAttributes.DataRenderAttributes(Paint,Paint,Stroke,Shape, Font,int,Composite,RenderAttributes,Properties,String,String)

PlotRenderAttributes

public PlotRenderAttributes(java.awt.Paint[] colors,
                            java.awt.Paint[] paints,
                            java.awt.Stroke[] strokes,
                            java.awt.Shape[] shapes,
                            java.awt.Font[] fonts,
                            int[] alignments,
                            java.awt.Composite[] composites,
                            RenderAttributes defaults,
                            java.util.Properties annotation,
                            java.lang.String dataFormat,
                            java.lang.String valueFormat,
                            java.awt.Color minColor,
                            java.awt.Color maxColor,
                            java.awt.Color minPaint,
                            java.awt.Color maxPaint,
                            java.lang.Float minSize,
                            java.lang.Float maxSize,
                            java.lang.Boolean enclose)
Creates a render attributes set with the given initial attribute values. A null value array will leave all attributes values as null (or UNSET).

Minimum and maximum shape size values, if set, will define the size range to which the sizes of dynamically scaled shapes will mapped.

Parameters:
colors - initial color attribute values (may be null)
paints - initial paint attribute values (may be null)
strokes - initial stroke attribute values (may be null)
shapes - initial shape attribute values (may be null)
fonts - initial font attribute values (may be null)
alignments - initial alignment attribute values (array of (RenderAttributes alignment codes, may be null)
composites - initial composite attribute values (may be null)
defaults - default attribute values (may be null)
annotation - annotation attributes (may be null)
dataFormat - single value format (may be null)
valueFormat - composite value format (may be null)
minColor - minimum scaled color (may be null)
maxColor - minimum scaled color (may be null)
minPaint - minimum scaled paint (may be null)
maxPaint - minimum scaled paint (may be null)
minSize - minimum scaled shape size (may be null)
maxSize - minimum scaled shape size (may be null)
enclose - enclose shapes within plot area, or not (may be null)
See Also:
DataRenderAttributes.DataRenderAttributes(Paint[],Paint[],Stroke[], Shape[],Font[],int[], Composite[], RenderAttributes, Properties,String,String)
Method Detail

dup

public com.davisor.core.Dupable dup()
Duplicates this object.

Specified by:
dup in interface com.davisor.core.Dupable
Overrides:
dup in class DataRenderAttributes

toString

public java.lang.String toString()
Gets rendering attributes XML representation.

Overrides:
toString in class RenderAttributes
See Also:
RenderAttributes.toString(int,String)

getMaxColor

public java.awt.Color getMaxColor()
Gets the color scale upper color. If the color value is null and the default attributes have been set, then the corresponding default value is returned instead. The default value may also be null.


getMaxPaint

public java.awt.Color getMaxPaint()
Gets the paint scale upper color. If the paint value is null and the default attributes have been set, then the corresponding default value is returned instead. The default value may also be null.


getMaxSize

public java.lang.Float getMaxSize()
Gets the upper limit of dynamically scaled shape size range. If the upper limit has not been explicitly set, the default maximum shape size is returned instead. The default value may also be null.

Returns:
shape size range upper limit
See Also:
getMaxSizeDefault(), setMaxSize(java.lang.Float)

getMaxSizeDefault

public float getMaxSizeDefault()
Gets the upper limit of dynamically scaled shape size range. If the upper limit is undefined, the default maximum shape size DEFAULTMAXSIZE is returned instead.

Returns:
shape size range upper limit
See Also:
getMaxSize(), setMaxSize(java.lang.Float)

getMinColor

public java.awt.Color getMinColor()
Gets the color scale lower color. If the color value is null and the default attributes have been set, then the corresponding default value is returned instead. The default value may also be null.


getMinPaint

public java.awt.Color getMinPaint()
Gets the paint scale lower color. If the paint value is null and the default attributes have been set, then the corresponding default value is returned instead. The default value may also be null.


getMinSize

public java.lang.Float getMinSize()
Gets the lower limit of dynamically scaled shape size range. If the lower limit has not been explicitly set, the default minimum shape size is returned instead. The default value may also be null.

Returns:
shape size range lower limit
See Also:
getMinSizeDefault(), setMinSize(java.lang.Float)

getMinSizeDefault

public float getMinSizeDefault()
Gets the lower limit of dynamically scaled shape size range. If the lower limit is undefined, the default minimum shape size DEFAULTMINSIZE is returned instead.

Returns:
shape size range lower limit
See Also:
getMinSize(), setMinSize(java.lang.Float)

enclose

public java.lang.Boolean enclose()
Tests if shapes are to be enclosed within plot area. If enclosing value is null and the default attributes have been set, then the corresponding default value is returned instead. The default value may also be null.

Returns:
enclose shapes or not (may be null)
See Also:
encloseDefault(), setEnclose(java.lang.Boolean)

encloseDefault

public boolean encloseDefault()
Tests if shapes are to be enclosed within plot area. The default is to do so.

Returns:
enclose shapes or not
See Also:
enclose(), setEnclose(java.lang.Boolean)

setMaxColor

public void setMaxColor(java.awt.Color maxColor)
Sets the color scale upper color.


setMaxPaint

public void setMaxPaint(java.awt.Color maxPaint)
Sets the paint scale upper color.


setMaxSize

public void setMaxSize(java.lang.Float maxSize)
Sets the upper limit of dynamically scaled shape size range.

Parameters:
maxSize - shape size range upper limit (may be null)

setMinColor

public void setMinColor(java.awt.Color minColor)
Gets the color scale lower color.


setMinPaint

public void setMinPaint(java.awt.Color minPaint)
Gets the paint scale lower color.


setMinSize

public void setMinSize(java.lang.Float minSize)
Sets the lower limit of dynamically scaled shape size range.

Parameters:
minSize - shape size range lower limit (may be null)

setEnclose

public void setEnclose(java.lang.Boolean enclose)
Sets if shapes are to be enclosed within plot area.

Parameters:
enclose - true if they are (may be null)
See Also:
enclose()

addChannelAttributes

public void addChannelAttributes(ChartData data)
Implements a ChartAttributes interface method with a concrete implementation.

See Also:
ChartAttributes.addChannelAttributes(com.davisor.graphics.chart.ChartData)

getChannelAttributes

public java.util.Map getChannelAttributes()
Returns channel attributes map.

Returns:
id -> channel attributes map

setDefaults

public void setDefaults(PlotRenderAttributes defaults)
This method sets this plot render attribute to default to another plot render attribtues. In addition to normal render attributes, we also go through channel attributes and set their defaults too. If the defaults channel attributes contain new attributes, we add these to this classes channel attributes also. This is needed, for example, in case of plot


addChannelAttributes

public void addChannelAttributes(java.lang.String id,
                                 ChannelAttributes atts)
Adds new ChannelAttributes to this ChartAttributes context with the specified id.

Parameters:
id - the ID for ChannelAttributes.
atts - the ChannelAttributes.
See Also:
addChannelAttributes(ChannelAttributes), addChannelAttributes(ChartData)

addChannelAttributes

public void addChannelAttributes(ChannelAttributes atts)
Adds new ChannelAttributes to this ChartAttributes context.

Parameters:
atts - the ChannelAttributes.
See Also:
addChannelAttributes(String,ChannelAttributes), addChannelAttributes(ChartData)

hasChannelAttributes

public boolean hasChannelAttributes(java.lang.String id)
Tests if these attributes have channel attributes for a specific channel.

Parameters:
id - channel identity

getName

public java.lang.String getName(java.lang.String id)
Method for ChartObjectAttributes to access name for give id

Parameters:
id -
Returns:
name

isSeries

public boolean isSeries(java.lang.String id)
Method for ChartObjectAttributes to check is series

Parameters:
id -
Returns:
name


Copyright © 2001-2004 Davisor Oy. All Rights Reserved.