Beispiel #1
3
 static function barGraph($data, $height = '', $width = '', $max = '', $is_percent = '')
 {
     $output = '';
     if (DevArray::isAssoc($data)) {
         if ($max == '') {
             $max = DevArray::max($data);
         }
         $output .= '<table width = "' . ($width > 0 ? $width : 200) . '" height = "' . ($height > 0 ? $height : 100) . '">';
         $output .= "\n";
         foreach ($data as $a => $b) {
             $output .= '<tr>';
             $output .= "<td>{$a}</td>" . ($hori ? '<tr>' : '<td>');
             $output .= '<td width="80%" class="dev_bar"><table width="100%" cellpadding="0" cellspacing="0" border="1" bgcolor="#ffffff"><tr><td width="' . DevNumber::ratio($b, $max, false) . '%" height="5" bgcolor="#c0c0c0"></td><td></td></tr></table></td>';
             $output .= "<td>" . ($is_percent ? DevNumber::ratio($b, $max, $is_percent) : $b) . "</td>";
             $output .= "</tr>";
         }
         $output .= "\n";
         $output .= '</table>';
     }
     return $output;
 }