Venice 0.751beta

nz.org.venice.chart
Class BasicChartUI

java.lang.Object
  extended byjavax.swing.plaf.ComponentUI
      extended bynz.org.venice.chart.BasicChartUI
All Implemented Interfaces:
java.awt.image.ImageObserver

public class BasicChartUI
extends javax.swing.plaf.ComponentUI
implements java.awt.image.ImageObserver

Chart Implementation.


Field Summary
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
BasicChartUI()
           
 
Method Summary
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
           
static java.awt.Color getComplementaryColour(java.awt.Color colour)
          Given a colour, return it's colour wheel complement so that it generates a useful contrast.
 double getDifference(Chart chart, Coordinate c, Coordinate start, Coordinate end)
           
 double getDifference(Chart chart, java.lang.Integer x, java.lang.Integer y, Coordinate start, Coordinate end)
           
 java.awt.Color getGraphColour(Graph graph, Chart chart)
          Return the colour we will draw the given graph.
 java.awt.image.BufferedImage getImage()
           
protected  int getLevelAtPoint(int yCoordinate)
          Return which graph level contains the given y coordinate.
static int getMinimumHeight(Chart chart)
          Return the minimum height needed by this component.
static int getMinimumWidth(Chart chart)
          Return the minimum width needed by this component.
 Coordinate getMoved(Chart chart, java.lang.Integer x, java.lang.Integer y, Coordinate start, Coordinate end)
           
 java.lang.String getToolTipText(Chart chart, int xCoordinate, int yCoordinate)
          Return the tool tip text for the given x, y coordinates.
 java.lang.Comparable getXAtPoint(Chart chart, int xCoordinate)
          Return the X value at the given x coordinate.
 java.lang.Double getYAtPoint(Chart chart, int yCoordinate)
          Return the Y value at the given x coordinate.
 boolean imageUpdate(java.awt.Image image, int infofloags, int x, int y, int width, int height)
           
 boolean intersect(Chart chart, Coordinate c1, Coordinate c2, int delta)
           
static boolean isLightColour(java.awt.Color colour)
           
 void paint(java.awt.Graphics g, javax.swing.JComponent c)
          Paint the component.
 void resetBuffer()
          Reset the double buffer and force the chart to redraw.
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize, installUI, uninstallUI, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicChartUI

public BasicChartUI()
Method Detail

getMinimumWidth

public static int getMinimumWidth(Chart chart)
Return the minimum width needed by this component.

Parameters:
chart - the chart component

getMinimumHeight

public static int getMinimumHeight(Chart chart)
Return the minimum height needed by this component.

Parameters:
chart - the chart component

createUI

public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)

getXAtPoint

public java.lang.Comparable getXAtPoint(Chart chart,
                                        int xCoordinate)
Return the X value at the given x coordinate.

Parameters:
chart - the chart component
xCoordinate - an x coordinate on the screen
Returns:
the X value at the x coordinate

getYAtPoint

public java.lang.Double getYAtPoint(Chart chart,
                                    int yCoordinate)
Return the Y value at the given x coordinate.

Parameters:
chart - the chart component
yCoordinate - an y coordinate on the screen
Returns:
the Y value at the y coordinate

getLevelAtPoint

protected int getLevelAtPoint(int yCoordinate)
Return which graph level contains the given y coordinate.

Parameters:
yCoordinate - the y coordinate to query
Returns:
the level which contains the y coordinate or 0 if none do

getToolTipText

public java.lang.String getToolTipText(Chart chart,
                                       int xCoordinate,
                                       int yCoordinate)
Return the tool tip text for the given x, y coordinates.

Parameters:
chart - the chart component
xCoordinate - the x coordinate
yCoordinate - the y coordinate

paint

public void paint(java.awt.Graphics g,
                  javax.swing.JComponent c)
Paint the component.

Parameters:
g - the graphics to paint to
c - the chart component

getImage

public java.awt.image.BufferedImage getImage()

getDifference

public double getDifference(Chart chart,
                            java.lang.Integer x,
                            java.lang.Integer y,
                            Coordinate start,
                            Coordinate end)

getDifference

public double getDifference(Chart chart,
                            Coordinate c,
                            Coordinate start,
                            Coordinate end)

getMoved

public Coordinate getMoved(Chart chart,
                           java.lang.Integer x,
                           java.lang.Integer y,
                           Coordinate start,
                           Coordinate end)

intersect

public boolean intersect(Chart chart,
                         Coordinate c1,
                         Coordinate c2,
                         int delta)

resetBuffer

public void resetBuffer()
Reset the double buffer and force the chart to redraw.


imageUpdate

public boolean imageUpdate(java.awt.Image image,
                           int infofloags,
                           int x,
                           int y,
                           int width,
                           int height)
Specified by:
imageUpdate in interface java.awt.image.ImageObserver

getGraphColour

public java.awt.Color getGraphColour(Graph graph,
                                     Chart chart)
Return the colour we will draw the given graph. Note that the graph may choose to override this colour.

Parameters:
graph - the graph to query
chart - the chart component
Returns:
the colour the graph might be

getComplementaryColour

public static java.awt.Color getComplementaryColour(java.awt.Color colour)
Given a colour, return it's colour wheel complement so that it generates a useful contrast. (e.g Given white return black, blue return orange etc)

Parameters:
colour - A colour
Returns:
it's complement

isLightColour

public static boolean isLightColour(java.awt.Color colour)

Venice 0.751beta