ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  color problem on scatter chart
Posted by M_jay on Jan-31-2011 18:09
Attachments:
I want to create a chart same to the picture(chart.png) which I have attached here with.
I got a chart but it is not the chart I wanted.
I attached here with my chart code.

data base values for the graph

----------------X axis-------------------------------
$col =array(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26)




-------------------Y axis-----------------
$ar=Array(2.5875 2.725   2.855 2.05875 2.47625 2.7075 2.88375 2.5738 2.93 2.72125 2.5525 2.4325 2.80125 3.21 2.45 2.1725 2.5275 3.43 2.89875 2.8475 2.58625 3.12 2.31625 2.51125 2.665 2.3788);


--------------------------Z axis---------------------------

0 6.241 2.535 1.8928 2.1609 2.8812 2.42 2.1952 3.481 6.5712 1.8816 2.1175 3.1752 4.335   5.0575 4.1472 2.809 2.0808 2.2326 2.5281 1.6128 4.1472 2.0184 4.9152 1.4406 5.184

I want to display all variables of each factor in one color and I have used 9 different colors for 9 factors (values of my $color array).
chart.png
Segment_Kpi.png
Segment_Kpi.php
<?php
require_once("C:/xampp/php/ext/phpchartdir.php");
 $con = mysql_connect("localhost:3306","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
        mysql_select_db("mygraphs", $con);
        
    
              $w=0;
	//$year='2010';
	$month='April';
        $k=0;
		$ab=0;                 
           $v=1;
           Do{
        switch($v){
          case 1:
          $d1="Select Variable From factor Where FactorName='Economy' AND Year='2010' AND Month= '$month'";
	$rd1 = mysql_query($d1);
       $dd1="Select COUNT(Variable) as c From factor Where FactorName='Economy' AND Year='2010' AND Month= '$month'";
             $rdd1 = mysql_query($dd1);
              $row = mysql_fetch_array($rdd1);
                              $ar_length =$row['c'];
							  //echo $ar_length;
						                               break;
          case 2:
          $d1="Select Variable From factor Where FactorName='HealthyLifestyle' AND Year='2010' AND Month= '$month'";
	$rd1 = mysql_query($d1);
       $dd1="Select COUNT(Variable) as c From factor Where FactorName='HealthyLifestyle' AND Year='2010' AND Month= '$month'";
             $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= '$month'";
	$rd1 = mysql_query($d1);
       $dd1="Select COUNT(Variable) as c From factor Where FactorName='Urban Growth' AND Year='2010' AND Month= '$month'";
             $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= '$month'";
	$rd1 = mysql_query($d1);
       $dd1="Select COUNT(Variable) as c From factor Where FactorName='Transport' AND Year='2010' AND Month= '$month'";
             $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= '$month'";
	$rd1 = mysql_query($d1);
       $dd1="Select COUNT(Variable) as c From factor Where FactorName='Crime & Safety' AND Year='2010' AND Month= '$month'";
             $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= '$month'";
	$rd1 = mysql_query($d1);
       $dd1="Select COUNT(Variable) as c From factor Where FactorName='Commiunity ' AND Year='2010' AND Month= '$month'";
             $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= '$month'";
	$rd1 = mysql_query($d1);
       $dd1="Select COUNT(Variable) as c From factor Where FactorName='Environment' AND Year='2010' AND Month= '$month'";
             $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= '$month'";
	$rd1 = mysql_query($d1);
       $dd1="Select COUNT(Variable) as c From factor Where FactorName='Education' AND Year='2010' AND Month= '$month'";
             $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= '$month'";
	$rd1 = mysql_query($d1);
       $dd1="Select COUNT(Variable) as c From factor Where FactorName='Health' AND Year='2010' AND Month= '$month'";
             $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'] ;
                       
						//******************************************************************
                           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'];
								$array[]=$n;
								//$e1[]=$array;
								
	                             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'];						   			   
						    $array[]=$n;
						//	echo $n;
							 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'];
                          
  $array[]=$n;
  
                               
                        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'];
							  $array[]=$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'];
							  $array[]=$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'];
							  $array[]=$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'];
							  $array[]=$n;
                          //  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'];
							  $array[]=$n;
                          //  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']; 
							 $array[]=$n;
                          //  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'];
							  $array[]=$n;
                          //  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']; 
							 $array[]=$n;
                          //  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'];
							  $array[]=$n;
                          //  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'];
							  $array[]=$n;
                          //  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'];
							  $array[]=$n;
                         //   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'];
							  $array[]=$n;
                         //   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'];
							  $array[]=$n;
                         //   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'];
							  $array[]=$n;
                         //   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'];  
							$array[]=$n;
                         //   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'];
							  $array[]=$n;
                         //   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'];
							  $array[]=$n;
                         //   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'];
							  $array[]=$n;
                         //   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'];
							  $array[]=$n;
                         //   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'];
							 $array[]=$n;
                            // echo $array;
                         //   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'];
							  $array[]=$n;
                         //   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'];
							  $array[]=$n;
                         //   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'];
							 $array[]=$n;
                         //   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'];
							 $array[]=$n;
                         //   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'];
							    $array[]=$n;
                         //      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'];
							    $array[]=$n;
                         //      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'];
							    $array[]=$n;
                         //      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'];
							    $array[]=$n;
                         //      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'];
							    $array[]=$n;
                         //      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'];
							    $array[]=$n;
                         //      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'];
							   $array[]=$n;
							    $array[]=$n;
                             // echo $array;
							 
                               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'];
							    $array[]=$n;
                          //     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'];
							    $array[]=$n;
                          //     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'];
							    $array[]=$n;
                          //     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'];
							    $array[]=$n;
                          //     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'];
							    $array[]=$n;
                          //     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'];
							    $array[]=$n;
                          //     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'];
							    $array[]=$n;
                          //     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'];
							    $array[]=$n;
                          //     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'];
							    $array[]=$n;
                              // 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'];
							    $array[]=$n;
                             //  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'];
							    $array[]=$n;
                             //  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'];
							    $array[]=$n;
                             //  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'];
							    $array[]=$n;
				                                break;
                          }
						  
						/*  $ay[]=$array;*/
						  
						  //******************************************************************
                      
					  //----------------------------------------------------------
					  switch($f){
					  case q2_1:
 $imp=mysql_query("Select Factorscore as aa From variables_and_factorscores Where Variable='Q2_1' AND Year='2010' AND Month= 'April'");
 $row = mysql_fetch_array($imp);
 $fa=$row['aa'];

                             break;
                        case q2_2:
$imp = mysql_query("Select Factorscore From variables_and_factorscores as aa Where  Variable='Q2_2' AND Year='2010' AND Month='April'");
$row = mysql_fetch_array($imp);
$fa=$row['aa'];

	                						                        break;
                        case q2_3:
$imp =mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_3' AND Year='2010' AND Month= 'April'");
 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];

                        break;
                        case q2_4:
			 $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_4' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
                                               break;
                        case q2_5:
							   $imp = mysql_query("Select Factorscore as aa From variables_and_factorscores Where Variable='Q2_5' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
                        break;
                        case q2_6:
							   $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_6' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
                        break;
                        case q2_7:
                        
						   $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_7' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
                        break;
                        case q2_8:
                        
						   $imp = mysql_query("Select Factorscore as aa From variables_and_factorscores Where Variable='Q2_8' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
                        break;
                        case q2_9:
                        
						   $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_9' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								 
                        break;
                        case q2_10:
                       
						   $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_10' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								 
                        break;
                        case q2_11:
                        
						   $imp = mysql_query("Select Factorscore as aa From variables_and_factorscores Where Variable='Q2_11' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								
                        break;
                        case q2_12:
                        
						   $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_12' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								
                        break;
                        case q2_13:
                        						   $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_13' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								 
                        break;
                        case q2_14:
                       $imp = mysql_query("Select Factorscore as aa From variables_and_factorscores Where Variable='Q2_14' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								 
                        break;
                        case q2_15:
                        
						  $imp = mysql_query("Select Factorscore as aa From variables_and_factorscores Where Variable='Q2_15' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								
                        break;
                        case q2_16:
                       
						  $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_16' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								
                        break;
                        case q2_17:
                        
						  $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_17' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								 
                        break;
                        case q2_18:
           $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_18' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								
                        break;
                        case q2_19:
                        
						  $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_19' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								 
                        break;
                        case q2_20:
                       	$imp = mysql_query("Select Factorscore as aa From variables_and_factorscores Where Variable='Q2_20' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								 
                        break;
                        case q2_21:
                       
						  $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where  Variable='Q2_21' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								                        break;
                        case q2_22:
                       			$imp = mysql_query("Select Factorscore as aa From variables_and_factorscores Where Variable='Q2_22' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								
                        break;
                        case q2_23:
                     $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_23' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								
                        break;
                        case q2_24:
                       
$imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_24' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								
                        break;
                        case q2_25:
                       
$imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_25' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								
                        break;
                        case q2_26:
                       
						  $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_26' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								
                        break;
                        case q2_27:
                       
						  $imp = mysql_query("Select Factorscore as aa From variables_and_factorscores Where Variable='Q2_27' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								
                        break;
                        case q2_28:
                        
						  $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_28' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								 
                               break;
                        case q2_29:
                        
						  $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_29' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								 
                               break;
                        case q2_30:
                       
						  $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_30' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								 
                        case q2_31:
                       
						  $imp = mysql_query("Select Factorscore as aa From variables_and_factorscores Where Variable='Q2_31' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								 
                               break;
                        case q2_32:
                        
$imp = mysql_query("Select Factorscore as aa ,Varience as b From variables_and_factorscores Where Variable='Q2_32' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								 
                               break;
                        case q2_33:
                        
						  $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_33' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								 
                               break;
                        case q2_34:
                        		  $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_34' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								                               
                           break;
                        case q2_35:
      $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_35' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								 
                               break;
                        case q2_36:
                       		 $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_36' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
							                               break;
                       
					    case q2_37:
                       
						   $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_37' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								 
                               break;
                      
					    case q2_38:
                        
						   $imp = mysql_query("Select Factorscore as aa From variables_and_factorscores Where Variable='Q2_38' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								 
                               break;
                      
					    case q2_39:
                        
						   $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_39' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								 
                               break;
                        case q2_40:
                       
						   $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_40' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								
                               break;
                       
					    case q2_41:
                        
						   $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_41' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								 
                               break;
                       
					    case q2_42:
                       
						   $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_42' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								
                               break;
                        case q2_43:
                       
							   $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_43' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								
                               break;
                       
					    case q2_44:
                       
							  $imp = mysql_query("Select Factorscore as aa From variables_and_factorscores Where Variable='Q2_44' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								
                               break;
                        
						case q2_45:
                       
							  $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_45' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								 
                               break;
                        case q2_46:
                       
							  $imp = mysql_query("Select Factorscore as aa From variables_and_factorscores Where Variable='Q2_46' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								  
                               break;
                        case q2_47:
                        
							                        
				 $imp = mysql_query("Select Factorscore as aa  From variables_and_factorscores Where Variable='Q2_47' AND Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp);
                                 $fa=$row['aa'];
								 
                               break;
					  
					  
					  }
					  
					  //---------------------------------------------
					  
					  switch($f){
					  case q2_1:
                         
								 $imp2 = mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_1' AND Year='2010' AND Month= 'April'");
								  $row3 = mysql_fetch_array($imp2);
								 $va=$row3['b'];
                             break;
                        case q2_2:
                     
		 $imp2 = mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_2' AND Year='2010' AND Month= 'April'");
								  $row3 = mysql_fetch_array($imp2);
								 $va=$row3['b'];
							                        break;
                        case q2_3:
                            
								  $imp2 = mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_3' AND Year='2010' AND Month= 'April'");
								  $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                             
                        break;
                        case q2_4:
                      
								  $imp2 = mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_4' AND Year='2010' AND Month= 'April'");
								  $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                                               break;
                        case q2_5:
                        
								  $imp2 = mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_5' AND Year='2010' AND Month= 'April'");
								  $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                          //  echo $n;
                        break;
                        case q2_6:
                        
								 $imp2= mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_6' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                          //  echo $n;
                        break;
                        case q2_7:
                      
								 $imp2= mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_7' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                        break;
                        case q2_8:
                       
								 $imp2= mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_8' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                        break;
                        case q2_9:
                        
								 $imp2= mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_9' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                        break;
                        case q2_10:
                       
								 $imp2= mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_10' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                        break;
                        case q2_11:
                       
								 $imp2= mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_11' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                        break;
                        case q2_12:
                       
								 $imp2= mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_12' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                        break;
                        case q2_13:
                        
								 $imp2= mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_13' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                        break;
                        case q2_14:
                       
								 $imp2= mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_14' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                        break;
                        case q2_15:
                       
								 $imp2= mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_15' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                        break;
                        case q2_16:
                       
								 $imp2= mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_16' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                        break;
                        case q2_17:
                       
								 $imp2= mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_17' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                        break;
                        case q2_18:
                       
								 $imp2= mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_18' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                        break;
                        case q2_19:
                      
								 $imp2= mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_19' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                        break;
                        case q2_20:
                       
								 $imp2= mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_20' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                        break;
                        case q2_21:
                       
								 $imp2= mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_21' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                        break;
                        case q2_22:
                        
								 $imp2= mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_22' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                        break;
                        case q2_23:
                        
								 $imp2= mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_23' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                        break;
                        case q2_24:
                       
								 $imp2= mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_24' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                        break;
                        case q2_25:
                       
								 $imp2= mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_25' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                        break;
                        case q2_26:
                       
								$imp2= mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_26' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                        break;
                        case q2_27:
                       
								 $imp2=mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_27' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                        break;
                        case q2_28:
                       
								 $imp2 = mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_28' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                               break;
                        case q2_29:
                       
								 $imp2 = mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_29' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                               break;
                        case q2_30:
                       
								 $imp2 = mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_30' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                        case q2_31:
                       
								 $imp2 = mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_31' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                               break;
                        case q2_32:
                      
				 $imp2 = mysql_query("Select Factorscore as aa ,Varience as b From variables_and_factorscores Where Variable='Q2_32' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                               break;
                        case q2_33:
                        
								 $imp2 = mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_33' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                               break;
                        case q2_34:
                        
								 $imp2 = mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_34' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                               break;
                           break;
                        case q2_35:
                        
								 $imp2 = mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_35' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);								 
								 $va=$row['b'];
                               break;
                        case q2_36:
                       
							$imp2 = mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_36' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                               break;
                       
					    case q2_37:
                        
								 $imp2 = mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_37' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                               break;
                      
					    case q2_38:
                        
								 $imp2 = mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_38' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                               break;
                      
					    case q2_39:
                       
								 $imp2 = mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_39' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                               break;
                        case q2_40:
                        
								 $imp2 = mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_40' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                               break;
                       
					    case q2_41:
                       	 $imp2 = mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_41' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                               break;
                       
					    case q2_42:
              $imp2 = mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_42' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                               break;
                        case q2_43:
                       
								 $imp2 = mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_43' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                               break;
                       
					    case q2_44:
$imp2 = mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_44' AND  Year='2010' AND Month= 'April'");
	 $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                               break;
                        
						case q2_45:
      $imp2 = mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_45' AND Year='2010' AND Month= 'April'");
								  $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                               break;
                        case q2_46:
$imp2 = mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_46' AND Year='2010' AND Month= 'April'");
								  $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                               break;
                        case q2_47:
$imp2 = mysql_query("Select Varience as b From variables_and_factorscores Where Variable='Q2_47' AND Year='2010' AND Month= 'April'");
								  $row = mysql_fetch_array($imp2);
								 $va=$row['b'];
                               break;
					  
					  
					  
					  }
					  //++++++++++++++++++++++++++++++++++++++++++++++++
				if($w==0){
				
                  $e1[$k]=$n;
				  	/*echo $n;
					echo "<br/>";	*/	 
                  $ar[$k]=$e1;
				   //  echo $ar[$w];
				 
				  $fa1=$fa;
				  $va1=$va;
				  
				  $imm1=$fa1*$fa1;
				  $imm2=$imm1*$va;
				  // echo $imm2; 
				 //  echo "<br/>";          //$ay[]
				  $ar2[$k]=$imm2;
				 
				 				 
               }
                    
				$k++;	  
               } //while
			   
			                  


			  /* if($w==0){
                  $e1[]=$ay;
                  $ar[]=$e1;
				     //echo $ay[2];
				 
				  $fa1=$fa;
				  $va1=$va;
				  
				  $im1=($fa1*$fa1)*$va;           //$ay[]
				  $ar2[]=$im1;
				  
               }
                    elseif($w==1){
                        $e2[]=$ay;
                        $ar[]=$e2;
						
						$fa1=$fa;
				  $va1=$va;
				  
				  $im1=($fa1*$fa1)*$va;
				  $ar2[]=$im1;
                    }
                    elseif($w==2){
                          $e3[]=$ay;
                          $ar[]=$e3;
						  
						  $fa1=$fa;
				  $va1=$va;
				  
				  $im1=($fa1*$fa1)*$va;
				  $ar2[]=$im1;
                    }
                    elseif($w==3){
                           $e4[]=$ay;
                           $ar[]=$e4;
						   
						   $fa1=$fa;
				  $va1=$va;
				  
				  $im1=($fa1*$fa1)*$va;
				  $ar2[]=$im1;
                    }
                    elseif($w==4){
                           $e5[]=$ay;
                           $ar[]=$e5;
						   
						   $fa1=$fa;
				  $va1=$va;
				  
				  $im1=($fa1*$fa1)*$va;
				  $ar2[]=$im1;
                    }
                    elseif($w==5){
                       $e6[]=$ay;
                       $ar[]=$e6;
					   
					   $fa1=$fa;
				  $va1=$va;
				  
				  $im1=($fa1*$fa1)*$va;
				  $ar2[]=$im1;
                    
                    }
                    elseif($w==6){
                          $e7[]=$ay;
                          $ar[]=$e7;
						  
						   $fa1=$fa;
				  $va1=$va;
				  
				  $im1=($fa1*$fa1)*$va;
				  $ar2[]=$im1;
                    }
                    elseif($w==7){
                          $e8[]=$ay;
                          $ar[]=$e8;
						  
						  $fa1=$fa;
				  $va1=$va;
				  
				  $im1=($fa1*$fa1)*$va;
				  $ar2[]=$im1;
                    }
                    elseif($w==8){
                          $e9[]=$ay;
                          $ar[]=$e9;
						  
						  $fa1=$fa;
				  $va1=$va;
				  
				  $im1=($fa1*$fa1)*$va;
				  $ar2[]=$im1;
                    }*/

$ab=$ab+$ar_length;

//echo $ab;
//echo "<br/>";
        $v++;
	//	$w++;
		
          }                                     //do

	
	
	
			  

        while($v<10);
		
		if($v==10){
	
  for($a=1;$a<$ab+1;$a++){
					$col[]=$a;    
					}
					} 
								  
                 //  echo "aqwsedrf";
				// echo "cjhjdhudhid";
                  // echo $ar[0];
                  //    echo $ar[25];
                  //      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";

    


    //  $ar2=array($di1,$di2,$di3,$di4,$di5,$di6,$di7,$di8,$di9);
	  
         // $labels = array("","<*color=ff0000*>Economy","<*color=0x008000*>HealthyLifestyle", "<*color=0x0000FF*>Urban Growth", "<*color=daa520*>Transport","<*color= 0xEE82EE*>Crime & Safety","<*color=0x00FFFF*>Commiunity","<*color=cd853f*>Environment","<*color=0xcccccc*>Education","<*color=8b7d6b*>Health","");
		 
		  //$labels = array("<*color=ff0000*>Economy","<*color=0x008000*>HealthyLifestyle", "<*color=0x0000FF*>Urban Growth", "<*color=daa520*>Transport","<*color= 0xEE82EE*>Crime & Safety","<*color=0x00FFFF*>Commiunity","<*color=cd853f*>Environment","<*color=0xcccccc*>Education","<*color=8b7d6b*>Health");
		  
  //   $color = array(0x008000, 0xeebb22, 0xcccccc, 0xcc88ff,0x66aaee, 0xeebb22, 0xcccccc, 0xcc88ff,0x66aaee);
              	# Create a XYChart object of size 450 x 420 pixels
	 $c = new XYChart(750, 720);
	  # 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) 
	  $plotAreaObj = $c->setPlotArea(55, 65, 700, 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.
          $plotAreaObj->setGridWidth(0, 1, 0, 0);
		    $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 Kpi)", "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->setTickOffset(1);
		//   $c->xAxis->setTitle("Range (miles)", "arialbi.ttf", 12);
			 # Set the axes line width to 3 pixels
		$c->xAxis->setWidth(3);
		$c->yAxis->setWidth(3);
		//for ($k=0;$k<10;$k++){
		
	                     for ($i = 0; $i < count($ar); ++$i) {
						
    $scatterLayerObj = $c->addScatterLayer($col[$i],$ar[$i],$color[$i],CircleSymbol, 15);
	
    $scatterLayerObj->setSymbolScale(array($ar2[$i]));
	
	}
	
	
	  /* $scatterLayerObj = $c->addScatterLayer($col,$ar,CircleSymbol,15);
	   
                          $scatterLayerObj->setSymbolScale($ar2);*/
						  
                   header("Content-type: image/png");
                      print($c->makeChart2(PNG));
 ?>

  Re: color problem on scatter chart
Posted by Peter Kwan on Feb-01-2011 01:08
Hi M_jay,

I suspect the problem you encountered is because the data arrays are not created correctly. The data arrays probably do not contain what you expect.

To see what is being passed to ChartDirector, you may add the following line in your for loop.

$scatterLayerObj->setDataLabelFormat("y={value}");
$scatterLayerObj->setDataLabelStyle("arial.ttf", 8, 0x000000, 90);

The above will print the y-coordinates you are using on top of the data points, so you can see what data your code have passed to ChartDirector.

If the issue is really due to incorrect data in the arrays, please modify your code so that it puts the correct data in the arrays.

If you need further help, please include the chart you obtain with the above code, so I may see the exact data values received by ChartDirector.

Regards
Peter Kwan

  clickable scattter chart problem
Posted by M_jay on Feb-01-2011 16:54
When I click on my each point of a graph I want to load separate graph for each point .There are 26 points in my graph.

How can I do it?

DO I need to use  crackable symbol for points of  my graph?

  Re: clickable scattter chart problem
Posted by M_jay on Feb-01-2011 16:55
When I click on my each point of a graph I want to load separate graph for each point .There are 26 points in my graph.

How can I do it?

DO I need to use  click able symbol for points of  my graph?

  Re: clickable scattter chart problem
Posted by Peter Kwan on Feb-02-2011 00:48
Hi M_jay,

If you want any part of the graph to be clickable, you would need to create a clickable chart. You may refer to the "Clickable Charts" section of the ChartDirector documentation on how to code should be structured.

The handler script for the click can perform anything you like. For example, it can load a separate graph depending on which point is clicked.

Hope this can help.

Regards
Peter Kwan