Code

Imported upstream version 1.2.26
[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         <li><a href="#print">PRINT</a></li>
22         <li><a href="#graph">GRAPH</a></li>
23         <li><a href="#notes_on_legend_arguments">NOTES on legend arguments</a></li>
24         <ul>
26                 <li><a href="#escaping_the_colon">Escaping the colon</a></li>
27                 <li><a href="#string_formatting">String Formatting</a></li>
28         </ul>
30         <li><a href="#see_also">SEE ALSO</a></li>
31         <li><a href="#author">AUTHOR</a></li>
32 </ul>
33 -->
34 <!-- INDEX END -->
36 <p>
37 </p>
38 <hr />
39 <h1><a name="name">NAME</a></h1>
40 <p>rrdgraph_graph - rrdtool graph command reference</p>
41 <p>
42 </p>
43 <hr />
44 <h1><a name="synopsis">SYNOPSIS</a></h1>
45 <p><strong>PRINT</strong><strong>:</strong><em>vname</em><strong>:</strong><em>format</em></p>
46 <p><strong>GPRINT</strong><strong>:</strong><em>vname</em><strong>:</strong><em>format</em></p>
47 <p><strong>COMMENT</strong><strong>:</strong><em>text</em></p>
48 <p><strong>VRULE</strong><strong>:</strong><em>time</em><strong>#</strong><em>color</em>[<strong>:</strong><em>legend</em>]</p>
49 <p><strong>HRULE</strong><strong>:</strong><em>value</em><strong>#</strong><em>color</em>[<strong>:</strong><em>legend</em>]</p>
50 <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>
51 <p><strong>AREA</strong><strong>:</strong><em>value</em>[<strong>#</strong><em>color</em>][<strong>:</strong>[<em>legend</em>][<strong>:STACK</strong>]]</p>
52 <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>
53 <p><strong>SHIFT</strong><strong>:</strong><em>vname</em><strong>:</strong><em>offset</em></p>
54 <p><strong>PRINT</strong><strong>:</strong><em>vname</em><strong>:</strong><em>CF</em><strong>:</strong><em>format</em> (deprecated)</p>
55 <p><strong>GPRINT</strong><strong>:</strong><em>vname</em><strong>:</strong><em>CF</em><strong>:</strong><em>format</em> (deprecated)</p>
56 <p><strong>STACK</strong><strong>:</strong><em>vname</em><strong>#</strong><em>color</em>[<strong>:</strong><em>legend</em>] (deprecated)</p>
57 <p>
58 </p>
59 <hr />
60 <h1><a name="description">DESCRIPTION</a></h1>
61 <p>These instructions allow you to generate your image or report.
62 If you don't use any graph elements, no graph is generated.
63 Similarly, no report is generated if you don't use print options.</p>
64 <p>
65 </p>
66 <hr />
67 <h1><a name="print">PRINT</a></h1>
68 <dl>
69 <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>
71 <dd>
72 <p>Depending on the context, either the value component or the time
73 component of a <strong>VDEF</strong> is printed using <em>format</em>. It is an error
74 to specify a <em>vname</em> generated by a <strong>DEF</strong> or <strong>CDEF</strong>.</p>
75 </dd>
76 <dd>
77 <p>Any text in <em>format</em> is printed literally with one exception:
78 The percent character introduces a formatter string. This string
79 can be:</p>
80 </dd>
81 <dd>
82 <p>For printing values:</p>
83 </dd>
84 <dl>
85 <dt><strong><a name="item___"><strong>%%</strong></a></strong>
87 <dd>
88 <p>just prints a literal '%' character</p>
89 </dd>
90 </li>
91 <dt><strong><a name="item_____le"><strong>%#.#le</strong></a></strong>
93 <dd>
94 <p>prints numbers like 1.2346e+04. The optional integers # denote field
95 width and decimal precision.</p>
96 </dd>
97 </li>
98 <dt><strong><a name="item_____lf"><strong>%#.#lf</strong></a></strong>
100 <dd>
101 <p>prints numbers like 12345.6789, with optional field width
102 and precision.</p>
103 </dd>
104 </li>
105 <dt><strong><a name="item__s"><strong>%s</strong></a></strong>
107 <dd>
108 <p>place this after <strong>%le</strong>, <strong>%lf</strong> or <strong>%lg</strong>. This will be replaced by the
109 appropriate SI magnitude unit and the value will be scaled
110 accordingly (123456 -&gt; 123.456 k).</p>
111 </dd>
112 </li>
113 <dt><strong><a name="item__s"><strong>%S</strong></a></strong>
115 <dd>
116 <p>is similar to <strong>%s</strong>. It does, however, use a previously defined
117 magnitude unit. If there is no such unit yet, it tries to define
118 one (just like <strong>%s</strong>) unless the value is zero, in which case the magnitude
119 unit stays undefined. Thus, formatter strings using <strong>%S</strong> and no <strong>%s</strong>
120 will all use the same magnitude unit except for zero values.</p>
121 </dd>
122 </li>
123 </dl>
124 <p>If you PRINT a VDEF value, you can also print the time associated with it by appending the string
125 <strong>:strftime</strong> to the format. Note that rrdtool uses the strftime function of your OSs clibrary. This means that
126 the conversion specifier may vary. Check the manual page if you are uncertain. The following is a list of
127 conversion specifiers usually supported across the board.</p>
128 <dl>
129 <dt><strong><a name="item__a"><strong>%a</strong></a></strong>
131 <dd>
132 <p>The abbreviated weekday name according to the current locale.</p>
133 </dd>
134 </li>
135 <dt><strong><a name="item__a"><strong>%A</strong></a></strong>
137 <dd>
138 <p>The full weekday name according to the current locale.</p>
139 </dd>
140 </li>
141 <dt><strong><a name="item__b"><strong>%b</strong></a></strong>
143 <dd>
144 <p>The abbreviated month name according to the current locale.</p>
145 </dd>
146 </li>
147 <dt><strong><a name="item__b"><strong>%B</strong></a></strong>
149 <dd>
150 <p>The full month name according to the current locale.</p>
151 </dd>
152 </li>
153 <dt><strong><a name="item__c"><strong>%c</strong></a></strong>
155 <dd>
156 <p>The preferred date and time representation for the current locale.</p>
157 </dd>
158 </li>
159 <dt><strong><a name="item__d"><strong>%d</strong></a></strong>
161 <dd>
162 <p>The day of the month as a decimal number (range 01 to 31).</p>
163 </dd>
164 </li>
165 <dt><strong><a name="item__h"><strong>%H</strong></a></strong>
167 <dd>
168 <p>The hour as a decimal number using a 24-hour clock (range 00 to 23).</p>
169 </dd>
170 </li>
171 <dt><strong><a name="item__i"><strong>%I</strong></a></strong>
173 <dd>
174 <p>The hour as a decimal number using a 12-hour clock (range 01 to 12).</p>
175 </dd>
176 </li>
177 <dt><strong><a name="item__j"><strong>%j</strong></a></strong>
179 <dd>
180 <p>The day of the year as a decimal number (range 001 to 366).</p>
181 </dd>
182 </li>
183 <dt><strong><a name="item__m"><strong>%m</strong></a></strong>
185 <dd>
186 <p>The month as a decimal number (range 01 to 12).</p>
187 </dd>
188 </li>
189 <dt><strong><a name="item__m"><strong>%M</strong></a></strong>
191 <dd>
192 <p>The minute as a decimal number (range 00 to 59).</p>
193 </dd>
194 </li>
195 <dt><strong><a name="item__p"><strong>%p</strong></a></strong>
197 <dd>
198 <p>Either `AM' or `PM' according to the given time value, or the corresponding
199 strings for the current locale.  Noon is treated as `pm' and midnight as
200 `am'.  Note that in many locales and `pm' notation is unsupported and in
201 such cases %p will return an empty string.</p>
202 </dd>
203 </li>
204 <dt><strong><strong>%S</strong></strong>
206 <dd>
207 <p>The second as a decimal number (range 00 to 61).</p>
208 </dd>
209 </li>
210 <dt><strong><a name="item__u"><strong>%U</strong></a></strong>
212 <dd>
213 <p>The  week  number  of  the current year as a decimal number, range 00 to 53, starting with the
214 first Sunday as the first day of week 01. See also %V and %W.</p>
215 </dd>
216 </li>
217 <dt><strong><a name="item__v"><strong>%V</strong></a></strong>
219 <dd>
220 <p>The ISO 8601:1988 week number of the current year as a decimal number, range 01 to  53,  where
221 week  1 is the first week that has at least 4 days in the current year, and with Monday as the
222 first day of the week. See also %U and %W.</p>
223 </dd>
224 </li>
225 <dt><strong><a name="item__w"><strong>%w</strong></a></strong>
227 <dd>
228 <p>The day of the week as a decimal, range 0 to 6, Sunday being 0.  See also %u.</p>
229 </dd>
230 </li>
231 <dt><strong><a name="item__w"><strong>%W</strong></a></strong>
233 <dd>
234 <p>The week number of the current year as a decimal number, range 00 to  53,  starting  with  the
235 first Monday as the first day of week 01.</p>
236 </dd>
237 </li>
238 <dt><strong><a name="item__x"><strong>%x</strong></a></strong>
240 <dd>
241 <p>The preferred date representation for the current locale without the time.</p>
242 </dd>
243 </li>
244 <dt><strong><a name="item__x"><strong>%X</strong></a></strong>
246 <dd>
247 <p>The preferred time representation for the current locale without the date.</p>
248 </dd>
249 </li>
250 <dt><strong><a name="item__y"><strong>%y</strong></a></strong>
252 <dd>
253 <p>The year as a decimal number without a century (range 00 to 99).</p>
254 </dd>
255 </li>
256 <dt><strong><a name="item__y"><strong>%Y</strong></a></strong>
258 <dd>
259 <p>The year as a decimal number including the century.</p>
260 </dd>
261 </li>
262 <dt><strong><a name="item__z"><strong>%Z</strong></a></strong>
264 <dd>
265 <p>The time zone or name or abbreviation.</p>
266 </dd>
267 </li>
268 <dt><strong><strong>%%</strong></strong>
270 <dd>
271 <p>A literal `%' character.</p>
272 </dd>
273 </li>
274 </dl>
275 <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>
277 <dd>
278 <p><em>Deprecated. Use the new form of this command in new scripts.</em>
279 The first form of this command is to be used with <strong>CDEF</strong> <em>vname</em>s.</p>
280 </dd>
281 </li>
282 </dl>
283 <p>
284 </p>
285 <hr />
286 <h1><a name="graph">GRAPH</a></h1>
287 <dl>
288 <dt><strong><a name="item_gprint_3avname_3aformat"><strong>GPRINT</strong><strong>:</strong><em>vname</em><strong>:</strong><em>format</em></a></strong>
290 <dd>
291 <p>This is the same as <code>PRINT</code>, but printed inside the graph.</p>
292 </dd>
293 </li>
294 <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>
296 <dd>
297 <p><em>Deprecated. Use the new form of this command in new scripts.</em>
298 This is the same as <code>PRINT</code>, but printed inside the graph.</p>
299 </dd>
300 </li>
301 <dt><strong><a name="item_comment_3atext"><strong>COMMENT</strong><strong>:</strong><em>text</em></a></strong>
303 <dd>
304 <p>Text is printed literally in the legend section of the graph. Note that in
305 RRDtool 1.2 you have to escape colons in COMMENT text in the same way you
306 have to escape them in <strong>*PRINT</strong> commands by writing <strong>'\:'</strong>.</p>
307 </dd>
308 </li>
309 <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>
311 <dd>
312 <p>Draw a vertical line at <em>time</em>.  Its color is composed from three
313 hexadecimal numbers specifying the rgb color components (00 is off, FF is
314 maximum) red, green and blue followed by an optional alpha. Optionally, a legend box and string is
315 printed in the legend section. <em>time</em> may be a number or a variable
316 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>
317 </dd>
318 </li>
319 <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>
321 <dd>
322 <p>Draw a horizontal line at <em>value</em>.  HRULE acts much like LINE except that
323 will have no effect on the scale of the graph. If a HRULE is outside the
324 graphing area it will just not be visible.</p>
325 </dd>
326 </li>
327 <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>
329 <dd>
330 <p>Draw a line of the specified width onto the graph. <em>width</em> can be a
331 floating point number. If the color is not specified, the drawing is done
332 'invisibly'. This is useful when stacking something else on top of this
333 line. Also optional is the legend box and string which will be printed in
334 the legend section if specified. The <strong>value</strong> can be generated by <strong>DEF</strong>,
335 <strong>VDEF</strong>, and <strong>CDEF</strong>.  If the optional <strong>STACK</strong> modifier is used, this line
336 is stacked on top of the previous element which can be a <strong>LINE</strong> or an
337 <strong>AREA</strong>.</p>
338 </dd>
339 <dd>
340 <p>When you do not specify a color, you cannot specify a legend.  Should
341 you want to use STACK, use the ``LINEx:&lt;value&gt;::STACK'' form.</p>
342 </dd>
343 </li>
344 <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>
346 <dd>
347 <p>See <strong>LINE</strong>, however the area between the x-axis and the line will
348 be filled.</p>
349 </dd>
350 </li>
351 <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>
353 <dd>
354 <p>Plot a tick mark (a vertical line) for each value of <em>vname</em> that is
355 non-zero and not *UNKNOWN*. The <em>fraction</em> argument specifies the length of
356 the tick mark as a fraction of the y-axis; the default value is 0.1 (10% of
357 the axis). Note that the color specification is not optional. The TICK marks normaly
358 start at the lower edge of the graphing area. If the fraction is negative they start
359 at the upper border of the graphing area.</p>
360 </dd>
361 </li>
362 <dt><strong><a name="item_shift_3avname_3aoffset"><strong>SHIFT</strong><strong>:</strong><em>vname</em><strong>:</strong><em>offset</em></a></strong>
364 <dd>
365 <p>Using this command <strong>RRDtool</strong> will graph the following elements
366 with the specified offset.  For instance, you can specify an
367 offset of (&nbsp;7*24*60*60&nbsp;=&nbsp;)&nbsp;604'800&nbsp;seconds to ``look back'' one
368 week. Make sure to tell the viewer of your graph you did this ...
369 As with the other graphing elements, you can specify a number or
370 a variable here.</p>
371 </dd>
372 </li>
373 <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>
375 <dd>
376 <p><em>Deprecated.  Use the <strong>STACK</strong> modifiers on the other commands.</em></p>
377 </dd>
378 </li>
379 </dl>
380 <p><strong>Some notes on stacking</strong></p>
381 <p>When stacking, an element is not placed above the X-axis but rather
382 on top of the previous element.  There must be something to stack
383 upon.</p>
384 <p>You can use an <strong>invisible</strong> LINE or AREA to stacked upon.</p>
385 <p>An <strong>unknown</strong> value makes the entire stack unknown from that moment on.
386 You don't know where to begin (the unknown value) and therefore do
387 not know where to end.</p>
388 <p>If you want to make sure you will be displaying a certain variable,
389 make sure never to stack upon the unknown value.  Use a CDEF instruction
390 with <strong>IF</strong> and <strong>UN</strong> to do so.</p>
391 <p>
392 </p>
393 <hr />
394 <h1><a name="notes_on_legend_arguments">NOTES on legend arguments</a></h1>
395 <p>
396 </p>
397 <h2><a name="escaping_the_colon">Escaping the colon</a></h2>
398 <p>A colon ':' in a <em>legend</em> argument will mark the end of the
399 legend. To enter a ':' as part of a legend, the colon must be escaped
400 with a backslash '\:'.  Beware that many environments process
401 backslashes themselves, so it may be necessary to write two
402 backslashes in order to one being passed onto rrd_graph.</p>
403 <p>
404 </p>
405 <h2><a name="string_formatting">String Formatting</a></h2>
406 <p>The text printed below the actual graph can be formatted by appending special
407 escape characters at the end of a text. When ever such a character occurs,
408 all pending text is pushed onto the graph according to the character
409 specified.</p>
410 <p>Valid markers are: <strong>\j</strong> for justified, <strong>\l</strong> for left aligned, <strong>\r</strong> for
411 right aligned, and <strong>\c</strong> for centered. In the next section there is an
412 example showing how to use centered formatting.</p>
413 <p><strong>\n</strong> is a valid alias for <strong>\l</strong> since incomplete parsing in earlier
414 versions of rrdtool lead to this behaviour and a number of people has been using it.</p>
415 <p>Normally there are two space characters inserted between every two items
416 printed into the graph. The space following a string can be suppressed by
417 putting a <strong>\g</strong> at the end of the string. The <strong>\g</strong> also ignores any space
418 inside the string if it is at the very end of the string. This can be used
419 in connection with <strong>%s</strong> to suppress empty unit strings.</p>
420 <pre>
421  GPRINT:a:MAX:%lf%s\g</pre>
422 <p>A special case is COMMENT:<strong>\s</strong> which inserts some additional vertical space
423 before placing the next row of legends.</p>
424 <p>If you are using the proportional font in your graph, you can use tab
425 characters or the sequence <strong>\t</strong> to line-up legend elements. Note that
426 the tabs inserted are relative to the start of the current legend
427 element!</p>
428 <p>
429 </p>
430 <hr />
431 <h1><a name="see_also">SEE ALSO</a></h1>
432 <p><a href="././rrdgraph.html">the rrdgraph manpage</a> gives an overview of how <strong>rrdtool graph</strong> works.
433 <a href="././rrdgraph_data.html">the rrdgraph_data manpage</a> describes <strong>DEF</strong>,<strong>CDEF</strong> and <strong>VDEF</strong> in detail.
434 <a href="././rrdgraph_rpn.html">the rrdgraph_rpn manpage</a> describes the <strong>RPN</strong> language used in the <strong>?DEF</strong> statements.
435 <a href="././rrdgraph_graph.html">the rrdgraph_graph manpage</a> page describes all of the graph and print functions.</p>
436 <p>Make sure to read <a href="././rrdgraph_examples.html">the rrdgraph_examples manpage</a> for tips&amp;tricks.</p>
437 <p>
438 </p>
439 <hr />
440 <h1><a name="author">AUTHOR</a></h1>
441 <p>Program by Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
442 <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>
444 </body>
446 </html>