function _AdvisingScreen::draw_pie_chart_box
Search API
4.x _AdvisingScreen.php | _AdvisingScreen::draw_pie_chart_box($title, $top_value, $bottom_value, $pal) |
5.x _AdvisingScreen.php | _AdvisingScreen::draw_pie_chart_box($title, $top_value, $bottom_value, $pal = "", $back_col = "", $fore_col = "", $extra = "") |
This function is used to draw an individual pie chart box. It accepts values of top/bottom in order to come up with a percentage.
Parameters
string $title:
float $top_value:
- The top part of a ratio. Ex: for 1/2, $top_value = 1.
float $bottom_value:
- The bottom part of a ratio. For 1/2, $bottom_value = 2.
- Do not let this equal zero. If it does, the calculation for the pie chart will never be evaluated.
string $pal:
- Which palette to use for the pie chart.
- Acceptable values:
- core
- major
- cumulative
- student
Return value
string
1 call to _AdvisingScreen::draw_pie_chart_box()
- _AdvisingScreen::draw_progress_boxes in classes/
_AdvisingScreen.php - This function calls drawPieChart to construct the student's 3 progress pie charts.
File
- classes/
_AdvisingScreen.php, line 1314
Class
Code
function draw_pie_chart_box($title, $top_value, $bottom_value, $pal)
{
$pC = "";
if ($bottom_value > 0)
{
$val = round(($top_value / $bottom_value) * 100);
}
if ($val > 100) {
$val = 99;
}
$leftval = 100 - $val;
$back_col = "660000";
$fore_col = "FFCC33";
if ($pal == "major")
{
$fore_col = "93D18B";
}
if ($pal == "cumulative")
{
$fore_col = "5B63A5";
}
$vval = $val;
if ($vval < 1) {
$vval = 1;
}
// Create a graph using google's chart API
$google_chart_url = "https://chart.googleapis.com/chart?cht=p&chd=t:$vval,$leftval&chs=75x75&chco=$fore_col|$back_col&chp=91.1";
$pC .= "<table border='0' width='100%' height='100' class='elevenpt blueBorder' cellpadding='0' cellspacing='0' >
<tr>
<td class='blueTitle' align='center' height='20'>
" . fp_render_square_line($title) . "
</td>
</tr>
<tr>
<td>
<table border='0'>
<td>
<!-- <img src='jgraph/display_graph.php?pal=$pal&value=$val'> -->
<img src='$google_chart_url'>
</td>
<td class='elevenpt'>
<span style='color: blue;'>$val% " . t("Complete") . "</span><br>
( <span style='color: blue;'>$top_value</span>
/ <span style='color: gray;'>$bottom_value " . t("hours") . "</span> )
";
$pC .= "
</td>
</table>
</td>
</tr>
</table>
";
return $pC;
}