Ellipse 
Overview
This example will display a plain ellipse 360 degree.
Screenshot
Demonstration
Give it a try
Dependencies
This example requires mandatory resources :
And also but optional :
Explains step by step
The progress meter wait 200ms (line 14)
between each step of 10% (line 15).
There are 10 pictures segments (lines 16-24)
built (line 40) and re-used (lines 34-37):
| Property          | Value    | Default  | 
| active-color      | navy     | #006600  | 
| inactive-color    | red      | #CCCCCC  | 
| background-color  |     | #FFFFFF  | 
| width             | 200      | 15       | 
| height            | 100      | 20       | 
| spacing           | 0        | 2        | 
See also :
And the progress percent text info is right aligned on right side (line 25):
| Property          | Value   | Default  | 
| left      |    | 5       | 
| top       | 35      | 5       | 
| width     | 100     | 50      | 
| height    |    | 0       | 
| align     |    | right   | 
| valign    |    | right   | 
| background-color  |   |    | 
| font-size         | 20     | 11      | 
| font-family       |   | Verdana, Tahoma, Arial  | 
| font-weight       |   | normal  | 
| color             |   | #000000 | 
| class             |   | progressPercentLabel%s  | 
See also :
Source Code
<?php
 
/**
 
 * Draw a plain Ellipse progress meter.
 
 *
 
 * @version    $Id: ellipse.php,v 1.4 2006/05/24 08:47:45 farell Exp $
 
 * @author     Laurent Laville <pear@laurent-laville.org>
 
 * @package    HTML_Progress2
 
 * @subpackage Examples
 
 * @access     public
 
 */
 
require_once 'HTML/Progress2.php';
 
 
 
$pb = new HTML_Progress2();
 
$pb->setAnimSpeed(200);
 
$pb->setIncrement(10);
 
$pb->setOrientation(HTML_PROGRESS2_CIRCLE);
 
$pb->setCellAttributes(array(
 
    'width' => 200,
 
    'height' => 100,
 
    'spacing' => 0,
 
    'inactive-color' => 'red',
 
    'active-color' => 'navy'
 
    )
 
);
 
$pb->setLabelAttributes('pct1', 'font-size=20 width=100 top=35');
 
$fileMask = 'e%s.png';
 
$cacheDir = 'cache/';
 
 
 
if (!is_dir($cacheDir)) {
 
    die("Directory <b>$cacheDir</b> does not exists");
 
}
 
if (file_exists($cacheDir . 'e0.png')) {
 
    // uses cached pictures rather than create it again
 
    foreach (range(0,10) as $index) {
 
        $file = sprintf($cacheDir . $fileMask, $index);
 
        $pb->setCellAttributes(array('background-image' => $file), $index);
 
    }
 
} else {
 
    // creates ellipse segments pictures only once
 
    $pb->drawCircleSegments($cacheDir, $fileMask);
 
}
 
?>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 
    "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 
<head>
 
<title>Ellipse Progress2 example</title>
 
<style type="text/css">
 
<!--
 
<?php echo $pb->getStyle(); ?>
 
 
 
body {
 
    background-color: #FFFFFF;
 
}
 
 -->
 
</style>
 
<?php echo $pb->getScript(false); ?>
 
</head>
 
<body>
 
 
 
<?php
 
$pb->display();
 
$pb->run();
 
?>
 
 
 
</body>
 
</html>