Venice 0.751beta

nz.org.venice.chart.graph
Class LineGraph

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

public class LineGraph
extends AbstractGraph

Simple line graph. This graph is used to draw any kind of line such as day close, day open, day high, day low etc.

Author:
Andrew Leppard

Field Summary
 
Fields inherited from interface nz.org.venice.chart.graph.Graph
TOOL_TIP_BUFFER
 
Constructor Summary
LineGraph(GraphSource source, java.lang.String name, boolean isPrimary)
          Create a new simple line graph.
 
Method Summary
 java.lang.String getName()
          Return the name of this graph.
 java.lang.String getToolTipText(java.lang.Comparable x, int yCoordinate, int yoffset, double verticalScale, double bottomLineValue)
          Get the tool tip text for the given X value and y coordinate.
 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.
 
Methods inherited from class nz.org.venice.chart.graph.AbstractGraph
dataAvailable, getAcceptableMajorDeltas, getAcceptableMinorDeltas, getEndX, getHighestY, getLowestY, getSettings, getSource, getSourceName, getSourceType, getStartX, getUI, getXRange, getY, getYLabel, setSettings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineGraph

public LineGraph(GraphSource source,
                 java.lang.String name,
                 boolean isPrimary)
Create a new simple line graph.

Parameters:
source - the source to render
name - the graph name
isPrimary - is this a primary graph?
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

getToolTipText

public java.lang.String getToolTipText(java.lang.Comparable x,
                                       int yCoordinate,
                                       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
yCoordinate - 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

getName

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

Returns:
the name given to the constructor

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

Venice 0.751beta