values = array(234, 125, 289, 147, 190); echo $graph->create(); Returns HTML code ====================================================================================================== */ class BAR_GRAPH { //---------------------------------------------------------------------------------------------------- // Configuration //---------------------------------------------------------------------------------------------------- var $type = 'hBar'; // graph type: "hBar", "vBar", "pBar", or "fader" var $values; // graph data: array or string with comma-separated values var $graphBGColor = ''; // graph background color: string var $graphBorder = ''; // graph border: string (CSS specification; doesn't work with NN4) var $graphPadding = 0; // graph padding: integer (pixels) var $titles; // titles: array or string with comma-separated values var $titleColor = 'black'; // title font color: string var $titleBGColor = '#C0E0FF'; // title background color: string var $titleBorder = '2px groove white'; // title border: string (CSS specification) var $titleFont = 'Arial, Helvetica'; // title font family: string (CSS specification) var $titleSize = 12; // title font size: integer (pixels) var $titleAlign = 'center'; // title text align: "left", "center", or "right" var $titlePadding = 2; // title padding: integer (pixels) var $labels; // label names: array or string with comma-separated values var $labelColor = 'black'; // label font color: string var $labelBGColor = '#C0E0FF'; // label background color: string var $labelBorder = '2px groove white'; // label border: string (CSS specification; doesn't work with NN4) var $labelFont = 'Arial, Helvetica'; // label font family: string (CSS specification) var $labelSize = 12; // label font size: integer (pixels) var $labelAlign = 'center'; // label text align: "left", "center", or "right" var $labelSpace = 0; // additional space between labels: integer (pixels) var $barWidth = 20; // bar width: integer (pixels) var $barLength = 1.0; // bar length ratio: float (from 0.1 to 2.9) var $barColors; // bar colors OR bar images: array or string with comma-separated values var $barBGColor; // bar background color: string var $barBorder = '2px outset white'; // bar border: string (CSS specification; doesn't work with NN4) var $barLevelColors; // bar level colors: ascending array (bLevel, bColor[,...]); draw bars >= bLevel with bColor var $showValues = 0; // show values: 0 = % only, 1 = abs. and %, 2 = abs. only, 3 = none var $absValuesColor = 'black'; // abs. values font color: string var $absValuesBGColor = '#C0E0FF'; // abs. values background color: string var $absValuesBorder = '2px groove white'; // abs. values border: string (CSS specification; doesn't work with NN4) var $absValuesFont = 'Arial, Helvetica'; // abs. values font family: string (CSS specification) var $absValuesSize = 12; // abs. values font size: integer (pixels) var $absValuesPrefix = ''; // abs. values prefix: string (e.g. "$") var $absValuesSuffix = ''; // abs. values suffix: string (e.g. " kg") var $percValuesColor = 'black'; // perc. values font color: string var $percValuesFont = 'Arial, Helvetica'; // perc. values font family: string (CSS specification) var $percValuesSize = 12; // perc. values font size: integer (pixels) var $percValuesDecimals = 0; // perc. values number of decimals: integer var $charts = 1; // number of charts: integer // hBar/vBar only: var $legend; // legend items: array or string with comma-separated values var $legendColor = 'black'; // legend font color: string var $legendBGColor = '#F0F0F0'; // legend background color: string var $legendBorder = '2px groove white'; // legend border: string (CSS specification; doesn't work with NN4) var $legendFont = 'Arial, Helvetica'; // legend font family: string (CSS specification) var $legendSize = 12; // legend font size: integer (pixels) // debug mode: false = off, true = on; just shows some extra information var $debug = false; // default bar colors; only used if $barColors isn't set var $colors = array('#0000FF', '#FF0000', '#00E000', '#A0A0FF', '#FFA0A0', '#00A000'); // error messages var $err_type = 'ERROR: Type must be "hBar", "vBar", "pBar", or "fader"'; // CSS names (don't change) var $cssGRAPH = ''; var $cssBAR = ''; var $cssBARBG = ''; var $cssTITLE = ''; var $cssLABEL = ''; var $cssLABELBG = ''; var $cssLEGEND = ''; var $cssLEGENDBG = ''; var $cssABSVALUES = ''; var $cssPERCVALUES = ''; //---------------------------------------------------------------------------------------------------- // Class Methods //---------------------------------------------------------------------------------------------------- function BAR_GRAPH($type = '') { if($type) $this->type = $type; } function set_styles() { if($this->graphBGColor) $this->cssGRAPH .= 'background-color:' . $this->graphBGColor . ';'; if($this->graphBorder) $this->cssGRAPH .= 'border:' . $this->graphBorder . ';'; if($this->barBorder) $this->cssBAR .= 'border:' . $this->barBorder . ';'; if($this->barBGColor) $this->cssBARBG .= 'background-color:' . $this->barBGColor . ';'; if($this->titleColor) $this->cssTITLE .= 'color:' . $this->titleColor . ';'; if($this->titleBGColor) $this->cssTITLE .= 'background-color:' . $this->titleBGColor . ';'; if($this->titleBorder) $this->cssTITLE .= 'border:' . $this->titleBorder . ';'; if($this->titleFont) $this->cssTITLE .= 'font-family:' . $this->titleFont . ';'; if($this->titleAlign) $this->cssTITLE .= 'text-align:' . $this->titleAlign . ';'; if($this->titleSize) $this->cssTITLE .= 'font-size:' . $this->titleSize . 'px;'; if($this->titleBGColor) $this->cssTITLE .= 'background-color:' . $this->titleBGColor . ';'; if($this->titlePadding) $this->cssTITLE .= 'padding:' . $this->titlePadding . 'px;'; if($this->labelColor) $this->cssLABEL .= 'color:' . $this->labelColor . ';'; if($this->labelBGColor) $this->cssLABEL .= 'background-color:' . $this->labelBGColor . ';'; if($this->labelBorder) $this->cssLABEL .= 'border:' . $this->labelBorder . ';'; if($this->labelFont) $this->cssLABEL .= 'font-family:' . $this->labelFont . ';'; if($this->labelSize) $this->cssLABEL .= 'font-size:' . $this->labelSize . 'px;'; if($this->labelAlign) $this->cssLABEL .= 'text-align:' . $this->labelAlign . ';'; if($this->labelBGColor) $this->cssLABELBG .= 'background-color:' . $this->labelBGColor . ';'; if($this->legendColor) $this->cssLEGEND .= 'color:' . $this->legendColor . ';'; if($this->legendFont) $this->cssLEGEND .= 'font-family:' . $this->legendFont . ';'; if($this->legendSize) $this->cssLEGEND .= 'font-size:' . $this->legendSize . 'px;'; if($this->legendBGColor) $this->cssLEGENDBG .= 'background-color:' . $this->legendBGColor . ';'; if($this->legendBorder) $this->cssLEGENDBG .= 'border:' . $this->legendBorder . ';'; if($this->absValuesColor) $this->cssABSVALUES .= 'color:' . $this->absValuesColor . ';'; if($this->absValuesBGColor) $this->cssABSVALUES .= 'background-color:' . $this->absValuesBGColor . ';'; if($this->absValuesBorder) $this->cssABSVALUES .= 'border:' . $this->absValuesBorder . ';'; if($this->absValuesFont) $this->cssABSVALUES .= 'font-family:' . $this->absValuesFont . ';'; if($this->absValuesSize) $this->cssABSVALUES .= 'font-size:' . $this->absValuesSize . 'px;'; if($this->percValuesColor) $this->cssPERCVALUES .= 'color:' . $this->percValuesColor . ';'; if($this->percValuesFont) $this->cssPERCVALUES .= 'font-family:' . $this->percValuesFont . ';'; if($this->percValuesSize) $this->cssPERCVALUES .= 'font-size:' . $this->percValuesSize . 'px;'; } function level_color($value, $color) { if($this->barLevelColors) { for($i = 0; $i < count($this->barLevelColors); $i += 2) { if($i+1 < count($this->barLevelColors)) { if(($this->barLevelColors[$i] > 0 && $value >= $this->barLevelColors[$i]) || ($this->barLevelColors[$i] < 0 && $value <= $this->barLevelColors[$i])) { $color = $this->barLevelColors[$i+1]; } } } } return $color; } function build_bar($value, $width, $height, $color) { $title = $this->absValuesPrefix . $value . $this->absValuesSuffix; $bg = eregi('\.(jpg|jpeg|jpe|gif|png)$', $color) ? 'background' : 'bgcolor'; $bar = ''; $bar .= '
' : '>'; $bar .= '
'; $bar .= '
'; return $bar; } function build_fader($value, $width, $height, $x, $color) { $fader = ''; $x -= round($width / 2); if($x > 0) $fader .= ''; $fader .= ''; $fader .= '
' . $this->build_bar($value, $width, $height, $color) . '
'; return $fader; } function build_value($val, $max_dec, $sum = 0, $align = '') { $val = number_format($val, $max_dec); if($sum) $sum = number_format($sum, $max_dec); $value = 'absValuesPrefix . $val . $this->absValuesSuffix; if($sum) $value .= ' / ' . $this->absValuesPrefix . $sum . $this->absValuesSuffix; $value .= ' '; return $value; } function build_legend($barColors) { $legend = ''; $legend .= '
'; $legend .= ''; $l = (is_array($this->legend)) ? $this->legend : explode(',', $this->legend); for($i = 0; $i < count($barColors); $i++) { $legend .= ''; $legend .= ''; $legend .= ''; $legend .= ''; } $legend .= '
' . $this->build_bar('', $this->barWidth, $this->barWidth, $barColors[$i]) . '' . trim($l[$i]) . '
'; return $legend; } function build_hTitle($titleLabel, $titleValue, $titleBar) { $title = ''; $title .= '' . $titleLabel . ''; if($titleValue != '') $title .= '' . $titleValue . ''; $title .= '' . $titleBar . ''; $title .= ''; return $title; } function create_hBar($value, $percent, $mPerc, $mPerc_neg, $max_neg, $mul, $valSpace, $bColor, $border, $spacer, $spacer_neg) { $bar = ''; if($percent < 0) { $percent *= -1; $bar .= ''; } else { if($max_neg) { $bar .= ''; } if($percent) { $bar .= ''; } else $bar .= ''; $bar .= ''; } $bar .= '
'; if($this->showValues < 2) $bar .= '' . number_format($percent, $this->percValuesDecimals) . '%'; $bar .= ' '; $bar .= $this->build_bar($value, round($percent * $mul), $this->barWidth, $bColor); $bar .= ''; $bar .= '
'; $bar .= $this->build_bar($value, round($percent * $mul), $this->barWidth, $bColor); $bar .= ''; if($this->showValues < 2) $bar .= ' ' . number_format($percent, $this->percValuesDecimals) . '%'; $bar .= ' 
'; return $bar; } function create_vBar($value, $percent, $mPerc, $mPerc_neg, $max_neg, $mul, $valSpace, $bColor, $border, $spacer, $spacer_neg) { $bar = ''; if($percent < 0) { $percent *= -1; $bar .= ''; $bar .= ''; } else { $bar .= ''; if($percent) { $bar .= ''; } else $bar .= ''; if($max_neg) { $bar .= ''; } } $bar .= '
'; $bar .= $this->build_bar($value, $this->barWidth, round($percent * $mul), $bColor); $bar .= '
'; $bar .= ($this->showValues < 2) ? '' . number_format($percent, $this->percValuesDecimals) . '%' : ' '; $bar .= ''; if($this->showValues < 2) $bar .= number_format($percent, $this->percValuesDecimals) . '%'; $bar .= '
'; $bar .= $this->build_bar($value, $this->barWidth, round($percent * $mul), $bColor); $bar .= '
'; $bar .= '
'; return $bar; } function create() { error_reporting(E_WARNING); $this->type = strtolower($this->type); $d = (is_array($this->values)) ? $this->values : explode(',', $this->values); if(is_array($this->titles)) $t = $this->titles; else $t = (strlen($this->titles) > 1) ? explode(',', $this->titles) : array(); if(is_array($this->labels)) $r = $this->labels; else $r = (strlen($this->labels) > 1) ? explode(',', $this->labels) : array(); if($this->barColors) $drc = (is_array($this->barColors)) ? $this->barColors : explode(',', $this->barColors); else $drc = array(); $val = $bc = array(); if($this->barLength < 0.1) $this->barLength = 0.1; else if($this->barLength > 2.9) $this->barLength = 2.9; $bars = (count($d) > count($r)) ? count($d) : count($r); if($this->type == 'pbar' || $this->type == 'fader') { if(!$this->barBGColor) $this->barBGColor = $this->labelBGColor; if($this->labelBGColor == $this->barBGColor && count($t) == 0) { $this->labelBGColor = ''; $this->labelBorder = ''; } } $this->set_styles(); $graph = ''; $graph .= 'cssGRAPH ? ' style="' . $this->cssGRAPH . '"' : '') . '>'; if($this->legend && $this->type != 'pbar' && $this->type != 'fader') $graph .= '
'; if($this->type == 'vbar') $graph .= ''; $graph .= '
'; if($this->charts > 1) { $divide = ceil($bars / $this->charts); $graph .= ''; if($this->showValues < 2) $graph .= ''; $graph .= ''; if($this->labelSpace && $i < count($val[$chart])-1) $graph .= ''; } } else $graph .= ''; $graph .= '
'; } else $divide = 0; for($i = $sum = $max = $max_neg = $max_dec = $ccnt = $lcnt = $chart = 0; $i < $bars; $i++) { if($divide && $i && !($i % $divide)) { $lcnt = 0; $chart++; } $drv = explode(';', $d[$i]); for($j = $dec = 0; $j < count($drv); $j++) { $val[$chart][$lcnt][$j] = $v = trim(str_replace(',', '.', $drv[$j])); if($v > $max) $max = $v; else if($v < $max_neg) $max_neg = $v; if($v < 0) $v *= -1; $sum += $v; if(strstr($v, '.')) { $dec = strlen(substr($v, strrpos($v, '.') + 1)); if($dec > $max_dec) $max_dec = $dec; } if(!$bc[$j]) { if($ccnt >= count($this->colors)) $ccnt = 0; $bc[$j] = (!$drc[$j] || strlen($drc[$j]) < 3) ? $this->colors[$ccnt++] : trim($drc[$j]); } } $lcnt++; } $border = (int) $this->barBorder; $mPerc = $sum ? round($max * 100 / $sum) : 0; if($this->type == 'pbar' || $this->type == 'fader') $mul = 2; else $mul = $mPerc ? 100 / $mPerc : 1; $mul *= $this->barLength; if($this->showValues < 2) { if($this->type == 'hbar') $valSpace = ($this->percValuesDecimals * ($this->percValuesSize / 1.6)) + ($this->percValuesSize * 3.2); else $valSpace = $this->percValuesSize * 1.2; } else $valSpace = $this->percValuesSize; $spacer = $maxSize = round($mPerc * $mul + $valSpace + $border * 2); if($max_neg) { $mPerc_neg = $sum ? round(-$max_neg * 100 / $sum) : 0; $spacer_neg = round($mPerc_neg * $mul + $valSpace + $border * 2); $maxSize += $spacer_neg; } $titleLabel = $titleValue = $titleBar = ''; if(count($t) > 0) { $titleLabel = ($t[0] == '') ? ' ' : $t[0]; if($this->showValues == 1 || $this->showValues == 2) { $titleValue = ($t[1] == '') ? ' ' : $t[1]; $titleBar = ($t[2] == '') ? ' ' : $t[2]; } else $titleBar = ($t[1] == '') ? ' ' : $t[1]; } for($chart = $lcnt = 0; $chart < count($val); $chart++) { $graph .= ''; if($this->type == 'hbar') { if(count($t) > 0) $graph .= $this->build_hTitle($titleLabel, $titleValue, $titleBar); for($i = 0; $i < count($val[$chart]); $i++, $lcnt++) { $label = ($lcnt < count($r)) ? trim($r[$lcnt]) : $lcnt+1; $rowspan = count($val[$chart][$i]); $graph .= ''; for($j = 0; $j < count($val[$chart][$i]); $j++) { $percent = $sum ? $val[$chart][$i][$j] * 100 / $sum : 0; $value = number_format($val[$chart][$i][$j], $max_dec); $bColor = $this->level_color($val[$chart][$i][$j], $bc[$j]); if($this->showValues == 1 || $this->showValues == 2) $graph .= $this->build_value($val[$chart][$i][$j], $max_dec, 0, 'right'); $graph .= 'cssBARBG ? ' style="' . $this->cssBARBG . '"' : '') . ' height=100% width=' . $maxSize . '>'; $graph .= $this->create_hBar($value, $percent, $mPerc, $mPerc_neg, $max_neg, $mul, $valSpace, $bColor, $border, $spacer, $spacer_neg); $graph .= ''; if($j < count($val[$chart][$i]) - 1) $graph .= ''; } if($this->labelSpace && $i < count($val[$chart])-1) $graph .= ''; } } else if($this->type == 'vbar') { $graph .= ''; if($titleBar != '') { $titleBar = str_replace('-', '-
', $titleBar); $graph .= ''; } for($i = 0; $i < count($val[$chart]); $i++) { for($j = 0; $j < count($val[$chart][$i]); $j++) { $percent = $sum ? $val[$chart][$i][$j] * 100 / $sum : 0; $value = number_format($val[$chart][$i][$j], $max_dec); $bColor = $this->level_color($val[$chart][$i][$j], $bc[$j]); $graph .= 'cssBARBG ? ' style="' . $this->cssBARBG . '"' : '') . '>'; $graph .= $this->create_vBar($value, $percent, $mPerc, $mPerc_neg, $max_neg, $mul, $valSpace, $bColor, $border, $spacer, $spacer_neg); $graph .= ''; } if($this->labelSpace) $graph .= ''; } if($this->showValues == 1 || $this->showValues == 2) { $graph .= ''; if($titleValue != '') $graph .= ''; for($i = 0; $i < count($val[$chart]); $i++) { for($j = 0; $j < count($val[$chart][$i]); $j++) { $graph .= $this->build_value($val[$chart][$i][$j], $max_dec); } if($this->labelSpace) $graph .= ''; } } $graph .= ''; if($titleLabel != '') $graph .= ''; for($i = 0; $i < count($val[$chart]); $i++, $lcnt++) { $label = ($lcnt < count($r)) ? trim($r[$lcnt]) : $lcnt+1; $colspan = count($val[$chart][$i]); $graph .= ''; if($this->labelSpace) $graph .= ''; } $graph .= ''; } else if($this->type == 'pbar' || $this->type == 'fader') { if(count($t) > 0) $graph .= $this->build_hTitle($titleLabel, $titleValue, $titleBar); for($i = 0; $i < count($val[$chart]); $i++, $lcnt++) { $label = ($lcnt < count($r)) ? trim($r[$lcnt]) : ''; $graph .= ''; if($label) { $graph .= ''; } $sum = (float) $val[$chart][$i][1]; $percent = $sum ? $val[$chart][$i][0] * 100 / $sum : 0; $value = number_format($val[$chart][$i][0], $max_dec); if($this->showValues == 1 || $this->showValues == 2) $graph .= $this->build_value($val[$chart][$i][0], $max_dec, $sum, 'right'); $graph .= 'cssBARBG ? ' style="' . $this->cssBARBG . '"' : '') . '>'; $this->barColors = $drc[$i] ? trim($drc[$i]) : $this->colors[0]; $bColor = $this->level_color($val[$chart][$i][0], $this->barColors); $graph .= '
1) ? ' rowspan=' . $rowspan : '') . '>'; $graph .= ' ' . $label . ' 
' . $titleBar . '
' . $titleValue . '
' . $titleLabel . ' 1) ? ' colspan=' . $colspan : '') . '>'; $graph .= ' ' . $label . ' 
'; $graph .= ' ' . $label . ' 
'; $graph .= '
'; if($this->type == 'fader') $graph .= $this->build_fader($value, round($this->barWidth / 2), $this->barWidth, round($percent * $mul), $bColor); else $graph .= $this->build_bar($value, round($percent * $mul), $this->barWidth, $bColor); $graph .= '
 ' . number_format($percent, $this->percValuesDecimals) . '%
' . $this->err_type . '
'; if($chart < $this->charts - 1 && count($val[$chart+1])) { $graph .= '
'; } } if($this->charts > 1) $graph .= '
'; if($this->legend && $this->type != 'pbar' && $this->type != 'fader') { $graph .= ' '; $graph .= $this->build_legend($bc); $graph .= ''; } if($this->debug) { $graph .= "
sum=$sum max=$max max_neg=$max_neg max_dec=$max_dec "; $graph .= "mPerc=$mPerc mPerc_neg=$mPerc_neg mul=$mul valSpace=$valSpace"; } $graph .= ''; return $graph; } } ?> Dragon Exploration System for Marine Sponge Compounds Interactions 

Page: 1 ... 1425 1426 1427 1428 1429 1430 1431
TitlePubID Frequency 
The use of gelfoam powder and betadine-saturated gauze in treatment of chronic ulcerations.7320417
Long-term follow-up of a sponge breast implant and review of the literature.10029487
Discovery and development of antineoplastic agents from natural sources.10071600
Spontaneous unilateral exophthalmos consecutive to arteriovenous fistulae exclusively fed by branches of the external carotid artery.7328426
[Medullary sponge Kidney (author's transl)].7330207
Eukaryote kingdoms: seven or nine?7337818
Six new spongian diterpenes from the sponge spongia matamata10075761
Erosion of spinous process after surgery.1729810
"Spiderlon": new device for simple, fast arterial and venous occlusion.6781312
Intraabdominal abscess with gauze.16431314

Page: 1 ... 1425 1426 1427 1428 1429 1430 1431