Last Updated: 3/4/97
Class NFStripChart

Class NFStripChart

public class NFStripChart extends NFDataChart

Strip chart base class. See NFStripChartApp for parameter interface information.

Instance Variables

Type Name Description Default
Vector bottomLabels Holds the bottom labels new Vector()
Rectangle graphRect chart rectangle less titles/axes null
int initialFill the side chart begins drawing on LEFT
Color labelBackgroundColor color used for dynamic axes null
int maxLookAhead buffer size 100
int nslots number of steps in the X axis 11
Vector topLabels Holds the top labels new Vector()
String undefString undefined data string "-"
Rectangle workRect chart rectangle less titles null

Final Variables

Type Name Description
int LEFT
int RIGHT

Constructors

Methods


NFStripChart (Applet a)
Constructor for NFStripChart class.

NFStripChart (Applet a,
              int x,
              int y,
              int w,
              int h)
Constructor for NFStripChart class.

protected void appendNewData(int dataset,
                             double yvalue) throws Exception
appends the raw data value to the appropriate dataset.

protected void appendNextActiveSlot (NFDataSeries ds,
                                     int dsIndex,
                                     int xvalue,
                                     double yvalue)
Appends another active label for the data set if necessary

protected void appendNextAxisLabel(boolean isTopLabels)
Manages the axis labels for the top and bottom axis. This is a particularly tricky routine since there are several different ways labels can be used.
 	o DYNAMIC feed from the left
 	o DYNAMIC feed from the right
 	o STATIC feed from the left
 	o STATIC feed from the right
 	o Autogenerated labels
 	o Passed in labels
 	o STATIC tics with dynamic data
 	o STATIC tics with static data
To do this, 3 label "queues" are used. The slotLabels queue is only used for STATIC tics and holds a label for each possible slot. The labels queue is what the axis will receive to display and should contain the same number of labels as there are tics. The labelQueue is a list of input labels that have not been displayed yet. The labelQueue will hold labels entered using TopLabels/BottomLabels attributes or labels generated automatically. When a new label is needed, it is pulled from the labelQueue and put into either the slotLabels queue or labels queue.

protected void appendNextSlot()
Extracts a point from each data set and computes its y value.

private void configure(Graphics g,
                       Rectangle workRect)
called if the size of the drawing area changes - recomputes relative placement of axes and the chart.

protected void defineParams ()
Defines strip chart specific parameters

protected void defineStripAxisParams(NFParam p,
                                     String name)
Generic routine to define an stripaxis parameter

void drawAxes(Graphics g,
              boolean resetLabels)
draws the bottom and top axes

protected void drawData(Graphics g)
this method required by NFDataChart (abstract method)

protected void drawDataLite(Graphics g)
this method required by NFDataChart (abstract method)

protected void drawGraph(Graphics g,
                         Rectangle r)
does a complete Strip Chart redraw.

protected void drawGraphLite(Graphics g)
Provides for quick, incremental draws.

private void drawGroupBars (Graphics g,
                            boolean resetLabels)
Draw all bars in groups

private void drawPoints (Graphics g,
                         NFDataSeries ds,
                         int dsIndex,
                         boolean resetLabels)
Draw all of the points and/or lines for the given data set

private void drawPoints (Graphics g,
                         boolean resetLabels)
Draw all data sets. If resetLabels is true, then update the positions of all active labels. Otherwise, simply update the position of the last one drawn (which was probably just added)

private void drawStackedBars (Graphics g,
                              boolean resetLabels)
Draw all bars as a stacked bar

protected double[] getMinMax (NFDataSeries ds,
                              NFAxis axis,
                              double minmax[])
Updates the min/max values for the given data set, along the given axis. This method should be overridden by higher level objects to deal with different data set types.

protected void initStripChart()
initialize axes and grids

protected NFAxis loadAxisParams (String name,
                                 NFAxis axis) throws Exception
Overrides NFDataChart so that the top and bottom axis are loaded using the strip chart definitions

protected synchronized void loadParams () throws Exception
overrides NFDataChart loadParams()

protected NFAxis loadStripAxisParams(NFParam param,
                                     String axisName,
                                     NFAxis axis) throws Exception
Generic routine to define an stripaxis parameter

private void makeNewDataSet(Color c,
                            NFGraphSymbol sym,
                            NFLine line,
                            Color fillColor)
creates a new strip chart data set

private void recomputeData()
Recompute the Y-value screen coordinates for all datasets

protected void setupAxisTics (NFAxis axis,
                              int slotsPerTic,
                              boolean resetLabels)
Setup the axis tic positions, using current dataCount

private void shiftActiveLabelArray()
active labels are stored in a 2 dimensional array to allow for easy shifting to the left as more data is added. The actual objects do not get shifted; only the data.

protected void slotsChanged()
Called when the number of slots or other slot-related parameter changes. Adjusts tic positions and slot xvalues.