Jump to content

kopander

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling
  • Location
    Finland

kopander's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Find the "php.ini" config file (somewhere like /etc/httpd/php.ini). Then in that file, under Dynamic Extensions,  find the line ";extension=php_gd2.dll" and just uncomment it (i.e. remove the ";"). That should do the trick.
  2. Check out the tutorials on this site, might have some info that helps: gd library:[url=http://www.phpfreaks.com/tutorials/105/0.php] http://www.phpfreaks.com/tutorials/105/0.php[/url] jpgraph: [url=http://www.phpfreaks.com/tutorials/112/0.php]http://www.phpfreaks.com/tutorials/112/0.php[/url]
  3. Don't know if this is any help, but found a script which can be used to add text the the center of an image (i.e. watermark). Perhaps you could get some ideas from there how to get your code working. Im quite new to GD stuff myself so. The link is: [url=http://www.nuonce.net/code-library/1084673172.html]http://www.nuonce.net/code-library/1084673172.html[/url]
  4. Hi, new to this. Wondering if it is possible to enter figures from a mysql database into an array, which can be used on php functions? Example: so I have a function such as: [code]for ($i=0; $i<count($Values); $i++){ if ($Values[$i]>$max){$max=$Values[$i];} }[/code] Which gets the values from a fixed array: [code]$Values=array(120,190,130,155,150);[/code] Now i'm trying to get the data from a database. But the problem I cant figure out how to change everything so it uses the data from the database without changing the functions. I was wondering if there is a way to get the data from the database, and write it into an array so that it will be the same as a variable, i.e I get something like: [code]$Values=array(120,190,130,155,150,.......);[/code] which can be used by the current fuctions. Make any sense ???
  5. Hi I'm using php and gd library to plot integer points into a graph. I'm new to this and having some troubles. I'm trying to scale the graph according to how many records there are in the database table. There will be hundreds of records in the table. So far I only seem to be able to get it by just making the x-axis bigger and not scaling the entire graph. Any one have any ideas, directions I should look at? The code 'should' be attached below: [code] <?php include "db.php"; //Database connection $query=mysql_query("select KOL from small"); //Query database $num = mysql_num_rows ($query); // Number of records header ("Content-type: image/jpg"); $x_gap=$num-($num/3); // The gap between each point in y axis $x_max=$x_gap*(2+$num); // Maximum width of the graph or horizontal axis $y_max=250; // Maximum  hight of the graph or vertical axis $im = @ImageCreate ($x_max, $y_max); //Allocated Colours $background_color = ImageColorAllocate ($im, 234, 234, 234); $text_color = ImageColorAllocate ($im, 233, 14, 91); $graph_color = ImageColorAllocate ($im,25,25,25); //Set initial variables $x1=0; $y1=0;     while($nt=mysql_fetch_array($query)){         $x2=$x1+$x_gap; // Shifting in X axis         $y2=($y_max/2)-$nt[0]; // Coordinate of Y axis         //Draw the points         imagefilledellipse($im, $x2, $y2, 4, 4, $graph_color);         //Print values on graph         ImageString($im,2,$x2,$y2,$nt[0],$graph_color);         // Storing the value for next draw                $x1=$x2;         $y1=$y2;}         ImageJPEG ($im); ?> [/code] Also, is there any way to make the plotted points interactive? Is that possible? How would I go about making the points pressable, and have the records data displayed for example? Any help would be greatly appreciated. Thanks!
×
×
  • 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.