Php Tortendiagramm erstellen
Mit dem Code lassen sich ganz einfach Tortendiagramme erstellen.
Kommentar abgeben zu diesen Beitrag/Code ?Dann hier klicken
Der hier verwendete Code
<?php
$piece_values = array(70, 15, 10, 7);
$piece_names = array("MSIE", "Firefox", "Opera", "Safari");
$height = 580; $width = 600;
$height3d = 15;
$no_sort = false; // Sortierung an
function graph_colors($im) {
$colors["background"] = ImageColorAllocate($im, 255, 255, 255);
$colors["text"] = ImageColorAllocate($im, 0, 0, 0);
$colors[0] = ImageColorAllocate($im, 255, 80, 80);
$colors[1] = ImageColorAllocate($im, 254, 255, 80);
$colors[2] = ImageColorAllocate($im, 81, 80, 255);
$colors[3] = ImageColorAllocate($im, 255, 80, 254);
$colors[4] = ImageColorAllocate($im, 80, 255, 81);
$colors[5] = ImageColorAllocate($im, 80, 255, 255);
$colors_dark[0] = ImageColorAllocate($im, 155, 0, 0);
$colors_dark[1] = ImageColorAllocate($im, 154, 155, 0);
$colors_dark[2] = ImageColorAllocate($im, 0, 0, 155);
$colors_dark[3] = ImageColorAllocate($im, 155, 0, 154);
$colors_dark[4] = ImageColorAllocate($im, 0, 155, 0);
$colors_dark[5] = ImageColorAllocate($im, 0, 155, 155);
return array("colors" => $colors, "colors_dark" => $colors_dark);
}
function graph_pie_3d($piece = array(), $piece_text = array(), $height = 180, $width = 200, $height3d = 15, $no_sort = false) {
header("Content-type: image/png");
$im = ImageCreateTrueColor($width, $height);
$graph_colors = graph_colors($im);
$colors = $graph_colors["colors"];
$colors_dark = $graph_colors["colors_dark"];