ij.plugin.frame
Class ChartFramePlugIn

java.lang.Object
  extended by ChartFrame
      extended by ij.plugin.frame.ChartFramePlugIn
All Implemented Interfaces:
PlugIn, WaveListener, java.awt.event.ActionListener, java.awt.event.AdjustmentListener, java.awt.event.ComponentListener, java.awt.event.FocusListener, java.awt.event.WindowListener, java.util.EventListener

public class ChartFramePlugIn
extends ChartFrame
implements PlugIn, java.awt.event.ActionListener, java.awt.event.AdjustmentListener, java.awt.event.ComponentListener, java.awt.event.WindowListener, java.awt.event.FocusListener, WaveListener

This class provides JFreeChart library plotting functionality as an ImageJ/PhysImage plugin. This plugin also introduces quite a few methods for manipulating the content and presentation of the chart data. This is one of the basic PlugIn Frames whose contents can be displayed in Layouts.


Field Summary
protected  ValueAxis domainAxis
           
protected  ImageJ ij
           
protected  double maxX
           
protected  double minX
           
protected  javax.swing.JScrollBar scrollbar
           
protected  javax.swing.JPanel statusbar
           
protected  javax.swing.JLabel statusLine
           
 
Constructor Summary
ChartFramePlugIn(java.lang.String title, JFreeChart chart)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void addAnnotation(XYAnnotation annotation)
          Adds any kinds of XYAnnotation to the chart
 void addAnnotations(XYAnnotation[] annotations)
          Adds any kinds of XYAnnotations to the chart
 void addAnnotationsFrom(ChartFramePlugIn sourceChart)
          Add XYAnnotations from another chart to the current chart.
 void addComment(Comment comment)
          Adds a single Comment to the chart.
 void addComments(Comments comments)
          Adds the Comments to the chart.
 void addMarker(WaveMarker marker)
          Adds a single WaveMarker to the chart.
 void addMarkers(java.util.ArrayList markers)
          Adds each of the WaveMarkers in the list to the current chart.
 void addWave(java.lang.String name)
          Adds a Wave from the WaveManager to the Chart by name.
 void addWave(Wave wave)
          Adds a Wave to the chart.
 void addWave(Wave wave, java.awt.Color color)
          Adds a Wave with the given Color to the chart.
 void addWaves(Waves waves)
          Adds all the Waves to the current chart.
 void addWaves(Waves waves, java.awt.Color color)
           
 void addWaves(Waves waves, double lowRange, double highRange, java.awt.Color color)
           
 void addWaves(WaveXYZDataset data, Waves waves, java.awt.Color color)
           
 void addWaves(WaveXYZDataset data, Waves waves, double lowRange, double highRange, java.awt.Color color)
           
 XYPlot addXYZPlot(Waves waves)
           
 void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
           
 void axisChanged(AxisChangeEvent e)
           
 void chartMouseClicked(ChartMouseEvent e)
           
 void chartMouseMoved(ChartMouseEvent e)
           
 ChartFramePlugIn clone()
           
 void close()
          Closes this window.
 void componentHidden(java.awt.event.ComponentEvent e)
           
 void componentMoved(java.awt.event.ComponentEvent e)
           
 void componentResized(java.awt.event.ComponentEvent event)
           
 void componentShown(java.awt.event.ComponentEvent e)
           
 void focusGained(java.awt.event.FocusEvent e)
           
 void focusLost(java.awt.event.FocusEvent e)
           
 XYAnnotation[] getAnnotations()
          Returns a list of XYAnnotations on the chart.
 java.util.List getAxes()
          Returns a list with all the axes.
 Axis getAxis(java.lang.String name)
          Returns the Axis corresponding to the axis label.
 Range getAxisExtents(java.lang.String name)
          Returns the drawable extents for the axis given by the name.
 Range getAxisRange(java.lang.String name)
          Returns the axis range
 JFreeChart getChart()
           
 java.util.ArrayList getDatasets()
           
 void getDatasets(java.util.ArrayList list, XYPlot plot)
           
 java.util.List getDomainAxes()
          Returns a list with all the domain axes.
 java.lang.String getInfo()
           
protected  java.lang.StringBuffer getInfo(java.lang.StringBuffer sb, java.lang.String indention, XYPlot plot)
           
 java.util.ArrayList getMarkers()
          Returns a reference to the list of WaveMarkers on the chart.
 java.util.ArrayList getMarkers(java.lang.String type)
          Returns the list of a type of markers, but should only be used for read-only.
 java.lang.String[] getMarkerTypes()
           
 PaintScale getPaintScale(java.lang.String waveName, int series)
          Gets the PaintScale for a Wave rendered using the XYBlockRenderer (e.g., 3D plots)
 PaintScale getPaintScale(XYPlot subplot, int series)
           
 java.util.List getRangeAxes()
          Returns a list with all the range axes.
protected  int getSeriesIndex(java.lang.String waveName)
           
 java.util.ArrayList getTriggerMarkers()
          Returns the list of trigger markers, but should only be used for read-only.
 Wave getWave(java.lang.String name)
          Returns the Wave from the chart with the given name.
 Waves getWaves()
          Returns all the Waves from the chart.
 XYDataset getXYDatasetForWave(java.lang.String waveName)
           
 XYPlot getXYPlot()
           
 XYPlot getXYPlotForWave(java.lang.String waveName)
           
 void hideDetails()
           
 void loadMarkers(java.lang.String filename)
          Loads the WaveMarkers from the file into the chart.
 void measureFrom(int x, int y)
           
 void removeAllMarkers()
          Removes all WaveMarkers from the chart.
 void removeMarker(WaveMarker marker)
          Removes the marker passed as argument from the chart.
 void removeMarkerAt(int x, int y)
          Remove the WaveMarker at the specified coordinates.
 void run(java.lang.String arg)
          This method is called when the plugin is loaded.
 void saveChart()
           
 void saveMarkers(java.lang.String filename)
          Saves the WaveMarkers to the file specified by the argument.
 void setAxisExtents(Axis axis, double lowerBound, double upperBound)
           
 void setAxisRange(Axis axis, double lowerBound, double upperBound)
           
 void setAxisRange(java.lang.String name, Range range)
          Sets the axis range for the wave or axis name.
 void setAxisTicks(java.lang.String axisName, double majorTickSize, int numMinTicks)
          Sets the tick increment and number of ticks for the axis with the name passed as argument.
 void setAxisVisible(java.lang.String name, boolean visible)
          Sets if the axis is visible by the wave or axis name.
 void setDomainAxisExtents(XYPlot plot, double lowerBound, double upperBound)
           
 void setDomainAxisRange(XYPlot plot, double lowerBound, double upperBound)
           
 void setPaintScale(java.lang.String waveName, java.awt.Color upperColor, int series)
           
 void setPaintScale(java.lang.String waveName, PaintScale paintScale, int series)
          Sets the PaintScale for a Wave rendered using the XYBlockRenderer (e.g., 3D plots)
 void setPaintScale(XYPlot subplot, java.awt.Color upperColor, int series)
           
 void setPaintScale(XYPlot subplot, PaintScale paintScale, int series)
           
 void setRangeAxisExtents(XYPlot plot, double lowerBound, double upperBound)
           
 void setRangeAxisRange(XYPlot plot, double lowerBound, double upperBound)
           
 void setWaveColor(java.lang.String waveName, java.awt.Color color)
           
 void setWaveStyle(java.lang.String waveName, java.lang.String style)
           
 void setWaveStyle(java.lang.String waveName, java.lang.String style, java.lang.String additionalOptions)
          Changes the renderer for the Wave to that of 'style'.
protected  void setXYPlotStyle(XYPlot plot, java.lang.String style, int seriesIndex, java.lang.String additionalOptions)
           
 void showDetails()
           
 java.lang.String toString()
           
 void waveChanged(Wave wave)
           
 void windowActivated(java.awt.event.WindowEvent e)
           
 void windowClosed(java.awt.event.WindowEvent e)
           
 void windowClosing(java.awt.event.WindowEvent e)
           
 void windowDeactivated(java.awt.event.WindowEvent e)
           
 void windowDeiconified(java.awt.event.WindowEvent e)
           
 void windowIconified(java.awt.event.WindowEvent e)
           
 void windowOpened(java.awt.event.WindowEvent e)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ij

protected ImageJ ij

statusbar

protected javax.swing.JPanel statusbar

statusLine

protected javax.swing.JLabel statusLine

scrollbar

protected javax.swing.JScrollBar scrollbar

domainAxis

protected ValueAxis domainAxis

minX

protected double minX

maxX

protected double maxX
Constructor Detail

ChartFramePlugIn

public ChartFramePlugIn(java.lang.String title,
                        JFreeChart chart)
Method Detail

clone

public ChartFramePlugIn clone()

componentHidden

public void componentHidden(java.awt.event.ComponentEvent e)
Specified by:
componentHidden in interface java.awt.event.ComponentListener

componentMoved

public void componentMoved(java.awt.event.ComponentEvent e)
Specified by:
componentMoved in interface java.awt.event.ComponentListener

componentShown

public void componentShown(java.awt.event.ComponentEvent e)
Specified by:
componentShown in interface java.awt.event.ComponentListener

componentResized

public void componentResized(java.awt.event.ComponentEvent event)
Specified by:
componentResized in interface java.awt.event.ComponentListener

getWave

public Wave getWave(java.lang.String name)
Returns the Wave from the chart with the given name.


getWaves

public Waves getWaves()
Returns all the Waves from the chart.


addWave

public void addWave(java.lang.String name)
Adds a Wave from the WaveManager to the Chart by name.


addWave

public void addWave(Wave wave)
Adds a Wave to the chart.


addWave

public void addWave(Wave wave,
                    java.awt.Color color)
Adds a Wave with the given Color to the chart.


addWaves

public void addWaves(Waves waves)
Adds all the Waves to the current chart.


getMarkerTypes

public java.lang.String[] getMarkerTypes()

getMarkers

public java.util.ArrayList getMarkers()
Returns a reference to the list of WaveMarkers on the chart. (BE CAREFUL NOT TO REMOVE/ADD CONTENTS).


getMarkers

public java.util.ArrayList getMarkers(java.lang.String type)
Returns the list of a type of markers, but should only be used for read-only. Use ChartFramePlugIn::addMarkers or ChartFramePlugIn::removeMarkers for manipulating the markers that appear in the chart.


getTriggerMarkers

public java.util.ArrayList getTriggerMarkers()
Returns the list of trigger markers, but should only be used for read-only. Use ChartFramePlugIn::addMarkers or ChartFramePlugIn::removeMarkers for manipulating the markers that appear in the chart.


getInfo

protected java.lang.StringBuffer getInfo(java.lang.StringBuffer sb,
                                         java.lang.String indention,
                                         XYPlot plot)

getInfo

public java.lang.String getInfo()

addXYZPlot

public XYPlot addXYZPlot(Waves waves)

addWaves

public void addWaves(WaveXYZDataset data,
                     Waves waves,
                     java.awt.Color color)

addWaves

public void addWaves(WaveXYZDataset data,
                     Waves waves,
                     double lowRange,
                     double highRange,
                     java.awt.Color color)

addWaves

public void addWaves(Waves waves,
                     java.awt.Color color)

addWaves

public void addWaves(Waves waves,
                     double lowRange,
                     double highRange,
                     java.awt.Color color)

getDatasets

public void getDatasets(java.util.ArrayList list,
                        XYPlot plot)

getDatasets

public java.util.ArrayList getDatasets()

getPaintScale

public PaintScale getPaintScale(java.lang.String waveName,
                                int series)
Gets the PaintScale for a Wave rendered using the XYBlockRenderer (e.g., 3D plots)


setPaintScale

public void setPaintScale(java.lang.String waveName,
                          java.awt.Color upperColor,
                          int series)

setPaintScale

public void setPaintScale(XYPlot subplot,
                          java.awt.Color upperColor,
                          int series)

setPaintScale

public void setPaintScale(XYPlot subplot,
                          PaintScale paintScale,
                          int series)

getPaintScale

public PaintScale getPaintScale(XYPlot subplot,
                                int series)

setPaintScale

public void setPaintScale(java.lang.String waveName,
                          PaintScale paintScale,
                          int series)
Sets the PaintScale for a Wave rendered using the XYBlockRenderer (e.g., 3D plots)


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

removeAllMarkers

public void removeAllMarkers()
Removes all WaveMarkers from the chart.


getAxis

public Axis getAxis(java.lang.String name)
Returns the Axis corresponding to the axis label. If more than one trace shares an axis using the Wave name will return the corresponding range axis. For the domain axis, you can also use the name "bottom".


setXYPlotStyle

protected void setXYPlotStyle(XYPlot plot,
                              java.lang.String style,
                              int seriesIndex,
                              java.lang.String additionalOptions)

setWaveStyle

public void setWaveStyle(java.lang.String waveName,
                         java.lang.String style)

setWaveStyle

public void setWaveStyle(java.lang.String waveName,
                         java.lang.String style,
                         java.lang.String additionalOptions)
Changes the renderer for the Wave to that of 'style'. 'style' can be one of the following: - 'lines' - connect points with lines - 'dots' - draw points with dots - 'circles' - draws the points with circles - 'spline' - connect points with splines - 'area' - connect points with lines and fill the area to zero


getSeriesIndex

protected int getSeriesIndex(java.lang.String waveName)

setWaveColor

public void setWaveColor(java.lang.String waveName,
                         java.awt.Color color)

getXYDatasetForWave

public XYDataset getXYDatasetForWave(java.lang.String waveName)

getXYPlotForWave

public XYPlot getXYPlotForWave(java.lang.String waveName)

setAxisTicks

public void setAxisTicks(java.lang.String axisName,
                         double majorTickSize,
                         int numMinTicks)
Sets the tick increment and number of ticks for the axis with the name passed as argument.


getDomainAxes

public java.util.List getDomainAxes()
Returns a list with all the domain axes.


getRangeAxes

public java.util.List getRangeAxes()
Returns a list with all the range axes.


getAxes

public java.util.List getAxes()
Returns a list with all the axes.


setRangeAxisExtents

public void setRangeAxisExtents(XYPlot plot,
                                double lowerBound,
                                double upperBound)

setDomainAxisExtents

public void setDomainAxisExtents(XYPlot plot,
                                 double lowerBound,
                                 double upperBound)

setAxisExtents

public void setAxisExtents(Axis axis,
                           double lowerBound,
                           double upperBound)

setRangeAxisRange

public void setRangeAxisRange(XYPlot plot,
                              double lowerBound,
                              double upperBound)

setDomainAxisRange

public void setDomainAxisRange(XYPlot plot,
                               double lowerBound,
                               double upperBound)

setAxisRange

public void setAxisRange(Axis axis,
                         double lowerBound,
                         double upperBound)

getAxisExtents

public Range getAxisExtents(java.lang.String name)
Returns the drawable extents for the axis given by the name. The bounds should be between 0 and 1.


getAxisRange

public Range getAxisRange(java.lang.String name)
Returns the axis range


setAxisRange

public void setAxisRange(java.lang.String name,
                         Range range)
Sets the axis range for the wave or axis name.


setAxisVisible

public void setAxisVisible(java.lang.String name,
                           boolean visible)
Sets if the axis is visible by the wave or axis name.


addComments

public void addComments(Comments comments)
Adds the Comments to the chart.


addComment

public void addComment(Comment comment)
Adds a single Comment to the chart.


addAnnotation

public void addAnnotation(XYAnnotation annotation)
Adds any kinds of XYAnnotation to the chart


addAnnotations

public void addAnnotations(XYAnnotation[] annotations)
Adds any kinds of XYAnnotations to the chart


getAnnotations

public XYAnnotation[] getAnnotations()
Returns a list of XYAnnotations on the chart.


addAnnotationsFrom

public void addAnnotationsFrom(ChartFramePlugIn sourceChart)
Add XYAnnotations from another chart to the current chart.


addMarkers

public void addMarkers(java.util.ArrayList markers)
Adds each of the WaveMarkers in the list to the current chart.


addMarker

public void addMarker(WaveMarker marker)
Adds a single WaveMarker to the chart.


loadMarkers

public void loadMarkers(java.lang.String filename)
Loads the WaveMarkers from the file into the chart.


measureFrom

public void measureFrom(int x,
                        int y)

removeMarkerAt

public void removeMarkerAt(int x,
                           int y)
Remove the WaveMarker at the specified coordinates.


removeMarker

public void removeMarker(WaveMarker marker)
Removes the marker passed as argument from the chart.


saveMarkers

public void saveMarkers(java.lang.String filename)
Saves the WaveMarkers to the file specified by the argument.


axisChanged

public void axisChanged(AxisChangeEvent e)

adjustmentValueChanged

public void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
Specified by:
adjustmentValueChanged in interface java.awt.event.AdjustmentListener

chartMouseClicked

public void chartMouseClicked(ChartMouseEvent e)

chartMouseMoved

public void chartMouseMoved(ChartMouseEvent e)

run

public void run(java.lang.String arg)
Description copied from interface: PlugIn
This method is called when the plugin is loaded. 'arg', which may be blank, is the argument specified for this plugin in IJ_Props.txt.

Specified by:
run in interface PlugIn

getChart

public JFreeChart getChart()

getXYPlot

public XYPlot getXYPlot()

saveChart

public void saveChart()

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
Specified by:
windowClosing in interface java.awt.event.WindowListener

close

public void close()
Closes this window.


windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
Specified by:
windowActivated in interface java.awt.event.WindowListener

focusGained

public void focusGained(java.awt.event.FocusEvent e)
Specified by:
focusGained in interface java.awt.event.FocusListener

waveChanged

public void waveChanged(Wave wave)
Specified by:
waveChanged in interface WaveListener

hideDetails

public void hideDetails()

showDetails

public void showDetails()

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
Specified by:
windowOpened in interface java.awt.event.WindowListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
Specified by:
windowClosed in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent e)
Specified by:
windowIconified in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener

focusLost

public void focusLost(java.awt.event.FocusEvent e)
Specified by:
focusLost in interface java.awt.event.FocusListener

toString

public java.lang.String toString()