[advanced search]
Results from the most recent live auction are here.
22 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Programming > CODE
User Name
Password

Old 10-17-2006, 09:59 AM   · #1
Barrucadu
Formally Mikor.
 
Barrucadu's Avatar
 
Name: Michael Walker
Location: East Yorkshire, England
Trader Rating: (7)
Join Date: Aug 2005
Posts: 2,438
NP$: 95.25 (Donate)
Barrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to behold
Graphs with PHP

This may be simple but it took me a while to figure out, you will need a 1x1 png image for your graph's background

PHP Code:
//Sample Graph
$graph[0] = 5;
$graph[1] = 8;
$graph[2] = 1;
$graph[3] = 52;

//How much to scale the graph up (use a decimal to scale down)
$scale = 2;

//Code Starts Here
echo '<span style="font-family:\'Courier New\', Courier;">';
    
$i=1;
foreach(
$graph as $point){
     
$point = $point * $scale;
     if(
$i < count($graph)){
          echo
'<img style="border-top:1px solid #000000;border-left:1px solid #000000;border-bottom:1px solid #000000;" src="graph.png" height="'.$point.'" width="40px"/>';
     }else{
          echo
'<img style="border:1px solid #000000;" src="graph.png" height="'.$point.'" width="40px"/>';
     }
}
    
echo
'<br/>';
    
foreach(
$graph as $point){
     if(
$point <= 9){
          echo
$point.'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
     }elseif(
$point <= 99){
          echo
$day['income'].'&nbsp;&nbsp;&nbsp;&nbsp;';
     }elseif(
$day['income'] <= 999){
          echo
$day['income'].'&nbsp;&nbsp;&nbsp;';
     }
}
echo
'</span>';


Please register or log-in into NamePros to hide ads
__________________
Me | Blog | Last.fm | F@h

archlinux User
Barrucadu is offline   Reply With Quote
Old 10-17-2006, 10:24 AM   · #2
-Ray-
TheyMix.com
 
-Ray-'s Avatar
 
Name: Ray
Location: Pennsylvania
Trader Rating: (20)
Join Date: Jun 2005
Posts: 1,502
NP$: 429.25 (Donate)
-Ray- is a splendid one to behold-Ray- is a splendid one to behold-Ray- is a splendid one to behold-Ray- is a splendid one to behold-Ray- is a splendid one to behold-Ray- is a splendid one to behold-Ray- is a splendid one to behold
nice little script mate....

THis would make an excellent include for a ipn script im writing....

rep +
-Ray- is online now   Reply With Quote
Old 10-17-2006, 12:05 PM   · #3
Barrucadu
Formally Mikor.
 
Barrucadu's Avatar
 
Name: Michael Walker
Location: East Yorkshire, England
Trader Rating: (7)
Join Date: Aug 2005
Posts: 2,438
NP$: 95.25 (Donate)
Barrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to behold
Originally Posted by templaterave
nice little script mate....

THis would make an excellent include for a ipn script im writing....

rep +



Thanks, i'm using it to record money i've made/spent at NP.

http://mikor.clearlyhosted.org/dac/graph.png
__________________
Me | Blog | Last.fm | F@h

archlinux User
Barrucadu is offline   Reply With Quote
Old 10-17-2006, 12:27 PM   · #4
TwistMyArm
NamePros Member
 
Trader Rating: (0)
Join Date: May 2006
Posts: 157
NP$: 81.00 (Donate)
TwistMyArm is on a distinguished road
Not to take anything away from you Mikor, but for those who need something a little stronger and don't know about it, there's also the dual-licenced JPGraph library which does all sorts of graphs pretty nicely.
TwistMyArm is offline   Reply With Quote
Old 10-17-2006, 12:28 PM   · #5
Barrucadu
Formally Mikor.
 
Barrucadu's Avatar
 
Name: Michael Walker
Location: East Yorkshire, England
Trader Rating: (7)
Join Date: Aug 2005
Posts: 2,438
NP$: 95.25 (Donate)
Barrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to behold
Originally Posted by TwistMyArm
Not to take anything away from you Mikor, but for those who need something a little stronger and don't know about it, there's also the dual-licenced JPGraph library which does all sorts of graphs pretty nicely.



There is? Damn, i've wasted a few hours, lol
__________________
Me | Blog | Last.fm | F@h

archlinux User
Barrucadu is offline   Reply With Quote
Old 10-17-2006, 12:43 PM   · #6
TwistMyArm
NamePros Member
 
Trader Rating: (0)
Join Date: May 2006
Posts: 157
NP$: 81.00 (Donate)
TwistMyArm is on a distinguished road
So long as you learnt something along the way, you didn't waste any time!

JPGraph is really good: admittedly, it doesn't build the graph straight in to the HTML as yours seems to, but it does do awesome graphs into various file formats. Trust me, it's worth the time to learn!
TwistMyArm is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

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 Off
HTML code is Off
Forum Jump


Site Sponsors
Build your NameBrand http://www.mobisitetrader.com/ Hunting Moon
Advertise your business at NamePros
All times are GMT -7. The time now is 01:00 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0