TPTP 4.5.0 Platform Project
Internal API Specification

org.eclipse.tptp.platform.report.chart.svg.internal.part
Class Legend

java.lang.Object
  extended by org.eclipse.tptp.platform.report.chart.svg.internal.generator.SVGBase
      extended by org.eclipse.tptp.platform.report.chart.svg.internal.generator.SVGContainerBase
          extended by org.eclipse.tptp.platform.report.chart.svg.internal.generator.SVGDocumentFragmentBase
              extended by org.eclipse.tptp.platform.report.chart.svg.internal.generator.SVGSvg
                  extended by org.eclipse.tptp.platform.report.chart.svg.internal.part.Part
                      extended by org.eclipse.tptp.platform.report.chart.svg.internal.part.Legend
All Implemented Interfaces:
java.io.Serializable, ISVGBase, ISVGContainerBase, ISVGDocumentFragmentBase, IConstants, IGraphicTypeConstants
Direct Known Subclasses:
LegendHorizontalLTR, LegendHorizontalRTL, LegendVerticalLTR, LegendVerticalRTL

public abstract class Legend
extends Part

Legend $Revision: 1.2 $

See Also:
Serialized Form

Field Summary
protected  java.lang.String backgroundColor
          background color of legend
protected  double chartHeight
          Height of the chart area
protected  double chartWidth
          Width of the chart area
protected  double customHeight
           
protected  double customWidth
           
protected  DataSet[] datasetArray
          an array of Datasets
protected  FontHelper fontHelper
          For calculating string lengths
protected  boolean isLTR
          text direction
protected  boolean isSetCustomHeight
           
protected  boolean isSetCustomWidth
           
protected  java.lang.String legendId
          legend identifier
protected  java.lang.String[] legendLabels
          an array of legend labels
protected  java.lang.String legendTitle
          legend title
protected  java.lang.String location
          position of the legend
protected  double margin
          Margin between the plotarea and legend
protected  NLString nls
          An object for retriving translated text
protected  int numOfDataSets
          Number of data sets
protected  SVGColorPalettes palettes
          Palettes for legend shape color
protected  SVGShapes shapes
          Shapes to be used in the legend
protected  boolean useShapes
          A flag to show if shapes should be used
 
Fields inherited from class org.eclipse.tptp.platform.report.chart.svg.internal.part.Part
height, input, width, x, y
 
Fields inherited from interface org.eclipse.tptp.platform.report.chart.svg.internal.part.IConstants
AXIS_LABEL_FONT_SIZE, AXIS_SPACE_BTW_AXIS_AND_LABEL, AXIS_SPACE_BTW_TITLE_AND_LABEL, AXIS_TITLE_FONT_SIZE, AXIS_TYPE_INDEPENDENT_AXIS, AXIS_TYPE_PRIMARY_DEPENDENT_AXIS, AXIS_TYPE_SECONDARY_DEPENDENT_AXIS, BASE_FONT_SIZE, CHART_AREA_DEFAULT_HEIGHT, CHART_AREA_DEFAULT_WIDTH, CHART_AREA_METER_DEFAULT_WIDTH, EMPTY_STRING, GRAPH_AREA_MARGIN, GRAPH_AREA_TOP_MARGIN, HIDDEN, HOLE_RADIUS, HORIZONTAL, LEGEND_HORIZONTAL_HEIGHT, LEGEND_HORIZONTAL_SIDE_MARGIN, LEGEND_HORIZONTAL_TOP_MARGIN, LEGEND_ITEM_FONT_SIZE, LEGEND_ITEMS_PER_ROW, LEGEND_MAX_HEIGHT_FRACTION, LEGEND_MAX_WIDTH_FRACTION, LEGEND_NARROW_SIDE_MARGIN, LEGEND_SPACE_AFTER_TITLE, LEGEND_SPACE_BETWEEN_ITEMS, LEGEND_SPACE_BETWEEN_SYMBOL_AND_TEXT, LEGEND_SYMBOL_LINE_LENGTH, LEGEND_TITLE_FONT_SIZE, LEGEND_VERTICAL_TOP_MARGIN, LEGEND_WIDE_SIDE_MARGIN, MARKER_LINE_DEFAULT_COLOR, PLOT_AREA_MARGIN, POSITION_EAST, POSITION_LEADING, POSITION_NORTH, POSITION_SOUTH, POSITION_TRAILING, POSITION_WEST, TEXT_ANCHOR_END, TEXT_ANCHOR_MIDDLE, TEXT_ANCHOR_START, TICK_MARK_LENGTH, TIMESTAMP_BOTTOM_MARGIN, TIMESTAMP_HEIGHT, TIMESTAMP_SIDE_MARGIN, TITLE_FONT_SIZE, TITLE_HEIGHT, TITLE_PREF_ICON_HEIGHT, TITLE_PREF_ICON_WIDTH, TITLE_SIDE_MARGIN, VERTICAL, VISIBLE
 
Fields inherited from interface org.eclipse.tptp.platform.report.chart.svg.internal.part.IGraphicTypeConstants
AREA_CHART, HBAR_CHART, HBAR_CHART3D, HSTACKBAR_CHART, HSTACKBAR_CHART3D, LINE_CHART, METER, PIE_CHART, PIE_CHART3D, SCATTER_CHART, STACK_AREA_CHART, VBAR_CHART, VBAR_CHART3D, VSTACKBAR_CHART, VSTACKBAR_CHART3D
 
Constructor Summary
Legend(Chart input, double x, double y, double width, double height, double chartWidth, double chartHeight, int margin, SVGColorPalettes palettes, SVGShapes shapes, NLString nls)
           
 
Method Summary
protected  SVGBase drawLegendItem(double x, double y, int itemNum)
          Draws a legend item in the legend
protected  SVGBase drawLegendItem(java.lang.String shapeId, double shapeWidth, double shapeHeight, double x, double y, int itemNum)
           
protected  SVGText drawTitle(double x, double y)
          draws the legend title
static Legend getInstance(java.lang.String legendPosition, boolean isLTR, Chart input, double x, double y, double width, double height, double chartWidth, double chartHeight, int margin, SVGColorPalettes palettes, SVGShapes shapes, NLString nls)
          Return a subclass given the legend position and text direction.
 double getLegendHeight()
           
 double getLegendWidth()
           
 void setNLString(NLString nls)
          Sets the NLString object to retrive translated text
 
Methods inherited from class org.eclipse.tptp.platform.report.chart.svg.internal.part.Part
constructPart, doImplementation
 
Methods inherited from class org.eclipse.tptp.platform.report.chart.svg.internal.generator.SVGSvg
addDefinition, addDefinition, addStyle, doImplementation, doImplementation, doImplementation, getImplementation
 
Methods inherited from class org.eclipse.tptp.platform.report.chart.svg.internal.generator.SVGDocumentFragmentBase
getHeight, getPreserveAspectRatio, getViewbox, getWidth, getXCoordinate, getYCoordinate, setHeight, setPreserveAspectRatio, setViewbox, setWidth, setXCoordinate, setYCoordinate
 
Methods inherited from class org.eclipse.tptp.platform.report.chart.svg.internal.generator.SVGContainerBase
getChildren, getDesc, getTitle, setChildren, setDesc, setTitle
 
Methods inherited from class org.eclipse.tptp.platform.report.chart.svg.internal.generator.SVGBase
getIdentifier, getStyle, getStyleClass, getTagName, getVisibility, setIdentifier, setStyle, setStyleClass, setTagName, setVisibility
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

legendId

protected java.lang.String legendId
legend identifier


legendTitle

protected java.lang.String legendTitle
legend title


legendLabels

protected java.lang.String[] legendLabels
an array of legend labels


datasetArray

protected DataSet[] datasetArray
an array of Datasets


location

protected java.lang.String location
position of the legend


useShapes

protected boolean useShapes
A flag to show if shapes should be used


shapes

protected SVGShapes shapes
Shapes to be used in the legend


palettes

protected SVGColorPalettes palettes
Palettes for legend shape color


numOfDataSets

protected int numOfDataSets
Number of data sets


backgroundColor

protected java.lang.String backgroundColor
background color of legend


isLTR

protected boolean isLTR
text direction


nls

protected NLString nls
An object for retriving translated text


fontHelper

protected FontHelper fontHelper
For calculating string lengths


chartWidth

protected double chartWidth
Width of the chart area


margin

protected double margin
Margin between the plotarea and legend


chartHeight

protected double chartHeight
Height of the chart area


customHeight

protected double customHeight

isSetCustomHeight

protected boolean isSetCustomHeight

customWidth

protected double customWidth

isSetCustomWidth

protected boolean isSetCustomWidth
Constructor Detail

Legend

public Legend(Chart input,
              double x,
              double y,
              double width,
              double height,
              double chartWidth,
              double chartHeight,
              int margin,
              SVGColorPalettes palettes,
              SVGShapes shapes,
              NLString nls)
Parameters:
input -
x -
y -
width -
height -
Method Detail

drawTitle

protected SVGText drawTitle(double x,
                            double y)
draws the legend title

Parameters:
x - the x coordinate of the title
y - the y coordinate of the title
Returns:
title in SVGText

drawLegendItem

protected SVGBase drawLegendItem(double x,
                                 double y,
                                 int itemNum)
Draws a legend item in the legend

Parameters:
x - the x coordinate of the item
y - the y coordinate of the item
itemNum - the item number, use for determining the color or shape
Returns:
a legend item

drawLegendItem

protected SVGBase drawLegendItem(java.lang.String shapeId,
                                 double shapeWidth,
                                 double shapeHeight,
                                 double x,
                                 double y,
                                 int itemNum)

getInstance

public static Legend getInstance(java.lang.String legendPosition,
                                 boolean isLTR,
                                 Chart input,
                                 double x,
                                 double y,
                                 double width,
                                 double height,
                                 double chartWidth,
                                 double chartHeight,
                                 int margin,
                                 SVGColorPalettes palettes,
                                 SVGShapes shapes,
                                 NLString nls)
Return a subclass given the legend position and text direction.

Parameters:
legendPosition -
isLTR -
input -
x -
y -
width -
height -
shapes -
Returns:

setNLString

public void setNLString(NLString nls)
Sets the NLString object to retrive translated text

Parameters:
nls -

getLegendHeight

public double getLegendHeight()

getLegendWidth

public double getLegendWidth()

TPTP 4.5.0 Platform Project
Internal API Specification