Jump to content

Recommended Posts

Can I assume you already now how to generate the data, just need to turn that into something graphical? There are several options out there:

 

http://www.fusioncharts.com/ - Stylish, but not free, Flash based frontend

http://www.maani.us/xml_charts/ - Also Stylish, has a free version, Flash based frontend

http://www.aditus.nu/jpgraph/ - Crude looking, but all free, uses GD to make image

http://code.google.com/apis/chart/ - Pretty slick, you just create a URL and Google makes the image for you

Link to comment
https://forums.phpfreaks.com/topic/133495-report-generating/#findComment-694308
Share on other sites

All of ones with the Flash front end, don't require you to know any Flash. They generate the chart based on an XML file (which can be static or dynamically generated with PHP).

 

Read the Documentation for each and check out their examples for what the final data looks like.

Link to comment
https://forums.phpfreaks.com/topic/133495-report-generating/#findComment-694315
Share on other sites

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 16 bytes)

 

for($c=0; $c<count($children); $c++){ number 26 related error <<<<<<<<<,,,

 

 

why dosent it work please got it to work once then bang gone...........

 

 

this is a graph out off css to show number off children........

 

 



<?php
/*


Show number of blocks per child.

1 = 1
2 = 18
3 = 38
4 = 58
5 = 78
6 = 98
7 = 118
8 = 138
9 = 158
10 = 178

*/


$children=array("1","2");

$num=count($children);

for($c=0; $c<count($children); $c++){

switch($children[$c]){

case "1":

$children[]="1";

break;

case "2":

$children[]="18";

break;

case "3";

$children[]="38";

break;

case "4";

$children[]="58";

break;


case "5";

$children[]="78";

break;

case "6";

$children[]="98";

break;

case "7";

$children[]="118";

break;

case "8";

$children[]="138";

break;

case "9";

$children[]="158";

break;

case "10";

$children[]="178";

break;

}
}

for($f=$num; $f<$c; $f++,$children++){

echo"<br><br><div style='height: 10px; width:{$children[$f]}px; padding: 10px; background: URL(2tone.gif) repeat'></div><br><br>";

}
?>

Link to comment
https://forums.phpfreaks.com/topic/133495-report-generating/#findComment-694416
Share on other sites

 

the only way a function lol...

 


<?php
/*


Show number of blocks per child.

1 = 1
2 = 18
3 = 38
4 = 58
5 = 78
6 = 98
7 = 118
8 = 138
9 = 158
10 = 178

*/

function pie($children){

switch($children){

case "1":

$children="1";

break;

case "2":

$children="18";

break;

case "3";

$children="38";

break;

case "4";

$children="58";

break;


case "5";

$children="78";

break;

case "6";

$children="98";

break;

case "7";

$children="118";

break;

case "8";

$children="138";

break;

case "9";

$children="158";

break;

case "10";

$children="178";

break;

}


echo"<br><br><div style='height: 10px; width:{$children}px; padding: 10px; background: URL(2tone.gif) repeat'></div><br><br>";

}



echo pie('5',$children);

Link to comment
https://forums.phpfreaks.com/topic/133495-report-generating/#findComment-694433
Share on other sites

why is the 1st result not showing the name off the person on top off array 0

 

 

see the result your self

http://simpleforum.ath.cx/pie.php

 

WHY THE ECHOED FORMAT WRONG OF THE RESULT, IT NOT ON TOP WHY?

 

 

The function........

<?php
$family=array("john"=>"3","paul"=>"10","bob"=>"9","henry"=>"1","clair"=>"2","linda"=>"6");

foreach($family as $key => $val){

echo "$key has $val children ".pie($val,$children)." ";

}
?>

 

 

full code

 


<?php
/*


Show number of blocks per child.

1 = 1
2 = 18
3 = 38
4 = 58
5 = 78
6 = 98
7 = 118
8 = 138
9 = 158
10 = 178

*/

function pie($children){

switch($children){

case "1":

$children="1";

break;

case "2":

$children="18";

break;

case "3";

$children="38";

break;

case "4";

$children="58";

break;


case "5";

$children="78";

break;

case "6";

$children="98";

break;

case "7";

$children="118";

break;

case "8";

$children="138";

break;

case "9";

$children="158";

break;

case "10";

$children="178";

break;

}


echo"<div style='height: 10px; width:{$children}px; padding: 10px; background: URL(2tone.gif) repeat'></div><br>";

}


$family=array("john"=>"3","paul"=>"10","kevin"=>"7");

foreach($family as $key => $val){

echo "$key ".pie($val,$children)." ";



}


?>

Link to comment
https://forums.phpfreaks.com/topic/133495-report-generating/#findComment-694453
Share on other sites

if i had my way, it would be like this:

 

<?php
  $family = array(
    'john'  => 3,
    'paul'  => 10,
    'kevin' => 7,
  );
  foreach($family as $name => $num){
    $width = ($num > 1) ? (($num-1)*20)-2 : 1;
    echo "{$name}<div style='height: 10px; width:{$width}px; padding: 10px; background: URL(2tone.gif) repeat'></div><br>";
  }
?>

Link to comment
https://forums.phpfreaks.com/topic/133495-report-generating/#findComment-694522
Share on other sites

your way good so what all this mean

 

  $width = ($num > 1) ? (($num-1)*20)-2 : 1;

 

exsplain it confused me

 

If $num is greater than one, then subtract 1 from $num then times that by 20 then subtract 2 from that.

If $num is less than one set $num to one.

 

So lets say $num is 10

10 - 1 is 9 times that by 20 is 180

then subtract 2 is 178

 

So the width would be set to 178 pixels. This I am assuming would make sure that the name can fit inside the div without being cut off. And if there was no name it would be set to 1 so the div wouldn't really be visible....at least that is how I interpret it.

 

Link to comment
https://forums.phpfreaks.com/topic/133495-report-generating/#findComment-694534
Share on other sites

the quistion is why issint the correct names on the correct line......

I know that my maths wasn't answering your question.... I was just getting fed up with seeing the size of your switch statement when the logic it executed could be simplified to a simple mathematical formula.

 

your maths didnt work mate....

So what was wrong with the mathematics.... other than the fact that I left an else in the if statement?

 

 

Link to comment
https://forums.phpfreaks.com/topic/133495-report-generating/#findComment-694537
Share on other sites

the quistion is why issint the correct names on the correct line......

I know that my maths wasn't answering your question.... I was just getting fed up with seeing the size of your switch statement when the logic it executed could be simplified to a simple mathematical formula.

 

My apologies for trying to simplify your code.

 

your maths didnt work mate....

So what was wrong with the mathematics.... other than the fact that I left an else in the if statement?

Link to comment
https://forums.phpfreaks.com/topic/133495-report-generating/#findComment-694540
Share on other sites

no sorry ur write im always wrong sorry.............

 

i just dont no how to think like a programmer my common sence sucks sorry mate

 

didnt even think off maths logic to solve this.......

 

not even my post i suppose it all wrong but i like to try to understand it..........

Link to comment
https://forums.phpfreaks.com/topic/133495-report-generating/#findComment-694546
Share on other sites

look at google chart amazing and free

 

<img src="http://chart.apis.google.com/chart?

chs=250x100

&chd=t:60,40

&cht=p3

&chl=Hello|World"

alt="Sample chart" />

 

google tacken over everthink even programming stratargys man it sick............

 

wonder why copy past exsperts get good money.......

Link to comment
https://forums.phpfreaks.com/topic/133495-report-generating/#findComment-694562
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.