📄 rrdgraphdef.java
字号:
{
this.minorGridColor = c;
}
/**
* Determines the color of chart area frame.
* @param c Color to use.
*/
public void setFrameColor( Color c )
{
this.frameColor = c;
}
/**
* Determines the color of chart X axis.
* @param c Color to use.
*/
public void setAxisColor( Color c )
{
this.axisColor = c;
}
/**
* Determines the color of the small axis arrow on the chart X axis.
* @param c Color to use.
*/
public void setArrowColor( Color c )
{
this.arrowColor = c;
}
/**
* Determines if the minor grid for the X axis needs to be drawn.
* @param visible True if minor grid needs to be drawn, false if not.
*/
public void setMinorGridX( boolean visible )
{
this.minorGridX = visible;
}
/**
* Determines if the minor grid for the Y axis needs to be drawn.
* @param visible True if minor grid needs to be drawn, false if not.
*/
public void setMinorGridY( boolean visible )
{
this.minorGridY = visible;
}
/**
* Determines if the major grid with labels for the X axis needs to be drawn.
* @param visible True if major grid needs to be drawn, false if not.
*/
public void setMajorGridX( boolean visible )
{
this.majorGridX = visible;
}
/**
* Determines if the major grid with labels for the Y axis needs to be drawn.
* @param visible True if major grid needs to be drawn, false if not.
*/
public void setMajorGridY( boolean visible )
{
this.majorGridY = visible;
}
/**
* Determines if the X axis grid should be drawn.
* @param visible True if grid needs to be drawn, false if not.
*/
public void setGridX( boolean visible )
{
this.gridX = visible;
}
/**
* Determines if the Y axis grid should be drawn.
* @param visible True if grid needs to be drawn, false if not.
*/
public void setGridY( boolean visible )
{
this.gridY = visible;
}
/**
* Determine if the graph grid is in front of the chart itself, or behind it.
* Default is in front of the chart.
* @param frontGrid True if the grid is in front of the chart.
*/
public void setFrontGrid( boolean frontGrid )
{
this.frontGrid = frontGrid;
}
/**
* Determine if the legend should be visible or not, default: visible.
* Invisible legend area means no comments will be plotted, and the graph will be smaller
* in height.
* @param showLegend True if the legend is visible.
*/
public void setShowLegend( boolean showLegend )
{
this.showLegend = showLegend;
}
/**
* Determine if the default JRobin signature should be visible, default: yes.
* The signature text is "www.jrobin.org" and the signature is centered at the bottom of the graph.
* Unless you have a good reason not to draw the signature, please be so kind as to leave the
* signature visible. Disabling the signature can give a minor performance boost.
* @param showSignature True if the signature is visible.
*/
public void setShowSignature( boolean showSignature )
{
this.drawSignature = showSignature;
}
/**
* Set the anti-aliasing option for the drawing area of the graph.
* Default uses anti-aliasing.
* @param aa True if anti-aliasing is on, false if off
*/
public void setAntiAliasing( boolean aa )
{
this.antiAliasing = aa;
}
/**
* Set the number of pixels on the left of the chart area ( value marker space ).
* @param lp Number of pixels used, defaults to 50.
*/
public void setChartLeftPadding( int lp )
{
this.chart_lpadding = lp;
}
/**
* Sets a background image to use for the graph.
* The image can be any of the supported imageio formats,
* default <i>.gif, .jpg or .png</i>.
*
* Please note: if the provided file does not exit at graph creation time, the
* corresponding graph will be created without the background image, and without
* any exception being thrown.
*
* @param fileName Filename of the image to use
*/
public void setBackground( String fileName )
{
File bgFile = new File( fileName );
if ( bgFile.exists() )
this.background = bgFile;
}
/**
* Sets a overlay image to use for the graph.
* The image can be any of the supported imageio formats,
* default <i>.gif, .jpg or .png</i>. All pixels with the color white
* RGB (255, 255, 255) will be treated as transparent.
*
* Please note: if the provided file does not exit at graph creation time, the
* corresponding graph will be created without the overlay image, and without
* any exception being thrown.
*
* @param fileName Filename of the image to use
*/
public void setOverlay( String fileName )
{
File ovFile = new File( fileName );
if ( ovFile.exists() )
this.overlay = ovFile;
}
/**
* Sets the base for value scaling.
* If you are graphing memory this should be set to 1024 so that one Kb is 1024 bytes.
* As a default the base value is set to 1000, under the assumption you will be measuring
* network traffic, in wich case 1 kb/s equals 1000 b/s.
* @param base Value to set as base for scaling.
*/
public void setBaseValue( double base )
{
this.baseValue = base;
}
/**
* This sets the 10** exponent 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 u (Micro, 10e-6, millionths). Use a value of 0 to
* prevent any scaling of the y-axis values.
* @param e Exponent value to use
*/
public void setUnitsExponent( int e )
{
this.scaleIndex = (6 - e / 3); // Index in the scale table
}
int getUnitsExponent() {
return (6 - scaleIndex) * 3;
}
/**
* Sets value range that will be presented in the graph. If not set, graph limits will be autoscaled.
* If you wish to specify one limit but leave the other auto-scaled, specify the value as Double.NaN
* fot the limit that should be auto-scaled.
* @param lower Lower limit.
* @param upper Upper limit.
* @param rigid Rigid grid, won't autoscale limits.
*/
public void setGridRange( double lower, double upper, boolean rigid )
{
gridRange = new GridRange( lower, upper, rigid );
}
/**
* This sets the lower limit of the grid to the specified value, see {@link RrdGraphDef#setGridRange(double, double, boolean)}.
* This is the equivalent of: <code>setGridRange( lower, Double.NaN, false );</code>
* @param lower Lower limit.
*/
public void setLowerLimit( double lower )
{
gridRange = new GridRange( lower, Double.NaN, false );
}
/**
* This sets the grid and labels on the Y axis.
* Minor grid lines appear at <code>gridStep</code>, major grid lines accompanied by a label
* will appear every <code>labelStep</code> value.
* @param gridStep Value step on which a minor grid line will appear.
* @param labelStep Value step on which a major grid line with value label will appear.
*/
public void setValueAxis( double gridStep, double labelStep )
{
vAxis = new ValueAxisUnit( gridStep, labelStep );
}
/**
* This sets the grid and labels on the X axis.
* There are both minor and major grid lines, the major lines are accompanied by a time label.
*
* To define a grid line you must define a specific time unit, and a number of time steps.
* A grid line will appear everey steps*unit. Possible units are defined in the
* {@link net.jumperz.ext.org.jrobin.graph.TimeAxisUnit TimeAxisUnit} class, and are <i>SECOND, MINUTE, HOUR, DAY,
* WEEK, MONTH</i> and <i>YEAR</i>.
*
* @param minGridTimeUnit Time unit for the minor grid lines.
* @param minGridUnitSteps Time unit steps for the minor grid lines.
* @param majGridTimeUnit Time unit for the major grid lines.
* @param majGridUnitSteps Time unit steps for the major grid lines.
* @param dateFormat Format string of the time labels, according to <code>java.text.SimpleDateFormat</code> specifications.
* @param centerLabels True if the time label should be centered in the area between two major grid lines.
*/
public void setTimeAxis( int minGridTimeUnit,
int minGridUnitSteps,
int majGridTimeUnit,
int majGridUnitSteps,
String dateFormat,
boolean centerLabels )
{
this.tAxis = new TimeAxisUnit( minGridTimeUnit,
minGridUnitSteps,
majGridTimeUnit,
majGridUnitSteps,
new SimpleDateFormat( dateFormat ),
centerLabels ,
firstDayOfWeek
);
}
/**
* Sets the first day of a calendar week, defaults to monday if not set.
*
* @param day Weekday, 0 for sunday, 6 for saturday.
*/
public void setFirstDayOfWeek( int day )
{
firstDayOfWeek = day;
}
/**
* Adds line plot to the graph definition, using the specified color and legend. This method
* takes exactly the same parameters as RRDTool's LINE1 directive (line width
* is set to 1). The legend allows for the same
* alignment options as <code>gprint</code> or <code>comment</code>.
*
* @param sourceName Graph source name.
* @param color Line collor to be used.
* @param legend Legend to be printed on the graph.
* @throws RrdException Thrown if invalid graph source name is supplied.
*/
public void line( String sourceName, Color color, String legend ) throws RrdException
{
plotDefs.add( new Line(sourceName, color) );
addLegend( legend, color );
}
/**
* Adds line plot to the graph definition, using the specified color, legend and line width.
* This method takes exactly the same parameters as RRDTool's LINE directive. The legend allows for the same
* alignment options as <code>gprint</code> or <code>comment</code>.
*
* @param sourceName Graph source name.
* @param color Line color to be used.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -