VisualVM 1.2 API
Specification

com.sun.tools.visualvm.charts
Class SimpleXYChartSupport

java.lang.Object
  extended by com.sun.tools.visualvm.charts.SimpleXYChartSupport

public final class SimpleXYChartSupport
extends Object

Handle to access a simple XY chart. The chart supports adding new data and updating the details area.

Author:
Jiri Sedlacek

Field Summary
static long MAX_UNDEFINED
           
static long MIN_UNDEFINED
           
 
Method Summary
 void addValues(long timestamp, long[] values)
          Adds a packet of values.
 String formatBytes(long value)
          Formats a bytes value to String.
 String formatDecimal(long value)
          Formats a decimal value to String.
 String formatPercent(long value)
          Formats a percent value to String.
 String formatTime(long value)
          Formats a time value to String.
 JComponent getChart()
          Returns a JComponent containing the chart.
 void loadValues(InputStream is)
          Loads chart values from the provided InputStream.
 void saveValues(OutputStream os)
          Saves chart values into the provided OutputStream.
 void updateDetails(String[] values)
          Updates the details area of the chart.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_UNDEFINED

public static final long MIN_UNDEFINED
See Also:
Constant Field Values

MAX_UNDEFINED

public static final long MAX_UNDEFINED
See Also:
Constant Field Values
Method Detail

getChart

public JComponent getChart()
Returns a JComponent containing the chart.

Note: This method must be called in the Event Dispatch Thread.

Returns:
JComponent containing the chart;

saveValues

public void saveValues(OutputStream os)
                throws IOException
Saves chart values into the provided OutputStream. This method should not be called in the Event Dispatch Thread.

Parameters:
os - OuptutStream into which to save the chart values
Throws:
IOException - if an I/O error occurs

loadValues

public void loadValues(InputStream is)
                throws IOException
Loads chart values from the provided InputStream. This method should not be called in the Event Dispatch Thread.

Parameters:
is - InputStram from which to load the chart values
Throws:
IOException - if an I/O error occurs

addValues

public void addValues(long timestamp,
                      long[] values)
Adds a packet of values.

Note: This method can be called from any thread.

Parameters:
timestamp - timestamp of the data packet
values - data packet

updateDetails

public void updateDetails(String[] values)
Updates the details area of the chart.

Note: This method can be called from any thread.

Parameters:
details - details packet

formatDecimal

public String formatDecimal(long value)
Formats a decimal value to String. Use this method to make sure the value appears in the same format as used in the chart (tooltip). Useful for updating details area.

Note: This method must be called in the Event Dispatch Thread.

Parameters:
value - value to be formatted
Returns:
formatted value in the same format as used in the chart

formatBytes

public String formatBytes(long value)
Formats a bytes value to String. Use this method to make sure the value appears in the same format as used in the chart (tooltip). Useful for updating details area.

Note: This method must be called in the Event Dispatch Thread.

Parameters:
value - value to be formatted
Returns:
formatted value in the same format as used in the chart

formatPercent

public String formatPercent(long value)
Formats a percent value to String. Use this method to make sure the value appears in the same format as used in the chart (tooltip). Useful for updating details area.

Note: This method must be called in the Event Dispatch Thread.

Parameters:
value - value to be formatted
Returns:
formatted value in the same format as used in the chart

formatTime

public String formatTime(long value)
Formats a time value to String. Use this method to make sure the value appears in the same format as used in the chart (tooltip). Useful for updating details area.

Note: This method must be called in the Event Dispatch Thread.

Parameters:
value - value to be formatted
Returns:
formatted value in the same format as used in the chart

VisualVM 1.2 API
Specification