org.ow2.jonas.webapp.jonasadmin.monitoring.graph.utils
Class GraphUtils

java.lang.Object
  extended by org.ow2.jonas.webapp.jonasadmin.monitoring.graph.utils.GraphUtils

public class GraphUtils
extends Object


Field Summary
static Color AXIS_COLOR
           
static Color BG_COLOR
           
static int BOTTOM_MARGIN
           
static int DEF_NUM_MESURE
           
static int DEF_RANGE
           
static int DEF_SIZE_TABLE_MEASURES
           
static int DEF_SPACE_BETWEEN_LINES
           
static Color FG_COLOR
           
static Color GAUGE_FG_COLOR
           
static int GAUGE_TEXT_MAX_LENGTH
           
static int GAUGE_WIDTH
           
static int GRAPHIC_SEPARATOR
           
static Color GRAPHICS_BG_COLOR
           
static Color GRAPHICS_FG_COLOR
           
static int HEIGHT
           
static Color HORIZONTAL_LINE_COLOR
           
static int HORIZONTAL_SPACE
           
static int LEFT_MARGIN
           
static int RIGHT_MARGIN
           
static Color TEXT_COLOR
           
static int TOP_MARGIN
           
static int Y_LENGTH
           
 
Constructor Summary
GraphUtils()
           
 
Method Summary
static int cartesianXToGraphicsX(int x)
           
static int cartesianYToGraphicsY(int y, int factor)
           
static void drawCurrentUsedPerTotal(Graphics g, Long currentUsed, Long total, int xLength, String usedLabel, String unit, boolean compareWithTotal, int graphRank)
          Draw a box on right of monitoring graph to show current used value compared to total value
static void drawGraph(Graphics g, long k, int xLength, int width, int pow, int n, int index, Long[] data, Long maxExpectedValue, String graphTitle, String meausreUnit, int graphRank)
          Draw main monitoring Graph
static int getHeight()
           
static int getWidth(int length)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEF_SIZE_TABLE_MEASURES

public static final int DEF_SIZE_TABLE_MEASURES
See Also:
Constant Field Values

DEF_RANGE

public static final int DEF_RANGE
See Also:
Constant Field Values

DEF_NUM_MESURE

public static final int DEF_NUM_MESURE
See Also:
Constant Field Values

HEIGHT

public static final int HEIGHT
See Also:
Constant Field Values

TOP_MARGIN

public static final int TOP_MARGIN
See Also:
Constant Field Values

RIGHT_MARGIN

public static final int RIGHT_MARGIN
See Also:
Constant Field Values

BOTTOM_MARGIN

public static final int BOTTOM_MARGIN
See Also:
Constant Field Values

LEFT_MARGIN

public static final int LEFT_MARGIN
See Also:
Constant Field Values

HORIZONTAL_SPACE

public static final int HORIZONTAL_SPACE
See Also:
Constant Field Values

Y_LENGTH

public static final int Y_LENGTH
See Also:
Constant Field Values

GAUGE_WIDTH

public static final int GAUGE_WIDTH
See Also:
Constant Field Values

BG_COLOR

public static final Color BG_COLOR

FG_COLOR

public static final Color FG_COLOR

GRAPHICS_BG_COLOR

public static final Color GRAPHICS_BG_COLOR

GAUGE_FG_COLOR

public static final Color GAUGE_FG_COLOR

GRAPHICS_FG_COLOR

public static final Color GRAPHICS_FG_COLOR

AXIS_COLOR

public static final Color AXIS_COLOR

TEXT_COLOR

public static final Color TEXT_COLOR

HORIZONTAL_LINE_COLOR

public static final Color HORIZONTAL_LINE_COLOR

DEF_SPACE_BETWEEN_LINES

public static final int DEF_SPACE_BETWEEN_LINES
See Also:
Constant Field Values

GAUGE_TEXT_MAX_LENGTH

public static final int GAUGE_TEXT_MAX_LENGTH
See Also:
Constant Field Values

GRAPHIC_SEPARATOR

public static final int GRAPHIC_SEPARATOR
See Also:
Constant Field Values
Constructor Detail

GraphUtils

public GraphUtils()
Method Detail

getWidth

public static int getWidth(int length)
Parameters:
length - the data array size (data.length)
Returns:
the picture width when displaying an array of the specified size

getHeight

public static int getHeight()
Returns:
the picture height

cartesianXToGraphicsX

public static int cartesianXToGraphicsX(int x)

cartesianYToGraphicsY

public static int cartesianYToGraphicsY(int y,
                                        int factor)
Parameters:
y - the value to convert into cartesian
factor - represents the graph rank on the image stream
Returns:
cartesian value of first parameter.

drawGraph

public static void drawGraph(Graphics g,
                             long k,
                             int xLength,
                             int width,
                             int pow,
                             int n,
                             int index,
                             Long[] data,
                             Long maxExpectedValue,
                             String graphTitle,
                             String meausreUnit,
                             int graphRank)
Draw main monitoring Graph

Parameters:
g - the graphic (contained in the servlet image)
k - used when
xLength - 2*monitored data number
width - Graph width, depends on xLength
pow - = 10^n
n -
data - datas to draw
maxExpectedValue - over this value, current measured value is considered critical

drawCurrentUsedPerTotal

public static void drawCurrentUsedPerTotal(Graphics g,
                                           Long currentUsed,
                                           Long total,
                                           int xLength,
                                           String usedLabel,
                                           String unit,
                                           boolean compareWithTotal,
                                           int graphRank)
Draw a box on right of monitoring graph to show current used value compared to total value

Parameters:
g - The main graphic. The drawn box will be added in this graphic
currentUsed - current used value of a given measure
total - total used value of a measure
xLength - width of the box
usedLabel - label to display for currentUsed value
unit - measure unit (e.g MB for memory measure)
compareWithTotal - if true then the graph will display comparison betxeen current and total value


Copyright © 2010 OW2 Consortium. All Rights Reserved.