<?php //JPGRAPH 生成X-Y线形统计 require_once("jpgraph/jpgraph.php"); require_once("jpgraph/jpgraph_line.php"); $arrData = array(19, 23, 34, 136, 50, 65, 70, 178); $graph = new Graph($width=400, $height=300); $graph->SetScale("textlin");//设置刻度模式 $graph->SetMargin(30, 30, 80, 30);//设置图表边界 $graph->title->Set("第一个折线图");//设置图表标题 $graph->title->SetFont(FF_SIMSUN, FS_BOLD); //设置中文字体 $lineplot = new LinePlot($arrData); //创建新的LinePlot对象 $lineplot->SetLegend("从风data1");//设置图例文字 $lineplot->SetColor("red");//设置曲线颜色 $graph->Add($lineplot);//在统计图上绘制曲线 $arrData2 = array(20, 30, 145, 23, 45, 69, 60, 79, 280); $lineplot2 = new LinePlot($arrData2); $lineplot2->SetLegend("从风data2");//设置图例文字 $graph->legend->SetFont(FF_SIMSUN, FS_NORMAL); $lineplot2->SetColor("blue");//设置曲线颜色 $graph->Add($lineplot2);//在统计图上绘制曲线 $graph->Stroke();//输出图像 ?>