org.apache.jmeter.testelement

Class AbstractChart

Implemented Interfaces:
Cloneable, ReportChart, Serializable, TestElement
Known Direct Subclasses:
BarChart, LineChart

public abstract class AbstractChart
extends AbstractTestElement
implements ReportChart

The general idea of the chart graphs information for a table. A chart can only be generated from a specific table, though more than one chart can be generated from a single table.

Field Summary

static int
DEFAULT_HEIGHT
static int
DEFAULT_WIDTH
static String
REPORT_CHART_CAPTION
static String
REPORT_CHART_HEIGHT
static String
REPORT_CHART_TITLE
static String
REPORT_CHART_WIDTH
static String
REPORT_CHART_X_AXIS
static String
REPORT_CHART_X_LABEL
static String
REPORT_CHART_Y_AXIS
static String
REPORT_CHART_Y_LABEL
static String
X_DATA_DATE_LABEL
static String
X_DATA_FILENAME_LABEL
static String[]
X_LABELS
protected BufferedImage
image

Fields inherited from interface org.apache.jmeter.testelement.TestElement

COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS

Constructor Summary

AbstractChart()

Method Summary

BufferedImage
getBufferedImage()
this makes it easy to get the bufferedImage
String
getCaption()
The caption is a description for the chart explaining what the chart means.
String
getFormattedXAxis()
int
getHeight()
if the height is not set, the default is returned
String
getTitle()
The title is a the name for the chart.
double
getValue(SamplingStatCalculator stat)
convienance method for getting the selected value.
int
getWidth()
if no width is set, the default is returned
String
getXAxis()
String
getXLabel()
String
getYAxis()
String
getYLabel()
abstract JComponent
renderChart(List data)
Subclasses will need to implement the method by doing the following: 1. get the x and y axis 2. filter the table data 3. pass the data to the chart library 4. return the generated chart
void
setBufferedImage(BufferedImage img)
in case an user wants set the bufferdImage
void
setCaption(String caption)
The caption is a description for the chart explaining what the chart means.
void
setHeight(String height)
set the height of the graph
void
setTitle(String title)
The title is a the name for the chart.
void
setWidth(String width)
set the width of the graph
void
setXAxis(String field)
void
setXLabel(String label)
The X data labels should be either the filename, date or some other series of values
void
setYAxis(String scale)
void
setYLabel(String label)

Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement

addProperty, addTestElement, canRemove, clear, clearTemporary, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traverseProperty

Field Details

DEFAULT_HEIGHT

public static final int DEFAULT_HEIGHT
Field Value:
350

DEFAULT_WIDTH

public static final int DEFAULT_WIDTH
Field Value:
350

REPORT_CHART_CAPTION

public static final String REPORT_CHART_CAPTION

REPORT_CHART_HEIGHT

public static final String REPORT_CHART_HEIGHT

REPORT_CHART_TITLE

public static final String REPORT_CHART_TITLE

REPORT_CHART_WIDTH

public static final String REPORT_CHART_WIDTH

REPORT_CHART_X_AXIS

public static final String REPORT_CHART_X_AXIS

REPORT_CHART_X_LABEL

public static final String REPORT_CHART_X_LABEL

REPORT_CHART_Y_AXIS

public static final String REPORT_CHART_Y_AXIS

REPORT_CHART_Y_LABEL

public static final String REPORT_CHART_Y_LABEL

X_DATA_DATE_LABEL

public static final String X_DATA_DATE_LABEL

X_DATA_FILENAME_LABEL

public static final String X_DATA_FILENAME_LABEL

X_LABELS

public static final String[] X_LABELS

image

protected BufferedImage image

Constructor Details

AbstractChart

public AbstractChart()

Method Details

getBufferedImage

public BufferedImage getBufferedImage()
this makes it easy to get the bufferedImage
Returns:
image

getCaption

public String getCaption()
The caption is a description for the chart explaining what the chart means.
Returns:
caption

getFormattedXAxis

public String getFormattedXAxis()

getHeight

public int getHeight()
if the height is not set, the default is returned
Returns:
height

getTitle

public String getTitle()
The title is a the name for the chart. A page link will be generated using the title. The title will also be used for a page index.
Returns:
chart title

getValue

public double getValue(SamplingStatCalculator stat)
convienance method for getting the selected value. Rather than use Method.invoke(Object,Object[]), it's simpler to just check which column is selected and call the method directly.
Parameters:
stat -
Returns:
value

getWidth

public int getWidth()
if no width is set, the default is returned
Returns:
width

getXAxis

public String getXAxis()

getXLabel

public String getXLabel()

getYAxis

public String getYAxis()

getYLabel

public String getYLabel()

renderChart

public abstract JComponent renderChart(List data)
Subclasses will need to implement the method by doing the following: 1. get the x and y axis 2. filter the table data 3. pass the data to the chart library 4. return the generated chart
Specified by:
renderChart in interface ReportChart

setBufferedImage

public void setBufferedImage(BufferedImage img)
in case an user wants set the bufferdImage
Parameters:
img -

setCaption

public void setCaption(String caption)
The caption is a description for the chart explaining what the chart means.
Parameters:
caption -

setHeight

public void setHeight(String height)
set the height of the graph
Parameters:
height -

setTitle

public void setTitle(String title)
The title is a the name for the chart. A page link will be generated using the title. The title will also be used for a page index.
Parameters:
title -

setWidth

public void setWidth(String width)
set the width of the graph
Parameters:
width -

setXAxis

public void setXAxis(String field)

setXLabel

public void setXLabel(String label)
The X data labels should be either the filename, date or some other series of values
Parameters:
label -

setYAxis

public void setYAxis(String scale)

setYLabel

public void setYLabel(String label)

Copyright © 1998-2010 Apache Software Foundation. All Rights Reserved.