Diagrams

Informations

Author: Pierre Marletta
License: FPDF

Description

This script allows to generate pie charts and bar diagrams. It uses the Sector script.

PieChart(float w, float h, array data, string format [, array colors])

w: maximum width of the diagram.
h: maximum height of the diagram.
data: associative array containing the labels and the corresponding data.
format: format used to display the legends. It is a string which can contain the following special values: %l (label), %v (value) and %p (percentage).
colors: array containing the colors. If not given, a grayscale will be used.

BarDiag(float w, float h, array data, string format [, array couleur [, int maxVal [, int nbDiv]]])

w: width of the diagram.
h: height of the diagram.
data: associative array containing the labels and the corresponding data.
format: format used to display the legends. It is a string which can contain the following special values: %l (label), %v (value) and %p (percentage).
color: color of the bars. If not given, gray will be used.
maxVal: high value of the scale. Defaults to the maximum value of the data.
nbDiv: number of subdivisions of the scale (4 by default).