Code

78aae248891171cbce61f122b8c4bf1044f2fa16
[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>
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 </dd>
79 <dd>
80 <p>Any text in <em>format</em> is printed literally with one exception:
81 The percent character introduces a formatter string. This string
82 can be:</p>
83 </dd>
84 <dd>
85 <p>For printing values:</p>
86 </dd>
87 <dd>
88 <p><strong>%%</strong> - just prints a literal '%' character</p>
89 </dd>
90 <dd>
91 <p><strong>%#.#le</strong> - prints numbers like 1.2346e+04. The optional integers # denote field
92 width and decimal precision.</p>
93 </dd>
94 <dd>
95 <p><strong>%#.#lf</strong> - prints numbers like 12345.6789, with optional field width
96 and precision.</p>
97 </dd>
98 <dd>
99 <p><strong>%s</strong> - place this after <strong>%le</strong>, <strong>%lf</strong> or <strong>%lg</strong>. This will be replaced by the
100 appropriate SI magnitude unit and the value will be scaled
101 accordingly (123456 -&gt; 123.456 k).</p>
102 </dd>
103 <dd>
104 <p><strong>%S</strong> - is similar to <strong>%s</strong>. It does, however, use a previously defined
105 magnitude unit. If there is no such unit yet, it tries to define
106 one (just like <strong>%s</strong>) unless the value is zero, in which case the magnitude
107 unit stays undefined. Thus, formatter strings using <strong>%S</strong> and no <strong>%s</strong>
108 will all use the same magnitude unit except for zero values.</p>
109 </dd>
110 <dd>
111 <p>If you PRINT a VDEF value, you can also print the time associated with it by appending the string
112 <strong>:strftime</strong> to the format. Note that rrdtool uses the strftime function of your OSs clibrary. This means that
113 the conversion specifier may vary. Check the manual page if you are uncertain. The following is a list of
114 conversion specifiers usually supported across the board.</p>
115 </dd>
116 <dd>
117 <p><strong>%a</strong> - The abbreviated weekday name according to the current locale.</p>
118 </dd>
119 <dd>
120 <p><strong>%A</strong> - The full weekday name according to the current locale.</p>
121 </dd>
122 <dd>
123 <p><strong>%b</strong> - The abbreviated month name according to the current locale.</p>
124 </dd>
125 <dd>
126 <p><strong>%B</strong> - The full month name according to the current locale.</p>
127 </dd>
128 <dd>
129 <p><strong>%c</strong> - The preferred date and time representation for the current locale.</p>
130 </dd>
131 <dd>
132 <p><strong>%d</strong> - The day of the month as a decimal number (range 01 to 31).</p>
133 </dd>
134 <dd>
135 <p><strong>%H</strong> - The hour as a decimal number using a 24-hour clock (range 00 to 23).</p>
136 </dd>
137 <dd>
138 <p><strong>%I</strong> - The hour as a decimal number using a 12-hour clock (range 01 to 12).</p>
139 </dd>
140 <dd>
141 <p><strong>%j</strong> - The day of the year as a decimal number (range 001 to 366).</p>
142 </dd>
143 <dd>
144 <p><strong>%m</strong> - The month as a decimal number (range 01 to 12).</p>
145 </dd>
146 <dd>
147 <p><strong>%M</strong> - The minute as a decimal number (range 00 to 59).</p>
148 </dd>
149 <dd>
150 <p><strong>%p</strong> - Either `AM' or `PM' according to the given time value, or the corresponding
151 strings for the current locale.  Noon is treated as `pm' and midnight as
152 `am'.  Note that in many locales and `pm' notation is unsupported and in
153 such cases %p will return an empty string.</p>
154 </dd>
155 <dd>
156 <p><strong>%S</strong> - The second as a decimal number (range 00 to 61).</p>
157 </dd>
158 <dd>
159 <p><strong>%U</strong> - The  week  number  of  the current year as a decimal number, range 00 to 53, starting with the
160 first Sunday as the first day of week 01. See also %V and %W.</p>
161 </dd>
162 <dd>
163 <p><strong>%V</strong> - The ISO 8601:1988 week number of the current year as a decimal number, range 01 to  53,  where
164 week  1 is the first week that has at least 4 days in the current year, and with Monday as the
165 first day of the week. See also %U and %W.</p>
166 </dd>
167 <dd>
168 <p><strong>%w</strong> - The day of the week as a decimal, range 0 to 6, Sunday being 0.  See also %u.</p>
169 </dd>
170 <dd>
171 <p><strong>%W</strong> - The week number of the current year as a decimal number, range 00 to  53,  starting  with  the
172 first Monday as the first day of week 01.</p>
173 </dd>
174 <dd>
175 <p><strong>%x</strong> - The preferred date representation for the current locale without the time.</p>
176 </dd>
177 <dd>
178 <p><strong>%X</strong> - The preferred time representation for the current locale without the date.</p>
179 </dd>
180 <dd>
181 <p><strong>%y</strong> - The year as a decimal number without a century (range 00 to 99).</p>
182 </dd>
183 <dd>
184 <p><strong>%Y</strong> - The year as a decimal number including the century.</p>
185 </dd>
186 <dd>
187 <p><strong>%Z</strong> - The time zone or name or abbreviation.</p>
188 </dd>
189 <dd>
190 <p><strong>%%</strong> - A literal `%' character.</p>
191 </dd>
192 </li>
193 <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>
195 <dd>
196 <p><em>Deprecated. Use the new form of this command in new scripts.</em>
197 The first form of this command is to be used with <strong>CDEF</strong> <em>vname</em>s.</p>
198 </dd>
199 </li>
200 </dl>
201 <p>
202 </p>
203 <h2><a name="graph">GRAPH</a></h2>
204 <dl>
205 <dt><strong><a name="item_gprint_3avname_3aformat"><strong>GPRINT</strong><strong>:</strong><em>vname</em><strong>:</strong><em>format</em></a></strong>
207 <dd>
208 <p>This is the same as <code>PRINT</code>, but printed inside the graph.</p>
209 </dd>
210 </li>
211 <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>
213 <dd>
214 <p><em>Deprecated. Use the new form of this command in new scripts.</em>
215 This is the same as <code>PRINT</code>, but printed inside the graph.</p>
216 </dd>
217 </li>
218 <dt><strong><a name="item_comment_3atext"><strong>COMMENT</strong><strong>:</strong><em>text</em></a></strong>
220 <dd>
221 <p>Text is printed literally in the legend section of the graph. Note that in
222 RRDtool 1.2 you have to escape colons in COMMENT text in the same way you
223 have to escape them in <strong>*PRINT</strong> commands by writing <strong>'\:'</strong>.</p>
224 </dd>
225 </li>
226 <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>
228 <dd>
229 <p>Draw a vertical line at <em>time</em>.  Its color is composed from three
230 hexadecimal numbers specifying the rgb color components (00 is off, FF is
231 maximum) red, green and blue followed by an optional alpha. Optionally, a legend box and string is
232 printed in the legend section. <em>time</em> may be a number or a variable
233 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>
234 </dd>
235 </li>
236 <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>
238 <dd>
239 <p>Draw a horizontal line at <em>value</em>.  HRULE acts much like LINE except that
240 will have no effect on the scale of the graph. If a HRULE is outside the
241 graphing area it will just not be visible.</p>
242 </dd>
243 </li>
244 <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>
246 <dd>
247 <p>Draw a line of the specified width onto the graph. <em>width</em> can be a
248 floating point number. If the color is not specified, the drawing is done
249 'invisibly'. This is useful when stacking something else on top of this
250 line. Also optional is the legend box and string which will be printed in
251 the legend section if specified. The <strong>value</strong> can be generated by <strong>DEF</strong>,
252 <strong>VDEF</strong>, and <strong>CDEF</strong>.  If the optional <strong>STACK</strong> modifier is used, this line
253 is stacked on top of the previous element which can be a <strong>LINE</strong> or an
254 <strong>AREA</strong>.</p>
255 </dd>
256 <dd>
257 <p>When you do not specify a color, you cannot specify a legend.  Should
258 you want to use STACK, use the ``LINEx:&lt;value&gt;::STACK'' form.</p>
259 </dd>
260 </li>
261 <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>
263 <dd>
264 <p>See <strong>LINE</strong>, however the area between the x-axis and the line will
265 be filled.</p>
266 </dd>
267 </li>
268 <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>
270 <dd>
271 <p>Plot a tick mark (a vertical line) for each value of <em>vname</em> that is
272 non-zero and not *UNKNOWN*. The <em>fraction</em> argument specifies the length of
273 the tick mark as a fraction of the y-axis; the default value is 0.1 (10% of
274 the axis). Note that the color specification is not optional. The TICK marks normaly
275 start at the lower edge of the graphing area. If the fraction is negative they start
276 at the upper border of the graphing area.</p>
277 </dd>
278 </li>
279 <dt><strong><a name="item_shift_3avname_3aoffset"><strong>SHIFT</strong><strong>:</strong><em>vname</em><strong>:</strong><em>offset</em></a></strong>
281 <dd>
282 <p>Using this command <strong>RRDtool</strong> will graph the following elements
283 with the specified offset.  For instance, you can specify an
284 offset of (&nbsp;7*24*60*60&nbsp;=&nbsp;)&nbsp;604'800&nbsp;seconds to ``look back'' one
285 week. Make sure to tell the viewer of your graph you did this ...
286 As with the other graphing elements, you can specify a number or
287 a variable here.</p>
288 </dd>
289 </li>
290 <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>
292 <dd>
293 <p><em>Deprecated.  Use the <strong>STACK</strong> modifiers on the other commands.</em></p>
294 </dd>
295 </li>
296 </dl>
297 <p><strong>Some notes on stacking</strong></p>
298 <p>When stacking, an element is not placed above the X-axis but rather
299 on top of the previous element.  There must be something to stack
300 upon.</p>
301 <p>You can use an <strong>invisible</strong> LINE or AREA to stacked upon.</p>
302 <p>An <strong>unknown</strong> value makes the entire stack unknown from that moment on.
303 You don't know where to begin (the unknown value) and therefore do
304 not know where to end.</p>
305 <p>If you want to make sure you will be displaying a certain variable,
306 make sure never to stack upon the unknown value.  Use a CDEF instruction
307 with <strong>IF</strong> and <strong>UN</strong> to do so.</p>
308 <p>
309 </p>
310 <hr />
311 <h1><a name="notes_on_legend_arguments">NOTES on legend arguments</a></h1>
312 <p>
313 </p>
314 <h2><a name="escaping_the_colon">Escaping the colon</a></h2>
315 <p>A colon ':' in a <em>legend</em> argument will mark the end of the
316 legend. To enter a ':' as part of a legend, the colon must be escaped
317 with a backslash '\:'.  Beware that many environments process
318 backslashes themselves, so it may be necessary to write two
319 backslashes in order to one being passed onto rrd_graph.</p>
320 <p>
321 </p>
322 <h2><a name="string_formatting">String Formatting</a></h2>
323 <p>The text printed below the actual graph can be formatted by appending special
324 escape characters at the end of a text. When ever such a character occurs,
325 all pending text is pushed onto the graph according to the character
326 specified.</p>
327 <p>Valid markers are: <strong>\j</strong> for justified, <strong>\l</strong> for left aligned, <strong>\r</strong> for
328 right aligned, and <strong>\c</strong> for centered. In the next section there is an
329 example showing how to use centered formatting.</p>
330 <p><strong>\n</strong> is a valid alias for <strong>\l</strong> since incomplete parsing in earlier
331 versions of rrdtool lead to this behaviour and a number of people has been using it.</p>
332 <p>Normally there are two space characters inserted between every two items
333 printed into the graph. The space following a string can be suppressed by
334 putting a <strong>\g</strong> at the end of the string. The <strong>\g</strong> also ignores any space
335 inside the string if it is at the very end of the string. This can be used
336 in connection with <strong>%s</strong> to suppress empty unit strings.</p>
337 <pre>
338  GPRINT:a:MAX:%lf%s\g</pre>
339 <p>A special case is COMMENT:<strong>\s</strong> which inserts some additional vertical space
340 before placing the next row of legends.</p>
341 <p>If you are using the proportional font in your graph, you can use tab
342 characters or the sequence <strong>\t</strong> to line-up legend elements. Note that
343 the tabs inserted are relative to the start of the current legend
344 element!</p>
345 <p>
346 </p>
347 <hr />
348 <h1><a name="see_also">SEE ALSO</a></h1>
349 <p><a href="././rrdgraph.html">the rrdgraph manpage</a> gives an overview of how <strong>rrdtool graph</strong> works.
350 <a href="././rrdgraph_data.html">the rrdgraph_data manpage</a> describes <strong>DEF</strong>,<strong>CDEF</strong> and <strong>VDEF</strong> in detail.
351 <a href="././rrdgraph_rpn.html">the rrdgraph_rpn manpage</a> describes the <strong>RPN</strong> language used in the <strong>?DEF</strong> statements.
352 <a href="././rrdgraph_graph.html">the rrdgraph_graph manpage</a> page describes all of the graph and print functions.</p>
353 <p>Make sure to read <a href="././rrdgraph_examples.html">the rrdgraph_examples manpage</a> for tips&amp;tricks.</p>
354 <p>
355 </p>
356 <hr />
357 <h1><a name="author">AUTHOR</a></h1>
358 <p>Program by Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
359 <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>
361 </body>
363 </html>