Rectangle
Overview
This example will run a progress meter (rectangle 6x4) filled in natural way.
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 16 cells 15x15 organized into polygonal shape (lines 16-23),
a basic rectangle 6x4 (line 25) :
Property | Value | Default |
active-color | red | #006600 |
inactive-color | orange | #CCCCCC |
width | 15 | 15 |
height | 15 | 20 |
spacing | | 2 |
See also :
And the progress percent text info is center aligned on bottom side (line 24):
Property | Value | Default |
left | 0 | 5 |
top | | 5 |
width | 90 | 50 |
height | | 0 |
align | center | right |
valign | bottom | right |
background-color | | |
font-size | | 11 |
font-family | | Verdana, Tahoma, Arial |
font-weight | | normal |
color | | #000000 |
class | | progressPercentLabel%s |
See also :
Source Code
<?php
/**
* Basic Rectangle progress meter.
*
* @version $Id: rectangle.php,v 1.4 2006/05/24 08:41:13 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_POLYGONAL);
$pb->setCellAttributes(array(
'width' => 15,
'height' => 15,
'active-color' => 'red',
'inactive-color' => 'orange',
)
);
$pb->setLabelAttributes('pct1', 'valign=bottom align=center width=90 left=0');
$pb->setCellCoordinates(6,4); // Rectangle 6x4
?>
<!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>Rectangle 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>