ElVis Java Interface

sv.graph
Class Fx

java.lang.Object
  extended bysv.graph.Fx
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Contour, DataTable, Fxi, Surface

public class Fx
extends java.lang.Object
implements java.io.Serializable

The Fx graph class contains all the elements of a graph. A graph contains 1 or more datasets, index label, plot area, axes, legend, and textual labels. The datasets are displayed simultaneously. Use the Fxt class for time indexed datasets. The Fxi class is for datasets indexed by a quantity other than time.

See Also:
Serialized Form

Field Summary
static int ALGEBRAIC
          Axis Number is drawn as a single quantity
static int AUTOMATIC
          Axis Number style is computed based on data
static int LINEAR
          Values are linearly spaced
static int LOGARITHMIC
          Values are logarithmically spaced
static int SCIENTIFIC
          Axis Number is drawn with mantissa and exponent
 int shot
           
 java.lang.String units
           
 
Constructor Summary
Fx(java.lang.String graphName)
          Create a graph of datasets.
 
Method Summary
 void addDataset(Data1D data1D)
          Add a dataset to the graph.
 void addLabel(java.lang.String text, float x, float y, java.lang.String fontName, java.lang.String fontStyle, float height, java.awt.Color color, float rotation)
          Add a label to the graph.
 void addLegendTitle(java.lang.String title)
          Add a line of text to the legend.
 Data1D findClosestDataset(double[] xy)
           
 java.util.List getLegendTitle()
          Get the list of legend strings used in the title.
 GLabel getTitleLabel()
          Get the title label.
 GLabel getXLabel()
          Get the X axis label.
 int getXNumberStyle()
          Get the numbering style of the X axis.
 float[] getXRange()
          Get the X axis range.
 GLabel getYLabel()
          Get the Y axis label.
 int getYNumberStyle()
          Get the numbering style of the Y axis.
 float[] getYRange()
          Get the Y axis range.
 boolean isLegend()
          Return true if the legend will be shown
 boolean isShowLines()
          Return true if lines between the markers will be shown
 boolean isShowMarkers()
          Return true if the markers will be shown
 boolean isXGridlines()
          Return true if the X axis gridlines should be drawn
 boolean isYGridlines()
          Return true if the Y axis gridlines should be drawn
 void setLegendTitle(java.lang.String title)
          Set the legend text.
 void setLocation(int r, int c)
          Set the grid location of the graph.
 void setPlotOrigin(float x, float y)
          Set the location of the plot area.
 void setPlotSize(float width, float height)
          Set the size of the plot area.
 void setScalable(boolean scaleX, boolean scaleY)
          Control scaling the axes.
 void setTitleLabel(GLabel label)
          Set the title label.
 void setTitleLabel(java.lang.String text)
          Set the title label.
 void setXLabel(GLabel label)
          Set the X axis label.
 void setXLabel(java.lang.String text)
          Set the X axis label.
 void setXNumberStyle(int style)
          Set the numbering style of the X axis instead of having it computed based on the size of the data.
 void setXRange(float min, float max)
          Set the X axis range for the data.
 void setYLabel(GLabel label)
          Set the Y axis label.
 void setYLabel(java.lang.String text)
          Set the Y axis label.
 void setYLabel(java.lang.String text, float rotation, float x, float y)
          Set the Y axis label, rotation, and location.
 void setYNumberStyle(int style)
          Set the numbering style of the Y axis instead of having it computed based on the size of the data.
 void setYRange(float min, float max)
          Set the Y axis range for the data.
 void showGridlines(boolean showX, boolean showY)
          Control drawing the grid lines.
 void showLegend(boolean show)
          Control drawing the legend.
 void showLines(boolean show)
          Control drawing of dataset lines.
 void showMarkers(boolean show)
          Control drawing of markers at data points.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

shot

public int shot

units

public java.lang.String units

ALGEBRAIC

public static final int ALGEBRAIC
Axis Number is drawn as a single quantity

See Also:
Constant Field Values

SCIENTIFIC

public static final int SCIENTIFIC
Axis Number is drawn with mantissa and exponent

See Also:
Constant Field Values

AUTOMATIC

public static final int AUTOMATIC
Axis Number style is computed based on data

See Also:
Constant Field Values

LINEAR

public static final int LINEAR
Values are linearly spaced

See Also:
Constant Field Values

LOGARITHMIC

public static final int LOGARITHMIC
Values are logarithmically spaced

See Also:
Constant Field Values
Constructor Detail

Fx

public Fx(java.lang.String graphName)
Create a graph of datasets.

Parameters:
graphName - - The name of the graph. The name will be drawn as the title.
Method Detail

addDataset

public void addDataset(Data1D data1D)
Add a dataset to the graph.

Parameters:
data1D - - The dataset to add to the graph.

addLabel

public void addLabel(java.lang.String text,
                     float x,
                     float y,
                     java.lang.String fontName,
                     java.lang.String fontStyle,
                     float height,
                     java.awt.Color color,
                     float rotation)
Add a label to the graph.

Parameters:
text - - The text string to display.
x - - The x location of the lower left corner of the label.
y - - The y location of the lower left corner of the label.
fontName - - The name of the font for drawing the label.
fontStyle - - The style of the font for drawing the label.
height - - The height of the label, 0. - 1.
color - - The color for drawing the label.
rotation - - Horizontal or vertical.

setLocation

public void setLocation(int r,
                        int c)
Set the grid location of the graph.

Parameters:
r - - The row in the ScopePanel of this graph.
c - - The column in the ScopePanel of this graph.

setPlotOrigin

public void setPlotOrigin(float x,
                          float y)
Set the location of the plot area.

Parameters:
x - - The x location of the lower left corner of the plot area
y - - The y location of the lower left corner of the plot area

setPlotSize

public void setPlotSize(float width,
                        float height)
Set the size of the plot area.

Parameters:
width - - The width of the plot area.
height - - The height of the plot area.

setXLabel

public void setXLabel(GLabel label)
Set the X axis label.

Parameters:
label - - The label to draw along the X axis.

setYLabel

public void setYLabel(GLabel label)
Set the Y axis label.

Parameters:
label - - The label to draw along the Y axis.

setTitleLabel

public void setTitleLabel(GLabel label)
Set the title label.

Parameters:
label - - The label to draw as the title of the graph.

getTitleLabel

public GLabel getTitleLabel()
Get the title label.

Returns:
title label

getXLabel

public GLabel getXLabel()
Get the X axis label.

Returns:
label - The GLabel of the X axis.

getYLabel

public GLabel getYLabel()
Get the Y axis label.

Returns:
label - The GLabel of the Y axis.

setXLabel

public void setXLabel(java.lang.String text)
Set the X axis label.

Parameters:
text - - The text to draw along the X axis.

setYLabel

public void setYLabel(java.lang.String text)
Set the Y axis label.

Parameters:
text - - The text to draw along the Y axis.

setYLabel

public void setYLabel(java.lang.String text,
                      float rotation,
                      float x,
                      float y)
Set the Y axis label, rotation, and location. The exponent will appear in the label.

Parameters:
text - - The text to draw along the Y axis.
rotation - - The rotation applied to the label.
x - - The x location of the origin of the label.
y - - The y location of the origin of the label.

getXRange

public float[] getXRange()
Get the X axis range.

Returns:
range - The range of the X axis, returned in a float [2].

getYRange

public float[] getYRange()
Get the Y axis range.

Returns:
range - The range of the Y axis, returned in a float [2].

setXRange

public void setXRange(float min,
                      float max)
Set the X axis range for the data.

Parameters:
min - - The start of the range.
max - - The end of the range.

setYRange

public void setYRange(float min,
                      float max)
Set the Y axis range for the data.

Parameters:
min - - The start of the range.
max - - The end of the range.

getXNumberStyle

public int getXNumberStyle()
Get the numbering style of the X axis.

Returns:
style - The numbering style of the X axis.

getYNumberStyle

public int getYNumberStyle()
Get the numbering style of the Y axis.

Returns:
style - The numbering style of the Y axis.

setXNumberStyle

public void setXNumberStyle(int style)
Set the numbering style of the X axis instead of having it computed based on the size of the data.

Parameters:
style - - The numbering style of the X axis.

setYNumberStyle

public void setYNumberStyle(int style)
Set the numbering style of the Y axis instead of having it computed based on the size of the data.

Parameters:
style - - The numbering style of the X axis.

setTitleLabel

public void setTitleLabel(java.lang.String text)
Set the title label.

Parameters:
text - - The text to draw as the title of the graph.

showLegend

public void showLegend(boolean show)
Control drawing the legend.

Parameters:
show - - true: draw the legend; false: hide the legend.

isLegend

public boolean isLegend()
Return true if the legend will be shown

Returns:
true for a legend

addLegendTitle

public void addLegendTitle(java.lang.String title)
Add a line of text to the legend. More than 1 line can be added.

Parameters:
title - - A line of text to draw in the legend.

setLegendTitle

public void setLegendTitle(java.lang.String title)
Set the legend text.

Parameters:
title - - A line of text to draw in the legend.

getLegendTitle

public java.util.List getLegendTitle()
Get the list of legend strings used in the title.

Returns:
list of legend strings

showGridlines

public void showGridlines(boolean showX,
                          boolean showY)
Control drawing the grid lines.

Parameters:
showX - - true: draw the grid lines at major ticks along the X axis; false: hide the grid lines along the X axis (default).
showY - - true: draw the grid lines at major ticks along the Y axis; false: hide the grid lines along the Y axis (default).

isXGridlines

public boolean isXGridlines()
Return true if the X axis gridlines should be drawn

Returns:
true for X axis grid lines

isYGridlines

public boolean isYGridlines()
Return true if the Y axis gridlines should be drawn

Returns:
true for Y axis grid lines

setScalable

public void setScalable(boolean scaleX,
                        boolean scaleY)
Control scaling the axes.

Parameters:
scaleX - - true: enable scaling the X axis (default); false: disable scaling the X axis.
scaleY - - true: enable scaling the Y axis (default); false: disable scaling the Y axis.

showLines

public void showLines(boolean show)
Control drawing of dataset lines.

Parameters:
show - - true: draw the lines to connect the data points (default); false: hide the lines.

showMarkers

public void showMarkers(boolean show)
Control drawing of markers at data points.

Parameters:
show - - true: draw a marker at each data point; false: hide the markers (default).

isShowLines

public boolean isShowLines()
Return true if lines between the markers will be shown

Returns:
true for lines

isShowMarkers

public boolean isShowMarkers()
Return true if the markers will be shown

Returns:
true for markers

findClosestDataset

public Data1D findClosestDataset(double[] xy)

ElVis Java Interface