Apache JMeter

## org.apache.jmeter.testelement
Class AbstractChart

    java.lang.Object
      org.apache.jmeter.testelement.AbstractTestElement
          org.apache.jmeter.testelement.AbstractChart

All Implemented Interfaces:
  Serializable, Cloneable, ReportChart, TestElement

Direct Known 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.

See Also:
  Serialized Form

Field Summary
`static int` `DEFAULT_HEIGHT`
`static int` `DEFAULT_WIDTH`
`protected BufferedImage` `image`
`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`

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<DataSet> 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, 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`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### REPORT_CHART_X_AXIS

    public static final String REPORT_CHART_X_AXIS

See Also:
  Constant Field Values

### REPORT_CHART_Y_AXIS

    public static final String REPORT_CHART_Y_AXIS

See Also:
  Constant Field Values

### REPORT_CHART_X_LABEL

    public static final String REPORT_CHART_X_LABEL

See Also:
  Constant Field Values

### REPORT_CHART_Y_LABEL

    public static final String REPORT_CHART_Y_LABEL

See Also:
  Constant Field Values

### REPORT_CHART_TITLE

    public static final String REPORT_CHART_TITLE

See Also:
  Constant Field Values

### REPORT_CHART_CAPTION

    public static final String REPORT_CHART_CAPTION

See Also:
  Constant Field Values

### REPORT_CHART_WIDTH

    public static final String REPORT_CHART_WIDTH

See Also:
  Constant Field Values

### REPORT_CHART_HEIGHT

    public static final String REPORT_CHART_HEIGHT

See Also:
  Constant Field Values

### DEFAULT_WIDTH

    public static final int DEFAULT_WIDTH

See Also:
  Constant Field Values

### DEFAULT_HEIGHT

    public static final int DEFAULT_HEIGHT

See Also:
  Constant Field Values

### X_DATA_FILENAME_LABEL

    public static final String X_DATA_FILENAME_LABEL

See Also:
  Constant Field Values

### X_DATA_DATE_LABEL

    public static final String X_DATA_DATE_LABEL

See Also:
  Constant Field Values

### X_LABELS

    public static final String[] X_LABELS

### image

    protected BufferedImage image

Constructor Detail

### AbstractChart

    public AbstractChart()

Method Detail

### getXAxis

    public String getXAxis()

### getFormattedXAxis

    public String getFormattedXAxis()

### setXAxis

    public void setXAxis(String field)

### getYAxis

    public String getYAxis()

### setYAxis

    public void setYAxis(String scale)

### getXLabel

    public String getXLabel()

### setXLabel

    public void setXLabel(String label)

  The X data labels should be either the filename, date or some other series of values

  Parameters:
    `label` -

### getYLabel

    public String getYLabel()

### setYLabel

    public void setYLabel(String label)

### 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

### 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` -

### getCaption

    public String getCaption()

  The caption is a description for the chart explaining what the chart means.

  Returns:
    caption

### setCaption

    public void setCaption(String caption)

  The caption is a description for the chart explaining what the chart means.

  Parameters:
    `caption` -

### getWidth

    public int getWidth()

  if no width is set, the default is returned

  Returns:
    width

### setWidth

    public void setWidth(String width)

  set the width of the graph

  Parameters:
    `width` -

### getHeight

    public int getHeight()

  if the height is not set, the default is returned

  Returns:
    height

### setHeight

    public void setHeight(String height)

  set the height of the graph

  Parameters:
    `height` -

### renderChart

    public abstract JComponent renderChart(List<DataSet> 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`
  Parameters:
    `data` - list of DataSet
  Returns:
    the component

### getBufferedImage

    public BufferedImage getBufferedImage()

  this makes it easy to get the bufferedImage

  Returns:
    image

### setBufferedImage

    public void setBufferedImage(BufferedImage img)

  in case an user wants set the bufferdImage

  Parameters:
    `img` -

### 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

Apache JMeter

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