com.davisor.graphics.chart
Class ScatterFactory

java.lang.Object
  extended bycom.davisor.graphics.chart.ChartFactory
      extended bycom.davisor.graphics.chart.AxisFactory
          extended bycom.davisor.graphics.chart.ShapeFactory
              extended bycom.davisor.graphics.chart.ScatterFactory
All Implemented Interfaces:
com.davisor.core.Dupable, com.davisor.core.MIMETypes, com.davisor.core.Public

public class ScatterFactory
extends ShapeFactory

ScatterFactory implements a scatter chart producer that can make polyline charts from twoe-dimensional multichannel data.

This factory inherits all of it's attribute and data operation logic from AxisFactory grand-superclass, and most of it's rendering logic from ShapeFactory superclass. In fact, this class implements itself only some low-level rendering methods that lay out shape chart visual elements in a way suitable for scatter charts. Please see AxisFactory documentation for more information about what kind of data and attributes this factory accepts.

If the dataset the line is based on is cumulative, open filled areas are closed by two lines that connect the first and last points of the cumulative line the the corredponding points on the previous line. Please note that this is somewhat untypical way to visualize cumulative values, as unlike in many other cumulative data visualizations, the coordinate values of the cumulative points are not summed together.

Scatter factory 3D lines are rendered using painter's algorithm and simple isometric projection. This imposes certain limitations of what kind of lines can be rendered in 3D:

Implementation information

Scatter charts use the following shape chart behaviour controls:

Since:
JDK1.2
See Also:
ChartAttributes, ChartData, ColumnBarFactory, PieFactory, RowBarFactory, ScatterFactory

Nested Class Summary
 
Nested classes inherited from class com.davisor.graphics.chart.ShapeFactory
ShapeFactory.ShapeContext
 
Nested classes inherited from class com.davisor.graphics.chart.AxisFactory
AxisFactory.AxisContext, AxisFactory.AxisMetrics
 
Nested classes inherited from class com.davisor.graphics.chart.ChartFactory
ChartFactory.ChartContext, ChartFactory.ChartMetrics
 
Field Summary
 
Fields inherited from class com.davisor.graphics.chart.ShapeFactory
BELOW, CENTER, LEFT, OVER, RIGHT
 
Fields inherited from class com.davisor.graphics.chart.AxisFactory
DEFAULTLABELTYPE, FLIPX, FLIPY, MAJORMARGIN, MINORMARGIN, MINSIZE
 
Fields inherited from class com.davisor.graphics.chart.ChartFactory
ALL, BRIGHT, CHANNEL, COS, DARK, DOTSEQUENCE, DOTSTROKE, DOTSTROKEWIDTH, DUMPFACTORYNAME, ENCODERINFO, FONT, FRC, HAS_3D, I, LABEL, LABELFIELDNAMES, LABELFIELDS, MIME_DEFAULT, NONE, NORMAL, NULLSTROKE, PERCENT, PI2, SHAPE, SIN, STROKE, STROKEWIDTH, TIC, VALUE, X, Y, Z
 
Fields inherited from interface com.davisor.core.MIMETypes
FILETYPE_BMP, FILETYPE_CSS, FILETYPE_DOC, FILETYPE_ECMA, FILETYPE_GIF, FILETYPE_HTML, FILETYPE_HTML_CSS, FILETYPE_INDEX, FILETYPE_INDEX_DOC, FILETYPE_INDEX_HTML, FILETYPE_INDEX_HTML_CSS, FILETYPE_INDEX_PDF, FILETYPE_INDEX_PPT, FILETYPE_INDEX_SVG, FILETYPE_INDEX_XHTML, FILETYPE_INDEX_XLS, FILETYPE_INDEX_XMSE, FILETYPE_INDEX_XMSP, FILETYPE_INDEX_XMSW, FILETYPE_INDEX_XSLFO, FILETYPE_JPEG, FILETYPE_PDF, FILETYPE_PNG, FILETYPE_PNG_WBMP, FILETYPE_PPM, FILETYPE_PPT, FILETYPE_SVG, FILETYPE_TEXT, FILETYPE_WBMP, FILETYPE_XHTML, FILETYPE_XLS, FILETYPE_XML, FILETYPE_XMSE, FILETYPE_XMSP, FILETYPE_XMSW, FILETYPE_XSLFO, FILETYPE_XSLFO_CSS, MIME_BMP, MIME_CSS, MIME_DOC, MIME_ECMA, MIME_GIF, MIME_HTML, MIME_HTML_CSS, MIME_INDEX, MIME_INDEX_DOC, MIME_INDEX_HTML, MIME_INDEX_HTML_CSS, MIME_INDEX_PDF, MIME_INDEX_PPT, MIME_INDEX_SVG, MIME_INDEX_XHTML, MIME_INDEX_XLS, MIME_INDEX_XMSE, MIME_INDEX_XMSP, MIME_INDEX_XMSW, MIME_INDEX_XSLFO, MIME_JPEG, MIME_OTHER, MIME_PDF, MIME_PNG, MIME_PNG_WBMP, MIME_PPM, MIME_PPT, MIME_SVG, MIME_TEXT, MIME_WBMP, MIME_XHTML, MIME_XLS, MIME_XML, MIME_XMSE, MIME_XMSP, MIME_XMSW, MIME_XSLFO, MIME_XSLFO_CSS
 
Constructor Summary
ScatterFactory()
          Default constructor.
ScatterFactory(ScatterFactory factory)
          Copy constructor.
 
Method Summary
protected  boolean absCumulativeValues(boolean isometric)
          Tests if the visualization strategy implemented by this shape factory instance requires that only absolute values should be used for cumulative data.
protected  void drawValues(java.awt.Graphics2D g, java.awt.Paint color, java.awt.Paint paint, java.awt.Font font, java.lang.String[] value, AxisFactory.AxisMetrics info, int alignment, java.awt.geom.Rectangle2D[] shapeBounds, boolean multiSeriesMode)
          Draws values at the top the data points.
 com.davisor.core.Dupable dup()
          Duplicates this factory.
protected  DataValue getSubChannel(DataValue channelValue, int subChannel)
          Gets a sub-channel value.
protected  int getSubChannels(Type valueType)
          Gets the number of sub-channels.
protected  DataValue[] resolveDataLimits(ChartData data, ChartAttributes attr, PlotRenderAttributes plot, int[] channels, boolean isometric, boolean[] cumulative)
          Determines global minimum and maximum data values.
protected  DataValue[][] resolveLimits(ChartDataSummary summary)
          Computes chart factory specific limit values for axes.
protected  boolean sumCumulativeValues()
          Tests if the visualization strategy implemented by this shape factory instance requires that cumulative data values should be summed together or not.
protected  boolean zeroCumulativeValues()
          Tests if the visualization strategy implemented by this shape factory instance requires that missing cumulative data values should be replaced by zero values.
 
Methods inherited from class com.davisor.graphics.chart.ShapeFactory
createContext, createContext, createContext, createMetrics, drawChart, drawGroup, drawLine, drawSegments, drawShapes, drawSmoothedLine, getAngle, getDefaultLineColor, getDefaultLinePaint, getLegendShape, isAbsolute, isCumulative
 
Methods inherited from class com.davisor.graphics.chart.AxisFactory
computeMinorMargin, createChart, createChart, createContext, createMetrics, createMetrics, createMetrics, drawAxis, drawMarkers, drawTics, drawXYAxes, drawXYZAxes, fillGrid, fillMarkers, formatDouble, getIdealSize, getIdealSize, hasGridLines, isSilent, labelAxis, labelMarkers, resolveLabels, resolveLabels, resolveMarkerSizes, resolveOverlap, titleAxis, transpose
 
Methods inherited from class com.davisor.graphics.chart.ChartFactory
annotate, combineProperties, createChannelType, createChannelType, createChart, createChart, createChart, createChart, createChart, createFormat, createPaintChannelType, createPaintChannelType, createShapeChannelType, createShapeChannelType, createSummary, drawLabel, getContentType, getDefaultPaint, getFactory, getFactory, getGroup, getIsometricCoefficients, getName, has3D, hasSVG, isClassAvailable, isMultiSeriesMode, main, mayHaveLegend, registerFactory, resolveDataLimits, rotateSize, shade, unregisterFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScatterFactory

public ScatterFactory()
Default constructor.


ScatterFactory

public ScatterFactory(ScatterFactory factory)
Copy constructor.

Method Detail

resolveLimits

protected DataValue[][] resolveLimits(ChartDataSummary summary)
Computes chart factory specific limit values for axes.

This implementation assumes that the given data values are tuples and it takes the X- and Y-axis limit values from the respective first two tuple member values.

Overrides:
resolveLimits in class ShapeFactory
Parameters:
summary - chart data summary
Returns:
limits values, as descibed by base prototype
See Also:
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[])

resolveDataLimits

protected DataValue[] resolveDataLimits(ChartData data,
                                        ChartAttributes attr,
                                        PlotRenderAttributes plot,
                                        int[] channels,
                                        boolean isometric,
                                        boolean[] cumulative)
                                 throws InvalidDataException
Determines global minimum and maximum data values.

Scatter factory cumulative data channel coordinate values do not stack. Instead, cumulativeness affects wether line fill area attaches itself to previous line (cumulative), or X -axis (not cumulative).

Warning! Do not modify the returned values since they may be references to the original data points.

Overrides:
resolveDataLimits in class ChartFactory
Parameters:
data - chart data to be inspected
attr - chart rendering attributes
plot - local plot area attributes
channels - indexes of the channels to be inspected
isometric - isometric rendering may affect how doata is understood
cumulative - precomputed channel cumulativenes values
Returns:
global minimum and maximum values, taken over all value channels
Throws:
InvalidDataException - if data limit resolvation fails
See Also:
ChartFactory.resolveDataLimits(DataValue[][],boolean[]), ChartData.getLimits(int[],Type,boolean[],boolean[])

absCumulativeValues

protected boolean absCumulativeValues(boolean isometric)
Tests if the visualization strategy implemented by this shape factory instance requires that only absolute values should be used for cumulative data.

Specified by:
absCumulativeValues in class ShapeFactory
Parameters:
isometric - tells if visualization will be isometric 3D or not
Returns:
false
See Also:
DataValue.abs(), sumCumulativeValues(), zeroCumulativeValues()

getSubChannel

protected DataValue getSubChannel(DataValue channelValue,
                                  int subChannel)
Gets a sub-channel value.

Specified by:
getSubChannel in class ShapeFactory
Parameters:
channelValue - channel value
subChannel - sub-channel index
Returns:
always the channel value itself, as scatter factory does not yet support sub-channels

getSubChannels

protected int getSubChannels(Type valueType)
Gets the number of sub-channels.

Specified by:
getSubChannels in class ShapeFactory
Parameters:
valueType - channel type
Returns:
always zero, indicating that scatter factory does not yet support sub-channels

sumCumulativeValues

protected boolean sumCumulativeValues()
Tests if the visualization strategy implemented by this shape factory instance requires that cumulative data values should be summed together or not.

Specified by:
sumCumulativeValues in class ShapeFactory
Returns:
false
See Also:
DataValue.add(DataValue), absCumulativeValues(boolean), zeroCumulativeValues()

zeroCumulativeValues

protected boolean zeroCumulativeValues()
Tests if the visualization strategy implemented by this shape factory instance requires that missing cumulative data values should be replaced by zero values.

Specified by:
zeroCumulativeValues in class ShapeFactory
Returns:
false
See Also:
Type.zero(), absCumulativeValues(boolean), sumCumulativeValues()

drawValues

protected void drawValues(java.awt.Graphics2D g,
                          java.awt.Paint color,
                          java.awt.Paint paint,
                          java.awt.Font font,
                          java.lang.String[] value,
                          AxisFactory.AxisMetrics info,
                          int alignment,
                          java.awt.geom.Rectangle2D[] shapeBounds,
                          boolean multiSeriesMode)
Draws values at the top the data points. There are nine positions for the value labels drawn in respect to the shapes. Those positions are:

Specified by:
drawValues in class ShapeFactory
Parameters:
g - the graphics' context to draw into
color - label colors
paint - label paints
font - label font
value - value texts
info - axis info
alignment - label alignment in relation to shape
shapeBounds - value will be aligned in relation to shape bounds
multiSeriesMode - if this is false, palette colors will be rotated

dup

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



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