I'm trying to write a wrapper around Image_Graph bar charts. I actually wrote the whole thing but in the end didn't work, so now I'm back to the basics. This code below is taken directly from the ImageGraph website as a bar chart example. I just wrapped it in a function (where $data is ignored for now).
Ben (function.php, diyelim ki) tanımlanmış oluyor Aynı dosyadan diyoruz Bu işlev, eğer iyi çalışır. Ben ikinci bir dosya, sadece include_onceyi veya Require_once bu dosyayı function.php ve sonra sadece işlevini çağırmak caller.php yaparsanız Ancak, kırar.
Herkes bana yardımcı olabilir misiniz? Herhalde bazı temel hata yapıyorum ama ben sadece bunu anlamaya olamaz. Ben sadece Hello World yazdıran basit bir işlevi yapmak ve başka bir dosyadan ararsanız, iyi çalışıyor, çünkü o da Image_Graph özgü bir şey olabilir.
Thanks, Daniel
<?php
include_once('Image/Graph.php');
function DrawBarChart($width, $height, $data)
{
// create the graph
$graph = Image_Graph::factory('graph', array($width, $height));
// create the plotarea
$plotArea =& $graph->addNew('plotarea');
// create a dataset
$dataset =& Image_Graph::factory('dataset');
// add points
$dataset->addPoint('Denmark', 10);
$dataset->addPoint('Norway', 3);
$dataset->addPoint('Sweden', 8);
$dataset->addPoint('Finland', 5);
$plot =& $plotArea->addNew('bar', &$dataset);
$graph->done();
}
?>