|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.slamd.stat.StatGrapher
This class provides a mechanism for generating graphs based on sets of data obtained during job processing. Note that a maximum of 30 data sets can be represented on a single graph.
| Field Summary | |
static java.awt.Color[] |
COLORS
The set of colors that will be used when producing the graphs. |
| Constructor Summary | |
StatGrapher(int width,
int height,
java.lang.String graphTitle)
Creates a new stat grapher with the specified information. |
|
| Method Summary | |
void |
addDataSet(double[] dataValues,
int collectionInterval,
java.lang.String dataSetLabel)
Adds the specified data to the set of information that will be graphed. |
void |
addStackedBarGraphDataSet(java.lang.String dataSetName,
java.lang.String[] categoryNames,
double[] categoryAverages)
Adds the specified data for use in generating a stacked bar graph. |
double |
chooseVerticalLabelIncrement(int numVerticalLabels)
This method attempts to determine an appropriate increment between labels on the vertical axis. |
double |
chooseVerticalLabelIncrement(int numVerticalLabels,
double graphSpan)
This method attempts to determine an appropriate increment between labels on the vertical axis. |
java.awt.image.BufferedImage |
generateBarGraph()
Generates a bar graph based on the information that has been provided. |
java.awt.image.BufferedImage |
generateDualLineGraph(java.lang.String label1,
java.lang.String caption1,
double[] values1,
int interval1,
java.lang.String label2,
java.lang.String caption2,
double[] values2,
int interval2,
boolean useSameAxis,
java.lang.String horizontalAxisCaption,
java.lang.String[] jobIDs)
Generates a line graph that can be used to overlay data for two different statistics. |
java.awt.image.BufferedImage |
generateLineGraph()
Generates a line graph based on the information that has been provided. |
java.awt.image.BufferedImage |
generatePieGraph(java.lang.String[] categoryNames,
int[] occurrencesPerCategory)
Generates a pie graph based on the information that has been provided. |
java.awt.image.BufferedImage |
generateStackedAreaGraph()
Generates a stacked area graph based on the information that has been provided. |
java.awt.image.BufferedImage |
generateStackedBarGraph()
Generates a stacked bar graph based on the information that has been provided. |
java.awt.image.BufferedImage |
generateXYLineGraph(double[][] xValues,
double[][] yValues,
java.lang.String[] labels,
boolean drawPoints,
boolean baseXAtZero)
Generates a line graph by plotting the provided data and connecting those points with lines. |
int |
graphXToValueX(int graphX)
Converts the provided X coordinate to the value along the horizontal axis to which it corresponds. |
double |
graphYToValueY(int graphY)
Converts the provided Y coordinate to the value along the vertical axis to which it corresponds. |
double |
graphYToValueY(int graphY,
double graphMin,
double graphSpan)
Converts the provided Y coordinate to the value along the specific vertical axis to which it corresponds. |
void |
setBaseAtZero(boolean baseAtZero)
Indicates whether the lower bound of the graph should be at zero or should be dynamically calculated based on information in the data set. |
void |
setFlatBetweenPoints(boolean flatBetweenPoints)
Indicates whether line graphs should have a flat horizontal line followed by a vertical line between data points, or if the points should be directly connected. |
void |
setHorizontalAxisTitle(java.lang.String horizontalAxisTitle)
Specifies the title to be used for the horizontal axis of the generated graph. |
void |
setIgnoreZeroValues(boolean ignoreZeroValues)
Indicates whether the graph should ignore data intervals where the value for that interval is zero. |
void |
setIncludeAverage(boolean includeAverage)
Indicates whether the graph should include a line that indicates the average of all values provided. |
void |
setIncludeHorizontalGrid(boolean includeHorizontalGrid)
Indicates whether the generated graph should include horizontal grid lines. |
void |
setIncludeLegend(boolean includeLegend,
java.lang.String legendTitle)
Indicates whether the generated graph should include a legend. |
void |
setIncludeRegression(boolean includeRegression)
Indicates whether the graph should include a trend line based on a linear regression calculation of all the values. |
void |
setIncludeVerticalGrid(boolean includeVerticalGrid)
Indicates whether the generated graph should include horizontal grid lines. |
void |
setShowPercentages(boolean showPercentages)
Indicates whether the generated pie graph should show the percentages for each category. |
void |
setStartSeconds(int startSeconds)
Specifies the number of seconds into the test that the graph starts. |
void |
setVerticalAxisTitle(java.lang.String verticalAxisTitle)
Specifies the title to be used for the verticial axis of the generated graph. |
int |
valueXToGraphX(double xValue,
double xMax)
Converts the provided value along the horizontal axis to an X coordinate in the graph image. |
int |
valueXToGraphX(int valueX)
Converts the provided value along the horizontal axis to an X coordinate in the graph image. |
int |
valueYToGraphY(double valueY)
Converts the provided value along the vertical axis to a Y oordinate in the graph image. |
int |
valueYToGraphY(double valueY,
double graphMin,
double graphSpan)
Converts the provided value along the vertical axis to a Y oordinate in the graph image. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.awt.Color[] COLORS
| Constructor Detail |
public StatGrapher(int width,
int height,
java.lang.String graphTitle)
width - The width of the drawable area to create.height - The height of the drawable area to create.graphTitle - The caption to include at the top of the graph.| Method Detail |
public void addDataSet(double[] dataValues,
int collectionInterval,
java.lang.String dataSetLabel)
dataValues - The of data to include in the set of
information that will be graphed.collectionInterval - The collection interval associated with this
data set.dataSetLabel - The label to use for this data set in the
legend.
public void addStackedBarGraphDataSet(java.lang.String dataSetName,
java.lang.String[] categoryNames,
double[] categoryAverages)
dataSetName - The overall name of the data set.categoryNames - The names of the categories in the data set.categoryAverages - The average values for each category of the data
set.public void setFlatBetweenPoints(boolean flatBetweenPoints)
flatBetweenPoints - Indicates whether line graphs should have a flat
horizontal line followed by a vertical line
between data points.public void setIgnoreZeroValues(boolean ignoreZeroValues)
addDataSet are made.
ignoreZeroValues - Indicates whether the graph should ignore data
intervals where the value for that interval is
zero.public void setIncludeAverage(boolean includeAverage)
includeAverage - Indicates whether the graph should include a line
that indicates the average of all values provided.public void setIncludeRegression(boolean includeRegression)
includeRegression - Indicates whether the graph should include a
regression line.public void setBaseAtZero(boolean baseAtZero)
baseAtZero - Indicates whether the lower bound of the graph should
be at zero or should be dynamically calculated based on
information in the data set.
public void setIncludeLegend(boolean includeLegend,
java.lang.String legendTitle)
includeLegend - Indicates whether the generated graph should
include a legend.legendTitle - The title to use for the legend if it is included.public void setIncludeHorizontalGrid(boolean includeHorizontalGrid)
includeHorizontalGrid - Indicates whether the generated graph should
include horizontal grid lines.public void setIncludeVerticalGrid(boolean includeVerticalGrid)
includeVerticalGrid - Indicates whether the generated graph should
include vertical grid lines.public void setShowPercentages(boolean showPercentages)
showPercentages - Indicates whether the generated pie graph should
show the percentages for each category.public void setHorizontalAxisTitle(java.lang.String horizontalAxisTitle)
horizontalAxisTitle - The title to be used for the horizontal axis
of the generated graph.public void setVerticalAxisTitle(java.lang.String verticalAxisTitle)
verticalAxisTitle - The title to be used for the vertical axis of
the generated graph.public void setStartSeconds(int startSeconds)
startSeconds - The number of seconds into the test that the graph
starts.
public java.awt.image.BufferedImage generatePieGraph(java.lang.String[] categoryNames,
int[] occurrencesPerCategory)
categoryNames - The names of the categories of each of the
elements.occurrencesPerCategory - The number of occurrences of the tracked
event in each category.
public java.awt.image.BufferedImage generateLineGraph()
public java.awt.image.BufferedImage generateXYLineGraph(double[][] xValues,
double[][] yValues,
java.lang.String[] labels,
boolean drawPoints,
boolean baseXAtZero)
xValues - The sets of x coordinates for the data to graph.yValues - The sets of y coordinates for the data to graph.labels - The labels to use in the legend.baseXAtZero - Indicates whether to start the x coordinates at zero
or the first x coordinate.
public java.awt.image.BufferedImage generateStackedAreaGraph()
public java.awt.image.BufferedImage generateDualLineGraph(java.lang.String label1,
java.lang.String caption1,
double[] values1,
int interval1,
java.lang.String label2,
java.lang.String caption2,
double[] values2,
int interval2,
boolean useSameAxis,
java.lang.String horizontalAxisCaption,
java.lang.String[] jobIDs)
label1 - The label for the first statistic.caption1 - The caption that should be used for the
vertical axis for the first statistic.values1 - The actual data values for the first
statistic.interval1 - The collection interval used when gathering
the data for the first statistic.label2 - The label for the second statistic.caption2 - The caption that should be used for the
vertical axis for the second statistic.values2 - The actual data values for the second
statistic.interval2 - The collection interval used when gathering
the data for the second statistic.useSameAxis - Indicates whether both statistics should be
graphed along the same axis.horizontalAxisCaption - The caption that should be displayed along
the horizontal axis for this graph.jobIDs - The set of job IDs that correspond to each
data point in each value set. This should
be null unless each data point
represents a different job.
public java.awt.image.BufferedImage generateBarGraph()
public java.awt.image.BufferedImage generateStackedBarGraph()
public double chooseVerticalLabelIncrement(int numVerticalLabels)
numVerticalLabels - The maximum number of labels that may be used
along the vertical axis. The vertical span of
the graph divided by the returned increment may
not exceed this value.
public double chooseVerticalLabelIncrement(int numVerticalLabels,
double graphSpan)
numVerticalLabels - The maximum number of labels that may be used
along the vertical axis. The vertical span of
the graph divided by the returned increment may
not exceed this value.graphSpan - The span of values covered along the vertical
axis.
public int graphXToValueX(int graphX)
graphX - The X coordinate of the point in the image.
public int valueXToGraphX(int valueX)
valueX - The value along the horizontal axis for which to retrieve
the X coordinate.
public int valueXToGraphX(double xValue,
double xMax)
xValue - The value along the horizontal axis for which to retrieve
the X coordinate.xMax - The maximum x value of any data point to be graphed.
public double graphYToValueY(int graphY)
graphY - The Y coordinate of the point in the image.
public double graphYToValueY(int graphY,
double graphMin,
double graphSpan)
graphY - The Y coordinate of the point in the image.graphMin - The minimum value for the vertical axis.graphSpan - The span for the vertical axis.
public int valueYToGraphY(double valueY)
valueY - The value along the vertical axis for which to retrieve
the Y coordinate.
public int valueYToGraphY(double valueY,
double graphMin,
double graphSpan)
valueY - The value along the vertical axis for which to retrieve
the Y coordinate.graphMin - The minimum value for the vertical axis.graphSpan - The span for the vertical axis.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||