I had created combo chart which displays both scatter chart and line chart 
in single chart. i want to display a curved line in this combo chart .For 
now, i had created line(which is not curved). Can i create curved line in 
combo chart ? Is it possible?. here is my code :(data is retrieved from 
Mysql and arrays from PHP).
Can you suggest me necessary correction.

code:


<html>
<head>
<title>Google Charts </title>
   <script type="text/javascript" 
src="https://www.gstatic.com/charts/loader.js";></script>
<script type="text/javascript" src="https://www.google.com/jsapi";></script>






   <script type="text/javascript">


google.load("visualization", "1", {packages:["corechart"], "callback": 
drawChart});
  google.setOnLoadCallback(drawChart);                  
 
<?php
$sql = mysql_connect("localhost","root","");
if(!$sql)
{
    echo "Connection Not Created";
}
$con = mysql_select_db("PRJ");
if(!$sql)
{
    echo "Database Not Connected";
}
$sql = "select * from CF";
$result = mysql_query($sql);

$count=0;
while($row = mysql_fetch_array($result))
{
$a[]=$row['x'];
$b[]=$row['y'];
$count++;
 }
  











$tot=0;
$toty=0;
$xsqtot=0;
$ysqtot=0;
$xytot=0;

for($i=0;$i<$count;$i++)
{
$tot=$tot+$a[$i];
$toty=$toty+$b[$i];
$xpow[]=$a[$i]*$a[$i];
$ypow[]=$b[$i]*$b[$i];
$xsqtot=$xsqtot+$xpow[$i];
$ysqtot=$ysqtot+$ypow[$i];
$product[]=$a[$i]*$b[$i];
$xytot=$xytot+$product[$i];
}
$p=(($tot*$toty)-($count*$xytot))/(($tot*$tot)-($count*$xsqtot));
$q=(($xytot*$tot)-($xsqtot*$toty))/(($tot*$tot)-($count*$xsqtot));

for($i=0;$i<$count;$i++)
{
$cfy[]=($p*$a[$i])+$q;
}
$ct=sizeof($a);






?>

var x=new Array();
<?php 

for($i=0;$i<$count;$i++){

                     echo "x[$i]=".$a[$i].";\n";}
                     
             ?>
var y=new Array();
<?php 

for($i=0;$i<$count;$i++){

                     echo "y[$i]=".$b[$i].";\n";}
                     
             ?>
var z=new Array();
<?php 

for($i=0;$i<$count;$i++){

                     echo "z[$i]=".$cfy[$i].";\n";}
                     
             ?>
function drawChart() 
{
   var data = new google.visualization.DataTable();
   data.addColumn('number', 'independent');
   data.addColumn('number', 'dependent');
   data.addColumn('number', 'Corrected');
        
for(var i=0;i<x.length;i++)
{
   data.addRows([[x[i],y[i],z[i]]]);
}      
   
     var options = {'title':'LAT VS LONG ',
 vAxis: {title: 'Dependent variable (Y)'},
      hAxis: {title: 'Independent variable (X)'},
      'width':550,
      'height':400,

seriesType:'scatter',

 series: {1: {type: 'line'}},
};

      var chart = new 
google.visualization.ComboChart(document.getElementById('chart'));
   chart.draw(data, options);
}

</script>

</head>
<body>
 <div id="chart" style="width: 900px; height: 500px;"></div>

 
</body>
</html>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/9e204cf8-896d-4458-9030-d5016ec0b947%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to