VisualVM 1.3 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 java.lang.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.
 java.lang.String formatBytes(long value)
          Formats a bytes value to String.
 java.lang.String formatDecimal(long value)
          Formats a decimal value to String.
 java.lang.String formatPercent(long value)
          Formats a percent value to String.
 java.lang.String formatTime(long value)
          Formats a time value to String.
 javax.swing.JComponent getChart()
          Returns a JComponent containing the chart.
 boolean isLegendVisible()
          Returns true if legend section of the chart is visible, false otherwise.
 void loadValues(java.io.InputStream is)
          Loads chart values from the provided InputStream.
 void saveValues(java.io.OutputStream os)
          Saves chart values into the provided OutputStream.
 void setLegendVisible(boolean visible)
          Shows or hides legend section of the chart.
 void updateDetails(java.lang.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 javax.swing.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(java.io.OutputStream os)
                throws java.io.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:
java.io.IOException - if an I/O error occurs

loadValues

public void loadValues(java.io.InputStream is)
                throws java.io.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:
java.io.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(java.lang.String[] values)
Updates the details area of the chart.

Note: This method can be called from any thread.

Parameters:
details - details packet

setLegendVisible

public void setLegendVisible(boolean visible)
Shows or hides legend section of the chart.

Note: This method can be called from any thread.

Parameters:
visible - new visibility of the legend section of the chart
Since:
VisualVM 1.3.4

isLegendVisible

public boolean isLegendVisible()
Returns true if legend section of the chart is visible, false otherwise.

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

Returns:
true if legend section of the chart is visible, false otherwise
Since:
VisualVM 1.3.4

formatDecimal

public java.lang.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 java.lang.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 java.lang.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 java.lang.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.3 API
Specification