Login   Register  
PHP Classes
elePHPant
Icontem

File: samples/sample4.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of David Frendin  >  TinyPie  >  samples/sample4.php  >  Download  
File: samples/sample4.php
Role: Example script
Content type: text/plain
Description: Sample of using TinyPie as a chart
Class: TinyPie
Generate pie charts as images embedded in HTML
Author: By
Last change: changed description
Date: 2 years ago
Size: 1,833 bytes
 

Contents

Class file image Download
<?php
include('../lib/TinyPie.php');
?>
<html>
<body>

<a href="index.php">&lt;&lt;&nbsp;Back to list</a>

<!--// 4. Demo usage sample as pie chart //-->
<fieldset>
    <legend>4. Demo usage sample as pie chart</legend>
    <table>
        <thead>
            <tr>
                <th colspan="2">
                    Remember the name, breakdown
                </th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>
<?php
$g 
= new TinyPie(128);
$g->AddValue(10'b96e17');
$g->AddValue(20'f7931e');
$g->AddValue(15'f9a94b');
$g->AddValue(5'fabe78');
$g->AddValue(50'fcd4a5');
echo 
$g->GetAsImg();
?>
                </td>
                <td valign="top">
                    <table>
                        <tr>
                            <td>
                                <div style="width: 16px; height: 16px; background: #b96e17; border: 1px solid #555555; display: block;"></div>
                            </td>
                            <td>
                                Luck, 10%
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div style="width: 16px; height: 16px; background: #f7931e; border: 1px solid #555555; display: block;"></div>
                            </td>
                            <td>
                                Skill, 20%
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div style="width: 16px; height: 16px; background: #f9a94b; border: 1px solid #555555; display: block;"></div>
                            </td>
                            <td>
                                Concentrated power of will, 15%
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div style="width: 16px; height: 16px; background: #fabe78; border: 1px solid #555555; display: block;"></div>
                            </td>
                            <td>
                                Pleasure, 5%
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div style="width: 16px; height: 16px; background: #fcd4a5; border: 1px solid #555555; display: block;"></div>
                            </td>
                            <td>
                                Pain, 50%
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </tbody>
    </table>
</fieldset>

</body>
</html>