JPGraph Part 1
I really like JPGraph now. For too long I hated it as a clunky, bloated rather useless graphing library (Sorry!), but now I like it. Really like it.
Over the next few months I'll be doing a series of articles on using JPGraph.
For now, heres my favourite feature at the moment.
Save the following code as make_image_led.php
require_once '_common_includes/jpgraph/jpgraph.php';
require_once '_common_includes/jpgraph/jpgraph_led.php';
$_GET['value'] = str_pad($_GET['value'],'6','0',STR_PAD_LEFT);
$led = new DigitalLED74();
$led->SetSupersampling(4);
$led->StrokeNumber($_GET['value'],LEDC_BLUE);
To generate an image, just call from another page;
echo '<img src="make_image_led?value='.$NUMBER.'" alt="image" />';
I pull the number from the database;
$count_1_rs = $conn->CacheExecute(180,'SELECT COUNT(id) AS id FROM SOME_TABLE;');
echo '<img src="http://bloke.org/wordpress/wp-admin/make_image_led?value=%27.$count_1_rs-%3Efields%5B%27id%27%5D.%27" alt="image" />';
Which generates one of the following;
Nice, huh?
Related posts
- Idiot Proof Lightbox
I've just made some modifications to my Gallery code which is part of i9000's small... - CAPTCHA Image Generation Part 2
A quick morning hack - I added some random lines to try and confuse the... - [Snippet] Simplified UK/US Date Conversion
One of my major annoyances in PHP & MySQL world is the different formats when... - [Snippet] Formatting an IMEI Number in PHP
Formatting an IMEI number in PHP is reasonably simple. The IMEI (14 decimal digits plus... - Retro Fitting Record Pagination with ADOdb
For my first project of the New Year I had to retro-fit pagination controls to...



