|Last Updated||Ratings||Unique User Downloads||Download Rankings|
|2004-12-12 (15 years ago)||74%||Total: 6,343||All time: 333 This week: 336|
|powergraphic 1.0.0||Freely Distributable||Graphics|
PowerGraphic is a class meant for generating graphic charts of several types from a data set of values to be represented in the chart.
Draw graphs using PHP
PowerGraphic version 1.0 Author: Carlos Reche E-mail: firstname.lastname@example.org Sorocaba, SP - Brazil Created: Sep 20, 2004 Last Modification: Sep 20, 2004 Authors' comments: PowerGraphic creates 6 different types of graphics with how many parameters you want. You can change the appearance of the graphics in 3 different skins, and you can still cross data from 2 graphics in only 1! It's a powerful script, and I recommend you read all the instructions to learn how to use all of this features. Don't worry, it's very simple to use it. This script is free. Please keep the credits. INSTRUNCTIONS OF HOW TO USE THIS SCRIPT (Please, take a minute to read it. It's important!) NOTE: make sure that your PHP is compiled to work with GD Lib. NOTE: You may create test images using a form that comes with this script. Just add a "showform" as a query string. (Example: "graphic.php?showform") PowerGraphic works with query strings (information sent after the "?" of an URL). Here is an example of how you will have to send the graphic information. Let's suppose that you want to show a graphic of your user's sex: <img src="graphic.php?title=Sex&type=5&x1=male&y1=50&x2=female&y2=55" /> This will create a pie graphic (set by type=5) with title as "Sex" and default skin. Let's see the other parameters: x1 = male y1 = 50 (quantity of males) x2 = female y2 = 55 (quantity of females) See how it's simple! :) For those who don't know, to create a query string you have to put an "?" at the end of the URL and join the parameters with "&". Example: "graphic.php?Parameter_1=Value_1&Parameter_2=Value_2" (and so on). You can set how many parameters you want. The boring step would be to create this query string. Well, "would be", if I didn't create a function to do that. :) Let's see an example of how you can use this function in a PHP document: ///// START OF EXAMPLE ///// <?php require "class.graphics.php"; $PG = new PowerGraphic; $PG->title = "Sex"; $PG->type = "5"; $PG->x1 = "male"; $PG->y1 = "50"; $PG->x2 = "female"; $PG->y2 = "55"; echo '<img src="graphic.php?' . $PG->create_query_string() . '" />'; // If you're going to create more than 1 graphic, it'll be important to reset the values before // create the next query string: $PG->reset_values(); ?> ///// END OF EXAMPLE ///// Here is a list of all parameters you may set: title => Title of the graphic axis_x => Name of values from Axis X axis_y => Name of values from Axis Y graphic_1 => Name of Graphic_1 (only shown if you are gonna cross data from 2 different graphics) graphic_2 => Name of Graphic_2 (same comment from above) type => Type of graphic (values 1 to 6) 1 => Vertical bars (default) 2 => Horizontal bars 3 => Dots 4 => Lines 5 => Pie 6 => Donut skin => Skin of the graphic (values 1 to 3) 1 => Office (default) 2 => Matrix 3 => Spring credits => Only if you want to show my credits in the image. :) 0 => doesn't show (default) 1 => shows x => Name of the first parameter in Axis X x => Name of the second parameter in Axis X ... (etc) y => Value from "graphic_1" relative for "x" y => Value from "graphic_1" relative for "x" ... (etc) z => Value from "graphic_2" relative for "x" z => Value from "graphic_2" relative for "x" ... (etc) NOTE: You can't cross data between graphics if you use "pie" or "donut" graphic. Values for "z" won't be considerated. That's all! Hope you make a good use of it! It would be nice to receive feedback from others users. All comments are welcome! Regards, Carlos Reche
|Version Control||Unique User Downloads||Download Rankings|
|User Ratings||User Comments (6)|