AFLPgui
Class BarGraph

java.lang.Object
  |
  +--AFLPgui.Graph
        |
        +--AFLPgui.BarGraph

public class BarGraph
extends Graph

This class will draw a graph given a set of lanes and an area in those lanes. The graph will be a bar graph, with one bar for every lane. The height of the bar will be equal to the height of the heighest peak in the lane in the specified region. (The region is defined by a minimum size in base pairs and a maximum size.) If the lane contains more than one peak, it will be drawn in a color different from those that contain only one peak. The graph can be of any width.

See Also:
Graph

Constructor Summary
BarGraph()
          Create a new BarGraph.
BarGraph(java.awt.Color singlePeak, java.awt.Color multiPeak)
          Create a new BarGraph with the specified colors.
 
Method Summary
 void drawGraph(java.awt.Graphics g, int x, int y, int width, int height, int bottom_border, double scale, double minSize, double maxSize, DataList lanes)
          Draws the graph described in the class description.
protected  double findMax(DataList peakList)
          Finds the maximum height in a list of peaks.
 int getPreferredWidth()
          Give the ideal width for this graph, which is -1.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BarGraph

public BarGraph()
Create a new BarGraph. Lanes with a single peak will be drawn in blue and lanes with multiple peaks wll be black.

BarGraph

public BarGraph(java.awt.Color singlePeak,
                java.awt.Color multiPeak)
Create a new BarGraph with the specified colors.
Parameters:
singlePeak - the color for the bar of a lane with only one peak.
multiPeak - the color for the bar of a lane with multiple peaks.
Method Detail

drawGraph

public void drawGraph(java.awt.Graphics g,
                      int x,
                      int y,
                      int width,
                      int height,
                      int bottom_border,
                      double scale,
                      double minSize,
                      double maxSize,
                      DataList lanes)
Draws the graph described in the class description.
Overrides:
drawGraph in class Graph
Parameters:
g - the graphics to draw on
x - the x coordinate of the upper left corner of the graph area. (The position of the vertical axis)
y - the y coordinate of the upper left corner of the graph
width - the width of the graph area.
height - the height of the graph
scale - the scale of the graph, pixel = intensity*scale
minSize - the minimum size, in bp, that the graph should include
maxSize - the maximum size, in bp, that the graph should include
lanes - the lanes to include in the graph.

getPreferredWidth

public int getPreferredWidth()
Give the ideal width for this graph, which is -1. This is a signal that the graph really doesn't care how wide it is. It will adjust itself automatically. However, if it is to narrow, then the labels for the bars will not be drawn, and it should probably leave at least one pixel per lane.
Overrides:
getPreferredWidth in class Graph
Returns:
the width requested by the graph, which is -1.

findMax

protected double findMax(DataList peakList)
Finds the maximum height in a list of peaks.
Parameters:
peakList - the peaks to find the maximum of.
Returns:
the maximum height from all of the peaks.