public class AttributeVisualizationPanel extends PrintablePanel
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
protected AttributeStats |
m_as
This holds the attribute stats of the current attribute on display.
|
protected AttributeStats[] |
m_asCache
Cache of attribute stats info for the current data set
|
protected int |
m_attribIndex
This holds the index of the current attribute on display and should be
set through setAttribute(int idx).
|
protected double |
m_barRange
Contains the range of each bar in a histogram.
|
protected int |
m_classIndex
Contains the current class index.
|
protected JComboBox |
m_colorAttrib
This stores and lets the user select a class attribute.
|
protected Instances |
m_data
This holds the current set of instances
|
protected int[] |
m_histBarCounts
This array holds the count (or height) for the each of the bars in a
barplot or a histogram.
|
protected int |
m_maxValue
This holds the max value of the current attribute.
|
m_Printer
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
AttributeVisualizationPanel()
Constructor - If used then the class will not show the class selection
combo box.
|
AttributeVisualizationPanel(boolean showColouringOption)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
calcGraph(int panelWidth,
int panelHeight)
Recalculates the barplot or histogram to display, required usually when the
attribute is changed or the component is resized.
|
JComboBox |
getColorBox()
Returns the class selection combo box if the parent component wants to
place it in itself or in some component other than this component.
|
int |
getColoringIndex()
Get the coloring (class) index for the plot
|
String |
getToolTipText(MouseEvent ev)
Returns "<nominal value> [<nominal value count>]"
if displaying a bar plot and mouse is on some bar.
|
static void |
main(String[] args)
Main method to test this class from command line
|
void |
paintComponent(Graphics g)
Paints this component
|
void |
setAttribute(int index)
Tells the panel which attribute to visualize.
|
void |
setColoringIndex(int ci)
Set the coloring (class) index for the plot
|
void |
setInstances(Instances newins)
Sets the instances for use
|
getSaveDialogTitle, getWriter, getWriters, getXScale, getYScale, saveComponent, setSaveDialogTitle, setScale
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
protected Instances m_data
protected AttributeStats m_as
protected AttributeStats[] m_asCache
protected int m_attribIndex
protected int m_maxValue
protected int[] m_histBarCounts
protected double m_barRange
protected int m_classIndex
protected JComboBox m_colorAttrib
public AttributeVisualizationPanel()
public AttributeVisualizationPanel(boolean showColouringOption)
showColouringOption
- - should be true if the class selection combo
box is to be displayed with the histogram/barplot, or false otherwise.
P.S: the combo box is always created it just won't be shown if
showColouringOption is false.public void setInstances(Instances newins)
newins
- a set of Instancespublic JComboBox getColorBox()
public int getColoringIndex()
int
valuepublic void setColoringIndex(int ci)
ci
- an int
valuepublic void setAttribute(int index)
index
- The index of the attributepublic void calcGraph(int panelWidth, int panelHeight)
public String getToolTipText(MouseEvent ev)
getToolTipText
in class JComponent
ev
- The mouse eventpublic void paintComponent(Graphics g)
paintComponent
in class JComponent
g
- The graphics object for this componentpublic static void main(String[] args)
args
- The arff file and the index of the attribute to useCopyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.