function createGraph($name, $type)
 {
     YDInclude('YDGraph.php');
     // generate chart
     $values = array();
     for ($i = 0; $i < 12; $i++) {
         $values[] = rand(20, 60);
     }
     $labels = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
     // Create a new graph
     $g1 = new YDGraph(550, 250);
     $g1->setLimits(0, 20);
     $g1->setOffset(5);
     $g1->setFormat(1, ',', '.');
     $g1->addSeries($values, $type, 'Series1', SOLID, '#444444', '#4682B4');
     $g1->setYAxis('#4682B4', SOLID, 5, 'example');
     $g1->setLabels($labels, '#000000', 1, HORIZONTAL);
     $g1->plot(dirname(__FILE__) . '/' . $name);
 }
 function actionDefault()
 {
     // The labels and the values for the graph
     $values = array(60, 40, 20, 34, 26, 52, 41, 20, 34, 43, 64, 40);
     $labels = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
     // Create a new graph
     $g1 = new YDGraph(550, 250);
     // Set the limits
     $g1->setLimits(0, 20);
     // Set the offsets
     $g1->setOffset(5);
     // Set the format
     $g1->setFormat(1, ',', '.');
     // Add the series
     $g1->addSeries($values, 'bar', 'Series1', SOLID, '#444444', '#4682B4');
     // Set the Y axis
     $g1->setYAxis('#4682B4', SOLID, 5, 'example');
     // Set the labels
     $g1->setLabels($labels, '#000000', 1, HORIZONTAL);
     // Plot the graph
     $g1->plot();
 }