Venice 0.751beta

nz.org.venice.chart.source
Class PortfolioGraphSource

java.lang.Object
  extended bynz.org.venice.chart.source.PortfolioGraphSource
All Implemented Interfaces:
GraphSource

public class PortfolioGraphSource
extends java.lang.Object
implements GraphSource

Provides a Portfolio graph source. This class allows portfolios to be graphed.

Author:
Andrew Leppard

Field Summary
static int CASH_VALUE
          Graph the portfolio cash value
static int MARKET_VALUE
          Graph the market value (day close) of the portfolio
static int RETURN_VALUE
          Graph the portfolio showing the return value
static int SHARE_VALUE
          Graph the portfolio share value
static int STOCKS_HELD
          Graph the number of stocks held
 
Fields inherited from interface nz.org.venice.chart.source.GraphSource
ADVANCEDECLINE, INDEX, PORTFOLIO, SYMBOL
 
Constructor Summary
PortfolioGraphSource(Portfolio portfolio, EODQuoteBundle quoteBundle, int mode)
          Create a graph source to graph the value of a portfolio.
PortfolioGraphSource(Portfolio portfolio, EODQuoteBundle quoteBundle, java.lang.String accountName)
          Create a graph source to graph the value of a single account in the portfolio.
 
Method Summary
 void adjust(int type, double adjustValue, java.lang.Comparable start, boolean direction)
          Apply an adjustment to the data.
 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.
 Graphable getGraphable()
          Get the actual graphable data.
 java.lang.String getName()
          Return the name of the data.
 java.lang.String getToolTipText(java.lang.Comparable x)
          Get the tool tip text for the given X value
 int getType()
          Return the type of the data.
 java.lang.String getYLabel(double value)
          Convert the Y value to a label to be displayed in the vertical axis.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MARKET_VALUE

public static final int MARKET_VALUE
Graph the market value (day close) of the portfolio

See Also:
Constant Field Values

RETURN_VALUE

public static final int RETURN_VALUE
Graph the portfolio showing the return value

See Also:
Constant Field Values

CASH_VALUE

public static final int CASH_VALUE
Graph the portfolio cash value

See Also:
Constant Field Values

SHARE_VALUE

public static final int SHARE_VALUE
Graph the portfolio share value

See Also:
Constant Field Values

STOCKS_HELD

public static final int STOCKS_HELD
Graph the number of stocks held

See Also:
Constant Field Values
Constructor Detail

PortfolioGraphSource

public PortfolioGraphSource(Portfolio portfolio,
                            EODQuoteBundle quoteBundle,
                            int mode)
Create a graph source to graph the value of a portfolio. This constructor allows you to graph the market value of the portfolio, the profit/loss made by the portfolio, and the value of the portfolio's cash or share holdings.

Parameters:
portfolio - the portfolio to graph
quoteBundle - quote bundle containing all the necessary quotes to calculate the portfolio value for every day
mode - MARKET_VALUE for the total market value of the portfolio; RETURN_VALUE for the return moade; CASH_VALUE for the cash value of the portfolio; STOCKS_HELD for the number of stocks held in the portfolio; or SHARE_VALUE for the share value of the portfolio.

PortfolioGraphSource

public PortfolioGraphSource(Portfolio portfolio,
                            EODQuoteBundle quoteBundle,
                            java.lang.String accountName)
Create a graph source to graph the value of a single account in the portfolio.

Parameters:
portfolio - the portfolio to graph
quoteBundle - quote bundle containing all the necessary quotes to calculate the portfolio value for every day
accountName - name of account in portfolio to graph.
Method Detail

getGraphable

public Graphable getGraphable()
Description copied from interface: GraphSource
Get the actual graphable data.

Specified by:
getGraphable in interface GraphSource
Returns:
the graphable data

getName

public java.lang.String getName()
Description copied from interface: GraphSource
Return the name of the data.

Specified by:
getName in interface GraphSource
Returns:
the name

getType

public int getType()
Description copied from interface: GraphSource
Return the type of the data.

Specified by:
getType in interface GraphSource
Returns:
the type

getToolTipText

public java.lang.String getToolTipText(java.lang.Comparable x)
Description copied from interface: GraphSource
Get the tool tip text for the given X value

Specified by:
getToolTipText in interface GraphSource
Parameters:
x - the X value
Returns:
the tooltip text

getYLabel

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

Specified by:
getYLabel in interface GraphSource
Parameters:
value - y value
Returns:
the label text

getAcceptableMajorDeltas

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

Specified by:
getAcceptableMajorDeltas in interface GraphSource
Returns:
array of doubles
See Also:
Graph.getAcceptableMajorDeltas()

getAcceptableMinorDeltas

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

Specified by:
getAcceptableMinorDeltas in interface GraphSource
Returns:
array of doubles
See Also:
Graph.getAcceptableMajorDeltas()

adjust

public void adjust(int type,
                   double adjustValue,
                   java.lang.Comparable start,
                   boolean direction)
Description copied from interface: GraphSource
Apply an adjustment to the data.

Specified by:
adjust in interface GraphSource
Parameters:
type - A split or a dividend.
adjustValue - The value applied to each data point from start point.
start - The point in the data from which to start adjusting.
direction - If true, will adjust the data in a positive direction.

Venice 0.751beta