org.jrobin.graph
public class RrdGraphDef extends Object implements RrdGraphConstants
Field Summary | |
---|---|
protected Font | largeFont |
protected Font | smallFont |
Constructor Summary | |
---|---|
RrdGraphDef()
Creates RrdGraphDef object and sets default time span (default ending time is 'now',
default starting time is 'end-1day'. |
Method Summary | |
---|---|
void | area(String srcName, Paint color, String legend)
Plots requested data in the form of the filled area starting from zero,
using the color specified.
|
void | area(String srcName, Paint color)
Plots requested data in the form of the filled area starting from zero,
using the color specified.
|
void | comment(String text)
Comment to be printed on the graph.
|
void | datasource(String name, String rrdPath, String dsName, String consolFun)
Defines virtual datasource. |
void | datasource(String name, String rrdPath, String dsName, String consolFun, String backend)
Defines virtual datasource. |
void | datasource(String name, String rpnExpression)
Create a new virtual datasource by evaluating a mathematical
expression, specified in Reverse Polish Notation (RPN).
|
void | datasource(String name, String defName, String consolFun)
Creates a new (static) virtual datasource. |
void | datasource(String name, Plottable plottable)
Creates a new (plottable) datasource. |
protected Font | getFontFromResourceName(String name) |
Font | getLargeFont()
Get the default large font for graphing. |
String | getSignature()
Gets the signature string that runs along the right-side of the graph. |
Font | getSmallFont()
Get the default small font for graphing. |
void | gprint(String srcName, String consolFun, String format)
This method does basically the same thing as RrdGraphDef,
but the result is printed on the graph itself, below the chart area.
|
void | hrule(double value, Paint color, String legend)
Draws a horizontal rule into the graph and optionally adds a legend
|
void | hrule(double value, Paint color, String legend, float width)
Draws a horizontal rule into the graph and optionally adds a legend
|
void | line(String srcName, Paint color, String legend, float width)
Plots requested data as a line, using the color and the line width specified.
|
void | line(String srcName, Paint color, String legend)
Plots requested data as a line, using the color specified. |
void | print(String srcName, String consolFun, String format)
Calculates the chosen consolidation function CF over the given datasource
and creates the result by using the given format string. |
void | setAltAutoscale(boolean altAutoscale)
Computes Y range based on function absolute minimum and maximum
values. |
void | setAltAutoscaleMax(boolean altAutoscaleMax)
Computes Y range based on function absolute minimum and maximum
values. |
void | setAltYGrid(boolean altYGrid)
Places Y grid dynamically based on graph Y range. |
void | setAltYMrtg(boolean altYMrtg)
Use this method to request MRTG-like graph (false by default)
|
void | setAntiAliasing(boolean antiAliasing)
Controls if the chart area of the image should be antialiased or not.
|
void | setBackgroundImage(String backgroundImage)
Sets background image - currently, only PNG images can be used as background.
|
void | setBase(double base)
Sets default base for magnitude scaling. |
void | setColor(int colorTag, Paint color)
Overrides the colors for the standard elements of the graph. |
void | setColor(String colorName, Paint color)
Overrides the colors for the standard elements of the graph by element name.
|
void | setDrawXGrid(boolean drawXGrid)
Sets visibility of the X-axis grid.
|
void | setDrawYGrid(boolean drawYGrid)
Sets visibility of the Y-axis grid.
|
void | setEndTime(long time)
Sets the time when the graph should end. |
void | setFilename(String filename)
Sets the name of the graph to generate. |
void | setFirstDayOfWeek(int firstDayOfWeek)
Sets first day of the week.
|
void | setForceRulesLegend(boolean forceRulesLegend)
Force the generation of HRULE and VRULE legend even if those HRULE
or VRULE will not be drawn because out of graph boundaries.
|
void | setHeight(int height)
Sets height of the drawing area within the graph. |
void | setImageFormat(String imageFormat)
Sets image format.
|
void | setImageInfo(String imageInfo)
Creates additional image information.
|
void | setImageQuality(float imageQuality)
Sets image quality. |
void | setInterlaced(boolean interlaced)
Creates interlaced GIF image (currently not supported,
method is present only for RRDTool comaptibility).
|
void | setLargeFont(Font largeFont)
Sets title font.
|
void | setLazy(boolean lazy)
Creates graph only if the current graph is out of date or not existent.
|
void | setLogarithmic(boolean logarithmic)
Sets logarithmic y-axis scaling.
|
void | setMaxValue(double maxValue)
Defines the value normally located at the upper border of the
graph. |
void | setMinValue(double minValue)
Sets the lower limit of a graph. |
void | setNoLegend(boolean noLegend)
Suppress generation of legend, only render the graph.
|
void | setNoMinorGrid(boolean noMinorGrid)
Use this method to turn off minor grid lines (printed by default)
|
void | setOnlyGraph(boolean onlyGraph)
Suppresses anything but the graph, works only for height < 64.
|
void | setOverlayImage(String overlayImage)
Sets overlay image - currently, only PNG images can be used as overlay. |
void | setPoolUsed(boolean poolUsed)
Sets RrdDbPool usage policy (defaults to true). |
void | setRigid(boolean rigid)
Sets rigid boundaries mode. |
void | setShowSignature(boolean showSignature)
Shows or hides graph signature (gator) in the top right corner of the graph
|
void | setSignature(String signature)
Sets the signature string that runs along the right-side of the graph.
|
void | setSmallFont(Font smallFont)
Sets default font for graphing. |
void | setStartTime(long time)
Sets the time when the graph should begin. |
void | setStep(long step)
Suggests which time step should be used by JRobin while processing data from RRD files.
|
void | setTimeAxis(int minorUnit, int minorUnitCount, int majorUnit, int majorUnitCount, int labelUnit, int labelUnitCount, int labelSpan, String simpleDateFormat)
Configures x-axis grid and labels. |
void | setTimeSpan(long startTime, long endTime)
Sets starting and ending time for the for the graph. |
void | setTimeSpan(long[] timestamps)
Sets starting and ending time for the for the graph. |
void | setTitle(String title)
Defines a title to be written into the graph.
|
void | setUnit(String unit)
Sets unit to be displayed on y axis. |
void | setUnitsExponent(int unitsExponent)
Sets the 10**unitsExponent scaling of the y-axis values. |
void | setUnitsLength(int unitsLength)
Sets the character width on the left side of the graph for
y-axis values.
|
void | setValueAxis(double gridStep, int labelFactor)
Sets vertical axis grid and labels. |
void | setVerticalLabel(String verticalLabel)
Sets vertical label on the left side of the graph. |
void | setWidth(int width)
Sets width of the drawing area within the graph. |
void | stack(String srcName, Paint color, String legend)
Does the same as RrdGraphDef,
but the graph gets stacked on top of the
previous LINE, AREA or STACK graph. |
void | vrule(long timestamp, Paint color, String legend)
Draws a vertical rule into the graph and optionally adds a legend
|
void | vrule(long timestamp, Paint color, String legend, float width)
Draws a vertical rule into the graph and optionally adds a legend
|
Parameters: srcName Virtual source name. color Color of the filled area. legend Legend text.
Parameters: srcName Virtual source name. color Color of the filled area.
Parameters: text Comment text
Parameters: name Source name rrdPath Path to RRD file dsName Datasource name in the specified RRD file consolFun Consolidation function (AVERAGE, MIN, MAX, LAST)
Parameters: name Source name rrdPath Path to RRD file dsName Datasource name in the specified RRD file consolFun Consolidation function (AVERAGE, MIN, MAX, LAST) backend Backend to be used while fetching data from a RRD file.
Parameters: name Source name rpnExpression RPN expression.
Parameters: name Source name defName Other source name consolFun Consolidation function to be applied to other datasource.
Parameters: name Source name. plottable Plottable object.
Returns: the font
Returns: the signature string
Returns: the font
Parameters: srcName Virtual source name consolFun Consolidation function to be applied to the source format Format string (like "average = %10.3f %s")
Parameters: value Position of the rule color Rule color legend Legend text. If null, legend text will be omitted.
Parameters: value Position of the rule color Rule color legend Legend text. If null, legend text will be omitted. width Rule width
Parameters: srcName Virtual source name color Line color legend Legend text width Line width (default: 1.0F)
Parameters: srcName Virtual source name color Line color legend Legend text
object
once the graph is created.
Parameters: srcName Virtual source name consolFun Consolidation function to be applied to the source format Format string (like "average = %10.3f %s")
Parameters: altAutoscale true to request alternative autoscaling, false otherwise (default).
Parameters: altAutoscaleMax true to request alternative autoscaling, false otherwise (default)
Parameters: altYGrid true, if Y grid should be calculated dynamically (defaults to false)
Parameters: altYMrtg true, to create MRTG-like graph, false otherwise (default)
Parameters: antiAliasing use true to turn antialiasing on, false to turn it off (default)
Parameters: backgroundImage Path to background image
Parameters: base Base value (defaults to 1000.0)
COLOR_BACK
background,
COLOR_CANVAS
canvas,
COLOR_SHADEA
left/top border,
COLOR_SHADEB
right/bottom border,
COLOR_GRID
major grid,
COLOR_MGRID
minor grid,
COLOR_FONT
font,
COLOR_FRAME
axis of the graph,
COLOR_ARROW
arrow. This method can
be called multiple times to set several colors.
Parameters: colorTag Color tag, as explained above. color Any color (paint) you like
Throws: RrdException Thrown if invalid colorTag is supplied.
Parameters: colorName One of the following strings: "BACK", "CANVAS", "SHADEA", "SHADEB", "GRID", "MGRID", "FONT", "FRAME", "ARROW" color Any color (paint) you like
Throws: RrdException Thrown if invalid element name is supplied.
Parameters: drawXGrid True if X-axis grid should be created (default), false otherwise.
Parameters: drawYGrid True if Y-axis grid should be created (default), false otherwise.
Parameters: time Ending time for the graph in seconds since epoch
Parameters: filename Path to the image file
Parameters: firstDayOfWeek One of the following constants:
MONDAY
,
TUESDAY
,
WEDNESDAY
,
THURSDAY
,
FRIDAY
,
SATURDAY
,
SUNDAY
Parameters: forceRulesLegend true if rule legend should be always printed, false otherwise (default).
Parameters: height Height of the drawing area.
Parameters: imageFormat "PNG", "GIF" or "JPG".
setImageInfo("<IMG SRC='/img/%s' WIDTH='%d' HEIGHT='%d' ALT='Demo'>");
Parameters: imageInfo Image info format. Use %s placeholder for filename, %d placeholder for image width and height.
Parameters: imageQuality (0F=worst, 1F=best).
Parameters: interlaced true, if GIF image should be interlaced.
Parameters: largeFont Font to be used for graph title.
Parameters: lazy true, if graph should be 'lazy', false otherwise (defualt)
Parameters: logarithmic true, for logarithmic scaling, false otherwise (default).
Parameters: maxValue Maximal value displayed on the graph.
Parameters: minValue Minimal value displayed on the graph
Parameters: noLegend true if graph legend should be omitted. False otherwise (default).
Parameters: noMinorGrid true, to turn off, false to turn on (default)
Parameters: onlyGraph true if only graph should be created, false otherwise (default).
Parameters: overlayImage Path to overlay image
RrdDbPool
will be used to
access individual RRD files. If set to false, RRD files will be accessed directly.
Parameters: poolUsed true, if RrdDbPool class should be used. False otherwise.
true
argument you can disable this behavior.
Parameters: rigid true if uper and lower limits should not be expanded to accomodate values outside of the specified range. False otherwise (default).
Parameters: showSignature true, if signature should be seen (default), false otherwise
Parameters: signature the string to print
Parameters: smallFont Default font for graphing. Use only monospaced fonts.
Parameters: time Starting time for the graph in seconds since epoch
Parameters: step Desired time step (don't use this method if you don't know what you're doing).
setTimeAxis(RrdGraphConstants.MINUTE, 10, RrdGraphConstants.HOUR, 1, RrdGraphConstants.HOUR, 1, 0, "%H:%M")The precision in this example is 0 because the %X format is exact. If the label was the name of the day, we would have had a precision of 24 hours, because when you say something like 'Monday' you mean the whole day and not Monday morning 00:00. Thus the label should be positioned at noon. By defining a precision of 24 hours or rather 86400 seconds, you make sure that this happens.
Parameters: minorUnit Minor grid unit. Minor grid, major grid and label units
can be one of the following constants defined in
RrdGraphConstants: SECOND
,
MINUTE
, HOUR
,
DAY
, WEEK
,
MONTH
, YEAR
. minorUnitCount Number of minor grid units between minor grid lines. majorUnit Major grid unit. majorUnitCount Number of major grid units between major grid lines. labelUnit Label unit. labelUnitCount Number of label units between labels. labelSpan Label precision simpleDateFormat Date format (SimpleDateFormat pattern of strftime-like pattern)
Parameters: startTime Starting time in seconds since epoch endTime Ending time in seconds since epoch
Parameters: timestamps Array of timestamps. The first array item will be chosen for the starting timestamp. The last array item will be chosen for the ending timestamp.
Parameters: title Graph title.
Parameters: unit Unit description
Parameters: unitsExponent
Parameters: unitsLength Number of characters on the left side of the graphs reserved for vertical axis labels.
Parameters: gridStep Minor grid step labelFactor Specifies how many minor minor grid steps will appear between labels (major grid lines)
Parameters: verticalLabel Vertical axis label
Parameters: width Width of the drawing area.
Parameters: srcName Virtual source name color Stacked graph color legend Legend text
Throws: RrdException Thrown if this STACK has no previously defined AREA, STACK or LINE graph bellow it.
Parameters: timestamp Position of the rule (seconds since epoch) color Rule color legend Legend text. Use null to omit the text.
Parameters: timestamp Position of the rule (seconds since epoch) color Rule color legend Legend text. Use null to omit the text. width Rule width