SVGGraph Library version 3.20 ============================= This library provides PHP classes and functions for easily creating SVG graphs from data. Version 3.0 of SVGGraph requires at least PHP 5.4 - if you must use an earlier version of PHP then use the SVGGraph 2.x version. Here is a basic example: $graph = new Goat1000\SVGGraph\SVGGraph(640, 480); $graph->colours(['red', 'green', 'blue']); $graph->values(['Tom' => 100, 'Dick' => 200, 'Harry' => 150]); $graph->render('BarGraph'); Full documentation is available at http://www.goat1000.com/ Graph types =========== At the moment these types of graph are supported by SVGGraph: EmptyGraph - en empty document that can be used to add shapes or labels; BarGraph - vertical bars, optionally hyperlinked; LineGraph - a line joining the data points, with optionally hyperlinked markers at the data points; PieGraph - a pie chart, with optionally hyperlinked slices and option to fade labels in/out when the pointer enters/leaves a slice; Bar3DGraph - a 3D-looking version of the BarGraph type; Pie3DGraph - a 3D-looking version of the PieGraph type; ScatterGraph - markers drawn at arbitrary horizontal and vertical points; MultiLineGraph - multiple data sets drawn as lines on one graph; SteppedLineGraph - a line graph with its lines drawin in horizonal and vertical steps; MultiSteppedLineGraph - a MultiLineGraph, but using stepped lines; StackedBarGraph - multiple data sets drawn as bars, stacked one on top of another; GroupedBarGraph - multiple data sets drawn as bars, side-by-side; StackedLineGraph - multiple data sets, their values added together; StackedGroupedBarGraph - multiple data sets, their values added together and split into groups; BarAndLineGraph - a grouped bar graph and multi-line graph on the same graph; StackedBarAndLineGraph - a stacked bar graph and multi-line graph on the same graph; Histogram - a bar graph that shows the range of values; ParetoChart - a bar and line graph showing sorted and summed values; MultiScatterGraph - scatter graph supporting multiple data sets; HorizontalBarGraph - a bar graph with the axes swapped; HorizontalStackedBarGraph - a stacked bar graph drawn horizontally; HorizontalGroupedBarGraph - a grouped bar graph drawn horizontally; HorizontalBar3DGraph - a 3D bar graph with the axes swapped; HorizontalStackedBar3DGraph - a stacked 3D bar graph drawn horizontally; HorizontalGroupedBar3DGraph - a grouped 3D bar graph drawn horizontally; RadarGraph - a radar or star graph with values drawn as lines; MultiRadarGraph - a radar graph supporting multiple data sets; CylinderGraph - a 3D bar graph with the bars cylinder shaped; StackedBar3DGraph - a 3D bar graph version of the stacked bar graph; GroupedBar3DGraph - a 3D bar graph version of the grouped bar graph; StackedGroupedBar3DGraph - a 3D bar graph version of the stacked grouped bar graph; StackedCylinderGraph - a cylinder-bar version of the stacked bar graph; GroupedCylinderGraph - a cylinder-bar version of the grouped bar graph; StackedGroupedCylinderGraph - a cylinder-bar version of the stacked grouped bar graph; DonutGraph - a pie graph with a hole in the middle; SemiDonutGraph - half of a donut graph; Donut3DGraph - a 3D version of the donut graph; SemiDonut3DGraph - a 3D version of the semi-donut graph; PolarAreaGraph - a pie graph where the area of the slice varies instead of its angle; PolarArea3DGraph - a 3D version of the polar area graph. ExplodedPieGraph - a pie graph with slices exploded out from the centre. ExplodedPie3DGraph - a 3D version of the exploded pie graph. ExplodedDonutGraph - a donut graph with its slices exploded; ExplodedSemiDonutGraph - a semi-donut graph with its slices exploded; ExplodedDonut3DGraph - a 3D version of the exploded donut graph; ExplodedSemiDonut3DGraph - a 3D version of the exploded semi-donut graph; ArrayGraph - a graph containing other graphs. There are also these graphs that are really hard to describe: FloatingBarGraph; HorizontalFloatingBarGraph; BubbleGraph; BoxAndWhiskerGraph; PopulationPyramid; CandlestickGraph; GanttChart. Using SVGGraph ============== The library consists of a directory of class files and a subdirectory of font metrics. An autoloader will load classes on demand when they are required. SVGGraph includes an autoloader script if you don't have one - include the "autoloader.php" file to use it. Embedding SVG in a page ======================= There are several ways to insert SVG graphics into a page. At time of writing, all modern browsers support SVG natively, so the Adobe plugin is not required. For options 1-3, I'll assume you have a PHP script called "graph.php" which contains the SVGGraph code to generate the SVG document. Option 1: the embed tag This method works in all browsers, though the embed tag is not part of the HTML standard. Option 2: the iframe tag This method also works in all browsers, and the iframe tag is standard. Option 3: the object tag The object tag is standard, but this doesn't work in old versions of IE. Option 4a: using the svg namespace within an xhtml document This option is more complicated, as it requires changing the doctype and content type of the page being served. The SVG is generated as part of the same page.