From 25f3706452bb77f20aaba25648e890da67673959 Mon Sep 17 00:00:00 2001 From: randommonk Date: Fri, 5 Jan 2018 20:20:50 +0000 Subject: Remove old jpgraph implementation --- html/import/import_domscreens.php | 26 - html/includes/domstats.php | 719 ---- html/jpgraph/.htaccess | 10 - html/jpgraph/d2utmpFU7H53 | 1190 ------ html/jpgraph/flag_mapping | 237 -- html/jpgraph/flags.dat | Bin 982680 -> 0 bytes html/jpgraph/flags_thumb100x100.dat | Bin 687670 -> 0 bytes html/jpgraph/flags_thumb35x35.dat | Bin 214336 -> 0 bytes html/jpgraph/flags_thumb60x60.dat | Bin 375530 -> 0 bytes html/jpgraph/fonts/DejaVuSans-Bold.ttf | Bin 634541 -> 0 bytes html/jpgraph/fonts/DejaVuSans-BoldOblique.ttf | Bin 574990 -> 0 bytes html/jpgraph/fonts/DejaVuSans-Oblique.ttf | Bin 574854 -> 0 bytes html/jpgraph/fonts/DejaVuSans.ttf | Bin 684003 -> 0 bytes html/jpgraph/fonts/FF_FONT0-Bold.gdf | Bin 13456 -> 0 bytes html/jpgraph/fonts/FF_FONT0.gdf | Bin 13456 -> 0 bytes html/jpgraph/fonts/FF_FONT1-Bold.gdf | Bin 18832 -> 0 bytes html/jpgraph/fonts/FF_FONT1.gdf | Bin 18832 -> 0 bytes html/jpgraph/fonts/FF_FONT2-Bold.gdf | Bin 25104 -> 0 bytes html/jpgraph/fonts/FF_FONT2.gdf | Bin 25104 -> 0 bytes html/jpgraph/gd_image.inc.php | 2304 ---------- html/jpgraph/imageSmoothArc.php | 344 -- html/jpgraph/imgdata_balls.inc.php | 1061 ----- html/jpgraph/imgdata_bevels.inc.php | 104 - html/jpgraph/imgdata_diamonds.inc.php | 177 - html/jpgraph/imgdata_pushpins.inc.php | 517 --- html/jpgraph/imgdata_squares.inc.php | 150 - html/jpgraph/imgdata_stars.inc.php | 144 - html/jpgraph/jpg-config.inc.php | 138 - html/jpgraph/jpgraph.php | 5626 ------------------------- html/jpgraph/jpgraph_antispam-digits.php | 205 - html/jpgraph/jpgraph_antispam.php | 615 --- html/jpgraph/jpgraph_bar.php | 1190 ------ html/jpgraph/jpgraph_canvas.php | 95 - html/jpgraph/jpgraph_canvtools.php | 523 --- html/jpgraph/jpgraph_contour.php | 587 --- html/jpgraph/jpgraph_date.php | 499 --- html/jpgraph/jpgraph_errhandler.inc.php | 369 -- html/jpgraph/jpgraph_error.php | 157 - html/jpgraph/jpgraph_flags.php | 376 -- html/jpgraph/jpgraph_gantt.php | 3955 ----------------- html/jpgraph/jpgraph_gb2312.php | 1552 ------- html/jpgraph/jpgraph_gradient.php | 434 -- html/jpgraph/jpgraph_iconplot.php | 190 - html/jpgraph/jpgraph_imgtrans.php | 223 - html/jpgraph/jpgraph_led.php | 311 -- html/jpgraph/jpgraph_legend.inc.php | 494 --- html/jpgraph/jpgraph_line.php | 682 --- html/jpgraph/jpgraph_log.php | 305 -- html/jpgraph/jpgraph_meshinterpolate.inc.php | 105 - html/jpgraph/jpgraph_mgraph.php | 345 -- html/jpgraph/jpgraph_pie.php | 1495 ------- html/jpgraph/jpgraph_pie3d.php | 933 ---- html/jpgraph/jpgraph_plotband.php | 635 --- html/jpgraph/jpgraph_plotline.php | 142 - html/jpgraph/jpgraph_plotmark.inc.php | 504 --- html/jpgraph/jpgraph_polar.php | 897 ---- html/jpgraph/jpgraph_radar.php | 861 ---- html/jpgraph/jpgraph_regstat.php | 215 - html/jpgraph/jpgraph_rgb.inc.php | 615 --- html/jpgraph/jpgraph_scatter.php | 242 -- html/jpgraph/jpgraph_stock.php | 198 - html/jpgraph/jpgraph_table.php | 1325 ------ html/jpgraph/jpgraph_text.inc.php | 327 -- html/jpgraph/jpgraph_theme.inc.php | 136 - html/jpgraph/jpgraph_ttf.inc.php | 631 --- html/jpgraph/jpgraph_utils.inc.php | 685 --- html/jpgraph/jpgraph_windrose.php | 1566 ------- html/jpgraph/lang/de.inc.php | 552 --- html/jpgraph/lang/en.inc.php | 545 --- html/jpgraph/lang/prod.inc.php | 386 -- html/jpgraph/themes/AquaTheme.class.php | 202 - html/jpgraph/themes/GreenTheme.class.php | 178 - html/jpgraph/themes/OceanTheme.class.php | 180 - html/jpgraph/themes/OrangeTheme.class.php | 180 - html/jpgraph/themes/PastelTheme.class.php | 175 - html/jpgraph/themes/RoseTheme.class.php | 180 - html/jpgraph/themes/SoftyTheme.class.php | 209 - html/jpgraph/themes/UniversalTheme.class.php | 188 - html/jpgraph/themes/VividTheme.class.php | 175 - 79 files changed, 40516 deletions(-) delete mode 100644 html/import/import_domscreens.php delete mode 100644 html/includes/domstats.php delete mode 100644 html/jpgraph/.htaccess delete mode 100644 html/jpgraph/d2utmpFU7H53 delete mode 100644 html/jpgraph/flag_mapping delete mode 100644 html/jpgraph/flags.dat delete mode 100644 html/jpgraph/flags_thumb100x100.dat delete mode 100644 html/jpgraph/flags_thumb35x35.dat delete mode 100644 html/jpgraph/flags_thumb60x60.dat delete mode 100644 html/jpgraph/fonts/DejaVuSans-Bold.ttf delete mode 100644 html/jpgraph/fonts/DejaVuSans-BoldOblique.ttf delete mode 100644 html/jpgraph/fonts/DejaVuSans-Oblique.ttf delete mode 100644 html/jpgraph/fonts/DejaVuSans.ttf delete mode 100644 html/jpgraph/fonts/FF_FONT0-Bold.gdf delete mode 100644 html/jpgraph/fonts/FF_FONT0.gdf delete mode 100644 html/jpgraph/fonts/FF_FONT1-Bold.gdf delete mode 100644 html/jpgraph/fonts/FF_FONT1.gdf delete mode 100644 html/jpgraph/fonts/FF_FONT2-Bold.gdf delete mode 100644 html/jpgraph/fonts/FF_FONT2.gdf delete mode 100644 html/jpgraph/gd_image.inc.php delete mode 100644 html/jpgraph/imageSmoothArc.php delete mode 100644 html/jpgraph/imgdata_balls.inc.php delete mode 100644 html/jpgraph/imgdata_bevels.inc.php delete mode 100644 html/jpgraph/imgdata_diamonds.inc.php delete mode 100644 html/jpgraph/imgdata_pushpins.inc.php delete mode 100644 html/jpgraph/imgdata_squares.inc.php delete mode 100644 html/jpgraph/imgdata_stars.inc.php delete mode 100644 html/jpgraph/jpg-config.inc.php delete mode 100644 html/jpgraph/jpgraph.php delete mode 100644 html/jpgraph/jpgraph_antispam-digits.php delete mode 100644 html/jpgraph/jpgraph_antispam.php delete mode 100644 html/jpgraph/jpgraph_bar.php delete mode 100644 html/jpgraph/jpgraph_canvas.php delete mode 100644 html/jpgraph/jpgraph_canvtools.php delete mode 100644 html/jpgraph/jpgraph_contour.php delete mode 100644 html/jpgraph/jpgraph_date.php delete mode 100644 html/jpgraph/jpgraph_errhandler.inc.php delete mode 100644 html/jpgraph/jpgraph_error.php delete mode 100644 html/jpgraph/jpgraph_flags.php delete mode 100644 html/jpgraph/jpgraph_gantt.php delete mode 100644 html/jpgraph/jpgraph_gb2312.php delete mode 100644 html/jpgraph/jpgraph_gradient.php delete mode 100644 html/jpgraph/jpgraph_iconplot.php delete mode 100644 html/jpgraph/jpgraph_imgtrans.php delete mode 100644 html/jpgraph/jpgraph_led.php delete mode 100644 html/jpgraph/jpgraph_legend.inc.php delete mode 100644 html/jpgraph/jpgraph_line.php delete mode 100644 html/jpgraph/jpgraph_log.php delete mode 100644 html/jpgraph/jpgraph_meshinterpolate.inc.php delete mode 100644 html/jpgraph/jpgraph_mgraph.php delete mode 100644 html/jpgraph/jpgraph_pie.php delete mode 100644 html/jpgraph/jpgraph_pie3d.php delete mode 100644 html/jpgraph/jpgraph_plotband.php delete mode 100644 html/jpgraph/jpgraph_plotline.php delete mode 100644 html/jpgraph/jpgraph_plotmark.inc.php delete mode 100644 html/jpgraph/jpgraph_polar.php delete mode 100644 html/jpgraph/jpgraph_radar.php delete mode 100644 html/jpgraph/jpgraph_regstat.php delete mode 100644 html/jpgraph/jpgraph_rgb.inc.php delete mode 100644 html/jpgraph/jpgraph_scatter.php delete mode 100644 html/jpgraph/jpgraph_stock.php delete mode 100644 html/jpgraph/jpgraph_table.php delete mode 100644 html/jpgraph/jpgraph_text.inc.php delete mode 100644 html/jpgraph/jpgraph_theme.inc.php delete mode 100644 html/jpgraph/jpgraph_ttf.inc.php delete mode 100644 html/jpgraph/jpgraph_utils.inc.php delete mode 100644 html/jpgraph/jpgraph_windrose.php delete mode 100644 html/jpgraph/lang/de.inc.php delete mode 100644 html/jpgraph/lang/en.inc.php delete mode 100644 html/jpgraph/lang/prod.inc.php delete mode 100644 html/jpgraph/themes/AquaTheme.class.php delete mode 100644 html/jpgraph/themes/GreenTheme.class.php delete mode 100644 html/jpgraph/themes/OceanTheme.class.php delete mode 100644 html/jpgraph/themes/OrangeTheme.class.php delete mode 100644 html/jpgraph/themes/PastelTheme.class.php delete mode 100644 html/jpgraph/themes/RoseTheme.class.php delete mode 100644 html/jpgraph/themes/SoftyTheme.class.php delete mode 100644 html/jpgraph/themes/UniversalTheme.class.php delete mode 100644 html/jpgraph/themes/VividTheme.class.php (limited to 'html') diff --git a/html/import/import_domscreens.php b/html/import/import_domscreens.php deleted file mode 100644 index de8a379..0000000 --- a/html/import/import_domscreens.php +++ /dev/null @@ -1,26 +0,0 @@ - - \ No newline at end of file diff --git a/html/includes/domstats.php b/html/includes/domstats.php deleted file mode 100644 index dbdd3f7..0000000 --- a/html/includes/domstats.php +++ /dev/null @@ -1,719 +0,0 @@ - ''"; - $q_player = mysql_query($sql_player) or die(mysql_error()); - - while ($r_player = mysql_fetch_array($q_player)) { - $playerid = $r_player[col4]; - - // Get players last name used - $r_player2 = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'player' AND col2 = 'rename' AND col4 = $playerid ORDER BY id DESC LIMIT 0,1"); - $playername = addslashes($r_player2[col3]); - - // Get players last team - $r_player3 = small_query("SELECT col4 FROM uts_temp_$uid WHERE col1 = 'player' AND col2 = 'TeamChange' AND col3 = $playerid AND col4 != 255 ORDER BY id DESC LIMIT 0,1"); - $playerteam = $r_player3[col4]; - - $playernames[$playerid] = $playername; - $playerteams[$playerid] = $playerteam; - } - - return array($playernames,$playerteams); - -} - -/* -Get time game starts, game ends, and ratio compared to real time -@return $time_gamestart, $time_gameend, $time_ratio_correction (difference in ut time & real time, typically 110%) -*/ -function getGameStartEndRatio($uid) { - - // gather game start & end time - $q_logdom = mysql_query("SELECT col0 FROM uts_temp_$uid WHERE col1='game_start' OR col1='game_end' ORDER BY id ASC")or die(mysql_error()); - - $time_gamestart = mysql_result($q_logdom,0); - $time_gameend = mysql_result($q_logdom,1); - $time_ratio_correction = ($time_gameend-$time_gamestart)/1200; - - return array($time_gamestart, $time_gameend, $time_ratio_correction); -} - -/* -Helper function to create the temporary table used for dom stats -*/ -function createEmptyTempTable($table_name) { - - $sqlCreateTable = " - CREATE TEMPORARY TABLE `$table_name` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `cp` varchar(254) NOT NULL, - `teamid` int(11) NOT NULL, - `playerid` int(11) NOT NULL, - `playername` varchar(254) NOT NULL, - `start` float NOT NULL, - `end` float NOT NULL, - `time` float NOT NULL, - `scoret0` float NOT NULL, - `scoret1` float NOT NULL, - `realTimeEnd` float NOT NULL, - PRIMARY KEY (`id`) - ) ENGINE=MyISAM - "; - mysql_query($sqlCreateTable) or die(mysql_error()); -} - -/* -Create & populate the dom stats table -@return name of temporary table -*/ -function generateTempTable($uid) { - global $playernames; - global $playerteams; - global $time_gamestart; - global $time_gameend; - global $time_ratio_correction; - - $tempTableName = "uts_tempidom_".$uid; - - createEmptyTempTable($tempTableName); - - // iterate over cp's. also capture game-end event as a quick hack to also do final iteration over final cp - $q_logdom = mysql_query("SELECT * FROM uts_temp_$uid WHERE col1='controlpoint_capture' OR col1='game_end' ORDER BY col1, col2, id ASC")or die(mysql_error()); - - $prev_time = 0; - - // dynamicly create insert query to populate the table in 1 go, instead of multiple database calls - $insertQuery = "INSERT INTO $tempTableName (cp, teamid, playerid, playername, start, end, time,scoret0,scoret1,realTimeEnd) VALUES"; - - // basically loop over all capture events per CP. Each time calculate how long the previous owner had the point and translate this to dom points - while($r_logdom = mysql_fetch_array($q_logdom)) { - $points[0] = 0; - $points[1] = 0; - $ticks[0] = 0; - $ticks[1] = 0; - - $start_time = $prev_time; - - $r_cp = $r_logdom['col2']; - $r_time = $r_logdom['col0']; - - // skip first capture event - no dom points given at start of map since no-one has cp - if($prev_time > 0) { - - // if switching to other cp - if($prev_cp != $r_cp) { - $end_time = $time_gameend; // take game end time to calculate time cp was taken, since it's the last time it's taken + extra tick for end time - - } else { - $end_time = $r_time; - } - - $time_diff = ($end_time - $start_time); - - // point has to be yours for at least a second before it starts to add points - if($time_diff >= 1) { - - // after this second, it will start to add points during each time the timer runs (= each second) - // thus, first run of timer is ceil of start time - // also, floor of end time since having the point after the timer ran, but not until the next tick = no points - // timing in log does not account for gamespeed, typically 1.1 ratio, which is corrected in these times - // test was done to save the actual tick times based upon the dom_points stats event (happens each 5 ticks), but this doesn't result in significant better results to be worth the effort - - // save amount of timer 'ticks' that generate a score of 0.2 - $ticks[$r_teamid] = (floor($end_time/$time_ratio_correction)-ceil($start_time/$time_ratio_correction)); - - } - - // if no tick happened, insert the event with 0 points - if($ticks[$r_teamid]==0) { - - $realTimeEnd=($start_time-$time_gamestart)/$time_ratio_correction/60; - $insertQuery .= " ('$prev_cp', '$r_teamid', '$r_pid', '$r_pname', '$start_time', '$end_time', '$time_diff', '".$points[0]."', '".$points[1]."', '$realTimeEnd'),"; - - // if ticks happened, insert each seperate tick as an event - } else { - - for($i=1;($ticks[$r_teamid]+1-$i) > 0;$i++) { - - $realTimeEnd=($start_time+$time_diff/$ticks[$r_teamid]*$i-$time_gamestart)/$time_ratio_correction/60; - $points[$r_teamid] = 0.2; - - $insertQuery .= " ('$prev_cp', '$r_teamid', '$r_pid', '$r_pname', '$start_time', '$end_time', '$time_diff', '".$points[0]."', '".$points[1]."', '$realTimeEnd'),"; - - } - } - - } - - // save data for current capture event - $prev_time = $r_time; - $prev_cp = $r_cp; - - $r_event = $r_logdom['col1']; - $r_pid = $r_logdom['col3']; - $r_teamid = mysql_real_escape_string($playerteams[$r_pid]); - $r_pname = mysql_real_escape_string($playernames[$r_pid]); - - } - - // populate table - $insertQuery = rtrim($insertQuery,","); - mysql_query($insertQuery) or die(mysql_error()); - - return $tempTableName; - -} - -/* -Generate times when amp was taken -@return $amps[$team][$start_time,$end_time, $pid] -*/ -function generateAmpTimes($uid) { - global $playernames; - global $playerteams; - global $time_gamestart; - global $time_gameend; - global $time_ratio_correction; - - $amps = array(); - $prev_time = array(); - - // Get activate & deactivate times & players - $q_amps = mysql_query("SELECT col0,col1,col3 FROM uts_temp_$uid WHERE col2='Damage Amplifier' AND (col1='item_activate' OR col1='item_deactivate') ORDER BY id ASC"); - while($r_amps = mysql_fetch_array($q_amps)) { - $time = ($r_amps[0]-$time_gamestart)/$time_ratio_correction/60; - $event = $r_amps[1]; - $pid = $r_amps[2]; - - // If amp is deactivated, calculate the time it was used - if($event == "item_deactivate") { - $amps[$playerteams[$pid]][] = array($prev_time[$pid], $time,$pid); - $prev_time[$pid] = 0; - - // If amp is activated & none yet acquired, save the time of the start of this amp run - } else if($prev_time[$pid] == 0) { - $prev_time[$pid] = $time; - } - } - - return $amps; -} - -/* -Function to render the chart with amp runs -*/ -function renderAmpBars($uid,$tempTableName) { - global $playernames; - global $ampTimes; - global $matchid; - global $domimage_color; - global $domimages_folder; - global $domimage_width; - global $domimage_heigth; - - // Iterate over amp runs - for($i=0;$i<2;$i++) { - foreach ($ampTimes[$i] as $ampTaken) { - $ampStart = $ampTaken[0]; - $ampEnd = $ampTaken[1]; - $pid = $ampTaken[2]; - - // Only save amp runs longer than 20seconds - if($ampEnd > ($ampStart+.33)) { - - // Get scores during amprun - $q_scoresDuringAmp = mysql_query("SELECT SUM(scoret0),SUM(scoret1) FROM $tempTableName WHERE realTimeEnd > $ampStart AND realTimeEnd < $ampEnd"); - $r_scoresDuringAmps = mysql_fetch_array($q_scoresDuringAmp); - - $netPoints = $r_scoresDuringAmps[$i] - $r_scoresDuringAmps[1-$i]; - - // Process time for readable label - $totalTime = $ampEnd-$ampStart; - $totalTimeMinutes = floor($totalTime); - $totalTimeSeconds = round(($totalTime-$totalTimeMinutes)*60,0); - - $timeLabel = ""; - if($totalTimeMinutes>0) { $timeLabel .= $totalTimeMinutes."m"; } - if($totalTimeSeconds>0) { $timeLabel .= $totalTimeSeconds."s"; } - - $playerName = $playernames[$pid]; - - $ampRun['start'] = $ampStart; - $ampRun['label'] = substr($playerName,0,15)." (".$timeLabel.")"; - $ampRun['points'] = $netPoints; - $ampRun['team'] = $i; - - $data[] = $ampRun; - } - } - } - - if(count($data)>0) { - - // Sort ampruns not on teams, but on start time, to make sure they are plotted chronocologicstic - $data = array_sort($data,'start'); - - $maxValue=0; - // Process the ampruns to map it to 2 differnt bar plots per team - foreach ($data as $ampRun) { - $labels[] = $ampRun['label']; - $values[$ampRun['team']][] = $ampRun['points']; - - $posValue = $ampRun['points']>0? $ampRun['points'] : $ampRun['points']*-1; - - if($posValue>$maxValue) - $maxValue = $posValue; - - // Add 0 value for other team to ensure only 1 bar is plotted each time (either team 0 or team 1) - $values[1-$ampRun['team']][] = 0; - } - - $tickInterval = $maxValue>15?10:5; - $maxValue = $tickInterval*ceil($maxValue/$tickInterval); - - // Create the graph - // Some commands to enable horizontal bars & moved axis for proper formatting - $graph = new Graph($domimage_width+8,$domimage_heigth+8); - $graph->SetScale('textlin',$maxValue*-1,$maxValue); - $graph->SetTickDensity(TICKD_SPARSE); - $graph->Set90AndMargin('20','15','30','30'); - $graph->SetMarginColor($domimage_color['background']); - $graph->SetColor($domimage_color['background']); - $graph->SetFrame(true,$domimage_color['background'],0); - $graph->ygrid->SetFill(true,$domimage_color['band'][0],$domimage_color['band'][1]); - $graph->ygrid->SetColor($domimage_color['background']); - - $graph->title->Set('Net Score Amp Runs'); - $graph->title->SetFont(FF_VERDANA,FS_BOLD); - $graph->title->SetColor($domimage_color['heading']); - - $graph->xaxis->SetPos('min'); - $graph->xaxis->SetTickLabels($labels); - $graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,7); - $graph->xaxis->SetColor($domimage_color['font']); - $graph->xaxis->SetLabelAlign('left','center'); - $graph->xaxis->SetColor($domimage_color['background'],$domimage_color['font']); - - $graph->yaxis->SetPos('max'); - $graph->yaxis->SetLabelAlign('center','top'); - $graph->yaxis->SetLabelSide(SIDE_RIGHT); - $graph->yaxis->SetTickSide(SIDE_LEFT); - $graph->yaxis->scale->ticks->set($tickInterval); - $graph->yaxis->SetColor($domimage_color['background'],$domimage_color['font']); - - if(count($values[0])>0) { - $b1plot = new BarPlot($values[0]); - $graph->Add($b1plot); - $b1plot->SetFillGradient($domimage_color['team'][0][0],$domimage_color['team'][0][1],GRAD_HOR); - $b1plot->SetColor($domimage_color['team'][0][0]); - - } if(count($values[1])>0) { - $b2plot = new BarPlot($values[1]); - $graph->Add($b2plot); - $b2plot->SetFillGradient($domimage_color['team'][1][0],$domimage_color['team'][1][1],GRAD_HOR); - $b2plot->SetColor($domimage_color['team'][1][0]); - } - - $graph->Stroke($domimages_folder."/".$matchid."-ampruns.png"); - } -} - -/* -Generate the chart with pickups -*/ -function renderDataPickups($uid) { - global $matchid; - global $domimage_color; - global $domimages_folder; - global $domimage_width; - global $domimage_heigth; - - $q_pickups = mysql_query("SELECT SUM(pu_belt), SUM(pu_keg), SUM(pu_pads), SUM(pu_armour), SUM(pu_amp) FROM uts_player as p WHERE matchid = $matchid GROUP BY team") or die(mysql_error()); - - while($r_pickups = mysql_fetch_row($q_pickups)) { - $preData[] = $r_pickups; - } - - $anyPickupDone = false; - - // Process data to convert these to percentages - // Normal numbers don't plot nicely (fe. pads getting much higher pickups due to lower spawn time - for($i=0;$i<5;$i++) { - if($preData[0][$i]>0) { - $data[0][$i] = round($preData[0][$i]/($preData[0][$i]+$preData[1][$i])*100,0); - $data[1][$i] = 100-$data[0][$i]; - $anyPickupDone = true; - } else if($preData[1][$i]>0) { - $data[0][$i] = 0; - $data[1][$i] = 100; - $anyPickupDone = true; - } else { - $data[0][$i] = 0; - $data[1][$i] = 0; - } - } - - if($anyPickupDone) { - // Plot radargraph - $titles = array('belt','keg','pads','armour','amp'); - $graph = new RadarGraph ($domimage_width+8,$domimage_heigth+8); - $graph->SetScale('lin',0,100); - $graph->yscale->ticks->Set(25,5); - $graph->setMargin(30,30,30,30); - $graph->SetMarginColor($domimage_color['background']); - $graph->SetColor($domimage_color['background']); - $graph->SetFrame(true,$domimage_color['background'],0); - $graph->title->Set('Pickups %'); - $graph->title->SetFont(FF_VERDANA,FS_BOLD); - $graph->title->SetColor($domimage_color['heading']); - $graph->HideTickMarks(); - $graph->axis->HideLabels(); - - $graph->SetTitles($titles); - $graph->axis->title->SetFont(FF_VERDANA,FS_NORMAL,8); - $graph->axis->title->SetColor($domimage_color['font']); - $graph->grid->Show(true,true); - $graph->grid->SetLineStyle('dashed'); - - // Seperate plot within radar per team - $plot1 = new RadarPlot($data[0]); - $plot2 = new RadarPlot($data[1]); - $graph->Add($plot1); - $graph->Add($plot2); - - $plot1->SetFillColor($domimage_color['team'][0][0].'@0.5'); - $plot1->SetColor($domimage_color['team'][0][0]); - $plot1->SetLineWeight(2); - $plot2->SetFillColor($domimage_color['team'][1][0].'@0.5'); - $plot2->SetColor($domimage_color['team'][1][0]); - $plot2->SetLineWeight(2); - - $graph->Stroke($domimages_folder."/".$matchid."-pickups.png"); - } -} - -/* -Render dom points over time & net rate of change per minute over all cp's -*/ -function renderDataTotal($uid,$tempTableName) { - $query = "SELECT t.realTimeEnd,@t0sum := @t0sum + t.scoret0 AS cumulScoret0,@t1sum := @t1sum + t.scoret1 AS cumulScoret1 FROM $tempTableName t JOIN (SELECT @t0sum := 0) r JOIN (SELECT @t1sum := 0) s ORDER BY realTimeEnd ASC"; - $appex = "total"; - - renderData($uid,$tempTableName,$query,$appex,"Total score",""); -} - -/* -Render dom points over time & net rate of change per minute per cp -*/ -function renderDataCPs($uid,$tempTableName) { - $q_cps = mysql_query("SELECT DISTINCT(cp) FROM $tempTableName"); - - $i=0; - while($r_cps = mysql_fetch_array($q_cps)) { - $r_cp = $r_cps[0]; - $query = "SELECT t.realTimeEnd,@t0sum := @t0sum + t.scoret0 AS cumulScoret0,@t1sum := @t1sum + t.scoret1 AS cumulScoret1 FROM $tempTableName t JOIN (SELECT @t0sum := 0) r JOIN (SELECT @t1sum := 0) s WHERE t.CP = '$r_cp' ORDER BY realTimeEnd ASC"; - $appex = "cp".$i++; - renderData($uid,$tempTableName,$query,$appex,"Score CP ".$r_cp,$r_cp); - - } -} - -/* -Render dom points over time & net rate of change per minute -*/ -function renderData($uid,$tempTableName,$query,$appex,$title,$cp) { - global $matchid; - global $domimage_color; - global $domimages_folder; - global $domimage_width; - global $domimage_heigth; - - // Use helper function to parse the data into different datasets for charts - list($datax,$datay1,$datay2,$derivx,$derivy1,$derivy2) = parseData($query); - - // If this is a cp plot, ensure enough space for plotting the names underneath - if(strlen($cp)>0) { - - $g1heigth = $domimage_heigth*.65; - $g2heigth = $domimage_heigth*.35; - $g2marginlow = 50; - - // Else, use all space - } else { - - $g1heigth = $domimage_heigth*.75; - $g2heigth = $domimage_heigth*.25; - $g2marginlow = 10; - - } - - // Dom points over time per team - $graph1 = createGraph($title,$domimage_width,$g1heigth,array(30,10,30,30),"linlin"); - $sp11 = generateScatterLink($datax, $datay1,$domimage_color['team'][0][0],'FCallbackRedAmp'); - $sp12 = generateScatterLink($datax, $datay2,$domimage_color['team'][1][0],'FCallbackBlueAmp'); - $graph1->Add($sp11); - $graph1->Add($sp12); - - // Net rate of change per minute - $graph2 = createGraph("",$domimage_width,$g2heigth,array(30,10,5,$g2marginlow),"linlin"); - $graph2->xaxis->HideLabels(); - - $b1plot = new BarPlot($derivy1,$derivx); - $b2plot = new BarPlot($derivy2,$derivx); - - $graph2->Add($b1plot); - $graph2->Add($b2plot); - - $b1plot->SetFillGradient($domimage_color['team'][0][0],$domimage_color['team'][0][1],GRAD_HOR); - $b1plot->SetColor($domimage_color['team'][0][0]); - $b1plot->SetWidth(0.85); - $b2plot->SetFillGradient($domimage_color['team'][1][0],$domimage_color['team'][1][1],GRAD_HOR); - $b2plot->SetColor($domimage_color['team'][1][0]); - $b2plot->SetWidth(0.85); - - // If this is a cp plot, render the names - if(strlen($cp) > 0) { - renderNamesCP($tempTableName,$cp,$graph2,$domimage_width,$g2heigth); - } - - // Combine both graphs into one - $mgraph = new MGraph(); - $xpos1=0;$ypos1=0; - $xpos2=0;$ypos2=$g1heigth; - $mgraph->Add($graph1,$xpos1,$ypos1); - $mgraph->Add($graph2,$xpos2,$ypos2); - $mgraph->SetFillColor($domimage_color['background']); - - $gdImgHandler = $mgraph->Stroke(_IMG_HANDLER); - - $fileName = $domimages_folder."/".$matchid."-".$appex.".png"; - $mgraph->Stroke($fileName); -} - -/* -Helper function to parse the data for the main renderData -*/ -function parseData($query) { - $q_result = mysql_query($query) or die(mysql_error()); - - $prevx = 0; - $prevy1 = 0; - $prevy2 = 0; - $smallcounter = 1/3; - $counter = 1; - - while($data = mysql_fetch_array($q_result)) { - - // Prep data for dom points over time - // Only save the data each $smallcounter interval, to optimize rendering time - if($data[0]>=$smallcounter) { - - $datax[] = $data[0]; - $datay1[] = $data[1]; - $datay2[] = $data[2]; - - $smallcounter+=1/3; - } - - // Prep data for net change over time - // Only save the data each integer interval, since we want the value per minute - // Start at 0.5, to ensure proper alignment with graph above (cheap hack) - if($data[0]>=$counter) { - $derivx[] = $counter-1; - - $derivy1pre = $data[1]-$prevy1; - $derivy2pre = $data[2]-$prevy2; - - $derivy1post = $derivy1pre-$derivy2pre; - $derivy2post = $derivy2pre-$derivy1pre; - - $derivy1[] = $derivy1post>0 ? $derivy1post : 0; - $derivy2[] = $derivy2post>0 ? $derivy2post : 0; - - $prevy1 = $data[1]; - $prevy2 = $data[2]; - - $counter++; - } - } - - return array($datax,$datay1,$datay2,$derivx,$derivy1,$derivy2); -} - -/* -Render the names of players that played the cp -*/ -function renderNamesCP($tempTableName,$appex,$graph,$width,$height) { - global $domimage_color; - - $appex = mysql_real_escape_string($appex); - - $q_namesPerCP = mysql_query("SELECT playername, COUNT( playername ) AS cplayer, MAX( teamid ) AS tid, AVG( realTimeEnd ) AS ati FROM $tempTableName WHERE cp = '$appex' GROUP BY playername ORDER BY tid,ati") or die(mysql_error()); - - $yTeam[0][0] = 45; - $yTeam[0][1] = 35; - $yTeam[1][0] = 20; - $yTeam[1][1] = 10; - $prevTeam = -1; - - while($r_namesPerCP = mysql_fetch_array($q_namesPerCP)) { - $playerName = substr($r_namesPerCP[0],0,20); - $timesTouched = $r_namesPerCP[1]; - $teamid = $r_namesPerCP[2]; - $avgTime = $r_namesPerCP[3]; - - // Only plot the playername if he touched the cp at least 60 times - if(strlen($playerName)>0 && $timesTouched > 60) { - - $txt = new Text($playerName); - - // Names per team can be plotted on 2 different heights to ensure it doesn't become a mess on one line - // This bit of code ensures height is flipped each time - if($teamid == $prevTeam) { - $ypos = $height-$yTeam[$teamid][1]; - $prevTeam = -1; - } else { - $ypos = $height-$yTeam[$teamid][0]; - $prevTeam = $teamid; - } - - $color = $domimage_color['team'][$teamid][0]; - - // Plot name at average time, minus 25 (hack assuming most names are around 50 pixels) - $txt->SetPos($width/20*$avgTime-25,$ypos); - - $txt->SetColor($color); - $txt->SetFont(FF_VERDANA,FS_NORMAL,8); - $graph->AddText($txt); - } - - $prevAvgTime = $avgTime; - } - -} - -/* -Helper function to generate the graph object -*/ -function createGraph($title,$width,$height,$margin,$scale) { - global $domimage_color; - - $graph = new Graph($width,$height); - - $graph->SetScale($scale); - $graph->SetMargin($margin[0],$margin[1],$margin[2],$margin[3]); - $graph->SetMarginColor($domimage_color['background']); - $graph->SetColor($domimage_color['background']); - $graph->SetFrame(true,$domimage_color['background'],0); - - $graph->ygrid->SetFill(true,$domimage_color['band'][0],$domimage_color['band'][1]); - $graph->ygrid->SetColor($domimage_color['background']); - - $graph->yaxis->SetColor($domimage_color['background'],$domimage_color['font']); - $graph->xaxis->SetColor($domimage_color['background'],$domimage_color['font']); - - if(strlen($title)>0) { - $graph->title->Set($title); - $graph->title->SetFont(FF_VERDANA,FS_BOLD); - $graph->title->SetColor($domimage_color['heading']); - } - return $graph; -} - -/* -Helper function to generate the scatter plots -*/ -function generateScatterLink($datax, $datay, $color,$callback) { - $sp = new ScatterPlot($datay,$datax); - - $sp->link->Show(); - $sp->link->SetStyle('solid'); - $sp->link->SetWeight(3); - $sp->link->SetColor($color); - - if(strlen($callback) > 0) - $sp->mark->SetCallbackYX($callback); - - $sp->mark->SetType(MARK_FILLEDCIRCLE); - - return $sp; -} - -/* -Format functions for scatterplot to format based on team and whether amp was taken -*/ -function FCallbackRedAmp($bVal,$aVal) { - return FCallbackAmp($aVal,0); -} - -function FCallbackBlueAmp($bVal,$aVal) { - return FCallbackAmp($aVal,1); -} - -function FCallbackAmp($aVal, $team) { - global $ampTimes; - global $domimage_color; - - $size = 1; - $color = $domimage_color['team'][$team][0]; - - foreach ($ampTimes[$team] as $ampTaken) { - - if($aVal > $ampTaken[0] && $aVal < $ampTaken[1]) { - - $color = $domimage_color['amp']; - $size = 3; - break; - } - } - - return array($size,$color,$color); -} - -/* -Helper function to sort array on key, based on solution from the interwebs -*/ -function array_sort($array, $on) { - $new_array = array(); - $sortable_array = array(); - - if (count($array) > 0) { - foreach ($array as $k => $v) { - if (is_array($v)) { - foreach ($v as $k2 => $v2) { - if ($k2 == $on) { - $sortable_array[$k] = $v2; - } - } - } else { - $sortable_array[$k] = $v; - } - } - - asort($sortable_array); - - foreach ($sortable_array as $k => $v) { - $new_array[$k] = $array[$k]; - } - } - - return $new_array; -} -?> \ No newline at end of file diff --git a/html/jpgraph/.htaccess b/html/jpgraph/.htaccess deleted file mode 100644 index 438cccd..0000000 --- a/html/jpgraph/.htaccess +++ /dev/null @@ -1,10 +0,0 @@ -#------------------------------------------------------------------------------ -# Server root folder www .htaccess -# This file provides server security limiting access to the localhost only. -# Comment next four lines to deactivate. (Allows external access) -#------------------------------------------------------------------------------ - -Order Deny,Allow -Deny from all -Allow from 127.0.0.1 -Allow from ::1 diff --git a/html/jpgraph/d2utmpFU7H53 b/html/jpgraph/d2utmpFU7H53 deleted file mode 100644 index ee01669..0000000 --- a/html/jpgraph/d2utmpFU7H53 +++ /dev/null @@ -1,1190 +0,0 @@ -numpoints; - } - - //--------------- - // PUBLIC METHODS - - // Set a drop shadow for the bar (or rather an "up-right" shadow) - function SetShadow($aColor="black",$aHSize=3,$aVSize=3,$aShow=true) { - $this->bar_shadow=$aShow; - $this->bar_shadow_color=$aColor; - $this->bar_shadow_vsize=$aVSize; - $this->bar_shadow_hsize=$aHSize; - - // Adjust the value margin to compensate for shadow - $this->value->margin += $aVSize; - } - - function Set3D($aHSize=3,$aVSize=3,$aShow=true) { - $this->bar_3d=$aShow; - $this->bar_3d_vsize=$aVSize; - $this->bar_3d_hsize=$aHSize; - - $this->value->margin += $aVSize; - } - - // DEPRECATED use SetYBase instead - function SetYMin($aYStartValue) { - //die("JpGraph Error: Deprecated function SetYMin. Use SetYBase() instead."); - $this->ybase=$aYStartValue; - } - - // Specify the base value for the bars - function SetYBase($aYStartValue) { - $this->ybase=$aYStartValue; - } - - // The method will take the specified pattern anre - // return a pattern index that corresponds to the original - // patterm being rotated 90 degreees. This is needed when plottin - // Horizontal bars - function RotatePattern($aPat,$aRotate=true) { - $rotate = array(1 => 2, 2 => 1, 3 => 3, 4 => 5, 5 => 4, 6 => 6, 7 => 7, 8 => 8); - if( $aRotate ) { - return $rotate[$aPat]; - } - else { - return $aPat; - } - } - - function Legend($graph) { - if( $this->grad && $this->legend!="" && !$this->fill ) { - $color=array($this->grad_fromcolor,$this->grad_tocolor); - // In order to differentiate between gradients and cooors specified as an RGB triple - $graph->legend->Add($this->legend,$color,"",-$this->grad_style, - $this->legendcsimtarget,$this->legendcsimalt,$this->legendcsimwintarget); - } - elseif( $this->legend!="" && ($this->iPattern > -1 || is_array($this->iPattern)) ) { - if( is_array($this->iPattern) ) { - $p1 = $this->RotatePattern( $this->iPattern[0], $graph->img->a == 90 ); - $p2 = $this->iPatternColor[0]; - $p3 = $this->iPatternDensity[0]; - } - else { - $p1 = $this->RotatePattern( $this->iPattern, $graph->img->a == 90 ); - $p2 = $this->iPatternColor; - $p3 = $this->iPatternDensity; - } - if( $p3 < 90 ) $p3 += 5; - $color = array($p1,$p2,$p3,$this->fill_color); - // A kludge: Too mark that we add a pattern we use a type value of < 100 - $graph->legend->Add($this->legend,$color,"",-101, - $this->legendcsimtarget,$this->legendcsimalt,$this->legendcsimwintarget); - } - elseif( $this->fill_color && $this->legend!="" ) { - if( is_array($this->fill_color) ) { - $graph->legend->Add($this->legend,$this->fill_color[0],"",0, - $this->legendcsimtarget,$this->legendcsimalt,$this->legendcsimwintarget); - } - else { - $graph->legend->Add($this->legend,$this->fill_color,"",0, - $this->legendcsimtarget,$this->legendcsimalt,$this->legendcsimwintarget); - } - } - } - - // Gets called before any axis are stroked - function PreStrokeAdjust($graph) { - parent::PreStrokeAdjust($graph); - - // If we are using a log Y-scale we want the base to be at the - // minimum Y-value unless the user have specifically set some other - // value than the default. - if( substr($graph->axtype,-3,3)=="log" && $this->ybase==0 ) - $this->ybase = $graph->yaxis->scale->GetMinVal(); - - // For a "text" X-axis scale we will adjust the - // display of the bars a little bit. - if( substr($graph->axtype,0,3)=="tex" ) { - // Position the ticks between the bars - $graph->xaxis->scale->ticks->SetXLabelOffset(0.5,0); - - // Center the bars - if( $this->abswidth > -1 ) { - $graph->SetTextScaleAbsCenterOff($this->abswidth); - } - else { - if( $this->align == "center" ) - $graph->SetTextScaleOff(0.5-$this->width/2); - elseif( $this->align == "right" ) - $graph->SetTextScaleOff(1-$this->width); - } - } - elseif( ($this instanceof AccBarPlot) || ($this instanceof GroupBarPlot) ) { - // We only set an absolute width for linear and int scale - // for text scale the width will be set to a fraction of - // the majstep width. - if( $this->abswidth == -1 ) { - // Not set - // set width to a visuable sensible default - $this->abswidth = $graph->img->plotwidth/(2*$this->numpoints); - } - } - } - - function Min() { - $m = parent::Min(); - if( $m[1] >= $this->ybase ) $m[1] = $this->ybase; - return $m; - } - - function Max() { - $m = parent::Max(); - if( $m[1] <= $this->ybase ) $m[1] = $this->ybase; - return $m; - } - - // Specify width as fractions of the major stepo size - function SetWidth($aWidth) { - if( $aWidth > 1 ) { - // Interpret this as absolute width - $this->abswidth=$aWidth; - } - else { - $this->width=$aWidth; - } - } - - // Specify width in absolute pixels. If specified this - // overrides SetWidth() - function SetAbsWidth($aWidth) { - $this->abswidth=$aWidth; - } - - function SetAlign($aAlign) { - $this->align=$aAlign; - } - - function SetNoFill() { - $this->grad = false; - $this->fill_color=false; - $this->fill=false; - } - - function SetFillColor($aColor) { - // Do an extra error check if the color is specified as an RGB array triple - // In that case convert it to a hex string since it will otherwise be - // interpretated as an array of colors for each individual bar. - - $aColor = RGB::tryHexConversion($aColor); - $this->fill = true ; - $this->fill_color=$aColor; - - } - - function SetFillGradient($aFromColor,$aToColor=null,$aStyle=null) { - $this->grad = true; - $this->grad_fromcolor = $aFromColor; - $this->grad_tocolor = $aToColor; - $this->grad_style = $aStyle; - } - - function SetValuePos($aPos) { - $this->valuepos = $aPos; - } - - function SetPattern($aPattern, $aColor='black'){ - if( is_array($aPattern) ) { - $n = count($aPattern); - $this->iPattern = array(); - $this->iPatternDensity = array(); - if( is_array($aColor) ) { - $this->iPatternColor = array(); - if( count($aColor) != $n ) { - JpGraphError::RaiseL(2001);//('NUmber of colors is not the same as the number of patterns in BarPlot::SetPattern()'); - } - } - else { - $this->iPatternColor = $aColor; - } - for( $i=0; $i < $n; ++$i ) { - $this->_SetPatternHelper($aPattern[$i], $this->iPattern[$i], $this->iPatternDensity[$i]); - if( is_array($aColor) ) { - $this->iPatternColor[$i] = $aColor[$i]; - } - } - } - else { - $this->_SetPatternHelper($aPattern, $this->iPattern, $this->iPatternDensity); - $this->iPatternColor = $aColor; - } - } - - function _SetPatternHelper($aPattern, &$aPatternValue, &$aDensity){ - switch( $aPattern ) { - case PATTERN_DIAG1: - $aPatternValue= 1; - $aDensity = 92; - break; - case PATTERN_DIAG2: - $aPatternValue= 1; - $aDensity = 78; - break; - case PATTERN_DIAG3: - $aPatternValue= 2; - $aDensity = 92; - break; - case PATTERN_DIAG4: - $aPatternValue= 2; - $aDensity = 78; - break; - case PATTERN_CROSS1: - $aPatternValue= 8; - $aDensity = 90; - break; - case PATTERN_CROSS2: - $aPatternValue= 8; - $aDensity = 78; - break; - case PATTERN_CROSS3: - $aPatternValue= 8; - $aDensity = 65; - break; - case PATTERN_CROSS4: - $aPatternValue= 7; - $aDensity = 90; - break; - case PATTERN_STRIPE1: - $aPatternValue= 5; - $aDensity = 94; - break; - case PATTERN_STRIPE2: - $aPatternValue= 5; - $aDensity = 85; - break; - default: - JpGraphError::RaiseL(2002); - //('Unknown pattern specified in call to BarPlot::SetPattern()'); - } - } - - function Stroke($img,$xscale,$yscale) { - - $numpoints = count($this->coords[0]); - if( isset($this->coords[1]) ) { - if( count($this->coords[1])!=$numpoints ) { - JpGraphError::RaiseL(2003,count($this->coords[1]),$numpoints); - //"Number of X and Y points are not equal. Number of X-points:".count($this->coords[1])."Number of Y-points:$numpoints"); - } - else { - $exist_x = true; - } - } - else { - $exist_x = false; - } - - - $numbars=count($this->coords[0]); - - // Use GetMinVal() instead of scale[0] directly since in the case - // of log scale we get a correct value. Log scales will have negative - // values for values < 1 while still not representing negative numbers. - if( $yscale->GetMinVal() >= 0 ) - $zp=$yscale->scale_abs[0]; - else { - $zp=$yscale->Translate(0); - } - - if( $this->abswidth > -1 ) { - $abswidth=$this->abswidth; - } - else { - $abswidth=round($this->width*$xscale->scale_factor,0); - } - - // Count pontetial pattern array to avoid doing the count for each iteration - if( is_array($this->iPattern) ) { - $np = count($this->iPattern); - } - - $grad = null; - for($i=0; $i < $numbars; ++$i) { - - // If value is NULL, or 0 then don't draw a bar at all - if ($this->coords[0][$i] === null || $this->coords[0][$i] === '' ) - continue; - - if( $exist_x ) { - $x=$this->coords[1][$i]; - } - else { - $x=$i; - } - - $x=$xscale->Translate($x); - - // Comment Note: This confuses the positioning when using acc together with - // grouped bars. Workaround for fixing #191 - /* - if( !$xscale->textscale ) { - if($this->align=="center") - $x -= $abswidth/2; - elseif($this->align=="right") - $x -= $abswidth; - } - */ - // Stroke fill color and fill gradient - $pts=array( - $x,$zp, - $x,$yscale->Translate($this->coords[0][$i]), - $x+$abswidth,$yscale->Translate($this->coords[0][$i]), - $x+$abswidth,$zp); - if( $this->grad ) { - if( $grad === null ) { - $grad = new Gradient($img); - } - if( is_array($this->grad_fromcolor) ) { - // The first argument (grad_fromcolor) can be either an array or a single color. If it is an array - // then we have two choices. It can either a) be a single color specified as an RGB triple or it can be - // an array to specify both (from, to style) for each individual bar. The way to know the difference is - // to investgate the first element. If this element is an integer [0,255] then we assume it is an RGB - // triple. - $ng = count($this->grad_fromcolor); - if( $ng === 3 ) { - if( is_numeric($this->grad_fromcolor[0]) && $this->grad_fromcolor[0] > 0 && $this->grad_fromcolor[0] < 256 ) { - // RGB Triple - $fromcolor = $this->grad_fromcolor; - $tocolor = $this->grad_tocolor; - $style = $this->grad_style; - } - else { - $fromcolor = $this->grad_fromcolor[$i % $ng][0]; - $tocolor = $this->grad_fromcolor[$i % $ng][1]; - $style = $this->grad_fromcolor[$i % $ng][2]; - } - } - else { - $fromcolor = $this->grad_fromcolor[$i % $ng][0]; - $tocolor = $this->grad_fromcolor[$i % $ng][1]; - $style = $this->grad_fromcolor[$i % $ng][2]; - } - $grad->FilledRectangle($pts[2],$pts[3], - $pts[6],$pts[7], - $fromcolor,$tocolor,$style); - } - else { - $grad->FilledRectangle($pts[2],$pts[3], - $pts[6],$pts[7], - $this->grad_fromcolor,$this->grad_tocolor,$this->grad_style); - } - } - elseif( !empty($this->fill_color) ) { - if(is_array($this->fill_color)) { - $img->PushColor($this->fill_color[$i % count($this->fill_color)]); - } else { - $img->PushColor($this->fill_color); - } - $img->FilledPolygon($pts); - $img->PopColor(); - } - -/////////////////////////kokorahen rectangle polygon////////////////////// - - // Remember value of this bar - $val=$this->coords[0][$i]; - - if( !empty($val) && !is_numeric($val) ) { - JpGraphError::RaiseL(2004,$i,$val); - //'All values for a barplot must be numeric. You have specified value['.$i.'] == \''.$val.'\''); - } - - // Determine the shadow - if( $this->bar_shadow && $val != 0) { - - $ssh = $this->bar_shadow_hsize; - $ssv = $this->bar_shadow_vsize; - // Create points to create a "upper-right" shadow - if( $val > 0 ) { - $sp[0]=$pts[6]; $sp[1]=$pts[7]; - $sp[2]=$pts[4]; $sp[3]=$pts[5]; - $sp[4]=$pts[2]; $sp[5]=$pts[3]; - $sp[6]=$pts[2]+$ssh; $sp[7]=$pts[3]-$ssv; - $sp[8]=$pts[4]+$ssh; $sp[9]=$pts[5]-$ssv; - $sp[10]=$pts[6]+$ssh; $sp[11]=$pts[7]-$ssv; - } - elseif( $val < 0 ) { - $sp[0]=$pts[4]; $sp[1]=$pts[5]; - $sp[2]=$pts[6]; $sp[3]=$pts[7]; - $sp[4]=$pts[0]; $sp[5]=$pts[1]; - $sp[6]=$pts[0]+$ssh; $sp[7]=$pts[1]-$ssv; - $sp[8]=$pts[6]+$ssh; $sp[9]=$pts[7]-$ssv; - $sp[10]=$pts[4]+$ssh; $sp[11]=$pts[5]-$ssv; - } - if( is_array($this->bar_shadow_color) ) { - $numcolors = count($this->bar_shadow_color); - if( $numcolors == 0 ) { - JpGraphError::RaiseL(2005);//('You have specified an empty array for shadow colors in the bar plot.'); - } - $img->PushColor($this->bar_shadow_color[$i % $numcolors]); - } - else { - $img->PushColor($this->bar_shadow_color); - } - $img->FilledPolygon($sp); - $img->PopColor(); - - } elseif( $this->bar_3d && $val != 0) { - // Determine the 3D - - $ssh = $this->bar_3d_hsize; - $ssv = $this->bar_3d_vsize; - - // Create points to create a "upper-right" shadow - if( $val > 0 ) { - $sp1[0]=$pts[6]; $sp1[1]=$pts[7]; - $sp1[2]=$pts[4]; $sp1[3]=$pts[5]; - $sp1[4]=$pts[4]+$ssh; $sp1[5]=$pts[5]-$ssv; - $sp1[6]=$pts[6]+$ssh; $sp1[7]=$pts[7]-$ssv; - - $sp2[0]=$pts[4]; $sp2[1]=$pts[5]; - $sp2[2]=$pts[2]; $sp2[3]=$pts[3]; - $sp2[4]=$pts[2]+$ssh; $sp2[5]=$pts[3]-$ssv; - $sp2[6]=$pts[4]+$ssh; $sp2[7]=$pts[5]-$ssv; - - } - elseif( $val < 0 ) { - $sp1[0]=$pts[4]; $sp1[1]=$pts[5]; - $sp1[2]=$pts[6]; $sp1[3]=$pts[7]; - $sp1[4]=$pts[6]+$ssh; $sp1[5]=$pts[7]-$ssv; - $sp1[6]=$pts[4]+$ssh; $sp1[7]=$pts[5]-$ssv; - - $sp2[0]=$pts[6]; $sp2[1]=$pts[7]; - $sp2[2]=$pts[0]; $sp2[3]=$pts[1]; - $sp2[4]=$pts[0]+$ssh; $sp2[5]=$pts[1]-$ssv; - $sp2[6]=$pts[6]+$ssh; $sp2[7]=$pts[7]-$ssv; - } - - $base_color = $this->fill_color; - - $img->PushColor($base_color . ':0.7'); - $img->FilledPolygon($sp1); - $img->PopColor(); - - $img->PushColor($base_color . ':1.1'); - $img->FilledPolygon($sp2); - $img->PopColor(); - } - - // Stroke the pattern - if( is_array($this->iPattern) ) { - $f = new RectPatternFactory(); - if( is_array($this->iPatternColor) ) { - $pcolor = $this->iPatternColor[$i % $np]; - } - else { - $pcolor = $this->iPatternColor; - } - $prect = $f->Create($this->iPattern[$i % $np],$pcolor,1); - $prect->SetDensity($this->iPatternDensity[$i % $np]); - - if( $val < 0 ) { - $rx = $pts[0]; - $ry = $pts[1]; - } - else { - $rx = $pts[2]; - $ry = $pts[3]; - } - $width = abs($pts[4]-$pts[0])+1; - $height = abs($pts[1]-$pts[3])+1; - $prect->SetPos(new Rectangle($rx,$ry,$width,$height)); - $prect->Stroke($img); - } - else { - if( $this->iPattern > -1 ) { - $f = new RectPatternFactory(); - $prect = $f->Create($this->iPattern,$this->iPatternColor,1); - $prect->SetDensity($this->iPatternDensity); - if( $val < 0 ) { - $rx = $pts[0]; - $ry = $pts[1]; - } - else { - $rx = $pts[2]; - $ry = $pts[3]; - } - $width = abs($pts[4]-$pts[0])+1; - $height = abs($pts[1]-$pts[3])+1; - $prect->SetPos(new Rectangle($rx,$ry,$width,$height)); - $prect->Stroke($img); - } - } - - // Stroke the outline of the bar - if( is_array($this->color) ) { - $img->SetColor($this->color[$i % count($this->color)]); - } - else { - $img->SetColor($this->color); - } - - $pts[] = $pts[0]; - $pts[] = $pts[1]; - - if( $this->weight > 0 ) { - $img->SetLineWeight($this->weight); - $img->Polygon($pts); - } - - // Determine how to best position the values of the individual bars - $x=$pts[2]+($pts[4]-$pts[2])/2; - $this->value->SetMargin(5); - - if( $this->valuepos=='top' ) { - $y=$pts[3]; - if( $img->a === 90 ) { - if( $val < 0 ) { - $this->value->SetAlign('right','center'); - } - else { - $this->value->SetAlign('left','center'); - } - - } - else { - if( $val < 0 ) { - $this->value->SetMargin(-5); - $y=$pts[1]; - $this->value->SetAlign('center','bottom'); - } - else { - $this->value->SetAlign('center','bottom'); - } - - } - $this->value->Stroke($img,$val,$x,$y); - } - elseif( $this->valuepos=='max' ) { - $y=$pts[3]; - if( $img->a === 90 ) { - if( $val < 0 ) - $this->value->SetAlign('left','center'); - else - $this->value->SetAlign('right','center'); - } - else { - if( $val < 0 ) { - $this->value->SetAlign('center','bottom'); - } - else { - $this->value->SetAlign('center','top'); - } - } - $this->value->SetMargin(-5); - $this->value->Stroke($img,$val,$x,$y); - } - elseif( $this->valuepos=='center' ) { - $y = ($pts[3] + $pts[1])/2; - $this->value->SetAlign('center','center'); - $this->value->SetMargin(0); - $this->value->Stroke($img,$val,$x,$y); - } - elseif( $this->valuepos=='bottom' || $this->valuepos=='min' ) { - $y=$pts[1]; - if( $img->a === 90 ) { - if( $val < 0 ) - $this->value->SetAlign('right','center'); - else - $this->value->SetAlign('left','center'); - } - $this->value->SetMargin(3); - $this->value->Stroke($img,$val,$x,$y); - } - else { - JpGraphError::RaiseL(2006,$this->valuepos); - //'Unknown position for values on bars :'.$this->valuepos); - } - // Create the client side image map - $rpts = $img->ArrRotate($pts); - $csimcoord=round($rpts[0]).", ".round($rpts[1]); - for( $j=1; $j < 4; ++$j){ - $csimcoord .= ", ".round($rpts[2*$j]).", ".round($rpts[2*$j+1]); - } - if( !empty($this->csimtargets[$i]) ) { - $this->csimareas .= 'csimareas .= " href=\"".htmlentities($this->csimtargets[$i])."\""; - - if( !empty($this->csimwintargets[$i]) ) { - $this->csimareas .= " target=\"".$this->csimwintargets[$i]."\" "; - } - - $sval=''; - if( !empty($this->csimalts[$i]) ) { - $sval=sprintf($this->csimalts[$i],$this->coords[0][$i]); - $this->csimareas .= " title=\"$sval\" alt=\"$sval\" "; - } - $this->csimareas .= " />\n"; - } - } - return true; - } -} // Class - -//=================================================== -// CLASS GroupBarPlot -// Description: Produce grouped bar plots -//=================================================== -class GroupBarPlot extends BarPlot { - public $plots; - private $nbrplots=0; - //--------------- - // CONSTRUCTOR - function GroupBarPlot($plots) { - $this->width=0.7; - $this->plots = $plots; - $this->nbrplots = count($plots); - if( $this->nbrplots < 1 ) { - JpGraphError::RaiseL(2007);//('Cannot create GroupBarPlot from empty plot array.'); - } - for($i=0; $i < $this->nbrplots; ++$i ) { - if( empty($this->plots[$i]) || !isset($this->plots[$i]) ) { - JpGraphError::RaiseL(2008,$i);//("Group bar plot element nbr $i is undefined or empty."); - } - } - $this->numpoints = $plots[0]->numpoints; - $this->width=0.7; - } - - //--------------- - // PUBLIC METHODS - function Legend($graph) { - $n = count($this->plots); - for($i=0; $i < $n; ++$i) { - $c = get_class($this->plots[$i]); - if( !($this->plots[$i] instanceof BarPlot) ) { - JpGraphError::RaiseL(2009,$c); - //('One of the objects submitted to GroupBar is not a BarPlot. Make sure that you create the Group Bar plot from an array of BarPlot or AccBarPlot objects. (Class = '.$c.')'); - } - $this->plots[$i]->DoLegend($graph); - } - } - - function Min() { - list($xmin,$ymin) = $this->plots[0]->Min(); - $n = count($this->plots); - for($i=0; $i < $n; ++$i) { - list($xm,$ym) = $this->plots[$i]->Min(); - $xmin = max($xmin,$xm); - $ymin = min($ymin,$ym); - } - return array($xmin,$ymin); - } - - function Max() { - list($xmax,$ymax) = $this->plots[0]->Max(); - $n = count($this->plots); - for($i=0; $i < $n; ++$i) { - list($xm,$ym) = $this->plots[$i]->Max(); - $xmax = max($xmax,$xm); - $ymax = max($ymax,$ym); - } - return array($xmax,$ymax); - } - - function GetCSIMareas() { - $n = count($this->plots); - $csimareas=''; - for($i=0; $i < $n; ++$i) { - $csimareas .= $this->plots[$i]->csimareas; - } - return $csimareas; - } - - // Stroke all the bars next to each other - function Stroke($img,$xscale,$yscale) { - $tmp=$xscale->off; - $n = count($this->plots); - $subwidth = $this->width/$this->nbrplots ; - - for( $i=0; $i < $n; ++$i ) { - $this->plots[$i]->ymin=$this->ybase; - $this->plots[$i]->SetWidth($subwidth); - - // If the client have used SetTextTickInterval() then - // major_step will be > 1 and the positioning will fail. - // If we assume it is always one the positioning will work - // fine with a text scale but this will not work with - // arbitrary linear scale - $xscale->off = $tmp+$i*round($xscale->scale_factor* $subwidth); - $this->plots[$i]->Stroke($img,$xscale,$yscale); - } - $xscale->off=$tmp; - } -} // Class - -//=================================================== -// CLASS AccBarPlot -// Description: Produce accumulated bar plots -//=================================================== -class AccBarPlot extends BarPlot { - public $plots=null; - private $nbrplots=0; - //--------------- - // CONSTRUCTOR - function __construct($plots) { - $this->plots = $plots; - $this->nbrplots = count($plots); - if( $this->nbrplots < 1 ) { - JpGraphError::RaiseL(2010);//('Cannot create AccBarPlot from empty plot array.'); - } - for($i=0; $i < $this->nbrplots; ++$i ) { - if( empty($this->plots[$i]) || !isset($this->plots[$i]) ) { - JpGraphError::RaiseL(2011,$i);//("Acc bar plot element nbr $i is undefined or empty."); - } - } - - // We can only allow individual plost which do not have specified X-positions - for($i=0; $i < $this->nbrplots; ++$i ) { - if( !empty($this->plots[$i]->coords[1]) ) { - JpGraphError::RaiseL(2015); - //'Individual bar plots in an AccBarPlot or GroupBarPlot can not have specified X-positions.'); - } - } - - // Use 0 weight by defau