| | |
pie Chart
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Oct 2007
Posts: 34
Reputation:
Solved Threads: 0
Hi i am trying to plot a pie chart from a poll, but i cannot seem to manage to get more than three colours to go into the chart, please note that i have 11 different items to plot in the pie chart
Attached please find the code
Attached please find the code
php Syntax (Toggle Plain Text)
<?php $slide = $one + $two + $three + $four + $five + $six + $seven + $eight + $nine + $ten; header('Content-type: image/png'); $handle = imagecreate(200, 200); $background = imagecolorallocate($handle, 255, 255, 255); $red = imagecolorallocate($handle, 255, 0, 0); $green = imagecolorallocate($handle, 0, 255, 0); $brown = imagecolorallocate($handle, 150, 0, 0); $blue = imagecolorallocate($handle, 0, 0, 255); $oth = imagecolorallocate($handle, 255, 255, 0); $oth1 = imagecolorallocate($handle, 0, 255, 255); $oth2 = imagecolorallocate($handle, 255, 0, 255); $oth3 = imagecolorallocate($handle, 160, 58, 58); $oth4 = imagecolorallocate($handle, 0, 0, 0); $oth5 = imagecolorallocate($handle, 0, 102, 0); $oth6 = imagecolorallocate($handle, 210, 100, 11); $darkred = imagecolorallocate($handle, 150, 0, 0); $darkblue = imagecolorallocate($handle, 0, 0, 150); $darkgreen = imagecolorallocate($handle, 0, 150, 0); // 3D look for ($i = 60; $i > 50; $i--) { imagefilledarc($handle, 50, $i, 100, 50, 0, $one, $darkred, IMG_ARC_PIE); imagefilledarc($handle, 50, $i, 100, 50, $one, $slide , $darkblue, IMG_ARC_PIE); imagefilledarc($handle, 50, $i, 100, 50, $slide, 360 , $darkgreen, IMG_ARC_PIE); } imagefilledarc($handle, 50, 50, 100, 50, 0, $one , $red, IMG_ARC_PIE); imagefilledarc($handle, 50, 50, 100, 50, $two, $slide , $blue, IMG_ARC_PIE); imagefilledarc($handle, 50, 50, 100, 50, $three, $slide , $green, IMG_ARC_PIE); imagefilledarc($handle, 50, 50, 100, 50, $four, $slide , $oth, IMG_ARC_PIE); imagefilledarc($handle, 50, 50, 100, 50, $five, $slide , $oth1, IMG_ARC_PIE); imagefilledarc($handle, 50, 50, 100, 50, $six, $slide , $oth2, IMG_ARC_PIE); imagefilledarc($handle, 50, 50, 100, 50, $seven, $slide , $oth3, IMG_ARC_PIE); imagefilledarc($handle, 50, 50, 100, 50, $eight, $slide , $oth4, IMG_ARC_PIE); imagefilledarc($handle, 50, 50, 100, 50, $nine, $slide , $oth5, IMG_ARC_PIE); imagefilledarc($handle, 50, 50, 100, 50, $ten, $slide , $oth6, IMG_ARC_PIE); imagefilledarc($handle, 50, 50, 100, 50, $one, $slide , $oth7, IMG_ARC_PIE); imagefilledarc($handle, 50, 50, 100, 50, $slide, 360 , $brown, IMG_ARC_PIE); imagepng($handle); ?>
Last edited by peter_budo; Nov 20th, 2008 at 1:00 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
![]() |
Similar Threads
- Word Association Game (Posting Games)
- Problems with pie chart (PHP)
- Is it possible to create a pie chart with JSP from the data of MySQL? (JSP)
- What Would You Pay? (Promotion and Marketing Plans)
- How to create own event handlers in ASP.net (C#)
- Creating Graphs (Java)
Other Threads in the PHP Forum
- Previous Thread: Calling an object within a class.
- Next Thread: sql count total calls
Views: 313 | Replies: 0
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery js limit link login loop mail mediawiki menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space speed sql stored structure subdomain syntax system table tutorial update updates upload url validation validator variable video web xml youtube





