|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.davisor.data.VoidData
com.davisor.data.stream.StreamDataSource
com.davisor.graphics.chart.ChartData
This documentation gives a summary description of chart data
buffers, channels, attributes and types. The details about the
advanced data and type framework that chart data objects use to
access, store and manipulate chart data are not, however, described
herein. More information about them can be found in the reference
documentation describing the corresponding Data and Type classes.
TupleData tuples,
which contain one or more data elements, much like a SQL result
set row contains row elements. Within a tuple, the elements
have an explicit order, identity, data type, name and value, again
much like the information described in the SQL result set meta data.
There are, however, also significant differences between chart data buffers and result sets. A data buffer, for example, may be read more than once, and the rows within the buffer can be accessed in any order. A typical data buffer implementation also holds the entire buffer in memory, thus gaining speed, but also consuming more resources. Data buffers are also by default not persistent.
A significant difference between data buffer and SQL result set
rows is also that data buffer rows are tuple objects, which may
recursively contain another tuple. In particular, tuples share the
same basic data manipulation interface that simpler DataValue
objects do, allowing a group of values to be treated and accessed
like a single value. A basic example would be a (X,Y)
coordinate pair's tuple data value that defines the coordinates of
one data point in a two-dimensional coordinate system.
The chart data buffer's tuple data objects are implemented and accessed
through TupleData and TupleType objects. They offer
comprehensive data manipulation and access methods, better
described in their respective reference documents.
TupleType. Corresponding
tuple elements in the buffer form data channels, much like
corresponding SQL table elements form table columns. For each channel,
the tuple type defines the following base attributes:
The channel data type, identifier and index are hopefully
self-explanatory attributes. More information about them and
related element access methods can be found in the TupleData
and TupleType documentation.
The channel meaning tells for what purpose the channel data has been provided for. In particular, by setting the meaning to one of the special keywords that chart factories recognize, the factories can select what to do with that particular channel. Different chart factories expect and support different channel meanings, but some typical and frequently supported keywords are:
More than one channel may be given the same meaning. In particular,
if more than one value channel is specified, then each
one will contribute with one data set in the resulting chart, as
and if appropriate to the nature of the target chart factory. An
equivalent number of attribute channels will typically be
accepted to control the appearance of each corresponding data set.
ChannelAttributes
objects, which define the following attributes:
Channel attributes are associated to the data channel with a matching identity. Channel render attributes give default rendering attributes for the channel data values.
The series name, if any, may be used by the legend factory as a description to the corresponding data series.
The cumulative indicator tells if channel values are to be cumulatively added to the values of the previous channel. The hidden indicator tells if channel values should be taken into account, but not be displayed directly. The interpretation of these values heavily depends on the target chart factory.
Channel attributes may later be overridden by chart specific channel
attributes, specified inside the ChartAttributes. This
allows the same chart data buffer to be the source for several
different charts, without enforcing the charts to use the same
channel attributes. Overriding channel attributes, if any, will
affect channels with identities matching their own, just like the
original attributes.
.min, .max, .sum, and
.abs channels, if available, provide total minimum,
maximum, sum, and absolute sum values over all value
channels.
Value channels, like all other explicit channels, may be referenced
in formats by channel identities. The formats themselves are not,
however, channel specific, so a frequent need is to be able to refer
to the current channel that the label is being formatted for. The
implicit .value channel provides this information.
The actual number and names of available implicit channels depend on the chart factory type, but when defined, implicit channels behave just like real, explicit channels. The only difference is that implicit data channel identities always begin with a dot character (.), something which normal channel identities never do.
getLimits(int,Type,boolean,boolean),
getLimits(int[],Type,boolean[],boolean[]),
ChannelAttributes,
Chart,
ChartAttributes,
ChartFactory,
NumberValue,
TupleData,
TupleType,
ChartFactory.createSummary(com.davisor.graphics.chart.ChartData, com.davisor.graphics.chart.ChartAttributes, com.davisor.graphics.chart.ChartAxes, com.davisor.graphics.chart.PlotRenderAttributes, com.davisor.data.EnumType, int[], boolean, int[])| Field Summary | |
static int |
ABS
Absolute sum value array index. |
static java.lang.String |
ABSVALUE
Absolut sum value key for additional values map ("abs"). |
static java.lang.String |
ALT
Channel key for additional values map ("alt"). |
static java.lang.String |
CHANNEL
Channel key for additional values map ("channel"). |
static java.lang.String |
COLOR
Channel key for additional values map ("color"). |
static java.lang.String |
EXPLODE
Channel key for additional values map ("explode"). |
static java.lang.String |
LABEL
Channel key for additional values map ("label"). |
static int |
MAX
Maximum value array index. |
static java.lang.String |
MAXVALUE
Maximum value key for additional values map ("max"). |
static int |
MIN
Minimum value array index. |
static java.lang.String |
MINVALUE
Minimum value key for additional values map ("min"). |
static java.lang.String |
OBJECT
Channel key for additional values map ("object"). |
static java.lang.String |
PAINT
Channel key for additional values map ("paint"). |
static java.lang.String |
PERCENTVALUE
Percent value key for additional values map ("percent"). |
static java.lang.String |
POSITION
Channel key for additional values map ("position"). |
static java.lang.String |
SHAPE
Channel key for additional values map ("shape"). |
static java.lang.String |
SIZE
Channel key for additional values map ("size"). |
static java.lang.String |
STROKE
Channel key for additional values map ("stroke"). |
static int |
SUM
Sum value array index. |
static java.lang.String |
SUMVALUE
Sum value key for additional values map ("sum"). |
static java.lang.String |
TIME
Channel key for additional values map ("time"). |
static java.lang.String |
URL
Channel key for additional values map ("url"). |
static java.lang.String |
VALUE
Channel key for additional values map ("value"). |
| Fields inherited from class com.davisor.data.stream.StreamDataSource |
M_buffer, M_stream |
| Fields inherited from class com.davisor.data.VoidData |
M_type |
| Constructor Summary | |
ChartData(ChartData cd)
Shallow copy constructor. |
|
ChartData(DataStream stream)
Creates a chart data source out of the given stream. |
|
ChartData(JoinedDataBuffer buffer)
Creates a chart data stream source out of the given buffer. |
|
| Method Summary | |
java.lang.String |
getID(int channel)
Gets the index of the channel with the given (unique) channel identifier. |
int |
getIndex(java.lang.String id)
Gets the index of the channel with the given (unique) channel identifier. |
DataValue[][] |
getLimits(int[] channels,
Type type,
boolean[] absolute,
boolean[] zeroDefault)
Gets the channel minimum and maximum values for the given set of channels. |
DataValue[] |
getLimits(int channel,
Type type,
boolean absolute,
boolean zeroDefault)
Gets the given channel minimum and maximum values. |
java.awt.geom.Rectangle2D |
getTextBounds(int channel,
java.awt.Font font)
Measures the maximum text bounds of multirow text elements rendered in the default font render context with the given font. |
java.awt.geom.Rectangle2D |
getTextBounds(Type format,
java.awt.Font font)
Measures the maximum text bounds of multirow formatted text elements rendered in the default font render context with the given font. |
Type |
getType(int channel)
Gets the type of a channel. |
Type |
getType(java.lang.String channelID)
Gets the type of the channel with the given (unique) channel identifier. |
int |
getTypeIndex(java.lang.String typeName)
Gets the index of the first tuple member that belongs to the default data group and that has a type name that matches the given name. |
int |
getTypeIndex(java.lang.String typeName,
java.lang.String dataGroup)
Gets the index of the first tuple member that belongs to the given data group and that has a type name that matches the given name. |
int |
getTypeIndex(java.lang.String typeName,
java.lang.String dataGroup,
java.util.Map channelAttributeMap)
Gets the index of the first tuple member that belongs to the given data group and that has a type name that matches the given name. |
int[] |
getTypeIndexes(java.lang.String typeName)
Gets all the indexes of the tuple members that belong to the default data group and that have a type name that matches the given name. |
int[] |
getTypeIndexes(java.lang.String typeName,
java.lang.String dataGroup)
Gets all the indexes of the tuple members that belong to the given data group and that have a type name that matches the given type name. |
int[] |
getTypeIndexes(java.lang.String typeName,
java.lang.String dataGroup,
java.util.Map channelAttributesMap)
Gets all the indexes of the tuple members that belong to the given data group and that have a type name that matches the given type name. |
java.lang.Number[] |
getValues(int channel,
Type type)
Gets the given channel sum and the minimum and maximum values. |
boolean |
isGroup(int channel)
Tests if a channel is a group channel. |
boolean |
isGroup(java.lang.String id)
Tests if a channel is a group channel. |
java.lang.String |
toString()
Gets chart data XML representation. |
| Methods inherited from class com.davisor.data.stream.StreamDataSource |
close, getBuffer, getBuffer, getData, getSize, getStream, getStream, isBuffered, setBuffer, setStream, toString |
| Methods inherited from class com.davisor.data.VoidData |
equals, getDataValue, getType, hashCode, setType |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.davisor.data.Data |
getType |
| Field Detail |
public static final java.lang.String ABSVALUE
public static final java.lang.String MINVALUE
public static final java.lang.String MAXVALUE
public static final java.lang.String SUMVALUE
public static final java.lang.String PERCENTVALUE
public static final java.lang.String ALT
public static final java.lang.String CHANNEL
public static final java.lang.String COLOR
public static final java.lang.String LABEL
public static final java.lang.String PAINT
public static final java.lang.String SIZE
public static final java.lang.String SHAPE
public static final java.lang.String STROKE
public static final java.lang.String URL
public static final java.lang.String VALUE
public static final java.lang.String EXPLODE
public static final java.lang.String POSITION
public static final java.lang.String TIME
public static final java.lang.String OBJECT
public static final int MIN
public static final int MAX
public static final int SUM
public static final int ABS
| Constructor Detail |
public ChartData(ChartData cd)
throws InvalidDataException
This constructor is useful when a single chart data source is to be shared between several chart factory invokations. The channel attributes in the shallow copy that this constructor creates can, in particular, be safely re-arranged and re-assigned without affecting the original chart data object.
cd - chart data object to be shallow copied
InvalidDataException - if the stream contains invalid data
public ChartData(DataStream stream)
throws InvalidDataException
If the stream is a non-tuple stream, it will be internally converted to a single-element tuple before buffering. The stream type name will become the identity of the resulting single channel.
InvalidDataException - if the stream contains invalid dataJoinedDataBuffer,
ListDataBuffer
public ChartData(JoinedDataBuffer buffer)
throws InvalidDataException
InvalidDataException - if the stream contains invalid data| Method Detail |
public java.lang.String toString()
ChartData is a
DataBuffer which contains a
ChartXMLDataBuffer which is a
JoinedDataBuffer which contains
ListChartDataBuffer buffers which contain chart data.
JoinedDataBuffer creates a
DataStream which is a
JoinedDataStream which contains
DataStream objects which are
IteratorDataStream objects.
ListChartDataBuffer buffers.
toString in class StreamDataSourceChartXMLDataBufferpublic java.lang.String getID(int channel)
null is
returned.
getIndex(java.lang.String),
TupleType.getType(String)
public int getIndex(java.lang.String id)
throws NoSuchTypeException
NoSuchTypeException - if the given id does not match any membergetID(int),
getType(String)
public DataValue[] getLimits(int channel,
Type type,
boolean absolute,
boolean zeroDefault)
throws InvalidDataException
DataValue objects.
Elements missing from the target channel are either ignored or
treated as zero values, as controlled by the zero
argument.
The found minimum and maximum values may be found equal. Later computation must be prepared to resolve such cases, too.
The resulting minimum and maximum value objects are guaranteed to
be new data value instances, instead of being null
or references to some original data values in the given
channel. Modifying the returned objects, or their types, will
therefore be always possible, and it will not cause any
unexpected side-effects in the original data buffer.
channel - index of the channel to be inspectedtype - the data type that the elements are to be converted
to (may be null)absolute - use absolute data values or notzeroDefault - use zero default value for missing values
java.lang.ClassCastException - if the elements are not
DataValue
InvalidDataException - if the data buffer contains invalid datagetLimits(int[],Type,boolean[],boolean[]),
AxisFactory.resolveLimits(com.davisor.graphics.chart.ChartDataSummary),
ChartAxis.computeValues(com.davisor.data.DataValue[]),
DataValue.unit(com.davisor.data.DataValue, double),
Type.zero()
public DataValue[][] getLimits(int[] channels,
Type type,
boolean[] absolute,
boolean[] zeroDefault)
throws InvalidDataException
DataValue objects.
channels - indexes of the channels to be inspectedtype - the data type that the elements are to be converted
to (may be null)absolute - use absolute data values or not (may be null, defaults
to false)zeroDefault - use zero value for missing values (may be null,
defaults to false)
java.lang.ClassCastException - if the elements are not
DataValue
InvalidDataException - if the data buffer contains invalid datagetLimits(int,Type,boolean,boolean)
public java.awt.geom.Rectangle2D getTextBounds(int channel,
java.awt.Font font)
null bounds are returned.
channel - data channel to scanfont - the font to render the text in elements with
getTextBounds(Type,Font),
LabelRenderer.getTextBounds(String,Font,FontRenderContext,int,
Rectangle2D)
public java.awt.geom.Rectangle2D getTextBounds(Type format,
java.awt.Font font)
null format results zero bounds. Any
single failed element is ignored. Any other more serious error
will silently terminate the operation and cause the maximum
bounds so far found to be returned. If no elements
succeed, null bounds are returned.
format - text formatter (may be null)font - the font to render the text in elements with
getTextBounds(int,Font),
LabelRenderer.getTextBounds(String,Font,FontRenderContext,int,
Rectangle2D)
public Type getType(int channel)
throws InvalidDataException
channel - channel number
InvalidDataExceptiongetType(String),
TupleType.getType(int)
public Type getType(java.lang.String channelID)
throws NoSuchTypeException,
InvalidDataException
channelID - channel identifier
NoSuchTypeException - if the given id does not match any member
InvalidDataExceptiongetType(int),
TupleType.getType(String)public int getTypeIndex(java.lang.String typeName)
This method just calls getTypeIndex(String,String,Map) with
default null data group and with null
channel attribute map.
typeName - target type name
-1 if not foundgetTypeIndex(String,String,Map),
getTypeIndexes(String),
TupleType.getTypeIndex(String)
public int getTypeIndex(java.lang.String typeName,
java.lang.String dataGroup)
null target data group value indicates
the default data group, other values select a spesific data
group.
This method just calls getTypeIndex(String,String,Map),
with a null channel attribute map.
typeName - target type namedataGroup - target data group (may be null)
-1 if not foundgetTypeIndex(String),
getTypeIndex(String,String,Map),
getTypeIndexes(String,String,Map),
TupleType.getTypeIndex(String)
public int getTypeIndex(java.lang.String typeName,
java.lang.String dataGroup,
java.util.Map channelAttributeMap)
null target data group value indicates
the default data group, other values select a spesific data
group.
If an explicit target data group produces no match, the default
null data group is searched, and the index of the
first default data group member with matching type name is
returned.
If a map of channel attributes is given, the tuple members are selected according to the data group specified in the channel attributes for tuple members. If a channel attribute for a tuple member is not found, the group of the tuple member is used for searching. The matching of tuple members and channel attributes is done by the ids.
This method just calls getTypeIndexes(String,String,Map),
and returns the first match, if any.
typeName - target type namedataGroup - target data group (may be null)channelAttributeMap - map of channel attributes (may be null)
-1 if not foundgetTypeIndex(String),
getTypeIndexes(String,String,Map),
TupleType.getTypeIndex(String)
public int[] getTypeIndexes(java.lang.String typeName)
throws InvalidDataException
This method just calls getTypeIndexes(String,String,Map) with
default null data group and with null
channel attributes map.
typeName - target type name
InvalidDataExceptiongetTypeIndex(String),
getTypeIndexes(String,String,Map),
TupleType.getTypeIndexes(String)
public int[] getTypeIndexes(java.lang.String typeName,
java.lang.String dataGroup)
null target data group value indicates
the default data group, other values select a spesific data
group.
This method just calls getTypeIndexes(String,String,Map) with
null channel attributes map.
typeName - target type namedataGroup - target data group (may be null, indicates default group)getTypeIndex(String,String),
getTypeIndexes(String,String,Map),
TupleType.getTypeIndexes(String)
public int[] getTypeIndexes(java.lang.String typeName,
java.lang.String dataGroup,
java.util.Map channelAttributesMap)
throws InvalidDataException
null target data group value indicates
the default data group, other values select a spesific data
group.
If an explicit target data group produces no matches, the default
null data group is searched, and the indexes of all
default data group members with matching type name are returned.
Type comparisons are made against type names (which need not be
unique) and not the type identities (which are
unique). null type names do not match, but
null data group identities do.
If a map of channel attributes is given, the tuple members are selected according to the data group specified in the channel attributes for tuple members. If a channel attribute for a tuple member is not found, the group of the tuple member is used for searching. The matching of tuple members and channel attributes is done by the ids.
typeName - target type namedataGroup - target data group (may be null, indicates default group)channelAttributesMap - map of channel attributes (may be null)
InvalidDataExceptiongetTypeIndex(String,String),
getTypeIndexes(String),
TupleType.getTypeIndexes(String)
public java.lang.Number[] getValues(int channel,
Type type)
throws InvalidDataException
Number objects.
(The limitation to use number objects only is severe, and it will be lifted in future releases, most propably by integrating this functionality with the more general chart data summary mechanism. The interface of this method will, however, also change at that time.)
channel - index of the channel to be inspectedtype - the data type that the elements are to be converted
to (may be null)
java.lang.ClassCastException - if the elements are not Number
InvalidDataException - if the data buffer contains invalid datapublic boolean isGroup(java.lang.String id)
id - channel identityisGroup(int)public boolean isGroup(int channel)
channel - channel indexgetType(int),
isGroup(String)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||