com.jinsight.jetchart
Class AbstractSerie

java.lang.Object
  |
  +--com.jinsight.jetchart.AbstractSerie
Direct Known Subclasses:
GraphSerie, PieSerie, ScatterSerie

public abstract class AbstractSerie
extends java.lang.Object

The AbstractSerie class is the super class of all series in the JetChart Library. A series is a sequence of data points depicted in a chart as a line, bars, pie slices, points, etc.

Three classes extends AbstractSerie:

Nine classes extends GraphSerie: Four classes extends ScatterSerie:

See Also:
GraphSerie, LineSerie, AreaSerie, BarSerie, StackBarSerie, PointSerie, ImageSerie, OHLCBarSerie, OHLCLineSerie, CandleStickSerie, ScatterSerie, XYSerie, XYLineSerie, XYImageSerie, BubbleSerie, PieSerie

Field Summary
static int CLIENT_SIDE
          Constant used to define generation of a series image map in client-side format.
static int SERVER_SIDE_CERN
          Constant used to define generation of a series image map in server-side CERN format.
static int SERVER_SIDE_NCSA
          Constant used to define generation of a series image map in server-side NCSA format.
 
Constructor Summary
AbstractSerie()
           
 
Method Summary
protected  void finalize()
           
 int getId()
          Returns series id.
 double[][] getMultipleValues()
          Returns a bidimensional array of multiple values.
abstract  java.lang.String getSerieMap(java.lang.String[] urls, int type, java.lang.String target)
          Creates a chart image map.
 double[] getValues()
          Returns series values.
 void setHighlightColor(java.awt.Color highlightColor)
          Sets highlight color.
 void setHighlightEnabled(boolean isHighlightEnabled)
          Enables/disables highlight of a series data point.
 void setId(int serieId)
          Sets a series unique ID.
 void setLegendEnabled(boolean isLegendEnabled)
          Enables/disables a series legend.
 void setMultipleValues(double[][] multipleValues)
          Sets the values of series whose data points are associated with multiple values, as OHLC series and scatter series.
 void setMultipleValues(double[][] multipleValues, int offset, int len)
          Sets the values of series whose data points are associated with multiple values, as OHLC series and scatter series.
 void setSVGURLs(java.lang.String[] svgURLs)
          Specifies a list of URLs to be associated with an SVG encoded sequence of series data points.
 void setToolTipContent(java.lang.String[] toolTipContent)
          Customizes tooltips contents.
 void setToolTipEnabled(boolean isToolTipEnabled)
          Enables/disables a series tooltips.
 void setValueFormat(java.lang.String valueFormat)
          Sets the format of values displayed in data points legends and tooltips.
 void setValues(double[] values)
          Sets series values.
 void setValues(double[] values, int offset, int len)
          Sets series values.
 void setValuesQuery(java.lang.String valuesQuery)
          Sets a sql query string to access a database and get series values.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLIENT_SIDE

public static final int CLIENT_SIDE
Constant used to define generation of a series image map in client-side format. Example: <area shape=poly coords='200,100,300,400,500,600' href='url.html'>
See Also:
getSerieMap(java.lang.String[], int, java.lang.String)

SERVER_SIDE_NCSA

public static final int SERVER_SIDE_NCSA
Constant used to define generation of a series image map in server-side NCSA format. Example: poly url.html 200,100 300,400 500,600
See Also:
getSerieMap(java.lang.String[], int, java.lang.String)

SERVER_SIDE_CERN

public static final int SERVER_SIDE_CERN
Constant used to define generation of a series image map in server-side CERN format. Example: poly (200,100) (300,400) (500,600) url.html
See Also:
getSerieMap(java.lang.String[], int, java.lang.String)
Constructor Detail

AbstractSerie

public AbstractSerie()
Method Detail

setId

public void setId(int serieId)
Sets a series unique ID. This number can be used to identify a series in a a SerieEvent handler.
Parameters:
serieId - an integer.
See Also:
SerieEvent, SerieListener, GenericGraph.addSerieListener(com.jinsight.jetchart.SerieListener), Graph.setSerieDraggingEnabled(boolean)

getId

public int getId()
Returns series id. This method is usually invoked by a SerieEvent handler to identify a series, in combo charts.
Returns:
an int number
See Also:
SerieEvent, SerieListener, GenericGraph.addSerieListener(com.jinsight.jetchart.SerieListener), Graph.setSerieDraggingEnabled(boolean)

setValues

public void setValues(double[] values)
Sets series values. Values are passed as an array of double precision numbers.
Parameters:
values - An array of double precision numbers.

setValues

public void setValues(double[] values,
                      int offset,
                      int len)
Sets series values. Values are passed as an array of double precision numbers. The 'offset' and 'len' parameters delimit a range of data to be extracted from the 'values' array.
Parameters:
values - An array of double precision numbers.
offset - The start offset.
len - The maximum number of values read.

getValues

public double[] getValues()
Returns series values.
Returns:
An array of double precision numbers.
See Also:
setValues(double[])

setMultipleValues

public void setMultipleValues(double[][] multipleValues)
Sets the values of series whose data points are associated with multiple values, as OHLC series and scatter series. Multiple values must be passed as a bidimensional array of double precision numbers.
Parameters:
multipleValues - A bidimensional array of double precision numbers.
See Also:
OHLCSerie, ScatterSerie

setMultipleValues

public void setMultipleValues(double[][] multipleValues,
                              int offset,
                              int len)
Sets the values of series whose data points are associated with multiple values, as OHLC series and scatter series. Multiple values must be passed as a bidimensional array of double precision numbers. The 'offset' and 'len' parameters delimit a range of data to be extracted from the 'multipleValues' array.
Parameters:
multipleValues - A bidimensional array of double precision numbers.
offset - The start offset.
len - The maximum number of data read.
See Also:
OHLCSerie, ScatterSerie

getMultipleValues

public double[][] getMultipleValues()
Returns a bidimensional array of multiple values. This method must be invoked to return values from series that supports multiple values, like scatter series and OHLC series.
Returns:
A bidimensional array of double precision numbers.
See Also:
setMultipleValues(double[][]), OHLCSerie

setValueFormat

public void setValueFormat(java.lang.String valueFormat)
Sets the format of values displayed in data points legends and tooltips. If a value format is informed, a NumberFormat object is created and, if possible, cast to a DecimalFormat instance. Then, all values are formatted, provided that the 'valueFormat' parameter is compatible with valid DecimalFormat patterns. The default format is "#,###,##0.00", numbers are displayed with two decimals.
Parameters:
valueFormat - A pattern string.
See Also:
GraphSerie.setMarkLegendEnabled(boolean), ToolTip

setHighlightEnabled

public void setHighlightEnabled(boolean isHighlightEnabled)
Enables/disables highlight of a series data point. Data point is highlighted when mouse cursor is hovered over it. Highlight color is cyan by default.
The highlight color can be customized with the setHighlightColor() method. Currently, highlight is only supported by a set of subclasses of GraphSerie, like line series,area series, etc. OHLC bar series, candlestick series, scatter series and pie series do not support highlight.
The shape of a highlighted data point is by default a solid square. It can be changed to a few other available styles, matching the shapes of visible data points marks. The available shapes are those supported by the method GraphSerie.setMarksStyle.
Parameters:
isHighlightEnabled - A boolean value(true/false).
See Also:
setHighlightColor(java.awt.Color), GraphSerie.setMarksStyle(int)

setToolTipEnabled

public void setToolTipEnabled(boolean isToolTipEnabled)
Enables/disables a series tooltips. If enabled, series tooltips are only displayed if the setEnabled method of the ToolTip class is set to true.
Parameters:
isToolTipEnabled - A boolean value(true/false).
See Also:
ToolTip.setEnabled(boolean)

setToolTipContent

public void setToolTipContent(java.lang.String[] toolTipContent)
Customizes tooltips contents. Tooltips usually display series values and optionally respective data points labels and a prefixed text. Customized tooltips take precedence over usual tooltips contents.
Parameters:
toolTipContent - An array of strings.
See Also:
ToolTip, ToolTip.setType(int), ToolTip.setLabel(java.lang.String)

setHighlightColor

public void setHighlightColor(java.awt.Color highlightColor)
Sets highlight color.
Parameters:
highlightColor - A Color object.
See Also:
setHighlightEnabled(boolean)

setLegendEnabled

public void setLegendEnabled(boolean isLegendEnabled)
Enables/disables a series legend. By default, image series and candlestick series do not have a legend displayed, because the legend is associated with the series color, and those series do not display a unique color that could be used to identify them. However, these series can be assigned a title with the setTitle method. To set the legend symbol color, use the setColor method. To display their legends in the legend box, set this method to true.

It is useful to display the legend of such series if the tooltip border color is matching respective series color. A series can be identified by comparing the tooltip border color with the legend symbol color.

Parameters:
isLegendEnabled - A boolean value(true/false).
See Also:
GraphSerie.setColor(java.awt.Color), GraphSerie.setTitle(java.lang.String), ToolTip.setMatchingBorderEnabled(boolean)

setValuesQuery

public void setValuesQuery(java.lang.String valuesQuery)
Sets a sql query string to access a database and get series values. The query must return a number of columns equal to the number of values associated with a data point, otherwise an exception is raised.
Parameters:
valuesQuery - A sql query string.
See Also:
GenericGraph.setDriver(java.lang.String), GenericGraph.setConnection(java.lang.String, java.lang.String, java.lang.String), setValues(double[]), setMultipleValues(double[][])

setSVGURLs

public void setSVGURLs(java.lang.String[] svgURLs)
Specifies a list of URLs to be associated with an SVG encoded sequence of series data points. If a data point is clicked the associated URL is loaded.
No URL is assigned to a data point if respective entry in the svgURLs array is null.
This method has no effect if the SVG image is generated as a base64 encoded sequence of characters to be passed to the SVG <image> tag.
Parameters:
svgURLs - An array of strings.
See Also:
ChartEncoder.svgEncode(java.io.File, boolean, int)

getSerieMap

public abstract java.lang.String getSerieMap(java.lang.String[] urls,
                                             int type,
                                             java.lang.String target)
Creates a chart image map. A image map is used in an HTML document to allow regions of an image to be linked to other HTML documents. The web browser will bring up a different document depending where on the image map the user clicks. The map itself is either a separate file (server-side maps) or part of the HTML document (client-side maps).
A client-side map can be inserted into html text to be returned by a servlet that also generates the chart image.
If the 'urls' parameter is informed, data points coordinates are associated with each element found in the array of urls. If hyperlinks are not required set the 'urls' parameter to null.
The second parameter sets the map format type. Image map can be generated in three different formats. A client-side map and an NCSA server or CERN server formatted map. The client-side map is the most used format.
The third parameter sets a target. The target is the name of an html frame used to display the page associated with the image map. This parameter is only related to client-side image mapping. If a target frame is not required set the 'target' parameter to null.
Parameters:
urls - An array of strings containing valid urls.
type - An integer representing the format type.
target - A string object.
See Also:
CLIENT_SIDE, SERVER_SIDE_NCSA, SERVER_SIDE_CERN

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object