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.chart
Class NFChart

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--netcharts.chart.NFChart
Subclasses:
NFApplet

public class NFChart
This is the root class for all NetCharts chart classes. It provides support for the loadParams() method and all common chart processing, allowing any NetCharts chart to be embedded and accessed in a generic manner. NFGlobal's getChart method provides an easy way of creating a NFChart of a particular type without specifying any parameters.

See Also:
getChart(int), Serialized Form

Inner classes inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Inner classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
NFGraph graph
          Reference to the underlying netchart object.
java.net.URL url
          The URL associated with this chart.
 
Constructor Summary
NFChart(java.applet.Applet app)
          Construct a new NFChart.
 
Method Summary
void clean()
          This method cleans the chart and its parameters, making it ready to be reused.
void display()
          Instruct the chart to reread its parameters and redisplay itself.
java.awt.Image drawImage(int width, int height)
          Create an image of the given size and draw the current representation of the chart to it.
java.applet.Applet getApplet()
          Get the applet for this Chart.
java.lang.String getAppletInfo()
          Return information about the software version of this chart.
NFCdf getCdf()
          Return the NFCdf object associated with this NFChart.
java.lang.String getCDL()
          Return the CDL representation of the NFChart with all DataBean references removed, and all Data from those DataBean's inlined.
static NFChart getChart(NFCdf cdf)
          Create an NFChart object from the given chart definition.
static NFChart getChart(NFCdf cdf, java.applet.Applet applet)
          Create an NFChart object using the given chart definition and applet.
static NFChart getChart(NFCdf cdf, NFContext context)
          Create an NFChart object using the given chart definition and context.
static NFChart getChart(NFCdf cdf, NFContext context, boolean loadAppletParams)
          Create an NFChart object using the given chart definition and context.
NFContext getContext()
          Get the context for this Chart.
java.util.Vector getErrors()
          Returns a vector of String error messages that were generated when the chart was created.
int getIndex(java.lang.String param, java.lang.Object itemKey)
          Returns the index (zero based) for a tuple attribute or a vector item, specified by a given itemKey.
boolean getLoadAppletParamsOnInit()
          Get whether the parameters contained in the Applet tag will be processed on the call to init.
java.util.Vector getMetaData(java.lang.String name)
          Returns the meta data value(s) for the given name.
java.util.Enumeration getMetaDataKeys()
          Return the list of metadata tags defined for this chart.
boolean getModified()
          Returns true if the chart has been modified without saving
java.lang.String getName()
          Return the name of the chart.
java.lang.String getParam(java.lang.String param)
          Returns a parameter definition expression for the current value of the given parameter.
java.lang.String getParam(java.lang.String param, java.lang.Object val)
          Returns a parameter definition expression for the given value, as defined by the given parameter.
java.lang.String getTextualDescription()
          This method returns a textual description of the chart.
void init()
          This method must be called after a chart applet is created in order to initially layout the chart and to load the applet parameters.
void loadParams(NFCdf cdf)
          Load chart parameters from the given CDF object.
void loadParams(java.lang.String str)
          Load chart parameters from the given script.
void loadParams(java.lang.StringBuffer script)
          Load chart parameters from the given script.
void loadParams(java.lang.String host, int port, java.lang.String args)
          Load chart parameters from the Parameter Server at the given host and port.
void loadParams(java.net.URL url)
          Load chart parameters from the given URL.
void loadParamsJS(java.lang.String str)
          Load chart parameters from the given script.
java.awt.Dimension preferredSize()
          Return the preferred size of the chart.
void printAll(java.awt.Graphics g)
          Print the chart.
void reloadChart()
          Reload the chart from its underlying Cdf representation.
void reloadChart(boolean force)
          Reload the specified chart from its underlying Cdf.
boolean reloadNeeded(java.util.Date timestamp)
          Returns true if any of the underlying data sources for the chart have changed since the given timestamp.
void reshape(int x, int y, int width, int height)
          Resize and reposition the chart.
void resize(int width, int height)
          Resize the chart.
void set(java.lang.Object expr)
          Parses the given parameter expression, which may be defined using any of the types supported by NFLoadParams.loadParams().
void set(java.lang.String param, int itemIndex, int attrIndex, java.lang.Object val)
          Set the data value for a specific attribute within a TUPLE VECTOR.
void set(java.lang.String param, int itemIndex, java.lang.Object val)
          Set the data value for a specific attribute or item within a TUPLE or VECTOR parameter, based on the itemIndex given.
void set(java.lang.String param, java.lang.Object val)
          Set the data value for the given parameter.
void set(java.lang.String param, java.lang.Object itemKey, java.lang.Object val)
          Set the data value for a specific attribute or item within a TUPLE or VECTOR parameter, based on the given itemKey.
void set(java.lang.String param, java.lang.Object itemKey, java.lang.Object attrKey, java.lang.Object val)
          Set the data value for a specific attribute within a TUPLE VECTOR.
void setApplet(java.applet.Applet a)
          Set the applet for this Chart.
void setCdf(NFCdf cdf)
          Set the NFCdf object for this NFChart.
void setContext(NFContext context)
          Set the context for this Chart.
void setLoadAppletParamsOnInit(boolean b)
          Sets whether the parameters contained in the Applet tag will be processed on the call to init.
void setModified(boolean isModified)
          Method to indicate whether the chart has been modified since the last save.
void setScale(double scale)
          Set the chart scale factor.
void start()
          Starts the chart.
void stop()
          This method should be called whenever the parent applet is stopped or when a standalone application wants to suspend chart processing for some reason.
 

Field Detail

graph

public NFGraph graph
Reference to the underlying netchart object.

url

public java.net.URL url
The URL associated with this chart.
Constructor Detail

NFChart

public NFChart(java.applet.Applet app)
Construct a new NFChart.
Method Detail

getApplet

public java.applet.Applet getApplet()
Get the applet for this Chart.
Returns:
The applet associated with this chart.

setApplet

public void setApplet(java.applet.Applet a)
Set the applet for this Chart.
Parameters:
a - The applet to be associated this chart.

getContext

public NFContext getContext()
Get the context for this Chart.
Returns:
The chart context.

setContext

public void setContext(NFContext context)
Set the context for this Chart.
Parameters:
context - The chart context.

getChart

public static NFChart getChart(NFCdf cdf)
Create an NFChart object from the given chart definition.
Parameters:
cdf - An NFCdf chart definition.
Returns:
An NFChart object representing the input NFCdf chart definition.

getChart

public static NFChart getChart(NFCdf cdf,
                               java.applet.Applet applet)
Create an NFChart object using the given chart definition and applet.
Parameters:
cdf - An NFCdf chart definition.
applet - The applet to assoicate with this chart.
Returns:
An NFChart object representing the input NFCdf chart definition.

getChart

public static NFChart getChart(NFCdf cdf,
                               NFContext context)
Create an NFChart object using the given chart definition and context.
Parameters:
cdf - An NFCdf chart definition.
context - The contect object to assoicate with this chart.
Returns:
An NFChart object representing the input NFCdf chart definition.

getChart

public static NFChart getChart(NFCdf cdf,
                               NFContext context,
                               boolean loadAppletParams)
Create an NFChart object using the given chart definition and context.
Parameters:
cdf - An NFCdf chart definition.
context - The contect object to assoicate with this chart.
loadAppletParams - Whether to load the applet parameters on init.
Returns:
An NFChart object representing the input NFCdf chart definition.

getLoadAppletParamsOnInit

public boolean getLoadAppletParamsOnInit()
Get whether the parameters contained in the Applet tag will be processed on the call to init.

setLoadAppletParamsOnInit

public void setLoadAppletParamsOnInit(boolean b)
Sets whether the parameters contained in the Applet tag will be processed on the call to init.

init

public void init()
This method must be called after a chart applet is created in order to initially layout the chart and to load the applet parameters.
Overrides:
init in class java.applet.Applet

loadParams

public void loadParams(java.net.URL url)
Load chart parameters from the given URL. This method may be called as many times as needed throughout the life of the chart.
Parameters:
url - The URL from which to load chart parameters.

loadParams

public void loadParams(java.lang.String host,
                       int port,
                       java.lang.String args)
Load chart parameters from the Parameter Server at the given host and port. The argument string is transmitted to the server when the connection is first made and then all parameters returned by the server are loaded by a thread which is automatically created by this method.
Parameters:
host - The name of the machine hosting the Parameter Server.
port - The port number of the Parameter Server on the host machine.
args - Command line args to be delivered to the Parameter Server.
See Also:
NFParamServ

loadParams

public void loadParams(java.lang.String str)
Load chart parameters from the given script. The script may define one or more parameters. Whenever an "Update" command is encountered in the script, the chart display will be updated.
Parameters:
str - A String containing chart parameters to load.

loadParams

public void loadParams(java.lang.StringBuffer script)
Load chart parameters from the given script. The script may define one or more parameters. Whenever an "Update" command is encountered in the script, the chart display will be updated.
Parameters:
script - A StringBuffer containing chart parameters to load.

loadParams

public void loadParams(NFCdf cdf)
Load chart parameters from the given CDF object.
Parameters:
cdf - An NFCdf object containing parameters to be loaded into this chart.

loadParamsJS

public void loadParamsJS(java.lang.String str)
Load chart parameters from the given script. The script may define one or more parameters. Whenever an "Update" command is encountered, the chart display will be updated. Note: This method is the same as loadParams(String) but is provided because of a bug in IE4.x which doesn't allow a JavaScript to access a method that has been overloaded.
Parameters:
str - A String containing chart parameters to load.

setScale

public void setScale(double scale)
Set the chart scale factor. A value of -1 instructs the chart to automatically select the best scale factor for the charts current size. A value of 0 or 1 produces no scaling. Any other value will scale the chart by that value.
Parameters:
scale - The chart scale factor.

getCDL

public java.lang.String getCDL()
Return the CDL representation of the NFChart with all DataBean references removed, and all Data from those DataBean's inlined.
Returns:
A string containing the CDL representation of this chart.

getCdf

public NFCdf getCdf()
Return the NFCdf object associated with this NFChart.
Returns:
The NFCdf object associated with this NFChart.

setCdf

public void setCdf(NFCdf cdf)
Set the NFCdf object for this NFChart.
Parameters:
cdf - The NFCdf to associate with this NFChart.

getModified

public boolean getModified()
Returns true if the chart has been modified without saving
Returns:
Value indicating if chart has been modified wothout saving.

setModified

public void setModified(boolean isModified)
Method to indicate whether the chart has been modified since the last save.
Parameters:
isModified - Indicator that chart has been modified wothout saving.

getName

public java.lang.String getName()
Return the name of the chart.
Returns:
The name of the chart.
Overrides:
getName in class java.awt.Component

getErrors

public java.util.Vector getErrors()
Returns a vector of String error messages that were generated when the chart was created.
Returns:
A vector of String error messages that were generated when the chart was created.

display

public void display()
Instruct the chart to reread its parameters and redisplay itself.

getAppletInfo

public java.lang.String getAppletInfo()
Return information about the software version of this chart.
Returns:
A string representing the software version of this chart.
Overrides:
getAppletInfo in class java.applet.Applet

stop

public void stop()
This method should be called whenever the parent applet is stopped or when a standalone application wants to suspend chart processing for some reason. When this method is called, all underlying threads and display processing are suspended.
Overrides:
stop in class java.applet.Applet

start

public void start()
Starts the chart. This method must be called at least once to initiate all underlying threads and display processing.
Overrides:
start in class java.applet.Applet

drawImage

public java.awt.Image drawImage(int width,
                       int height)
Create an image of the given size and draw the current representation of the chart to it.
Parameters:
width - The width of the desired image.
height - The height of the desired image.
Returns:
An Image object of the given size depicting the chart.

printAll

public void printAll(java.awt.Graphics g)
Print the chart.
Parameters:
g - The graphics context to use for this print operation.
Overrides:
printAll in class java.awt.Component

resize

public void resize(int width,
                   int height)
Resize the chart.
Parameters:
width - The new width.
height - The new height.
Overrides:
resize in class java.applet.Applet

reshape

public void reshape(int x,
                    int y,
                    int width,
                    int height)
Resize and reposition the chart.
Parameters:
x - The desired x location of the chart.
y - The desired y location of the chart.
width - The desired width of the chart.
height - The desired height of the chart.
Overrides:
reshape in class java.awt.Component

preferredSize

public java.awt.Dimension preferredSize()
Return the preferred size of the chart.
Returns:
A Dimension object representing the charts preferred size.
Overrides:
preferredSize in class java.awt.Container

reloadNeeded

public boolean reloadNeeded(java.util.Date timestamp)
Returns true if any of the underlying data sources for the chart have changed since the given timestamp. If the timestamp is null, then the chart will make its determination based on its internal timestamp information, if any.
Parameters:
timestamp - The timestamp to compare.
Returns:
Boolean flag indicating if the chart has changed since the given time.

reloadChart

public void reloadChart()
Reload the chart from its underlying Cdf representation.

reloadChart

public void reloadChart(boolean force)
Reload the specified chart from its underlying Cdf.

If the force flag is true, then the chart will be reloaded regardless of any lack of modifications.

If the force flag is false, then the chart will be reloaded only if the underlying databeans (if any) have been modified since they were last loaded.

Parameters:
force - Flag to force a reload.

set

public void set(java.lang.Object expr)
        throws NFParamException
Parses the given parameter expression, which may be defined using any of the types supported by NFLoadParams.loadParams().
Parameters:
expr - An expression to set on the chart.
See Also:
NFLoadParams

set

public void set(java.lang.String param,
                java.lang.Object val)
        throws NFParamException
Set the data value for the given parameter.

The VAL object should reference data according to the type of parameter specified by PARAM.

Parameter TypeData Object
Single-ValueRaw Data Object
Tuple AttributeRaw Data Object
Tuple ParameterVector of Raw Data Objects
Simple VectorVector of Raw Data Objects
Tuple VectorVector of Vector of Raw Data Objects

The following Raw Data Objects are supported for the various attribute types:

Attribute TypeRaw Data Objects
StringAny object type
NumberNumber, String
DateNFDate, NFTimeUnit, Number, String
ColorColor, String
SymbolNumber, String
ImageNFParamImage, Image, String

Examples:

 		set ("GraphType", "HORIZONTAL");
 		set ("Bar3DDepth", new Integer(15));
 
 		set ("BackgroundColor", Color.red);
 		set ("BackgroundWidth", new Integer(5));
 
 		Vector bg = new Vector();
 		bg.addElement (Color.white);
 		bg.addElement ("BOX");
 		bg.addElement (new Integer(5));
 		set ("Background", bg);
 
 		Vector labels = new Vector();
 		labels.addElement ("Engr");
 		labels.addElement ("Sales");
 		labels.addElement ("Mktg");
 		set ("BarLabels", labels);
 
 		Vector line = new Vector();

 		Vector pt = new Vector();
 		pt.addElement (new Integer(10));
 		pt.addElement (new Integer(20));
 		line.addElement (pt);
 	
 		pt = new Vector();
 		pt.addElement (new Float(0.5));
 		pt.addElement (new Double(12.45));
 		line.addElement (pt);

 		set ("LineSet1", line);
 
Parameters:
param - Parameter to set.
object - New value for parameter.
Throws:
NFParamException -  

set

public void set(java.lang.String param,
                int itemIndex,
                java.lang.Object val)
        throws NFParamException
Set the data value for a specific attribute or item within a TUPLE or VECTOR parameter, based on the itemIndex given.

If a TUPLE parameter is specified, then the attribute with the given itemIndex will be replaced with the given data.

		set ("Background", 0, Color.red);
		set ("Background", 1, "BOX");
		set ("Background", 2, new Integer(10));
 

If a SIMPLE VECTOR parameter is specified, then the vector element with the given itemIndex will be replaced by the Raw Data Object given.

		set ("BarLabels", 2, "Marketing");

If a TUPLE VECTOR parameter is specified, then the entire vector tuple with the given itemIndex will be replaced by the Vector of Raw Data Objects given.

		Vector pt = new Vector();
		pt.addElement (new Float(13.5));
		pt.addElement (new Double(10.0));

		set ("LineSet1", 1, pt);

If a SINGLE VALUE parameter is specified, the itemIndex is ignored.

Parameters:
param - Parameter to set.
itemIndex - The target index within the TUPLE or VECTOR
object - New value for parameter.
Throws:
NFParamException -  

set

public void set(java.lang.String param,
                int itemIndex,
                int attrIndex,
                java.lang.Object val)
        throws NFParamException
Set the data value for a specific attribute within a TUPLE VECTOR.

The itemIndex is used to determine which tuple within the vector will be selected, and the attrIndex is used to determine which attribute within that tuple will be replaced by the Raw Data Object given.

If a non-vector parameter is specified, the attrIndex is ignored.

Parameters:
param - The parameter to set.
itemIndex - The index of the tuple to set.
attrIndex - The index of the attribute within the tuple to set
val - The new value.
Throws:
NFParamException - if an error occurs

set

public void set(java.lang.String param,
                java.lang.Object itemKey,
                java.lang.Object val)
        throws NFParamException
Set the data value for a specific attribute or item within a TUPLE or VECTOR parameter, based on the given itemKey.
Parameters:
param - The parameter name.
itemKey - The item key.
val - The new value for this item.
Throws:
NFParamException - if an error occurs
See Also:
getIndex

set

public void set(java.lang.String param,
                java.lang.Object itemKey,
                java.lang.Object attrKey,
                java.lang.Object val)
        throws NFParamException
Set the data value for a specific attribute within a TUPLE VECTOR. The itemKey is used to determine which tuple is being changed and the attrKey is used to determine which attribute within that tuple should be changed.
Parameters:
param - The parameter name.
itemKey - The itemKey for the parameter.
attrKey - The attribute key for the item
val - The new value for this attribute of this tuple in this parameter.
Throws:
NFParamException - if an error occurs
See Also:
getIndex

getIndex

public int getIndex(java.lang.String param,
                    java.lang.Object itemKey)
            throws NFParamException
Returns the index (zero based) for a tuple attribute or a vector item, specified by a given itemKey.

If a TUPLE parameter is specified, the itemKey is compared as a String to each of the attribute names defined within the tuple. If a match is found, the attribute index is returned.

 	getIndex ("Background", "Color")
 	getIndex ("Background", "Width")
 

If a SIMPLE VECTOR parameter is specified, the itemKey is compared against each value in the vector. If a match is found, the item index is returned.

 	getIndex ("BarLabels", "Fred")

If a TUPLE VECTOR parameter is specified, the itemKey is compared against the "first" attribute value (ie. the key attribute) in each tuple. If a match is found, the tuple index is returned.

 	i = getIndex ("LineSets", "Fred");
 	getIndex ("LineSet"+(i+1), new Float(0.5));

If a SIMPLE VALUE parameter is specified, zero is returned.

If no match is found, -1 is returned.

Parameters:
param - The parameter name.
itemKey - The item key
Returns:
The index of the itemKey within the parameter value
Throws:
NFParamException - if an error occurs

getParam

public java.lang.String getParam(java.lang.String param)
                         throws NFParamException
Returns a parameter definition expression for the current value of the given parameter.
Parameters:
param - The name of the desired parameter.
Returns:
The value of of the desired parameter.
Throws:
NFParamException - if an error occurs.

getParam

public java.lang.String getParam(java.lang.String param,
                       java.lang.Object val)
                         throws NFParamException
Returns a parameter definition expression for the given value, as defined by the given parameter.
Parameters:
param - The desired parameter name.
val - The parameter value.
Returns:
A string representation of this parameter/value.
Throws:
NFParamException - if an error occurs

getMetaData

public java.util.Vector getMetaData(java.lang.String name)
Returns the meta data value(s) for the given name.
Parameters:
name - The metadata key name.
Returns:
The value for this metadata key.

getMetaDataKeys

public java.util.Enumeration getMetaDataKeys()
Return the list of metadata tags defined for this chart.
Returns:
An Enumeration of the metadata tags defined for this chart.

clean

public void clean()
This method cleans the chart and its parameters, making it ready to be reused.

getTextualDescription

public java.lang.String getTextualDescription()
This method returns a textual description of the chart.

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