com.davisor.graphics.chart
Class AxisFactory

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

public abstract class AxisFactory
extends ChartFactory

AxisFactory implements an abstract base class for charts that render data into one-, two-, or three-dimensional coordinate systems. Axis chart subclasses are expected to extend the functionality of this class to render actual graph data into the axis coordinate systems produced by this class.

Introduction

Axis chart creation is divided into three major phases in order to give sub-classes a change to intervene at critical points:

Input

Axis charts expect data from channels of the following types. The channel types are taken from the corresponding tuple data stream type names:

Any number of value channels of any type are accepted. Each channel is mapped on a single axis, as defined by sub-class implementations. Individual values are mapped on chosen axes with de-interpolation, implemented by the de-interpolation operation of channel data type. This deinterpolation requires that axis minimum and maximum values are first resolved. When minimum and maximum values and their placement on target axis are known, the placement of intermediate values can also be resolved.

If there is more than one value channel, then the respective elements sharing the same element index in different channels form element groups. Different charts may assign special meanings to the members of each group, like for example ScatterFactory does with the X and Y coordinate values. There will be as many element groups as there are elements in the longest value channel. Missing elements are considered to have null values.

Cumulative values

Channel attributes, when present, control the value channel cumulativeness and visibility. Cumulative channels will add their values to the corresponding values of the previous channel, while non-cumulative channels will not. Hidden channels are not shown, but their values affect the element value accumulation.

Axes

The definitive feature for all axis charts is, that they maintain one or more coordinate system set up by axes groups, modelled by ChartAxes instances. Each axes group contains axes, modelled by ChartAxis instances. Each axis then sets up a value range and a value step that divides the range into a number of discrete steps.

Axis value ranges define not only the range minimum and maximum values, but also the type of the data that is expected to be laid out along the axis. The type may be anything supported by the Type framework, including simple scalar values, dates, timestamps, and enumerated values like labels. In particular, if chart input data contains a label channel, these labels are turned into a enumerated data type than spans a integer value range [0,N-1], where N is the number of labels.

Axis mimum and maximum values are resolved by finding data channel minimum and maximum values with the help of 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[]) method. Sub-class spesific resolveLimits(com.davisor.graphics.chart.ChartDataSummary) method then assign channel limit values on individual axes. Finally, ChartAxes.computeValues(com.davisor.data.DataValue[][]) method resolves the axis spesific minimum and maximum values. At this time the minimum and maximum values may also be overriden with explicitly given values. Furthermore, if axis spesific data step values have been given, they will be used to round the final minimum and maximum values to even step values.

The chart axes control the axis labeling, orientation, grid and 3D look. The chart axis will be labeled only if the axis label type has been given. If so, the labels are formatted with the given type. X- and Y-axis rotation determines the chart's 3D look. Zero rotation gives a flat 2D chart and other angles between zero and 90 will turn the axels and expose the top and right sides of the bar.

Attributes

Chart rendering details are controlled by chart rendering attributes. The font, background paint and pen color have their obvious meanings. Shapes can be drawn with the plot area stroke style, which will default to a thin solid line.

Element render attributes are primarily taken from the channel attributes, and secondarily from the corresponding channels. If channels are used, the n:th attribute column of one attribute type corresponds to the n:th value column. If there are more value columns than there are attribute columns of a specific type, the remaining value columns use the attributes from the last available attribute column.

The element color attribute controls the element borderline color, while the element paint controls the element fill color. The element's color will default to the plot area color, while the element's paint will default to missing (invisible) paint.

The element shape attribute controls the shape of the data points in the factories drawing shapes such as LineFactory and ScatterFactory. If the shape for an element is not set, no shape is drawn for the element.

Layout

AxisFactory partitions a chart coordinate system into a XY chart section, a sheared 3D Z section, a labeling section and titles. A separate axis info object is constructed for each axis chart to describe the measuremenets of these sections. Please see the AxisMetrics inner class documentation for details.

The chart image size is determined from initial chart attributes. If either or both of the width and height values are zero, the suitable image size values are queried from the subclasses through the getIdealSize(com.davisor.graphics.chart.ChartAxes, int, int, float[], float[][], float[][], float[][], float[]) method. If the chart size is decreased below the point where the chart labels would not fit in the space given to them, then the font sizes are automatically scaled down, in order to make the labels fit.

Since:
JDK1.2
See Also:
AxisFactory.AxisContext, AxisFactory.AxisMetrics

Nested Class Summary
 class AxisFactory.AxisContext
          AxisContext holds the state of one particular axis chart while it is being constructed.
 class AxisFactory.AxisMetrics
          AxisMetrics is an AxisFactory internal info container that carries axis chart manufacturing parameters.
 
Nested classes inherited from class com.davisor.graphics.chart.ChartFactory
ChartFactory.ChartContext, ChartFactory.ChartMetrics
 
Field Summary
static Type DEFAULTLABELTYPE
          Default label type (DoubleType(null,"#")).
protected static java.awt.geom.AffineTransform FLIPX
          Static flip-X transformation.
protected static java.awt.geom.AffineTransform FLIPY
          Static flip-Y transformation.
protected static int MAJORMARGIN
          Index for table elements that concern major marginal size data.
protected static int MINORMARGIN
          Index for table elements that concern minor marginal size data.
protected static int MINSIZE
          The minimum element size (3).
 
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
AxisFactory()
          Default constructor.
AxisFactory(AxisFactory factory)
          Copy constructor.
 
Method Summary
protected  float computeMinorMargin(int dim, float[][] labelSizes)
          Computes label minor margin size.
protected  Chart createChart(AxisFactory.AxisContext context, AxisFactory.AxisMetrics metrics, ChartAxes axes, boolean fillGrid, boolean drawAxes, boolean drawLabel, boolean drawGrid, Chart chart)
          Creates and renders an axis chart.
 Chart createChart(ChartFactory.ChartContext chartContext, ChartFactory.ChartMetrics chartMetrics, ChartAttributes attr, Chart chart)
          Draw chart.
 ChartFactory.ChartContext createContext(ChartData data, ChartAttributes attr)
          Creates axis chart context.
protected  AxisFactory.AxisContext createContext(ChartData data, ChartAttributes attr, ChartAxes axes, short index)
          Creates and initializes an axis chart context.
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 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  AxisFactory.AxisMetrics createMetrics(ChartAxes axes, float chartWidth, float chartHeight, float[] titleSize, float[] labelSize, float[] markerSize, float[] labelOffset, float[] markerOffset, float[] majorEdge, float[] minorEdge, float[] zLabel)
          Defines metrics for three-dimensional chart.
protected  AxisFactory.AxisMetrics createMetrics(ChartAxes axes, float width, float height, float[] titleSize, float[] labelSize, float[] markerSize, float[] axisOffset, float[] labelOffset, float[] markerOffset, float[] symbolOffset, float[] majorEdge, float[] minorEdge)
          Defines metrics for two-dimensional chart.
 ChartFactory.ChartMetrics createMetrics(ChartFactory.ChartContext context, ChartAttributes attr)
          Creates axis chart metrics.
protected  void drawAxis(ChartAxis axis, java.awt.Graphics2D g, AxisFactory.AxisMetrics metrics, boolean transpose, float zeroPosition, float offset, boolean drawAxis, boolean drawGrid, boolean down)
          Draws an axis inside the back area.
protected  Chart drawChart(AxisFactory.AxisContext context, AxisFactory.AxisMetrics metrics, ChartAxes axes, boolean fillGrid, boolean drawAxes, boolean drawLabel, boolean drawGrid, Chart chart)
          Renders an axis chart.
protected  void drawMarkers(java.awt.Graphics2D g, ChartAxes axes, AxisFactory.AxisMetrics metrics)
          Draws marker lines and fills areas between them.
protected static void drawTics(java.awt.Graphics2D g, java.awt.Shape ticShape, java.awt.Stroke ticStroke, java.awt.Paint ticColor, java.awt.Stroke gridStroke, java.awt.Paint gridColor, int ticLevel, float width, float height, float zeroPosition, DataValue min, DataValue max, DataValue step, java.util.ArrayList markers)
          Draws tic marks and grid lines along the axis.
protected  AxisFactory.AxisMetrics drawXYAxes(java.awt.Graphics2D g, ChartAxes axes, AxisFactory.AxisMetrics metrics, boolean fillGrid, boolean drawAxes, boolean drawLabel, boolean drawGrid)
          Draws a two-dimensional XY-axis.
protected  float[] drawXYZAxes(java.awt.Graphics2D g, ChartAxes axes, AxisFactory.AxisMetrics metrics, boolean fillGrid, boolean drawAxes, boolean drawLabel, boolean drawGrid)
          Draws a three-dimensional XYZ-axis.
protected  void fillGrid(ChartAxis axis, java.awt.Graphics2D g, AxisFactory.AxisMetrics metrics, boolean transpose)
          Fills the axis' face with back paint.
protected  void fillMarkers(ChartAxis axis, java.awt.Graphics2D g, AxisFactory.AxisMetrics metrics, boolean transpose)
          Fills the areas defined by markers.
protected static java.lang.String formatDouble(Type type, double value)
          Returns the correct locale formatted string received by formatting a float value.
protected static float[] getIdealSize(ChartAxes axes, float[] steps, float[] labelOffsets, float[][] titleSizes, float[][] labelSizes, float[][] markerSizes, float[] markerOffsets)
          Computes generic ideal suggested size for a chart.
protected  float[] getIdealSize(ChartAxes axes, int elements, int channels, float[] labelOffsets, float[][] titleSizes, float[][] labelSizes, float[][] markerSizes, float[] markerOffsets)
          Computes the ideal, suggested image size for this chart.
protected  boolean hasGridLines(ChartAxis axis)
          Tests if axis has grid lines in chart factory spesific way.
protected  boolean isSilent(ChartAxis axis)
          Tests axis silency in chart factory spesific way.
protected  void labelAxis(ChartAxis axis, java.awt.Graphics2D g, float renderWidth, float renderHeight, float offsetWidth, float edgeWidth, float labelHeight, float axisHeight, float rotation, boolean gaps, boolean down, boolean above, boolean flipx, boolean flipy)
          Labels an axis with tic labels.
protected  void labelMarkers(ChartAxis axis, java.awt.Graphics2D g, AxisFactory.AxisMetrics metrics, float plotOffsetWidth, float renderWidth, float renderHeight, float coreWidth, float markerHeight, float markerOffsetHeight, float labelHeight, float labelOffsetHeight, float axisHeight, boolean down, boolean above, boolean flipx, boolean flipy)
          Label markers.
protected  float[][] resolveLabels(ChartAxes axes, AxisFactory.AxisContext context)
          Computes ideal axis label sizes.
protected  java.awt.geom.Rectangle2D resolveLabels(ChartAxis axis, java.awt.Font font)
          Measures axis label maximum size.
protected abstract  DataValue[][] resolveLimits(ChartDataSummary summary)
          Computes chart factory specific axis limit values.
protected  float[][] resolveMarkerSizes(ChartAxes axes)
          Loops through the markers associated to X and Y axes.
protected static void resolveOverlap(AxisFactory.AxisContext context, float[][] labelSizes)
          Configures axis label offsets to ensure that axis labels do not overlap at the axis junction, or exceed chart bounds.
protected static void titleAxis(ChartAxis axis, java.awt.Graphics2D g, float renderWidth, float renderHeight, float titleHeight, float titleOffset, float markerHeight, float markerOffset, float labelHeight, float axisHeight, boolean down, boolean above, boolean flipx, boolean flipy)
          Labels an axis with a title.
protected static float[] transpose(float[] size)
          Transposes size array width/height elements, and returns them in a new array.
 
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, getLegendShape, 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

DEFAULTLABELTYPE

public static final Type DEFAULTLABELTYPE
Default label type (DoubleType(null,"#")).


MAJORMARGIN

protected static final int MAJORMARGIN
Index for table elements that concern major marginal size data.

See Also:
Constant Field Values

MINORMARGIN

protected static final int MINORMARGIN
Index for table elements that concern minor marginal size data.

See Also:
Constant Field Values

MINSIZE

protected static final int MINSIZE
The minimum element size (3).

See Also:
Constant Field Values

FLIPX

protected static final java.awt.geom.AffineTransform FLIPX
Static flip-X transformation.


FLIPY

protected static final java.awt.geom.AffineTransform FLIPY
Static flip-Y transformation.

Constructor Detail

AxisFactory

public AxisFactory()
Default constructor.


AxisFactory

public AxisFactory(AxisFactory factory)
Copy constructor.

Method Detail

resolveLimits

protected abstract DataValue[][] resolveLimits(ChartDataSummary summary)
Computes chart factory specific axis limit values. The computation is based on the chart input data limit values and/or the number of data elements, according to the nature of each particular chart factory.

This method will be called once before actual chart rendering begins. This gives each chart factory type a chance to control the range of values to be displayed. The result will be passed to ChartAxes.computeValues(com.davisor.data.DataValue[][]) method, which configures chart axes.

Parameters:
summary - chart data summary
Returns:
array of axis minimum and maximum data values ([x,y,...][min,max])
See Also:
ChartAxis.computeValues(com.davisor.data.DataValue[]), 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[])

createContext

public ChartFactory.ChartContext createContext(ChartData data,
                                               ChartAttributes attr)
                                        throws ChartException
Creates axis chart context.

Specified by:
createContext in class ChartFactory
Parameters:
data - chart data
attr - chart attributes
Returns:
chart context (AxisContext)
Throws:
ChartException - if chart generation fails
See Also:
createContext(ChartData,ChartAttributes,ChartAxes,short), createMetrics(com.davisor.graphics.chart.ChartFactory.ChartContext, com.davisor.graphics.chart.ChartAttributes), AxisFactory.AxisContext, ChartFactory.ChartContext

createMetrics

public ChartFactory.ChartMetrics createMetrics(ChartFactory.ChartContext context,
                                               ChartAttributes attr)
                                        throws ChartException
Creates axis chart metrics.

Specified by:
createMetrics in class ChartFactory
Parameters:
context - chart context (must be AxisFactory.AxisContext)
attr - chart attributes
Returns:
chart metrics (AxisMetrics)
Throws:
ChartException - if chart generation fails
See Also:
createMetrics(ChartAxes,AxisFactory.AxisContext,boolean,boolean), AxisFactory.AxisContext, AxisFactory.AxisMetrics

createChart

public Chart createChart(ChartFactory.ChartContext chartContext,
                         ChartFactory.ChartMetrics chartMetrics,
                         ChartAttributes attr,
                         Chart chart)
                  throws ChartException
Draw chart. See sub-classes for more information.

Specified by:
createChart in class ChartFactory
Parameters:
chartContext - pre-calculated context information (AxisContext)
chartMetrics - pre-calculated size information used in drawing (instance of AxisMetrics)
attr - chart attributes
chart - previously created chart to be drawn onto (may be null)
Returns:
the given chart instance or a new one if none was given
Throws:
ChartException - if chart generation fails
See Also:
createChart(AxisFactory.AxisContext,AxisFactory.AxisMetrics, ChartAxes,boolean,boolean,boolean,boolean,Chart)

computeMinorMargin

protected float computeMinorMargin(int dim,
                                   float[][] labelSizes)
Computes label minor margin size. Minor margin tells how much extra space edgemost labels are expected to need beyond axis end. On X -axis, the minor margin measures horizontal space width, on Y -axis, vertical space height.
                 X #
    |            X |           XX = edgemost label text
    |              |
    |              |            # = minor margin space
  ##+------##    X +------
  XX       XX    X #
 
Labels are typically rendered centered at axis end, in which case the label minor margin is equal to half the label width or heigh, depending on la, chartbel orientation. This is also the value this method returns by default. Sub-classes may override this as neccessary.

Parameters:
dim - dimension index (X or Y)
labelSizes - label width and height ([x,y][w,h])
Returns:
chart type spesific minor margin value
See Also:
resolveLabels(com.davisor.graphics.chart.ChartAxes, com.davisor.graphics.chart.AxisFactory.AxisContext)

createChart

protected Chart createChart(AxisFactory.AxisContext context,
                            AxisFactory.AxisMetrics metrics,
                            ChartAxes axes,
                            boolean fillGrid,
                            boolean drawAxes,
                            boolean drawLabel,
                            boolean drawGrid,
                            Chart chart)
                     throws ChartException
Creates and renders an axis chart.

The chart object the chart is rendered into depends on given chart parameter. If no chart object is given, a new one is created with ChartFactory.createChart(ChartAttributes,float,float,boolean). If the given chart is an ImageChart instance, the chart is rendered into it. In any other case the chart is deemed incompatible, and no chart is rendered.

Parameters:
context - chart context
metrics - chart metrics
axes - chart axes
fillGrid - enables or disables axis background filling
drawAxes - determine which axes may be drawn
drawLabel - determine if default labeling is to be applied
drawGrid - determine if axis grid is to be drawn
chart - chart to render to (may be null)
Returns:
given or new chart object
Throws:
ChartException - if chart generation fails

createContext

protected AxisFactory.AxisContext createContext(ChartData data,
                                                ChartAttributes attr,
                                                ChartAxes axes,
                                                short index)
                                         throws ChartException
Creates and initializes an axis chart context. The context will hold values neccessary to resolve chart image size. All context parameters expect data and attr will be new object instances. Sub-classes are expected to extend AxisFactory.AxisContext in order to pass forward sub-class spesific context parameter.

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

Parameters:
data - chart data
attr - chart attributes
axes - chart axes
index - context index among other contexts
Returns:
axis chart context, containing axis chart sizing information
Throws:
ChartException - if chart generation fails
See Also:
createMetrics(com.davisor.graphics.chart.ChartFactory.ChartContext, com.davisor.graphics.chart.ChartAttributes)

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 axis context. Sub-classes that need to extend the standard axis context are expected to override this method with an implementation that creates appropriate extended axis context instance.

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 axis context. Sub-classes that need to extend the standard axis context are expected to override this method with an implementation that creates appropriate extended axis context instance.

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 for each value channel
lastPlotColorChannel - last color channel for plot
paintChannelTypes - paint data channel type for each value channel
lastPlotPaintChannel - last paint channel for plot
urlChannelType - annotation URL address data channel type
labelType - label channel 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 contexts

createMetrics

protected AxisFactory.AxisMetrics createMetrics(ChartAxes axes,
                                                AxisFactory.AxisContext context,
                                                boolean scaleMargins,
                                                boolean conserveSpace)
                                         throws ChartException
Resolve final axis chart image and image component sizes. This method first computes ideal label sizes with the help of the resolveLabels(com.davisor.graphics.chart.ChartAxes, com.davisor.graphics.chart.AxisFactory.AxisContext) method. Sub-class spesific ideal chart size is computed next by invoking 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.

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:
createContext(com.davisor.graphics.chart.ChartData, com.davisor.graphics.chart.ChartAttributes), resolveLabels(com.davisor.graphics.chart.ChartAxes, com.davisor.graphics.chart.AxisFactory.AxisContext)

createMetrics

protected AxisFactory.AxisMetrics createMetrics(ChartAxes axes,
                                                float width,
                                                float height,
                                                float[] titleSize,
                                                float[] labelSize,
                                                float[] markerSize,
                                                float[] axisOffset,
                                                float[] labelOffset,
                                                float[] markerOffset,
                                                float[] symbolOffset,
                                                float[] majorEdge,
                                                float[] minorEdge)
                                         throws ChartException
Defines metrics for two-dimensional chart. The method determines axis section measurements as described by the inner AxisMetrics class documentation. When determining the axis marginal's width and height, the corresponding axis stroke widths are taken into account.

This method will compute and create a new axis metrix object that describes the sizes of all axis areas. Please see AxisFactory.AxisMetrics documentation for into what kind of areas the coordinate systems is divided.

Parameters:
axes - chart axes
width - chart width
height - chart height
titleSize - title size
labelSize - label size
markerSize - marker size
axisOffset - axis line offset
labelOffset - label offset
markerOffset - marker offset
symbolOffset - symbol line offset
majorEdge - major edge size
minorEdge - minor edge size
Returns:
axis measurements
Throws:
ChartException - if chart generation fails
See Also:
drawXYAxes(java.awt.Graphics2D, com.davisor.graphics.chart.ChartAxes, com.davisor.graphics.chart.AxisFactory.AxisMetrics, boolean, boolean, boolean, boolean), AxisFactory.AxisMetrics

createMetrics

protected AxisFactory.AxisMetrics createMetrics(ChartAxes axes,
                                                float chartWidth,
                                                float chartHeight,
                                                float[] titleSize,
                                                float[] labelSize,
                                                float[] markerSize,
                                                float[] labelOffset,
                                                float[] markerOffset,
                                                float[] majorEdge,
                                                float[] minorEdge,
                                                float[] zLabel)
                                         throws ChartException
Defines metrics for three-dimensional chart. The method determines axis section measurements as described by the inner AxisMetrics class documentation.

A isometric shearing space is merged with the marginal space, when possible. This makes better use of the available chart area, while still ensuring the requested marginal space for the labels.

Parameters:
axes - chart axes
chartWidth - chart width, stricly within chart borders
chartHeight - chart height, stricly within chart borders
titleSize - title size
labelSize - label size
markerSize - label size
labelOffset - label offset
markerOffset - label offset
majorEdge - major edge size
minorEdge - minor edge size
zLabel - Z -axis label information
Throws:
ChartException - if chart generation fails
See Also:
createMetrics(com.davisor.graphics.chart.ChartFactory.ChartContext, com.davisor.graphics.chart.ChartAttributes), drawXYZAxes(java.awt.Graphics2D, com.davisor.graphics.chart.ChartAxes, com.davisor.graphics.chart.AxisFactory.AxisMetrics, boolean, boolean, boolean, boolean), AxisFactory.AxisMetrics

drawAxis

protected void drawAxis(ChartAxis axis,
                        java.awt.Graphics2D g,
                        AxisFactory.AxisMetrics metrics,
                        boolean transpose,
                        float zeroPosition,
                        float offset,
                        boolean drawAxis,
                        boolean drawGrid,
                        boolean down)
                 throws InvalidDataException
Draws an axis inside the back area. Axis markings include a horizontal axis line with tic marks, and an equal number of vertical grid lines. The axis line is draw across the whole width of the back area at zeroPosition height. The grid lines are drawn across the whole height of the back area at even axis unit steps values. Axis line is also moved by vertical plot offset, and grid lines are moved horizontally by horizontal plot offset.
 h-----------        0 origo
 |  -:-:-:-  |       w back width
 | | : : : | |       h back height
 |o| : : : | |       z zero position
 | | : : : | |       o plot offset
 |===+=+=+===| z     = axis line
 | | : : : | |       : grid line
 |  -:-:-:-  |       : grid line
 0-----------w       + tic mark
 
If the axis is reversed, the axis and tic marks are mirrored horizontally (left becomes right, and vice versa). Axis opposite side status has no effect on how the axis is drawn.

When drawing an Y -axis, the given graphics context is assumed to have been rotated +90 degrees so that the Y -axis and the graphics context X -axis are parallel. In this case the transpose argument

Parameters:
axis - the axis to be drawn
g - the graphics context that the axis is to be drawn to
metrics - axis metrics
transpose - invert width/height or not
zeroPosition - zero value position along the vertical axis
offset - horizontal label offset along axis
drawAxis - determine if axis line and tic marks are to be drawn
drawGrid - determine if axis grid lines are to be drawn
down - true if grid lines extend to the -Y direction
Throws:
InvalidDataException - if data is invalid for axis drawing
See Also:
drawTics(java.awt.Graphics2D, java.awt.Shape, java.awt.Stroke, java.awt.Paint, java.awt.Stroke, java.awt.Paint, int, float, float, float, com.davisor.data.DataValue, com.davisor.data.DataValue, com.davisor.data.DataValue, java.util.ArrayList), drawXYAxes(java.awt.Graphics2D, com.davisor.graphics.chart.ChartAxes, com.davisor.graphics.chart.AxisFactory.AxisMetrics, boolean, boolean, boolean, boolean), drawXYZAxes(java.awt.Graphics2D, com.davisor.graphics.chart.ChartAxes, com.davisor.graphics.chart.AxisFactory.AxisMetrics, boolean, boolean, boolean, boolean)

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 an axis chart.

Before doing anything else, this method will move the given chart graphics context origo upwards and left so that title, label, and axis areas will lie left and below coordinate axes. The actual drawing area will lie above and right from coordinate axes, followed by top and right margin areas. In order for this to work, this method assumes that the old origo was located at target area bottom left corner, and X- and Y-axes positive directions were left and up, respectively.

Parameters:
context - chart context
metrics - chart metrics
axes - chart axes
fillGrid - enables or disables axis background filling
drawAxes - determine which axes may be drawn
drawLabel - determine if default labeling is to be applied
drawGrid - determine if axis grid is to be drawn
chart - chart to draw into
Throws:
InvalidDataException - if data is invalid for chart drawing

drawMarkers

protected void drawMarkers(java.awt.Graphics2D g,
                           ChartAxes axes,
                           AxisFactory.AxisMetrics metrics)
                    throws InvalidDataException
Draws marker lines and fills areas between them.

Throws:
InvalidDataException - if data is invalid for marker drawing

drawTics

protected static void drawTics(java.awt.Graphics2D g,
                               java.awt.Shape ticShape,
                               java.awt.Stroke ticStroke,
                               java.awt.Paint ticColor,
                               java.awt.Stroke gridStroke,
                               java.awt.Paint gridColor,
                               int ticLevel,
                               float width,
                               float height,
                               float zeroPosition,
                               DataValue min,
                               DataValue max,
                               DataValue step,
                               java.util.ArrayList markers)
                        throws InvalidDataException
Draws tic marks and grid lines along the axis. Tic marks are drawn only if given ticShape is not null. Grid lines are drawn only if given ticStroke is not null. Furthermore, if min, max, or step is null, or ticLevel is not positive, nothing is drawn.

Tic marks and grid lines are rendered along the axis, starting the distance offsetWidth from the origo, and continuing stepwise onwards. The exact label horizontal positions along the axis are deinterpolated with DataValue.deinterpolate(com.davisor.data.DataValue, com.davisor.data.DataValue), using axis minimum and maximum values as interpolation range, and axis step value as unit increment. If axis minimum and maximum values are equal, a single tic mark and grid line are draw at the center of the axis.

Parameters:
g - the graphics context for tic marks
ticShape - tic shape (may be null)
ticStroke - tic line stroke (may be null if tic shape is)
ticColor - tic line color (may be null if tic shape is)
gridStroke - grid line stroke (may be null)
gridColor - grid line color (may be null if grid stroke is)
ticLevel - tic recursion level (decreases until reaches 0)
width - grid width
height - grid height
zeroPosition - grid line offset
min - grid minimum value
max - grid maximum value
step - grid unit step
Throws:
InvalidDataException - if data is invalid for tic drawing
See Also:
labelAxis(com.davisor.graphics.chart.ChartAxis, java.awt.Graphics2D, float, float, float, float, float, float, float, boolean, boolean, boolean, boolean, boolean)

drawXYAxes

protected AxisFactory.AxisMetrics drawXYAxes(java.awt.Graphics2D g,
                                             ChartAxes axes,
                                             AxisFactory.AxisMetrics metrics,
                                             boolean fillGrid,
                                             boolean drawAxes,
                                             boolean drawLabel,
                                             boolean drawGrid)
                                      throws InvalidDataException
Draws a two-dimensional XY-axis. The axis will be equipped with different features, as requested by input boolean flags, but only if all neccessary graphics parameters have been provided.

The axis' position will depend on user coordinate space bounds, computed from the chart info minimum values and value ranges. The X- and Y-axis will be, respectively, positioned to:

The axis' position does not depend on the other axis, so any up/down/left/righ combination is possible.

Parameters:
g - graphics context to draw into
axes - axes to draw
metrics - chart metrics
fillGrid - determine if grid filling is to be enabled
drawAxes - determine which axes may be drawn
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 axes drawing
See Also:
createMetrics(com.davisor.graphics.chart.ChartFactory.ChartContext, com.davisor.graphics.chart.ChartAttributes), drawAxis(com.davisor.graphics.chart.ChartAxis, java.awt.Graphics2D, com.davisor.graphics.chart.AxisFactory.AxisMetrics, boolean, float, float, boolean, boolean, boolean), fillGrid(com.davisor.graphics.chart.ChartAxis, java.awt.Graphics2D, com.davisor.graphics.chart.AxisFactory.AxisMetrics, boolean), labelAxis(com.davisor.graphics.chart.ChartAxis, java.awt.Graphics2D, float, float, float, float, float, float, float, boolean, boolean, boolean, boolean, boolean)

drawXYZAxes

protected float[] drawXYZAxes(java.awt.Graphics2D g,
                              ChartAxes axes,
                              AxisFactory.AxisMetrics metrics,
                              boolean fillGrid,
                              boolean drawAxes,
                              boolean drawLabel,
                              boolean drawGrid)
                       throws InvalidDataException
Draws a three-dimensional XYZ-axis. The axes are filled and drawn in a specific order, so that their fill attributes will affect the axes' faces as follows:

Parameters:
g - graphics context to draw into
axes - chart axes to draw
metrics - axis area measurements
fillGrid - enables or disables axis background filling
drawAxes - determine which axes may be drawn
drawLabel - determine if default labeling is to be applied
drawGrid - determine if axis grid is to be drawn
Throws:
InvalidDataException - if data is invalid for axes drawing
See Also:
createMetrics(com.davisor.graphics.chart.ChartFactory.ChartContext, com.davisor.graphics.chart.ChartAttributes), drawAxis(com.davisor.graphics.chart.ChartAxis, java.awt.Graphics2D, com.davisor.graphics.chart.AxisFactory.AxisMetrics, boolean, float, float, boolean, boolean, boolean), drawXYAxes(java.awt.Graphics2D, com.davisor.graphics.chart.ChartAxes, com.davisor.graphics.chart.AxisFactory.AxisMetrics, boolean, boolean, boolean, boolean), labelAxis(com.davisor.graphics.chart.ChartAxis, java.awt.Graphics2D, float, float, float, float, float, float, float, boolean, boolean, boolean, boolean, boolean)

fillGrid

protected void fillGrid(ChartAxis axis,
                        java.awt.Graphics2D g,
                        AxisFactory.AxisMetrics metrics,
                        boolean transpose)
Fills the axis' face with back paint. Draws edges using the back stroke and back color, if stroke is given. drawXYAxes(java.awt.Graphics2D, com.davisor.graphics.chart.ChartAxes, com.davisor.graphics.chart.AxisFactory.AxisMetrics, boolean, boolean, boolean, boolean) and drawXYZAxes(java.awt.Graphics2D, com.davisor.graphics.chart.ChartAxes, com.davisor.graphics.chart.AxisFactory.AxisMetrics, boolean, boolean, boolean, boolean) call this method to fill the axes backfaces before anything else is draw on them.

Parameters:
axis - the axis to be drawn
g - the graphics context that the axis is to be drawn to
metrics - chart metrics
transpose - invert width/height or not
See Also:
drawAxis(com.davisor.graphics.chart.ChartAxis, java.awt.Graphics2D, com.davisor.graphics.chart.AxisFactory.AxisMetrics, boolean, float, float, boolean, boolean, boolean)

fillMarkers

protected void fillMarkers(ChartAxis axis,
                           java.awt.Graphics2D g,
                           AxisFactory.AxisMetrics metrics,
                           boolean transpose)
                    throws