- All Implemented Interfaces:
DataHolder, RrdGraphConstants
RrdGraph class which will actually create the graph.The text printed below the actual graph can be formatted by appending special escaped characters at the end of a text. When ever such a character occurs, all pending text is pushed onto the graph according to the character specified.
Valid markers are: \j for justified, \l for left aligned, \r for right aligned and \c for centered.
Normally there are two space characters inserted between every two items printed into the graph. The space following a string can be suppressed by putting a \g at the end of the string. The \g also squashes any space inside the string if it is at the very end of the string. This can be used in connection with %s to suppress empty unit strings.
A special case is COMMENT:\s this inserts some additional vertical space before placing the next row of legends.
When text has to be formatted without special instructions from your side, RRDTool will automatically justify the text as soon as one string goes over the right edge. If you want to prevent the justification without forcing a newline, you can use the special tag \J at the end of the string to disable the auto justification.
Nested Class Summary
Modifier and TypeClassDescriptionprivate static classFileImageSource class.static interfaceImplementations of this class can be used to generate image than can be layered on graph.private static classUrlImageSource class.Nested classes/interfaces inherited from interface RrdGraphConstants
RrdGraphConstants.FontConstructor, RrdGraphConstants.FontTagModifier and TypeInterfaceDescriptionstatic classFont constructor, to use embedded fonts.static enumAllowed font tag names which can be used insetFont(org.rrd4j.graph.RrdGraphConstants.FontTag, java.awt.Font)methodField Summary
FieldsModifier and TypeFieldDescription(package private) booleanWhether to use alternative autoscaling based on actual min/max values.(package private) booleanWhether alternative autoscaling affects only the maximum value.(package private) booleanWhether alternative autoscaling affects only the minimum value.(package private) booleanWhether to place Y grid dynamically based on graph Y range.(package private) booleanWhether to create MRTG-like graph.(package private) booleanWhether to enable anti-aliasing for the chart area.(package private) RrdGraphDef.ImageSourceBackground image to render behind the graph.(package private) doubleBase value for magnitude scaling (1000 for network, 1024 for memory).(package private) RrdGraphDef.ImageSourceCanvas background image rendered under the plot.private final Paint[]Paint for standard graph elements indexed byElementsNames.(package private) final List<CommentText> List of comment and print text elements for the graph.(package private) DownSamplerOptional downsampler for improved visual representation.(package private) booleanWhether to draw the x-axis grid.(package private) booleanWhether to draw the y-axis grid.(package private) longStart and end timestamps for the graph (seconds since epoch).(package private) StringPath to the output image file, or '-' for in-memory only.(package private) intFirst day of the week for time axis labels.(package private) Font[]Array of Font instances for each font tag (default, title, axis, unit, legend, watermark).(package private) booleanWhether to always render rule legends even if rules are out of bounds.(package private) java.util.function.Function<TimeUnit, Optional<TimeLabelFormat>> Provider that returns a TimeLabelFormat based on the TimeUnit.(package private) StrokeStroke used to draw grid lines.(package private) intWidth and height of the drawing area within the graph.(package private) StringImage format for the output (e.g., PNG, GIF, JPEG).(package private) StringAdditional image info format string (printf-like).(package private) floatImage quality for JPEG images (0F=worst, 1F=best).(package private) booleanWhether to create interlaced or progressive mode image.(package private) booleanWhether to create the graph only if out of date or not existent.(package private) LocaleLocale used for legend formatting.(package private) booleanWhether to use logarithmic y-axis scaling.(package private) StrokeStroke used to draw the major grid lines, which a theme may dash differently.(package private) doubleUpper limit for the graph's y-axis.(package private) doubleLower limit for the graph's y-axis.(package private) booleanWhether to suppress the legend.(package private) booleanWhether to turn off minor grid lines.(package private) booleanWhether to render only the graph (height < 64).(package private) RrdGraphDef.ImageSourceOverlay image rendered on top of the completed graph.(package private) final List<PlotElement> List of plot elements (lines, areas, rules, spans) to render.private RrdDbPoolOptional RrdDbPool instance to use.(package private) booleanWhether to useRrdDbPoolfor accessing RRD files.(package private) booleanWhether to prevent automatic expansion of axis limits.private floatInk length of one dot in a series line, forRrdGraphConstants#COLOR_SERIES_DASH.private floatStated space after each dot, or zero to derive it from the stroke width.(package private) booleanWhether to show the signature on the graph.(package private) StringSignature string displayed on the graph.(package private) booleanWhether to draw plot lines and areas as smoothed bezier curves rather than steps.List of data source definitions for the graph.(package private) longStart and end timestamps for the graph (seconds since epoch).(package private) longSuggested time step for processing RRD data.(package private) booleanWhether to enable text anti-aliasing.(package private) StrokeStroke used to draw tick marks.(package private) TimeAxisSettingConfiguration for the time axis grid and labels.(package private) TimeLabelFormatCustom time label format for the x-axis.(package private) StringTitle text to display on the graph.(package private) TimeZoneTime zone used for time axis labels.(package private) StringUnit string displayed on the y-axis.(package private) intThe 10**unitsExponent scaling for y-axis values.(package private) intCharacter width reserved for y-axis labels on the left side.(package private) ValueAxisSettingConfiguration for the value (y) axis grid and labels.(package private) StringVertical label displayed on the left side of the graph.(package private) intWidth and height of the drawing area within the graph.Fields inherited from interface DataHolder
DEFAULT_POOL_USAGE_POLICYModifier and TypeFieldDescriptionstatic final booleanConstant that defines the defaultRrdDbPoolusage policy.Fields inherited from interface RrdGraphConstants
BLIND_COLOR, COLOR_ARROW, COLOR_BACK, COLOR_CANVAS, COLOR_FONT, COLOR_FRAME, COLOR_GRID, COLOR_MGRID, COLOR_SHADEA, COLOR_SHADEB, COLOR_XAXIS, COLOR_YAXIS, DAY, DEFAULT_ARROW_COLOR, DEFAULT_BACK_COLOR, DEFAULT_BASE, DEFAULT_CANVAS_COLOR, DEFAULT_END, DEFAULT_FONT_COLOR, DEFAULT_FRAME_COLOR, DEFAULT_GRID_COLOR, DEFAULT_HEIGHT, DEFAULT_IMAGE_FORMAT, DEFAULT_IMAGE_QUALITY, DEFAULT_LARGE_FONT, DEFAULT_MGRID_COLOR, DEFAULT_SHADEA_COLOR, DEFAULT_SHADEB_COLOR, DEFAULT_SMALL_FONT, DEFAULT_START, DEFAULT_UNITS_LENGTH, DEFAULT_WIDTH, DEFAULT_XAXIS_COLOR, DEFAULT_YAXIS_COLOR, FIRST_DAY_OF_WEEK, FONTTAG_AXIS, FONTTAG_DEFAULT, FONTTAG_LEGEND, FONTTAG_TITLE, FONTTAG_UNIT, FONTTAG_WATERMARK, FRIDAY, GATOR_FONT, GRID_STROKE, HH_MM, HOUR, IN_MEMORY_IMAGE, LEGEND_BOX, LEGEND_BOX_SPACE, LEGEND_INTERSPACING, LEGEND_LEADING, LEGEND_LEADING_SMALL, MINUTE, MONDAY, MONTH, PADDING_BOTTOM, PADDING_LEFT, PADDING_LEGEND, PADDING_PLOT, PADDING_RIGHT, PADDING_TITLE, PADDING_TOP, PADDING_VLABEL, PROPERTYFONTBOLD, PROPERTYFONTBOLDURL, PROPERTYFONTPLAIN, PROPERTYFONTPLAINURL, PROPERTYFONTSPROPERTIES, PROPERTYFONTSURL, SATURDAY, SECOND, SERIES_DOT, SUNDAY, THURSDAY, TICK_STROKE, TUESDAY, WEDNESDAY, WEEK, YEARModifier and TypeFieldDescriptionstatic final ColorAn transparent colorstatic final intIndex of the arrow color.static final intIndex of the background color.static final intIndex of the canvas color.static final intIndex of the font color.static final intIndex of the frame color.static final intIndex of the minor grid color.static final intIndex of the major grid color.static final intIndex of the top-left graph shade color.static final intIndex of the bottom-right graph shade color.static final intIndex of the x-axis color.static final intIndex of the yaxis color.static final intConstant to represent daystatic final ColorDefault arrow colorstatic final ColorDefault graph background colorstatic final doubleDefault value basestatic final ColorDefault graph canvas colorstatic final StringDefault graph ending timestatic final ColorDefault font colorstatic final ColorDefault frame colorstatic final ColorDefault minor grid colorstatic final intDefault graph heightstatic final StringDefault image formatstatic final floatDefault image quality, used only for jpeg graphsstatic final FontDefault graph large fontstatic final ColorDefault major grid colorstatic final ColorDefault top-left graph shade colorstatic final ColorDefault bottom-right graph shade colorstatic final FontDefault graph small fontstatic final StringDefault graph starting timestatic final intDefault units lengthstatic final intDefault graph widthstatic final ColorDefault x-axis colorstatic final ColorDefault x-axis colorstatic final intDefault first day of the week (obtained from the default locale)static final RrdGraphConstants.FontTagAxis font tagstatic final RrdGraphConstants.FontTagDefault font tagstatic final RrdGraphConstants.FontTagLegend font tagstatic final RrdGraphConstants.FontTagTitle font tagstatic final RrdGraphConstants.FontTagUnit font tagstatic final RrdGraphConstants.FontTagWatermark font tagstatic final intConstant to represent Fridaystatic final FontFont for the Gatorstatic final StrokeStroke used to draw gridstatic final StringHH:mm time formatstatic final intConstant to represent hourstatic final StringConstant to represent in-memory image namestatic final doubleUsed internallystatic final doubleUsed internallystatic final intUsed internallystatic final doubleUsed internallystatic final doubleUsed internallystatic final intConstant to represent minutestatic final intConstant to represent Mondaystatic final intConstant to represent monthstatic final intUsed internallystatic final intUsed internallystatic final doubleUsed internallystatic final intUsed internallystatic final intUsed internallystatic final intUsed internallystatic final intUsed internallystatic final intUsed internallystatic final StringThe name of the bold font, used to define theRrdGraphConstants.DEFAULT_LARGE_FONT.static final StringA URL to the bold font, used to define theRrdGraphConstants.DEFAULT_LARGE_FONT.static final StringThe name of the plain font, used to define theRrdGraphConstants.DEFAULT_SMALL_FONTand theRrdGraphConstants.GATOR_FONT.static final StringA URL to the plain font, used to define theRrdGraphConstants.DEFAULT_SMALL_FONTand theRrdGraphConstants.GATOR_FONT.static final StringThe file that contains font configuration searched in the class path.static final StringA possible URL to a configuration file.static final intConstant to represent Saturdaystatic final intConstant to represent secondstatic final floatInk length of one dot in a series line, in device pixels.static final intConstant to represent Sundaystatic final intConstant to represent Thursdaystatic final StrokeStroke used to draw ticksstatic final intConstant to represent Tuesdaystatic final intConstant to represent Wednesdaystatic final intConstant to represent weekstatic final intConstant to represent yearConstructor Summary
ConstructorsConstructorDescriptionRrdGraphDef(long t1, long t2) Creates RrdGraphDef object.RrdGraphDef(java.time.temporal.TemporalAmount d) Creates new DataProcessor object for the given time duration.Method Summary
Modifier and TypeMethodDescriptionvoidAdd a area like any other but with a constant value, it can be stacked like any other areavoidPlots requested data in the form of the filled area starting from zero, using the color specified.voidPlots requested data in the form of the filled area starting from zero, using the color specified.voidPlots requested data in the form of the filled area starting from zero, using the color specified.voidComment to be printed on the graph.voiddatasource(String name, String rpnExpression) Create a new virtual datasource by evaluating a mathematical expression, specified in Reverse Polish Notation (RPN).voiddatasource(String name, String rrdPath, String dsName, ConsolFun consolFun) Defines virtual datasource.voiddatasource(String name, String rrdPath, String dsName, ConsolFun consolFun, RrdBackendFactory backend) Defines virtual datasource.voiddatasource(String name, String dsName, FetchData fetchData) Creates a new 'fetched' datasource.voiddatasource(String name, String defName, Variable var) Creates a datasource that performs a variable calculation on an another named datasource to yield a single combined timestamp/value.voiddatasource(String name, URI rrdUri, String dsName, ConsolFun consolFun) Defines virtual datasource.voiddatasource(String name, URI rrdUri, String dsName, ConsolFun consolFun, RrdBackendFactory backend) Defines virtual datasource.voiddatasource(String name, FetchData fetchData) Creates a new 'fetched' datasource.voiddatasource(String name, IPlottable plottable) Creates a new (plottable) datasource.(package private) booleanReturns whether ticks should be drawn.private SourcedPlotElementFind parent(package private) PaintgetColor(ElementsNames element) Returns the Paint color for the given graph element type.longReturns the end timestamp for the graph.Fetch the font for a graph slot, falling back to the default font.getPool()The database pool, if in use.floatReport the dash length set bysetSeriesDash(float), which the renderer uses to break up each series line.floatReport the dot spacing set bysetSeriesDashGap(float), the second half of the CSS--graph_plotDashpair.Gets the signature string that runs along the right-side of the graph.longReturns the start timestamp for the graph.longgetStep()Returns the suggested time step for processing RRD data.Returns the time zone used for the graph.voidRead the value of a variable (VDEF) and prints the value by using the given format string.voidRead the value of a variable (VDEF) and prints the the value or the time stamp, according to the strftime flag by using the given format string.voidDraws a horizontal rule into the graph.voidDraws a horizontal rule into the graph and optionally adds a legend.voidDraws a horizontal rule into the graph and optionally adds a legend.voidhrule(double value, Paint color, String legend, BasicStroke stroke) Draws a horizontal rule into the graph and optionally adds a legend.voidDraws a horizontal span into the graph.voidDraws a horizontal span into the graph and optionally adds a legend.booleanWhether a database pool is in use.booleanReport whether plot lines and areas interpolate between samples rather than holding each value until the next one.voidDefine a line like any other but with constant value, it can be stackedvoidline(double value, Paint color, BasicStroke stroke, boolean stack) Define a line like any other but with constant value, it can be stackedvoidPlots requested data as a line, using the color specified.voidPlots requested data as a line, using the color and the line width specified.voidPlots requested data as a line, using the color specified.voidPlots requested data as a line, using the color and the line width specified.voidPlots requested data as a line, using the color and the line width specified.voidPlots requested data as a line, with value shading and stacking both optional.voidPlots requested data as a line shaded by its value rather than drawn flat.voidline(String srcName, Paint color, String legend, BasicStroke stroke, boolean stack) Plots requested data as a line, using the color and theBasicStrokespecified.voidRead the value of a variable (VDEF) and prints the value by using the given format string.voidRead the value of a variable (VDEF) and prints the the value or the time stamp, according to the strftime flag by using the given format string.(package private) intReturns the number of print statements defined.voidsetAltAutoscale(boolean altAutoscale) Computes Y range based on function absolute minimum and maximum values.voidsetAltAutoscaleMax(boolean altAutoscaleMax) Computes Y range based on function absolute minimum and maximum values.voidsetAltAutoscaleMin(boolean altAutoscaleMin) Computes Y range based on function absolute minimum and maximum values.voidsetAltYGrid(boolean altYGrid) Places Y grid dynamically based on graph Y range.voidsetAltYMrtg(boolean altYMrtg) Use this method to request MRTG-like graph (false by default)voidsetAntiAliasing(boolean antiAliasing) Controls if the chart area of the image should be antialiased or not.voidsetBackgroundImage(String backgroundImage) Sets background image.voidsetBackgroundImage(URL backgroundImageUrl) Sets background image.voidsetBackgroundImage(RrdGraphDef.ImageSource backgroundImage) Sets background image.voidsetBase(double base) Sets default base for magnitude scaling.voidsetCanvasImage(String canvasImage) Sets canvas background image.voidsetCanvasImage(URL canvasUrl) Sets canvas background image.voidsetCanvasImage(RrdGraphDef.ImageSource canvasImageSource) Sets canvas background image.voidOverrides the colors for the standard elements of the graph.voidsetColor(ElementsNames colorTag, Paint color) Overrides the colors for the standard elements of the graph.voidsetDownsampler(DownSampler downsampler) Allows to set a downsampler, used to improved the visual representation of graph.voidsetDrawXGrid(boolean drawXGrid) Sets visibility of the X-axis grid.voidsetDrawYGrid(boolean drawYGrid) Sets visibility of the Y-axis grid.voidsetEndTime(long time) Sets the time when the graph should end.voidsetFilename(String filename) Sets the name of the graph to generate.voidsetFirstDayOfWeek(int firstDayOfWeek) Sets first day of the week.voidSets font.voidSets font.voidSets font.voidsetFont(RrdGraphConstants.FontTag fontTag, Font font) /** /** Sets font to be used for a specific font tag.voidsetFont(RrdGraphConstants.FontTag fontTag, Font font, boolean setAll) Sets font.voidsetFont(RrdGraphConstants.FontTag fontTag, Font font, boolean setAll, boolean keepSizes) Sets font.voidsetFontSet(boolean rrdtool) This method reset the font set to it's default values.voidsetForceRulesLegend(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.voidsetGridStroke(Stroke gridStroke) Set the Stroke used to draw gridvoidsetHeight(int height) Sets height of the drawing area within the graph.voidsetImageFormat(String imageFormat) Sets image format.voidsetImageInfo(String imageInfo) Creates additional image information.voidsetImageQuality(float imageQuality) Sets image quality.voidsetInterlaced(boolean interlaced) Creates interlaced or progressive mode image.voidsetLazy(boolean lazy) Creates graph only if the current graph is out of date or not existent.voidSet the locale used for the legend.voidsetLogarithmic(boolean logarithmic) Sets logarithmic y-axis scaling.voidsetMajorGridStroke(Stroke majorGridStroke) Set the stroke used to draw the major grid lines.voidsetMaxValue(double maxValue) Defines the value normally located at the upper border of the graph.voidsetMinValue(double minValue) Sets the lower limit of a graph.voidsetNoLegend(boolean noLegend) Suppress generation of legend, only render the graph.voidsetNoMinorGrid(boolean noMinorGrid) Use this method to turn off minor grid lines (printed by default)voidsetOnlyGraph(boolean onlyGraph) Suppresses anything but the graph, works only for height < 64.voidsetOverlayImage(String overlayImage) Sets overlay image.voidsetOverlayImage(URL overlayImage) Sets overlay image.voidsetOverlayImage(RrdGraphDef.ImageSource overlayImageSource) Sets overlay image.voidUse the given database pool.voidsetPoolUsed(boolean poolUsed) Sets RrdDbPool usage policy (defaults to true).voidsetRigid(boolean rigid) Sets rigid boundaries mode.voidsetSeriesDash(float dashLength) Set the dash length used when a graph carries more than one series.voidsetSeriesDashGap(float dashGap) Set the space drawn after each dot in a dotted series line.voidsetShowSignature(boolean showSignature) Shows or hides graph signature (gator) in the top right corner of the graphvoidsetSignature(String signature) Sets the signature string that runs along the right-side of the graph.voidsetSmoothing(boolean smoothing) Controls whether plot lines and areas are drawn as smoothed bezier curves instead of steps.voidsetStartTime(long time) Sets the time when the graph should begin.voidsetStep(long step) Suggests which time step should be used by Rrd4j while processing data from RRD files.voidsetTextAntiAliasing(boolean textAntiAliasing) Controls if the text should be antialiased or not.voidsetTickStroke(Stroke tickStroke) Set the stroke used to draw ticksvoidsetTimeAxis(int minorUnit, int minorUnitCount, int majorUnit, int majorUnitCount, int labelUnit, int labelUnitCount, int labelSpan, String simpleDateFormat) Configures x-axis grid and labels.voidsetTimeAxis(int minorUnit, int minorUnitCount, int majorUnit, int majorUnitCount, int labelUnit, int labelUnitCount, int labelSpan, TimeLabelFormat format) It configure the x-axis grid in the same way thansetTimeAxis(int, int, int, int, int, int, int, String), but it allows to use aTimeLabelFormatto format the date label.voidsetTimeLabelFormat(TimeLabelFormat format) This allows to keep the default major and minor grid unit, but with changing only the label formatting, using aTimeLabelFormatvoidsetTimeLabelFormatter(java.util.function.Function<TimeUnit, Optional<TimeLabelFormat>> formatProvider) This allows to keep the default major and minor grid unit, but with changing only the label formatting, that will be formatted differently according toTimeUnitchosen for the time axis.voidsetTimeSpan(long[] timestamps) Sets starting and ending time for the for the graph.voidsetTimeSpan(long startTime, long endTime) Sets starting and ending time for the for the graph.voidsetTimeZone(TimeZone tz) Set the time zone used for the legend.voidDefines a title to be written into the graph.voidSets unit to be displayed on y axis.voidsetUnitsExponent(int unitsExponent) Sets the 10**unitsExponent scaling of the y-axis values.voidsetUnitsLength(int unitsLength) Sets the character width on the left side of the graph for y-axis values.voidsetValueAxis(double gridStep, int labelFactor) Sets vertical axis grid and labels.voidsetVerticalLabel(String verticalLabel) Sets vertical label on the left side of the graph.voidsetWidth(int width) Sets width of the drawing area within the graph.(package private) booleanReturns whether there are any plot elements or valid graph comments to render.voidDoes the same asline(String, java.awt.Paint), but the graph gets stacked on top of the previous LINE, AREA or STACK graph.voidDoes the same asline(String, java.awt.Paint, String), but the graph gets stacked on top of the previous LINE, AREA or STACK graph.voidDraws a vertical rule into the graph.voidDraws a vertical rule into the graph and optionally adds a legendvoidDraws a vertical rule into the graph and optionally adds a legendvoidvrule(long timestamp, Paint color, String legend, BasicStroke stroke) Draws a vertical rule into the graph and optionally adds a legendvoidDraws a vertical span into the graph.voidDraws a vertical span into the graph and optionally adds a legend.
Field Details
poolUsed
boolean poolUsedWhether to useRrdDbPoolfor accessing RRD files.pool
Optional RrdDbPool instance to use.antiAliasing
boolean antiAliasingWhether to enable anti-aliasing for the chart area.textAntiAliasing
boolean textAntiAliasingWhether to enable text anti-aliasing.smoothing
boolean smoothingWhether to draw plot lines and areas as smoothed bezier curves rather than steps. Off by default, which preserves the staircase rendering.filename
String filenamePath to the output image file, or '-' for in-memory only.startTime
long startTimeStart and end timestamps for the graph (seconds since epoch).endTime
long endTimeStart and end timestamps for the graph (seconds since epoch).timeAxisSetting
TimeAxisSetting timeAxisSettingConfiguration for the time axis grid and labels.timeLabelFormat
TimeLabelFormat timeLabelFormatCustom time label format for the x-axis.formatProvider
java.util.function.Function<TimeUnit, Optional<TimeLabelFormat>> formatProviderProvider that returns a TimeLabelFormat based on the TimeUnit.valueAxisSetting
ValueAxisSetting valueAxisSettingConfiguration for the value (y) axis grid and labels.altYGrid
boolean altYGridWhether to place Y grid dynamically based on graph Y range.noMinorGrid
boolean noMinorGridWhether to turn off minor grid lines.altYMrtg
boolean altYMrtgWhether to create MRTG-like graph.altAutoscale
boolean altAutoscaleWhether to use alternative autoscaling based on actual min/max values.altAutoscaleMin
boolean altAutoscaleMinWhether alternative autoscaling affects only the minimum value.altAutoscaleMax
boolean altAutoscaleMaxWhether alternative autoscaling affects only the maximum value.unitsExponent
int unitsExponentThe 10**unitsExponent scaling for y-axis values.unitsLength
int unitsLengthCharacter width reserved for y-axis labels on the left side.verticalLabel
String verticalLabelVertical label displayed on the left side of the graph.width
int widthWidth and height of the drawing area within the graph.height
int heightWidth and height of the drawing area within the graph.interlaced
boolean interlacedWhether to create interlaced or progressive mode image.imageInfo
String imageInfoAdditional image info format string (printf-like).imageFormat
String imageFormatImage format for the output (e.g., PNG, GIF, JPEG).imageQuality
float imageQualityImage quality for JPEG images (0F=worst, 1F=best).backgroundImage
RrdGraphDef.ImageSource backgroundImageBackground image to render behind the graph.canvasImage
RrdGraphDef.ImageSource canvasImageCanvas background image rendered under the plot.overlayImage
RrdGraphDef.ImageSource overlayImageOverlay image rendered on top of the completed graph.unit
String unitUnit string displayed on the y-axis.lazy
boolean lazyWhether to create the graph only if out of date or not existent.minValue
double minValueLower limit for the graph's y-axis.maxValue
double maxValueUpper limit for the graph's y-axis.rigid
boolean rigidWhether to prevent automatic expansion of axis limits.base
double baseBase value for magnitude scaling (1000 for network, 1024 for memory).logarithmic
boolean logarithmicWhether to use logarithmic y-axis scaling.colors
Paint for standard graph elements indexed byElementsNames.seriesDash
private float seriesDashInk length of one dot in a series line, forRrdGraphConstants#COLOR_SERIES_DASH. Kept out ofcolorsso that array stays aPaint[]for the ten colour indices it has always held. Zero, as a theme's--graph_plotDash:0states, draws solid instead.seriesDashGap
private float seriesDashGapStated space after each dot, or zero to derive it from the stroke width.noLegend
boolean noLegendWhether to suppress the legend.onlyGraph
boolean onlyGraphWhether to render only the graph (height < 64).forceRulesLegend
boolean forceRulesLegendWhether to always render rule legends even if rules are out of bounds.title
String titleTitle text to display on the graph.step
long stepSuggested time step for processing RRD data.fonts
Font[] fontsArray of Font instances for each font tag (default, title, axis, unit, legend, watermark).drawXGrid
boolean drawXGridWhether to draw the x-axis grid.drawYGrid
boolean drawYGridWhether to draw the y-axis grid.firstDayOfWeek
int firstDayOfWeekFirst day of the week for time axis labels.locale
Locale localeLocale used for legend formatting.tz
TimeZone tzTime zone used for time axis labels.signature
String signatureSignature string displayed on the graph.showSignature
boolean showSignatureWhether to show the signature on the graph.gridStroke
Stroke gridStrokeStroke used to draw grid lines.majorGridStroke
Stroke majorGridStrokeStroke used to draw the major grid lines, which a theme may dash differently.tickStroke
Stroke tickStrokeStroke used to draw tick marks.downsampler
DownSampler downsamplerOptional downsampler for improved visual representation.sources
comments
List of comment and print text elements for the graph.plotElements
List of plot elements (lines, areas, rules, spans) to render.
Constructor Details
RrdGraphDef
public RrdGraphDef(long t1, long t2) Creates RrdGraphDef object.- Parameters:
t1- the start timestampt2- the end timestamp
RrdGraphDef
public RrdGraphDef(java.time.temporal.TemporalAmount d) Creates new DataProcessor object for the given time duration. The given duration will be subtracted from current time.- Parameters:
d- duration to subtract.
Method Details
setSeriesDash
public void setSeriesDash(float dashLength) Set the dash length used when a graph carries more than one series.Zero is a request for a solid line, the way a theme says "no pattern here". A negative length is nonsense rather than a request, so it is ignored.
- Parameters:
dashLength- ink length in pixels; zero draws solid, negatives are ignored
getSeriesDash
public float getSeriesDash()Report the dash length set bysetSeriesDash(float), which the renderer uses to break up each series line.- Returns:
- the dash length this graph draws series lines with, zero for a solid line
setSeriesDashGap
public void setSeriesDashGap(float dashGap) Set the space drawn after each dot in a dotted series line.This is the second half of a CSS
--graph_plotDash:1 3pair. A value that would let the dots merge is raised to the minimum by the renderer rather than honoured, so a theme cannot accidentally turn a dotted line into a solid one.- Parameters:
dashGap- space in pixels after the dot; zero or less derives it instead
getSeriesDashGap
public float getSeriesDashGap()Report the dot spacing set bysetSeriesDashGap(float), the second half of the CSS--graph_plotDashpair.- Returns:
- the stated gap, or zero when the renderer should derive it
setStartTime
public void setStartTime(long time) 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.- Specified by:
setStartTimein interfaceDataHolder- Parameters:
time- Starting time for the graph in seconds since epoch
setEndTime
public void setEndTime(long time) 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.- Specified by:
setEndTimein interfaceDataHolder- Parameters:
time- Ending time for the graph in seconds since epoch
setTimeSpan
public void setTimeSpan(long startTime, long endTime) 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.- Specified by:
setTimeSpanin interfaceDataHolder- Parameters:
startTime- Starting time in seconds since epochendTime- Ending time in seconds since epoch
setTimeSpan
public void setTimeSpan(long[] timestamps) Sets starting and ending time for the for the graph. Timestamps in seconds since epoch are required.- 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.
setPoolUsed
public void setPoolUsed(boolean poolUsed) Sets RrdDbPool usage policy (defaults to true). If set to true,RrdDbPoolwill be used to access individual RRD files. If set to false, RRD files will be accessed directly.- Specified by:
setPoolUsedin interfaceDataHolder- Parameters:
poolUsed- true, if RrdDbPool class should be used. False otherwise.
isPoolUsed
public boolean isPoolUsed()Whether a database pool is in use.- Specified by:
isPoolUsedin interfaceDataHolder- Returns:
- true, if the pool will be used internally to fetch data from RRD files, false otherwise.
getPool
The database pool, if in use.- Specified by:
getPoolin interfaceDataHolder- Returns:
- the current pool, or null
setPool
Use the given database pool.- Specified by:
setPoolin interfaceDataHolder- Parameters:
pool- an optional pool to use.
setFilename
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.- Parameters:
filename- Path to the image file
setTimeAxis
public void setTimeAxis(int minorUnit, int minorUnitCount, int majorUnit, int majorUnitCount, int labelUnit, int labelUnitCount, int labelSpan, String simpleDateFormat) 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.
- Parameters:
minorUnit- Minor grid unit. Minor grid, major grid and label units can be one of the following constants defined inRrdGraphConstants: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- Interval between axis labels.labelUnitCount- Number of label units between labels.labelSpan- Label span in seconds; 86400 puts a daily "Monday" label at noon.simpleDateFormat- Date format (SimpleDateFormat pattern of strftime-like pattern)
setTimeAxis
public void setTimeAxis(int minorUnit, int minorUnitCount, int majorUnit, int majorUnitCount, int labelUnit, int labelUnitCount, int labelSpan, TimeLabelFormat format) It configure the x-axis grid in the same way thansetTimeAxis(int, int, int, int, int, int, int, String), but it allows to use aTimeLabelFormatto format the date label.- Parameters:
minorUnit- the minor unitminorUnitCount- the minor unit countmajorUnit- the major unitmajorUnitCount- the major unit countlabelUnit- the label unitlabelUnitCount- the label unit countlabelSpan- the label spanformat- the time label format
setTimeLabelFormat
This allows to keep the default major and minor grid unit, but with changing only the label formatting, using aTimeLabelFormat- Parameters:
format- a custom dynamic time label format
setTimeLabelFormatter
public void setTimeLabelFormatter(java.util.function.Function<TimeUnit, Optional<TimeLabelFormat>> formatProvider) This allows to keep the default major and minor grid unit, but with changing only the label formatting, that will be formatted differently according toTimeUnitchosen for the time axis.If the returned
Optionalis empty, the default formatting will be keptDefault formatting TimeUnitDefault pattern MINUTE HH:mm HOUR HH:mm DAY EEE dd WEEK 'Week 'w MONTH MMM YEAR yy - Parameters:
formatProvider- AnOptionalholding theTimeLabelFormatto use or empy to keep the default.
setValueAxis
public void setValueAxis(double gridStep, int labelFactor) 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.- Parameters:
gridStep- Minor grid steplabelFactor- Specifies how many minor minor grid steps will appear between labels (major grid lines)
setAltYGrid
public void setAltYGrid(boolean altYGrid) 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.- Parameters:
altYGrid- true, if Y grid should be calculated dynamically (defaults to false)
setNoMinorGrid
public void setNoMinorGrid(boolean noMinorGrid) Use this method to turn off minor grid lines (printed by default)- Parameters:
noMinorGrid- true, to turn off, false to turn on (default)
setAltYMrtg
public void setAltYMrtg(boolean altYMrtg) Use this method to request MRTG-like graph (false by default)- Parameters:
altYMrtg- true, to create MRTG-like graph, false otherwise (default)
setAltAutoscale
public void setAltAutoscale(boolean altAutoscale) 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.- Parameters:
altAutoscale- true to request alternative autoscaling, false otherwise (default).
setAltAutoscaleMin
public void setAltAutoscaleMin(boolean altAutoscaleMin) 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.- Parameters:
altAutoscaleMin- true to request alternative autoscaling, false otherwise (default)
setAltAutoscaleMax
public void setAltAutoscaleMax(boolean altAutoscaleMax) 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.- Parameters:
altAutoscaleMax- true to request alternative autoscaling, false otherwise (default)
setUnitsExponent
public void setUnitsExponent(int unitsExponent) 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, inclusive. 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, thousands), use -6 to display the y-axis values in µ (Micro, 10e-6, millionths). Use a value of 0 to prevent any scaling of the y-axis values.- Parameters:
unitsExponent- the 10**unitsExponent value for scaling y-axis values.
setUnitsLength
public void setUnitsLength(int unitsLength) Sets the character width on the left side of the graph for y-axis values.- Parameters:
unitsLength- Number of characters on the left side of the graphs reserved for vertical axis labels.
setVerticalLabel
Sets vertical label on the left side of the graph. This is normally used to specify the units used.- Parameters:
verticalLabel- Vertical axis label
setWidth
public void setWidth(int width) Sets width of the drawing area within the graph. This affects the total size of the image.- Parameters:
width- Width of the drawing area.
setHeight
public void setHeight(int height) Sets height of the drawing area within the graph. This affects the total size of the image.- Parameters:
height- Height of the drawing area.
setInterlaced
public void setInterlaced(boolean interlaced) Creates interlaced or progressive mode image.- Parameters:
interlaced- true, if GIF image should be interlaced.
setImageInfo
Creates additional image information. After the image has been created, the graph function uses imageInfo format string (printf-like) to create output similar to theprint(String, ConsolFun, String)function. The format string is supplied with the following parameters: filename, xsize and ysize (in that particular order).For example, in order to generate an IMG tag suitable for including the graph into a web page, the command would look like this:
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.
setImageFormat
Sets image format. ImageIO is used to save the image, so any supported format byImageIOcan be used, and it can be extended using ....- Parameters:
imageFormat- Any value as return byImageIO.getReaderFormatNames()
setBackgroundImage
setBackgroundImage
setBackgroundImage
Sets background image.- Parameters:
backgroundImage- AnRrdGraphDef.ImageSourcethat will provides aBufferedImage
setCanvasImage
Sets canvas background image. Canvas image is printed on canvas area, under canvas color and plot. ImageIO is used to download, so any supported format by ImageIO can be used, and it can be extended using ....- Parameters:
canvasImage- Path to canvas image
setCanvasImage
setCanvasImage
Sets canvas background image. Canvas image is printed on canvas area, under canvas color and plot.- Parameters:
canvasImageSource- AnRrdGraphDef.ImageSourcethat will provides aBufferedImage
setOverlayImage
Sets overlay image. Overlay image is printed on the top of the image, once it is completely created. ImageIO is used to download, so any supported format by ImageIO can be used, and it can be extended using ....- Parameters:
overlayImage- Path to overlay image
setOverlayImage
Sets overlay image. Overlay image is printed on the top of the image, once it is completely created. ImageIO is used to download, so any supported format by ImageIO can be used, and it can be extended using ....- Parameters:
overlayImage- URL to overlay image
setOverlayImage
Sets overlay image. Overlay image is printed on the top of the image, once it is completely created.- Parameters:
overlayImageSource- AnRrdGraphDef.ImageSourcethat will provides aBufferedImage
setUnit
Sets unit to be displayed on y axis. It is wise to use only short units on graph, however.- Parameters:
unit- Unit description appended to the y-axis label format; null omits it.
setLazy
public void setLazy(boolean lazy) Creates graph only if the current graph is out of date or not existent.- Parameters:
lazy- true, if graph should be 'lazy', false otherwise (default)
setMinValue
public void setMinValue(double minValue) 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.- Parameters:
minValue- Minimal value displayed on the graph
setMaxValue
public void setMaxValue(double maxValue) 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 use
setRigid(boolean)method as well.- Parameters:
maxValue- Maximal value displayed on the graph.
setRigid
public void setRigid(boolean rigid) 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 thetrueargument you can disable this behavior.- Parameters:
rigid- true if upper and lower limits should not be expanded to accommodate values outside of the specified range. False otherwise (default).
setBase
public void setBase(double base) 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.- Parameters:
base- Base value (defaults to 1000.0)
setLogarithmic
public void setLogarithmic(boolean logarithmic) Sets logarithmic y-axis scaling.- Parameters:
logarithmic- true, for logarithmic scaling, false otherwise (default).
setColor
Overrides the colors for the standard elements of the graph. The colorTag must be one of the following constants defined in theRrdGraphConstants:COLOR_BACKground,COLOR_CANVAS,COLOR_XAXIS,COLOR_SHADEAleft/top border,COLOR_SHADEBright/bottom border,COLOR_GRID,COLOR_MGRIDmajor grid,COLOR_FONT,COLOR_FRAMEand axis of the graph orCOLOR_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
setColor
Overrides the colors for the standard elements of the graph.- Parameters:
colorTag- The element to change color.color- The color of the element.
setNoLegend
public void setNoLegend(boolean noLegend) Suppress generation of legend, only render the graph.- Parameters:
noLegend- true if graph legend should be omitted. False otherwise (default).
setOnlyGraph
public void setOnlyGraph(boolean onlyGraph) Suppresses anything but the graph, works only for height < 64.- Parameters:
onlyGraph- true if only graph should be created, false otherwise (default).
setForceRulesLegend
public 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.- Parameters:
forceRulesLegend- true if rule legend should be always printed, false otherwise (default).
setTitle
Defines a title to be written into the graph.- Parameters:
title- Graph title; leading and trailing whitespace is trimmed.
setStep
public void setStep(long step) Suggests which time step should be used by Rrd4j while processing data from RRD files.- Specified by:
setStepin interfaceDataHolder- Parameters:
step- Desired time step (don't use this method if you don't know what you're doing).
setFontSet
public void setFontSet(boolean rrdtool) This method reset the font set to it's default values. With the flag rrdtool set to true, it's not the old default set that is used, but the one taken from rrdtool. So use false to keep compatibility with previous version and true for a graph matching rrdtool's- Parameters:
rrdtool- true to use rrdtool font set
setFont
/** /** Sets font to be used for a specific font tag. The fontTag must be one of the following constants defined in theRrdGraphConstants:FONTTAG_DEFAULTdefault font,,FONTTAG_TITLEtitle,FONTTAG_AXISgrid axis,,FONTTAG_UNITvertical unit label,,FONTTAG_LEGENDlegend,FONTTAG_WATERMARKwatermark. This method can be called multiple times to set several fonts.- Parameters:
fontTag- Font tag, as explained above.font- Font to be used for tag
setFont
Sets font.- Parameters:
fontTag- Font tag, as explained above.font- Font to be used for tagsetAll- Boolean to flag whether to set all fonts if fontTag == FONTTAG_DEFAULT
setFont
public void setFont(RrdGraphConstants.FontTag fontTag, Font font, boolean setAll, boolean keepSizes) Sets font.- Parameters:
fontTag- Font tag, as explained above.font- Font to be used for tagsetAll- Boolean to flag whether to set all fonts if fontTag == FONTTAG_DEFAULTkeepSizes- Boolean to flag whether to keep original font sizes if setting all fonts.
setFont
Sets font.- Parameters:
fontTag- Font tag as String, as explained insetFont(org.rrd4j.graph.RrdGraphConstants.FontTag, Font, boolean).font- Font to be used for tag
setFont
Sets font.- Parameters:
fontTag- Font tag as String, as explained insetFont(org.rrd4j.graph.RrdGraphConstants.FontTag, Font, boolean).font- Font to be used for tagsetAll- Boolean to flag whether to set all fonts if fontTag == FONTTAG_DEFAULT
setFont
Sets font.- Parameters:
fontTag- Font tag as String, as explained insetFont(org.rrd4j.graph.RrdGraphConstants.FontTag, Font, boolean).font- Font to be used for tagsetAll- Boolean to flag whether to set all fonts if fontTag == FONTTAG_DEFAULTkeepSizes- Boolean to flag whether to keep original font sizes if setting all fonts.
getFont
Fetch the font for a graph slot, falling back to the default font.- Parameters:
tag- the font slot to look up- Returns:
- the font set for that slot, or the default font if the slot is unset
datasource
Defines virtual datasource. This datasource can then be used in other methods likedatasource(String, String)orgprint(String, ConsolFun, String).- Specified by:
datasourcein interfaceDataHolder- Parameters:
name- Source namerrdPath- Path to RRD filedsName- Datasource name in the specified RRD fileconsolFun- Consolidation function (AVERAGE, MIN, MAX, LAST)
datasource
Defines virtual datasource. This datasource can then be used in other methods likedatasource(String, String)orgprint(String, ConsolFun, String).- Specified by:
datasourcein interfaceDataHolder- Parameters:
name- Source namerrdUri- URI to RRD filedsName- Datasource name in the specified RRD fileconsolFun- Consolidation function (AVERAGE, MIN, MAX, LAST)
datasource
public void datasource(String name, String rrdPath, String dsName, ConsolFun consolFun, RrdBackendFactory backend) Defines virtual datasource. This datasource can then be used in other methods likedatasource(String, String)orgprint(String, ConsolFun, String).- Specified by:
datasourcein interfaceDataHolder- Parameters:
name- Source namerrdPath- Path to RRD filedsName- Datasource name in the specified RRD fileconsolFun- Consolidation function (AVERAGE, MIN, MAX, LAST)backend- Backend to be used while fetching data from a RRD file.
datasource
public void datasource(String name, URI rrdUri, String dsName, ConsolFun consolFun, RrdBackendFactory backend) Defines virtual datasource. This datasource can then be used in other methods likedatasource(String, String)orgprint(String, ConsolFun, String).- Specified by:
datasourcein interfaceDataHolder- Parameters:
name- Source namerrdUri- Path to RRD filedsName- Datasource name in the specified RRD fileconsolFun- Consolidation function (AVERAGE, MIN, MAX, LAST)backend- Backend to be used while fetching data from a RRD file.
datasource
Create a new virtual datasource by evaluating a mathematical expression, specified in Reverse Polish Notation (RPN).- Specified by:
datasourcein interfaceDataHolder- Parameters:
name- Source namerpnExpression- Comma-separated RPN tokens naming sources, PREV(x) or numbers.
datasource
Creates a datasource that performs a variable calculation on an another named datasource to yield a single combined timestamp/value.Requires that the other datasource has already been defined; otherwise, it'll end up with no data
- Specified by:
datasourcein interfaceDataHolder- Parameters:
name- - the new virtual datasource namedefName- - the datasource from which to extract the percentile. Must be a previously defined virtual datasourcevar- - a new instance of a Variable used to do the calculation
datasource
Creates a new (plottable) datasource. Datasource values are obtained from the given plottable object.- Specified by:
datasourcein interfaceDataHolder- Parameters:
name- Source name.plottable- the source each interval's values are read from
datasource
Creates a new 'fetched' datasource. Datasource values are obtained from the givenFetchDataobject.- Specified by:
datasourcein interfaceDataHolder- Parameters:
name- Source name.fetchData- the fetched values for the source.
datasource
Creates a new 'fetched' datasource. Datasource values are obtained from the givenFetchDataobject. Values will be extracted from the datasource dsName in the fetchData- Specified by:
datasourcein interfaceDataHolder- Parameters:
name- Source name.dsName- Source name in fetchData.fetchData- the fetched values for the source.
print
Read the value of a variable (VDEF) and prints the value 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' argument 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 magnitude 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 the
RrdGraphInfoobject which is retrieved from theobjectonce the graph is created.- Parameters:
srcName- Virtual source nameformat- Format string (like "average = %10.3f %s")
print
Read the value of a variable (VDEF) and prints the the value or the time stamp, according to the strftime flag by using the given format string. In 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' argument 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 magnitude 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 the
RrdGraphInfoobject which is retrieved from theobjectonce the graph is created.- Parameters:
srcName- Virtual source nameformat- Format string (like "average = %10.3f %s")strftime- use the timestamp from the variable (true) or the numerical value (false)
gprint
Read the value of a variable (VDEF) and prints the value 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' argument 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 magnitude 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 added to the graph as a legend
- Parameters:
srcName- Virtual source nameformat- Format string (like "average = %10.3f %s")
gprint
Read the value of a variable (VDEF) and prints the the value or the time stamp, according to the strftime flag by using the given format string. In 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' argument 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 magnitude 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 added to the graph as a legend.
- Parameters:
srcName- Virtual source nameformat- Format string (like "average = %10.3f %s")strftime- use the timestamp from the variable (true) or the numerical value (false)
comment
Comment to be printed on the graph.- Parameters:
text- Text to print; a trailing alignment marker sets its position.
hrule
hrule
hrule
Draws a horizontal rule into the graph and optionally adds a legend.- Parameters:
value- Position of the rulecolor-Paintfor the rule line and its legend.legend- Legend text. If null, legend text will be omitted.width- Line thickness used to build theBasicStroke.
hrule
Draws a horizontal rule into the graph and optionally adds a legend.- Parameters:
value- Position of the rulecolor-Paintfor the rule line and its legend.legend- Legend text. If null, legend text will be omitted.stroke-BasicStrokeused to draw the rule line.
vrule
vrule
vrule
Draws a vertical rule into the graph and optionally adds a legend- Parameters:
timestamp- Position of the rule (seconds since epoch)color-Paintfor the rule line and its legend.legend- Legend text. Use null to omit the text.width- Line thickness used to build theBasicStroke.
vrule
Draws a vertical rule into the graph and optionally adds a legend- Parameters:
timestamp- Position of the rule (seconds since epoch)color-Paintfor the rule line and its legend.legend- Legend text. Use null to omit the text.stroke-BasicStrokeused to draw the rule line.
hspan
hspan
Draws a horizontal span into the graph and optionally adds a legend.- Parameters:
start- Starting value of the spanend- Ending value of the spancolor-Paintfilling the span and tinting its legend.legend- Legend text. Use null to omit the text.
vspan
vspan
Draws a vertical span into the graph and optionally adds a legend.- Parameters:
start- Start time for the span (seconds since epoch)end- End time for the span (seconds since epoch)color-Paintfilling the span and tinting its legend.legend- Legend text. Use null to omit the text.
line
line
line
line
Plots requested data as a line, using the color and the line width specified.- Parameters:
srcName- Virtual source namecolor-Paintfor the line and its legend.legend- Legend text; null omits the legend entry.width- Line width (default: 1.0F)
line
Plots requested data as a line shaded by its value rather than drawn flat.A vertical gradient across the plot area, so the colour at a point is the colour for the value at that point. The stops are per line, so two plots on one axis may be shaded independently - one shaded, one flat, if the caller asks for that.
- Parameters:
srcName- Virtual source namecolor- Line colour, used for the legend and wherever shading does not applylegend- Legend text; null omits the legend entry.width- Line thickness used to build theBasicStroke.valueShade- bottom-to-top colour stops, or null to draw the line flat
line
public void line(String srcName, Paint color, String legend, float width, boolean stack, Color[] valueShade) Plots requested data as a line, with value shading and stacking both optional.- Parameters:
srcName- the virtual datasource whose series is plottedcolor- the paint the line is stroked withlegend- the legend text, added only when non-nullwidth- the stroke width in pointsstack- true if the line will be stackedvalueShade- bottom-to-top colour stops, or null to draw the line flat
line
Plots requested data as a line, using the color and the line width specified.- Parameters:
srcName- Virtual source namecolor-Paintfor the line and its legend.legend- Legend text; null omits the legend entry.width- Line width (default: 1.0F).stack- true if it will be stacked.
line
Plots requested data as a line, using the color and theBasicStrokespecified.- Parameters:
srcName- Virtual source namecolor-Paintfor the line and its legend.legend- Legend text; null omits the legend entry.stroke- Line stroke to use.stack- true if it will be stacked.
line
Define a line like any other but with constant value, it can be stacked- Parameters:
value- Constant y value the line is drawn at.color-Paintused to draw the line.width- Line width (default: 1.0F).stack- true if it will be stacked.
line
Define a line like any other but with constant value, it can be stacked- Parameters:
value- Constant y value the line is drawn at.color-Paintused to draw the line.stroke- Line stroke to use.stack- true if it will be stacked.
area
area
area
Plots requested data in the form of the filled area starting from zero, using the color specified.- Parameters:
srcName- Virtual source name.color- Color of the filled area.legend- Legend text; null omits the legend entry.stack- true if it will be stacked.
area
Add a area like any other but with a constant value, it can be stacked like any other area- Parameters:
value- Constant y value the filled area is drawn at.color- Color of the filled area.stack- true if it will be stacked.
stack
Does the same asline(String, java.awt.Paint), 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.Note, that when you STACK onto *UNKNOWN* data, Rrd4j will not draw any graphics ... *UNKNOWN* is not zero.
- Parameters:
srcName- Virtual source namecolor- Stacked graph color- Throws:
IllegalArgumentException- Thrown if this STACK has no previously defined AREA, STACK or LINE graph bellow it.
stack
Does the same asline(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. Note, that when you STACK onto *UNKNOWN* data, Rrd4j will not draw any graphics ... *UNKNOWN* is not zero.- Parameters:
srcName- Virtual source namecolor- Stacked graph colorlegend- Legend text; null omits the legend entry.- Throws:
IllegalArgumentException- Thrown if this STACK has no previously defined AREA, STACK or LINE graph bellow it.
findParent
Find parent- Returns:
- the most recently added sourced plot element (LINE, AREA or STACK) this element can be stacked onto
setDrawXGrid
public void setDrawXGrid(boolean drawXGrid) Sets visibility of the X-axis grid.- Parameters:
drawXGrid- True if X-axis grid should be created (default), false otherwise.
setDrawYGrid
public void setDrawYGrid(boolean drawYGrid) Sets visibility of the Y-axis grid.- Parameters:
drawYGrid- True if Y-axis grid should be created (default), false otherwise.
setImageQuality
public void setImageQuality(float imageQuality) Sets image quality. Relevant only for JPEG images.- Parameters:
imageQuality- (0F=worst, 1F=best).
setAntiAliasing
public void setAntiAliasing(boolean antiAliasing) Controls if the chart area of the image should be antialiased or not.- Parameters:
antiAliasing- use true to turn antialiasing on, false to turn it off (default)
setTextAntiAliasing
public void setTextAntiAliasing(boolean textAntiAliasing) Controls if the text should be antialiased or not.- Parameters:
textAntiAliasing- use true to turn text-antialiasing on, false to turn it off (default)
setSmoothing
public void setSmoothing(boolean smoothing) Controls whether plot lines and areas are drawn as smoothed bezier curves instead of steps.Off by default. When enabled, each transition between values is eased into a curve while stretches of unchanged data are left as straight lines, so a graph reads as a trend rather than a staircase. Areas are only smoothed when their lower boundary is the graph baseline; a stacked area keeps the step rendering, because the interpolation is not additive across a change in direction and so a stacked band's two curves cannot be guaranteed to stay ordered.
- Parameters:
smoothing- true to draw smoothed curves, false to draw steps (default)
isSmoothing
public boolean isSmoothing()Report whether plot lines and areas interpolate between samples rather than holding each value until the next one.- Returns:
- true if plot lines and areas are drawn as smoothed curves
setSignature
Sets the signature string that runs along the right-side of the graph. Defaults to "Generated by RRD4J".- Parameters:
signature- the string to print
getSignature
Gets the signature string that runs along the right-side of the graph.- Returns:
- the signature string
setShowSignature
public void setShowSignature(boolean showSignature) Shows or hides graph signature (gator) in the top right corner of the graph- Parameters:
showSignature- true, if signature should be seen (default), false otherwise
setFirstDayOfWeek
setLocale
Set the locale used for the legend.It overrides the firstDayOfWeek
- Parameters:
locale- the locale to set
setTimeZone
Set the time zone used for the legend.- Specified by:
setTimeZonein interfaceDataHolder- Parameters:
tz- the time zone to set
getTimeZone
Returns the time zone used for the graph.- Specified by:
getTimeZonein interfaceDataHolder- Returns:
- the time zone
setGridStroke
setMajorGridStroke
setTickStroke
setDownsampler
Allows to set a downsampler, used to improved the visual representation of graph.More details can be found on Sveinn Steinarsson's thesis
- Parameters:
downsampler- The downsampler that will be used
printStatementCount
int printStatementCount()Returns the number of print statements defined.- Returns:
- the count of PrintText comments with print flag set
shouldPlot
boolean shouldPlot()Returns whether there are any plot elements or valid graph comments to render.- Returns:
- true if the graph has content to plot, false otherwise
getColor
Returns the Paint color for the given graph element type.- Parameters:
element- the graph element type- Returns:
- the Paint color assigned to that element
getEndTime
public long getEndTime()Returns the end timestamp for the graph.- Specified by:
getEndTimein interfaceDataHolder- Returns:
- end time in seconds since epoch
getStartTime
public long getStartTime()Returns the start timestamp for the graph.- Specified by:
getStartTimein interfaceDataHolder- Returns:
- start time in seconds since epoch
getStep
public long getStep()Returns the suggested time step for processing RRD data.- Specified by:
getStepin interfaceDataHolder- Returns:
- the time step in seconds
drawTicks
boolean drawTicks()Returns whether ticks should be drawn.- Returns:
- true if ticks should be drawn, false otherwise