Location: PHPKode > scripts > DbGraph > dbgraph/class.piegraph.php
<html>
  <head>
    <title>Documentation: PieGraph</title>
    <style type="text/css">
    <!--
      body,td { font: 8pt verdana #000000; }
      body { background: #ffffff; }
      a { text-decoration: none; color: #0000aa; }
      a:hover { text-decoration: underline; }
      h1 { font-size: 12pt; letter-spacing: 2pt; }
      hr { height: 1px; color: #dddddd; background: #dddddd; }
      .varname { font-size: 10pt; letter-spacing: 2pt; color: #123456; font-weight: bold; }
      .funname { font-size: 10pt; letter-spacing: 2pt; color: #123456; font-weight: bold; }
      .vartype { color: #0000aa; font-weight: bold; }
    //-->
    </style>
  </head>
  <body>
    <a name='top'></a>
    <h1>Class: <b>PieGraph</b> (0.1)</h1>
    Class to create pie graphs.<br>
    Credits to: <a href='mailto:hide@address.com'>Jeph</a><br>
    <a name='var'></a>
    <br><u>Variables</u><br><br>
    <a href='#var_pie_bgcolor' title="Pie background color"><span class=vartype>array</span> PieGraph::pie_bgcolor</a><br>
    <a href='#var_pie_color' title="Pie color (&lt;var=pie_color&gt;, &lt;var=pie_bgcolor&gt; and &lt;var=pie_deepnesscolor&gt; can be arrays of arrays of red, green and blue colors, when drawing more than one pie chart)"><span class=vartype>array</span> PieGraph::pie_color</a><br>
    <a href='#var_pie_deepness' title="Pie deepness (z axis size)"><span class=vartype>int</span> PieGraph::pie_deepness</a><br>
    <a href='#var_pie_deepnesscolor' title="Pie deepness color"><span class=vartype>array</span> PieGraph::pie_deepnesscolor</a><br>
    <a href='#var_pie_startoffset' title="Offset is in degrees and the start is at coordenates (x=xmax,y=0) from the center of the pie"><span class=vartype>int</span> PieGraph::pie_startoffset</a><br>
    <a href='#var_pie_total' title="If this value is superior to the total values of all data, pie won't be complete
Try:
&lt;fun=SetPieData&gt;(array(&quot;x&quot; =&gt; 20));
&lt;fun=SetPieTotalValue&gt;(100);

Check the result ;)"><span class=vartype>int</span> PieGraph::pie_total</a><br>
    <a name='fun'></a>
    <br><u>Methods</u><br><br>
    <a href='#fun_AddPieBackgroundColor' title="Add one more pie background color (RGB)">PieGraph::AddPieBackgroundColor (
    $red
    , $green
    , $blue
    ) </a><br>
    <a href='#fun_AddPieColor' title="Add one more pie color (RGB)">PieGraph::AddPieColor (
    $red
    , $green
    , $blue
    ) </a><br>
    <a href='#fun_AddPieDeepnessColor' title="Add one more pie deepness color (RGB)">PieGraph::AddPieDeepnessColor (
    $red
    , $green
    , $blue
    ) </a><br>
    <a href='#fun_DrawGraph' title="Draw graph
If no file given, output will be stdout">PieGraph::DrawGraph (
    $file
    ) </a><br>
    <a href='#fun_SetPieBackgroundColor' title="Set pie background color (RGB)">PieGraph::SetPieBackgroundColor (
    $red
    , $green
    , $blue
    ) </a><br>
    <a href='#fun_SetPieColor' title="Set pie color (RGB)">PieGraph::SetPieColor (
    $red
    , $green
    , $blue
    ) </a><br>
    <a href='#fun_SetPieData' title="It's only a link to SetData() and sets pie charts name and value">PieGraph::SetPieData (
    $data
    ) </a><br>
    <a href='#fun_SetPieDeepnessColor' title="Set pie deepness color (RGB)">PieGraph::SetPieDeepnessColor (
    $red
    , $green
    , $blue
    ) </a><br>
    <a href='#fun_SetPieStartOffset' title="Set pie start offset (see &lt;var=pie_startoffset&gt;)">PieGraph::SetPieStartOffset (
    $offset
    ) </a><br>
    <a href='#fun_SetPieTotalValue' title="Set pie total value (see &lt;var=pie_total&gt;)">PieGraph::SetPieTotalValue (
    $total
    ) </a><br>
    <hr>
    <a name='var_pie_bgcolor'></a>
    <table border=0 cellpadding=0 cellspacing=0 width=100%>
      <tr>
        <td>
          <span class=varname>PieGraph::pie_bgcolor</span></a>
        </td>
        <td align=right>
          <a href='#top'>^ Top</a>
          | <a href='#var'>^ Variables</a>
          | <a href='#fun'>^ Methods</a>
        </td>
      </tr>
    </table>
    Pie background color<br><br>
    &nbsp; <b>Type:</b><br>
    &nbsp; &nbsp; &nbsp; &nbsp; Array(int, int, int)<br>
    <br>&nbsp; <b>Default:</b><br>
    &nbsp; &nbsp; &nbsp; &nbsp; Array(69, 129, 194)<br>
    <br>
    <hr>
    <a name='var_pie_color'></a>
    <table border=0 cellpadding=0 cellspacing=0 width=100%>
      <tr>
        <td>
          <span class=varname>PieGraph::pie_color</span></a>
        </td>
        <td align=right>
          <a href='#top'>^ Top</a>
          | <a href='#var'>^ Variables</a>
          | <a href='#fun'>^ Methods</a>
        </td>
      </tr>
    </table>
    Pie color (<a href='#var_pie_color'>pie_color</a>, <a href='#var_pie_bgcolor'>pie_bgcolor</a> and <a href='#var_pie_deepnesscolor'>pie_deepnesscolor</a> can be arrays of arrays of red, green and blue colors, when drawing more than one pie chart)<br><br>
    &nbsp; <b>Type:</b><br>
    &nbsp; &nbsp; &nbsp; &nbsp; Array(int, int, int)<br>
    <br>&nbsp; <b>Default:</b><br>
    &nbsp; &nbsp; &nbsp; &nbsp; Array(39, 78, 120)<br>
    <br>
    <hr>
    <a name='var_pie_deepness'></a>
    <table border=0 cellpadding=0 cellspacing=0 width=100%>
      <tr>
        <td>
          <span class=varname>PieGraph::pie_deepness</span></a>
        </td>
        <td align=right>
          <a href='#top'>^ Top</a>
          | <a href='#var'>^ Variables</a>
          | <a href='#fun'>^ Methods</a>
        </td>
      </tr>
    </table>
    Pie deepness (z axis size)<br><br>
    &nbsp; <b>Type:</b><br>
    &nbsp; &nbsp; &nbsp; &nbsp; int<br>
    <br>&nbsp; <b>Default:</b><br>
    &nbsp; &nbsp; &nbsp; &nbsp; 10<br>
    <br>
    <hr>
    <a name='var_pie_deepnesscolor'></a>
    <table border=0 cellpadding=0 cellspacing=0 width=100%>
      <tr>
        <td>
          <span class=varname>PieGraph::pie_deepnesscolor</span></a>
        </td>
        <td align=right>
          <a href='#top'>^ Top</a>
          | <a href='#var'>^ Variables</a>
          | <a href='#fun'>^ Methods</a>
        </td>
      </tr>
    </table>
    Pie deepness color<br><br>
    &nbsp; <b>Type:</b><br>
    &nbsp; &nbsp; &nbsp; &nbsp; Array(int, int, int)<br>
    <br>&nbsp; <b>Default:</b><br>
    &nbsp; &nbsp; &nbsp; &nbsp; Array(9, 48, 90)<br>
    <br>
    <hr>
    <a name='var_pie_startoffset'></a>
    <table border=0 cellpadding=0 cellspacing=0 width=100%>
      <tr>
        <td>
          <span class=varname>PieGraph::pie_startoffset</span></a>
        </td>
        <td align=right>
          <a href='#top'>^ Top</a>
          | <a href='#var'>^ Variables</a>
          | <a href='#fun'>^ Methods</a>
        </td>
      </tr>
    </table>
    Offset is in degrees and the start is at coordenates (x=xmax,y=0) from the center of the pie<br><br>
    &nbsp; <b>Type:</b><br>
    &nbsp; &nbsp; &nbsp; &nbsp; int<br>
    <br>&nbsp; <b>Default:</b><br>
    &nbsp; &nbsp; &nbsp; &nbsp; 0<br>
    <br>
    <hr>
    <a name='var_pie_total'></a>
    <table border=0 cellpadding=0 cellspacing=0 width=100%>
      <tr>
        <td>
          <span class=varname>PieGraph::pie_total</span></a>
        </td>
        <td align=right>
          <a href='#top'>^ Top</a>
          | <a href='#var'>^ Variables</a>
          | <a href='#fun'>^ Methods</a>
        </td>
      </tr>
    </table>
    If this value is superior to the total values of all data, pie won't be complete<br />
Try:<br />
<a href='#fun_SetPieData'>SetPieData</a>(array("x" => 20));<br />
<a href='#fun_SetPieTotalValue'>SetPieTotalValue</a>(100);<br />
<br />
Check the result ;)<br><br>
    &nbsp; <b>Type:</b><br>
    &nbsp; &nbsp; &nbsp; &nbsp; int<br>
    <br>&nbsp; <b>Default:</b><br>
    &nbsp; &nbsp; &nbsp; &nbsp; 0<br>
    <br>
    <hr><a name='fun_AddPieBackgroundColor'></a>
    <table border=0 cellpadding=0 cellspacing=0 width=100%>
      <tr>
        <td><span class=funname>PieGraph::AddPieBackgroundColor()</span></a></td>
        <td align=right>
          <a href='#top'>^ Top</a>
          | <a href='#var'>^ Variables</a>
          | <a href='#fun'>^ Methods</a>
        </td>
      </tr>
    </table>
    Add one more pie background color (RGB)<br><br>
    &nbsp; <b>Arguments:</b><br>
    &nbsp; &nbsp; &nbsp; &nbsp;
    ( <span class=vartype>int</span>
    )
    $red<br>
    &nbsp; &nbsp; &nbsp; &nbsp;
    ( <span class=vartype>int</span>
    )
    $green<br>
    &nbsp; &nbsp; &nbsp; &nbsp;
    ( <span class=vartype>int</span>
    )
    $blue<br>
    <br>
    <hr><a name='fun_AddPieColor'></a>
    <table border=0 cellpadding=0 cellspacing=0 width=100%>
      <tr>
        <td><span class=funname>PieGraph::AddPieColor()</span></a></td>
        <td align=right>
          <a href='#top'>^ Top</a>
          | <a href='#var'>^ Variables</a>
          | <a href='#fun'>^ Methods</a>
        </td>
      </tr>
    </table>
    Add one more pie color (RGB)<br><br>
    &nbsp; <b>Arguments:</b><br>
    &nbsp; &nbsp; &nbsp; &nbsp;
    ( <span class=vartype>int</span>
    )
    $red<br>
    &nbsp; &nbsp; &nbsp; &nbsp;
    ( <span class=vartype>int</span>
    )
    $green<br>
    &nbsp; &nbsp; &nbsp; &nbsp;
    ( <span class=vartype>int</span>
    )
    $blue<br>
    <br>
    <hr><a name='fun_AddPieDeepnessColor'></a>
    <table border=0 cellpadding=0 cellspacing=0 width=100%>
      <tr>
        <td><span class=funname>PieGraph::AddPieDeepnessColor()</span></a></td>
        <td align=right>
          <a href='#top'>^ Top</a>
          | <a href='#var'>^ Variables</a>
          | <a href='#fun'>^ Methods</a>
        </td>
      </tr>
    </table>
    Add one more pie deepness color (RGB)<br><br>
    &nbsp; <b>Arguments:</b><br>
    &nbsp; &nbsp; &nbsp; &nbsp;
    ( <span class=vartype>int</span>
    )
    $red<br>
    &nbsp; &nbsp; &nbsp; &nbsp;
    ( <span class=vartype>int</span>
    )
    $green<br>
    &nbsp; &nbsp; &nbsp; &nbsp;
    ( <span class=vartype>int</span>
    )
    $blue<br>
    <br>
    <hr><a name='fun_DrawGraph'></a>
    <table border=0 cellpadding=0 cellspacing=0 width=100%>
      <tr>
        <td><span class=funname>PieGraph::DrawGraph()</span></a></td>
        <td align=right>
          <a href='#top'>^ Top</a>
          | <a href='#var'>^ Variables</a>
          | <a href='#fun'>^ Methods</a>
        </td>
      </tr>
    </table>
    Draw graph<br />
If no file given, output will be stdout<br><br>
    &nbsp; <b>Arguments:</b><br>
    &nbsp; &nbsp; &nbsp; &nbsp;
    ( <span class=vartype>int</span>
    )
    $file<br>
    <br>&nbsp; <b>Default:</b><br>
    &nbsp; &nbsp; &nbsp; &nbsp;$file = ""<br>
    <br>
    <hr><a name='fun_SetPieBackgroundColor'></a>
    <table border=0 cellpadding=0 cellspacing=0 width=100%>
      <tr>
        <td><span class=funname>PieGraph::SetPieBackgroundColor()</span></a></td>
        <td align=right>
          <a href='#top'>^ Top</a>
          | <a href='#var'>^ Variables</a>
          | <a href='#fun'>^ Methods</a>
        </td>
      </tr>
    </table>
    Set pie background color (RGB)<br><br>
    &nbsp; <b>Arguments:</b><br>
    &nbsp; &nbsp; &nbsp; &nbsp;
    ( <span class=vartype>int</span>
    )
    $red<br>
    &nbsp; &nbsp; &nbsp; &nbsp;
    ( <span class=vartype>int</span>
    )
    $green<br>
    &nbsp; &nbsp; &nbsp; &nbsp;
    ( <span class=vartype>int</span>
    )
    $blue<br>
    <br>
    <hr><a name='fun_SetPieColor'></a>
    <table border=0 cellpadding=0 cellspacing=0 width=100%>
      <tr>
        <td><span class=funname>PieGraph::SetPieColor()</span></a></td>
        <td align=right>
          <a href='#top'>^ Top</a>
          | <a href='#var'>^ Variables</a>
          | <a href='#fun'>^ Methods</a>
        </td>
      </tr>
    </table>
    Set pie color (RGB)<br><br>
    &nbsp; <b>Arguments:</b><br>
    &nbsp; &nbsp; &nbsp; &nbsp;
    ( <span class=vartype>int</span>
    )
    $red<br>
    &nbsp; &nbsp; &nbsp; &nbsp;
    ( <span class=vartype>int</span>
    )
    $green<br>
    &nbsp; &nbsp; &nbsp; &nbsp;
    ( <span class=vartype>int</span>
    )
    $blue<br>
    <br>
    <hr><a name='fun_SetPieData'></a>
    <table border=0 cellpadding=0 cellspacing=0 width=100%>
      <tr>
        <td><span class=funname>PieGraph::SetPieData()</span></a></td>
        <td align=right>
          <a href='#top'>^ Top</a>
          | <a href='#var'>^ Variables</a>
          | <a href='#fun'>^ Methods</a>
        </td>
      </tr>
    </table>
    It's only a link to SetData() and sets pie charts name and value<br><br>
    &nbsp; <b>Arguments:</b><br>
    &nbsp; &nbsp; &nbsp; &nbsp;
    ( <span class=vartype>array</span>
    )
    $data<br>
    <br>
    <hr><a name='fun_SetPieDeepnessColor'></a>
    <table border=0 cellpadding=0 cellspacing=0 width=100%>
      <tr>
        <td><span class=funname>PieGraph::SetPieDeepnessColor()</span></a></td>
        <td align=right>
          <a href='#top'>^ Top</a>
          | <a href='#var'>^ Variables</a>
          | <a href='#fun'>^ Methods</a>
        </td>
      </tr>
    </table>
    Set pie deepness color (RGB)<br><br>
    &nbsp; <b>Arguments:</b><br>
    &nbsp; &nbsp; &nbsp; &nbsp;
    ( <span class=vartype>int</span>
    )
    $red<br>
    &nbsp; &nbsp; &nbsp; &nbsp;
    ( <span class=vartype>int</span>
    )
    $green<br>
    &nbsp; &nbsp; &nbsp; &nbsp;
    ( <span class=vartype>int</span>
    )
    $blue<br>
    <br>
    <hr><a name='fun_SetPieStartOffset'></a>
    <table border=0 cellpadding=0 cellspacing=0 width=100%>
      <tr>
        <td><span class=funname>PieGraph::SetPieStartOffset()</span></a></td>
        <td align=right>
          <a href='#top'>^ Top</a>
          | <a href='#var'>^ Variables</a>
          | <a href='#fun'>^ Methods</a>
        </td>
      </tr>
    </table>
    Set pie start offset (see <a href='#var_pie_startoffset'>pie_startoffset</a>)<br><br>
    &nbsp; <b>Arguments:</b><br>
    &nbsp; &nbsp; &nbsp; &nbsp;
    ( <span class=vartype>int</span>
    )
    $offset<br>
    <br>
    <hr><a name='fun_SetPieTotalValue'></a>
    <table border=0 cellpadding=0 cellspacing=0 width=100%>
      <tr>
        <td><span class=funname>PieGraph::SetPieTotalValue()</span></a></td>
        <td align=right>
          <a href='#top'>^ Top</a>
          | <a href='#var'>^ Variables</a>
          | <a href='#fun'>^ Methods</a>
        </td>
      </tr>
    </table>
    Set pie total value (see <a href='#var_pie_total'>pie_total</a>)<br><br>
    &nbsp; <b>Arguments:</b><br>
    &nbsp; &nbsp; &nbsp; &nbsp;
    ( <span class=vartype>int</span>
    )
    $total<br>
    <br>
  </body>
</html>
Return current item: DbGraph