java.lang.Object | |
↳ | org.rrd4j.graph.RrdGraphDef |
Class which should be used to define new Rrd4j graph. Once constructed and populated with data
object of this class should be passed to the constructor of the RrdGraph
class which
will actually create the graph.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates RrdGraphDef object and sets default time span (default ending time is 'now',
default starting time is 'end-1day'.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Plots requested data in the form of the filled area starting from zero, using
the color specified.
| |||||||||||
Comment to be printed on the graph.
| |||||||||||
Creates a new (static) virtual datasouce.
| |||||||||||
Defines virtual datasource.
| |||||||||||
Create a new virtual datasource by evaluating a mathematical
expression, specified in Reverse Polish Notation (RPN).
| |||||||||||
Defines virtual datasource.
| |||||||||||
Creates a new (plottable) datasource.
| |||||||||||
This method does basically the same thing as
print(String, ConsolFun, String) ,
but the result is printed on the graph itself, below the chart area. | |||||||||||
Draws a horizontal rule into the graph and optionally adds a legend
| |||||||||||
Draws a horizontal rule into the graph and optionally adds a legend
| |||||||||||
Plots requested data as a line, using the color and the line width specified.
| |||||||||||
Plots requested data as a line, using the color specified.
| |||||||||||
Calculates the chosen consolidation function CF over the given datasource
and creates the result by using the given format string.
| |||||||||||
Computes Y range based on function absolute minimum and maximum
values.
| |||||||||||
Computes Y range based on function absolute minimum and maximum
values.
| |||||||||||
Places Y grid dynamically based on graph Y range.
| |||||||||||
Use this method to request MRTG-like graph (false by default)
| |||||||||||
Controls if the chart area of the image should be antialiased or not.
| |||||||||||
Sets background image - currently, only PNG images can be used as background.
| |||||||||||
Sets default base for magnitude scaling.
| |||||||||||
Overrides the colors for the standard elements of the graph by element name.
| |||||||||||
Overrides the colors for the standard elements of the graph.
| |||||||||||
Sets visibility of the X-axis grid.
| |||||||||||
Sets visibility of the Y-axis grid.
| |||||||||||
Sets the time when the graph should end.
| |||||||||||
Sets the name of the graph to generate.
| |||||||||||
Sets first day of the week.
| |||||||||||
Force the generation of HRULE and VRULE legend even if those HRULE
or VRULE will not be drawn because out of graph boundaries.
| |||||||||||
Sets height of the drawing area within the graph.
| |||||||||||
Sets image format.
| |||||||||||
Creates additional image information.
| |||||||||||
Sets image quality.
| |||||||||||
Creates interlaced GIF image (currently not supported,
method is present only for RRDTool comaptibility).
| |||||||||||
Sets title font.
| |||||||||||
Creates graph only if the current graph is out of date or not existent.
| |||||||||||
Sets logarithmic y-axis scaling.
| |||||||||||
Defines the value normally located at the upper border of the
graph.
| |||||||||||
Sets the lower limit of a graph.
| |||||||||||
Suppress generation of legend, only render the graph.
| |||||||||||
Use this method to turn off minor grid lines (printed by default)
| |||||||||||
Suppresses anything but the graph, works only for height < 64.
| |||||||||||
Sets overlay image - currently, only PNG images can be used as overlay.
| |||||||||||
Sets RrdDbPool usage policy (defaults to true).
| |||||||||||
Sets rigid boundaries mode.
| |||||||||||
Shows or hides graph signature (gator) in the top right corner of the graph
| |||||||||||
Sets default font for graphing.
| |||||||||||
Sets the time when the graph should begin.
| |||||||||||
Suggests which time step should be used by Rrd4j while processing data from RRD files.
| |||||||||||
Controls if the text should be antialiased or not.
| |||||||||||
Configures x-axis grid and labels.
| |||||||||||
Sets starting and ending time for the for the graph.
| |||||||||||
Sets starting and ending time for the for the graph.
| |||||||||||
Defines a title to be written into the graph.
| |||||||||||
Sets unit to be displayed on y axis.
| |||||||||||
Sets the 10**unitsExponent scaling of the y-axis values.
| |||||||||||
Sets the character width on the left side of the graph for
y-axis values.
| |||||||||||
Sets vertical axis grid and labels.
| |||||||||||
Sets vertical label on the left side of the graph.
| |||||||||||
Sets width of the drawing area within the graph.
| |||||||||||
Does the same as
line(String, java.awt.Paint, String) ,
but the graph gets stacked on top of the
previous LINE, AREA or STACK graph. | |||||||||||
Draws a vertical rule into the graph and optionally adds a legend
| |||||||||||
Draws a vertical rule into the graph and optionally adds a legend
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Creates RrdGraphDef object and sets default time span (default ending time is 'now', default starting time is 'end-1day'.
Plots requested data in the form of the filled area starting from zero, using the color specified.
srcName | Virtual source name. |
---|---|
color | Color of the filled area. |
legend | Legend text. |
Creates a new (static) virtual datasouce. The value of the datasource is constant. This value is evaluated by applying the given consolidation function to another virtual datasource.
name | Source name |
---|---|
defName | Other source name |
consolFun | Consolidation function to be applied to other datasource. |
Defines virtual datasource. This datasource can then be used
in other methods like datasource(String, String)
or
gprint(String, ConsolFun, String)
.
name | Source name |
---|---|
rrdPath | Path to RRD file |
dsName | Datasource name in the specified RRD file |
consolFun | Consolidation function (AVERAGE, MIN, MAX, LAST) |
Create a new virtual datasource by evaluating a mathematical expression, specified in Reverse Polish Notation (RPN).
name | Source name |
---|---|
rpnExpression | RPN expression. |
Defines virtual datasource. This datasource can then be used
in other methods like datasource(String, String)
or
gprint(String, ConsolFun, String)
.
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. |
Creates a new (plottable) datasource. Datasource values are obtained from the given plottable object.
name | Source name. |
---|---|
plottable | Plottable object. |
This method does basically the same thing as print(String, ConsolFun, String)
,
but the result is printed on the graph itself, below the chart area.
srcName | Virtual source name |
---|---|
consolFun | Consolidation function to be applied to the source |
format | Format string (like "average = %10.3f %s") |
Draws a horizontal rule into the graph and optionally adds a legend
value | Position of the rule |
---|---|
color | Rule color |
legend | Legend text. If null, legend text will be omitted. |
Draws a horizontal rule into the graph and optionally adds a legend
value | Position of the rule |
---|---|
color | Rule color |
legend | Legend text. If null, legend text will be omitted. |
width | Rule width |
Plots requested data as a line, using the color and the line width specified.
srcName | Virtual source name |
---|---|
color | Line color |
legend | Legend text |
width | Line width (default: 1.0F) |
Plots requested data as a line, using the color specified. Line width is assumed to be 1.0F.
srcName | Virtual source name |
---|---|
color | Line color |
legend | Legend text |
Calculates the chosen consolidation function CF over the given datasource and creates the result by using the given format string. In the format string there should be a '%[l]f', '%[l]g' or '%[l]e' marker in the place where the number should be printed.
If an additional '%s' is found AFTER the marker, the value will be scaled and an appropriate SI magnitude unit will be printed in place of the '%s' marker. The scaling will take the '--base' argu- ment into consideration! If a '%S' is used instead of a '%s', then instead of calculating the appropriate SI magnitude unit for this value, the previously calculated SI magnitude unit will be used. This is useful if you want all the values in a print statement to have the same SI magni- tude unit. If there was no previous SI magnitude calculation made, then '%S' behaves like a '%s', unless the value is 0, in which case it does not remember a SI magnitude unit and a SI magnitude unit will only be calculated when the next '%s' is seen or the next '%S' for a non-zero value. Print results are collected in theRrdGraphInfo
object which is retrieved
from the object
once the graph is created.srcName | Virtual source name |
---|---|
consolFun | Consolidation function to be applied to the source |
format | Format string (like "average = %10.3f %s") |
Computes Y range based on function absolute minimum and maximum values. Default algorithm uses predefined set of ranges. This is good in many cases but it fails miserably when you need to graph something like 260 + 0.001 * sin(x). Default algorithm will use Y range from 250 to 300 and on the graph you will see almost straight line. With --alt-autoscale Y range will be from slightly less the 260 - 0.001 to slightly more then 260 + 0.001 and periodic behavior will be seen.
altAutoscale | true to request alternative autoscaling, false otherwise (default). |
---|
Computes Y range based on function absolute minimum and maximum values. Where setAltAutoscale(true) will modify both the absolute maximum AND minimum values, this option will only affect the maximum value. The minimum value, if not defined elsewhere, will be 0. This option can be useful when graphing router traffic when the WAN line uses compression, and thus the throughput may be higher than the WAN line speed.
altAutoscaleMax | true to request alternative autoscaling, false otherwise (default) |
---|
Places Y grid dynamically based on graph Y range. Algorithm ensures that you always have grid, that there are enough but not too many grid lines and the grid is metric. That is grid lines are placed every 1, 2, 5 or 10 units.
altYGrid | true, if Y grid should be calculated dynamically (defaults to false) |
---|
Use this method to request MRTG-like graph (false by default)
altYMrtg | true, to create MRTG-like graph, false otherwise (default) |
---|
Controls if the chart area of the image should be antialiased or not.
antiAliasing | use true to turn antialiasing on, false to turn it off (default) |
---|
Sets background image - currently, only PNG images can be used as background.
backgroundImage | Path to background image |
---|
Sets default base for magnitude scaling. If you are graphing memory (and NOT network traffic) this switch should be set to 1024 so that 1Kb is 1024 byte. For traffic measurement, 1 kb/s is 1000 b/s.
base | Base value (defaults to 1000.0) |
---|
Overrides the colors for the standard elements of the graph by element name.
See setColor(int, java.awt.Paint)
for full explanation.
colorName | One of the following strings: "BACK", "CANVAS", "SHADEA", "SHADEB", "GRID", "MGRID", "FONT", "FRAME", "ARROW" |
---|---|
color | Any color (paint) you like |
Overrides the colors for the standard elements of the graph. The
colorTag must be one of the following constants defined in the RrdGraphConstants
:
COLOR_BACK
ground,
COLOR_CANVAS
,
COLOR_SHADEA
left/top border,
COLOR_SHADEB
right/bottom border,
COLOR_GRID
,
COLOR_MGRID
major grid,
COLOR_FONT
,
COLOR_FRAME
and axis of the graph or
COLOR_ARROW
. This
method can be called multiple times to set several colors.
colorTag | Color tag, as explained above. |
---|---|
color | Any color (paint) you like |
Sets visibility of the X-axis grid.
drawXGrid | True if X-axis grid should be created (default), false otherwise. |
---|
Sets visibility of the Y-axis grid.
drawYGrid | True if Y-axis grid should be created (default), false otherwise. |
---|
Sets the time when the graph should end. Time in seconds since epoch (1970-01-01) is required. Negative numbers are relative to the current time.
time | Ending time for the graph in seconds since epoch |
---|
Sets the name of the graph to generate. Since Rrd4j outputs GIFs, PNGs, and JPEGs it's recommended that the filename end in either .gif, .png or .jpg. Rrd4j does not enforce this, however. If the filename is set to '-' the image will be created only in memory (no file will be created). PNG and GIF formats are recommended but JPEGs should be avoided.
filename | Path to the image file |
---|
Force the generation of HRULE and VRULE legend even if those HRULE or VRULE will not be drawn because out of graph boundaries.
forceRulesLegend | true if rule legend should be always printed, false otherwise (default). |
---|
Sets height of the drawing area within the graph. This affects the total size of the image.
height | Height of the drawing area. |
---|
Sets image format.
imageFormat | "PNG", "GIF" or "JPG". |
---|
Creates additional image information.
After the image has been created, the graph function uses imageInfo
format string (printf-like) to create output similar to
the print(String, ConsolFun, String)
function.
The format string is supplied with the following parameters:
filename, xsize and ysize (in that particular order).
setImageInfo("<IMG SRC='/img/%s' WIDTH='%d' HEIGHT='%d' ALT='Demo'>");
imageInfo | Image info format. Use %s placeholder for filename, %d placeholder for image width and height. |
---|
Sets image quality. Relevant only for JPEG images.
imageQuality | (0F=worst, 1F=best). |
---|
Creates interlaced GIF image (currently not supported, method is present only for RRDTool comaptibility).
interlaced | true, if GIF image should be interlaced. |
---|
Sets title font.
largeFont | Font to be used for graph title. |
---|
Creates graph only if the current graph is out of date or not existent.
lazy | true, if graph should be 'lazy', false otherwise (defualt) |
---|
Sets logarithmic y-axis scaling.
logarithmic | true, for logarithmic scaling, false otherwise (default). |
---|
Defines the value normally located at the upper border of the graph. If the graph contains higher values, the upper border will move upwards to accommodate these values as well.
If you want to define an upper-limit which will not move in any event you have to usesetRigid(boolean)
method as well.maxValue | Maximal value displayed on the graph. |
---|
Sets the lower limit of a graph. But rather, this is the maximum lower bound of a graph. For example, the value -100 will result in a graph that has a lower limit of -100 or less. Use this method to expand graphs down.
minValue | Minimal value displayed on the graph |
---|
Suppress generation of legend, only render the graph.
noLegend | true if graph legend should be omitted. False otherwise (default). |
---|
Use this method to turn off minor grid lines (printed by default)
noMinorGrid | true, to turn off, false to turn on (default) |
---|
Suppresses anything but the graph, works only for height < 64.
onlyGraph | true if only graph should be created, false otherwise (default). |
---|
Sets overlay image - currently, only PNG images can be used as overlay. Overlay image is printed on the top of the image, once it is completely created.
overlayImage | Path to overlay image |
---|
Sets RrdDbPool usage policy (defaults to true). If set to true,
RrdDbPool
will be used to
access individual RRD files. If set to false, RRD files will be accessed directly.
poolUsed | true, if RrdDbPool class should be used. False otherwise. |
---|
Sets rigid boundaries mode. Normally Rrd4j will automatically expand
the lower and upper limit if the graph contains a value outside the
valid range. With the true
argument you can disable this behavior.
rigid | true if uper and lower limits should not be expanded to accomodate values outside of the specified range. False otherwise (default). |
---|
Shows or hides graph signature (gator) in the top right corner of the graph
showSignature | true, if signature should be seen (default), false otherwise |
---|
Sets default font for graphing. Note that Rrd4j will behave unpredictably if proportional font is selected.
smallFont | Default font for graphing. Use only monospaced fonths. |
---|
Sets the time when the graph should begin. Time in seconds since epoch (1970-01-01) is required. Negative numbers are relative to the current time.
time | Starting time for the graph in seconds since epoch |
---|
Suggests which time step should be used by Rrd4j while processing data from RRD files.
step | Desired time step (don't use this method if you don't know what you're doing). |
---|
Controls if the text should be antialiased or not.
textAntiAliasing | use true to turn text-antialiasing on, false to turn it off (default) |
---|
Configures x-axis grid and labels. The x-axis label is quite complex to configure. So if you don't have very special needs, you can rely on the autoconfiguration to get this right.
Otherwise, you have to configure three elements making up the x-axis labels and grid. The base grid, the major grid and the labels. The configuration is based on the idea that you first specify a well known amount of time and then say how many times it has to pass between each minor/major grid line or label. For the label you have to define two additional items: The precision of the label in seconds and the format used to generate the text of the label. For example, if you wanted a graph with a base grid every 10 minutes and a major one every hour, with labels every hour you would use the following x-axis definition.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.
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) |
Sets starting and ending time for the for the graph. Timestamps in seconds since epoch are required.
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. |
---|
Sets starting and ending time for the for the graph. Timestamps in seconds since epoch are required. Negative numbers are relative to the current time.
startTime | Starting time in seconds since epoch |
---|---|
endTime | Ending time in seconds since epoch |
Defines a title to be written into the graph.
title | Graph title. |
---|
Sets unit to be displayed on y axis. It is wise to use only short units on graph, however.
unit | Unit description |
---|
Sets the 10**unitsExponent scaling of the y-axis values. Normally values will be scaled to the appropriate units (k, M, etc.). However you may wish to display units always in k (Kilo, 10e3) even if the data is in the M (Mega, 10e6) range for instance. Value should be an integer which is a multiple of 3 between -18 and 18, inclu- sive. It is the exponent on the units you which to use. For example, use 3 to display the y-axis values in k (Kilo, 10e3, thou- sands), use -6 to display the y-axis values in u (Micro, 10e-6, millionths). Use a value of 0 to prevent any scaling of the y-axis values.
Sets the character width on the left side of the graph for y-axis values.
unitsLength | Number of characters on the left side of the graphs reserved for vertical axis labels. |
---|
Sets vertical axis grid and labels. Makes vertical grid lines appear at gridStep interval. Every labelFactor*gridStep, a major grid line is printed, along with label showing the value of the grid line.
gridStep | Minor grid step |
---|---|
labelFactor | Specifies how many minor minor grid steps will appear between labels (major grid lines) |
Sets vertical label on the left side of the graph. This is normally used to specify the units used.
verticalLabel | Vertical axis label |
---|
Sets width of the drawing area within the graph. This affects the total size of the image.
width | Width of the drawing area. |
---|
Does the same as line(String, java.awt.Paint, String)
,
but the graph gets stacked on top of the
previous LINE, AREA or STACK graph. Depending on the type of the
previous graph, the STACK will be either a LINE or an AREA. This
obviously implies that the first STACK must be preceded by an AREA
or LINE.
srcName | Virtual source name |
---|---|
color | Stacked graph color |
legend | Legend text |
IllegalArgumentException | Thrown if this STACK has no previously defined AREA, STACK or LINE graph bellow it. |
---|
Draws a vertical rule into the graph and optionally adds a legend
timestamp | Position of the rule (seconds since epoch) |
---|---|
color | Rule color |
legend | Legend text. Use null to omit the text. |
Draws a vertical rule into the graph and optionally adds a legend
timestamp | Position of the rule (seconds since epoch) |
---|---|
color | Rule color |
legend | Legend text. Use null to omit the text. |
width | Rule width |