Code

Merge branch 'upstream'
[pkg-rrdtool.git] / doc / rrdgraph_graph.html
1 <?xml version="1.0" ?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <title>rrdgraph_graph</title>
6 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
7 <link rev="made" href="mailto:root@localhost" />
8 </head>
10 <body style="background-color: white">
12 <p><a name="__index__"></a></p>
13 <!-- INDEX BEGIN -->
14 <!--
16 <ul>
18         <li><a href="#name">NAME</a></li>
19         <li><a href="#synopsis">SYNOPSIS</a></li>
20         <li><a href="#description">DESCRIPTION</a></li>
21         <ul>
23                 <li><a href="#print">PRINT</a></li>
24                 <li><a href="#graph">GRAPH</a></li>
25         </ul>
27         <li><a href="#notes_on_legend_arguments">NOTES on legend arguments</a></li>
28         <ul>
30                 <li><a href="#escaping_the_colon">Escaping the colon</a></li>
31                 <li><a href="#string_formatting">String Formatting</a></li>
32         </ul>
34         <li><a href="#see_also">SEE ALSO</a></li>
35         <li><a href="#author">AUTHOR</a></li>
36 </ul>
37 -->
38 <!-- INDEX END -->
40 <p>
41 </p>
42 <hr />
43 <h1><a name="name">NAME</a></h1>
44 <p>rrdgraph_graph - rrdtool graph command reference</p>
45 <p>
46 </p>
47 <hr />
48 <h1><a name="synopsis">SYNOPSIS</a></h1>
49 <p><strong>PRINT</strong><strong>:</strong><em>vname</em><strong>:</strong><em>format</em></p>
50 <p><strong>GPRINT</strong><strong>:</strong><em>vname</em><strong>:</strong><em>format</em></p>
51 <p><strong>COMMENT</strong><strong>:</strong><em>text</em></p>
52 <p><strong>VRULE</strong><strong>:</strong><em>time</em><strong>#</strong><em>color</em>[<strong>:</strong><em>legend</em>]</p>
53 <p><strong>HRULE</strong><strong>:</strong><em>value</em><strong>#</strong><em>color</em>[<strong>:</strong><em>legend</em>]</p>
54 <p><strong>LINE</strong>[<em>width</em>]<strong>:</strong><em>value</em>[<strong>#</strong><em>color</em>][<strong>:</strong>[<em>legend</em>][<strong>:STACK</strong>]]</p>
55 <p><strong>AREA</strong><strong>:</strong><em>value</em>[<strong>#</strong><em>color</em>][<strong>:</strong>[<em>legend</em>][<strong>:STACK</strong>]]</p>
56 <p><strong>TICK</strong><strong>:</strong><em>vname</em><strong>#</strong><em>rrggbb</em>[<em>aa</em>][<strong>:</strong><em>fraction</em>[<strong>:</strong><em>legend</em>]]</p>
57 <p><strong>SHIFT</strong><strong>:</strong><em>vname</em><strong>:</strong><em>offset</em></p>
58 <p><strong>PRINT</strong><strong>:</strong><em>vname</em><strong>:</strong><em>CF</em><strong>:</strong><em>format</em> (deprecated)</p>
59 <p><strong>GPRINT</strong><strong>:</strong><em>vname</em><strong>:</strong><em>CF</em><strong>:</strong><em>format</em> (deprecated)</p>
60 <p><strong>STACK</strong><strong>:</strong><em>vname</em><strong>#</strong><em>color</em>[<strong>:</strong><em>legend</em>] (deprecated)</p>
61 <p>
62 </p>
63 <hr />
64 <h1><a name="description">DESCRIPTION</a></h1>
65 <p>These instructions allow you to generate your image or report.
66 If you don't use any graph elements, no graph is generated.
67 Similarly, no report is generated if you don't use print options.</p>
68 <p>
69 </p>
70 <h2><a name="print">PRINT</a></h2>
71 <dl>
72 <dt><strong><a name="item_print_3avname_3aformat_5b_3astrftime_5d"><strong>PRINT:</strong><em>vname</em><strong>:</strong><em>format</em>[<strong>:strftime</strong>]</a></strong></dt>
74 <dd>
75 <p>Depending on the context, either the value component or the time
76 component of a <strong>VDEF</strong> is printed using <em>format</em>. It is an error
77 to specify a <em>vname</em> generated by a <strong>DEF</strong> or <strong>CDEF</strong>.</p>
78 <p>Any text in <em>format</em> is printed literally with one exception:
79 The percent character introduces a formatter string. This string
80 can be:</p>
81 <p>For printing values:</p>
82 <p><strong>%%</strong> - just prints a literal '%' character</p>
83 <p><strong>%#.#le</strong> - prints numbers like 1.2346e+04. The optional integers # denote field
84 width and decimal precision.</p>
85 <p><strong>%#.#lf</strong> - prints numbers like 12345.6789, with optional field width
86 and precision.</p>
87 <p><strong>%s</strong> - place this after <strong>%le</strong>, <strong>%lf</strong> or <strong>%lg</strong>. This will be replaced by the
88 appropriate SI magnitude unit and the value will be scaled
89 accordingly (123456 -&gt; 123.456 k).</p>
90 <p><strong>%S</strong> - is similar to <strong>%s</strong>. It does, however, use a previously defined
91 magnitude unit. If there is no such unit yet, it tries to define
92 one (just like <strong>%s</strong>) unless the value is zero, in which case the magnitude
93 unit stays undefined. Thus, formatter strings using <strong>%S</strong> and no <strong>%s</strong>
94 will all use the same magnitude unit except for zero values.</p>
95 <p>If you PRINT a VDEF value, you can also print the time associated with it by appending the string
96 <strong>:strftime</strong> to the format. Note that rrdtool uses the strftime function of your OSs clibrary. This means that
97 the conversion specifier may vary. Check the manual page if you are uncertain. The following is a list of
98 conversion specifiers usually supported across the board.</p>
99 <p><strong>%a</strong> - The abbreviated weekday name according to the current locale.</p>
100 <p><strong>%A</strong> - The full weekday name according to the current locale.</p>
101 <p><strong>%b</strong> - The abbreviated month name according to the current locale.</p>
102 <p><strong>%B</strong> - The full month name according to the current locale.</p>
103 <p><strong>%c</strong> - The preferred date and time representation for the current locale.</p>
104 <p><strong>%d</strong> - The day of the month as a decimal number (range 01 to 31).</p>
105 <p><strong>%H</strong> - The hour as a decimal number using a 24-hour clock (range 00 to 23).</p>
106 <p><strong>%I</strong> - The hour as a decimal number using a 12-hour clock (range 01 to 12).</p>
107 <p><strong>%j</strong> - The day of the year as a decimal number (range 001 to 366).</p>
108 <p><strong>%m</strong> - The month as a decimal number (range 01 to 12).</p>
109 <p><strong>%M</strong> - The minute as a decimal number (range 00 to 59).</p>
110 <p><strong>%p</strong> - Either `AM' or `PM' according to the given time value, or the corresponding
111 strings for the current locale.  Noon is treated as `pm' and midnight as
112 `am'.  Note that in many locales and `pm' notation is unsupported and in
113 such cases %p will return an empty string.</p>
114 <p><strong>%S</strong> - The second as a decimal number (range 00 to 61).</p>
115 <p><strong>%U</strong> - The  week  number  of  the current year as a decimal number, range 00 to 53, starting with the
116 first Sunday as the first day of week 01. See also %V and %W.</p>
117 <p><strong>%V</strong> - The ISO 8601:1988 week number of the current year as a decimal number, range 01 to  53,  where
118 week  1 is the first week that has at least 4 days in the current year, and with Monday as the
119 first day of the week. See also %U and %W.</p>
120 <p><strong>%w</strong> - The day of the week as a decimal, range 0 to 6, Sunday being 0.  See also %u.</p>
121 <p><strong>%W</strong> - The week number of the current year as a decimal number, range 00 to  53,  starting  with  the
122 first Monday as the first day of week 01.</p>
123 <p><strong>%x</strong> - The preferred date representation for the current locale without the time.</p>
124 <p><strong>%X</strong> - The preferred time representation for the current locale without the date.</p>
125 <p><strong>%y</strong> - The year as a decimal number without a century (range 00 to 99).</p>
126 <p><strong>%Y</strong> - The year as a decimal number including the century.</p>
127 <p><strong>%Z</strong> - The time zone or name or abbreviation.</p>
128 <p><strong>%%</strong> - A literal `%' character.</p>
129 </dd>
130 <dt><strong><a name="item_print_3avname_3acf_3aformat"><strong>PRINT:</strong><em>vname</em><strong>:</strong><em>CF</em><strong>:</strong><em>format</em></a></strong></dt>
132 <dd>
133 <p><em>Deprecated. Use the new form of this command in new scripts.</em>
134 The first form of this command is to be used with <strong>CDEF</strong> <em>vname</em>s.</p>
135 </dd>
136 </dl>
137 <p>
138 </p>
139 <h2><a name="graph">GRAPH</a></h2>
140 <dl>
141 <dt><strong><a name="item_gprint_3avname_3aformat"><strong>GPRINT</strong><strong>:</strong><em>vname</em><strong>:</strong><em>format</em></a></strong></dt>
143 <dd>
144 <p>This is the same as <code>PRINT</code>, but printed inside the graph.</p>
145 </dd>
146 <dt><strong><a name="item_gprint_3avname_3acf_3aformat"><strong>GPRINT</strong><strong>:</strong><em>vname</em><strong>:</strong><em>CF</em><strong>:</strong><em>format</em></a></strong></dt>
148 <dd>
149 <p><em>Deprecated. Use the new form of this command in new scripts.</em>
150 This is the same as <code>PRINT</code>, but printed inside the graph.</p>
151 </dd>
152 <dt><strong><a name="item_comment_3atext"><strong>COMMENT</strong><strong>:</strong><em>text</em></a></strong></dt>
154 <dd>
155 <p>Text is printed literally in the legend section of the graph. Note that in
156 RRDtool 1.2 you have to escape colons in COMMENT text in the same way you
157 have to escape them in <strong>*PRINT</strong> commands by writing <strong>'\:'</strong>.</p>
158 </dd>
159 <dt><strong><a name="item_vrule_3atime_23color__5b_3alegend__5d"><strong>VRULE</strong><strong>:</strong><em>time</em><strong>#</strong><em>color</em> [<strong>:</strong><em>legend</em> ]</a></strong></dt>
161 <dd>
162 <p>Draw a vertical line at <em>time</em>.  Its color is composed from three
163 hexadecimal numbers specifying the rgb color components (00 is off, FF is
164 maximum) red, green and blue followed by an optional alpha. Optionally, a legend box and string is
165 printed in the legend section. <em>time</em> may be a number or a variable
166 from a <strong>VDEF</strong>. It is an error to use <em>vname</em>s from <strong>DEF</strong> or <strong>CDEF</strong> here.</p>
167 </dd>
168 <dt><strong><a name="item_hrule_3avalue_23color__5b__3alegend__5d"><strong>HRULE</strong><strong>:</strong><em>value</em><strong>#</strong><em>color</em> [ :<em>legend</em> ]</a></strong></dt>
170 <dd>
171 <p>Draw a horizontal line at <em>value</em>.  HRULE acts much like LINE except that
172 will have no effect on the scale of the graph. If a HRULE is outside the
173 graphing area it will just not be visible.</p>
174 </dd>
175 <dt><strong><a name="item_line_5bwidth_5d_3avalue_5b_23color_5d_5b_3a_5blege"><strong>LINE</strong>[<em>width</em>]<strong>:</strong><em>value</em>[<strong>#</strong><em>color</em>][<strong>:</strong>[<em>legend</em>][<strong>:STACK</strong>]]</a></strong></dt>
177 <dd>
178 <p>Draw a line of the specified width onto the graph. <em>width</em> can be a
179 floating point number. If the color is not specified, the drawing is done
180 'invisibly'. This is useful when stacking something else on top of this
181 line. Also optional is the legend box and string which will be printed in
182 the legend section if specified. The <strong>value</strong> can be generated by <strong>DEF</strong>,
183 <strong>VDEF</strong>, and <strong>CDEF</strong>.  If the optional <strong>STACK</strong> modifier is used, this line
184 is stacked on top of the previous element which can be a <strong>LINE</strong> or an
185 <strong>AREA</strong>.</p>
186 <p>When you do not specify a color, you cannot specify a legend.  Should
187 you want to use STACK, use the ``LINEx:&lt;value&gt;::STACK'' form.</p>
188 </dd>
189 <dt><strong><a name="item_area_3avalue_5b_23color_5d_5b_3a_5blegend_5d_5b_3a"><strong>AREA</strong><strong>:</strong><em>value</em>[<strong>#</strong><em>color</em>][<strong>:</strong>[<em>legend</em>][<strong>:STACK</strong>]]</a></strong></dt>
191 <dd>
192 <p>See <strong>LINE</strong>, however the area between the x-axis and the line will
193 be filled.</p>
194 </dd>
195 <dt><strong><a name="item_tick_3avname_23rrggbb_5baa_5d_5b_3afraction_5b_3al"><strong>TICK</strong><strong>:</strong><em>vname</em><strong>#</strong><em>rrggbb</em>[<em>aa</em>][<strong>:</strong><em>fraction</em>[<strong>:</strong><em>legend</em>]]</a></strong></dt>
197 <dd>
198 <p>Plot a tick mark (a vertical line) for each value of <em>vname</em> that is
199 non-zero and not *UNKNOWN*. The <em>fraction</em> argument specifies the length of
200 the tick mark as a fraction of the y-axis; the default value is 0.1 (10% of
201 the axis). Note that the color specification is not optional. The TICK marks normaly
202 start at the lower edge of the graphing area. If the fraction is negative they start
203 at the upper border of the graphing area.</p>
204 </dd>
205 <dt><strong><a name="item_shift_3avname_3aoffset"><strong>SHIFT</strong><strong>:</strong><em>vname</em><strong>:</strong><em>offset</em></a></strong></dt>
207 <dd>
208 <p>Using this command <strong>RRDtool</strong> will graph the following elements
209 with the specified offset.  For instance, you can specify an
210 offset of (&nbsp;7*24*60*60&nbsp;=&nbsp;)&nbsp;604'800&nbsp;seconds to ``look back'' one
211 week. Make sure to tell the viewer of your graph you did this ...
212 As with the other graphing elements, you can specify a number or
213 a variable here.</p>
214 </dd>
215 <dt><strong><a name="item_stack_3avname_23color_5b_3alegend_5d"><strong>STACK</strong><strong>:</strong><em>vname</em><strong>#</strong><em>color</em>[<strong>:</strong><em>legend</em>]</a></strong></dt>
217 <dd>
218 <p><em>Deprecated.  Use the <strong>STACK</strong> modifiers on the other commands.</em></p>
219 </dd>
220 </dl>
221 <p><strong>Some notes on stacking</strong></p>
222 <p>When stacking, an element is not placed above the X-axis but rather
223 on top of the previous element.  There must be something to stack
224 upon.</p>
225 <p>You can use an <strong>invisible</strong> LINE or AREA to stacked upon.</p>
226 <p>An <strong>unknown</strong> value makes the entire stack unknown from that moment on.
227 You don't know where to begin (the unknown value) and therefore do
228 not know where to end.</p>
229 <p>If you want to make sure you will be displaying a certain variable,
230 make sure never to stack upon the unknown value.  Use a CDEF instruction
231 with <strong>IF</strong> and <strong>UN</strong> to do so.</p>
232 <p>
233 </p>
234 <hr />
235 <h1><a name="notes_on_legend_arguments">NOTES on legend arguments</a></h1>
236 <p>
237 </p>
238 <h2><a name="escaping_the_colon">Escaping the colon</a></h2>
239 <p>A colon ':' in a <em>legend</em> argument will mark the end of the
240 legend. To enter a ':' as part of a legend, the colon must be escaped
241 with a backslash '\:'.  Beware that many environments process
242 backslashes themselves, so it may be necessary to write two
243 backslashes in order to one being passed onto rrd_graph.</p>
244 <p>
245 </p>
246 <h2><a name="string_formatting">String Formatting</a></h2>
247 <p>The text printed below the actual graph can be formatted by appending special
248 escape characters at the end of a text. When ever such a character occurs,
249 all pending text is pushed onto the graph according to the character
250 specified.</p>
251 <p>Valid markers are: <strong>\j</strong> for justified, <strong>\l</strong> for left aligned, <strong>\r</strong> for
252 right aligned, and <strong>\c</strong> for centered. In the next section there is an
253 example showing how to use centered formatting.</p>
254 <p><strong>\n</strong> is a valid alias for <strong>\l</strong> since incomplete parsing in earlier
255 versions of rrdtool lead to this behaviour and a number of people has been using it.</p>
256 <p>Normally there are two space characters inserted between every two items
257 printed into the graph. The space following a string can be suppressed by
258 putting a <strong>\g</strong> at the end of the string. The <strong>\g</strong> also ignores any space
259 inside the string if it is at the very end of the string. This can be used
260 in connection with <strong>%s</strong> to suppress empty unit strings.</p>
261 <pre>
262  GPRINT:a:MAX:%lf%s\g</pre>
263 <p>A special case is COMMENT:<strong>\s</strong> which inserts some additional vertical space
264 before placing the next row of legends.</p>
265 <p>If you are using the proportional font in your graph, you can use tab
266 characters or the sequence <strong>\t</strong> to line-up legend elements. Note that
267 the tabs inserted are relative to the start of the current legend
268 element!</p>
269 <p>
270 </p>
271 <hr />
272 <h1><a name="see_also">SEE ALSO</a></h1>
273 <p><a href="././rrdgraph.html">the rrdgraph manpage</a> gives an overview of how <strong>rrdtool graph</strong> works.
274 <a href="././rrdgraph_data.html">the rrdgraph_data manpage</a> describes <strong>DEF</strong>,<strong>CDEF</strong> and <strong>VDEF</strong> in detail.
275 <a href="././rrdgraph_rpn.html">the rrdgraph_rpn manpage</a> describes the <strong>RPN</strong> language used in the <strong>?DEF</strong> statements.
276 <a href="././rrdgraph_graph.html">the rrdgraph_graph manpage</a> page describes all of the graph and print functions.</p>
277 <p>Make sure to read <a href="././rrdgraph_examples.html">the rrdgraph_examples manpage</a> for tips&amp;tricks.</p>
278 <p>
279 </p>
280 <hr />
281 <h1><a name="author">AUTHOR</a></h1>
282 <p>Program by Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
283 <p>This manual page by Alex van den Bogaerdt &lt;<a href="mailto:alex@ergens.op.het.net">alex@ergens.op.het.net</a>&gt;</p>
285 </body>
287 </html>