com.davisor.graphics.chart
Class ShapeFactory

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

public abstract class ShapeFactory
extends AxisFactory

ShapeFactory is a base class for chart producers that can make shape charts out of one- or multidimensional data. Shape charts support isometric 3D look and a wealth of chart attributes.

Introduction

Shape charts visualize data point series with colored point shapes and stroked lines, drawn onto a coordinate axis. Each data point series is read from one data channel. Each point inside a data channel may be expressed with one data value that gives the point Y -coordinate value, or with a pair of data values that give the point X- and Y -coordinate values.

A single data series may be rendered as point symbols, as a continous stroked line, or both. Series may also be grouped, and the groups rendered with lines the connect the corresponding points in grouped series.

Drawing and filling

Shape factory connects given data points with a line that uses given line color and stroke to determine the color, width and style of the line. If the line is rendered in 3D isometric mode, the line becomes a ribbon of shaded line color, and that will have it's front edge drawn with given stroke. Missing data points may break continuous lines, or they may be skipped and not displayed at all, or their value may be assumed to be zero, as apporpriate in each situation.

When line paint is set, the areas outlined by chart lines are filled with that paint. If the start and end points of a line are the same, the line defines a closed area, which is then filled. If the start end end points do not meet, the area is closed by the horizontal axis and two vertical lines that extend from the start and end points to it.

Magnitune visualization

Data point shape sizes may be made dependant of size channel values. If such channel is present, the points associated with the largest size values among all size channels will have the biggest symbols, and the ones with the smalles values will have the smallest symbols. The absolute values of the size channel elements or shape sizes do not matter, only their relative magnitudes against each other do.

The visible sizes of the largest and smallest shapes are controlled with plot area maxSize and minSize attributes, respectively. maxSize tells of how many tenths of the whole plot area size the maximum symbol size will approximately be. The measurement is not exact nor linear, but the bigger the value, the bigger the maximum symbols will appear.

The ratio between plot area attributes minSize and maxSize sets the approximate ratio between the visible size of the smallest and largest scaled shape. minSize may also be larger than maxSize, making the values representing smaller values to appear bigger than those representing larger values.

Border control

Shapes drawn near plot area edges are problematic since they raise a question what to do with the shape segments that cross the plot area border. There are three possible basic strategies, and ShapeFactory supports them all:
  1. clip the shapes against plot area edges
  2. increase axis margins to make room behind the border so that the shape will not overlap with axis decorations beynd
  3. make axis values start far enough from the data point so that the shape will not cross the border

Two settings control what strategy is used: plot area enclose attribute, and the presense or absense of magnitude visualization data:

Enclose Don't enclose
size channels present add axis steps increase label margins
size channels absent clip against plot area edge increase label margins

Channel groups and sub-channels

Shape factory supports the notion of channel groups that tie together a number of data value channels. These sub-channels inherit their attributes from the enclosing group attributes, and they may also override them with their own.

The details of how and if a top-level data channel is broken up into sub-channels is left for the sub-classes to implement. If sub-channels are present, the shape factory will render them by joining the corresponding sub-channel points within each group. The render attributes for these cross-channel lines are taken from plot area render attributes.

Implementation information

The shape charts utilize the services of the AxisFactory base class, in order to prepare chart data and attributes for rendering. This class then converts the chart data values, originally expressed in arbitrary user value data types, to chart device coordinates expressed in scalar pixel values. The values are then rendered using the various draw methods that this class provides.

The ShapeFactory subclasses implement details about how exactly the charts are rendered. The subclasses do this by implementing the abstract interface that this class and its superclass define. In particular, the following suble choises affect how exactly shape factory behaves:

Since:
JDK1.2
See Also:
AxisFactory.resolveLabels(com.davisor.graphics.chart.ChartAxes, com.davisor.graphics.chart.AxisFactory.AxisContext), resolveLimits(com.davisor.graphics.chart.ChartDataSummary), AxisFactory.createChart(com.davisor.graphics.chart.ChartFactory.ChartContext, com.davisor.graphics.chart.ChartFactory.ChartMetrics, com.davisor.graphics.chart.ChartAttributes, com.davisor.graphics.chart.Chart)

Nested Class Summary
 class ShapeFactory.ShapeContext
          ShapeContext implements a shape factory specific axis context.
 
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
protected static int BELOW
           
protected static int CENTER
           
protected static int LEFT
           
protected static int OVER
           
protected static int 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
ShapeFactory()
          Default constructor.
ShapeFactory(ShapeFactory factory)
          Copy constructor.
 
Method Summary
protected abstract  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  AxisFactory.AxisContext createContext(ChartData data, ChartAttributes attr, ChartAxes axes, short index)
          Creates a shape chart.
protected  AxisFactory.AxisContext createContext(ChartData data, ChartAttributes attr, PlotRenderAttributes plot, ChartDataSummary summary, java.awt.Font[] labelFont, java.awt.Font[] titleFont, Type[] colorChannelTypes, int lastPlotColorChannel, Type[] paintChannelTypes, int lastPlotPaintChannel, Type urlChannelType, EnumType labelType, int[] valueChannels, int[] colorChannels, int[] paintChannels, int[] urlChannels, int[] altChannels, int[] positionChannels, float[] labelOffsets, float[] markerOffsets, float[][] titleSizes, boolean isometric, short index)
          Creates a new shape factory specific axis context.
protected  AxisFactory.AxisContext createContext(ChartData data, ChartAttributes attr, PlotRenderAttributes plot, ChartDataSummary summary, java.awt.Font[] labelFont, java.awt.Font[] titleFont, Type colorChannelType, Type paintChannelType, Type urlChannelType, EnumType labelType, int[] valueChannels, int[] colorChannels, int[] paintChannels, int[] urlChannels, int[] altChannels, int[] positionChannels, float[] labelOffsets, float[] markerOffsets, float[][] titleSizes, boolean isometric, short index)
          Deprecated.  
protected  AxisFactory.AxisMetrics createMetrics(ChartAxes axes, AxisFactory.AxisContext context, boolean scaleMargins, boolean conserveSpace)
          Resolve final axis chart image and image component sizes.
protected  Chart drawChart(AxisFactory.AxisContext context, AxisFactory.AxisMetrics metrics, ChartAxes axes, boolean fillGrid, boolean drawAxes, boolean drawLabel, boolean drawGrid, Chart chart)
          Renders a shape chart.
protected  void drawGroup(java.awt.Graphics2D g, int p, boolean side, java.awt.Paint color, java.awt.Paint paint, java.awt.Stroke stroke, float[][] x, float[][] y, float x0, float y0, float dx, float dy)
           
protected  void drawLine(java.awt.Graphics2D g, boolean side, boolean skipMissingPoints, java.awt.Paint pen, java.awt.Paint[] color, java.awt.Paint[] paint, java.awt.Stroke stroke, float[] x, float[] y, float[] prevX, float[] prevY, float baseLevel, float x0, float y0, float dx, float dy)
          Draws an filled front- or sideface around the given points.
protected  void drawSegments(java.awt.Graphics2D g, boolean side, java.awt.Paint[] color, java.awt.Paint[] paint, java.awt.Stroke stroke, int lineSegments, java.awt.Paint linePaint, java.awt.Shape drawPath, java.awt.Shape fillPath, float dx, float dy)
           
protected  java.awt.geom.Rectangle2D[] drawShapes(java.awt.Graphics2D g, java.awt.Paint[] color, java.awt.Paint[] paint, java.awt.Stroke[] stroke, java.awt.Shape[] shape, float[] x, float[] y, float s, float x0, float y0, float dx, float dy)
          Draws a shape at the given points.
protected  float[] drawSmoothedLine(java.awt.Graphics2D g, boolean side, boolean skipMissingPoints, java.awt.Paint pen, java.awt.Paint[] color, java.awt.Paint[] paint, java.awt.Stroke stroke, float[] x, float[] y, float[] prevX, float[] prevY, float baseLevel, float x0, float y0, float dx, float dy, int lineSmoothness, float[] oldControlPoints)
          Method for drawing smoothed lines.
protected abstract  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 of one data channel or sub channel at the data points.
protected  double getAngle(float x0, float y0, float x1, float y1, float x2, float y2)
          This helper method will calculate angle (x0,y0), (x1,y1), (x2,y2)
protected  java.awt.Paint getDefaultLineColor(boolean multiSeriesMode)
          Returns default line color.
protected  java.awt.Paint getDefaultLinePaint(boolean multiSeriesMode)
          Returns default line paint.
 java.awt.Shape getLegendShape()
          Gets the legend symbol shape preferred by this factory.
protected abstract  DataValue getSubChannel(DataValue channelValue, int subChannel)
          Gets a sub-channel value.
protected abstract  int getSubChannels(Type valueType)
          Gets the number of sub-channels.
protected  boolean isAbsolute(int channel, boolean[] cumulative, ChartData data, ChartAttributes attr, PlotRenderAttributes plot, boolean isometric)
          Tests if given channel needs absolute point values.
protected  boolean isCumulative(int channel, boolean[] cumulative)
          Tests if given channel is a member of mutually cumulative channels.
protected  DataValue[][] resolveLimits(ChartDataSummary summary)
          Computes chart factory specific limit values for the axes.
protected abstract  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 abstract  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.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, resolveDataLimits, rotateSize, shade, unregisterFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.davisor.core.Dupable
dup
 

Field Detail

OVER

protected static final int OVER
See Also:
Constant Field Values

BELOW

protected static final int BELOW
See Also:
Constant Field Values

CENTER

protected static final int CENTER
See Also:
Constant Field Values

LEFT

protected static final int LEFT
See Also:
Constant Field Values

RIGHT

protected static final int RIGHT
See Also:
Constant Field Values
Constructor Detail

ShapeFactory

public ShapeFactory()
Default constructor.


ShapeFactory

public ShapeFactory(ShapeFactory factory)
Copy constructor.

Method Detail

absCumulativeValues

protected abstract 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.

Parameters:
isometric - tells if visualization will be isometric 3D or not
Returns:
true if only cumulative absolute values should be used
See Also:
DataValue.abs(), sumCumulativeValues(), zeroCumulativeValues()

getSubChannel

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

Parameters:
channelValue - channel value
subChannel - sub-channel index
Returns:
sub-channel value taken from given channel value, or the channel value itself if it has no sub-values (may be null)

getSubChannels

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

Parameters:
valueType - channel type
Returns:
number of sub-channels in data values of given type (may be zero, indicating that the type has no sub-channels)

sumCumulativeValues

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

Returns:
true if cumulative values should be summed
See Also:
DataValue.add(DataValue), absCumulativeValues(boolean), zeroCumulativeValues()

zeroCumulativeValues

protected abstract 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.

Returns:
true if missing cumulative absolute values should be replaced with zero values
See Also:
Type.zero(), absCumulativeValues(boolean), sumCumulativeValues()

drawValues

protected abstract 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 of one data channel or sub channel at the data points.

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

getLegendShape

public java.awt.Shape getLegendShape()
Gets the legend symbol shape preferred by this factory.

This factory prefers no default shape for legends and thus returns null

Overrides:
getLegendShape in class ChartFactory
Returns:
null

createContext

protected AxisFactory.AxisContext createContext(ChartData data,
                                                ChartAttributes attr,
                                                ChartAxes axes,
                                                short index)
                                         throws ChartException
Creates a shape chart. context is expected to contain initial information necessary to resolve final chart size. Chart shapes are then computed and their maximum size measured. Depending on current settings, label margins may then be increased or new axis steps may be added to hold shapes drawn near plot area edges.

This method first allows superclass to create a standard chart context. Chart shapes are then computed and their maximum size measured and stored into the extended, ShapeFactory specific context parameters.

See class documentation for more information about how axis chart generation is expected to proceed.

Overrides:
createContext in class AxisFactory
Parameters:
data - chart data
attr - chart attributes
axes - chart axes
index - context index among other contexts
Returns:
shape factory context, containing shape chart specific sizing information
Throws:
ChartException - if chart generation fails
See Also:
createMetrics(com.davisor.graphics.chart.ChartAxes, com.davisor.graphics.chart.AxisFactory.AxisContext, boolean, boolean), AxisFactory.resolveLabels(com.davisor.graphics.chart.ChartAxes, com.davisor.graphics.chart.AxisFactory.AxisContext), resolveLimits(com.davisor.graphics.chart.ChartDataSummary), ChartAxes.computeValues(com.davisor.data.DataValue[][]), ChartAxis.bumpValue(float,float,float), 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[])

createMetrics

protected AxisFactory.AxisMetrics createMetrics(ChartAxes axes,
                                                AxisFactory.AxisContext context,
                                                boolean scaleMargins,
                                                boolean conserveSpace)
                                         throws ChartException
Description copied from class: AxisFactory
Resolve final axis chart image and image component sizes. This method first computes ideal label sizes with the help of the AxisFactory.resolveLabels(com.davisor.graphics.chart.ChartAxes, com.davisor.graphics.chart.AxisFactory.AxisContext) method. Sub-class spesific ideal chart size is computed next by invoking AxisFactory.getIdealSize(com.davisor.graphics.chart.ChartAxes, int, int, float[], float[][], float[][], float[][], float[]) methods. Finally, and conflicts between chart ideal size and given size constrains are resolved. The results are then collected into an AxisFactory.AxisMetrics instance, which is returned.

Conflict resolution between chart ideal and given size scales ideal size components to fit into given size. If size is not explisitly set, the ideal size is used. If size is greater than ideal size, all chart components are scaled up evenly. If size is smaller than ideal size, more complex chart component size optimization is carried out.

First, an attempt to reduce the number of steps on the relevant axis is made by calling ChartAxis.reduceSteps(float). A new ideal size is then computed by using the reduced number of steps. If this yields enough or more than space, chart components are scaled evenly up to the new ideal size.

Overrides:
createMetrics in class AxisFactory
Parameters:
axes - the axes that control this particular chart
context - axis chart context
scaleMargins - if true, scales only the margins and plot area
conserveSpace - if true, does not scale beyoun ideal size
Returns:
final axis chart component metrics
Throws:
ChartException - if chart generation fails
See Also:
AxisFactory.createContext(com.davisor.graphics.chart.ChartData, com.davisor.graphics.chart.ChartAttributes), AxisFactory.resolveLabels(com.davisor.graphics.chart.ChartAxes, com.davisor.graphics.chart.AxisFactory.AxisContext)

drawChart

protected Chart drawChart(AxisFactory.AxisContext context,
                          AxisFactory.AxisMetrics metrics,
                          ChartAxes axes,
                          boolean fillGrid,
                          boolean drawAxes,
                          boolean drawLabel,
                          boolean drawGrid,
                          Chart chart)
                   throws InvalidDataException
Renders a shape chart.

Overrides:
drawChart in class AxisFactory
Parameters:
context - chart context
metrics - chart metrics
axes - chart axes
chart - chart to render to
drawAxes - determine which axes may be drawn
fillGrid - enables or disables axis background filling
drawLabel - determine if default labeling is to be applied
drawGrid - determine if grid drawing is to be enabled
Throws:
InvalidDataException - if data is invalid for chart drawing

createContext

protected AxisFactory.AxisContext createContext(ChartData data,
                                                ChartAttributes attr,
                                                PlotRenderAttributes plot,
                                                ChartDataSummary summary,
                                                java.awt.Font[] labelFont,
                                                java.awt.Font[] titleFont,
                                                Type colorChannelType,
                                                Type paintChannelType,
                                                Type urlChannelType,
                                                EnumType labelType,
                                                int[] valueChannels,
                                                int[] colorChannels,
                                                int[] paintChannels,
                                                int[] urlChannels,
                                                int[] altChannels,
                                                int[] positionChannels,
                                                float[] labelOffsets,
                                                float[] markerOffsets,
                                                float[][] titleSizes,
                                                boolean isometric,
                                                short index)
Deprecated.  

Creates a new shape factory specific axis context.

Overrides:
createContext in class AxisFactory
See Also:
createContext(ChartData,ChartAttributes,PlotRenderAttributes, ChartDataSummary,Font[],Font[],Type[],int,Type[],int,Type,EnumType, int[],int[],int[],int[],int[],int[],float[],float[],float[][], boolean,short)

createContext

protected AxisFactory.AxisContext createContext(ChartData data,
                                                ChartAttributes attr,
                                                PlotRenderAttributes plot,
                                                ChartDataSummary summary,
                                                java.awt.Font[] labelFont,
                                                java.awt.Font[] titleFont,
                                                Type[] colorChannelTypes,
                                                int lastPlotColorChannel,
                                                Type[] paintChannelTypes,
                                                int lastPlotPaintChannel,
                                                Type urlChannelType,
                                                EnumType labelType,
                                                int[] valueChannels,
                                                int[] colorChannels,
                                                int[] paintChannels,
                                                int[] urlChannels,
                                                int[] altChannels,
                                                int[] positionChannels,
                                                float[] labelOffsets,
                                                float[] markerOffsets,
                                                float[][] titleSizes,
                                                boolean isometric,
                                                short index)
Creates a new shape factory specific axis context.

Overrides:
createContext in class AxisFactory
Parameters:
data - chart data
attr - chart attributes
plot - local plot area attributes
summary - chart data summary
labelFont - axis label fonts [X,Y,Z,...]
titleFont - axis title fonts [X,Y,Z,...]
colorChannelTypes - color data channel types
lastPlotColorChannel - last color channel for plot
paintChannelTypes - paint data channel types
lastPlotPaintChannel - last paint channel for plot
urlChannelType - annotation URL address data channel type
labelType - label data access type (may be null)
valueChannels - value data channel indexes
colorChannels - color data channel indexes
paintChannels - paint data channel indexes
urlChannels - annotation URL address data channel indexes
altChannels - annotation description text data channel indexes
positionChannels - category position value data channel indexes
labelOffsets - axis label offsets ([x,y,z])
titleSizes - axis title sizes ([x,y][w,h])
isometric - isometric mode indicator
index - context index among other indexes
See Also:
ShapeFactory.ShapeContext

resolveLimits

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

This implementation places data value limit values on the Y -axis, and label limit values on the X -axis. If the given extreme values are incomplete or have errors, then the value axis limits are left unset. This may happen in particular if no label information is available.

Specified by:
resolveLimits in class AxisFactory
Parameters:
summary - 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[])

drawGroup

protected void drawGroup(java.awt.Graphics2D g,
                         int p,
                         boolean side,
                         java.awt.Paint color,
                         java.awt.Paint paint,
                         java.awt.Stroke stroke,
                         float[][] x,
                         float[][] y,
                         float x0,
                         float y0,
                         float dx,
                         float dy)

drawLine

protected void drawLine(java.awt.Graphics2D g,
                        boolean side,
                        boolean skipMissingPoints,
                        java.awt.Paint pen,
                        java.awt.Paint[] color,
                        java.awt.Paint[] paint,
                        java.awt.Stroke stroke,
                        float[] x,
                        float[] y,
                        float[] prevX,
                        float[] prevY,
                        float baseLevel,
                        float x0,
                        float y0,
                        float dx,
                        float dy)
Draws an filled front- or sideface around the given points. A frontface consists of a stroked edge line and a filled area. Sidefaces consist of sheared segments running around the frontface. For appropriate rendering results, all sidefaces of all lines and areas must be drawn before any of the frontfaces are.

Any line segment starting from or ending at points with NaN coordinate values is not drawn.

Areas are defined by continuous sequences of valid coordinate values in x and y arrays. If an area so defined is not already closed (it does not end to a point equal to the point it started from), the area will be closed by first travelling back along the corresponding points in prevX and prevY arrays, and then returning to the point the area oriignally started from. Any NaN points in prevX and prevY will be simply skipped.

Paint arrays that are not null are expected to contain shaded paints, as described by the ChartFactory.shade(Paint) method. Frontfaces are filled with NORMAL paint shade, while ascending sidefaces are filled with DARK and descending sidefaces with BRIGHT paint shades. Sidefaces facing back are not drawn.

Finally, the stroked front edge line is drawn only if the given stroke is not null. The edge line color is primarily taken from color, secondarily from paint and tertiary from pen. If they all are null, the edge line color defaults to black.

Parameters:
g - the graphics' context to draw in
side - draw side faces, or the front face
skipMissingPoints - run over missing points or not
pen - line front edge color
color - line color shades (may be null)
paint - line paint shades (may be null)
stroke - line stroke (may be null)
x - points data on x-axis
y - points data on y-axis
prevX - previous line points data on x-axis
prevY - previous line points data on y-axis
baseLevel - base Y value to use if prevY is null
x0 - X offset
y0 - Y offset
dx - X shear offset
dy - Y shear offset
See Also:
AxisFactory.createChart(com.davisor.graphics.chart.ChartFactory.ChartContext, com.davisor.graphics.chart.ChartFactory.ChartMetrics, com.davisor.graphics.chart.ChartAttributes, com.davisor.graphics.chart.Chart), drawShapes(java.awt.Graphics2D, java.awt.Paint[], java.awt.Paint[], java.awt.Stroke[], java.awt.Shape[], float[], float[], float, float, float, float, float), ChartFactory.shade(java.awt.Paint)

drawSegments

protected void drawSegments(java.awt.Graphics2D g,
                            boolean side,
                            java.awt.Paint[] color,
                            java.awt.Paint[] paint,
                            java.awt.Stroke stroke,
                            int lineSegments,
                            java.awt.Paint linePaint,
                            java.awt.Shape drawPath,
                            java.awt.Shape fillPath,
                            float dx,
                            float dy)

drawShapes

protected java.awt.geom.Rectangle2D[] drawShapes(java.awt.Graphics2D g,
                                                 java.awt.Paint[] color,
                                                 java.awt.Paint[] paint,
                                                 java.awt.Stroke[] stroke,
                                                 java.awt.Shape[] shape,
                                                 float[] x,
                                                 float[] y,
                                                 float s,
                                                 float x0,
                                                 float y0,
                                                 float dx,
                                                 float dy)
Draws a shape at the given points. Points with NaN coordinate values are not drawn.

The rendered shape consists of a stroked edge line on a filled background. If the shearing offsets dx and dy are not equal to zero, they will move the shape so that it will appear at the front edge on the sheared 3D decorations. Negative dx and dy shearing offset values move the shapes to the left and down, while positive values move them to the right and up.

Shapes for each point are taken from the shape array. Points with null shapes are not drawn at all.

The filled background paint of a shape is taken from the paint parameter. If the background paint for a shape is null, the shape is not filled.

The stroked edge line color of a shape is taken from the color parameter. If the line color is null, the shape's edge line is not drawn.

The shape's stroke is taken from the stroke parameter. If it is null, a thin solid line stroke is used by default.

Parameters:
g - the graphics' context to draw in
color - colors for shapes
paint - paints for shapes
stroke - shape stroke (may be null)
shape - shapes for points
x - points data on x-axis
y - points data on y-axis
s - shape size scalar factory
x0 - X offset
y0 - Y offset
dx - X shear offset
dy - Y shear offset
Returns:
bounding boxes for drawn shapes (located to 0,0)
See Also:
ChartFactory.shade(java.awt.Paint)

isAbsolute

protected boolean isAbsolute(int channel,
                             boolean[] cumulative,
                             ChartData data,
                             ChartAttributes attr,
                             PlotRenderAttributes plot,
                             boolean isometric)
Tests if given channel needs absolute point values. A channel needs to use absolute point values if it is cumulative or it defines a filled area line, and if current factory instance absCumulativeValues(boolean) returns true.

A channel needs to use absolute values if the data it contains can not be rendered reliably with 3D isometric graphics. In particular, absolute values are needed if any of the data points would have a value that would move it "backwards" to the negative direction. To prevent this, only absolute point data values should be used in rendering.

For example, if a cumulative channel had negative values, the corresponding line would have to "dig in" the previous line. Likewise, a closed non-cumulative filled area with positive and negative values would cross the bottom of the same area, standing on a coordinate axis.

Parameters:
channel - the number of the channel to test
cumulative - cumulativeness information for each channel
data - chart data
attr - chart attributes
plot - local plot area attributes
isometric - use isometric 3D rendering or not
See Also:
absCumulativeValues(boolean), isCumulative(int, boolean[]), ChartAttributes.isArea(java.lang.String, com.davisor.graphics.chart.PlotRenderAttributes)

isCumulative

protected boolean isCumulative(int channel,
                               boolean[] cumulative)
Tests if given channel is a member of mutually cumulative channels. A channel is a member of mutually cumulative channels when either it or the next channel is.

Parameters:
channel - the number of the channel to test
cumulative - cumulativeness information for each channel

drawSmoothedLine

protected float[] drawSmoothedLine(java.awt.Graphics2D g,
                                   boolean side,
                                   boolean skipMissingPoints,
                                   java.awt.Paint pen,
                                   java.awt.Paint[] color,
                                   java.awt.Paint[] paint,
                                   java.awt.Stroke stroke,
                                   float[] x,
                                   float[] y,
                                   float[] prevX,
                                   float[] prevY,
                                   float baseLevel,
                                   float x0,
                                   float y0,
                                   float dx,
                                   float dy,
                                   int lineSmoothness,
                                   float[] oldControlPoints)
Method for drawing smoothed lines. Smoothing is done using second order bezier curves. Smoothness of the line can be configured by lineSmoothness variable, which valid ranges from 0 to 100. 100 means very smoothed line, where 0 indicates that no smoothing should take place.

Parameters:
g - the graphics' context to draw in
side - draw side faces, or the front face
skipMissingPoints - run over missing points or not
pen - line front edge color
color - line color shades (may be null)
paint - line paint shades (may be null)
stroke - line stroke (may be null)
x - points data on x-axis
y - points data on y-axis
prevX - previous line points data on x-axis
prevY - previous line points data on y-axis
baseLevel - base Y value to use if prevY is null
x0 - X offset
y0 - Y offset
dx - X shear offset
dy - Y shear offset
lineSmoothness - is percentage of smoothness. 0 means no smoothing and 100 means maximal smoothing is to be applied.
oldControlPoints - in case of cumulative smoothed lines, the control points of previous line should be passed. If there are no previous control points, null should be passed.
Returns:
control points used to construct this smoothed line. These are needed in case of cumulative smoothed lines.
See Also:
drawLine(java.awt.Graphics2D, boolean, boolean, java.awt.Paint, java.awt.Paint[], java.awt.Paint[], java.awt.Stroke, float[], float[], float[], float[], float, float, float, float, float)

getAngle

protected double getAngle(float x0,
                          float y0,
                          float x1,
                          float y1,
                          float x2,
                          float y2)
This helper method will calculate angle (x0,y0), (x1,y1), (x2,y2)


getDefaultLineColor

protected java.awt.Paint getDefaultLineColor(boolean multiSeriesMode)
Returns default line color. Factories can override this method to define their own optimal default value.

Parameters:
multiSeriesMode - true if multi series mode is in use

getDefaultLinePaint

protected java.awt.Paint getDefaultLinePaint(boolean multiSeriesMode)
Returns default line paint. Factories can override this method to define their own optimal default value.

Parameters:
multiSeriesMode - true if multi series mode is in use


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