SVGGraph 2.15.1 - a PHP SVG graph library
SVGGraph is an object-oriented PHP library for creating simple PHP graphs, released as open source under the LGPL v3 license. Here are some examples of different types of graph supported by SVGGraph.
If you are still using PHP4, then you should use version 1.2.1 of SVGGraph: SVGGraph.zip [35k] or SVGGraph.tar.bz2 [25k]. Please read the included README.txt file for the correct instructions for the earlier version.
This library provides PHP classes and functions for easily creating SVG graphs from data. As of version 2.0, SVGGraph works with PHP 5 only, PHP 4 support has been dropped.
Here is a basic example:
$graph = new SVGGraph(640, 480); $graph->colours = array('red','green','blue'); $graph->Values(100, 200, 150); $graph->Links('/Tom/', '/Dick/', '/Harry/'); $graph->Render('BarGraph');
This will create a SVG file containing a 640x480 bar graph with three hyperlinked bars.
At the moment these types of graph are supported by SVGGraph - the class
name of the type of graph you want to generate should be passed to the
|BarGraph||Vertical bars, optionally hyperlinked.|
|StackedBarGraph||Vertical bars, with multiple datasets stacked.|
|GroupedBarGraph||Vertical bars, with multiple datasets grouped side-by-side.|
For more details and examples, see the bar graph page.
|Bar3DGraph||A 3D-looking version of the BarGraph type.|
|StackedBar3DGraph||3D vertical bars, with multiple datasets stacked.|
|GroupedBar3DGraph||3D vertical bars, with multiple datasets grouped side-by-side.|
|CylinderGraph||Vertical 3D cylinder-shaped bars.|
|StackedCylinderGraph||Cylinder-shaped version of stacked bar graph.|
|GroupedCylinderGraph||Cylinder-shaped version of grouped bar graph.|
For more details and examples, see the 3D bar graph page.
|HorizontalBarGraph||Horizontal bars, optionally hyperlinked.|
|HorizontalStackedBarGraph||Horizontal bars, with multiple datasets in-line.|
|HorizontalGroupedBarGraph||Horizontal bars, with multiple datasets grouped vertically.|
|PopulationPyramid||A horizontal bar graph with the bars drawn from a central axis, used to show male and female populations and ages.|
For more details and examples, see the horizontal bar graph page.
|LineGraph||A line joining the data points, with optionally hyperlinked markers at the data points.|
|MultiLineGraph||Multiple lines joining the data points in each data set, with optionally hyperlinked markers at the data points.|
|StackedLineGraph||Multiple lines joining data points, with the values from different data sets added together.|
For more details and examples, see the line graph page.
|ScatterGraph||Markers drawn at arbitrary horizontal and vertical points.|
|MultiScatterGraph||Markers from multiple data sets drawn at arbitrary horizontal and vertical points.|
For more details and examples, see the scatter graph page.
|RadarGraph||A line joining the data points, measured from the centre point, with optionally hyperlinked markers at the data points.|
|MultiRadarGraph||Multiple lines joining the data points in each data set, measured from the centre point, with optionally hyperlinked markers at the data points.|
For more details and examples, see the radar graph page.
|PieGraph||A pie chart, with optionally hyperlinked slices and option to fade labels in/out when the pointer enters/leaves a slice.|
|Pie3DGraph||A 3D-looking version of the PieGraph type.|
|DonutGraph||A pie chart, with a hole in the centre where text can be displayed.|
|PolarAreaGraph||A pie chart where the area of the slice indicates the value instead of the slice angle.|
|ExplodedPieGraph||A pie chart with slices pushed out from the centre point.|
For more details and examples, see the pie graph page.
|FloatingBarGraph||A bar graph where the top and bottom of each bar use separate data points.|
|HorizontalFloatingBarGraph||A horizontal version of the FloatingBarGraph.|
|BubbleGraph||A scatter graph where the markers are replaced by filled circles, their areas coming from another data point.|
|BoxAndWhiskerGraph||A bar-like graph for displaying statistical distributions.|
For more details and examples, see the other graphs page.
If you have trouble figuring out how to get your graph working from the details on these pages, or if you find any bugs or have suggestions for improvements, please contact me at the usual address, graham(at)goat1000.com.
Thanks to Pierre-Sylvain Luquet for his code submissions.