org.dmonix.util.image.imageobjects
Class GraphImageObject

java.lang.Object
  extended byorg.dmonix.util.image.imageobjects.BaseImageObject
      extended byorg.dmonix.util.image.imageobjects.GraphImageObject
All Implemented Interfaces:
ImageObject

public class GraphImageObject
extends BaseImageObject

The class will paint one or more graphs on a graphics object.
Differenct colors are allowed for each graph.

Copyright: Copyright (c) 2004

Company: dmonix.org

Version:
1.0
Author:
Peter Nerg

Field Summary
static int GRAPH_TYPE_CUBIC
          Uses a cubic style algorithm to connect the dots of the graph.
static int GRAPH_TYPE_QUAD
          Uses a quadratic style algorithm to connect the dots of the graph.
 
Fields inherited from class org.dmonix.util.image.imageobjects.BaseImageObject
bg, dash1, fg, HEIGHT, NOTCH_LENGTH, stroke, STROKE_DASHED_LINE, STROKE_DOTTED_LINE, STROKE_LINE, STROKE_LINE_THICKER, STROKE_POINT, wideStroke, WIDTH, X_AXIS_ABSOLUTE_LENGTH, X_AXIS_HORIZONTAL_END_OFFSET, X_AXIS_HORIZONTAL_START_OFFSET, X_AXIS_NOTCH_COUNT, X_AXIS_NOTCH_DISTANCE, X_AXIS_SCALE_FACTOR, X_AXIS_SCALE_STEP, X_AXIS_VERTICAL_OFFSET, Y_AXIS_ABSOLUTE_LENGTH, Y_AXIS_HORIZONTAL_OFFSET, Y_AXIS_NOTCH_COUNT, Y_AXIS_NOTCH_DISTANCE, Y_AXIS_SCALE_FACTOR, Y_AXIS_SCALE_STEP, Y_AXIS_VERTICAL_END_OFFSET, Y_AXIS_VERTICAL_START_OFFSET
 
Constructor Summary
GraphImageObject(int width, int height)
          Constructor [obviously].
 
Method Summary
 void addData(int graph, int value)
          Add data to a specific graph.
 int addGraph(int graphType, java.awt.Color color)
          Add a new graph to the image.
 void paint(java.awt.Graphics2D g2)
          Paint the image.
 void setXAxisHeaders(java.lang.String[] headers)
          Sets the text printed on the x-axis.
 
Methods inherited from class org.dmonix.util.image.imageobjects.BaseImageObject
calculateXAxisNotchDistanceBasedOnObjects, calculateXAxisNotchDistanceBasedOnValue, calculateYAxisNotchDistanceBasedOnObjects, calculateYAxisNotchDistanceBasedOnValue, drawXAxis, drawYAxis, getBounds
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GRAPH_TYPE_CUBIC

public static final int GRAPH_TYPE_CUBIC
Uses a cubic style algorithm to connect the dots of the graph.

See Also:
Constant Field Values

GRAPH_TYPE_QUAD

public static final int GRAPH_TYPE_QUAD
Uses a quadratic style algorithm to connect the dots of the graph.

See Also:
Constant Field Values
Constructor Detail

GraphImageObject

public GraphImageObject(int width,
                        int height)
Constructor [obviously].

Parameters:
width - The width of the image
height - The height of the image
Method Detail

addGraph

public int addGraph(int graphType,
                    java.awt.Color color)
Add a new graph to the image.
The user may choose the type of algorithm used to connect the dots of the graph.

Parameters:
graphType - The type of the graph
color - The color of the graph
Returns:
A reference to the graph
See Also:
GRAPH_TYPE_CUBIC, GRAPH_TYPE_QUAD

addData

public void addData(int graph,
                    int value)
Add data to a specific graph.

Parameters:
graph - The graph to add the data to
value - The value

setXAxisHeaders

public void setXAxisHeaders(java.lang.String[] headers)
Sets the text printed on the x-axis.

Parameters:
headers - The text

paint

public void paint(java.awt.Graphics2D g2)
Description copied from class: BaseImageObject
Paint the image.

Specified by:
paint in interface ImageObject
Specified by:
paint in class BaseImageObject
Parameters:
g2 - The graphics object.


Copyright © 1998-2005 dmonix.org Peter Nerg, All Rights Reserved.