Code

7f2a36b67e3702e176dcc0787952d739e3d13780
[pkg-rrdtool.git] / doc / rrdgraph_graph.pod
1 =pod
3 =head1 NAME
5 rrdgraph_graph - rrdtool graph command reference
7 =head1 SYNOPSIS
9 B<PRINT>B<:>I<vname>B<:>I<format>
11 B<GPRINT>B<:>I<vname>B<:>I<format>
13 B<COMMENT>B<:>I<text>
15 B<VRULE>B<:>I<time>B<#>I<color>[B<:>I<legend>][B<:dashes>[B<=>I<on_s>[,I<off_s>[,I<on_s>,I<off_s>]...]][B<:dash-offset=>I<offset>]]
17 B<HRULE>B<:>I<value>B<#>I<color>[B<:>I<legend>][B<:dashes>[B<=>I<on_s>[,I<off_s>[,I<on_s>,I<off_s>]...]][B<:dash-offset=>I<offset>]]
19 B<LINE>[I<width>]B<:>I<value>[B<#>I<color>][B<:>[I<legend>][B<:STACK>]][B<:dashes>[B<=>I<on_s>[,I<off_s>[,I<on_s>,I<off_s>]...]][B<:dash-offset=>I<offset>]]
21 B<AREA>B<:>I<value>[B<#>I<color>][B<:>[I<legend>][B<:STACK>]]
23 B<TICK>B<:>I<vname>B<#>I<rrggbb>[I<aa>][B<:>I<fraction>[B<:>I<legend>]]
25 B<SHIFT>B<:>I<vname>B<:>I<offset>
27 B<TEXTALIGN>B<:>{B<left>|B<right>|B<justified>|B<center>}
29 B<PRINT>B<:>I<vname>B<:>I<CF>B<:>I<format> (deprecated)
31 B<GPRINT>B<:>I<vname>B<:>I<CF>B<:>I<format> (deprecated)
33 B<STACK>B<:>I<vname>B<#>I<color>[B<:>I<legend>] (deprecated)
35 =head1 DESCRIPTION
37 These instructions allow you to generate your image or report.
38 If you don't use any graph elements, no graph is generated.
39 Similarly, no report is generated if you don't use print options.
41 =head2 PRINT
43 =head3 B<PRINT:>I<vname>B<:>I<format>[B<:strftime>]
45 Depending on the context, either the value component or the time
46 component of a B<VDEF> is printed using I<format>. It is an error
47 to specify a I<vname> generated by a B<DEF> or B<CDEF>.
49 Any text in I<format> is printed literally with one exception:
50 The percent character introduces a formatter string. This string
51 can be:
53 For printing values:
55 =over
57 =item B<%%>
59 just prints a literal '%' character
61 =item B<%#.#le>
63 prints numbers like 1.2346e+04. The optional integers # denote field
64 width and decimal precision.
66 =item B<%#.#lf>
68 prints numbers like 12345.6789, with optional field width
69 and precision.
71 =item B<%s>
73 place this after B<%le>, B<%lf> or B<%lg>. This will be replaced by the
74 appropriate SI magnitude unit and the value will be scaled
75 accordingly (123456 -> 123.456 k).
77 =item B<%S>
79 is similar to B<%s>. It does, however, use a previously defined
80 magnitude unit. If there is no such unit yet, it tries to define
81 one (just like B<%s>) unless the value is zero, in which case the magnitude
82 unit stays undefined. Thus, formatter strings using B<%S> and no B<%s>
83 will all use the same magnitude unit except for zero values.
85 =back
87 If you PRINT a VDEF value, you can also print the time associated with it by appending the string
88 B<:strftime> to the format. Note that rrdtool uses the strftime function of your OSs clibrary. This means that
89 the conversion specifier may vary. Check the manual page if you are uncertain. The following is a list of
90 conversion specifiers usually supported across the board. 
92 =over
94 =item B<%a>
96 The abbreviated weekday name according to the current locale.
98 =item B<%A>
100 The full weekday name according to the current locale.
102 =item B<%b>
104 The abbreviated month name according to the current locale.
106 =item B<%B>
108 The full month name according to the current locale.
110 =item B<%c>
112 The preferred date and time representation for the current locale.
114 =item B<%d>
116 The day of the month as a decimal number (range 01 to 31).
118 =item B<%H>
120 The hour as a decimal number using a 24-hour clock (range 00 to 23).
122 =item B<%I>
124 The hour as a decimal number using a 12-hour clock (range 01 to 12).
126 =item B<%j>
128 The day of the year as a decimal number (range 001 to 366).
130 =item B<%m>
132 The month as a decimal number (range 01 to 12).
134 =item B<%M>
136 The minute as a decimal number (range 00 to 59).
138 =item B<%p>
140 Either `AM' or `PM' according to the given time value, or the corresponding
141 strings for the current locale.  Noon is treated as `pm' and midnight as
142 `am'.  Note that in many locales and `pm' notation is unsupported and in
143 such cases %p will return an empty string.
145 =item B<%S>
147 The second as a decimal number (range 00 to 61).
149 =item B<%U>
151 The  week  number  of  the current year as a decimal number, range 00 to 53, starting with the
152 first Sunday as the first day of week 01. See also %V and %W.
154 =item B<%V>
156 The ISO 8601:1988 week number of the current year as a decimal number, range 01 to  53,  where
157 week  1 is the first week that has at least 4 days in the current year, and with Monday as the
158 first day of the week. See also %U and %W.
160 =item B<%w>
162 The day of the week as a decimal, range 0 to 6, Sunday being 0.  See also %u.
164 =item B<%W>
166 The week number of the current year as a decimal number, range 00 to  53,  starting  with  the
167 first Monday as the first day of week 01.
169 =item B<%x>
171 The preferred date representation for the current locale without the time.
173 =item B<%X>
175 The preferred time representation for the current locale without the date.
177 =item B<%y>
179 The year as a decimal number without a century (range 00 to 99).
181 =item B<%Y>
183 The year as a decimal number including the century.
185 =item B<%Z>
187 The time zone or name or abbreviation.
189 =item B<%%>
191 A literal `%' character.
193 =back
195 =head3 B<PRINT:>I<vname>B<:>I<CF>B<:>I<format>
197 I<Deprecated. Use the new form of this command in new scripts.>
198 The first form of this command is to be used with B<CDEF> I<vname>s.
201 =head2 GRAPH
203 =head3 B<GPRINT>B<:>I<vname>B<:>I<format>
205 This is the same as C<PRINT>, but printed inside the graph.
207 =head3 B<GPRINT>B<:>I<vname>B<:>I<CF>B<:>I<format>
209 I<Deprecated. Use the new form of this command in new scripts.>
210 This is the same as C<PRINT>, but printed inside the graph.
212 =head3 B<COMMENT>B<:>I<text>
214 Text is printed literally in the legend section of the graph. Note that in
215 RRDtool 1.2 you have to escape colons in COMMENT text in the same way you
216 have to escape them in B<*PRINT> commands by writing B<'\:'>.
218 =head3 B<VRULE>B<:>I<time>B<#>I<color>[B<:>I<legend>][B<:dashes>[B<=>I<on_s>[,I<off_s>[,I<on_s>,I<off_s>]...]][B<:dash-offset=>I<offset>]]
220 Draw a vertical line at I<time>.  Its color is composed from three
221 hexadecimal numbers specifying the rgb color components (00 is off, FF is
222 maximum) red, green and blue followed by an optional alpha. Optionally, a legend box and string is
223 printed in the legend section. I<time> may be a number or a variable
224 from a B<VDEF>. It is an error to use I<vname>s from B<DEF> or B<CDEF> here.
225 Dashed lines can be drawn using the B<dashes> modifier. See B<LINE> for more
226 details.
228 =head3 B<HRULE>B<:>I<value>B<#>I<color>[B<:>I<legend>][B<:dashes>[B<=>I<on_s>[,I<off_s>[,I<on_s>,I<off_s>]...]][B<:dash-offset=>I<offset>]]
230 Draw a horizontal line at I<value>.  HRULE acts much like LINE except that
231 will have no effect on the scale of the graph. If a HRULE is outside the
232 graphing area it will just not be visible.
234 =head3 B<LINE>[I<width>]B<:>I<value>[B<#>I<color>][B<:>[I<legend>][B<:STACK>]][B<:dashes>[B<=>I<on_s>[,I<off_s>[,I<on_s>,I<off_s>]...]][B<:dash-offset=>I<offset>]]
236 Draw a line of the specified width onto the graph. I<width> can be a
237 floating point number. If the color is not specified, the drawing is done
238 'invisibly'. This is useful when stacking something else on top of this
239 line. Also optional is the legend box and string which will be printed in
240 the legend section if specified. The B<value> can be generated by B<DEF>,
241 B<VDEF>, and B<CDEF>.  If the optional B<STACK> modifier is used, this line
242 is stacked on top of the previous element which can be a B<LINE> or an
243 B<AREA>.
245 The B<dashes> modifier enables dashed line style. Without any further options
246 a symmetric dashed line with a segment length of 5 pixels will be drawn. The
247 dash pattern can be changed if the B<dashes=> parameter is followed by either
248 one value or an even number (1, 2, 4, 6, ...) of positive values. Each value
249 provides the length of alternate I<on_s> and I<off_s> portions of the
250 stroke. The B<dash-offset> parameter specifies an I<offset> into the pattern
251 at which the stroke begins.
253 When you do not specify a color, you cannot specify a legend.  Should
254 you want to use STACK, use the "LINEx:<value>::STACK" form.
256 =head3 B<AREA>B<:>I<value>[B<#>I<color>][B<:>[I<legend>][B<:STACK>]]
258 See B<LINE>, however the area between the x-axis and the line will
259 be filled.
261 =head3 B<TICK>B<:>I<vname>B<#>I<rrggbb>[I<aa>][B<:>I<fraction>[B<:>I<legend>]]
263 Plot a tick mark (a vertical line) for each value of I<vname> that is
264 non-zero and not *UNKNOWN*. The I<fraction> argument specifies the length of
265 the tick mark as a fraction of the y-axis; the default value is 0.1 (10% of
266 the axis). Note that the color specification is not optional. The TICK marks normaly
267 start at the lower edge of the graphing area. If the fraction is negative they start
268 at the upper border of the graphing area.
270 =head3 B<SHIFT>B<:>I<vname>B<:>I<offset>
272 Using this command B<RRDtool> will graph the following elements
273 with the specified offset.  For instance, you can specify an
274 offset of S<( 7*24*60*60 = ) 604'800 seconds> to "look back" one
275 week. Make sure to tell the viewer of your graph you did this ...
276 As with the other graphing elements, you can specify a number or
277 a variable here.
279 =head3 B<TEXTALIGN>B<:>{B<left>|B<right>|B<justified>|B<center>}
281 Labels are placed below the graph. When they overflow to the left, they wrap
282 to the next line. By default, lines are justified left and right. The
283 B<TEXTALIGN> function lets you change this default. This is a command and
284 not an option, so that you can change the default several times in your
285 argument list.
287 =cut
289 # This section describes the curruently defunct
290 # PieChart code.
292 # =item B<PART>B<:>I<vname>B<#>I<rrggbb>[I<aa>][B<:>I<legend>]
294 # B<RRDtool> has now support for B<pie charts>. If you include the
295 # B<PART> command, the canvas is extended to make room for a chart.
296 # The size of the canvas is determined by the lesser of
297 # L<width and height|rrdgraph/item_Size>.
299 # Pie parts will be concatenated, the first one will start at the
300 # top and parts will be created clockwise.  The size of the part
301 # is defined by the value part of the L<VDEF|rrdgraph_data/VDEF>
302 # function.  It should return a number between 0 and 100, being a
303 # percentage.  Providing wrong input will produce undefined results.
307 =pod
309 =head3 B<STACK>B<:>I<vname>B<#>I<color>[B<:>I<legend>]
311 I<Deprecated.  Use the B<STACK> modifiers on the other commands.>
313 =back
315 B<Some notes on stacking>
317 When stacking, an element is not placed above the X-axis but rather
318 on top of the previous element.  There must be something to stack
319 upon.
321 You can use an B<invisible> LINE or AREA to stacked upon.
323 An B<unknown> value makes the entire stack unknown from that moment on.
324 You don't know where to begin (the unknown value) and therefore do
325 not know where to end.
327 If you want to make sure you will be displaying a certain variable,
328 make sure never to stack upon the unknown value.  Use a CDEF instruction
329 with B<IF> and B<UN> to do so.
331 =head1 NOTES on legend arguments
333 =head2 Escaping the colon
335 A colon ':' in a I<legend> argument will mark the end of the
336 legend. To enter a ':' as part of a legend, the colon must be escaped
337 with a backslash '\:'.  Beware that many environments process
338 backslashes themselves, so it may be necessary to write two
339 backslashes in order to one being passed onto rrd_graph.
341 =head2 String Formatting
343 The text printed below the actual graph can be formatted by appending special
344 escape characters at the end of a text. When ever such a character occurs,
345 all pending text is pushed onto the graph according to the character
346 specified.
348 Valid markers are: B<\j> for justified, B<\l> for left aligned, B<\r> for
349 right aligned, and B<\c> for centered. In the next section there is an
350 example showing how to use centered formatting.
352 B<\n> is a valid alias for B<\l> since incomplete parsing in earlier
353 versions of rrdtool lead to this behaviour and a number of people has been using it.
355 Normally there are two space characters inserted between every two items
356 printed into the graph. The space following a string can be suppressed by
357 putting a B<\g> at the end of the string. The B<\g> also ignores any space
358 inside the string if it is at the very end of the string. This can be used
359 in connection with B<%s> to suppress empty unit strings.
361  GPRINT:a:MAX:%lf%s\g
363 A special case is COMMENT:B<\s> which inserts some additional vertical space
364 before placing the next row of legends.
366 If you are using the proportional font in your graph, you can use tab
367 characters or the sequence B<\t> to line-up legend elements. Note that
368 the tabs inserted are relative to the start of the current legend
369 element!
371 Since RRDtool 1.3 is using Pango for rending text, you can use Pango markup.
372 Pango uses the xml B<span> tags for inline formatting instructions.:
374 A simple example of a marked-up string might be: 
376  <span foreground="blue" size="x-large">Blue text</span> is <i>cool</i>!
378 The complete list of attributes for the span tag (taken from the pango documentation):
380 =over
382 =item B<font_desc>
384 A font description string, such as "Sans Italic 12"; note that any other span attributes will override this description. So if you have "Sans Italic" and also a style="normal" attribute, you will get Sans normal, not italic.
386 =item B<font_family>
388 A font family name
390 =item B<face>
392 Synonym for font_family
394 =item B<size>
396 Font size in 1024ths of a point, or one of the absolute sizes 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', or one of the relative sizes 'smaller' or 'larger'. If you want to specify a absolute size, it's usually easier to take advantage of the ability to specify a partial font description using 'font_desc'; you can use font_desc='12.5' rather than size='12800'.
398 =item B<style>
400 One of 'normal', 'oblique', 'italic'
402 =item B<weight>
404 One of 'ultralight', 'light', 'normal', 'bold', 'ultrabold', 'heavy', or a numeric weight
406 =item B<variant>
408 'normal' or 'smallcaps'
410 =item B<stretch>
412 One of 'ultracondensed', 'extracondensed', 'condensed', 'semicondensed', 'normal', 'semiexpanded', 'expanded', 'extraexpanded', 'ultraexpanded'
414 =item B<foreground>
416 An RGB color specification such as '#00FF00' or a color name such as 'red'
418 =item B<background>
420 An RGB color specification such as '#00FF00' or a color name such as 'red'
422 =item B<underline>
424 One of 'none', 'single', 'double', 'low', 'error'
426 =item B<underline_color>
428 The color of underlines; an RGB color specification such as '#00FF00' or a color name such as 'red'
430 =item B<rise>
432 Vertical displacement, in 10000ths of an em. Can be negative for subscript, positive for superscript.
434 =item B<strikethrough>
436 'true' or 'false' whether to strike through the text
438 =item B<strikethrough_color>
440 The color of strikethrough lines; an RGB color specification such as '#00FF00' or a color name such as 'red'
442 =item B<fallback>
444 'true' or 'false' whether to enable fallback. If disabled, then characters will only be used from the closest matching font on the system. No fallback will be done to other fonts on the system that might contain the characters in the text. Fallback is enabled by default. Most applications should not disable fallback.
446 =item B<lang>
448 A language code, indicating the text language
450 =item B<letter_spacing>
452 Inter-letter spacing in 1024ths of a point.
454 =item B<gravity>
456 One of 'south', 'east', 'north', 'west', 'auto'.
458 =item B<gravity_hint>
460 One of 'natural', 'strong', 'line'.
462 =back
464 To save you some typing, there are also some shortcuts:
466 =over
468 =item B<b>
470 Bold
472 =item B<big>
474 Makes font relatively larger, equivalent to <span size="larger">
476 =item B<i>
478 Italic
480 =item B<s>
482 Strikethrough
484 =item B<sub>
486 Subscript
488 =item B<sup>
490 Superscript
492 =item B<small>
494 Makes font relatively smaller, equivalent to <span size="smaller">
496 =item B<tt>
498 Monospace font
500 =item B<u>
502 Underline 
504 =back
506 =head1 SEE ALSO
508 L<rrdgraph> gives an overview of how B<rrdtool graph> works.
509 L<rrdgraph_data> describes B<DEF>,B<CDEF> and B<VDEF> in detail.
510 L<rrdgraph_rpn> describes the B<RPN> language used in the B<?DEF> statements.
511 L<rrdgraph_graph> page describes all of the graph and print functions.
513 Make sure to read L<rrdgraph_examples> for tipsE<amp>tricks.
515 =head1 AUTHOR
517 Program by Tobias Oetiker E<lt>tobi@oetiker.chE<gt>
519 This manual page by Alex van den Bogaerdt E<lt>alex@ergens.op.het.netE<gt>