Venice 0.751beta

nz.org.venice.chart.graph
Class KDGraph

java.lang.Object
  extended bynz.org.venice.chart.graph.AbstractGraph
      extended bynz.org.venice.chart.graph.KDGraph
All Implemented Interfaces:
Graph

public class KDGraph
extends AbstractGraph


Field Summary
 
Fields inherited from interface nz.org.venice.chart.graph.Graph
TOOL_TIP_BUFFER
 
Constructor Summary
KDGraph(GraphSource low, GraphSource high, GraphSource close)
           
KDGraph(GraphSource low, GraphSource high, GraphSource close, java.util.HashMap settings)
           
 
Method Summary
 void createKDGraph(Graphable lowGraph, Graphable highGraph, Graphable closeGraph, int period, int ksmooth, int dsmooth)
           
 double[] getAcceptableMajorDeltas()
          Return an array of acceptable major deltas for the vertical axis.
 double[] getAcceptableMinorDeltas()
          Return an array of acceptable minor deltas for the vertical axis.
 java.lang.Comparable getEndX()
          Get the last X value that this graph will draw.
 double getHighestY(java.util.List x)
          Return the highest Y value in the given X range.
 double getLowestY(java.util.List x)
          Return the loweset Y value in the given X range.
 java.lang.String getName()
          Return the name of this graph.
 java.lang.String getSourceName()
          Return the name of the source data that we are graphing, e.g.
 int getSourceType()
          Return the type of the source data that we are graphing, e.g.
 java.lang.Comparable getStartX()
          Get the first X value that this graph will draw.
 java.lang.String getToolTipText(java.lang.Comparable x)
           
 java.lang.String getToolTipText(java.lang.Comparable x, int y, int yoffset, double verticalScale, double bottomLineValue)
          Get the tool tip text for the given X value and y coordinate.
 GraphUI getUI(java.util.HashMap settings)
          Returns the graph's user interface.
 java.util.Set getXRange()
          Get all X values that this graph will draw.
 java.lang.String getYLabel(double value)
          Convert the Y value to a label to be displayed in the vertical axis.
 boolean isPrimary()
          Return whether the graph is a primary graph.
 void render(java.awt.Graphics g, java.awt.Color colour, int xoffset, int yoffset, double horizontalScale, double verticalScale, double topLineValue, double bottomLineValue, java.util.List xRange, boolean vertOrientation)
          Draw the graph.
 void setSettings(java.util.HashMap settings)
          Set the graph's user definable settings.
 
Methods inherited from class nz.org.venice.chart.graph.AbstractGraph
dataAvailable, getSettings, getSource, getY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KDGraph

public KDGraph(GraphSource low,
               GraphSource high,
               GraphSource close)

KDGraph

public KDGraph(GraphSource low,
               GraphSource high,
               GraphSource close,
               java.util.HashMap settings)
Method Detail

render

public void render(java.awt.Graphics g,
                   java.awt.Color colour,
                   int xoffset,
                   int yoffset,
                   double horizontalScale,
                   double verticalScale,
                   double topLineValue,
                   double bottomLineValue,
                   java.util.List xRange,
                   boolean vertOrientation)
Description copied from interface: Graph
Draw the graph.

Parameters:
g - the Graphics object to render to
colour - the colour the graph should be rendered in; override this if the graph should be drawn in a certain colour - such as a Moving Average graph
xoffset - the x offset in the graphics object where the graph starts
yoffset - the y offset in the graphics object where the graph starts
horizontalScale - horizontal scale factor; use this to convert between X value in the xRange to a cartesian coordinate x
verticalScale - vertical scale factor; use this to convert between Y value to a cartesian coordinate y
topLineValue - the Y value of the lowest line in the graph
bottomLineValue - the Y value of the lowest line in the graph
xRange - a List of Comparable that contain the X values to plot
vertOrientation - true if increasing y values mean decreasing Y values

createKDGraph

public void createKDGraph(Graphable lowGraph,
                          Graphable highGraph,
                          Graphable closeGraph,
                          int period,
                          int ksmooth,
                          int dsmooth)

getSourceName

public java.lang.String getSourceName()
Description copied from class: AbstractGraph
Return the name of the source data that we are graphing, e.g. CBA.

Specified by:
getSourceName in interface Graph
Overrides:
getSourceName in class AbstractGraph
Returns:
the name of the source

getSourceType

public int getSourceType()
Description copied from class: AbstractGraph
Return the type of the source data that we are graphing, e.g. Portfolio.

Specified by:
getSourceType in interface Graph
Overrides:
getSourceType in class AbstractGraph
Returns:
the name of the source

getStartX

public java.lang.Comparable getStartX()
Description copied from class: AbstractGraph
Get the first X value that this graph will draw.

Specified by:
getStartX in interface Graph
Overrides:
getStartX in class AbstractGraph
Returns:
X value of the first x coordinate in the default GraphSource's Graphable

getEndX

public java.lang.Comparable getEndX()
Description copied from class: AbstractGraph
Get the last X value that this graph will draw.

Specified by:
getEndX in interface Graph
Overrides:
getEndX in class AbstractGraph
Returns:
X value of the last x coordinate in the default GraphSource's Graphable

getXRange

public java.util.Set getXRange()
Description copied from class: AbstractGraph
Get all X values that this graph will draw.

Specified by:
getXRange in interface Graph
Overrides:
getXRange in class AbstractGraph
Returns:
X values in the default GraphSource's Graphable

getAcceptableMajorDeltas

public double[] getAcceptableMajorDeltas()
Description copied from class: AbstractGraph
Return an array of acceptable major deltas for the vertical axis.

Specified by:
getAcceptableMajorDeltas in interface Graph
Overrides:
getAcceptableMajorDeltas in class AbstractGraph
Returns:
an array of doubles representing the minor deltas of the default GraphSource

getAcceptableMinorDeltas

public double[] getAcceptableMinorDeltas()
Description copied from class: AbstractGraph
Return an array of acceptable minor deltas for the vertical axis.

Specified by:
getAcceptableMinorDeltas in interface Graph
Overrides:
getAcceptableMinorDeltas in class AbstractGraph
Returns:
an array of doubles representing the minor deltas of the default GraphSource
See Also:
Graph.getAcceptableMajorDeltas()

getHighestY

public double getHighestY(java.util.List x)
Description copied from class: AbstractGraph
Return the highest Y value in the given X range.

Specified by:
getHighestY in interface Graph
Overrides:
getHighestY in class AbstractGraph
Parameters:
x - range of X values
Returns:
the highest Y value of the default GraphSource

getLowestY

public double getLowestY(java.util.List x)
Description copied from class: AbstractGraph
Return the loweset Y value in the given X range.

Specified by:
getLowestY in interface Graph
Overrides:
getLowestY in class AbstractGraph
Parameters:
x - range of X values
Returns:
the lowest Y value of the default GraphSource

getYLabel

public java.lang.String getYLabel(double value)
Description copied from class: AbstractGraph
Convert the Y value to a label to be displayed in the vertical axis.

Specified by:
getYLabel in interface Graph
Overrides:
getYLabel in class AbstractGraph
Parameters:
value - y value
Returns:
the Y label text that the default GraphSource would display

setSettings

public void setSettings(java.util.HashMap settings)
Description copied from class: AbstractGraph
Set the graph's user definable settings.

Specified by:
setSettings in interface Graph
Overrides:
setSettings in class AbstractGraph
Parameters:
settings - the new settings

getName

public java.lang.String getName()
Return the name of this graph.

Returns:

isPrimary

public boolean isPrimary()
Description copied from interface: Graph
Return whether the graph is a primary graph. Primary graphs will appear together in the top chart. Secondary graphs appear in their own charts which are added below. The day close graph is primary; while the day close graph is secondary.

Returns:
true if the graph is a primary graph

getToolTipText

public java.lang.String getToolTipText(java.lang.Comparable x,
                                       int y,
                                       int yoffset,
                                       double verticalScale,
                                       double bottomLineValue)
Description copied from class: AbstractGraph
Get the tool tip text for the given X value and y coordinate.

Specified by:
getToolTipText in interface Graph
Overrides:
getToolTipText in class AbstractGraph
Parameters:
x - the X value
y - the y coordinate
yoffset - y offset from top of graph
verticalScale - vertical scale factor
bottomLineValue - the Y value of the lowest line in the graph
Returns:
the tool tip text for the default GraphSource

getToolTipText

public java.lang.String getToolTipText(java.lang.Comparable x)

getUI

public GraphUI getUI(java.util.HashMap settings)
Description copied from class: AbstractGraph
Returns the graph's user interface. The default action is to return null which indicates that the graph does not have a user interface. If the graph does have a user interface then it should override this method.

Specified by:
getUI in interface Graph
Overrides:
getUI in class AbstractGraph
Parameters:
settings - initial settings (ignored)
Returns:
null

Venice 0.751beta