TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 12-07-2008, 01:51 AM   #1 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default Pie chart w/ Anti-Aliasing

Since I'm kinda crud at math, how should I make a pie chart with Anti Aliasing, and by math I mean looping through each pixel to make the circular shape of a slice of pie, or so so.
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 12-07-2008, 02:38 AM   #2 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

Our resident GD guru, Rendair -- who I haven't seen in a while and miss dearly, wrote an article on pie charts with the GD library. Hopefully he'll make a return to TalkPHP and tell us all how to make it anti-aliased!
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 12-07-2008, 09:02 AM   #3 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Quote:
Originally Posted by Wildhoney View Post
Our resident GD guru, Rendair -- who I haven't seen in a while and miss dearly, wrote an article on pie charts with the GD library. Hopefully he'll make a return to TalkPHP and tell us all how to make it anti-aliased!
The problem with your post is, that is a tutorial on bar charts. ;P
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 12-07-2008, 04:06 PM   #4 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

You're right. Sorry about that, it was a bit late when I posted.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 12-07-2008, 06:58 PM   #5 (permalink)
The Wanderer
 
c-through's Avatar
 
Join Date: Nov 2008
Posts: 13
Thanks: 0
c-through is on a distinguished road
Default

There is a way using the Google chart API and I found a nice tut on it to
Creating a three dimensional pie chart using Google's Chart API
But since we want to make the chart on our own here is what I would suggest to do something like that:

PHP Code:
header('Content-type: image/png');
$handle imagecreate(200,200);
$background=imagecolorallocate($handle,000,000,000);
$red=imagecolorallocate($handle,255,0,0);
$green=imagecolorallocate($handle,0,255,0);
$blue=imagecolorallocate($handle,0,0,255);
imagefilledarc($handle,100,100,200,200,0,90,$greenIMG_ARC_PIE);
imagefilledarc($handle,100,100,200,200,90,240,$redIMG_ARC_PIE);
imagefilledarc($handle,100,100,200,200,240,360,$blueIMG_ARC_PIE);
imagepng($handle); 
Just saw you are looking for an antialiasing solution...
Ok forget the script on top, one way would be supersampling, but creating a aa image from scratch Don't have an good solution in my mind (Having a serious hangover, and need some sleep). But I do have a script from someone else creating antialiased arcs as far as I remember. Maybe you can use it?!

http://pastebin.com/m6fdecadf

And now I take some Panado and go sleep...
__________________
Hello World!

Last edited by c-through : 12-07-2008 at 07:19 PM.
c-through is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Google's Chart API bdm Libraries & Extensions 14 06-01-2011 05:25 AM
Bar Chart in PHP Rendair Advanced PHP Programming 22 05-12-2010 07:22 AM
Line Chart in PHP Rendair Advanced PHP Programming 3 08-28-2009 08:17 AM
Google chart extended data encoding help Karl Advanced PHP Programming 3 12-14-2007 06:39 PM
Creating a three dimensional pie chart using Google's Chart API maZtah General 4 12-14-2007 12:13 PM


All times are GMT. The time now is 09:31 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design