示例#1
0
文件: piemaker.php 项目: loopzy/my
            $y1 = round($this->imageHeight / 2 + $this->imageHeight / 3 * sin(($angle + $angles[$x] / 2) * pi() / 180) / 4);
            ImageFill($image, $x1, $y1, $sliceColors[$x]);
            $angle = $angle + $angles[$x];
        }
        // put the desc strings
        ImageString($image, 5, $this->imageWidth / 2, 60, "Legend", $black);
        for ($x = 0; $x < $num; $x++) {
            $fl = sprintf("%.2f", $varValues[$x] * 100 / $total);
            $str = $varDesc[$x] . " (" . $fl . "%)";
            ImageString($image, 3, $this->imageWidth / 2, ($x + 5) * 20, $str, $sliceColors[$x]);
        }
        // put the title
        ImageString($image, 5, 20, 20, $this->title, $black);
        ImagePng($image);
        ImageDestroy($image);
    }
}
$pie = new Pie();
if (isset($width)) {
    $pie->imageWidth = $width;
}
if (isset($height)) {
    $pie->imageHeight = $height;
}
if (isset($title)) {
    $pie->title = $title;
}
$varDesc = explode(",", $desc);
$varValues = explode(",", $values);
$pie->create($varDesc, $varValues);