//调用方法:<image src=../../"chart.php">
//chart.php为本文文件名
<?
/*
把角度转换为弧度
*/
function radians ($degrees)
{
return($degrees * (pi()/180.0));
}
/*
** 取得在圆心为(0,0)圆上 x,y点的值
*/
function circle_point($degrees, $diameter)
{
$x = cos(radians($degrees)) * ($diameter/2);
$y = sin(radians($degrees)) * ($diameter/2);
return (array($x, $y));
}
// 填充图表的参数
$chartdiameter = 200; //图表直径
$chartfont = 2; //图表字体
$chartfontheight = imagefontheight($chartfont);//图表字体的大小
require('mysql.php3');
$sql=new mysql_class;
$sql->create('star');
$sql->query("select * from serch where answer='富士通常昊 九段'");
$record1=$sql->rows;
$sql->query("select * from serch where answer='富士通曹薰铉 九段'");
$record2=$sql->rows;
$chartdata = array( $record1,$record2);//用于生成图表的数据,可通过数据库来取得来确定
//$chartlabel = array("常昊九段", "曹薰铉九段"); //数据对应的名称
//确定图形的大小
$chartwidth = $chartdiameter + 20;
$chartheight = $chartdiameter + 20 +
(($chartfontheight + 2) * count($chartdata));
//确定统计的总数
for($index = 0; $index < count($chartdata); $index++)
{
$charttotal += $chartdata[$index];
}
$chartcenterx = $chartdiameter/2 + 10;
| 对此文章发表了评论 |
