📄 rrdgraphdef.java
字号:
* WAN line speed.
*
* @param altAutoscaleMax true to request alternative autoscaling, false
* otherwise (default)
*/
public void setAltAutoscaleMax(boolean altAutoscaleMax) {
this.altAutoscaleMax = altAutoscaleMax;
}
/**
* 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.
*
* @param unitsExponent
*/
public void setUnitsExponent(int unitsExponent) {
this.unitsExponent = unitsExponent;
}
/**
* Sets the character width on the left side of the graph for
* y-axis values.
*
* @param unitsLength Number of characters on the left side of the graphs
* reserved for vertical axis labels.
*/
public void setUnitsLength(int unitsLength) {
this.unitsLength = unitsLength;
}
/**
* Sets vertical label on the left side of the graph. This is normally used
* to specify the units used.
*
* @param verticalLabel Vertical axis label
*/
public void setVerticalLabel(String verticalLabel) {
this.verticalLabel = verticalLabel;
}
/**
* Sets width of the drawing area within the graph. This affects the total
* size of the image.
*
* @param width Width of the drawing area.
*/
public void setWidth(int width) {
this.width = width;
}
/**
* Sets height of the drawing area within the graph. This affects the total
* size of the image.
*
* @param height Height of the drawing area.
*/
public void setHeight(int height) {
this.height = height;
}
/**
* Creates interlaced GIF image (currently not supported,
* method is present only for RRDTool comaptibility).
*
* @param interlaced true, if GIF image should be interlaced.
*/
public void setInterlaced(boolean interlaced) {
this.interlaced = interlaced;
}
/**
* 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 {@link #print(String, String, String)} function.
* The format string is supplied with the following parameters:
* filename, xsize and ysize (in that particular order).
* <p/>
* For example, in order to generate an IMG tag
* suitable for including the graph into a web page, the command
* would look like this:
* <pre>
* setImageInfo("<IMG SRC='/img/%s' WIDTH='%d' HEIGHT='%d' ALT='Demo'>");
* </pre>
*
* @param imageInfo Image info format. Use %s placeholder for filename, %d placeholder for
* image width and height.
*/
public void setImageInfo(String imageInfo) {
this.imageInfo = imageInfo;
}
/**
* Sets image format.
*
* @param imageFormat "PNG", "GIF" or "JPG".
*/
public void setImageFormat(String imageFormat) {
this.imageFormat = imageFormat;
}
/**
* Sets background image - currently, only PNG images can be used as background.
*
* @param backgroundImage Path to background image
*/
public void setBackgroundImage(String backgroundImage) {
this.backgroundImage = backgroundImage;
}
/**
* 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.
*
* @param overlayImage Path to overlay image
*/
public void setOverlayImage(String overlayImage) {
this.overlayImage = overlayImage;
}
/**
* Sets unit to be displayed on y axis. It is wise to use only short units on graph, however.
*
* @param unit Unit description
*/
public void setUnit(String unit) {
this.unit = unit;
}
/**
* Creates graph only if the current graph is out of date or not existent.
*
* @param lazy true, if graph should be 'lazy', false otherwise (defualt)
*/
public void setLazy(boolean lazy) {
this.lazy = lazy;
}
/**
* 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.
*
* @param minValue Minimal value displayed on the graph
*/
public void setMinValue(double minValue) {
this.minValue = minValue;
}
/**
* 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.
* <p/>
* If you want to define an upper-limit which will not move in any
* event you have to use {@link #setRigid(boolean)} method as well.
*
* @param maxValue Maximal value displayed on the graph.
*/
public void setMaxValue(double maxValue) {
this.maxValue = maxValue;
}
/**
* Sets rigid boundaries mode. Normally JRObin will automatically expand
* the lower and upper limit if the graph contains a value outside the
* valid range. With the <code>true</code> argument you can disable this behavior.
*
* @param rigid true if uper and lower limits should not be expanded to accomodate
* values outside of the specified range. False otherwise (default).
*/
public void setRigid(boolean rigid) {
this.rigid = rigid;
}
/**
* 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.
*
* @param base Base value (defaults to 1000.0)
*/
public void setBase(double base) {
this.base = base;
}
/**
* Sets logarithmic y-axis scaling.
*
* @param logarithmic true, for logarithmic scaling, false otherwise (default).
*/
public void setLogarithmic(boolean logarithmic) {
this.logarithmic = logarithmic;
}
/**
* Overrides the colors for the standard elements of the graph. The
* colorTag must be one of the following constants defined in the {@link RrdGraphConstants}:
* {@link RrdGraphConstants#COLOR_BACK COLOR_BACK}ground,
* {@link RrdGraphConstants#COLOR_CANVAS COLOR_CANVAS},
* {@link RrdGraphConstants#COLOR_SHADEA COLOR_SHADEA} left/top border,
* {@link RrdGraphConstants#COLOR_SHADEB COLOR_SHADEB} right/bottom border,
* {@link RrdGraphConstants#COLOR_GRID COLOR_GRID},
* {@link RrdGraphConstants#COLOR_MGRID COLOR_MGRID} major grid,
* {@link RrdGraphConstants#COLOR_FONT COLOR_FONT},
* {@link RrdGraphConstants#COLOR_FRAME COLOR_FRAME} and axis of the graph or
* {@link RrdGraphConstants#COLOR_ARROW COLOR_ARROW}. This
* method can be called multiple times to set several colors.
*
* @param colorTag Color tag, as explained above.
* @param color Any color (paint) you like
* @throws RrdException Thrown if invalid colorTag is supplied.
*/
public void setColor(int colorTag, Paint color) throws RrdException {
if (colorTag >= 0 && colorTag < colors.length) {
colors[colorTag] = color;
}
else {
throw new RrdException("Invalid color index specified: " + colorTag);
}
}
/**
* Overrides the colors for the standard elements of the graph by element name.
* See {@link #setColor(int, java.awt.Paint)} for full explanation.
*
* @param colorName One of the following strings: "BACK", "CANVAS", "SHADEA", "SHADEB",
* "GRID", "MGRID", "FONT", "FRAME", "ARROW"
* @param color Any color (paint) you like
* @throws RrdException Thrown if invalid element name is supplied.
*/
public void setColor(String colorName, Paint color) throws RrdException {
setColor(getColorTagByName(colorName), color);
}
private static int getColorTagByName(String colorName) throws RrdException {
for (int i = 0; i < COLOR_NAMES.length; i++) {
if (COLOR_NAMES[i].equalsIgnoreCase(colorName)) {
return i;
}
}
throw new RrdException("Unknown color name specified: " + colorName);
}
/**
* Suppress generation of legend, only render the graph.
*
* @param noLegend true if graph legend should be omitted. False otherwise (default).
*/
public void setNoLegend(boolean noLegend) {
this.noLegend = noLegend;
}
/**
* Suppresses anything but the graph, works only for height < 64.
*
* @param onlyGraph true if only graph should be created, false otherwise (default).
*/
public void setOnlyGraph(boolean onlyGraph) {
this.onlyGraph = onlyGraph;
}
/**
* Force the generation of HRULE and VRULE legend even if those HRULE
* or VRULE will not be drawn because out of graph boundaries.
*
* @param forceRulesLegend true if rule legend should be always printed,
* false otherwise (default).
*/
public void setForceRulesLegend(boolean forceRulesLegend) {
this.forceRulesLegend = forceRulesLegend;
}
/**
* Defines a title to be written into the graph.
*
* @param title Graph title.
*/
public void setTitle(String title) {
this.title = title;
}
/**
* Suggests which time step should be used by JRobin while processing data from RRD files.
*
* @param step Desired time step (don't use this method if you don't know what you're doing).
*/
public void setStep(long step) {
this.step = step;
}
/**
* Sets default font for graphing. Note that JRobin will behave unpredictably if proportional
* font is selected.
*
* @param smallFont Default font for graphing. Use only monospaced fonths.
*/
public void setSmallFont(Font smallFont) {
this.smallFont = smallFont;
}
/**
* Sets title font.
*
* @param largeFont Font to be used for graph title.
*/
public void setLargeFont(Font largeFont) {
this.largeFont = largeFont;
}
/**
* Defines virtual datasource. This datasource can then be used
* in other methods like {@link #datasource(String, String)} or
* {@link #gprint(String, String, String)}.
*
* @param name Source name
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -