CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 JPGraph

Print topic Send  topic

Author Message
Vince
Posted: 04/02/2002, 6:29 AM

Does anybody have any experience with this PHP class to create Graphs on the fly? I am trying to populate the JPGraph arrays with data coming from a MySQL database but have not been successful so far. Anybody got a working example to share?
Thanks!

Vince
www.adenin.nl
Posted: 04/02/2002, 6:53 AM

no experience, but visit also www.hanengcharts.com maybe great to work with?
Steve
Posted: 04/02/2002, 7:21 AM

I have been messing with it a bit, but have not had too much luck. I habve also been playing with phplot, which seems to be a bit more tweakable when it comes to CodeCharge.

http://sourceforge.net/projects/phplot/
Mel
Posted: 04/02/2002, 9:11 PM

I am doing just what you are trying to do. I had to add some additional packages to my web server and recompile PHP several times before I got it to run. The PHP compile options are rather poorly documented. You need to have GD support included - check with
<?
phpinfo():
?>

Mel
Posted: 04/02/2002, 9:17 PM

Here's the code I use:

$new=mysql_query("SELECT COUNT(*) FROM opportunity WHERE opportunity.opportunity_stage='Qualification'");
$qualification=mysql_result($new,0);
/* The number of qualified opportunities at the moment is $qualification */

$new=mysql_query("SELECT COUNT(*) FROM opportunity WHERE opportunity.opportunity_stage='Proposal Development' OR opportunity.opportunity_stage='Proposal Delivered'");
$proposal=mysql_result($new,0);
/* The number of ongoing proposals at the moment is $proposal */

$new=mysql_query("SELECT COUNT(*) FROM opportunity WHERE opportunity.opportunity_stage LIKE '%Contract D%'");
$contract=mysql_result($new,0);
/* The number of pending contracts at the moment is $contract */

$data = array($qualification,$proposal,$contract);
$graph = new PieGraph(320,250);
$graph->title->Set("Current Opportunity Status Summary");
$graph->title->SetFont(FF_VERDANA,FS_NORMAL,12);
$graph->legend->SetFont(FF_VERDANA,FS_NORMAL,8);
$graph->SetFrame("0");
$p1 = new PiePlot($data);
$p1->SetTheme("pastel");
$p1->SetCenter(0.25,0.5);
$p1->SetSize(0.25);
$p1->SetLegends(array("Qualified ($qualification)","Proposed ($proposal)","Contract Negotiations ($contract)"));
$graph->Add($p1);
$graph->Stroke();

Creates a simple pie chart. Good Luck!!

Mel
Vince
Posted: 04/03/2002, 12:10 AM

Mel,
This seems to be the kind of code that I am looking for indeed! Have you incorporated this with CodeCharge? In which event? Where do you put the database connection parameters?
Thank you!

Vince
Mel
Posted: 04/04/2002, 7:51 AM

I built this with a text editor. I just discovered CodeCharge and have been playing around with the trial copy for about 30 minutes total. Instead of filling up posting space, let's go off-line and we can post the final solution in CC
mel@radiofreemel.com

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.