com.davisor.graphics.chart
Class LayoutFactory

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

public class LayoutFactory
extends ChartFactory

LayoutFactory implements a chart that can combine different charts into one chart. The used layout can be specified.

Introduction

Layout-chart divides the chart drawing area into separate parts and asks all sub charts to render themselves into the specified locations on the master chart. Layout chart will ask the preferred size from the sub charts and it uses that information when possible.

Sub charts do not know anything about each others. They may share the same data and attributes.

At first, this is used only to combine a legend chart with some other chart.

Layout chart manufacturing process

Layout-charts are created with the following procedure:

Size allocation

TBA

Available Layouts

Currently there is only one supported layout model. It consists of four alignments for the second chart in relation to the first one. Those are: up,down,left,right.

Since:
JDK1.3

Nested Class Summary
 class LayoutFactory.LayoutContext
          Stores context information for the drawn chart and legend.
 class LayoutFactory.LayoutMetrics
          Stores chart and legend metrics.
 
Nested classes inherited from class com.davisor.graphics.chart.ChartFactory
ChartFactory.ChartContext, ChartFactory.ChartMetrics
 
Field Summary
static java.lang.Number DEFAULT_OFFSET
          Default offset in device coordinates.
protected static java.lang.String DEFAULTLEGENDFACTORYNAME
          Legend factory name ("legend").
protected static java.lang.String DUMPFACTORYNAME
          Dump factory name ("dump").
 
Fields inherited from class com.davisor.graphics.chart.ChartFactory
ALL, BRIGHT, CHANNEL, COS, DARK, DOTSEQUENCE, DOTSTROKE, DOTSTROKEWIDTH, 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
LayoutFactory()
          Default constructor.
LayoutFactory(LayoutFactory factory)
          Copy constructor.
 
Method Summary
 Chart createChart(ChartData data, ChartAttributes attr, Chart chart)
          Overrides the ChartFactory implementation.
 Chart createChart(ChartFactory.ChartContext chartContext, ChartFactory.ChartMetrics chartMetrics, ChartAttributes attr, Chart chart)
          Creates a chart with an embedded legend chart.
 ChartFactory.ChartContext createContext(ChartData data, ChartAttributes attr)
          Create chart and legend contexts and store them inside LayoutFactory.LayoutContext.
 ChartFactory.ChartMetrics createMetrics(ChartFactory.ChartContext chartContext, ChartAttributes attr)
          Create metrics for the chart and the legend.
 com.davisor.core.Dupable dup()
          Duplicates this factory.
static boolean hasLegend(ChartFactory factory, ChartAttributes attr)
          Decides whether there will be legend or not basing on the given factory and attributes.
 
Methods inherited from class com.davisor.graphics.chart.ChartFactory
annotate, combineProperties, createChannelType, createChannelType, 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
 

Field Detail

DEFAULT_OFFSET

public static java.lang.Number DEFAULT_OFFSET
Default offset in device coordinates.


DEFAULTLEGENDFACTORYNAME

protected static final java.lang.String DEFAULTLEGENDFACTORYNAME
Legend factory name ("legend").

See Also:
Constant Field Values

DUMPFACTORYNAME

protected static final java.lang.String DUMPFACTORYNAME
Dump factory name ("dump").

See Also:
Constant Field Values
Constructor Detail

LayoutFactory

public LayoutFactory()
Default constructor.


LayoutFactory

public LayoutFactory(LayoutFactory factory)
Copy constructor.

Method Detail

createChart

public Chart createChart(ChartData data,
                         ChartAttributes attr,
                         Chart chart)
                  throws ChartException
Overrides the ChartFactory implementation.

Creates a chart containing other charts laid out according to the layout specification. A layoutfactory chart consists of one or more charts, all draw into a common coordinate system. Please see class description for more information.

Overrides:
createChart in class ChartFactory
Parameters:
data - chart data
attr - chart attributes (may be null)
chart - a ready made chart to draw onto (may be null)
Throws:
ChartException - if chart generation fails
See Also:
ChartFactory.createChart(ChartData,ChartAttributes)

createContext

public ChartFactory.ChartContext createContext(ChartData data,
                                               ChartAttributes attr)
                                        throws ChartException
Create chart and legend contexts and store them inside LayoutFactory.LayoutContext. Resolve also legend attributes.

Specified by:
createContext in class ChartFactory
Parameters:
data - chart data
attr - chart attributes
Returns:
a new LayoutContext instance
Throws:
ChartException - if chart generation fails
See Also:
ChartFactory.createMetrics(com.davisor.graphics.chart.ChartFactory.ChartContext, com.davisor.graphics.chart.ChartAttributes)

createMetrics

public ChartFactory.ChartMetrics createMetrics(ChartFactory.ChartContext chartContext,
                                               ChartAttributes attr)
                                        throws ChartException
Create metrics for the chart and the legend. Combine sizes.

Specified by:
createMetrics in class ChartFactory
Parameters:
chartContext - a LayoutContext instance
attr - chart attributes
Returns:
a new LayoutMetrics instance
Throws:
ChartException - if chart generation fails

createChart

public Chart createChart(ChartFactory.ChartContext chartContext,
                         ChartFactory.ChartMetrics chartMetrics,
                         ChartAttributes attr,
                         Chart chart)
                  throws ChartException
Creates a chart with an embedded legend 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.

Specified by:
createChart in class ChartFactory
Parameters:
chartContext - context information (LayoutContext)
chartMetrics - size information used in drawing (LayoutMetrics)
attr - chart attributes
chart - chart to render to (may be null)
Returns:
given or new chart object
Throws:
ChartException - if chart generation fails

hasLegend

public static boolean hasLegend(ChartFactory factory,
                                ChartAttributes attr)
                         throws ChartException
Decides whether there will be legend or not basing on the given factory and attributes. If factory is null, tries to resolve proper factory from attributes.

Parameters:
factory - The final chart factory (may be null)
attr - Chart attributes
Throws:
ChartException - If resolvation cannot be done due to the missing information

dup

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



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