Location: PHPKode > projects > PACSPulse > chartsumgen.php
<?php

/* 
PAC Pulse (PACS Perfomance optimization tool)
Copyright (C) 2001 Medical College of Wisconsin

This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
include("phplot.php");
include ("globalvars.php");

$daynum=1;
$scaler=1;
switch ($D)
{
    case "W":
    $daynum=7;
    $scaler=10;
    break;
    case "M":
    $daynum=30;
    $scaler=100;    
    break;
    case "Y":
    $daynum=365;
    $scaler=1000;    
    break;
    default:
    $daynum=1;
    $scaler=1;
}  
//Define the object
switch ($Typ)
{
    case 1:
	$graph = new PHPlot(350,250);
	$graph->SetPrintImage(0);
	$db = mysql_select_db("pulsetest", $connection) or die ("Couldn't connect to DB Radtracker");
	$sql_command = "select hour(timestamp),count(distinct StudyUID),format(avg(rate)/1000,1) from test where txrx='rx' and dayofyear(timestamp)>(dayofyear(CURRENT_DATE)-$daynum) group by hour(timestamp)";
	$sql_result = mysql_query($sql_command,$connection) or die (mysql_error());
	$max=0;
	$max2=0;
	while ($row = mysql_fetch_array($sql_result)) {
		$example_data[]=array($row[0],$row[1]);
		$example_data2[]=array($row[0],$row[2]);
		if ($row[1]>$max){$max=$row[1];}
		if ($row[2]>$max2){$max2=$row[2];}
	}
	$grinc=number_format($max/(4*$scaler),0)*$scaler;
	$grinc2=number_format($max2/4,1);
	//Set some data
	$graph->SetDataValues($example_data);
	//$graph->SetXLabel('Hour of Day');
	$graph->SetXDataLabelAngle(90);
	//$graph->SetXDataLabelAngle(90);
	$graph->SetYLabel('Number of Studies');
	$graph->SetPrecisionY("0");
	$graph->SetTitleFontSize("2");
	$graph->SetTitle('Incoming study analysis as hour of the day');
	$graph->SetPlotType('bars');
	$graph->SetXDataLabelMaxlength(4);
	$graph->SetVertTickIncrement("$grinc");
	//Draw it
	$graph->SetIsInline("1");  
	$graph->SetFileFormat("");
	$graph->SetBackgroundColor("white");
	$graph->DrawGraph();
	
	$graph->SetVertTickIncrement("1.25");
	$graph->SetDataValues($example_data2);
	$graph->SetDataColors(array("red"),array("green"));
	$arrsize=sizeof($example_data2);
	$graph->SetDrawXDataLabels(0); //We already got them in the first graph
	$graph->SetPlotAreaWorld(0,0,$arrsize,8.5); //New Plot Area
	$graph->SetLegend(array('Performance (MB/S)')); //Lets add a second legend
	$graph->DrawLegend(80,25,'');

	//Set Params of another Y Axis
	$graph->SetVertTickPosition('yaxis');
	$graph->SetYAxisPosition($arrsize*1.17);
	$graph->SetPrecisionY("1");
	$graph->SetTickColor('white');
	$graph->SetTextColor('red');
	$graph->SetGridColor('white');
	$graph->DrawYAxis();
	$graph->SetFileFormat('');

	//Draw the New data over the first graph
	$graph->DrawLines();
	$graph->DrawDots();
	$graph->PrintImage();
	break;
    case 2:
	$graph = new PHPlot(350,250);
	$graph->SetPrintImage(0);
	$db = mysql_select_db("pulsetest", $connection) or die ("Couldn't connect to DB Radtracker");
	$sql_command = "select hour(timestamp),count(distinct StudyUID),format(avg(rate)/1000,1) from test where txrx='tx' and dayofyear(timestamp)>(dayofyear(CURRENT_DATE)-$daynum) group by hour(timestamp)";
	$sql_result = mysql_query($sql_command,$connection) or die (mysql_error());
	$max=0;
	$max2=0;
	while ($row = mysql_fetch_array($sql_result)) {
		$example_data[]=array($row[0],$row[1]);
		$example_data2[]=array($row[0],$row[2]);
		if ($row[1]>$max){$max=$row[1];}
		if ($row[2]>$max2){$max2=$row[2];}
	}
	$grinc=number_format($max/(4*$scaler),0)*$scaler;
	$grinc2=number_format($max2/4,1);	//Set some data
	$graph->SetXDataLabelAngle(90);
	$graph->SetDataValues($example_data);
	//$graph->SetXLabel('Hour of Day');
	//$graph->SetXDataLabelAngle(90);
	$graph->SetYLabel('Number of Studies');
	$graph->SetPrecisionY("0");
	$graph->SetTitleFontSize("2");
	$graph->SetTitle('Outgoing study analysis as hour of the day');
	$graph->SetPlotType('bars');
	$graph->SetXDataLabelMaxlength(4);
	$graph->SetVertTickIncrement("$grinc");
	//Draw it
	$graph->SetIsInline("1");  
	$graph->SetFileFormat("");
	$graph->SetBackgroundColor("white");
	$graph->DrawGraph();

	$graph->SetVertTickIncrement("1.25");
	$graph->SetDataValues($example_data2);
	$graph->SetDataColors(array("red"),array("green"));
	$arrsize=sizeof($example_data2);
	$graph->SetDrawXDataLabels(0); //We already got them in the first graph
	$graph->SetPlotAreaWorld(0,0,$arrsize,8.5); //New Plot Area
	$graph->SetLegend(array('Performance (MB/S)')); //Lets add a second legend
	$graph->DrawLegend(80,25,'');

	//Set Params of another Y Axis
	$graph->SetVertTickPosition('yaxis');
	$graph->SetYAxisPosition($arrsize*1.17);
	$graph->SetPrecisionY("1");
	$graph->SetTickColor('white');
	$graph->SetTextColor('red');
	$graph->SetGridColor('white');
	$graph->DrawYAxis();
	$graph->SetFileFormat('');

	//Draw the New data over the first graph
	$graph->DrawLines();
	$graph->DrawDots();
	$graph->PrintImage();
	break;

    case 3:
	$graph = new PHPlot(350,250);
	$graph->SetPrintImage(0);
	$db = mysql_select_db("pulsetest", $connection) or die ("Couldn't connect to DB Radtracker");
	$sql_command = "select typeMod,count(distinct StudyUID),format(avg(rate)/1000,1) from test where txrx='rx' and dayofyear(timestamp)>(dayofyear(CURRENT_DATE)-$daynum) group by typeMod";
	$sql_result = mysql_query($sql_command,$connection) or die (mysql_error());
	$max=0;
	$max2=0;
	while ($row = mysql_fetch_array($sql_result)) {
		$example_data[]=array($row[0],$row[1]);
		$example_data2[]=array($row[0],$row[2]);
		if ($row[1]>$max){$max=$row[1];}
		if ($row[2]>$max2){$max2=$row[2];}
	}
	$grinc=number_format($max/(4*$scaler),0)*$scaler;
	$grinc2=number_format($max2/4,1);	//Set some data
	$graph->SetDataValues($example_data);
	$graph->SetXLabel('Modality');
	$graph->SetYLabel('Number of Studies');
	$graph->SetPrecisionY("0");
	$graph->SetTitleFontSize("2");
	$graph->SetVertTickIncrement("10");
	$graph->SetTitle('Incoming Modality Analysis');
	$graph->SetPlotType('bars');
	$graph->SetXDataLabelMaxlength(4);
	$graph->SetVertTickIncrement("$grinc");
	//Draw it
	$graph->SetIsInline("1");  
	$graph->SetFileFormat("");
	$graph->SetBackgroundColor("white");
	$graph->DrawGraph();

	$graph->SetVertTickIncrement("1.25");
	$graph->SetDataValues($example_data2);
	$graph->SetDataColors(array("red"),array("green"));
	$arrsize=sizeof($example_data2);
	$graph->SetDrawXDataLabels(0); //We already got them in the first graph
	$graph->SetPlotAreaWorld(0,0,$arrsize,8.5); //New Plot Area
	$graph->SetLegend(array('Performance (MB/S)')); //Lets add a second legend
	$graph->DrawLegend(80,25,'');

	//Set Params of another Y Axis
	$graph->SetVertTickPosition('yaxis');
	$graph->SetYAxisPosition($arrsize*1.17);
	$graph->SetPrecisionY("1");
	$graph->SetTickColor('white');
	$graph->SetTextColor('red');
	$graph->SetGridColor('white');
	$graph->DrawYAxis();
	$graph->SetFileFormat('');

	//Draw the New data over the first graph
	$graph->DrawLines();
	$graph->DrawDots();
	$graph->PrintImage();
	break;
  case 4:
	$graph = new PHPlot(350,250);
	$graph->SetPrintImage(0);
	$db = mysql_select_db("pulsetest", $connection) or die ("Couldn't connect to DB Radtracker");
	$sql_command = "select typeMod,count(distinct StudyUID),format(avg(rate)/1000,1) from test where txrx='tx' and dayofyear(timestamp)>(dayofyear(CURRENT_DATE)-$daynum) group by typeMod";
	$sql_result = mysql_query($sql_command,$connection) or die (mysql_error());
	$max=0;
	$max2=0;
	while ($row = mysql_fetch_array($sql_result)) {
		$example_data[]=array($row[0],$row[1]);
		$example_data2[]=array($row[0],$row[2]);
		if ($row[1]>$max){$max=$row[1];}
		if ($row[2]>$max2){$max2=$row[2];}
	}
	$grinc=number_format($max/(4*$scaler),0)*$scaler;
	$grinc2=number_format($max2/4,1);
	//Set some data
	$graph->SetDataValues($example_data);
	$graph->SetXLabel('Modality');
	$graph->SetYLabel('Number of Studies');
	$graph->SetPrecisionY("0");
	$graph->SetTitleFontSize("2");
	$graph->SetVertTickIncrement("10");
	$graph->SetTitle('Outgoing Modality Analysis');
	$graph->SetPlotType('bars');
	$graph->SetXDataLabelMaxlength(4);
	$graph->SetVertTickIncrement("$grinc");
	//Draw it
	$graph->SetIsInline("1");  
	$graph->SetFileFormat("");
	$graph->SetBackgroundColor("white");
	$graph->DrawGraph();

	$graph->SetVertTickIncrement("1.25");
	$graph->SetDataValues($example_data2);
	$graph->SetDataColors(array("red"),array("green"));
	$arrsize=sizeof($example_data2);
	$graph->SetDrawXDataLabels(0); //We already got them in the first graph
	$graph->SetPlotAreaWorld(0,0,$arrsize,8.5); //New Plot Area
	$graph->SetLegend(array('Performance (MB/S)')); //Lets add a second legend
	$graph->DrawLegend(80,25,'');

	//Set Params of another Y Axis
	$graph->SetVertTickPosition('yaxis');
	$graph->SetYAxisPosition($arrsize*1.17);
	$graph->SetPrecisionY("1");
	$graph->SetTickColor('white');
	$graph->SetTextColor('red');
	$graph->SetGridColor('white');
	$graph->DrawYAxis();
	$graph->SetFileFormat('');

	//Draw the New data over the first graph
	$graph->DrawLines();
	$graph->DrawDots();
	$graph->PrintImage();
	break;
   case 5:
	$graph = new PHPlot(350,250);
	$graph->SetPrintImage(0);
	$db = mysql_select_db("pulsetest", $connection) or die ("Couldn't connect to DB Radtracker");
	$sql_command = "select nameMod,count(distinct StudyUID),format(avg(rate)/1000,1) from test where txrx='rx' and dayofyear(timestamp)>(dayofyear(CURRENT_DATE)-$daynum) group by nameMod";
	$sql_result = mysql_query($sql_command,$connection) or die (mysql_error());
	$max=0;
	$max2=0;
	while ($row = mysql_fetch_array($sql_result)) {
		$example_data[]=array($row[0],$row[1]);
		$example_data2[]=array($row[0],$row[2]);
		if ($row[1]>$max){$max=$row[1];}
		if ($row[2]>$max2){$max2=$row[2];}
	}
	$tnum=$max;
	$nmax=1;
	while ($tnum>1)
	   {	$tnum=$tnum/10;
		$nmax=$nmax*10;
	   }
	$grinc=number_format($max/(4*$scaler),0)*$scaler;
	$grinc2=number_format($max2/4,1);
    	//Set some data
	$graph->SetDataValues($example_data);
	//$graph->SetXLabel('AE Title');
	$graph->SetYLabel('Number of Studies');
	$graph->SetPrecisionY("0");
	$graph->SetTitleFontSize("2");
	$graph->SetVertTickIncrement("10");
	$graph->SetTitle('Incoming Device Analysis');
	$graph->SetPlotType('bars');
	$graph->SetXDataLabelMaxlength(13);
	$graph->SetVertTickIncrement("$grinc");
	//Draw it
	$graph->SetIsInline("1");  
	$graph->SetFileFormat("");
	$graph->SetBackgroundColor("white");
	$graph->SetXDataLabelAngle(90);
	$graph->DrawGraph();

	$graph->SetVertTickIncrement("1.25");
	$graph->SetDataValues($example_data2);
	$graph->SetDataColors(array("red"),array("green"));
	$arrsize=sizeof($example_data2);
	$graph->SetDrawXDataLabels(0); //We already got them in the first graph
	$graph->SetPlotAreaWorld(0,0,$arrsize,8.5); //New Plot Area
	$graph->SetLegend(array('Performance (MB/S)')); //Lets add a second legend
	$graph->DrawLegend(80,25,'');

	//Set Params of another Y Axis
	$graph->SetVertTickPosition('yaxis');
	$graph->SetYAxisPosition($arrsize*1.17);
	$graph->SetPrecisionY("1");
	$graph->SetTickColor('white');
	$graph->SetTextColor('red');
	$graph->SetGridColor('white');
	$graph->DrawYAxis();
	$graph->SetFileFormat('');

	//Draw the New data over the first graph
	$graph->DrawLines();
	$graph->DrawDots();
	$graph->PrintImage();
	break;
  case 6:
	$graph = new PHPlot(350,250);
	$graph->SetPrintImage(0);
	$db = mysql_select_db("pulsetest", $connection) or die ("Couldn't connect to DB Radtracker");
	$sql_command = "select nameMod,count(distinct StudyUID),format(avg(rate)/1000,1) from test where txrx='tx' and dayofyear(timestamp)>(dayofyear(CURRENT_DATE)-$daynum) group by nameMod";
	$sql_result = mysql_query($sql_command,$connection) or die (mysql_error());
	$max=0;
	$max2=0;
	while ($row = mysql_fetch_array($sql_result)) {
		$example_data[]=array($row[0],$row[1]);
		$example_data2[]=array($row[0],$row[2]);
		if ($row[1]>$max){$max=$row[1];}
		if ($row[2]>$max2){$max2=$row[2];}
	}
	$grinc=number_format($max/(4*$scaler),0)*$scaler;
	$grinc2=number_format($max2/4,1);	//Set some data
	$graph->SetDataValues($example_data);
	//$graph->SetXLabel('AE Title');
	$graph->SetYLabel('Number of Studies');
	$graph->SetPrecisionY("0");
	$graph->SetTitleFontSize("2");
	$graph->SetVertTickIncrement("10");
	$graph->SetTitle('Outgoing AE Title Analysis');
	$graph->SetPlotType('bars');
	$graph->SetXDataLabelMaxlength(13);
	$graph->SetVertTickIncrement("$grinc");
	//Draw it
	$graph->SetIsInline("1");  
	$graph->SetFileFormat("");
	$graph->SetBackgroundColor("white");
	$graph->SetXDataLabelAngle(90);
	$graph->DrawGraph();

	$graph->SetVertTickIncrement("1.25");
	$graph->SetDataValues($example_data2);
	$graph->SetDataColors(array("red"),array("green"));
	$arrsize=sizeof($example_data2);
	$graph->SetDrawXDataLabels(0); //We already got them in the first graph
	$graph->SetPlotAreaWorld(0,0,$arrsize,8.5); //New Plot Area
	$graph->SetLegend(array('Performance (MB/S)')); //Lets add a second legend
	$graph->DrawLegend(80,25,'');

	//Set Params of another Y Axis
	$graph->SetVertTickPosition('yaxis');
	$graph->SetYAxisPosition($arrsize*1.17);
	$graph->SetPrecisionY("1");
	$graph->SetTickColor('white');
	$graph->SetTextColor('red');
	$graph->SetGridColor('white');
	$graph->DrawYAxis();
	$graph->SetFileFormat('');

	//Draw the New data over the first graph
	$graph->DrawLines();
	$graph->DrawDots();
	$graph->PrintImage();
	break;
   case 7:
	$graph = new PHPlot(350,250);
	$graph->SetPrintImage(0);
	$db = mysql_select_db("pulsetest", $connection) or die ("Couldn't connect to DB Radtracker");
	$sql_command = "select reverse(right(reverse(ip),length(ip)-locate('.',reverse(ip)))),count(distinct StudyUID),format(avg(rate)/1000,1) from test where txrx='rx' and dayofyear(timestamp)>(dayofyear(CURRENT_DATE)-$daynum) group by reverse(right(reverse(ip),length(ip)-locate('.',reverse(ip))))";
	$sql_result = mysql_query($sql_command,$connection) or die (mysql_error());
	$max=0;
	$max2=0;
	while ($row = mysql_fetch_array($sql_result)) {
		$example_data[]=array($row[0],$row[1]);
		$example_data2[]=array($row[0],$row[2]);
		if ($row[1]>$max){$max=$row[1];}
		if ($row[2]>$max2){$max2=$row[2];}
	}
	$grinc=number_format($max/(4*$scaler),0)*$scaler;
	$grinc2=number_format($max2/4,1);	//Set some data
	$graph->SetDataValues($example_data);
	//$graph->SetXLabel('IP Subnet');
	$graph->SetYLabel('Number of Studies');
	$graph->SetPrecisionY("0");
	$graph->SetTitleFontSize("2");
	$graph->SetVertTickIncrement("10");
	$graph->SetTitle('Incoming IP Subnet Analysis');
	$graph->SetPlotType('bars');
	$graph->SetXDataLabelMaxlength(13);
	$graph->SetVertTickIncrement("$grinc");
	//Draw it
	$graph->SetIsInline("1");  
	$graph->SetFileFormat("");
	$graph->SetBackgroundColor("white");
	$graph->SetXDataLabelAngle(90);
	$graph->DrawGraph();

	$graph->SetVertTickIncrement("1.25");
	$graph->SetDataValues($example_data2);
	$graph->SetDataColors(array("red"),array("green"));
	$arrsize=sizeof($example_data2);
	$graph->SetDrawXDataLabels(0); //We already got them in the first graph
	$graph->SetPlotAreaWorld(0,0,$arrsize,8.5); //New Plot Area
	$graph->SetLegend(array('Performance (MB/S)')); //Lets add a second legend
	$graph->DrawLegend(80,25,'');

	//Set Params of another Y Axis
	$graph->SetVertTickPosition('yaxis');
	$graph->SetYAxisPosition($arrsize*1.17);
	$graph->SetPrecisionY("1");
	$graph->SetTickColor('white');
	$graph->SetTextColor('red');
	$graph->SetGridColor('white');
	$graph->DrawYAxis();
	$graph->SetFileFormat('');

	//Draw the New data over the first graph
	$graph->DrawLines();
	$graph->DrawDots();
	$graph->PrintImage();
	break;
  case 8:
	$graph = new PHPlot(350,250);
	$graph->SetPrintImage(0);
	$db = mysql_select_db("pulsetest", $connection) or die ("Couldn't connect to DB Radtracker");
	$sql_command = "select reverse(right(reverse(ip),length(ip)-locate('.',reverse(ip)))),count(distinct StudyUID),format(avg(rate)/1000,1) from test where txrx='tx' and dayofyear(timestamp)>(dayofyear(CURRENT_DATE)-$daynum) group by reverse(right(reverse(ip),length(ip)-locate('.',reverse(ip))))";
	$sql_result = mysql_query($sql_command,$connection) or die (mysql_error());
	$max=0;
	$max2=0;
	while ($row = mysql_fetch_array($sql_result)) {
		$example_data[]=array($row[0],$row[1]);
		$example_data2[]=array($row[0],$row[2]);
		if ($row[1]>$max){$max=$row[1];}
		if ($row[2]>$max2){$max2=$row[2];}
	}
	$grinc=number_format($max/(4*$scaler),0)*$scaler;
	$grinc2=number_format($max2/4,1);	//Set some data
	$graph->SetDataValues($example_data);
	//$graph->SetXLabel('IP Subnet');
	$graph->SetYLabel('Number of Studies');
	$graph->SetPrecisionY("0");
	$graph->SetTitleFontSize("2");
	$graph->SetVertTickIncrement("10");
	$graph->SetTitle('Outgoing IP Subnet Analysis');
	$graph->SetPlotType('bars');
	$graph->SetXDataLabelMaxlength(13);
	$graph->SetVertTickIncrement("$grinc");
	//Draw it
	$graph->SetIsInline("1");  
	$graph->SetFileFormat("");
	$graph->SetBackgroundColor("white");
	$graph->SetXDataLabelAngle(90);
	$graph->DrawGraph();

	$graph->SetVertTickIncrement("1.25");
	$graph->SetDataValues($example_data2);
	$graph->SetDataColors(array("red"),array("green"));
	$arrsize=sizeof($example_data2);
	$graph->SetDrawXDataLabels(0); //We already got them in the first graph
	$graph->SetPlotAreaWorld(0,0,$arrsize,8.5); //New Plot Area
	$graph->SetLegend(array('Performance (MB/S)')); //Lets add a second legend
	$graph->DrawLegend(80,25,'');

	//Set Params of another Y Axis
	$graph->SetVertTickPosition('yaxis');
	$graph->SetYAxisPosition($arrsize*1.17);
	$graph->SetPrecisionY("1");
	$graph->SetTickColor('white');
	$graph->SetTextColor('red');
	$graph->SetGridColor('white');
	$graph->DrawYAxis();
	$graph->SetFileFormat('');

	//Draw the New data over the first graph
	$graph->DrawLines();
	$graph->DrawDots();
	$graph->PrintImage();
	break;
  case 9:
	$graph = new PHPlot(350,250);
	$graph->SetPrintImage(0);
	$db = mysql_select_db("pulsetest", $connection) or die ("Couldn't connect to DB Radtracker");
	$sql_command = "select numAssoc,count(numAssoc),format(avg(rate)/1000,2) from test  ";
	$sql_command .= " where dayofyear(timestamp)>(dayofyear(CURRENT_DATE)-$daynum) group by numAssoc order by numAssoc";
	$sql_result = mysql_query($sql_command,$connection) or die (mysql_error());
	$max=0;
	$max2=0;
	while ($row = mysql_fetch_array($sql_result)) {
		$example_data[]=array($row[0],$row[1]);
		$example_data2[]=array($row[0],$row[2]);
		if ($row[1]>$max){$max=$row[1];}
		if ($row[2]>$max2){$max2=$row[2];}
	}
	$grinc=number_format($max/(4*$scaler),0)*$scaler;
	$grinc2=number_format($max2/4,1);	//Set some data
	$graph->SetDataValues($example_data);
	//$graph->SetXLabel('IP Subnet');
	$graph->SetYLabel('Number of Associations');
	$graph->SetPrecisionY("0");
	$graph->SetTitleFontSize("2");
	$graph->SetVertTickIncrement("10");
	$graph->SetTitle('Server Loading (# Simultaneous Associations)');
	$graph->SetPlotType('bars');
	$graph->SetXDataLabelMaxlength(13);
	$graph->SetVertTickIncrement("$grinc");
	//Draw it
	$graph->SetIsInline("1");  
	$graph->SetFileFormat("");
	$graph->SetBackgroundColor("white");
	$graph->SetXDataLabelAngle(90);
	$graph->DrawGraph();

	$graph->SetVertTickIncrement("1.25");
	$graph->SetDataValues($example_data2);
	$graph->SetDataColors(array("red"),array("green"));
	$arrsize=sizeof($example_data2);
	$graph->SetDrawXDataLabels(0); //We already got them in the first graph
	$graph->SetPlotAreaWorld(0,0,$arrsize,8.5); //New Plot Area
	$graph->SetLegend(array('Performance (MB/S)')); //Lets add a second legend
	$graph->DrawLegend(80,25,'');

	//Set Params of another Y Axis
	$graph->SetVertTickPosition('yaxis');
	$graph->SetYAxisPosition($arrsize*1.17);
	$graph->SetPrecisionY("1");
	$graph->SetTickColor('white');
	$graph->SetTextColor('red');
	$graph->SetGridColor('white');
	$graph->DrawYAxis();
	$graph->SetFileFormat('');

	//Draw the New data over the first graph
	$graph->DrawLines();
	$graph->DrawDots();
	$graph->PrintImage();
	break;
    case 10:
	$graph = new PHPlot(350,250);
	$db = mysql_select_db("pulsetest", $connection) or die ("Couldn't connect to DB Radtracker");
	$sql_command = "select format((rate/500),0)*.5,count(size),count(size) from test  ";
	$sql_command .= "where txrx='tx' and dayofyear(timestamp)>(dayofyear(CURRENT_DATE)-$daynum) group by format((rate/500),0)*500";
	$sql_result = mysql_query($sql_command,$connection) or die (mysql_error());
	$max=0;
	$max2=0;
	while ($row = mysql_fetch_array($sql_result)) {
		$example_data[]=array($row[0],$row[1]);
		$example_data2[]=array($row[0],$row[2]);
		if ($row[1]>$max){$max=$row[1];}
		if ($row[2]>$max2){$max2=$row[2];}
	}
	$grinc=number_format($max/(4*$scaler),0)*$scaler;
	$grinc2=number_format($max2/4,1);	//Set some data
	$graph->SetDataValues($example_data);
	//$graph->SetXLabel('IP Subnet');
	$graph->SetYLabel('Number of Associations');
	$graph->SetPrecisionY("0");
	$graph->SetTitleFontSize("2");
	$graph->SetVertTickIncrement("10");
	$graph->SetTitle('Outgoing Performance Histogram');
	$graph->SetPlotType('bars');
	$graph->SetXDataLabelMaxlength(13);
	$graph->SetVertTickIncrement("$grinc");
	//Draw it
	$graph->SetIsInline("1");  
	$graph->SetFileFormat('');
	$graph->SetBackgroundColor("white");
	$graph->SetXDataLabelAngle(90);
	$graph->DrawGraph();
	break;
}
?>
Return current item: PACSPulse