|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
com.objectplanet.chart.ext.GaugeChart
Nested Class Summary |
Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
static int |
GRADIENT_PAINT_DIAGONAL1
Gradient paint from top left to bottom right |
static int |
GRADIENT_PAINT_DIAGONAL2
Gradient paint from bottom left to top right |
static int |
GRADIENT_PAINT_HORIZONTAL
Horizontal gradient paint |
static int |
GRADIENT_PAINT_VERTICAL
Vertical gradient paint |
static int |
POINTER_STYLE_ARROW
Used to display pointer as an arrow |
static int |
POINTER_STYLE_LINE
Used to display pointer as a line |
static int |
POINTER_STYLE_TRIANGLE
Used to display pointer as a triangle |
static int |
RANGE_LABEL_INSIDE
Range labels display inside the gauge. |
static int |
RANGE_LABEL_OUTSIDE
Range labels display outside the gauge. |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
GaugeChart()
Creates a gauge chart. |
Method Summary | |
void |
addImage(java.lang.String name,
java.awt.Image image)
Adds an image to the chart. |
void |
addItemListener(java.awt.event.ItemListener l)
Adds an item listener to the chart. |
void |
autoRepaint()
Calls repaint() if the automaticRepaintOn is turned on. |
protected int |
checkSelection(java.awt.Point point)
This method is called when the user releases the mouse and checks if the given point is inside a series. |
java.awt.Image |
createImage(int width,
int height)
Creates an offscreen image. |
java.lang.String |
formatRangeNumber(int index,
double value)
Formats a floating number to the number of decimals given for the specified range. |
java.awt.Color |
getBackground2()
Gets the secondary background of the chart component. |
java.awt.Color |
getBorderColor(int index)
Gets color of the specified border. |
int |
getBorderWidth(int index)
Gets width of the specified border. |
java.awt.Color |
getChartBackground()
Gets the color of the chart background itself. |
java.awt.Color |
getChartBackground2()
Gets the secondary background of the chart grid itself. |
java.awt.Color |
getChartForeground()
Gets the color of the chart foreground itself. |
int |
getEndAngle()
Gets the end angle of the gauge. |
java.awt.Font |
getFont(java.lang.String label)
Gets the font for the specified label. |
java.awt.Image |
getImage(java.lang.String name)
Gets the image with the specified name. |
protected java.awt.Dimension |
getImageSize(java.lang.String name)
Calculates the size of an image. |
java.lang.String |
getLabel(java.lang.String name)
Gets the specified label from the chart. |
java.awt.Color |
getLegendColor(int index)
Gets legend entry's color value by it's index. |
java.awt.Color[] |
getLegendColors()
Gets the legend colors. |
int |
getLegendColumns()
Gets the number of columns used to display the legend labels. |
java.lang.String |
getLegendImage(int index)
Gets a legend entry's image name. |
java.lang.String[] |
getLegendLabels()
Gets the legend labels. |
int |
getLegendPosition()
Gets the legend position. |
double |
getLowerRange()
Gets the lower value of the range. |
java.awt.Dimension |
getMinimumSize()
This method returns the minimum size of the chart. |
double |
getPointer(int index)
Gets value of the pointer with specified index. |
java.awt.Color |
getPointerColor(int index)
Gets color of the pointer with specified index. |
float |
getPointerSize(int index)
Gets size of the pointer with specified index. |
double |
getPointerStyle(int index)
Gets style of the pointer with specified index. |
java.awt.Dimension |
getPreferredSize()
This method is called by the awt, and returns the preferred size of the chart. |
double |
getRange()
Gets the upper value of the range. |
java.awt.Color |
getRangeColor(int range)
Returns color of the given range. |
int |
getRangeDecimalCount(int index)
Gets the number of decimals used in the range values. |
java.awt.Color |
getRangeHighlight()
Gets the range highlight color. |
double |
getRangeInterval()
Gets the interval between the ticks on the specified range. |
java.awt.Color |
getRangeLabelColor(int range)
Returns color of the range labels. |
int |
getRangeLabelStyle()
Gets style of the range labels. |
java.awt.Color |
getSectorColor(int index)
Gets color of the sector with specified index. |
double[] |
getSectorHighlight(int index)
Gets the start and the end values of the specified sector. |
int |
getSelectedElement(java.awt.Point point,
Legend legend)
This method is called when the user releases the mouse and checks if the given point is inside a sample. |
int |
getStartAngle()
Gets the start angle of the gauge. |
java.lang.String |
getTitle()
Gets the chart title. |
static java.lang.String |
getVersion()
Returns the current version of the charts. |
boolean |
isFloatingLabelsOn()
|
boolean |
isLegendOn()
Checks if the legend is turned on. |
boolean |
isLegendReverseOn()
Returns true if the inverted legend is on. |
boolean |
isRangeLabelsOn(int range)
Returns true if the range labels are turned on, false otherwise. |
boolean |
isServletModeOn()
Checks if the servlet mode is turned on. |
boolean |
isTitleOn()
Checks if the title is turned on. |
java.awt.Image |
loadImage(java.lang.String name)
Loads an image from the disk. |
void |
paint(java.awt.Graphics g)
This method is overridden to paint the chart using double buffering. |
protected void |
paintLabel(java.awt.Graphics g,
java.lang.String label,
int label_x,
int label_y,
java.awt.Dimension size,
int style,
int angle,
boolean underlined)
Paints a normal, multiline, and angled label. |
protected void |
paintLegend(java.awt.Graphics g,
Legend legend,
java.awt.Rectangle bounds,
java.lang.String[] labels)
Paints the legend. |
protected void |
paintLegendElement(java.awt.Graphics g,
Legend legend,
int index,
int xpos,
int ypos,
java.lang.String label,
java.awt.FontMetrics fm)
Paints the particular legend element. |
protected void |
processEvent(java.awt.AWTEvent event)
Handles the chart events. |
void |
removeBorder(int index)
Removes border with the specified index. |
void |
removeExternalGraphics()
Removes external graphics context if there is one. |
void |
removeItemListener(java.awt.event.ItemListener l)
Removes the specified item listener from the chart. |
void |
removePointer(int index)
Removes pointer with the specified index. |
void |
render(java.awt.Graphics g)
Renders the bar chart according to the current chart attributes and which charts features are turned on or off. |
void |
render(java.awt.Graphics g,
boolean offscreenOn)
Renders the gauge chart according to the current gauge attributes and which charts features are turned on or off. |
protected void |
renderOffScreen(java.awt.Graphics g)
A subclass should override this method to paint on top of the chart before it is painted to the AWT component. |
void |
setBackground(java.awt.Color color)
Sets the chart component background color, outside the gauge. |
void |
setBackground2(java.awt.Color color)
Sets the secondary chart component background color, outside the chart grid. |
void |
setBorder(int index,
int width)
Sets a border with the specified width (0-based). |
void |
setBorderColor(int index,
java.awt.Color color)
Sets color for the specified border. |
void |
setChartBackground(java.awt.Color color)
Sets the background color of the chart itself. |
void |
setChartBackground2(java.awt.Color color)
Sets the secondary background color of the chart itself. |
void |
setChartForeground(java.awt.Color color)
Sets the foreground color of the chart itself. |
void |
setEndAngle(int angle)
Sets the end angle of the gauge. |
void |
setExternalGraphics(java.awt.Graphics g,
java.awt.Image image)
Sets an external graphics context to paint with. |
void |
setFloatingLabelsOn(boolean on)
Turns floating labels over the range and pointers on or off. |
void |
setFont(java.lang.String label,
java.awt.Font font)
Sets the font for the specified label. |
void |
setForeground(java.awt.Color color)
Sets the color of the labels. |
void |
setLabel(java.lang.String name,
java.lang.String label)
Sets the specified label in the chart. |
void |
setLegendColor(int index,
java.awt.Color color)
Sets a legend entry color. |
void |
setLegendColors(java.awt.Color[] colors)
Sets the legend colors. |
void |
setLegendColumns(int columns)
Sets the number of columns that should be used to display legend labels. |
void |
setLegendImage(int index,
java.lang.String name)
Sets an image to be used in front of the legend label. |
void |
setLegendLabels(java.lang.String[] labels)
Sets the legend labels. |
void |
setLegendOn(boolean on)
Turns on or off the label legend. |
void |
setLegendPosition(int position)
Sets the legend position. |
void |
setLegendReverseOn(boolean on)
Set on or off the inverted legend. |
void |
setLowerRange(double value)
Sets the lower value of the range. |
void |
setPointer(int index,
double value)
Sets a pointer with the specified index (0-based). |
void |
setPointerColor(int index,
java.awt.Color color)
Sets color for a pointer with the specified index (0-based). |
void |
setPointerSize(int index,
float size)
Sets style for the pointer with specified index (0-based). |
void |
setPointerStyle(int index,
int style)
Sets style for the pointer with specified index (0-based). |
void |
setPreferredSize(int width,
int height)
Sets the preferred size of the chart. |
void |
setRange(double value)
Sets the upper value of the range. |
void |
setRangeColor(int range,
java.awt.Color color)
Sets color of the range. |
void |
setRangeDecimalCount(int index,
int count)
Sets the number of decimals to use in the range label values. |
void |
setRangeHighlight(java.awt.Color color)
Sets the range highlight color |
void |
setRangeInterval(double interval)
Sets interval between the ticks on the specified range. |
void |
setRangeLabelColor(int range,
java.awt.Color color)
Sets color of the range labels. |
void |
setRangeLabelsOn(int range,
boolean on)
Turns labels of the given range on or off. |
void |
setRangeLabelStyle(int style)
Sets style of the range labels. |
void |
setSectorColor(int index,
java.awt.Color color)
Sets color for a specified highlight sector. |
void |
setSectorHighlight(int index,
double start,
double end)
Sets a highlighted sector with the specified start and end values in the gauge's range. |
void |
setServletModeOn(boolean on)
Turns on or off servlet mode. |
void |
setStartAngle(int angle)
Sets the start angle of the gauge. |
void |
setTitle(java.lang.String title)
Sets the chart title. |
void |
setTitleOn(boolean on)
Turns on or off the chart title. |
void |
update(java.awt.Graphics g)
This method is overridden to avoid flicker when the chart is repainted. |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int GRADIENT_PAINT_DIAGONAL1
public static final int GRADIENT_PAINT_DIAGONAL2
public static final int GRADIENT_PAINT_HORIZONTAL
public static final int GRADIENT_PAINT_VERTICAL
public static final int POINTER_STYLE_ARROW
public static final int POINTER_STYLE_LINE
public static final int POINTER_STYLE_TRIANGLE
public static final int RANGE_LABEL_INSIDE
public static final int RANGE_LABEL_OUTSIDE
Constructor Detail |
public GaugeChart()
Method Detail |
public void addImage(java.lang.String name, java.awt.Image image)
name
- The unique name of the imageimage
- The image to add, use null to remove the image.public void addItemListener(java.awt.event.ItemListener l)
l
- The item listener to add.removeItemListener(java.awt.event.ItemListener)
public void autoRepaint()
protected int checkSelection(java.awt.Point point)
point
- The point to check for.
public java.awt.Image createImage(int width, int height)
width
- The width of the image in pixels.height
- The height of the image in pixels.public java.lang.String formatRangeNumber(int index, double value)
index
- The range index.value
- The value to format.
public java.awt.Color getBackground2()
public java.awt.Color getBorderColor(int index)
index
- The index of the border (0-based).
public int getBorderWidth(int index)
index
- The index of the border (0-based).
java.lang.IllegalArgumentException
- if the index is invalid.public java.awt.Color getChartBackground()
public java.awt.Color getChartBackground2()
public java.awt.Color getChartForeground()
public int getEndAngle()
public java.awt.Font getFont(java.lang.String label)
label
- The name of the label.
public java.awt.Image getImage(java.lang.String name)
name
- The name of the image.
protected java.awt.Dimension getImageSize(java.lang.String name)
name
- The name of the image to check size for.
public java.lang.String getLabel(java.lang.String name)
name
- The name of the label.
setLabel(java.lang.String, java.lang.String)
public java.awt.Color getLegendColor(int index)
index
- The index of the legend entry to get color from.
public java.awt.Color[] getLegendColors()
public int getLegendColumns()
public java.lang.String getLegendImage(int index)
index
- The index of the legend entry.
public java.lang.String[] getLegendLabels()
setLegendLabels(java.lang.String[])
public int getLegendPosition()
public double getLowerRange()
public java.awt.Dimension getMinimumSize()
public double getPointer(int index)
index
- The index of the pointer (0-based).
java.lang.IllegalArgumentException
- if the index is invalid.public java.awt.Color getPointerColor(int index)
index
- The index of the pointer (0-based).
public float getPointerSize(int index)
index
- The index of the pointer (0-based).
public double getPointerStyle(int index)
index
- The index of the pointer (0-based).
java.lang.IllegalArgumentException
- if the index is invalid.public java.awt.Dimension getPreferredSize()
public double getRange()
public java.awt.Color getRangeColor(int range)
range
- Index of the range.
public int getRangeDecimalCount(int index)
index
- The index of the range.public java.awt.Color getRangeHighlight()
public double getRangeInterval()
public java.awt.Color getRangeLabelColor(int range)
range
- Index of the range.
public int getRangeLabelStyle()
public java.awt.Color getSectorColor(int index)
index
- The index of the highlighted sector (0-based).
public double[] getSectorHighlight(int index)
index
- The index of the highlighted sector (0-based).
java.lang.IllegalArgumentException
- if the index is invalid.public int getSelectedElement(java.awt.Point point, Legend legend)
point
- The point to check for.legend
- The legend to paint.
public int getStartAngle()
public java.lang.String getTitle()
setTitle(java.lang.String)
public static java.lang.String getVersion()
public boolean isFloatingLabelsOn()
public boolean isLegendOn()
public boolean isLegendReverseOn()
public boolean isRangeLabelsOn(int range)
range
- Index of the range.
public boolean isServletModeOn()
public boolean isTitleOn()
public java.awt.Image loadImage(java.lang.String name)
name
- The file name of the image.
public final void paint(java.awt.Graphics g)
protected void paintLabel(java.awt.Graphics g, java.lang.String label, int label_x, int label_y, java.awt.Dimension size, int style, int angle, boolean underlined)
g
- The graphics context used to paint with.label
- The label to paint.label_x
- The x position of the label.label_y
- The y position of the label.size
- The size of the unrotated label.style
- -1 for left, 0 for center, 1 for right.angle
- The degrees to turn the label (only 0, 90, 180, 270 works fine).underlined
- If true the label is underlined (can be used for URLs, ony for non-angled labels).protected void paintLegend(java.awt.Graphics g, Legend legend, java.awt.Rectangle bounds, java.lang.String[] labels)
g
- The graphics context used to paint with.legend
- The legend to paint.bounds
- The chart grid bounds.labels
- The labels of the legend.protected void paintLegendElement(java.awt.Graphics g, Legend legend, int index, int xpos, int ypos, java.lang.String label, java.awt.FontMetrics fm)
g
- The graphics context used to paint with.legend
- The legend to paint.index
- The index of element inside the legend.xpos
- The x position if the element.ypos
- The y position if the element.label
- The legend label.fm
- The font metrics used to paint label with.protected void processEvent(java.awt.AWTEvent event)
event
- The event to process.public void removeBorder(int index)
index
- The index of the border (0-based).
java.lang.IllegalArgumentException
- if the index is invalid.public void removeExternalGraphics()
setExternalGraphics(java.awt.Graphics, java.awt.Image)
public void removeItemListener(java.awt.event.ItemListener l)
l
- The item listener to remove.addItemListener(java.awt.event.ItemListener)
public void removePointer(int index)
index
- The index of the pointer (0-based).
java.lang.IllegalArgumentException
- if the index is invalid.public void render(java.awt.Graphics g)
public final void render(java.awt.Graphics g, boolean offscreenOn)
protected void renderOffScreen(java.awt.Graphics g)
g
- The graphics context used to paint with.public void setBackground(java.awt.Color color)
color
- The color to use.public void setBackground2(java.awt.Color color)
color
- The color to use.setChartBackground(java.awt.Color)
public void setBorder(int index, int width)
index
- The index of the border.width
- The width of the borderpublic void setBorderColor(int index, java.awt.Color color)
index
- The index of the border.color
- The color of the border.public void setChartBackground(java.awt.Color color)
color
- The color to use.public void setChartBackground2(java.awt.Color color)
color
- The color to use.public void setChartForeground(java.awt.Color color)
color
- The color to use.public void setEndAngle(int angle)
angle
- The end angle.public void setExternalGraphics(java.awt.Graphics g, java.awt.Image image)
g
- The graphics context used for painting.image
- The image to which graphics context belongs.
See here for an example.public void setFloatingLabelsOn(boolean on)
on
- True if the floating labels should be turned on, false otherwise.public void setFont(java.lang.String label, java.awt.Font font)
label
- "titleFont" or "rangeLabelFont".font
- The font to set for the label.public void setForeground(java.awt.Color color)
color
- The color to use.public void setLabel(java.lang.String name, java.lang.String label)
name
- The name of the label.label
- The label to use, null for no label.public void setLegendColor(int index, java.awt.Color color)
index
- The index of the legend entry to set Color for.color
- The color to set for the legend entry.setLegendColors(java.awt.Color[])
,
setLegendImage(int, java.lang.String)
public void setLegendColors(java.awt.Color[] colors)
colors
- The array with legend colors.
java.lang.IllegalArgumentException
- if the colors is null.setLegendColors(java.awt.Color[])
,
setLegendImage(int, java.lang.String)
public void setLegendColumns(int columns)
columns
- Number of columns to display legends on. If columns is
set to 0, the default legend rendering is used.public void setLegendImage(int index, java.lang.String name)
index
- The index of the legend entry to set the image for.name
- The image to use, null for the default legend box.addImage(java.lang.String, java.awt.Image)
public void setLegendLabels(java.lang.String[] labels)
labels
- The labels to use, null for default behavior.public void setLegendOn(boolean on)
on
- True if the legend should be displayed.setLegendPosition(int)
public void setLegendPosition(int position)
position
- TOP, BOTTOM, LEFT, or RIGHT.
java.lang.IllegalArgumentException
- If the position is invalid.public void setLegendReverseOn(boolean on)
on
- If true the legend entryes are displayed from bottom to
top and from right to left.public void setLowerRange(double value)
value
- The range value to set.public void setPointer(int index, double value)
index
- The index of the pointer (0-based).value
- The value of the pointer.public void setPointerColor(int index, java.awt.Color color)
index
- The index of the pointer (0-based).color
- The color of the pointer.public void setPointerSize(int index, float size)
index
- The index of the pointer (0-based).size
- The size of the pointer (a float value from 0.0 to 2.0,
where the standart value is 1.0)public void setPointerStyle(int index, int style)
index
- The index of the pointer (0-based).style
- The type of the pointer (POINTER_TYPE_LINE, POINTER_TYPE_TRIANGLE,
POINTER_TYPE_ARROW).public void setPreferredSize(int width, int height)
width
- The preferred width.height
- The preferred height.public void setRange(double value)
value
- The range value to set.public void setRangeColor(int range, java.awt.Color color)
range
- Index of the range.color
- Color of the range.public void setRangeDecimalCount(int index, int count)
index
- The index of the range (0 or 1).count
- The number of decimals to use.public void setRangeHighlight(java.awt.Color color)
color
- The color highlight the range withpublic void setRangeInterval(double interval)
interval
- The interval between the to range ticks.public void setRangeLabelColor(int range, java.awt.Color color)
range
- Index of the range.color
- Color of the range labels.public void setRangeLabelsOn(int range, boolean on)
range
- Index of the range.on
- True if the reange labels should be turned on, false otherwise.public void setRangeLabelStyle(int style)
style
- The style of the range labels (INSIDE | OUTSIDE).public void setSectorColor(int index, java.awt.Color color)
index
- The index of the sector.color
- The color of the sector.public void setSectorHighlight(int index, double start, double end)
index
- The index of the sector.start
- The start value of the sector.end
- The end value of the sector.public void setServletModeOn(boolean on)
on
- True for servlet mode on, false for
servlet mode off.public void setStartAngle(int angle)
angle
- The start angle.public void setTitle(java.lang.String title)
title
- The title to set.getTitle()
,
setTitleOn(boolean)
public void setTitleOn(boolean on)
on
- True for on, false for off.setTitle(java.lang.String)
public final void update(java.awt.Graphics g)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |