Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > trying to draw simple images/charts from web server

trying to draw simple images/charts from web server
Thread Tools
Zoom
Mac Elite
Join Date: Feb 2000
Location: RTP, NC
Status: Offline
Reply With Quote
Nov 16, 2009, 10:16 PM
 
I've got a web tool that I've written that helps my group debug things from our voluminous debug logs. I've done some nice HTML stuff, but I'd really like to draw some histograms and other simple images.

Most of my digging has led me to the GD libraries, which are not installed by default. If necessary, I'll do that, though it doesn't look fun.

Is there something simpler that I'm missing? Something that's already installed as part of Mac OS X Server (Snow Leopard)? I want to draw some straight lines of varying lengths and colors on an XY axis. Ideally, I'd like to have an imagemap, too, with tooltips and hot areas (clickable).

Thoughts?
Late 2012 27" iMac 3.4GHz Intel Core i7, 24GB RAM, 3TB Fusion drive
     
Warhaven
Dedicated MacNNer
Join Date: Jul 2002
Status: Offline
Reply With Quote
Nov 18, 2009, 05:29 PM
 
OS X Server comes with PHP and GD library module by default. You can do all your basic drawing needs in PHP. Like so:

Code:
<?php header ("Content-type: image/png"); $im = @imagecreatetruecolor(120, 20) or die("Cannot Initialize new GD image stream"); $line_color = imagecolorallocate($im, 233, 14, 91); imageline($im, 0, 0, 120, 20, $line_color); imagepng($im); imagedestroy($im); ?>
Plenty of samples online, and it's very extensive. olePigeon's Yahtzee sig, for example. I did that with OS X's (Leopard) bundled PHP. Generates random dice and calculates your Yahtzee score for that hand. Would be pretty straight forward to adapt it to generating charts or whatever.

(* Reload your browser window to get a new hand below: *)
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 02:54 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,