Class SimplePlot
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.visualization.instances.instancestable.SimplePlot
-
- All Implemented Interfaces:
adams.core.Destroyable
,adams.core.GlobalInfoSupporter
,adams.core.logging.LoggingLevelHandler
,adams.core.logging.LoggingSupporter
,adams.core.option.OptionHandler
,adams.core.SizeOfHandler
,adams.gui.core.spreadsheettable.TableRowRangeCheck
,InstancesTablePopupMenuItem
,PlotColumn
,PlotRow
,PlotSelectedRows
,Serializable
,Comparable<InstancesTablePopupMenuItem>
public class SimplePlot extends adams.core.option.AbstractOptionHandler implements PlotColumn, PlotRow, PlotSelectedRows
Allows to perform a simple plot of a column or row.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
KEY_COLUMNS
static String
KEY_PLOT
static int
MAX_POINTS
the maximum of data points to plot.
-
Constructor Summary
Constructors Constructor Description SimplePlot()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(InstancesTablePopupMenuItem o)
For sorting the menu items.protected void
createPlot(InstancesTable table, boolean isColumn, List<Double>[] list, String title, String[] titles)
Generates the plot.String
getIconName()
Returns the name of the icon.String
getMenuItem()
Returns the name for the menu item.String
globalInfo()
Returns a string describing the object.boolean
handlesRowRange(adams.gui.core.TableRowRange range)
Checks whether the row range can be handled.boolean
isAvailable(InstancesTablePopupMenuItemHelper.TableState state)
Returns whether the menu item is available.int
maxNumRows()
Returns the maximum number of rows that the plugin requires.int
minNumRows()
Returns the minimum number of rows that the plugin requires.protected void
plot(InstancesTablePopupMenuItemHelper.TableState state, boolean isColumn, int index, int[] indices)
Allows the user to generate a plot from either a row or a column.boolean
plotColumn(InstancesTablePopupMenuItemHelper.TableState state)
Plots the specified column.boolean
plotRow(InstancesTablePopupMenuItemHelper.TableState state)
Plots the specified row.boolean
plotSelectedRows(InstancesTablePopupMenuItemHelper.TableState state)
Plots the specified row.protected adams.core.Properties
promptParameters(InstancesTable table, boolean isColumn)
Prompts the user to configure the parameters.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, defineOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
KEY_COLUMNS
public static final String KEY_COLUMNS
- See Also:
- Constant Field Values
-
KEY_PLOT
public static final String KEY_PLOT
- See Also:
- Constant Field Values
-
MAX_POINTS
public static final int MAX_POINTS
the maximum of data points to plot.- See Also:
- Constant Field Values
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceadams.core.GlobalInfoSupporter
- Specified by:
globalInfo
in classadams.core.option.AbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
getMenuItem
public String getMenuItem()
Returns the name for the menu item.- Specified by:
getMenuItem
in interfaceInstancesTablePopupMenuItem
- Returns:
- the name
-
getIconName
public String getIconName()
Returns the name of the icon.- Specified by:
getIconName
in interfaceInstancesTablePopupMenuItem
- Returns:
- the name, null if none available
-
isAvailable
public boolean isAvailable(InstancesTablePopupMenuItemHelper.TableState state)
Returns whether the menu item is available.- Specified by:
isAvailable
in interfaceInstancesTablePopupMenuItem
- Parameters:
state
- the state to use- Returns:
- true if available
-
compareTo
public int compareTo(InstancesTablePopupMenuItem o)
For sorting the menu items.- Specified by:
compareTo
in interfaceComparable<InstancesTablePopupMenuItem>
- Parameters:
o
- the other item- Returns:
- -1 if less than, 0 if equal, +1 if larger than this menu item name
-
handlesRowRange
public boolean handlesRowRange(adams.gui.core.TableRowRange range)
Checks whether the row range can be handled.- Specified by:
handlesRowRange
in interfaceadams.gui.core.spreadsheettable.TableRowRangeCheck
- Parameters:
range
- the range to check- Returns:
- true if handled
-
promptParameters
protected adams.core.Properties promptParameters(InstancesTable table, boolean isColumn)
Prompts the user to configure the parameters.- Parameters:
table
- the table to do this forisColumn
- whether column or row(s)- Returns:
- the parameters, null if cancelled
-
createPlot
protected void createPlot(InstancesTable table, boolean isColumn, List<Double>[] list, String title, String[] titles)
Generates the plot.- Parameters:
table
- the table this is forisColumn
- whether column or row(s)list
- the data to plottitle
- the title of the plottitles
- the titles array
-
plot
protected void plot(InstancesTablePopupMenuItemHelper.TableState state, boolean isColumn, int index, int[] indices)
Allows the user to generate a plot from either a row or a column.- Parameters:
state
- the table stateisColumn
- whether the to use column or rowindex
- the index of the row/columnindices
- the indices of the rows, ignored if null
-
plotColumn
public boolean plotColumn(InstancesTablePopupMenuItemHelper.TableState state)
Plots the specified column.- Specified by:
plotColumn
in interfacePlotColumn
- Parameters:
state
- the table state- Returns:
- true if successful
-
plotRow
public boolean plotRow(InstancesTablePopupMenuItemHelper.TableState state)
Plots the specified row.
-
minNumRows
public int minNumRows()
Returns the minimum number of rows that the plugin requires.- Specified by:
minNumRows
in interfacePlotSelectedRows
- Returns:
- the minimum
-
maxNumRows
public int maxNumRows()
Returns the maximum number of rows that the plugin requires.- Specified by:
maxNumRows
in interfacePlotSelectedRows
- Returns:
- the maximum, -1 for none
-
plotSelectedRows
public boolean plotSelectedRows(InstancesTablePopupMenuItemHelper.TableState state)
Plots the specified row.- Specified by:
plotSelectedRows
in interfacePlotSelectedRows
- Parameters:
state
- the table state- Returns:
- true if successful
-
-