NetCharts Pro

netcharts.pro.charts.dial
Class NFDial

java.lang.Object
  extended by netcharts.pro.common.NFBaseClass
      extended by netcharts.pro.charts.dial.NFDial
All Implemented Interfaces:
java.lang.Cloneable

public class NFDial
extends NFBaseClass

Represents a dial chart. Contains circle or semicircle that may contain multiple sectors or hands. The dial area is generated by specifying a start and stop angle. These values are relative to the top of the chart. For example, a dial with a start angle of 0 and a stop angle of 180 would display a vertically oriented semicircle. A dial with a start angle of -180 and stop angle of 180 would draw a circle with the data orientation starting at the bottom of the circle. Data is mapped onto the dial by using the dial's scale. The scale, which consists of min, max, and step, allows the developer to map non circular coordinates into the dial. So, for example, a speedometer may have a dial that has a start/stop angle of -160,160, but the scale ranges from 0 to 120. This means that if a hand's value is set to 60, the hand will appear to be pointing at the top of the semicircle.


Field Summary
static int INSIDE
          Tics on inside of dial
static int NONE
          No Tics
static int OUTSIDE
          Tics on outside of dial
static java.util.Hashtable ticPositionMap
          The set of allowed tic positions.
 
Constructor Summary
NFDial()
          Constructs a default dial.
NFDial(java.lang.String dialName)
          Constructs a dial with the given name.
 
Method Summary
 void addHand(NFDialHand hand)
          Adds a new hand to this dial.
 void addSector(NFDialSector sector)
          Adds a new sector to this dial.
 void addTicLabel(java.lang.String ticLabel)
          Add a new tic label.
 java.lang.Object clone()
          Does a deep copy of this dial object
 NFActiveLabel getActiveLabel()
          Gets the active label for this dial.
 boolean getActiveLabelModified()
          Gets if the dial active label has been modified
 NFLine getBorderLine()
          Gets the style of the border line
 boolean getBorderModified()
          Gets if the dial border has been modified
 java.lang.String getCDLDial()
          Generate CDL parameters representing this dial
 java.lang.String getCDLDialActiveLabel()
          Generate CDL parameters representing the dial active label
 java.lang.String getCDLDialBorder()
          Generate CDL parameters representing the dial border
 java.lang.String getCDLDialFill()
          Generate CDL parameters representing the dial fill
 java.lang.String getCDLDialFillPattern()
          Generate CDL parameters representing this dial's fill pattern
 java.lang.String getCDLDialFormat()
          Generate CDL parameters representing the dial format
 java.lang.String getCDLDialScale()
          Generate CDL parameters representing the dial scale
 java.lang.String getCDLDialTicLabels()
          Generate CDL parameters representing the dial tic labels
 java.lang.String getCDLDialTics()
          Generate CDL parameters representing the dial tics
 java.lang.String getCDLDialTicStyle()
          Generate CDL parameters representing the dial tic styles
 boolean getConnectBorderEnds()
          Gets if the line/fill should be drawn to connect the points of the border.
 boolean getDialModified()
          Gets if the dial has been modified
 java.lang.String getDialName()
          Get this dial's name.
 boolean getDrawBorderToCenter()
          Gets if the line/fill should be drawn so that end point connect at the center of the chart.
 java.awt.Color getFillColor()
          Gets the dial fill color
 boolean getFillModified()
          Gets if the dial fill has been modified
 NFFillPattern getFillPattern()
          Gets the fill pattern this dial should use.
 boolean getFillPatternModified()
          Gets if the dial fill pattern has been modified
 NFFormat getFormat()
          Gets the format of the tic labels
 boolean getFormatModified()
          Gets if the dial format has been modified
 NFVector getHands()
          Gets the list of NFDialHand objects for this dial
 double getRadiusPercent()
          Gets the percentage of the available space the dial should use.
 NFAxisRange getScale()
          Gets the dial scale.
 boolean getScaleModified()
          Gets if the dial scale has been modified
 NFVector getSectors()
          Gets the list of NFDialSector objects for this dial
 boolean getShowTicLabels()
          Gets whether or not the tic labels should be displayed.
 double getStartAngle()
          Gets the angle that the dial starts from.
 double getStopAngle()
          Gets the angle that the dial stops.
 java.awt.Color getTicColor()
          Gets the tic line color
 double getTicLabelPosition()
          Gets the position of a tic label relative to the width of the dial.
 NFVector getTicLabels()
          Gets the tic labels.
 NFTextStyle getTicLabelStyle()
          Gets text style of the tic labels.
 double getTicLength()
          Gets the tic line length
 int getTicPosition()
          Gets the location of the tics relative to the dial.
 boolean getTicsModified()
          Gets if the dial tics have been modified
 int getTicWidth()
          Gets the tic line width
 void setActiveLabel(NFActiveLabel activeLabel)
          Sets the active label for this dial.
 void setBorderLine(NFLine borderLine)
          Sets the style of the border line
 void setCDLDial(java.lang.String cdl)
          Configures this object from a CDL parameter representation.
 void setCDLDialActiveLabel(java.lang.String cdl)
          Configures the dial active label from a CDL parameter representation.
 void setCDLDialBorder(java.lang.String cdl)
          Configures the dial border from a CDL parameter representation.
 void setCDLDialFill(java.lang.String cdl)
          Configures the dial fill from a CDL parameter representation.
 void setCDLDialFillPattern(java.lang.String cdl)
          Configures this object from a CDL parameter representation.
 void setCDLDialFormat(java.lang.String cdl)
          Configures the dial format from a CDL parameter representation.
 void setCDLDialScale(java.lang.String cdl)
          Configures the dial scale from a CDL parameter representation.
 void setCDLDialTicLabels(java.lang.String cdl)
          Configures the dial tic labels from a CDL parameter representation.
 void setCDLDialTics(java.lang.String cdl)
          Configures the dial tics from a CDL parameter representation.
 void setCDLDialTicStyle(java.lang.String cdl)
          Configures the dial tic style from a CDL parameter representation.
 void setConnectBorderEnds(boolean connectBorderEnds)
          Sets if the line/fill should be drawn to connect the points of the border.
 void setDialName(java.lang.String dialName)
          Set this dial's name.
 void setDrawBorderToCenter(boolean drawBorderToCenter)
          Sets if the line/fill should be drawn so that end point connect at the center of the chart.
 void setFillColor(java.awt.Color fillColor)
          Sets the dial fill color
 void setFillPattern(NFFillPattern fillPattern)
          Sets the fill pattern this dial should use.
 void setFormat(NFFormat format)
          Sets the format of the tic labels
 void setHands(NFVector hands)
          Sets the list of NFDialHand objects for this dial
 void setRadiusPercent(double radiusPercent)
          Sets the percentage of the available space the dial should use.
 void setScale(double min, double max, double step)
          Sets the dial scale.
 void setScale(NFAxisRange scale)
          Sets the dial scale.
 void setSectors(NFVector sectors)
          Sets the list of NFDialSector objects for this dial
 void setShowTicLabels(boolean showTicLabels)
          Sets whether or not the tic labels should be displayed.
 void setStartAngle(double startAngle)
          Sets the angle that the dial starts from.
 void setStopAngle(double stopAngle)
          Sets the angle that the dial stops.
 void setTicColor(java.awt.Color ticColor)
          Sets the tic line color
 void setTicLabelPosition(double ticLabelPosition)
          Sets the position of a tic label relative to the width of the dial.
 void setTicLabels(NFVector ticLabels)
          Sets the tic labels.
 void setTicLabelStyle(java.awt.Color color, java.awt.Font font, int angle)
          Sets text style of the tic labels.
 void setTicLabelStyle(NFTextStyle ticLabelStyle)
          Sets text style of the tic labels.
 void setTicLength(double ticLength)
          Sets the tic line length
 void setTicLine(java.awt.Color ticColor, int ticWidth, int ticLength)
          Sets the characteristics of the tic lines.
 void setTicPosition(int ticPosition)
          Sets the location of the tics relative to the dial.
 void setTicWidth(int ticWidth)
          Sets the tic line width
 
Methods inherited from class netcharts.pro.common.NFBaseClass
getModified, getUserObject, setModified, setUserObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
No Tics

See Also:
Constant Field Values

INSIDE

public static final int INSIDE
Tics on inside of dial

See Also:
Constant Field Values

OUTSIDE

public static final int OUTSIDE
Tics on outside of dial

See Also:
Constant Field Values

ticPositionMap

public static java.util.Hashtable ticPositionMap
The set of allowed tic positions. Consists of NONE, INSIDE, OUTSIDE.

Constructor Detail

NFDial

public NFDial()
Constructs a default dial. Sets the default name to DialN where N is a random number


NFDial

public NFDial(java.lang.String dialName)
Constructs a dial with the given name. If the name is equal to null, then a default value will be created.

Parameters:
dialName -
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Does a deep copy of this dial object

Overrides:
clone in class NFBaseClass
Returns:
Object
Throws:
java.lang.CloneNotSupportedException

setDialName

public void setDialName(java.lang.String dialName)
Set this dial's name. The dial name is used mostly when reading or generating a CDL representation of the chart.

Parameters:
dialName - The name of the dial.

getDialName

public java.lang.String getDialName()
Get this dial's name. The dial name is used mostly when reading or generating a CDL representation of the chart.

Returns:
the name of this dial. If a name has not been set, an automatically generated name will be provided.

setStartAngle

public void setStartAngle(double startAngle)
Sets the angle that the dial starts from. The dial sweeps in a clockwise direction. The top of the dial is considered the zero angle.

Parameters:
startAngle - The start angle.

getStartAngle

public double getStartAngle()
Gets the angle that the dial starts from. The dial sweeps in a clockwise direction. The top of the dial is considered the zero angle.

Returns:
the start angle or 0.0 if not defined.

setStopAngle

public void setStopAngle(double stopAngle)
Sets the angle that the dial stops. The dial sweeps in a clockwise direction. The top of the dial is considered the zero angle.

Parameters:
stopAngle - The stop angle.

getStopAngle

public double getStopAngle()
Gets the angle that the dial stops. The dial sweeps in a clockwise direction. The top of the dial is considered the zero angle.

Returns:
stopAngle or 359.0 if not set.

setRadiusPercent

public void setRadiusPercent(double radiusPercent)
Sets the percentage of the available space the dial should use.

Parameters:
radiusPercent - A value between 0 and 100.

getRadiusPercent

public double getRadiusPercent()
Gets the percentage of the available space the dial should use.

Returns:
radiusPercent or 100 if not set.

setTicPosition

public void setTicPosition(int ticPosition)
Sets the location of the tics relative to the dial. One of
 NONE - no tics
 INSIDE - inside the dial
 OUTSIDE - outside the dial
 

Parameters:
ticPosition - One of NONE, INSIDE, OUTSIDE

getTicPosition

public int getTicPosition()
Gets the location of the tics relative to the dial.

Returns:
ticPosition, one of NONE, INSIDE, OUTSIDE or NONE if not defined.

setScale

public void setScale(double min,
                     double max,
                     double step)
Sets the dial scale. The dial scale determines how sectors, hands, and tic marks are distributed in this dial. Sector and hand values are mapped onto the dial by using the scale. Note that tics can be effectively removed by setting the step equal to the absolute value of (max-min)

Parameters:
min - The scale minimum value
max - The scale maximum value
step - Tic spacing

setScale

public void setScale(NFAxisRange scale)
Sets the dial scale. The dial scale determines how sectors, hands, and tic marks are distributed in this dial. Sector and hand values are mapped onto the dial by using the scale. Note that tics can be effectively removed by setting the step equal to the absolute value of (max-min)

Parameters:
scale - the dial scale value.

getScale

public NFAxisRange getScale()
Gets the dial scale. The dial scale determines how sectors, hands, and tic marks are distributed in this dial. Sector and hand values are mapped onto the dial by using the scale.

Returns:
the dial scale or null if not defined.

addTicLabel

public void addTicLabel(java.lang.String ticLabel)
Add a new tic label. In the dial chart, all tic labels are passed in (versus automatic generation found in other chart types).

Parameters:
ticLabel - The new tic label.

setTicLabels

public void setTicLabels(NFVector ticLabels)
Sets the tic labels. In the dial chart, all tic labels are passed in (versus automatic generation found in other chart types). If there are more labels than tics, only the labels that correspond to tics will be shown. If there are less labels than tics, all labels will be shown.

Parameters:
ticLabels - vector of String values.

getTicLabels

public NFVector getTicLabels()
Gets the tic labels. In the dial chart, all tic labels are passed in (versus automatic generation found in other chart types). If there are more labels than tics, only the labels that correspond to tics will be shown. If there are less labels than tics, all labels will be shown.

Returns:
vector of tic labels or null if not defined.

setTicLine

public void setTicLine(java.awt.Color ticColor,
                       int ticWidth,
                       int ticLength)
Sets the characteristics of the tic lines. Calls setTicColor, setTicWidth and setTicLength.

Parameters:
ticColor - Color of the tic line
ticWidth - Width of the tic line (in pixels)
ticLength - Length of the tic line (in pixels)

setTicColor

public void setTicColor(java.awt.Color ticColor)
Sets the tic line color

Parameters:
ticColor - Color of the tic line

getTicColor

public java.awt.Color getTicColor()
Gets the tic line color

Returns:
color of the tic line or null if not defined.

setTicWidth

public void setTicWidth(int ticWidth)
Sets the tic line width

Parameters:
ticWidth - Width of the tic line (in pixels)

getTicWidth

public int getTicWidth()
Gets the tic line width

Returns:
width of the tic line (in pixels) or 1 if not defined.

setTicLength

public void setTicLength(double ticLength)
Sets the tic line length

Parameters:
ticLength - Length of the tic line (in pixels)

getTicLength

public double getTicLength()
Gets the tic line length

Returns:
length of the tic line (in pixels) or 3.0 if not defined.

setShowTicLabels

public void setShowTicLabels(boolean showTicLabels)
Sets whether or not the tic labels should be displayed. Please note that if no labels have been set using addTicLabel or setTicLabels, the value of this parameter is irrelevant.

Parameters:
showTicLabels - If true, show the tic labels (if defined)

getShowTicLabels

public boolean getShowTicLabels()
Gets whether or not the tic labels should be displayed. Please note that if no labels have been set using addTicLabel or setTicLabels, the value of this parameter is irrelevant.

Returns:
showTicLabels, If true (default), show the tic labels (if defined)

setTicLabelPosition

public void setTicLabelPosition(double ticLabelPosition)
Sets the position of a tic label relative to the width of the dial. A value of 1.1 will place each label just outside the dial face, while a value of 0.6 will place each label inside of the dial border. If setTicPosition is set to OUTSIDE, this value will default to 1.1, otherwise this value will default to 0.6.

Parameters:
ticLabelPosition - Tic label position.

getTicLabelPosition

public double getTicLabelPosition()
Gets the position of a tic label relative to the width of the dial. A value of 1.1 will place each label just outside the dial face, while a value of 0.6 will place each label inside of the dial border. If setTicPosition is set to OUTSIDE, this value will default to 1.1, otherwise this value will default to 0.6.


setTicLabelStyle

public void setTicLabelStyle(java.awt.Color color,
                             java.awt.Font font,
                             int angle)
Sets text style of the tic labels.

Parameters:
color - Text color
font - Text font
angle - Text rotation

setTicLabelStyle

public void setTicLabelStyle(NFTextStyle ticLabelStyle)
Sets text style of the tic labels.

Parameters:
ticLabelStyle - Style object.

getTicLabelStyle

public NFTextStyle getTicLabelStyle()
Gets text style of the tic labels.

Returns:
ticLabelStyle or null if not defined.

setConnectBorderEnds

public void setConnectBorderEnds(boolean connectBorderEnds)
Sets if the line/fill should be drawn to connect the points of the border. This may be desirable when the range between the start angle and stop angle is less than 360 degrees.

Parameters:
connectBorderEnds - true or false.

getConnectBorderEnds

public boolean getConnectBorderEnds()
Gets if the line/fill should be drawn to connect the points of the border. This may be desirable when the range between the start angle and stop angle is less than 360 degrees.

Returns:
connectBorderEnds. false if not defined.

setDrawBorderToCenter

public void setDrawBorderToCenter(boolean drawBorderToCenter)
Sets if the line/fill should be drawn so that end point connect at the center of the chart. This may be desirable when the range between the start angle and stop angle is less than 360 degrees.

Parameters:
drawBorderToCenter - true or false.

getDrawBorderToCenter

public boolean getDrawBorderToCenter()
Gets if the line/fill should be drawn so that end point connect at the center of the chart. This may be desirable when the range between the start angle and stop angle is less than 360 degrees.

Returns:
drawBorderToCenter. false if not defined.

setFormat

public void setFormat(NFFormat format)
Sets the format of the tic labels

Parameters:
format - NFFormat format.

getFormat

public NFFormat getFormat()
Gets the format of the tic labels

Returns:
format or null if not defined.

setBorderLine

public void setBorderLine(NFLine borderLine)
Sets the style of the border line

Parameters:
borderLine - NFLine style.

getBorderLine

public NFLine getBorderLine()
Gets the style of the border line

Returns:
borderLine or null if not defined.

setFillColor

public void setFillColor(java.awt.Color fillColor)
Sets the dial fill color

Parameters:
fillColor - Dial's fill color.

getFillColor

public java.awt.Color getFillColor()
Gets the dial fill color

Returns:
color or null if not defined.

setActiveLabel

public void setActiveLabel(NFActiveLabel activeLabel)
Sets the active label for this dial.

Parameters:
activeLabel - Active label object for the dial.

getActiveLabel

public NFActiveLabel getActiveLabel()
Gets the active label for this dial.

Returns:
activeLabel or null if not defined.

setFillPattern

public void setFillPattern(NFFillPattern fillPattern)
Sets the fill pattern this dial should use.

Parameters:
fillPattern - Fill pattern for this dial.

getFillPattern

public NFFillPattern getFillPattern()
Gets the fill pattern this dial should use.

Returns:
fill pattern for this dial or null if not defined.

addHand

public void addHand(NFDialHand hand)
Adds a new hand to this dial.

Parameters:
hand - NFDialHand object to add.

setHands

public void setHands(NFVector hands)
Sets the list of NFDialHand objects for this dial

If the vector contains elements that are not NFDialHand objects, an IllegalArgumentException will be thrown.

Parameters:
hands - NFVector of NFDialHand objects.

getHands

public NFVector getHands()
Gets the list of NFDialHand objects for this dial

Returns:
hands or null if not defined.

addSector

public void addSector(NFDialSector sector)
Adds a new sector to this dial.

Parameters:
sector - NFDialSector object to add.

setSectors

public void setSectors(NFVector sectors)
Sets the list of NFDialSector objects for this dial

If the vector contains elements that are not NFDialSector objects, an IllegalArgumentException will be thrown.

Parameters:
sectors -

getSectors

public NFVector getSectors()
Gets the list of NFDialSector objects for this dial

Returns:
sectors or null if not defined.

getCDLDial

public java.lang.String getCDLDial()
Generate CDL parameters representing this dial

Returns:
CDL in the form: ("dialName", startAngle, stopAngle, radiusPercent, ticPosition)

setCDLDial

public void setCDLDial(java.lang.String cdl)
Configures this object from a CDL parameter representation.

Parameters:
cdl - CDL in the form: ("dialName", startAngle, stopAngle, radiusPercent, ticPosition)

getCDLDialTics

public java.lang.String getCDLDialTics()
Generate CDL parameters representing the dial tics

Returns:
CDL in the form: ("dialName", ticColor, ticWidth, ticLength)

setCDLDialTics

public void setCDLDialTics(java.lang.String cdl)
Configures the dial tics from a CDL parameter representation.

Parameters:
cdl - CDL in the form: ("dialName", ticColor, ticWidth, ticLength)

getCDLDialTicStyle

public java.lang.String getCDLDialTicStyle()
Generate CDL parameters representing the dial tic styles

Returns:
CDL in the form: ("dialName", showLabels, labelPosition, "font", fontSize, textAngle)

setCDLDialTicStyle

public void setCDLDialTicStyle(java.lang.String cdl)
Configures the dial tic style from a CDL parameter representation.

Parameters:
cdl - CDL in the form: ("dialName", showLabels, labelPosition, "font", fontSize, textAngle)

getCDLDialFillPattern

public java.lang.String getCDLDialFillPattern()
Generate CDL parameters representing this dial's fill pattern

Returns:
CDL in the form: ("dialName", type, fgcolor, bgcolor, imageurl)

setCDLDialFillPattern

public void setCDLDialFillPattern(java.lang.String cdl)
Configures this object from a CDL parameter representation.

Parameters:
cdl - CDL in the form: ("dialName", type, fgcolor, bgcolor, imageurl)

getCDLDialTicLabels

public java.lang.String getCDLDialTicLabels()
Generate CDL parameters representing the dial tic labels

Returns:
CDL in the form: "label1","label2",...,"labelN"

setCDLDialTicLabels

public void setCDLDialTicLabels(java.lang.String cdl)
Configures the dial tic labels from a CDL parameter representation.

Parameters:
cdl - CDL in the form: "label1","label2",...,"labelN"

getCDLDialScale

public java.lang.String getCDLDialScale()
Generate CDL parameters representing the dial scale

Returns:
CDL in the form: ("dialName", min, max, step)

setCDLDialScale

public void setCDLDialScale(java.lang.String cdl)
Configures the dial scale from a CDL parameter representation.

Parameters:
cdl - CDL in the form: ("dialName", min, max, step)

getCDLDialFormat

public java.lang.String getCDLDialFormat()
Generate CDL parameters representing the dial format

Returns:
CDL in the form: ("dialName", formatType, formatStr)

getCDLDialBorder

public java.lang.String getCDLDialBorder()
Generate CDL parameters representing the dial border

Returns:
CDL in the form: ("dialName", lineStyle, lineThickness, lineColor, endType)

setCDLDialFormat

public void setCDLDialFormat(java.lang.String cdl)
Configures the dial format from a CDL parameter representation.

Parameters:
cdl - CDL in the form: ("dialName", formatType, formatStr)

setCDLDialBorder

public void setCDLDialBorder(java.lang.String cdl)
Configures the dial border from a CDL parameter representation.

Parameters:
cdl - CDL in the form: ("dialName", lineStyle, lineThickness, lineColor, endType)

getCDLDialFill

public java.lang.String getCDLDialFill()
Generate CDL parameters representing the dial fill

Returns:
CDL in the form: ("dialName", fillColor, endType)

setCDLDialFill

public void setCDLDialFill(java.lang.String cdl)
Configures the dial fill from a CDL parameter representation.

Parameters:
cdl - CDL in the form: ("dialName", fillColor, endType)

getCDLDialActiveLabel

public java.lang.String getCDLDialActiveLabel()
Generate CDL parameters representing the dial active label

Returns:
CDL in the form: ("dialName", "label","url","target")

setCDLDialActiveLabel

public void setCDLDialActiveLabel(java.lang.String cdl)
Configures the dial active label from a CDL parameter representation.

Parameters:
cdl - CDL in the form: ("dialName", "label","url","target")

getDialModified

public boolean getDialModified()
Gets if the dial has been modified

Returns:
modified

getTicsModified

public boolean getTicsModified()
Gets if the dial tics have been modified

Returns:
modified

getFillModified

public boolean getFillModified()
Gets if the dial fill has been modified

Returns:
modified

getActiveLabelModified

public boolean getActiveLabelModified()
Gets if the dial active label has been modified

Returns:
modified

getScaleModified

public boolean getScaleModified()
Gets if the dial scale has been modified

Returns:
modified

getFormatModified

public boolean getFormatModified()
Gets if the dial format has been modified

Returns:
modified

getBorderModified

public boolean getBorderModified()
Gets if the dial border has been modified

Returns:
modified

getFillPatternModified

public boolean getFillPatternModified()
Gets if the dial fill pattern has been modified

Returns:
modified

NetCharts Pro


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

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

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

Last Modified: Jun 28, 2011