SGNGD : SvgGd is Not GD

SVG Charts for PHP


SGNGD is a PHP library to help you for generating SVG charts.
Based-on SVG technology, charts are more efficient. With few code lines, you can create many relevant charts such as:

  • Pie Chart
  • Bar Chart
  • Horizontal Bar chart
  • Kiviat Chart
  • Point Cloud Chart
  • Mathematical function plotter



  Example of use:

* Copyright 2008 Renaud Guezennec
* This file is part of SGNGD.
* SGNGD is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* SDNGD distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with SGNGD. If not, see <>.

* \author:Renaud Guezennec
* \brief Example of KiviatChart use.
* \version 0.1
* \date 28/03/2009
$chartsvg = new KiviatChart("kiviatChart SVG",FULLDEFINED);
/*$chartsvg->setStartColor(new Color(0,150,0));
$chartsvg->setEndColor(new Color(255,150,0));*/
$chartsvg->AddData('Elf',$data[0],new Color(255,0,0));
$chartsvg->AddData('Golem',$data[1],new Color(0,255,0));
$chartsvg->AddData('Dwarf',$data[2],new Color(0,0,255));
header('Content-Type: image/svg+xml');
echo $chartsvg->display();


Extract the archive in a directory of your web site.

How to use: (Quick Start)

-Open a new php file.
-Include SGNGD: require_once( path_to_SGNGD/Chart.php );
-Make a new instance of which chart you want:PieChart or BarChart (others are coming soon). $class = new BarChart();
-Add items by calling $class->AddData( name ,value);
-Call $class->compute().
-Define the type of page by call header: header(‘Content-Type: image/svg xml’);
and display the chart by calling echo $class->display();
You can manage colors of your chart, the size and few other things.
For more details, take a look to the user manual.




Manuel: SGNGD-usermanual.pdf
Source: SGNGD.tar.gz< Git: