<?php
require_once("G:/xampp/php/ext/phpchartdir.php");
$con = mysql_connect("localhost:3306","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("mygraphs", $con);
$dataX0=array(1,2,3,4,5,6,7,8,9);
$w=0;
$year='2010';
$month='April';
$v=1;
Do{
switch($v){
case 1:
$d1="Select Variable From factor Where FactorName='Economy' AND Year='2010' AND Month= 'April'";
$rd1 = mysql_query($d1);
$dd1="Select COUNT(Variable) as c From factor Where FactorName='Economy' AND Year='2010' AND Month= 'April'";
$rdd1 = mysql_query($dd1);
$row = mysql_fetch_array($rdd1);
$ar_length =$row['c'];
// echo "cccccc" ;
// echo $ar_length;
break;
case 2:
$d1="Select Variable From factor Where FactorName='HealthyLifestyle' AND Year='2010' AND Month= 'April'";
$rd1 = mysql_query($d1);
$dd1="Select COUNT(Variable) as c From factor Where FactorName='HealthyLifestyle' AND Year='2010' AND Month= 'April'";
$rdd1 = mysql_query($dd1);
$row = mysql_fetch_array($rdd1);
$ar_length =$row['c'];
// echo "cccccc" ;
// echo $ar_length;
break;
case 3:
$d1="Select Variable From factor Where FactorName='Urban Growth' AND Year='2010' AND Month= 'April'";
$rd1 = mysql_query($d1);
$dd1="Select COUNT(Variable) as c From factor Where FactorName='Urban Growth' AND Year='2010' AND Month= 'April'";
$rdd1 = mysql_query($dd1);
$row = mysql_fetch_array($rdd1);
$ar_length =$row['c'];
// echo "cccccc" ;
// echo $ar_length;
break;
case 4:
$d1="Select Variable From factor Where FactorName='Transport' AND Year='2010' AND Month= 'April'";
$rd1 = mysql_query($d1);
$dd1="Select COUNT(Variable) as c From factor Where FactorName='Transport' AND Year='2010' AND Month= 'April'";
$rdd1 = mysql_query($dd1);
$row = mysql_fetch_array($rdd1);
$ar_length =$row['c'];
// echo "cccccc" ;
// echo $ar_length;
break;
case 5:
$d1="Select Variable From factor Where FactorName='Crime & Safety' AND Year='2010' AND Month= 'April'";
$rd1 = mysql_query($d1);
$dd1="Select COUNT(Variable) as c From factor Where FactorName='Crime & Safety' AND Year='2010' AND Month= 'April'";
$rdd1 = mysql_query($dd1);
$row = mysql_fetch_array($rdd1);
$ar_length =$row['c'];
// echo "cccccc" ;
// echo $ar_length;
break;
case 6:
$d1="Select Variable From factor Where FactorName='Commiunity ' AND Year='2010' AND Month= 'April'";
$rd1 = mysql_query($d1);
$dd1="Select COUNT(Variable) as c From factor Where FactorName='Commiunity ' AND Year='2010' AND Month= 'April'";
$rdd1 = mysql_query($dd1);
$row = mysql_fetch_array($rdd1);
$ar_length =$row['c'];
// echo "cccccc" ;
// echo $ar_length;
break;
case 7:
$d1="Select Variable From factor Where FactorName='Environment' AND Year='2010' AND Month= 'April'";
$rd1 = mysql_query($d1);
$dd1="Select COUNT(Variable) as c From factor Where FactorName='Environment' AND Year='2010' AND Month= 'April'";
$rdd1 = mysql_query($dd1);
$row = mysql_fetch_array($rdd1);
$ar_length =$row['c'];
// echo "cccccc" ;
// echo $ar_length;
break;
case 8:
$d1="Select Variable From factor Where FactorName='Education' AND Year='2010' AND Month= 'April'";
$rd1 = mysql_query($d1);
$dd1="Select COUNT(Variable) as c From factor Where FactorName='Education' AND Year='2010' AND Month= 'April'";
$rdd1 = mysql_query($dd1);
$row = mysql_fetch_array($rdd1);
$ar_length =$row['c'];
// echo "cccccc" ;
// echo $ar_length;
break;
case 9:
$d1="Select Variable From factor Where FactorName='Health' AND Year='2010' AND Month= 'April'";
$rd1 = mysql_query($d1);
$dd1="Select COUNT(Variable) as c From factor Where FactorName='Health' AND Year='2010' AND Month= 'April'";
$rdd1 = mysql_query($dd1);
$row = mysql_fetch_array($rdd1);
$ar_length =$row['c'];
// echo "cccccc" ;
// echo $ar_length;
break;
} //end sw
$sum = 0;
while($row = mysql_fetch_array($rd1))
{
$f = $row['Variable'] ;
//echo $f;
switch($f){
Case q2_1:
$d2 = mysql_query("Select AVG(Q2_1) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
// echo $d2;
break;
Case q2_2:
$d2 = mysql_query("Select AVG(Q2_2) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
// echo $d2;
break;
Case q2_3:
$d2=mysql_query("Select AVG(Q2_3) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
//echo $d2;
break;
Case q2_4:
$d2=mysql_query("Select AVG(Q2_4) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_5:
$d2=mysql_query("Select AVG(Q2_5) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_6:
$d2=mysql_query("Select AVG(Q2_6) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_7:
$d2=mysql_query("Select AVG(Q2_7) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_8:
$d2=mysql_query("Select AVG(Q2_8) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_9:
$d2=mysql_query("Select AVG(Q2_9) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_10:
$d2=mysql_query("Select AVG(Q2_10) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_11:
$d2=mysql_query("Select AVG(Q2_11) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_12:
$d2=mysql_query("Select AVG(Q2_12) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_13:
$d2=mysql_query("Select AVG(Q2_13) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_14:
$d2=mysql_query("Select AVG(Q2_14) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_15:
$d2=mysql_query("Select AVG(Q2_15) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_16:
$d2=mysql_query("Select AVG(Q2_16) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_17:
$d2=mysql_query("Select AVG(Q2_17) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_18:
$d2=mysql_query("Select AVG(Q2_18) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_19:
$d2=mysql_query("Select AVG(Q2_19) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_20:
$d2=mysql_query("Select AVG(Q2_20) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_21:
$d2=mysql_query("Select AVG(Q2_21) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_22:
$d2=mysql_query("Select AVG(Q2_22) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_23:
$d2=mysql_query("Select AVG(Q2_23) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_24:
$d2=mysql_query("Select AVG(Q2_24) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_25:
$d2=mysql_query("Select AVG(Q2_25) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_26:
$d2=mysql_query("Select AVG(Q2_26) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_27:
$d2=mysql_query("Select AVG(Q2_27) as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_28:
$d2=mysql_query("Select AVG(Q2_28)as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_29:
$d2=mysql_query("Select AVG(Q2_29)as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_30:
$d2=mysql_query("Select AVG(Q2_30)as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
Case q2_31:
$d2=mysql_query("Select AVG(Q2_31)as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_32:
$d2=mysql_query("Select AVG(Q2_32)as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_33:
$d2=mysql_query("Select AVG(Q2_33)as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_34:
$d2=mysql_query("Select AVG(Q2_34)as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
break;
Case q2_35:
$d2=mysql_query("Select AVG(Q2_35)as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_36:
$d2=mysql_query("Select AVG(Q2_36)as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_37:
$d2=mysql_query("Select AVG(Q2_37)as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_38:
$d2=mysql_query("Select AVG(Q2_38)as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_39:
$d2=mysql_query("Select AVG(Q2_39)as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_40:
$d2=mysql_query("Select AVG(Q2_40)as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_41:
$d2=mysql_query("Select AVG(Q2_41)as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_42:
$d2=mysql_query("Select AVG(Q2_42)as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_43:
$d2=mysql_query("Select AVG(Q2_43)as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_44:
$d2=mysql_query("Select AVG(Q2_44)as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_45:
$d2=mysql_query("Select AVG(Q2_45)as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_46:
$d2=mysql_query("Select AVG(Q2_46)as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
Case q2_47:
$d2=mysql_query("Select AVG(Q2_47)as a From var_ratings Where Year='2010' AND Month= 'April'");
$row = mysql_fetch_array($d2);
$n=$row['a'];
// echo $n;
break;
}//switch
$sum=$n+$sum;
} //while
// echo "<br/>";
// echo $sum;
// echo "<br/>";
$g=$sum/$ar_length;
// echo $g;
//$e1=$g;
if($w==0){
$e1=$g;
$ar[]=$e1;
}
elseif($w==1){
$e2=$g;
$ar[]=$e2;
}
elseif($w==2){
$e3=$g;
$ar[]=$e3;
}
elseif($w==3){
$e4=$g;
$ar[]=$e4;
}
elseif($w==4){
$e5=$g;
$ar[]=$e5;
}
elseif($w==5){
$e6=$g;
$ar[]=$e6;
}
elseif($w==6){
$e7=$g;
$ar[]=$e7;
}
elseif($w==7){
$e8=$g;
$ar[]=$e8;
}
elseif($w==8){
$e9=$g;
$ar[]=$e9;
}
$v++;
}//do
while($v<10);
// echo "aqwsedrf";
// echo $ar[0];
// echo $ar[1];
// echo $ar[2];
// echo $ar[3];
// echo $ar[4];
// echo $ar[5];
// echo $ar[6];
// echo $ar[7];
// echo $ar[8];
//echo "end of files";
$di1=mysql_query("Select Importance From importance_of_factors Where Factor='Economy' AND Year='2010' AND Month= 'April' ");
$di2=mysql_query("Select Importance From importance_of_factors Where Factor='HealthyLifestyle' AND Year='2010' AND Month= 'April' ");
$di3=mysql_query("Select Importance From importance_of_factors Where Factor='Urban Growth' AND Year='2010' AND Month= 'April' ");
$di4=mysql_query("Select Importance From importance_of_factors Where Factor='Transport' AND Year='2010' AND Month= 'April' ");
$di5=mysql_query("Select Importance From importance_of_factors Where Factor='Crime & Safety' AND Year='2010' AND Month= 'April' ");
$di6=mysql_query("Select Importance From importance_of_factors Where Factor='Commiunity' AND Year='2010' AND Month= 'April' ");
$di7=mysql_query("Select Importance From importance_of_factors Where Factor='Environment' AND Year='2010' AND Month= 'April' ");
$di8=mysql_query("Select Importance From importance_of_factors Where Factor='Education' AND Year='2010' AND Month= 'April' ");
$di9=mysql_query("Select Importance From importance_of_factors Where Factor='Health' AND Year='2010' AND Month= 'April' ");
$ar2=array($di1,$di2,$di3,$di4,$di5,$di6,$di7,$di8,$di9);
$labels = array("0","Economy","HealthyLifestyle", "Urban Growth", "Transport","Crime & Safety","Commiunity","Environment","Education","Health","");
$colors = array(0x008000, 0xeebb22, 0xcccccc, 0xcc88ff,0x66aaee, 0xeebb22, 0xcccccc, 0xcc88ff,0x66aaee);
# Create a XYChart object of size 450 x 420 pixels
$c = new XYChart(450, 420);
# Set the plotarea at (55, 65) and of size 350 x 300 pixels, with a light grey border
# (0xc0c0c0). Turn on both horizontal and vertical grid lines with light grey color # (0xc0c0c0)
$c->setPlotArea(55, 65, 350, 300, -1, -1, 0xc0c0c0, 0xc0c0c0, -1);
# Add a legend box at (50, 30) (top of the chart) with horizontal layout. Use 12 pts # Times Bold Italic font. Set the background and border color to Transparent.
$legendObj = $c->addLegend(50, 30, false, "timesbi.ttf", 12);
$legendObj->setBackground(Transparent);
# Add a title to the chart using 18 pts Times Bold Itatic font.
$c->addTitle("Segmentation (by factor)", "timesbi.ttf", 18);
# Add a title to the y axis using 12 pts Arial Bold Italic font
$c->yAxis->setTitle("Satisfaction (Scale 1 Very bad - 5 Very good)", "arialbi.ttf", 12);
# Add a title to the x axis using 12 pts Arial Bold Italic font
$c->xAxis->setLabels($labels);
// $c->xAxis->setTitle("Range (miles)", "arialbi.ttf", 12);
# Set the axes line width to 3 pixels
$c->xAxis->setWidth(3);
$c->yAxis->setWidth(3);
// Layer->set3D2(10,10,4,4);
// $dataX0->setColor($colors);
// $layer = $c->addScatterLayer3($ar);
//for($i = 0; $i < count($symbols); ++$i) {
// $c->addScatterLayer(array($i % 6 + 1), array((int)($i / 6 + 1)), "", $symbols[$i ], 15);
// }
$scatterLayerObj = $c->addScatterLayer($dataX0, $ar,$color, GlassSphereShape, 7);
$scatterLayerObj->setSymbolScale($ar2);
//->fill($dataX0, $ar, $colors, null);
// $c->setColors2($ar, $colors);
header("Content-type: image/png");
print($c->makeChart2(PNG));
?>
|