// The label array values may have printf() formatting in them. The argument to the // form,at string will be the value of the slice (either the percetage or absolute // depending on what was specified in the SetLabelType() above. $lbl = array("adam\n%.1f%%", "bertil\n%.1f%%", "johan\n%.1f%%", "peter\n%.1f%%", "daniel\n%.1f%%", "erik\n%.1f%%"); $p1->SetLabels($lbl); // Uncomment this line to remove the borders around the slices // $p1->ShowBorder(false); // Add drop shadow to slices $p1->SetShadow(); // Explode all slices 15 pixels $p1->ExplodeAll(15); // Setup the CSIM targets $targ = array("piec_csimex1.php#1", "piec_csimex1.php#2", "piec_csimex1.php#3", "piec_csimex1.php#4", "piec_csimex1.php#5", "piec_csimex1.php#6"); $alts = array("val=%d", "val=%d", "val=%d", "val=%d", "val=%d", "val=%d"); $p1->SetCSIMTargets($targ, $alts); $p1->SetMidCSIM("piec_csimex1.php#7", "Center"); // Setup a small help text in the image $txt = new Text("Note: This is an example of image map. Hold\nyour mouse over the slices to see the values.\nThe URL just points back to this page"); $txt->SetFont(FF_FONT1, FS_BOLD); $txt->SetPos(0.5, 0.97, 'center', 'bottom'); $txt->SetBox('yellow', 'black'); $txt->SetShadow(); $graph->AddText($txt); // Add plot to pie graph $graph->Add($p1); // .. and send the image on it's marry way to the browser $graph->StrokeCSIM(); ?>
$p1->SetLabelType(PIE_VALUE_PER); // The label array values may have printf() formatting in them. The argument to the // form,at string will be the value of the slice (either the percetage or absolute // depending on what was specified in the SetLabelType() above. $lbl = array("Jan\n%.1f%%", "Feb\n%.1f%%", "March\n%.1f%%", "Apr\n%.1f%%", "May\n%.1f%%", "Jun\n%.1f%%"); $p1->SetLabels($lbl); // Add drop shadow to slices $p1->SetShadow(); // Explode all slices 15 pixels $p1->ExplodeAll(15); // Setup the CSIM targets global $_wrapperfilename; $targ = array(); $alt = array(); $wtarg = array(); for ($i = 0; $i <= $n; ++$i) { $urlarg = 'pie_clickedon=' . ($i + 1); $targ[] = $_wrapperfilename . '?' . $urlarg; $alt[] = 'val=%d'; $wtarg[] = ''; } $p1->SetCSIMTargets($targ, $alt, $wtarg); $p1->SetMidCSIM($targ[0], $alt[0], $wtarg[0]); // Add plot to pie graph $piegraph->Add($p1); // Send back the image when we are called from within the <img> tag $piegraph->StrokeCSIMImage(); ?>