public class BarVisualisation extends XYPlotVisualisation<BarVisualisation.Bar> implements ItemPlotter<BarVisualisation.Bar,Float[],MBFImage>
BarVisualisation can be used to draw to an image a bar graph of
any data set to an RGBA MBFImage.| Modifier and Type | Class and Description |
|---|---|
static class |
BarVisualisation.Bar
Represents a single bar to draw.
|
XYPlotVisualisation.LocatedObject<O>JPanel.AccessibleJPanelJComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategyaxesRenderer2D, plotterclearBeforeDraw, data, visImagelistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
BarVisualisation(int width,
int height)
Create a bar visualisation of the given size
|
BarVisualisation(int width,
int height,
double[] data)
Creates the given visualisation with the given data
|
| Modifier and Type | Method and Description |
|---|---|
void |
fixAxis(int position)
Fix the x-axis to the given position in pixels.
|
void |
floatAxis()
Allow the x-axis to move as best to fit the data
|
Float[] |
getAxisColour() |
double |
getAxisLocation()
Returns the last calculated axis location
|
double |
getAxisRangeX()
The data range being displayed.
|
double |
getAxisRangeY()
The data range being displayed.
|
int |
getAxisWidth()
Get the width of the axis being drawn
|
Float[] |
getBackgroundColour() |
Float[] |
getBarColour() |
double |
getBarWidth() |
double |
getMaxValue()
Get the maximum value for the scaling
|
double |
getMinValue()
Get the minimum value in use.
|
Float[] |
getStrokeColour(int row) |
int |
getTextBasePad() |
Float[] |
getTextColour() |
int |
getTextSize() |
Float[] |
getTextStrokeColour() |
LabelTransformer |
getTransformer() |
Point2d |
getValueAt(int x,
int y)
Returns the units value at the given pixel coordinate.
|
double |
getYscale()
The y-scale being used to plot the data.
|
boolean |
isAutoScale()
Returns whether the bars are auto scaling
|
boolean |
isAxisAlwaysVisible()
Whether the axis is always visible
|
boolean |
isCentreBarsOnValues() |
boolean |
isFixAxis()
Returns whether the axis is fixed or not.
|
boolean |
isOutlineText() |
boolean |
isUseFixedBarWidth() |
static void |
main(String[] args)
Shows a basic bar visualisation.
|
void |
plotObject(MBFImage visImage,
XYPlotVisualisation.LocatedObject<BarVisualisation.Bar> object,
AxesRenderer2D<Float[],MBFImage> renderer)
Plots a single bar into the visualisation.
|
void |
renderRestarting()
Called just before a render of the visualisation is about to start.
|
void |
setAutoScale(boolean autoScale)
Set whether the bars should auto scale to fit all values within the vis.
|
void |
setAxisAlwaysVisible(boolean axisAlwaysVisible)
Set whether the axis should always be visible.
|
void |
setAxisColour(Float[] axisColour) |
void |
setAxisLocation(double axisLocation)
Set the axis location.
|
void |
setAxisWidth(int axisWidth)
Set the axis width
|
void |
setBackgroundColour(Float[] backgroundColour) |
void |
setBarColour(Float[] barColour) |
void |
setBarWidth(double barWidth) |
void |
setCentreBarsOnValues(boolean centreBarsOnValues) |
void |
setData(double[] data)
Set the data to a double array
|
void |
setData(float[] data)
Set the data from a float array.
|
void |
setData(long[] data)
Set the data from a long array.
|
void |
setDrawValues(boolean tf)
Sets whether values are drawn to the image.
|
void |
setFixAxis(boolean fixAxis)
Set whether the axis should be fixed.
|
void |
setMaxValue(double maxValue)
Set the maximum value (in units) for the bars.
|
void |
setMinValue(double minValue)
Set the minimum value (in units) to use to plot the bars.
|
void |
setOutlineText(boolean outlineText) |
void |
setStrokeColour(Float[] strokeColour) |
void |
setStrokeProvider(StrokeColourProvider<Float[]> prov) |
void |
setTextBasePad(int textBasePad) |
void |
setTextColour(Float[] textColour) |
void |
setTextSize(int textSize) |
void |
setTextStrokeColour(Float[] textStrokeColour) |
void |
setTransformer(LabelTransformer transformer) |
void |
setUseFixedBarWidth(boolean useFixedBarWidth) |
void |
useColourMap(ColourMap cp)
Whether to use a colour map and which one.
|
void |
useStaticColour()
Revert back to using a static colour rather than a colour map;
|
addPoint, beforeAxesRender, clearData, getAxesRenderer, isAutoPositionXAxis, isAutoScaleAxes, isRenderAxesLast, removePoint, setAutoPositionXAxis, setAutoScaleAxes, setData, setItemPlotter, setRenderAxesLast, update, validateDataaddOverlay, componentHidden, componentMoved, componentResized, componentShown, getRequiredSize, getVisualisationImage, isAllowResize, newVisualisationAvailable, paint, removeOverlay, setAllowResize, setClearBeforeDraw, setRequiredSize, showWindow, update, updateVis, updateVisgetAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIaddAncestorListener, 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, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, 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, unregisterKeyboardActionadd, 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, validateTreeaction, 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, transferFocusUpCyclepublic BarVisualisation(int width, int height)
width - The width of the imageheight - The height of the imagepublic BarVisualisation(int width, int height, double[] data)
width - The width of the imageheight - The height of the imagedata - The data to visualisepublic void renderRestarting()
renderRestarting in interface ItemPlotter<BarVisualisation.Bar,Float[],MBFImage>ItemPlotter.renderRestarting()public void plotObject(MBFImage visImage, XYPlotVisualisation.LocatedObject<BarVisualisation.Bar> object, AxesRenderer2D<Float[],MBFImage> renderer)
AxesRenderer2D to
provide the position of the object. Should side affect the given image.plotObject in interface ItemPlotter<BarVisualisation.Bar,Float[],MBFImage>visImage - The image to draw toobject - The objectrenderer - The axes rendererItemPlotter.plotObject(org.openimaj.image.Image,
org.openimaj.vis.general.XYPlotVisualisation.LocatedObject,
org.openimaj.vis.general.AxesRenderer2D)public void setDrawValues(boolean tf)
tf - TRUE to draw valuespublic void setData(float[] data)
data - The data to setpublic void setData(long[] data)
data - The data to setpublic void setData(double[] data)
data - The datapublic void fixAxis(int position)
position - The position in pixelspublic void floatAxis()
public boolean isOutlineText()
public void setOutlineText(boolean outlineText)
outlineText - the outlineText to setpublic int getTextSize()
public void setTextSize(int textSize)
textSize - the textSize to setpublic void useColourMap(ColourMap cp)
cp - The colour map to usepublic void useStaticColour()
public Float[] getBarColour()
public Float[] getStrokeColour(int row)
row - the rowpublic void setStrokeProvider(StrokeColourProvider<Float[]> prov)
prov - public Float[] getTextColour()
public Float[] getTextStrokeColour()
public Float[] getBackgroundColour()
public void setBackgroundColour(Float[] backgroundColour)
backgroundColour - the backgroundColour to setpublic void setBarColour(Float[] barColour)
barColour - the barColour to setpublic void setStrokeColour(Float[] strokeColour)
strokeColour - the strokeColour to setpublic void setTextColour(Float[] textColour)
textColour - the textColour to setpublic void setTextStrokeColour(Float[] textStrokeColour)
textStrokeColour - the textStrokeColour to setpublic Float[] getAxisColour()
public void setAxisColour(Float[] axisColour)
axisColour - the axisColour to setpublic int getAxisWidth()
public void setAxisWidth(int axisWidth)
axisWidth - The new axis widthpublic boolean isAutoScale()
public void setAutoScale(boolean autoScale)
autoScale - TRUE to auto scale the valuespublic double getMaxValue()
public void setMaxValue(double maxValue)
maxValue - Set the maximum value to usepublic double getMinValue()
public void setMinValue(double minValue)
minValue - the minimum valuepublic boolean isAxisAlwaysVisible()
public void setAxisAlwaysVisible(boolean axisAlwaysVisible)
axisAlwaysVisible - TRUE to make the axis always visiblepublic double getAxisLocation()
public void setAxisLocation(double axisLocation)
axisLocation - the axisLocation to setpublic boolean isFixAxis()
public void setFixAxis(boolean fixAxis)
fixAxis - TRUE to fix the axis; FALSE to allow it to floatpublic double getYscale()
public double getAxisRangeY()
public double getAxisRangeX()
public Point2d getValueAt(int x, int y)
x - The x pixel coordinatey - The y pixel coordinatepublic double getBarWidth()
public void setBarWidth(double barWidth)
barWidth - the barWidth to setpublic boolean isUseFixedBarWidth()
public void setUseFixedBarWidth(boolean useFixedBarWidth)
useFixedBarWidth - the useFixedBarWidth to setpublic boolean isCentreBarsOnValues()
public void setCentreBarsOnValues(boolean centreBarsOnValues)
centreBarsOnValues - the centreBarsOnValues to setpublic int getTextBasePad()
public void setTextBasePad(int textBasePad)
textBasePad - the textBasePad to setpublic LabelTransformer getTransformer()
public void setTransformer(LabelTransformer transformer)
transformer - the transformer to set