Ejemplo n.º 1
0
$img = ImageCreateTrueColor($width + $xtra_width, $height + ceil($shadow_height) + $xtra_height);
ImageFill($img, 0, 0, colorHex($img, $background_color));
foreach ($colors as $colorkode) {
    $fill_color[] = colorHex($img, $colorkode);
    $shadow_color[] = colorHexshadow($img, $colorkode, $shadow_dark);
}
$label_place = 5;
if (is_array($label)) {
    for ($i = 0; $i < count($label); $i++) {
        if ($label_form == 'round' && $show_label) {
            imagefilledellipse($img, $width + 11, $label_place + 5, 10, 10, colorHex($img, $colors[$i % count($colors)]));
            imageellipse($img, $width + 11, $label_place + 5, 10, 10, colorHex($img, $text_color));
        } else {
            if ($label_form == 'square' && $show_label) {
                imagefilledrectangle($img, $width + 6, $label_place, $width + 16, $label_place + 10, colorHex($img, $colors[$i % count($colors)]));
                imagerectangle($img, $width + 6, $label_place, $width + 16, $label_place + 10, colorHex($img, $text_color));
            }
        }
        if ($show_percent) {
            $label_output = $number[$i] . ' ';
        }
        if ($show_text) {
            $label_output = $label_output . $label[$i] . ' ';
        }
        if ($show_parts) {
            $label_output = $label_output . $data[$i];
        }
        //	imagestring($img,'2',$width+20,$label_place,$label_output,colorHex($img, $text_color));
        //require_once("../../mainfile.php");
        $path = "" . WEB_PATH . "";
        $font = "" . $path . "/modules/ajoxpoll/font/angsa.ttf";
        } else {
            if ($label_form == 'square' && $show_label) {
                imagefilledrectangle($img, $width + 6, $label_place, $width + 16, $label_place + 10, colorHex($img, $colors[$i % count($colors)]));
                imagerectangle($img, $width + 6, $label_place, $width + 16, $label_place + 10, colorHex($img, $text_color));
            }
        }
        if ($show_percent) {
            $label_output = $number[$i] . ' ';
        }
        if ($show_text) {
            $label_output = $label_output . $label[$i] . ' ';
        }
        if ($show_parts) {
            $label_output = $label_output . $data[$i];
        }
        imagestring($img, '2', $width + 20, $label_place, $label_output, colorHex($img, $text_color));
        $label_output = '';
        $label_place = $label_place + 15;
    }
}
$centerX = round($width / 2);
$centerY = round($height / 2);
$diameterX = $width - 4;
$diameterY = $height - 4;
$data_sum = array_sum($data);
$start = 270;
for ($i = 0; $i < count($data); $i++) {
    $value += $data[$i];
    $end = ceil($value / $data_sum * 360) + 270;
    $slice[] = array($start, $end, $shadow_color[$value_counter % count($shadow_color)], $fill_color[$value_counter % count($fill_color)]);
    $start = $end;