Overview | Package | Class | Tree | Index | Help NetCharts Pro (Applets) 7.0
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

netcharts.graphics
Class NFAxis

java.lang.Object
  |
  +--netcharts.graphics.NFAbstractAxis
        |
        +--netcharts.graphics.NFAxis

public class NFAxis
extends NFAbstractAxis
The NFAxis object provides tic marks and labels along a given axis from (x1,y1) to (x2,y2), mapping a range of values between (min, max).

Tic spacing is determined by designating a number of tics, the stepsize between tics (in terms of min & max), or by assigning a NFSpacing object. If none of these parameters are defined, tics will be automatically generated based on the (min,max) values and the physical size of the axis.

Labels can be automatically generated based on the (min,max) values (default) or can be defined by a Vector of Strings. The rendering of tic labels is controlled using a NFLabel object.


Inner Class Summary
static  NFAxis.NFAxisCreator
           
 
Field Summary
static int AUTO
          autoskipstagger tic labels
static int AUTOSKIP
          autoskip tic labels
static int AUTOSTAGGER
          autostagger tic labels
int beginMargin
          The beginning margin.
int endMargin
          The ending margin.
static int LINEAR
          Linear Scale Mode
static int LOG
          Log Scale Mode
static int NORMAL
          no skip/stagger
static int SKIP
          skip tic labels
static int SKIPSTAGGER
          skip and stagger tic labels
static int STAGGER
          stagger tic labels
static int TicBottom
          Tic below axis
static int TicDefault
          Use default tic position
static int TicLeft
          Tic left of axis
static int TicRight
          Tic right of axis
static int TicTop
          Tic above axis
 
Fields inherited from class netcharts.graphics.NFAbstractAxis
DATE, DECIMAL, decSymbol, FLOAT, groupSize, groupSymbol, INTEGER, SIMPLEDATE
 
Constructor Summary
NFAxis(int x1, int y1, int dx, int dy)
          Create a NFAxis object, using the given screen coordinates for the rendering location.
 
Method Summary
boolean abortPreScroll(double newmin, double newmax)
          Determine if the scroll should be aborted or not.
void addObserver(java.lang.Object observer)
          Add a ScrollObserver.
static NFAxis defaultAxis(java.lang.String name)
          Create a default NFAxis object based on the name given, which can be either Top, Bottom, Left or Right.
static void defineAxis(NFParam param, java.lang.String name, java.lang.String XY)
          Define an Axis for the given parameter name and XY string.
void display(java.awt.Graphics g)
          Display the axis in the given graphics context.
java.awt.Dimension getBounds(java.awt.Graphics g)
          Returns the amount of screen space required to display the axis, including all labels and tics.
boolean getChanged()
          Returns true if the axis has changed and needs to be repainted
boolean getDrawMinorTics()
          Get the draw minor tics boolean.
int getMaxCoord()
          Returns the maximum screen coordinate for the current axis, which should be either purely horizontal or purely vertical.
int getMinCoord()
          Returns the minimum screen coordinate for the current axis, which should be either purely horizontal or purely vertical.
int getMinimumThumbSize()
          Get the specified minimum thumb size.
java.awt.Point getNthPoint(int i)
          Returns the Nth tic position in screen coordinates.
java.awt.Point getNthPoint(int i, java.awt.Point pt)
          Returns the Nth tic position in screen coordinates.
java.awt.Rectangle getRect(java.awt.Graphics g)
          Returns the rectangle that the Axis occupies, including all labels and tics.
java.awt.Rectangle getRect(java.awt.Graphics g, java.awt.Rectangle r)
          Returns the rectangle that the Axis occupies, including all labels and tics.
int getScaleMode()
          Get the ScaleMode, LOG or LINEAR.
double getScaleModeBase()
          Get the ScaleMode base for when ScaleMode is LOG.
double[] getScrollLimits()
          Returns the min/max values for the scroll limits, with the min value returned as the first element in a two item array.
int getSkipCount()
          Get the skip count
int getStaggerLevels()
          Get the stagger levels
int getTicLength()
          Returns the length of the tics used for this axis.
int getTicPosition()
          Returns the current tic position for this axis.
boolean isSliderOn()
          Returns true if scrolling is enabled.
static NFAxis loadAxis(java.awt.Component comp, NFParam param, java.lang.String name, NFAxis axis, NFActiveRegion dwell)
          Create an axis from the parameters.
static NFAxis loadAxis(NFParam param, java.lang.String name, NFAxis axis, NFActiveRegion dwell)
          Create an axis from the parameters.
static NFAxis loadAxisFormat(NFParam param, java.lang.String name, NFAxis axis)
          Load the Axis format into the given axis.
void loadAxisTics(java.util.Vector data)
          Load the axis tics from the given Vector.
void loadAxisTics(java.util.Vector data, double scale)
          Load the axis tics from the given Vector.
void loadScaleSet(java.util.Vector v)
          Set the scale set.
java.awt.Point mapValue(double v)
          Returns a screen position along the axis corresponding to the given value, which may be within (min,max) or not.
java.awt.Point mapValue(double v, java.awt.Point pt)
          Returns a screen position along the axis corresponding to the given value, which may be within (min,max) or not.
boolean mouseDown(java.awt.Event evt, int x, int y)
          Handle the mouse down event for the axis.
boolean mouseDrag(java.awt.Event evt, int x, int y)
          Handle the mouse drag event for the axis.
boolean mouseUp(java.awt.Event evt, int x, int y)
          Handle the mouse up event for the axis.
void notifyPostScroll()
          Notify the observers that a scroll occured.
void removeObserver(java.lang.Object observer)
          Remove a ScrollObserver.
boolean scroll(int direction)
          This method can be used to scroll the axis a given driection, which may be any of the following:
  • Event.UP
  • Event.DOWN
  • Event.LEFT
  • Event.RIGHT
boolean scrollTo(double newmin)
          Scroll to the given min position.
void setAxis(int x1, int y1, int dx, int dy)
          Specifies the screen coordinates for the axis.
void setAxisColor(java.awt.Color c)
          Set the axis color
void setMinMax(double min, double max)
          Sets axis minimum and maximum values to the given values.
boolean setMinMaxRect(int x, int y, int w, int h)
          Sets the min/max axis values based on the given rectangle defined using screen coordinates.
void setNumberFormat(int groupSize, char groupSymbol, char decSymbol)
          This method can be used to set the group size, symbol and decimal symbol to be used when formatting whole numbers.
void setScale(double scale)
          Set the scale factor.
void setScaleMode(int mode)
          Set the ScaleMode, LOG or LINEAR.
void setScaleModeBase(double scaleBase)
          Set the ScaleMode base for when ScaleMode is LOG.
void setScroll(boolean onoff)
          Set scrolling mode on (true) or off (false)
void setScrollLimits(double min, double max)
          Sets the absolute min and max values over which the axis can scroll.
void setScrollLimits(java.lang.Object min, java.lang.Object max)
          Sets the absolute min and max values over which the axis can scroll, based on the given objects, which can be any of the following types:
  • NFDate
  • NFTimeUnit
  • Number
void setTicLabel(NFLabel ticLabel)
          Sets label parameters to be used for each of the axis labels.
void setTicLayout(int mode, int skipCount, int staggerLevels)
          Set the tic layout attributes
void setTicLength(int ticLength)
          Changes the length of the axis tics.
void setTicPosition(int ticPosition)
          Sets the tic position
java.lang.String toString()
          Return the String representation of the axis.
double unMapValue(double val)
          Returns the numeric value for the given pixel coordinate along the current axis.
boolean zoomHome()
          This method can be called to cause the axis to zoom out as far as possible.
boolean zoomIn()
          This method can be called to cause the axis to zoom in, if possible.
boolean zoomOut()
          This method can be called to cause the axis to zoom out, if possible.
 
Methods inherited from class netcharts.graphics.NFAbstractAxis
autoGeneratedLabel, clearTicLabels, getColor, getDecimalSymbol, getGroupSize, getGroupSymbol, getLabel, getLabel, getLabel, getLabel, getMajorTicColor, getMax, getMin, getMinorTicColor, getNthPoint, getShowAxis, getShowTics, getSpacing, getStepSize, getTicLabel, getTicLabels, getTitleLabel, getValue, mapValue, mapValue, reasonableStep, setActiveLabels, setAxis, setColor, setMajorTicColor, setMinorTicColor, setNumberFormat, setScale, setSpacing, setTicDivisions, setTicDivisions, setTicDivisions, setTicLabel, setTicLabels, setTicLabels, setTicLocations, setTitleLabel, setup, showAxis, showAxisAndLine, showAxisLine, showAxisTitle, showTicLabels, showTics, showTicsAndLabels
 

Field Detail

TicDefault

public static final int TicDefault
Use default tic position

TicTop

public static final int TicTop
Tic above axis

TicLeft

public static final int TicLeft
Tic left of axis

TicRight

public static final int TicRight
Tic right of axis

TicBottom

public static final int TicBottom
Tic below axis

NORMAL

public static final int NORMAL
no skip/stagger

SKIP

public static final int SKIP
skip tic labels

STAGGER

public static final int STAGGER
stagger tic labels

SKIPSTAGGER

public static final int SKIPSTAGGER
skip and stagger tic labels

AUTOSKIP

public static final int AUTOSKIP
autoskip tic labels

AUTOSTAGGER

public static final int AUTOSTAGGER
autostagger tic labels

AUTO

public static final int AUTO
autoskipstagger tic labels

LINEAR

public static final int LINEAR
Linear Scale Mode

LOG

public static final int LOG
Log Scale Mode

beginMargin

protected int beginMargin
The beginning margin.

endMargin

protected int endMargin
The ending margin.
Constructor Detail

NFAxis

public NFAxis(int x1,
              int y1,
              int dx,
              int dy)
Create a NFAxis object, using the given screen coordinates for the rendering location.
Parameters:
x1 - The X coordinate.
y1 - The Y coordinate.
dx - The change in the X coordinate.
dy - The change in the Y coordinate.
Method Detail

defaultAxis

public static NFAxis defaultAxis(java.lang.String name)
Create a default NFAxis object based on the name given, which can be either Top, Bottom, Left or Right.
Parameters:
name - The location of the Axis in the Chart.
Returns:
An Axis for the desired location.

setAxis

public void setAxis(int x1,
                    int y1,
                    int dx,
                    int dy)
Specifies the screen coordinates for the axis. This allows an application to move the axis around without affecting any rendering attributes.
Parameters:
x1 - The X coordinate.
y1 - The Y coordinate.
dx - The change in the X coordinate.
dy - The change in the Y coordinate.
Overrides:
setAxis in class NFAbstractAxis

loadScaleSet

public void loadScaleSet(java.util.Vector v)
Set the scale set.
Parameters:
v - The scaleSet to set.

setTicLayout

public void setTicLayout(int mode,
                         int skipCount,
                         int staggerLevels)
Set the tic layout attributes
Parameters:
mode - The mode of the axis layout.
skipCount - The skip count.
staggerLevels - The stagger levels.

setTicLength

public void setTicLength(int ticLength)
Changes the length of the axis tics.
Parameters:
ticLength - The tic length to set.

setTicPosition

public void setTicPosition(int ticPosition)
Sets the tic position
Parameters:
ticPosition - The tic position to set.

getTicPosition

public int getTicPosition()
Returns the current tic position for this axis.
Returns:
The tic position.

setTicLabel

public void setTicLabel(NFLabel ticLabel)
Sets label parameters to be used for each of the axis labels.
Parameters:
ticLabel - The NFLbael to use to draw the tic labels.
Overrides:
setTicLabel in class NFAbstractAxis

setAxisColor

public void setAxisColor(java.awt.Color c)
Set the axis color
Parameters:
The - axis color to set.

setMinMax

public void setMinMax(double min,
                      double max)
Sets axis minimum and maximum values to the given values.
Parameters:
min - The minimum.
max - The maximum.

setMinMaxRect

public boolean setMinMaxRect(int x,
                             int y,
                             int w,
                             int h)
Sets the min/max axis values based on the given rectangle defined using screen coordinates.
Parameters:
x - The X coordinate.
y - The Y coordinate.
w - The width.
h - The height.
Returns:
true if the zoom to was successful, false otherwise.

setScrollLimits

public void setScrollLimits(double min,
                            double max)
Sets the absolute min and max values over which the axis can scroll.
Parameters:
min - The minimum.
max - The maximum.

setScrollLimits

public void setScrollLimits(java.lang.Object min,
                            java.lang.Object max)
Sets the absolute min and max values over which the axis can scroll, based on the given objects, which can be any of the following types:
Parameters:
min - The minimum.
max - The maximum.

getScrollLimits

public double[] getScrollLimits()
Returns the min/max values for the scroll limits, with the min value returned as the first element in a two item array.
Returns:
The minimum and maximum in an array.

setScroll

public void setScroll(boolean onoff)
Set scrolling mode on (true) or off (false)
Parameters:
onoff - Whether to turn scrolling on or off.

getMinCoord

public int getMinCoord()
Returns the minimum screen coordinate for the current axis, which should be either purely horizontal or purely vertical.
Returns:
The minimum coordinate.

getMaxCoord

public int getMaxCoord()
Returns the maximum screen coordinate for the current axis, which should be either purely horizontal or purely vertical.
Returns:
The maximum coordinate.

getChanged

public boolean getChanged()
Returns true if the axis has changed and needs to be repainted
Returns:
true if the axis has been changed, false otherwise.

getTicLength

public int getTicLength()
Returns the length of the tics used for this axis.
Returns:
The tic length.

getBounds

public java.awt.Dimension getBounds(java.awt.Graphics g)
Returns the amount of screen space required to display the axis, including all labels and tics.
Parameters:
g - The Graphics to use for font metric information.
Returns:
The bounds.

getRect

public java.awt.Rectangle getRect(java.awt.Graphics g)
Returns the rectangle that the Axis occupies, including all labels and tics.
Parameters:
g - The Graphics to use for font metric information.
Returns:
The bounds.

getRect

public java.awt.Rectangle getRect(java.awt.Graphics g,
                         java.awt.Rectangle r)
Returns the rectangle that the Axis occupies, including all labels and tics. The values are returned in the given rectangle instead of creating a new object. If the given rect is null, then a new object is created anyway.
Parameters:
g - The Graphics to use for font metric information.
r - The Rectangle to store the result in.
Returns:
The bounds.

getNthPoint

public java.awt.Point getNthPoint(int i)
Returns the Nth tic position in screen coordinates.
Parameters:
i - The index of the point.
Returns:
The point.
Overrides:
getNthPoint in class NFAbstractAxis

getNthPoint

public java.awt.Point getNthPoint(int i,
                         java.awt.Point pt)
Returns the Nth tic position in screen coordinates. The values are returned in the given pt, instead of creating a new object
Parameters:
i - The index of the point.
pt - The Point to put the result in.
Returns:
The point.

mapValue

public java.awt.Point mapValue(double v)
Returns a screen position along the axis corresponding to the given value, which may be within (min,max) or not. If the value is outside (min,max), then the screen position will be outside of the bounds of the axis.
Parameters:
v - The value to map to the axis.
Returns:
The point.
Overrides:
mapValue in class NFAbstractAxis

mapValue

public java.awt.Point mapValue(double v,
                      java.awt.Point pt)
Returns a screen position along the axis corresponding to the given value, which may be within (min,max) or not. If the value is outside (min,max), then the screen position will be outside of the bounds of the axis.

The given pt is used to hold the return values, instead of generating a new object.

Parameters:
v - The value to map to the axis.
pt - The Point to put the result in.
Returns:
The point.

unMapValue

public double unMapValue(double val)
Returns the numeric value for the given pixel coordinate along the current axis.
Parameters:
val - The mapped value.
Returns:
The original, unmapped value.

display

public void display(java.awt.Graphics g)
Display the axis in the given graphics context.
Parameters:
g - The Graphics to draw on.

isSliderOn

public boolean isSliderOn()
Returns true if scrolling is enabled.
Returns:
true if the slider is on, false otherwise.

mouseDown

public boolean mouseDown(java.awt.Event evt,
                         int x,
                         int y)
Handle the mouse down event for the axis.
Parameters:
evt - The Event.
x - The X coordinate.
y - The Y coordinate.
Returns:
true if the event was handled, false otherwise.

mouseDrag

public boolean mouseDrag(java.awt.Event evt,
                         int x,
                         int y)
Handle the mouse drag event for the axis.
Parameters:
evt - The Event.
x - The X coordinate.
y - The Y coordinate.
Returns:
true if the event was handled, false otherwise.

mouseUp

public boolean mouseUp(java.awt.Event evt,
                       int x,
                       int y)
Handle the mouse up event for the axis.
Parameters:
evt - The Event.
x - The X coordinate.
y - The Y coordinate.
Returns:
true if the event was handled, false otherwise.

scroll

public boolean scroll(int direction)
This method can be used to scroll the axis a given driection, which may be any of the following:

It returns true if the axis settings changed and the graph should be redrawn.

Parameters:
direction - The direction to scroll.
Returns:
true if the scroll occured, false otherwise.

scrollTo

public boolean scrollTo(double newmin)
Scroll to the given min position. Leave the current slider bar width the same.
Parameters:
newmin - The new minimum value.
Returns:
true if the scroll occured, false otherwise.

zoomOut

public boolean zoomOut()
This method can be called to cause the axis to zoom out, if possible. It returns true, if the axis settings changed and the graph should be redrawn.
Returns:
true if the zoom to was successful, false otherwise.

zoomIn

public boolean zoomIn()
This method can be called to cause the axis to zoom in, if possible. It returns true, if the axis settings changed and the graph should be redrawn.
Returns:
true if the zoom to was successful, false otherwise.

zoomHome

public boolean zoomHome()
This method can be called to cause the axis to zoom out as far as possible. It returns true, if the axis settings changed and the graph should be redrawn.
Returns:
true if the zoom to was successful, false otherwise.

defineAxis

public static void defineAxis(NFParam param,
                              java.lang.String name,
                              java.lang.String XY)
Define an Axis for the given parameter name and XY string.
Parameters:
param - The NFParam to define the parameters within.
name - The parameter name.
XY - The XY string.

loadAxisFormat

public static NFAxis loadAxisFormat(NFParam param,
                                    java.lang.String name,
                                    NFAxis axis)
                                               throws java.lang.Exception
Load the Axis format into the given axis.
Parameters:
param - The NFParam to load the parameters from.
name - The parameter name.
axis - The axis to load the parameters into.
Returns:
The axis.
Throws:
java.lang.Exception - If there was a error loading the parameters.

loadAxisTics

public void loadAxisTics(java.util.Vector data)
Load the axis tics from the given Vector.
Parameters:
data - The tics.

loadAxisTics

public void loadAxisTics(java.util.Vector data,
                         double scale)
Load the axis tics from the given Vector.
Parameters:
data - The tics.
scale - The scale factor.

setScale

public void setScale(double scale)
Set the scale factor.
Parameters:
scale - The scale factor.
Overrides:
setScale in class NFAbstractAxis

loadAxis

public static NFAxis loadAxis(NFParam param,
                              java.lang.String name,
                              NFAxis axis,
                              NFActiveRegion dwell)
                                         throws java.lang.Exception
Create an axis from the parameters.
Parameters:
param - The NFParam to load the parameters from.
name - The parameter name.
axis - The axis to store the result in.
dwell - The ActiveRegion.
Returns:
The axis.
Throws:
java.lang.Exception - If there was a error loading the parameters.

loadAxis

public static NFAxis loadAxis(java.awt.Component comp,
                              NFParam param,
                              java.lang.String name,
                              NFAxis axis,
                              NFActiveRegion dwell)
                                         throws java.lang.Exception
Create an axis from the parameters.
Parameters:
comp - The Component.
param - The NFParam to load the parameters from.
name - The parameter name.
axis - The axis to store the result in.
dwell - The ActiveRegion.
Returns:
The axis.
Throws:
java.lang.Exception - If there was a error loading the parameters.

toString

public java.lang.String toString()
Return the String representation of the axis.
Returns:
The string representation.
Overrides:
toString in class java.lang.Object

getScaleMode

public int getScaleMode()
Get the ScaleMode, LOG or LINEAR.

setScaleMode

public void setScaleMode(int mode)
Set the ScaleMode, LOG or LINEAR.
Parameters:
mode - The new mode.

getScaleModeBase

public double getScaleModeBase()
Get the ScaleMode base for when ScaleMode is LOG.

setScaleModeBase

public void setScaleModeBase(double scaleBase)
Set the ScaleMode base for when ScaleMode is LOG.
Parameters:
scaleBase - The new base.

addObserver

public void addObserver(java.lang.Object observer)
Add a ScrollObserver.
Parameters:
observer - The observer to add.

removeObserver

public void removeObserver(java.lang.Object observer)
Remove a ScrollObserver.
Parameters:
observer - The observer to remove.

abortPreScroll

public boolean abortPreScroll(double newmin,
                              double newmax)
Determine if the scroll should be aborted or not.
Parameters:
newmin - The new minimum.
newmax - The new maximum.
Returns:
true if the scroll should be aborted, false otherwise.

notifyPostScroll

public void notifyPostScroll()
Notify the observers that a scroll occured.

setNumberFormat

public void setNumberFormat(int groupSize,
                            char groupSymbol,
                            char decSymbol)
This method can be used to set the group size, symbol and decimal symbol to be used when formatting whole numbers. By default, no grouping is done. Common values are a groupSize of 3 and a groupSymbol of ','
Parameters:
groupSize - The grouping size.
groupSymbol - The grouping symbol.
decSymbol - The decimal symbol.
Overrides:
setNumberFormat in class NFAbstractAxis

getSkipCount

public int getSkipCount()
Get the skip count
Returns:
The skip count.

getStaggerLevels

public int getStaggerLevels()
Get the stagger levels
Returns:
The stagger levels.

getDrawMinorTics

public boolean getDrawMinorTics()
Get the draw minor tics boolean.
Returns:
Whether to draw minor tics or not.

getMinimumThumbSize

public int getMinimumThumbSize()
Get the specified minimum thumb size.
Returns:
The specified minimum thumb size.

Overview | Package | Class | Tree | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD


Visual Mining, Inc.
2099 Gaither Grove Rd.
Suite 220
Rockville, MD 20850
800.308.0731
301.947.8293 FAX

Copyright © Visual Mining, Inc. 1996 - 2010
All Rights Reserved.

NetCharts ProTM is a registered trademark of Visual Mining, Inc. Other brands and their products are trademarks of their respective holders.

Last Modified: Jun 29, 2010