Pass in the type of graph to display
public Render ( $class, $header = TRUE, $content_type = TRUE, $defer_js = FALSE ) |
protected function renderGraph($graphType, $width, $height, $settings, $values, $destFile = null) { $graph = new \SVGGraph($width, $height, $settings); $graph->Values($values); if ($destFile) { ob_start(); } $graph->Render($graphType, false, false); if ($destFile) { file_put_contents($destFile, ob_get_clean()); } }
<?php require_once __DIR__ . '/vendor/autoload.php'; $settings = array('back_colour' => 'white', 'graph_title' => 'Start of Fibonacci series'); $graph = new SVGGraph(600, 450, $settings); $graph->Values(0, 1, 1, 2, 3, 5, 8, 13, 21); $graph->Render('BarGraph');