PHPCon Poland 2024


(PECL rrd >= 0.9.0)

rrd_graphCrée une image depuis des données


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

Crée une image depuis un fichier RRD.

Liste de paramètres


Le nom du fichier dans lequel le graphique sera redirigé. Il se termine normalement par l'extension .png, .svg ou .eps, suivant le format de sortie désiré.


Options pour la génération de l'image. Reportez-vous à la page man du graphique RRD pour toutes les options possibles. Toutes les options (définitions de données, définitions des variables, etc.) sont autorisées.

Valeurs de retour

Tableau contenant les informations sur l'image générée, ou false si une erreur survient.

add a note

User Contributed Notes 6 notes

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 ?
10 years ago
You can get the latest RRD Error by simply doing print_r(rrd_error()) immediately after the rrd_graph() call.
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.
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
10 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