com.davisor.graphics.chart
Class DataRenderAttributes

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

public class DataRenderAttributes
extends LineRenderAttributes

DataRenderAttributes represents data formatting attributes for chart rendering.

Render attributes

Plot area render attributes are inherited from LineRenderAttributes super-class. See also the derived PlotRenderAttributes class.

Value formatting

Most chart factories can draw element text values next to corresponding data point visualizations. Typically that text, if visible at all, is a simple text string representation of the value that is being visualized, but it may also be a more complex composite value, composed of static text and a number of custom formatted element values. These value formatting details are controlled with a valueFormat attribute, in a manner described by the TupleFormat class.

Next to valueFormat attribute there is also a simpler dataFormat attribute that specifies the text string output format of a single data value. This attribute corresponds to FormatType format strings that chart data framework uses to parse and format individual data values. The value format depends on the data type the format is applied to, as described by decendants of the FormatType class.

Annotation attributes

Drawn data shapes can have annotation information attached to them. For example, a chart that is shown in a HTML page can have image maps with hyperlinks pointing somewhere. Due to the different annotation mechanism of charts shown in HTML pages and in SVG images, for example, the attribute names for annotations are not restricted. The annotation attributes for charts in a HTML page are described in HTML specification. Annotation attributes are specified with a property set of:

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

Field Summary
protected  java.util.Properties M_annotation
          Chart annotation properties (may be null).
protected  PaintScale M_colorScale
          Intervalled coloring.
protected  java.lang.String M_dataFormat
          Single value format (may be null).
protected  java.lang.Integer M_lineSmoothness
          Line smoothness setting (integer from 0 to 100)
protected  PaintScale M_paintScale
          Intervalled painting.
protected  ShapeScale M_shapeScale
          Intervalled shaping.
protected  java.lang.String M_valueFormat
          Composite value format (may be null).
 
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
DataRenderAttributes()
          Default constructor.
DataRenderAttributes(DataRenderAttributes dra)
          Shallow copy constructor.
DataRenderAttributes(DataRenderAttributes dra, DataRenderAttributes defaults)
          Shallow copy constructor, with explicitly given default values.
DataRenderAttributes(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)
          Creates a render attributes set with the given initial attribute values.
DataRenderAttributes(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)
          Deprecated. 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.

DataRenderAttributes(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, PaintScale paintScale, PaintScale colorScale, ShapeScale shapeScale)
          Creates a render attributes set with the given initial attribute values.
DataRenderAttributes(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)
          Creates a render attributes set with the given initial default attribute values.
DataRenderAttributes(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)
          Deprecated. 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.

DataRenderAttributes(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, PaintScale paintScale, PaintScale colorScale, ShapeScale shapeScale)
          Creates a render attributes set with the given initial default attribute values.
 
Method Summary
 com.davisor.core.Dupable dup()
          Duplicates this object.
 java.util.Properties getAnnotationAttributes()
          Creates and returns an annotation attribute property set which takes care of defaulting.
 java.util.Properties getAnnotationAttributes(boolean defaults)
          Creates and returns an annotation attribute property set.
 java.util.HashSet getAnnotationNames()
          Gets the annotation attribute names.
 java.lang.String getAnnotationValue(java.lang.String name)
          Gets annotation value for given attribute name.
 PaintScale getColorScale()
          Returns color scale if defined.
 PaintScale getColorScale(boolean defaults)
          Returns color scale if defined.
 java.lang.String getDataFormat()
          Gets single value format.
 java.lang.Integer getLineSmoothness()
          Return line smoothness value.
 PaintScale getPaintScale()
          Returns paint scale if defined.
 PaintScale getPaintScale(boolean defaults)
          Returns paint scale if defined.
 ShapeScale getShapeScale()
          Returns shape scale if defined.
 ShapeScale getShapeScale(boolean defaults)
          Returns shape scale if defined.
 java.lang.String getValueFormat()
          Gets composite value format.
 void setAnnotationAttributes(java.util.Properties annotation)
          Sets annotation attributes.
 void setAnnotationNameValue(java.lang.String name, java.lang.String value)
          Sets annotation attribute value for the given attribute name.
 void setColorScale(PaintScale colorScale)
          Set color scale for intervalled coloring.
 void setDataFormat(java.lang.String dataFormat)
          Sets single value format.
 void setLineSmoothness(java.lang.Integer smoothness)
          Method for setting line smoothness
 void setPaintScale(PaintScale paintScale)
          Set paint scale for intervalled painting.
 void setShapeScale(ShapeScale shapeScale)
          Set shape scale for intervalled shaping.
 void setValueFormat(java.lang.String valueFormat)
          Sets composite value format.
protected  void toString(java.lang.StringBuffer xml)
          Add specific format attributes and call super class implementation.
 
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, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

M_annotation

protected java.util.Properties M_annotation
Chart annotation properties (may be null).


M_dataFormat

protected java.lang.String M_dataFormat
Single value format (may be null).


M_lineSmoothness

protected java.lang.Integer M_lineSmoothness
Line smoothness setting (integer from 0 to 100)


M_valueFormat

protected java.lang.String M_valueFormat
Composite value format (may be null).


M_paintScale

protected PaintScale M_paintScale
Intervalled painting.


M_colorScale

protected PaintScale M_colorScale
Intervalled coloring.


M_shapeScale

protected ShapeScale M_shapeScale
Intervalled shaping.

Constructor Detail

DataRenderAttributes

public DataRenderAttributes()
Default constructor.

See Also:
RenderAttributes.RenderAttributes(int)

DataRenderAttributes

public DataRenderAttributes(DataRenderAttributes dra)
Shallow copy constructor.

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

DataRenderAttributes

public DataRenderAttributes(DataRenderAttributes dra,
                            DataRenderAttributes 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 RenderAttributes.setDefaults(com.davisor.graphics.RenderAttributes).

If given principal render attributes source dra 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:
dra - render attributes to be copied (may be null)
defaults - default render attibutes (may be null)
See Also:
RenderAttributes.RenderAttributes(RenderAttributes,RenderAttributes)

DataRenderAttributes

public DataRenderAttributes(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)
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.

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)
See Also:
DataRenderAttributes(Paint,Paint,Stroke,Shape,Font,int, Composite,RenderAttributes,Properties,String,String,PaintScale, PaintScale,ShapeScale)

DataRenderAttributes

public DataRenderAttributes(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)
Creates a render attributes set with the given initial attribute values. A null value array will leave all attributes values as null (or UNSET).

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)
See Also:
DataRenderAttributes(Paint[],Paint[],Stroke[],Shape[],Font[],int[], Composite[],RenderAttributes,Properties,String,String,PaintScale, PaintScale,ShapeScale)

DataRenderAttributes

public DataRenderAttributes(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,
                            PaintScale paintScale,
                            PaintScale colorScale,
                            ShapeScale shapeScale)
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)
paintScale - intervalled painting (may be null)
colorScale - intervalled coloring (may be null)
shapeScale - intervalled shaping (may be null)
See Also:
LineRenderAttributes.LineRenderAttributes(Paint,Paint,Stroke,Shape, Font,int,Composite, RenderAttributes)

DataRenderAttributes

public DataRenderAttributes(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,
                            PaintScale paintScale,
                            PaintScale colorScale,
                            ShapeScale shapeScale)
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)
paintScale - intervalled painting (may be null)
colorScale - intervalled coloring (may be null)
shapeScale - intervalled shaping (may be null)
See Also:
LineRenderAttributes.LineRenderAttributes(Paint[],Paint[],Stroke[], Shape[],Font[],int[], Composite[], RenderAttributes)

DataRenderAttributes

public DataRenderAttributes(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)
Deprecated. 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:
LineRenderAttributes.LineRenderAttributes(Paint,Paint,Stroke,Shape, Font,int,Composite, RenderAttributes)

DataRenderAttributes

public DataRenderAttributes(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)
Deprecated. 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)
See Also:
LineRenderAttributes.LineRenderAttributes(Paint[],Paint[],Stroke[], Shape[],Font[],int[], Composite[], RenderAttributes)
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 LineRenderAttributes

toString

protected void toString(java.lang.StringBuffer xml)
Add specific format attributes and call super class implementation.

Overrides:
toString in class LineRenderAttributes
Parameters:
xml - string buffer to write xml attributes into
See Also:
RenderAttributes.toString(), RenderAttributes.toString(int,String)

getAnnotationAttributes

public java.util.Properties getAnnotationAttributes()
Creates and returns an annotation attribute property set which takes care of defaulting. May return null.


getAnnotationAttributes

public java.util.Properties getAnnotationAttributes(boolean defaults)
Creates and returns an annotation attribute property set. Whether defaulting is taken into account can be specified. May return null.

Parameters:
defaults - whether defaults are taken into account

getAnnotationNames

public java.util.HashSet getAnnotationNames()
Gets the annotation attribute names. Searches also available defaults.

Returns:
set of attribute names

getAnnotationValue

public java.lang.String getAnnotationValue(java.lang.String name)
Gets annotation value for given attribute name. Searches also available defaults.

Returns:
annotation value for attribute, or null if unset

getColorScale

public PaintScale getColorScale()
Returns color scale if defined. Takes care of defaulting. May return null.


getColorScale

public PaintScale getColorScale(boolean defaults)
Returns color scale if defined. Whether defaulting is taken into account can be specified. May return null.

Parameters:
defaults - whether defaults are taken into account

getDataFormat

public java.lang.String getDataFormat()
Gets single value format. Searches also available defaults.

Returns:
value format, or null if unset
See Also:
setDataFormat(java.lang.String)

getLineSmoothness

public java.lang.Integer getLineSmoothness()
Return line smoothness value. If not set, will return value RenderAttributes.NONE.

Returns:
smoothness

getPaintScale

public PaintScale getPaintScale()
Returns paint scale if defined. Takes care of defaulting. May return null.


getPaintScale

public PaintScale getPaintScale(boolean defaults)
Returns paint scale if defined. Whether defaulting is taken into account can be specified. May return null.

Parameters:
defaults - whether defaults are taken into account

getShapeScale

public ShapeScale getShapeScale()
Returns shape scale if defined. Takes care of defaulting. May return null.


getShapeScale

public ShapeScale getShapeScale(boolean defaults)
Returns shape scale if defined. Whether defaulting is taken into account can be specified. May return null.

Parameters:
defaults - whether defaults are taken into account

getValueFormat

public java.lang.String getValueFormat()
Gets composite value format. Searches also available defaults.

Returns:
value format, or null if unset
See Also:
setValueFormat(java.lang.String)

setAnnotationAttributes

public void setAnnotationAttributes(java.util.Properties annotation)
Sets annotation attributes.


setAnnotationNameValue

public void setAnnotationNameValue(java.lang.String name,
                                   java.lang.String value)
Sets annotation attribute value for the given attribute name. It is not possible to unset already set values in the annotation attributes property set. If it is wanted to remove a set name value pair from the property set, a new property set without the name value pair should be given.

See Also:
setAnnotationAttributes(Properties)

setColorScale

public void setColorScale(PaintScale colorScale)
Set color scale for intervalled coloring.


setDataFormat

public void setDataFormat(java.lang.String dataFormat)
Sets single value format. The value format depends on the data type the format is applied to, as described by decendants of the FormatType class.

Parameters:
dataFormat - new single value format
See Also:
getDataFormat()

setLineSmoothness

public void setLineSmoothness(java.lang.Integer smoothness)
Method for setting line smoothness

Parameters:
smoothness - should be integer in range [0,100]

setPaintScale

public void setPaintScale(PaintScale paintScale)
Set paint scale for intervalled painting.


setShapeScale

public void setShapeScale(ShapeScale shapeScale)
Set shape scale for intervalled shaping.


setValueFormat

public void setValueFormat(java.lang.String valueFormat)
Sets composite value format. The value format syntax is described in TupleFormat class documentation.

Parameters:
valueFormat - new composite value format
See Also:
getValueFormat()


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