|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.openware.loadsim.plotting.BarChart
Create a bar chart for statistics produced by a LoadSim simulation. The resulting chart is saved to a JPEG file and is appropriate for use in a web page. The intent is to facilitate the creation of a web site that contains results and conclusions of a set of load tests.
Basically, the high level view of the bar chart is that you simply pass in 2 arrays. One array contains the labels for each bar and the other contains the values that determine the size of the bar.
This is intended to be a quick and dirty plotting specifically for LoadSim, not a general purpose plotting tool.
Constructor Summary | |
BarChart(java.lang.String[] labels,
java.lang.Double[] values)
|
Method Summary | |
java.io.ByteArrayOutputStream |
getImageBytes()
Get a ByteArrayOutputStream representation
of the image. |
static void |
main(java.lang.String[] args)
Unit test program for the BarChart class. |
void |
renderChart()
Actually render the chart. |
void |
save(java.lang.String fileName)
Save the chart to a JPEG file with the given name. |
void |
setNumDecimalPlaces(int places)
Set the number of decimal places to display on the y-axis (horizontal axis) for labeling the tick marks. |
void |
setTitle(java.lang.String title)
|
void |
setXAxisLegend(java.lang.String str)
Set the x-axis legend. |
void |
setYAxisLegend(java.lang.String str)
Set the y-axis legend. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BarChart(java.lang.String[] labels, java.lang.Double[] values) throws java.lang.IllegalArgumentException
Method Detail |
public void setXAxisLegend(java.lang.String str)
str
- The title of the x-axis.public void setYAxisLegend(java.lang.String str)
str
- The title of the y-axis.public void setTitle(java.lang.String title)
public void setNumDecimalPlaces(int places)
NOTE:The default is 2.
places
- The number of places to the right of the decimal point.public java.io.ByteArrayOutputStream getImageBytes() throws java.io.IOException
ByteArrayOutputStream
representation
of the image.public void save(java.lang.String fileName) throws java.io.IOException
fileName
- The name of the JPEG file to save the chart to.public void renderChart()
It will, for instance, adjust the width of the chart to accomodate the longest label.
Currently, the width of the plotting area (the area that actually contains the bars) is always set to 300 pixels. The dimensions are scaled appropriately depending on the values passed into the constructor.
public static void main(java.lang.String[] args) throws java.lang.Exception
BarChart
class.java.lang.Exception
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |