/* +-------------------------------------------------------------------+ | H T M L - G R A P H S (v4.4) | | | | Copyright Gerd Tentler www.gerd-tentler.de/tools | | Created: Sep. 17, 2002 Last modified: Nov. 17, 2007 | +-------------------------------------------------------------------+ | This program may be used and hosted free of charge by anyone for | | personal purpose as long as this copyright notice remains intact. | | | | Obtain permission before selling the code for this program or | | hosting this software on a commercial website or redistributing | | this software over the Internet or in any other medium. In all | | cases copyright must remain intact. | +-------------------------------------------------------------------+ ====================================================================================================== Example: $graph = new BAR_GRAPH("hBar"); $graph->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 .= ' |
'; $fader .= ' | ' . $this->build_bar($value, $width, $height, $color) . ' | '; $fader .= '
';
$legend .= '
|
'; if($this->showValues < 2) $bar .= '' . number_format($percent, $this->percValuesDecimals) . '%'; $bar .= ' | '; $bar .= $this->build_bar($value, round($percent * $mul), $this->barWidth, $bColor); $bar .= ' | '; } else { if($max_neg) { $bar .= ' | ';
$bar .= ' | ';
}
if($percent) {
$bar .= ''; $bar .= $this->build_bar($value, round($percent * $mul), $this->barWidth, $bColor); $bar .= ' | '; } else $bar .= ''; if($this->showValues < 2) $bar .= ' ' . number_format($percent, $this->percValuesDecimals) . '%'; $bar .= ' | '; } $bar .= '
'; $bar .= $this->build_bar($value, $this->barWidth, round($percent * $mul), $bColor); $bar .= ' | |
'; $bar .= ($this->showValues < 2) ? '' . number_format($percent, $this->percValuesDecimals) . '%' : ' '; $bar .= ' | '; } else { $bar .= ''; if($this->showValues < 2) $bar .= number_format($percent, $this->percValuesDecimals) . '%'; $bar .= ' | '; if($percent) { $bar .= '
'; $bar .= $this->build_bar($value, $this->barWidth, round($percent * $mul), $bColor); $bar .= ' | '; } else $bar .= '|
';
$bar .= ' | ';
}
}
$bar .= '
cssGRAPH ? ' style="' . $this->cssGRAPH . '"' : '') . '>';
if($this->legend && $this->type != 'pbar' && $this->type != 'fader')
$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 .= ' |
Page: | 1 2 3 4 5 6 7 8 ... 1431 |
Title | PubID | Frequency |
---|---|---|
Polyacetylenediols regulate the function of human monocyte-derived dendritic cells. | 20493278 | 31 |
Angiogenic potential in vivo by Kaposi's sarcoma cell-free supernatants and HIV-1 tat product: inhibition of KS-like lesions by tissue inhibitor of metalloproteinase-2. | 7528513 | 30 |
TGFβ-stimulated microRNA-21 utilizes PTEN to orchestrate AKT/mTORC1 signaling for mesangial cell hypertrophy and matrix expansion. | 22879939 | 30 |
Ferroportin-1 is a 'nuclear'-negative acute-phase protein in rat liver: a comparison with other iron-transport proteins. | 22469696 | 30 |
Modulation of acute and chronic inflammatory processes by cacospongionolide B, a novel inhibitor of human synovial phospholipase A2. | 10051149 | 30 |
Liver and kidney disease in ciliopathies. | 19876928 | 30 |
Chemoembolization in liver malignant involvement. Experiences on 17 cases. | 8072703 | 30 |
Marine sponge-derived polymeric alkylpyridinium salts as a novel tumor chemotherapeutic targeting the cholinergic system in lung tumors. | 17088975 | 30 |
Comparison of TGF-beta/BMP pathways signaled by demineralized bone powder and BMP-2 in human dermal fibroblasts. | 15355569 | 30 |
Aglycon of rhizochalin from the Rhizochalina incrustata induces apoptosis via activation of AMP-activated protein kinase in HT-29 colon cancer cells. | 21963494 | 29 |
Page: | 1 2 3 4 5 6 7 8 ... 1431 |