com.jinsight.jetchart
Class Graph

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--com.jinsight.jetchart.GradientPanel
                          |
                          +--com.jinsight.jetchart.GenericGraph
                                |
                                +--com.jinsight.jetchart.Graph
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class Graph
extends GenericGraph

The Graph class implements the graphic context of series whose data points are plotted against only one scale and follow a regular progression along the horizontal or vertical axis, if chart is vertical or horizontal respectively. Each series data point is associated with a descriptive label.
A chart context implemented by the Graph class can be dragged or resized. To drag a chart, just place the mouse cursor within the chart area, then click and drag. To resize chart, double-click mouse within the chart area and then click and drag. A double-click alternates between dragging and resizing chart.

See Also:
GenericGraph, AbstractSerie, GenericGraph.setDraggingEnabled(boolean), Serialized Form

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
 
Field Summary
static int DAY_INCREMENT
          Constant used to set the date increment of a date chart to a daily increment.
static int GRAPH_AREA
          Constant used to clip the background area within which an image can be painted or the gradient colors effect can be displayed.
static int GRAPH_SCOPE
          Constant used to specify that the shift value of a series must be calculated with respect to the number of series added to the chart context, rather than the GraphSet object they belong to.
static int GRAPHSET_SCOPE
          Constant used to specify that the shift value of a series must be calculated with respect to the number of series belonging to the same GraphSet object.
static int HIGH
          Constant used to set multiple tooltips mouse sensitivity to high.
static int LOW
          Constant used to set multiple tooltips mouse sensitivity to low.
static int MEDIUM
          Constant used to set multiple tooltips mouse sensitivity to medium.
static int MONTH_INCREMENT
          Constant used to set the date increment of a date chart to a monthly increment.
static int PARENT_AREA
          Constant used to set the chart container bounds to the area within which a background image can be painted or the gradient colors effect can be displayed.
static int WEEK_INCREMENT
          Constant used to set the date increment of a date chart to a weekly increment.
static int YEAR_INCREMENT
          Constant used to set the date increment of a date chart to a yearly increment.
 
Fields inherited from class com.jinsight.jetchart.GenericGraph
CENTER, TILE, TOP_LEFT
 
Fields inherited from class com.jinsight.jetchart.GradientPanel
BOTTOM_TO_TOP, LEFT_TO_RIGHT, RIGHT_TO_LEFT, TOP_TO_BOTTOM
 
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
Graph()
          Creates a Graph object.
Graph(java.lang.String[] labels)
          Creates a Graph object, taking the chart labels as an array of strings.
 
Method Summary
 void addGraphSet(GraphSet graphSet)
          Adds a GraphSet object to the chart context.
 void addSerie(AbstractSerie serie)
          Adds series objects to the chart context.
 void addZoomListener(ZoomListener zoomListener)
          Adds a zoom event listener to handle zoom events.
protected  void finalize()
           
 GraphEventListener getGraphEventListener()
          Returns a reference to a GraphEventListener object.
 GraphSet getGraphSet(int graphSetIndex)
          Gets a reference to a GraphSet object previously added to the chart context.
 java.lang.String[] getLabels()
          Returns the chart labels.
 ScrollingLabel getScrollingLabel()
          Returns a reference to the ScrollingLabel object.
 Wall getWall()
          Returns a reference to a Wall object.
 boolean isDrawingTrendLine()
          If a trendline is being drawed this method returns true.
 boolean isHorizontalGraphEnabled()
          Returns true if chart orientation is horizontal.
 void paint(java.awt.Graphics gr)
          Overrides the Component class paint() method.
 void readXMLData(java.io.Reader reader)
          Reads chart properties from an xml character stream.
 void refresh()
          Refreshes chart.
 void removeAllSeries()
          Removes all series from the graphic context.
 void removeAllTrendLines()
          Removes all GraphSets' trendlines.
 void removeGraphSet(GraphSet graphSet)
          Removes a GraphSet object from the chart context.
 void removeSerie(AbstractSerie serie)
          Removes a series from the graphic context.
 void removeZoomListener(ZoomListener zoomListener)
          Removes a zoom event listener.
 void set3DSeriesInLineEnabled(boolean is3DSeriesInLineEnabled)
          Enables/disables inline disposition of series in 3D charts.
 void setAutoLabelSpacingEnabled(boolean isAutoLabelSpacingEnabled)
          Enables/disables automatic label spacing.
 void setAutoScalePositioningEnabled(boolean isAutoScalePositioningEnabled)
          Enables/disables automatic scale positioning, in vertical charts.
 void setBackgroundImageArea(int backgroundImageArea)
          Sets the area where a background image is painted.
 void setDataSetRange(int dataSetStartIndex, int dataSetEndIndex)
          Delimits a range of data points to be plotted.
 void setDateIncrement(int dateIncrementType)
          Sets date increment type as a daily, weekly, monthly or yearly increment.
 void setDateIncrement(int dateIncrementType, int dateIncrement)
          Sets date increment type as a daily, weekly, monthly or yearly increment.
 void setGradientColorsArea(int gradientColorsArea)
          Sets the area where the gradient colors effect is displayed.
 void setHDepth(int hDepth)
          Sets horizontal chart 3D depth.
 void setHorizontalGraphEnabled(boolean isHorizontalGraphEnabled)
          Enables/disables horizontal chart.
 void setLabels(java.lang.String[] labels)
          Sets chart labels.
 void setLabels(java.lang.String[] labels, int offset, int len)
          Sets chart labels.
 void setLabelsAxisEndGap(int labelsAxisEndGap)
          Sets the labels axis end gap.
 void setLabelsAxisStartGap(int labelsAxisStartGap)
          Sets the labels axis start gap.
 void setLabelSections(int labelSections)
          Deprecated.  
 void setLabelsFont(java.awt.Font labelsFont)
          Sets the labels font.
 void setLabelsQuery(java.lang.String labelsQuery)
          Sets a sql statement to access a database and get chart labels.
 void setLabelsStatus(int[] labelsStatus)
          Sets labels status.
 void setLabelsStep(int labelsStep)
          Sets a step value to control labels painting.
 void setMonthLabelsEnabled(boolean isMonthLabelsEnabled)
          Enables/disables automatic display of labels as months, if a starting date is informed and labels are not retrieved from a database.
 void setMouseSensitivity(int mouseSensitivity)
          Sets mouse sensitivity.
 void setMultipleHighlightEnabled(boolean isMultipleHighlightEnabled)
          Enables/disables simultaneous highlight of data points.
 void setMultipleSerieEventsEnabled(boolean isMultipleSerieEventsEnabled)
          Enables/disables simultaneous dispatch of series events.
 void setScalesGap(float scalesGap)
          Sets the gap between stacked scales, in vertical charts.
 void setSerieDraggingEnabled(boolean isSerieDraggingEnabled)
          Enables/disables series dragging.
 void setSeriesTitleShiftScope(int seriesTitleShiftScope)
          Sets the series title shift scope.
 void setShiftScope(int shiftScope)
          Sets the scope to be taken into account when calculating the shift value of bar and stacked bar series.
 void setStartDate(java.lang.String startDate)
          Sets a starting date to generate date labels.
 void setStartDate(java.lang.String startDate, int offset)
          Sets a starting date to generate date labels.
 void setTrendLineColor(java.awt.Color trendLineColor)
          Sets the color of the line displayed while drawing a trendline.
 void setTrendLinesDrawingEnabled(boolean isTrendLinesDrawingEnabled)
          Enables/disables manual drawing of trendlines.
 void setVDepth(int vDepth)
          Sets vertical chart 3D depth.
 void setVerticalLabelsEnabled(boolean isVerticalLabelsEnabled)
          Enables/disables vertical orientation of labels.
 void setVerticalLabelsOpacityEnabled(boolean isVerticalLabelsOpaque)
          Enables/disables vertical labels opacity.
 void setZoomAreaColor(java.awt.Color zoomAreaColor)
          Sets the color to paint chart area selected for zooming.
 void setZoomAreaSplitEnabled(boolean isZoomAreaSplit)
          Provides control over the way the zoom area is selected.
 void setZoomEnabled(boolean isZoomEnabled)
          Enables/disables zoom.
 void update(java.awt.Graphics gr)
          Overrides the Component class update() method, to avoid flickering.
 
Methods inherited from class com.jinsight.jetchart.GenericGraph
addLegend, addNote, addSerieListener, getBottomTitle, getLeftTitle, getLegend, getLegend, getRightTitle, getSeries, getToolTip, isPainted, processMouseEvent, processMouseMotionEvent, removeAllNotes, removeLegend, removeNote, removeSerieListener, set3DEnabled, setBackgroundImage, setBottomMargin, setBufferedImageEnabled, setConnection, setDefaultCursor, setDraggingBoxColor, setDraggingEnabled, setDriver, setLeftMargin, setLegendEnabled, setOffScreenGraphEnabled, setRightMargin, setTitle, setTitleFont, setTitleForeground, setTitleGap, setTopMargin, setValueFormat
 
Methods inherited from class com.jinsight.jetchart.GradientPanel
setGradientColors, setGradientOrientation
 
Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DAY_INCREMENT

public static final int DAY_INCREMENT
Constant used to set the date increment of a date chart to a daily increment.

WEEK_INCREMENT

public static final int WEEK_INCREMENT
Constant used to set the date increment of a date chart to a weekly increment.

MONTH_INCREMENT

public static final int MONTH_INCREMENT
Constant used to set the date increment of a date chart to a monthly increment.

YEAR_INCREMENT

public static final int YEAR_INCREMENT
Constant used to set the date increment of a date chart to a yearly increment.

LOW

public static final int LOW
Constant used to set multiple tooltips mouse sensitivity to low.

MEDIUM

public static final int MEDIUM
Constant used to set multiple tooltips mouse sensitivity to medium.

HIGH

public static final int HIGH
Constant used to set multiple tooltips mouse sensitivity to high.

GRAPHSET_SCOPE

public static final int GRAPHSET_SCOPE
Constant used to specify that the shift value of a series must be calculated with respect to the number of series belonging to the same GraphSet object. The shift value is applied to bar series and stacked bar series.
The shift value of series titles displayed above or beside the top of the vertical axis follows the same rule.

GRAPH_SCOPE

public static final int GRAPH_SCOPE
Constant used to specify that the shift value of a series must be calculated with respect to the number of series added to the chart context, rather than the GraphSet object they belong to. The shift value is applied to bar series and stacked bar series.
The shift value of series titles displayed above or beside the top of the vertical axis follows the same rule.

PARENT_AREA

public static final int PARENT_AREA
Constant used to set the chart container bounds to the area within which a background image can be painted or the gradient colors effect can be displayed.

GRAPH_AREA

public static final int GRAPH_AREA
Constant used to clip the background area within which an image can be painted or the gradient colors effect can be displayed. The clipped area is delimited by the vertical and horizontal axis coordinates.
Constructor Detail

Graph

public Graph()
Creates a Graph object. Default constructor.

Graph

public Graph(java.lang.String[] labels)
Creates a Graph object, taking the chart labels as an array of strings.
Parameters:
labels - Array of strings.
See Also:
AbstractSerie.setValues(double[])
Method Detail

addSerie

public void addSerie(AbstractSerie serie)
Description copied from class: GenericGraph
Adds series objects to the chart context. Except for pie series, JetChart can display more than one series simultaneously.

Only series belonging to the same type of chart context can be combined. For example, a line series can be combined with another line series, a bar series, an area series, etc., but can not be combined with an xy series, whose chart context is ScatterGraph.

Overrides:
addSerie in class GenericGraph
Following copied from class: com.jinsight.jetchart.GenericGraph
Parameters:
serie - Any series that extends the AbstractSerie class.
See Also:
AbstractSerie, GraphException

removeSerie

public void removeSerie(AbstractSerie serie)
Description copied from class: GenericGraph
Removes a series from the graphic context.
Overrides:
removeSerie in class GenericGraph
Following copied from class: com.jinsight.jetchart.GenericGraph
Parameters:
serie - Any series that extends the AbstractSerie class and that was previously added to the chart context.
See Also:
AbstractSerie

removeAllSeries

public void removeAllSeries()
Description copied from class: GenericGraph
Removes all series from the graphic context.
Overrides:
removeAllSeries in class GenericGraph

addGraphSet

public void addGraphSet(GraphSet graphSet)
Adds a GraphSet object to the chart context.
Parameters:
graphSet - A GraphSet object.
See Also:
GraphSet

removeGraphSet

public void removeGraphSet(GraphSet graphSet)
Removes a GraphSet object from the chart context.
Parameters:
graphSet - A GraphSet object.
See Also:
GraphSet

getGraphSet

public GraphSet getGraphSet(int graphSetIndex)
Gets a reference to a GraphSet object previously added to the chart context. This method takes the GraphSet index number.
Parameters:
graphSetIndex - An integer number.
See Also:
GraphSet

addZoomListener

public void addZoomListener(ZoomListener zoomListener)
Adds a zoom event listener to handle zoom events. A zoom event listener is an object that adheres to the ZoomListener interface, implementing callback methods to handle zoom events.
Parameters:
zoomListener - A ZoomListener object.
See Also:
removeZoomListener(com.jinsight.jetchart.ZoomListener), ZoomListener, ZoomEvent

removeZoomListener

public void removeZoomListener(ZoomListener zoomListener)
Removes a zoom event listener. A zoom event listener is an object that adheres to the ZoomListener interface, implementing callback methods to handle zoom events.
Parameters:
zoomListener - A ZoomListener object.
See Also:
addZoomListener(com.jinsight.jetchart.ZoomListener), ZoomListener, ZoomEvent

getGraphEventListener

public GraphEventListener getGraphEventListener()
Returns a reference to a GraphEventListener object. This object is created by Graph , and implements both MouseListener and MouseMotionListener interfaces to handle mouse events.
See Also:
GraphEventListener

setAutoLabelSpacingEnabled

public void setAutoLabelSpacingEnabled(boolean isAutoLabelSpacingEnabled)
Enables/disables automatic label spacing. Default value is true.
Parameters:
isAutoLabelSpacingEnabled - A boolean value.

setTrendLinesDrawingEnabled

public void setTrendLinesDrawingEnabled(boolean isTrendLinesDrawingEnabled)
Enables/disables manual drawing of trendlines. If enabled, trendlines can be painted by clicking and dragging mouse across the chart area. When mouse is released the trendline is permanently added to the chart. A manual trendline belongs to a GraphSet object and it is not displayed if chart is zoomed-in.
Parameters:
isTrendLinesDrawingEnabled - A boolean value.
See Also:
GraphSet.setTrendLinesColor(java.awt.Color), GraphSet.setTrendLinesThickness(int)

setTrendLineColor

public void setTrendLineColor(java.awt.Color trendLineColor)
Sets the color of the line displayed while drawing a trendline. Color is black by default.
Parameters:
trendLineColor - A Color object.
See Also:
setTrendLinesDrawingEnabled(boolean)

isDrawingTrendLine

public boolean isDrawingTrendLine()
If a trendline is being drawed this method returns true.
Returns:
A boolean value(true/false).
See Also:
setTrendLinesDrawingEnabled(boolean)

removeAllTrendLines

public void removeAllTrendLines()
Removes all GraphSets' trendlines. To remove only a specific GraphSet's trendlines, use method with the same name implemented in the GraphSet class.
See Also:
GraphSet.removeAllTrendLines()

readXMLData

public void readXMLData(java.io.Reader reader)
                 throws java.io.IOException
Description copied from class: GenericGraph
Reads chart properties from an xml character stream. The incoming data must follow some rules regarding the xml elements to be parsed. Currently, only chart labels and series values are supported. Future versions of JetChart will support a complete set of xml elements to specify all chart properties. The structure of the xml character stream is the following:

<chart>
  <labels>
     l1
     l2
     l3
     l4

  </labels>
  <series id="1">
    <values>
       80
       100
       70
       60

    </values>
  </series>
  <series id="2">
    <multiplevalues qty="4" delimiter="|">
       10|20|15|35
       22|38|12|40
       17|50|20|13
       25|14|38|55

    </multiplevalues>
  </series>
</chart>

In the xml sequence above, we can see the following xml elements and attributes:

<chart> - This is the root element, and it must be closed at the end of the xml file.

<labels> - Used to list textual data representing the chart labels.

<series> - Encloses the properties of a series. The id attribute is used to identify the series within the chart context. It is compared with the value returned by the AbstractSerie.getId() method, and if they match, the properties read from this xml file are assigned to the identified series.

<values> - Used to list textual data representing a series values.

<multiplevalues> - Used to set values of series that display data points associated with multiple values, like ohlc series, for example. The qty attribute is mandatory, and it is used to set the exact number of values expected from each line listed within the <multiplevalues> tag. The delimiter attribute is optional. It is used by the xml parser to tokenize values. If not informed, a space character is used.

Every opened xml element must be closed, otherwise the xml parser raises an exception.
Overrides:
readXMLData in class GenericGraph
Following copied from class: com.jinsight.jetchart.GenericGraph
Parameters:
reader - The reader from which to retrieve the XML data.
Throws:
java.io.IOException - If an error occured while reading the input.
GraphException - If the XML data does not follow certain rules related to the definition of acceptable tags.
See Also:
AbstractSerie.getId()

getWall

public Wall getWall()
Returns a reference to a Wall object. A GraphSet also owns a Wall object, which is painted on the area delimited by the vertical and horizontal axis of the GraphSet. Should this Wall object is enabled, GraphSets' walls are not painted.
The area of this Wall object is delimited by the upper left corner of the topmost GraphSet and the lower right corner of the bottommost GraphSet.
Returns:
Wall object.
See Also:
Wall, GraphSet, GraphSet.getWall()

setAutoScalePositioningEnabled

public void setAutoScalePositioningEnabled(boolean isAutoScalePositioningEnabled)
Enables/disables automatic scale positioning, in vertical charts. Scale objects belong to GraphSets. if this method is set to true, the starting and end points of each scale are adjusted so that the scales are vertically stacked one above the other, without overlapping, and as a consequence series belonging to different GraphSet objects are arranged in groups and vertically positioned one above the other.
Automatic scale positioning is disabled by default and does not apply to horizontal charts.
Parameters:
isAutoScalePositioningEnabled - A boolean value (true/false)
See Also:
GraphSet, Scale.setStartPoint(float), Scale.setEndPoint(float), setScalesGap(float)

setScalesGap

public void setScalesGap(float scalesGap)
Sets the gap between stacked scales, in vertical charts. The scales gap is ignored if automatic scale positioning is disabled. This method takes a decimal value between 0 and 1, representing a fraction of the vertical axis height. The scales gap is 0 by default.
Parameters:
scalesGap - A float number.
See Also:
setAutoScalePositioningEnabled(boolean), Scale.setStartPoint(float), Scale.setEndPoint(float)

setShiftScope

public void setShiftScope(int shiftScope)
Sets the scope to be taken into account when calculating the shift value of bar and stacked bar series. Bars are positioned side by side in 2D charts and 3D charts whose bar and stacked bar series are disposed side by side. If the scope is the Graph object, the shift value is calculated considering the width of each bar and stacked bar series, despite there being series belonging to different GraphSet objects or not. The shift value is calculated with respect to the total number of series.
If the scope is the GraphSet object, the calculation of the shift value takes into account the width of series belonging to the same GraphSet, therefore if two or more GraphSet objects make up the graph, bar and stacked bar series belonging to different GraphSets may overlap each other, unless the GraphSets are stacked one above the other, using the method setAutoScalePositioningEnabled or manually setting the start and end points of all scales so that they do not overlap.
Parameters:
shiftScope - An integer number.
See Also:
GRAPH_SCOPE, GRAPHSET_SCOPE, GraphSet

setSeriesTitleShiftScope

public void setSeriesTitleShiftScope(int seriesTitleShiftScope)
Sets the series title shift scope. A series title can be placed inside the legend box or above/beside the top of the vertical side of the GraphSet object each series belongs to. If more than one series have their titles configured to be displayed at the top of their GraphSet rectangular areas, the titles are disposed side by side, from left to right. The horizontal position of each series title is determined by sequentially adding a shift value to the left coordinate of the string to be painted. The shift value is increased by the length of the titles previously painted. The scope in which the shift is calculated is, by default, delimited by a GraphSet object. For this reason, series belonging to different GraphSet objects might have their titles overlapping each other, should the GraphSet objects are not vertically stacked. The method below adresses this problem, making it possible to calculate the series titles shift value in respect to the whole set of series added to the chart context, despite there being series belonging to different GraphSet objects or not.
Parameters:
seriesTitleShiftScope - An integer number.
See Also:
GRAPH_SCOPE, GRAPHSET_SCOPE, GraphSerie.setTitlePosition(int), GraphSet

setLabelsQuery

public void setLabelsQuery(java.lang.String labelsQuery)
Sets a sql statement to access a database and get chart labels. If informed, labels coming from a database take precedence over those ones passed with the setLabels or the Graph.setStartDate methods. The query must return only one column, otherwise an exception is raised.
Overrides:
setLabelsQuery in class GenericGraph
Parameters:
labelsQuery - A sql statement.
See Also:
GenericGraph.setDriver(java.lang.String), GenericGraph.setConnection(java.lang.String, java.lang.String, java.lang.String), setLabels(java.lang.String[]), setStartDate(java.lang.String)

setLabels

public void setLabels(java.lang.String[] labels)
Sets chart labels. Labels are displayed along the horizontal axis, in vertical charts, or the vertical axis, in horizontal charts.
Parameters:
labels - An array of strings.

setLabels

public void setLabels(java.lang.String[] labels,
                      int offset,
                      int len)
Sets chart labels. The 'offset' and 'len' parameters delimit a range of strings to be extracted from the 'labels' array and set as the chart labels.
Parameters:
labels - An array of strings.
offset - The start offset.
len - The maximum number of labels read.
See Also:
addSerie(com.jinsight.jetchart.AbstractSerie), AbstractSerie.setValues(double[])

getLabels

public java.lang.String[] getLabels()
Returns the chart labels.
Returns:
An array of String objects.

setLabelsFont

public void setLabelsFont(java.awt.Font labelsFont)
Sets the labels font.
Parameters:
labelsFont - A Font object.

setLabelSections

public void setLabelSections(int labelSections)
Deprecated.  

This method has been deprecated. Use setLabelsStatus to control visibility of each label or setLabelsStep to define a step value.
See Also:
setLabelsStatus(int[]), setLabelsStep(int)

setLabelsStep

public void setLabelsStep(int labelsStep)
Sets a step value to control labels painting. The step value is sequentially added to the index of each label to find the index of the next label to be painted, starting from 0. For instance, a step value of 5 applied to a sequence of 20 labels will cause the labels with the following indexes to be painted: 0,5,10,15,20. Intermediary labels are not painted. This method only has effect if automatic label spacing is disabled.
Parameters:
labelsStep - An integer value equal to or greater than 1.
See Also:
setAutoLabelSpacingEnabled(boolean)

setLabelsStatus

public void setLabelsStatus(int[] labelsStatus)
Sets labels status. The status of each label sets its visibility, and it is represented by a sequence of integer numbers using the binary digits '0' and '1'. A value of '0' inhibits the display of respective label, while a value of '1', which is the default, keeps it visible. The binary sequence follows the labels array sequence. The status array length has not necessarily to be of the same size of the labels array length . It can be smaller, and in this case, the remaining labels are always displayed.
Parameters:
labelsStatus - An integer array of binary values(0 or 1).
See Also:
setLabels(java.lang.String[])

setLabelsAxisStartGap

public void setLabelsAxisStartGap(int labelsAxisStartGap)
Sets the labels axis start gap. Labels coordinates starts at the beginning of the labels axis plus the start gap. Default value is 10 pixels.
Parameters:
labelsAxisStartGap - An integer number.

setLabelsAxisEndGap

public void setLabelsAxisEndGap(int labelsAxisEndGap)
Sets the labels axis end gap. Labels coordinates ends at the end of the labels axis minus the end gap. Default value is 10 pixels.
Parameters:
labelsAxisEndGap - An integer number.

setSerieDraggingEnabled

public void setSerieDraggingEnabled(boolean isSerieDraggingEnabled)
Enables/disables series dragging. If series dragging is enabled, the values of a series can be dinamically changed. OHLC series can not be dragged.
To drag a series, move the mouse cursor to the top of a bar or a xy point and when the cursor change to a resizing cursor, click the left button and drag. While dragging, a SerieEvent object is generated and dispatched to objects registered as series event listeners.

After releasing mouse button the scale is recalculated so that data points dragged past the chart bounds are always displayed within a visible area.

Parameters:
isSerieDraggingEnabled - A boolean value(true/false).
See Also:
SerieEvent, SerieListener, refresh(), setHorizontalGraphEnabled(boolean), GenericGraph.addSerieListener(com.jinsight.jetchart.SerieListener)

setZoomEnabled

public void setZoomEnabled(boolean isZoomEnabled)
Enables/disables zoom. If chart dragging is enabled, this parameter has no effect. To select an area for zooming, just click mouse button and drag cursor to delimit the area to be zoomed. While dragging mouse, the selected area is transparently painted. After releasing mouse button, the selected area is zoomed. To zoom-out chart, simply click mouse right button and chart returns to normal view.
Parameters:
isZoomEnabled - A boolean value(true/false).
See Also:
GenericGraph.setDraggingEnabled(boolean), setZoomAreaColor(java.awt.Color), setZoomAreaSplitEnabled(boolean)

setZoomAreaColor

public void setZoomAreaColor(java.awt.Color zoomAreaColor)
Sets the color to paint chart area selected for zooming. The selected area is painted in 'XOR' mode, which combines a given color with the background color, resulting in a transparent effect.
Parameters:
zoomAreaColor - A Color object.
See Also:
setZoomEnabled(boolean), setZoomAreaSplitEnabled(boolean)

setZoomAreaSplitEnabled

public void setZoomAreaSplitEnabled(boolean isZoomAreaSplit)
Provides control over the way the zoom area is selected. If true, selected area is only painted within the bounds of GraphSet objects. If false, the selected area spans from the top of the topmost GraphSet to the bottom of the bottommost one. By default, selected zoom area is not split.
See Also:
GraphSet, setZoomEnabled(boolean)

setStartDate

public void setStartDate(java.lang.String startDate)
Sets a starting date to generate date labels. If labels are manually passed to the Graph object and a starting date is informed, the array of labels is ignored. If labels are retrieved from a database, then the starting date is ignored. The 'startDate' parameter is a valid date in the format 'mmddaaaa'. Subsequent dates are automatically calculated. Date format is localized.
Parameters:
startDate - A String object.
See Also:
setDateIncrement(int)

setStartDate

public void setStartDate(java.lang.String startDate,
                         int offset)
Sets a starting date to generate date labels. If labels are manually passed to the Graph object and a starting date is informed, the array of labels is ignored. If labels are retrieved from a database, then the starting date is ignored. The 'startDate' parameter is a valid date in the format 'mmddaaaa'. Subsequent dates are automatically calculated. The 'offset' parameter shifts date ahead in time, incrementing the starting date in a daily basis. Date format is localized.
Parameters:
startDate - A string object.
offset - An integer number.
See Also:
setDateIncrement(int)

setDateIncrement

public void setDateIncrement(int dateIncrementType)
Sets date increment type as a daily, weekly, monthly or yearly increment. Date increment is unitary.
Parameters:
dateIncrementType - one of the constants used to set the date increment.
See Also:
DAY_INCREMENT, WEEK_INCREMENT, MONTH_INCREMENT, YEAR_INCREMENT

setDateIncrement

public void setDateIncrement(int dateIncrementType,
                             int dateIncrement)
Sets date increment type as a daily, weekly, monthly or yearly increment. The second parameter represents the increment value.
Parameters:
dateIncrementType - one of the constants used to set the date increment.
dateIncrement - an integer number.
See Also:
DAY_INCREMENT, WEEK_INCREMENT, MONTH_INCREMENT, YEAR_INCREMENT

setMonthLabelsEnabled

public void setMonthLabelsEnabled(boolean isMonthLabelsEnabled)
Enables/disables automatic display of labels as months, if a starting date is informed and labels are not retrieved from a database. In a date sequence, labels are displayed at the position corresponding to the first day of each month. If labels are displayed as months, the date increment type and increment values reset to the default values(daily type and unitary increment), despite the values passed to the setDateIncrement(int dateIncrementType, int dateIncrement) method.
Parameters:
isMonthLabelsEnabled - A boolean value
See Also:
setStartDate(java.lang.String), setDateIncrement(int)

setMultipleHighlightEnabled

public void setMultipleHighlightEnabled(boolean isMultipleHighlightEnabled)
Enables/disables simultaneous highlight of data points. Data points are simultaneously highlighted if mouse cursor is positioned within a chart region delimited by a label coordinate and chart is 2D. The width or height of this region, depending on chart orientation, can be adjusted with the setMouseSensitivity method.
Parameters:
isMultipleHighlightEnabled - A boolean value(true/false).
See Also:
setMouseSensitivity(int)

setMultipleSerieEventsEnabled

public void setMultipleSerieEventsEnabled(boolean isMultipleSerieEventsEnabled)
Enables/disables simultaneous dispatch of series events. Series events are dispatched to registered series event listeners if mouse cursor is moved over the chart area. If mouse cursor is positioned within a series data point bounds, a SerieEvent object has its element index property set to the data point index. If not, its element index property is set to -1. After that, it is dispatched to SerieListener objects interested in handling series events. By default, the vertical and horizontal dimensions of a data point area are checked before setting the element index. If this method is set to true, just one dimension is checked, and if cursor is positioned within a region delimited by a label coordinate, multiple SerieEvent objects are simultaneously created and their element index properties are set to the index of that label coordinate.

If data points values must be displayed in a way different from tooltips, like Labels laid out on a Panel, for example, set this method to true and capture data points values by handling series events with the mouseMoved method, which is a method required by the SerieListener interface.

Series events are also dispatched if a data point is clicked, released or dragged. However, this method only affects the dispatch of events as a result of mouse moving.

Parameters:
isMultipleSerieEventsEnabled - a boolean value(true/false).
See Also:
SerieEvent, SerieListener, GenericGraph.addSerieListener(com.jinsight.jetchart.SerieListener), setMouseSensitivity(int)

setMouseSensitivity

public void setMouseSensitivity(int mouseSensitivity)
Sets mouse sensitivity. The greater the sensitivity the wider the data point area used to check if mouse cursor is in a valid position to display multiple tooltips, simultaneously highlight data points, dispatch multiple series events, and display scrolling bars and the scrolling label. Default value is Graph.HIGH.
Parameters:
mouseSensitivity - One of the constants used to set mouse sensitivity.
See Also:
HIGH, MEDIUM, LOW, ToolTip.setMultipleEnabled(boolean), setMultipleHighlightEnabled(boolean), setMultipleSerieEventsEnabled(boolean), ScrollingBar, ScrollingLabel

setVDepth

public void setVDepth(int vDepth)
Sets vertical chart 3D depth. In 3D mode, vertical charts can be assigned a depth ranging from 0 to 30 pixels.
Parameters:
vDepth - An int number representing vertical depth.
See Also:
GenericGraph.set3DEnabled(boolean)

setHDepth

public void setHDepth(int hDepth)
Sets horizontal chart 3D depth. In 3D mode, horizontal charts can be assigned a depth ranging from 0 to 30 pixels.
Parameters:
hDepth - An int number representing horizontal depth.
See Also:
GenericGraph.set3DEnabled(boolean)

setHorizontalGraphEnabled

public void setHorizontalGraphEnabled(boolean isHorizontalGraphEnabled)
Enables/disables horizontal chart. Charts are vertical by default.
Parameters:
isHorizontalGraphEnabled - A boolean value(true/false).

isHorizontalGraphEnabled

public boolean isHorizontalGraphEnabled()
Returns true if chart orientation is horizontal.
Returns:
A boolean value(true/false).
See Also:
setHorizontalGraphEnabled(boolean)

set3DSeriesInLineEnabled

public void set3DSeriesInLineEnabled(boolean is3DSeriesInLineEnabled)
Enables/disables inline disposition of series in 3D charts. By default, series are disposed inline. This method must be set to false if series have to be arranged side by side.
Parameters:
is3DSeriesInLineEnabled - A boolean value(true/false).

setVerticalLabelsEnabled

public void setVerticalLabelsEnabled(boolean isVerticalLabelsEnabled)
Enables/disables vertical orientation of labels. If a label displays multiple lines, only the first line is displayed.
Parameters:
isVerticalLabelsEnabled - A boolean value(true/false).

setVerticalLabelsOpacityEnabled

public void setVerticalLabelsOpacityEnabled(boolean isVerticalLabelsOpaque)
Enables/disables vertical labels opacity. Vertical labels are painted inside images, which are rotated to a 90 degree angle and painted below the x axis. These images are transparent by default, what is convenient if the chart background is painted with gradient colors. However, sometimes applets do not display vertical labels as expected, if opacity is disabled. This method disables transparency, causing the label image background to be painted with the same color of the chart background.
Parameters:
isVerticalLabelsOpaque - A boolean value(true/false).

getScrollingLabel

public ScrollingLabel getScrollingLabel()
Returns a reference to the ScrollingLabel object.
Returns:
ScrollingLabel object.
See Also:
ScrollingLabel

setDataSetRange

public void setDataSetRange(int dataSetStartIndex,
                            int dataSetEndIndex)
Delimits a range of data points to be plotted. The values of variables dataSetStartIndex and dataSetEndIndex have to be within 0 and the maximum value between the largest series length and the number of labels,minus 1.The dataSetEndIndex variable value must always be greater than or equal to dataSetStartIndex.
If chart is zoomed-in or zoomed-out, the values of these variables are changed to reflect the indexes of the leftmost and rightmost labels displayed, if chart is vertical, or topmost and bottommost labels, if chart is horizontal. These values are then dispatched to ZoomListener objects, where they can be caught and assigned to the properties of a scrolling bar object, for example, in order to implement scrolling of reduced areas. These variables values are also changed if at least one of the conditions outlined below takes place: 1 - a new array of labels is informed; 2 - the visibility status of one or more labels is changed; 3 - a start date is informed; 4 - month labels are enabled; 5 - labels are retrieved from a database; 6 - values are retrieved from a database; 7 - new values are assigned to one or more series; 8 - series are added to or removed from the chart context.
Parameters:
dataSetStartIndex - An integer number
dataSetEndIndex - An integer number
See Also:
setLabels(java.lang.String[]), setLabelsStatus(int[]), setStartDate(java.lang.String), setMonthLabelsEnabled(boolean), GraphSerie.setValues(double[]), GraphSerie.setMultipleValues(double[][]), GraphSerie.setValuesQuery(java.lang.String), addSerie(com.jinsight.jetchart.AbstractSerie), removeSerie(com.jinsight.jetchart.AbstractSerie), removeAllSeries(), ZoomListener, ZoomEvent

setBackgroundImageArea

public void setBackgroundImageArea(int backgroundImageArea)
Sets the area where a background image is painted. Default area is the parent container bounds. If this method is passed GRAPH_AREA, the background image area is delimited by the vertical and horizontal axis coordinates.
Parameters:
backgroundImageArea - An integer value.
See Also:
PARENT_AREA, GRAPH_AREA

setGradientColorsArea

public void setGradientColorsArea(int gradientColorsArea)
Sets the area where the gradient colors effect is displayed. Default area is the parent container bounds. If this method is passed GRAPH_AREA, the area is delimited by the vertical and horizontal axis coordinates.
Parameters:
gradientColorsArea - An integer value.
See Also:
PARENT_AREA, GRAPH_AREA

refresh

public void refresh()
Refreshes chart. The first time a chart is displayed, some private methods of several classes are invoked to calculate margins, scale values, etc., and these processes are executed just one time, unless any change that affects chart data or appearance takes place.
Overrides:
refresh in class GenericGraph

update

public void update(java.awt.Graphics gr)
Overrides the Component class update() method, to avoid flickering.
Overrides:
update in class java.awt.Container
Parameters:
gr - A Graphics object, where painting is done. This object is automatically created by the AWT classes and passed to the update() method, which in turn sends it to the paint() method.
See Also:
paint(java.awt.Graphics)

paint

public void paint(java.awt.Graphics gr)
Overrides the Component class paint() method. Chart plotting starts in this method, basically by delegating the painting process to each one of the objects held by the chart context.
Overrides:
paint in class GradientPanel
Parameters:
gr - A Graphics object.
See Also:
update(java.awt.Graphics)

finalize

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