PHP 8.4.2 Released!

rrd_graph

(PECL rrd >= 0.9.0)

rrd_graph从数据创建图像

说明

rrd_graph(string $filename, array $options): array

从 RRD 文件的详细数据创建图像。

参数

filename

输出的图表文件名。根据输出的格式,文件通常是 .png.svg.eps 格式。

options

生成图像的选项。请参阅 rrd graph 手册以获取所有可用选项。允许使用所有选项(数据定义、变量定义等)。

返回值

返回包含生成图像信息的数组, 或者在失败时返回 false

添加备注

用户贡献的备注 6 notes

up
4
Anonymous
4 years ago
This documentation page is useless ...

"See man page of rrd graph for all possible options"

I thought I am looking at the documentation, of not, why not provide a link ?
up
1
Dk
11 years ago
You can get the latest RRD Error by simply doing print_r(rrd_error()) immediately after the rrd_graph() call.
up
1
Matt C
12 years ago
Note; apache server requires write access to the folder in which the image is to be created otherwise no image file is produced, and (unhelpfully) no error is generated.
up
-1
info at ukee dot nl
9 years ago
When using style features like: --font TITLE:13:Times
use in your code: --font=TITLE:13:Times

the "=" is missing in the documentation
up
-2
Anonymous
11 years ago
When I add

--font AXIS:8:

into $options,

I receive the next error:

PNG creation error: unknown option '--font AXIS:8:'

According to docs from rrdtool site the right syntax is:

[-n|--font FONTTAG:size:[font]]

This lets you customize which font to use for the various text elements on the RRD graphs. DEFAULT sets the default value for all elements, TITLE for the title, AXIS for the axis labels, UNIT for the vertical unit label, LEGEND for the graph legend, WATERMARK for the watermark on the edge of the graph.

Use Times for the title: --font TITLE:13:Times

Note that you need to quote the argument to --font if the font-name contains whitespace: --font "TITLE:13:Some Font"

If you do not give a font string you can modify just the size of the default font: --font TITLE:13:.
To Top