com.ibm.etools.pd.widget.viewer
Class SVGXYChart

java.lang.Object
  |
  +--com.ibm.etools.pd.widget.viewer.GraphicDocumentGenerator
        |
        +--com.ibm.etools.pd.widget.viewer.SVGDocumentGenerator
              |
              +--com.ibm.etools.pd.widget.viewer.SVGXYChart
All Implemented Interfaces:
IDataInputConstants, IGraphicDocumentGenerator, IGraphicDocumentStyle, java.io.Serializable
Direct Known Subclasses:
SVGBarChart, SVGLineChart, SVGStackBarChart

public abstract class SVGXYChart
extends SVGDocumentGenerator
implements IDataInputConstants, java.io.Serializable

SVGXYChart is an abstract base class providing implementation of methods common to classes generating SVG graphics which have x,y axes.

See Also:
Serialized Form

Field Summary
protected  int axisLabelFontSize
           
protected  XYChartDataRetriever dataRetriever
          Provides methods for retrieving the data from the configuration and data documents.
protected static int GRIDXOFFSET
           
protected  int GRIDYOFFSET
           
protected  int xAxisLabelYValue
           
protected  int xAxisLength
           
protected  double[] xAxisValues
           
protected  double XRATIO
           
protected  int yAxisLength
           
protected  double yMaxValue
           
protected  double YRATIO
           
 
Fields inherited from class com.ibm.etools.pd.widget.viewer.SVGDocumentGenerator
svgRoot
 
Fields inherited from class com.ibm.etools.pd.widget.viewer.GraphicDocumentGenerator
configDocument, dataDocument, generatedDocument, graphicColourPalette, graphicColourPaletteName, graphicFont, graphicHeight, graphicLegendTitle, graphicTimestampPrefix, graphicTitle, graphicType, graphicWidth, preferencesPage, preferencesPageHeight, preferencesPageWidth, resourcesFolder, suppressLegend
 
Fields inherited from interface com.ibm.etools.pd.widget.viewer.IDataInputConstants
ACTUAL_RATE, CATEGORIZATION, CATEGORY, CONFIGURATION, CONTEXT, DATAPOINT, DATASET, DATAUPDATE, DESCRIPTION, EMPTY_STRING, FONT, HEIGHT, ID, LEGEND_TITLE, MAXVALUE, MINVALUE, NAME, PERCENTAGE_OF_DATAPOINT_TOTAL, POSITION, RANGE, RATE_DEFINITION, SEGMENT_MARKER, SUMMARY, SUPPRESS_LEGEND, TIMESTAMP, TIMESTAMP_PREFIX, TITLE, TOTAL, TOTAL_TITLE, VALUE, VALUE_TITLE, WIDTH, X_TITLE, Y_TITLE
 
Fields inherited from interface com.ibm.etools.pd.widget.viewer.IGraphicDocumentStyle
BAR_PREFS, BAR_PREFS_HEIGHT, BASIC_FONT, BASIC_FONTSIZE, BASIC_FONTSTYLE, BASIC_HEIGHT, BASIC_SHOW_PERCENTS, BASIC_SHOW_SHAPES, BASIC_SHOW_VALUES, BASIC_WIDTH, COMMON_STYLE, EARTH, EARTH_PALETTE, HARVEST, HARVEST_PALETTE, LABEL_FONTSIZE_DELTA, LINE_DEFAULT_WIDTH, LINE_PREFS, LINE_PREFS_HEIGHT, METER_DEFAULT_WIDTH, METER_PREFS, METER_PREFS_HEIGHT, METER_STYLE, NS_BAR_PREFS_HEIGHT, NS_LINE_PREFS_HEIGHT, NS_METER_PREFS_HEIGHT, NS_PIE_PREFS_HEIGHT, NS_PREFS, NS_PREFS_WIDTH, NS_STACKBAR_PREFS_HEIGHT, PASTEL, PASTEL_PALETTE, PIE_DEFAULT_WIDTH, PIE_PREFS, PIE_PREFS_HEIGHT, PIE_STYLE, PREFS, PREFS_WIDTH, SEASIDE, SEASIDE_PALETTE, SPRING, SPRING_PALETTE, STACKBAR_DEFAULT_WIDTH, STACKBAR_PREFS, STACKBAR_PREFS_HEIGHT, SUMMER, SUMMER_PALETTE, TITLE_FONTSIZE_DELTA, XYCHART_STYLE
 
Method Summary
protected  void addAxisLabels(org.w3c.dom.Element parent, java.lang.String[] xAxisLabels, java.lang.String[] yAxisLabels)
          Adds the axis data labels to the x- and y-axes.
protected  void addEachTextBox(org.w3c.dom.Element parent, double x, double y, double width, double height, java.lang.String value, int dataSet, int next, java.lang.String crossXAxisFlag)
          Add one text box (with a value inside it)
protected  void addGrid(org.w3c.dom.Element parent, int xTicks, int yTicks, java.lang.String[] yAxisLabels)
          Adds the grid for the x,y axes and draws tick lines on them, positioning them based on the y-axis marker values.
protected  void addJavaScriptFunctions(org.w3c.dom.Element parent, int numberOfSets)
          Adds the JavaScript functions required by this object's graphic.
protected  void addTitles(org.w3c.dom.Element parent, java.util.Hashtable input)
          Adds the titles to the SVG graphic.
protected  java.util.Vector calculateDashGridYPositions(java.lang.String[] yAxisLabels)
          Calculate the y position of all dash grid lines
 void setConfigDocument(org.w3c.dom.Document newConfigDocument)
          Sets the document which is to be used for configuration data retrieval and then retrieves the configuration data from that document.
 void setDataDocument(org.w3c.dom.Document newDataDocument)
          Sets the document which is to be used for data update retrieval and then, if configDocument has not been set, retrieves the configuration data from that document.
 void setGraphicHeight(java.lang.String newGraphicHeight)
          Sets the graphic height and then computes the length of the y-axis as a factor of the graphic height.
 void setGraphicWidth(java.lang.String newGraphicWidth)
          Sets the graphic width and then computes the length of the x-axis as a factor of the graphic width.
 
Methods inherited from class com.ibm.etools.pd.widget.viewer.SVGDocumentGenerator
addBorder, addLabel, addLegend, addLegendShapes, addPreferenceIcon, addTimeStamp, addTitle, createDOMTextElement, createGraphicColourPalettes, createSvgDocument, getPreferencesPage, getPreferencesPageHeight, getPreferencesPageWidth, setGraphicFont, setPreferencesPage, setPreferencesPageHeight, setPreferencesPageWidth
 
Methods inherited from class com.ibm.etools.pd.widget.viewer.GraphicDocumentGenerator
addGraphicColourPalette, generateAndSerialize, generateAndSerializeTo, generateGraphicDocument, getConfigDocument, getDataDocument, getGeneratedDocument, getGraphicColourPalette, getGraphicColourPaletteName, getGraphicFont, getGraphicHeight, getGraphicLegendTitle, getGraphicTimestampPrefix, getGraphicTitle, getGraphicType, getGraphicWidth, getResourcesFolder, isLegendSuppressed, serializeGeneratedDocumentToFile, serializeGeneratedDocumentToStream, serializeGeneratedDocumentToString, setGraphicColourPaletteName, setGraphicLegendTitle, setGraphicTimestampPrefix, setGraphicTitle, setResourcesFolder, setSuppressLegend
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataRetriever

protected XYChartDataRetriever dataRetriever
Provides methods for retrieving the data from the configuration and data documents.


XRATIO

protected final double XRATIO
See Also:
Constant Field Values

YRATIO

protected final double YRATIO
See Also:
Constant Field Values

GRIDXOFFSET

protected static int GRIDXOFFSET

GRIDYOFFSET

protected final int GRIDYOFFSET
See Also:
Constant Field Values

xAxisLength

protected int xAxisLength

yAxisLength

protected int yAxisLength

xAxisValues

protected double[] xAxisValues

axisLabelFontSize

protected int axisLabelFontSize

xAxisLabelYValue

protected int xAxisLabelYValue

yMaxValue

protected double yMaxValue
Method Detail

setConfigDocument

public void setConfigDocument(org.w3c.dom.Document newConfigDocument)
                       throws DataInputProcessingException
Sets the document which is to be used for configuration data retrieval and then retrieves the configuration data from that document.

Specified by:
setConfigDocument in interface IGraphicDocumentGenerator
Overrides:
setConfigDocument in class GraphicDocumentGenerator
DataInputProcessingException
See Also:
IGraphicDocumentGenerator.setConfigDocument(Document)

setDataDocument

public void setDataDocument(org.w3c.dom.Document newDataDocument)
                     throws DataInputProcessingException
Sets the document which is to be used for data update retrieval and then, if configDocument has not been set, retrieves the configuration data from that document.

Specified by:
setDataDocument in interface IGraphicDocumentGenerator
Overrides:
setDataDocument in class GraphicDocumentGenerator
DataInputProcessingException
See Also:
IGraphicDocumentGenerator.setDataDocument(Document)

setGraphicWidth

public void setGraphicWidth(java.lang.String newGraphicWidth)
Sets the graphic width and then computes the length of the x-axis as a factor of the graphic width.

Specified by:
setGraphicWidth in interface IGraphicDocumentGenerator
Overrides:
setGraphicWidth in class SVGDocumentGenerator
See Also:
IGraphicDocumentGenerator.setGraphicWidth(String)

setGraphicHeight

public void setGraphicHeight(java.lang.String newGraphicHeight)
Sets the graphic height and then computes the length of the y-axis as a factor of the graphic height.

Specified by:
setGraphicHeight in interface IGraphicDocumentGenerator
Overrides:
setGraphicHeight in class SVGDocumentGenerator
See Also:
IGraphicDocumentGenerator.setGraphicHeight(String)

addJavaScriptFunctions

protected void addJavaScriptFunctions(org.w3c.dom.Element parent,
                                      int numberOfSets)
Description copied from class: SVGDocumentGenerator
Adds the JavaScript functions required by this object's graphic.

Overrides:
addJavaScriptFunctions in class SVGDocumentGenerator
Parameters:
parent - element to which the script-related elements are appended
numberOfSets - the number of data sets in the input

addEachTextBox

protected void addEachTextBox(org.w3c.dom.Element parent,
                              double x,
                              double y,
                              double width,
                              double height,
                              java.lang.String value,
                              int dataSet,
                              int next,
                              java.lang.String crossXAxisFlag)
Add one text box (with a value inside it)

Parameters:
parent - element to which the textbox-related elements are appended
x - x-coordinate of the text box
y - y-coordinate of the text box
width - width of the text box
height - height of the text box

addGrid

protected void addGrid(org.w3c.dom.Element parent,
                       int xTicks,
                       int yTicks,
                       java.lang.String[] yAxisLabels)
Adds the grid for the x,y axes and draws tick lines on them, positioning them based on the y-axis marker values.

Parameters:
parent - element to which the grid-related elements are appended
xTicks - number of ticks to draw on the x-axis
yTicks - number of ticks to draw on the y-axis
yAxisLabels - the set of y-axis range marker values

addTitles

protected void addTitles(org.w3c.dom.Element parent,
                         java.util.Hashtable input)
Adds the titles to the SVG graphic. This includes the main title, legend title (if appropriate), x-axis label and y-axis label.

Parameters:
parent - element to which the title-related elements are appended
input - the titles

addAxisLabels

protected void addAxisLabels(org.w3c.dom.Element parent,
                             java.lang.String[] xAxisLabels,
                             java.lang.String[] yAxisLabels)
Adds the axis data labels to the x- and y-axes.

Parameters:
parent - element to which the label-related elements are appended
xAxisLabels - data labels for the x-axis
yAxisLabels - data labels for the y-axis

calculateDashGridYPositions

protected java.util.Vector calculateDashGridYPositions(java.lang.String[] yAxisLabels)
Calculate the y position of all dash grid lines

Parameters:
yAxisLabels - the set of y-axis range marker values