another batch of fixes from fritz
[rrdtool.git] / doc / rrdgraph_graph.pod
1 =head1 NAME  
2
3 rrdgraph_graph - rrdtool graph command reference
4
5 =head1 SYNOPSIS
6
7 B<PRINT>B<:>I<vname>B<:>I<format>
8
9 B<GPRINT>B<:>I<vname>B<:>I<format>
10
11 B<COMMENT>B<:>I<text>
12
13 B<VRULE>B<:>I<vname>B<#>I<color>[B<:>I<legend>]
14
15 B<LINE>I<width>B<:>I<vname>B<#>I<color>[B<:>I<legend>][B<:>B<STACK>]
16
17 B<AREA>B<:>I<vname>B<#>I<color>[B<:>I<legend>][B<:>B<STACK>]
18
19 B<TICK>B<:>I<vname>B<#>I<rrggbb>[I<aa>][B<:>I<fraction>[B<:>I<legend>]]
20
21 B<SHIFT>B<:>I<vname>B<:>I<offset>
22
23 =cut
24
25 B<PART>B<:>I<vname>B<#>I<rrggbb>[I<aa>][B<:>I<legend>]
26
27 =pod
28
29 B<PRINT>B<:>I<vname>B<:>I<CF>B<:>I<format> (deprecated)
30
31 B<GPRINT>B<:>I<vname>B<:>I<CF>B<:>I<format> (deprecated)
32
33 B<HRULE>B<:>I<value>B<#>I<color>[B<:>I<legend>] (deprecated)
34
35 B<STACK>B<:>I<vname>B<#>I<color>[B<:>I<legend>] (deprecated)
36
37 =head1 DESCRIPTION
38
39 These instructions allow you to generate your image or report.
40 If you don't use any graph elements, no graph is generated.
41 Similarly, no report is generated if you don't use print options.
42
43 =head1 PRINT
44
45 =over 4
46
47 =item B<PRINT:>I<vname>B<:>I<CF><:>I<format>
48
49 I<Deprecated. Use the new form of this command in new scripts.>
50 The first form of this command is to be used with B<CDEF> I<vname>s.
51
52 =item B<PRINT:>I<vname>B<:>I<format>
53
54 Depending on the context, either the value component or the time
55 component of a B<VDEF> is printed using I<format>. It is an error
56 to specify a I<vname> generated by a B<DEF> or B<CDEF>.
57
58 Any text in I<format> is printed literally with one exception:
59 The percent character introduces a formatter string. This string
60 can be:
61
62 For printing values:
63
64 =over 4
65
66 =item *
67
68 B<%%> just prints a literal '%' character
69
70 =item *
71
72 B<%#.#le> prints numbers like 1.2346e+04. The optional integers # denote field
73 width and decimal precision.
74
75 =item *
76
77 B<%#.#lf> prints numbers like 12345.6789, with optional field width
78 and precision.
79
80 =item *
81
82 B<%s> place this after B<%le>, B<%lf> or B<%lg>. This will be replaced by the
83 appropriate SI magnitude unit and the value will be scaled
84 accordingly (123456 -> 123.456 k).
85
86 =item *
87
88 B<%S> is similar to B<%s>. It does, however, use a previously defined
89 magnitude unit. If there is no such unit yet, it tries to define
90 one (just like B<%s>) unless the value is zero, in which case the magnitude
91 unit stays undefined. Thus, formatter strings using B<%S> and no B<%s>
92 will all use the same magnitude unit except for zero values.
93
94 =back
95
96 For printing times:
97
98 =over 4
99
100 =item *
101
102 B<%%> just prints a literal '%' character
103
104 =item *
105
106 B<%a, %A> print the abbreviated or full name of the day of the week.
107
108 =item *
109
110 B<%b, %B> print the abbreviated or full name of the month.
111
112 =item *
113
114 B<%d, %m, %y, %H, %M, %S> print day, month, year, hour, minute, and
115 second in two-digit format.
116
117 =item *
118
119 B<%Y> prints the year in 4-digit format.
120
121 =item *
122
123 B<%I, %p> print the hour (01..12), 'am' or 'pm'.
124
125 =item *
126
127 B<%j, %w> print day of the week (0..6), day of the year (1..366)
128
129 =item *
130
131 B<%c, %x, %X> print date+time, date only, time only.
132
133 =item *
134
135 B<%U, %W> number of the week of the current year, with either the
136 first Sunday (%U) or the first Monday (%W) determining the first week.
137
138 =item *
139
140 B<%Z> prints the time zone.
141
142 =back
143
144 =back
145
146 =head1 GRAPH
147
148 =over 4
149
150 =item B<GPRINT>B<:>I<vname>B<:>I<CF>B<:>I<format>
151
152 I<Deprecated. Use the new form of this command in new scripts.>
153 This is the same as C<PRINT>, but printed inside the graph.
154
155 =item B<GPRINT>B<:>I<vname>B<:>I<format>
156
157 This is the same as C<PRINT>, but printed inside the graph.
158
159 =item B<COMMENT>B<:>I<text>
160
161 Text is printed literally in the legend section of the graph.
162
163 =item B<HRULE>B<:>I<value>B<#>I<color> [ :I<legend> ]
164
165 I<Deprecated. Use B<LINEx> in new scripts.>
166
167 =item B<VRULE>B<:>I<vname>B<#>I<color> [B<:>I<legend> ]
168
169 Draw a vertical line at I<time>.  Its color is composed from three
170 hexadecimal numbers specifying the rgb color components (00 is off, FF is
171 maximum) red, green and blue. Optionally, a legend box and string is
172 printed in the legend section. I<time> may be a number or a variable
173 from a B<VDEF>. It is an error to use I<vname>s from B<DEF> or B<CDEF> here.
174
175 =item B<LINE>I<width>B<:>I<{vname or number}>B<#>I<color>[B<:>I<legend>]
176 [ C<:STACK> ]
177
178 Draw a line of the specified width onto the graph. If the color
179 is not specified, the drawing is done 'invisibly'. This is useful when
180 stacking something else on top of this line. Also optional is the
181 legend box and string which will be printed in the legend section
182 if specified. The B<vname> can be generated by B<DEF>, B<VDEF>, and
183 B<CDEF>.  If the optional B<STACK> modifier is used, this line is
184 stacked on top of the previous element which can be a B<LINEx> or
185 an B<AREA>
186
187 =item B<AREA>B<:>I<vname>B<#>I<rrggbb>[I<aa>][B<:>I<legend>][B<:STACK>]
188
189 See B<LINE>, however the area between the x-axis and the line will
190 be filled.
191
192 =item B<TICK>B<:>I<vname>B<#>I<rrggbb>[I<aa>][B<:>I<fraction>[B<:>I<legend>]]
193
194 Plot a tick mark (a vertical line) for each value of I<vname> that is
195 non-zero and not *UNKNOWN*. The I<fraction> argument specifies the
196 length of the tick mark as a fraction of the y-axis; the default value
197 is 0.1 (10% of the axis). Note that the color specification is not
198 optional.
199
200 =item B<SHIFT>B<:>I<vname>B<:>I<offset>
201
202 Using this command B<RRDtool> will graph the following elements
203 with the specified offset.  For instance, you can specify an
204 offset of S<( 7*24*60*60 = ) 604'800 seconds> to "look back" one
205 week. Make sure to tell the viewer of your graph you did this ...
206 As with the other graphing elements, you can specify a number or
207 a variable here.
208
209 =cut
210
211 =item B<PART>B<:>I<vname>B<#>I<rrggbb>[I<aa>][B<:>I<legend>]
212
213 B<RRDtool> has now support for B<pie charts>. If you include the
214 B<PART> command, the canvas is extended to make room for a chart.
215 The size of the canvas is determined by the lesser of
216 L<width and height|rrdgraph/item_Size>.
217
218 Pie parts will be concatenated, the first one will start at the
219 top and parts will be created clockwise.  The size of the part
220 is defined by the value part of the L<VDEF|rrdgraph_data/VDEF>
221 function.  It should return a number between 0 and 100, being a
222 percentage.  Providing wrong input will produce undefined results.
223
224 =for comment
225 XXX Above: shouldn't this be caught and and error be generated? Fritz
226
227 =pod
228
229 =item B<STACK>B<:>I<vname>B<#>I<color>[B<:>I<legend>]
230
231 I<Deprecated.  Use the B<STACK> modifiers on the other commands.>
232
233 =back
234
235 B<Some notes on stacking>
236
237 When stacking, an element is not placed above the X-axis but rather
238 on top of the previous element.  There must be something to stack
239 upon.
240
241 You can use an B<invisible> LINEx or AREA to stacked upon.  
242
243 An B<unknown> value makes the entire stack unknown from that moment on.
244 You don't know where to begin (the unknown value) and therefore do
245 not know where to end.
246
247 If you want to make sure you will be displaying a certain variable,
248 make sure never to stack upon the unknown value.  Use a CDEF instruction
249 with B<IF> and B<UN> to do so.
250
251 =head1 NOTES on legend arguments
252
253 =head2 Escaping the colon
254
255 A colon ':' in a I<legend> argument will mark the end of the
256 legend. To enter a ':' as part of a legend, the colon must be escaped
257 with a backslash '\:'.  Beware that many environments process
258 backslashes themselves, so it may be necessary to write two
259 backslashes in order to one being passed onto rrd_graph.
260
261 =head2 String Formatting
262
263 The text printed below the actual graph can be formatted by appending special
264 escape characters at the end of a text. When ever such a character occurs,
265 all pending text is pushed onto the graph according to the character
266 specified.
267
268 Valid markers are: B<\j> for justified, B<\l> for left aligned, B<\r> for
269 right aligned, and B<\c> for centered. In the next section there is an
270 example showing how to use centered formatting.
271
272 Normally there are two space characters inserted between every two items
273 printed into the graph. The space following a string can be suppressed by
274 putting a B<\g> at the end of the string. The B<\g> also ignores any space
275 inside the string if it is at the very end of the string. This can be used
276 in connection with B<%s> to suppress empty unit strings.
277
278  GPRINT:a:MAX:%lf%s\g
279
280 A special case is COMMENT:B<\s> which inserts some additional vertical space
281 before placing the next row of legends.
282
283 If you are using the proportional font in your graph, you can use tab
284 characters or the sequence B<\t> to line-up legend elements. Note that
285 the tabs inserted are relative to the start of the current legend
286 element!
287
288 =head1 SEE ALSO
289
290 L<rrdgraph> gives an overview of how B<rrdtool graph> works.
291 L<rrdgraph_data> describes B<DEF>,B<CDEF> and B<VDEF> in detail.
292 L<rrdgraph_rpn> describes the B<RPN> language used in the B<?DEF> statements.
293 L<rrdgraph_graph> page describes all of the graph and print functions.
294
295 Make sure to read L<rrdgraph_examples> for tipsE<amp>tricks.
296
297 =head1 AUTHOR
298
299 Program by Tobias Oetiker E<lt>oetiker@ee.ethz.chE<gt>
300
301 This manual page by Alex van den Bogaerdt E<lt>alex@ergens.op.het.netE<gt>