public class IlvChart.Area extends JComponent
IlvChart.getChartArea()
method. This component is the place where all
the drawing operations are performed (the graphical representations of the
data themselves, and the decorations). This container also contains the
Scales components. We can distinguish two areas within the chart area
component:
getDrawRect()
method.getPlotRect()
method.The following figure shows the different parts of the chart area:
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
static int |
FIXED_BOTTOM_MARGIN
Constant for plot margins: the bottom margin is fixed.
|
static int |
FIXED_LEFT_MARGIN
Constant for plot margins: the left margin is fixed.
|
static int |
FIXED_RIGHT_MARGIN
Constant for plot margins: the right margin is fixed.
|
static int |
FIXED_TOP_MARGIN
Constant for plot margins: the top margin is fixed.
|
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
Modifier and Type | Method and Description |
---|---|
Color |
getBackground()
Returns the background color of this component.
|
Paint |
getBackgroundPaint()
Returns the background Paint.
|
IlvChart |
getChart()
Returns the chart to which this area belongs.
|
Rectangle |
getDrawRect()
Returns the rectangle where both charts and scales are displayed.
|
int |
getFixedMargins()
Indicates which margins are fixed.
|
Font |
getFont()
Returns the font of this component.
|
Graphics |
getGraphics()
Returns a graphics context, which lets you draw directly on the chart
area component.
|
Insets |
getMargins()
Returns the interior margins between the plotting rectangle and the chart
area.
|
Paint |
getPlotBackground()
Returns the background paint of the plotting area.
|
Rectangle |
getPlotRect()
Returns the plotting rectangle.
|
IlvStyle |
getPlotStyle()
Returns the style used to fill and outline the plotting area.
|
Dimension |
getPreferredSize()
Returns the preferred size.
|
boolean |
isDirectRedrawEnabled()
Returns the value of the
directRedraw property. |
boolean |
isFilledPlottingArea()
Returns whether the plotting area is filled.
|
boolean |
isPlotRectIncludingAnnotations()
Returns
true if the layout is made in such a way that the
plotting rectangle contains the markers and annotations of the visible
data points. |
boolean |
isValidateRoot()
Returns
true , so that a revalidate call on the
child components does not invalidate the chart. |
protected void |
paintComponent(Graphics dst)
Paints the contents of the chart area component.
|
void |
paintCurrentThread(Graphics2D g,
Color bgColor)
Draws the contents of this chart area entirely in the caller thread.
|
protected void |
processKeyEvent(KeyEvent event)
Processes key events occurring on this component by dispatching them to
any registered interactors.
|
protected void |
processMouseEvent(MouseEvent event)
Processes mouse events occurring on this component by dispatching them to
any registered interactors.
|
protected void |
processMouseMotionEvent(MouseEvent event)
Processes mouse motion events occurring on this component by dispatching
them to any registered interactors.
|
void |
repaint()
Repaints this component.
|
void |
repaint(IlvDataWindow dataWindow,
int yAxisIdx)
Repaints the specified data window.
|
void |
repaint2D(Rectangle2D r)
Adds the specified region to the dirty region list if the component is
showing.
|
void |
revalidate()
Overridden to do nothing if not executing in the AWT/Swing event thread.
|
void |
revalidateLayout()
Revalidates the layout of this component.
|
void |
setBackgroundPaint(Paint bg)
Sets the background as a Paint.
|
void |
setBottomMargin(int bottom)
Sets the bottom margin between the plotting rectangle and the chart area.
|
void |
setBounds(int x,
int y,
int w,
int h)
Moves and resizes this component.
|
void |
setDirectRedrawEnabled(boolean b)
Sets the
directRedraw property. |
void |
setFilledPlottingArea(boolean filled)
Sets whether the plotting area is filled.
|
void |
setFont(Font font)
Sets the font of this component.
|
void |
setHorizontalMargins(int left,
int right)
Sets the horizontal margins between the plotting rectangle and the chart
area.
|
void |
setLayout(LayoutManager mgr)
Does not allow to change the layout.
|
void |
setLeftMargin(int left)
Sets the left margin between the plotting rectangle and the chart area.
|
void |
setMargins(Insets margins)
Sets the interior margins between the plotting rectangle and the chart
area.
|
void |
setPlotBackground(Color[] colors,
boolean xAxis)
Sets the background colors of the plotting rectangle.
|
void |
setPlotBackground(Paint background)
Sets the background paint of the plotting area.
|
void |
setPlotRectIncludingAnnotations(boolean include)
Specifies whether the layout is made in such a way that the plotting
rectangle contains the markers and annotations of the visible data
points.
|
void |
setPlotStyle(IlvStyle style)
Sets the style used to fill and outline the plotting area.
|
void |
setRightMargin(int right)
Sets the right margin between the plotting rectangle and the chart area.
|
void |
setTopMargin(int top)
Sets the top margin between the plotting rectangle and the chart area.
|
void |
setVerticalMargins(int top,
int bottom)
Sets the vertical margins between the plotting rectangle and the chart
area.
|
BufferedImage |
toImage(BufferedImage image,
boolean erase)
Paints the chart area in a
BufferedImage object. |
BufferedImage |
toImage(int width,
int height,
Color bgColor)
Paints the chart area in a
BufferedImage object. |
void |
toJPEG(OutputStream output)
Dumps the chart area as a JPEG stream.
|
void |
toPNG(OutputStream output)
Dumps this chart area as a PNG stream.
|
void |
toPNG(OutputStream output,
boolean transparent)
Dumps the chart area as a PNG stream.
|
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, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
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, 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, getAccessibleContext, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, 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, resize, resize, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final int FIXED_LEFT_MARGIN
public static final int FIXED_RIGHT_MARGIN
public static final int FIXED_TOP_MARGIN
public static final int FIXED_BOTTOM_MARGIN
public Font getFont()
getFont
in interface MenuContainer
getFont
in class Component
public void setFont(Font font)
setFont
in class JComponent
public void setLayout(LayoutManager mgr)
public boolean isPlotRectIncludingAnnotations()
true
if the layout is made in such a way that the
plotting rectangle contains the markers and annotations of the visible
data points.public void setPlotRectIncludingAnnotations(boolean include)
If the value is true
, annotations are included in the
plotting rectangle. This is pretty, but can slow down dynamic updates. If
the value if false
, annotations may be clipped at the border
of the plotting rectangle.
The default value is false
.
public void setMargins(Insets margins)
margins
parameter specifies the new margins. If
this parameter is null
, margins will be automatically
computed.public void setHorizontalMargins(int left, int right)
setLeftMargin(int)
,
setRightMargin(int)
,
getFixedMargins()
public void setVerticalMargins(int top, int bottom)
getFixedMargins()
,
setLeftMargin(int)
,
setRightMargin(int)
public void setLeftMargin(int left)
setMargins(java.awt.Insets)
,
getFixedMargins()
public void setRightMargin(int right)
setMargins(java.awt.Insets)
,
getFixedMargins()
public void setTopMargin(int top)
setMargins(java.awt.Insets)
,
getFixedMargins()
public void setBottomMargin(int bottom)
setMargins(java.awt.Insets)
,
getFixedMargins()
public int getFixedMargins()
FIXED_LEFT_MARGIN
, FIXED_RIGHT_MARGIN
,
FIXED_TOP_MARGIN
, FIXED_BOTTOM_MARGIN
.setMargins(java.awt.Insets)
,
setHorizontalMargins(int, int)
,
setVerticalMargins(int, int)
public Insets getMargins()
public final IlvChart getChart()
public Color getBackground()
getBackground
in class Component
public final Paint getBackgroundPaint()
public void setBackgroundPaint(Paint bg)
public IlvStyle getPlotStyle()
public void setPlotStyle(IlvStyle style)
Note: The Bean property plotStyle
must not be specified
together with the Bean properties plotBackground
or
filledPlottingArea
.
public boolean isFilledPlottingArea()
public void setFilledPlottingArea(boolean filled)
Note: The Bean property filledPlottingArea
must not be
specified together with the Bean property plotStyle
.
public final Paint getPlotBackground()
getPlotStyle()
public void setPlotBackground(Paint background)
Note: The Bean property plotBackground
must not be specified
together with the Bean property plotStyle
.
setPlotStyle(ilog.views.chart.IlvStyle)
public void setPlotBackground(Color[] colors, boolean xAxis)
colors
- The background colors. If more than one color is specified, a
gradient will be used to fill the background of the plotting
rectangle.xAxis
- Indicates the orientation of the gradient. If true
,
the gradient is created along the x-axis. If false
,
the gradient is created along the y-axis.public boolean isValidateRoot()
true
, so that a revalidate
call on the
child components does not invalidate the chart.isValidateRoot
in class JComponent
public boolean isDirectRedrawEnabled()
directRedraw
property.setDirectRedrawEnabled(boolean)
public void setDirectRedrawEnabled(boolean b)
directRedraw
property. When this property is set to
true
, redraw requests are automatically processed instead of
being posted and executed by the drawing thread. The default value of
this property is false
.isDirectRedrawEnabled()
public Dimension getPreferredSize()
getPreferredSize
in class JComponent
public Rectangle getDrawRect()
public Rectangle getPlotRect()
getDrawRect()
and the margins returned by getMargins()
. The
margins are either computed by an internal layout or specified explicitly
with the setMargins(java.awt.Insets)
, setHorizontalMargins(int, int)
and
setVerticalMargins(int, int)
methods.public Graphics getGraphics()
Graphics
takes into account the
antiAliasing
and antiAliasingText
property of
the chart.getGraphics
in class JComponent
null
if it
has none.IlvChart.setAntiAliasing(boolean)
,
IlvChart.setAntiAliasingText(boolean)
public void repaint()
directRedraw
property of the
chart is set to true
, this method performs the drawing
request immediately instead of posting it.repaint
in class Component
setDirectRedrawEnabled(boolean)
public final void repaint2D(Rectangle2D r)
public void repaint(IlvDataWindow dataWindow, int yAxisIdx)
protected void paintComponent(Graphics dst)
paintComponent
in class JComponent
public void paintCurrentThread(Graphics2D g, Color bgColor)
startSession()
and endSession()
.g
- Graphics context that interfaces to the graphics device.bgColor
- Background color, or null
to designate the
(possibly Swing Look&Feel dependent) default background
color.IlvChart.getPaintContext()
protected void processMouseEvent(MouseEvent event)
processMouseEvent
in class JComponent
IlvChart.addInteractor(ilog.views.chart.IlvChartInteractor)
protected void processMouseMotionEvent(MouseEvent event)
processMouseMotionEvent
in class JComponent
IlvChart.addInteractor(ilog.views.chart.IlvChartInteractor)
protected void processKeyEvent(KeyEvent event)
processKeyEvent
in class JComponent
IlvChart.addInteractor(ilog.views.chart.IlvChartInteractor)
public BufferedImage toImage(int width, int height, Color bgColor)
BufferedImage
object. The
operation is performed in the caller Thread
.width
- The width of the image. Must be > 0.height
- The height of the image. Must be > 0.bgColor
- Background color, or null
to designate the
(possibly Swing Look&Feel dependent) default background
color.IlvChart.toImage(int,int,Color)
public BufferedImage toImage(BufferedImage image, boolean erase)
BufferedImage
object. The
operation is performed in the AWT-Event Thread.image
- The destination image. If null
, a new image is
created.erase
- Indicates whether the specified image should be erased. This
parameter is only taken into account if the image is not
null
.public void toPNG(OutputStream output, boolean transparent) throws IOException
output
- The output stream.transparent
- Specifies whether the generated PNG image should have a
transparent background.IOException
- An error occurred during the encoding process.public void toPNG(OutputStream output) throws IOException
toPNG(output, false)
. The operation is performed in the
AWT-Event Thread.output
- The output stream.IOException
- An error occurred during the encoding process.toPNG(OutputStream, boolean)
public void toJPEG(OutputStream output) throws IOException
output
- The output stream.IOException
- An error occurred during the encoding process.public void setBounds(int x, int y, int w, int h)
public void revalidate()
revalidateLayout()
.revalidate
in class JComponent
public void revalidateLayout()
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.