本文实例讲述了php使用jpgraph绘制简单x-y坐标图的方法。分享给大家供大家参考。具体实现方法如下:
setscale(textlin); //设置刻度样式 $graph->img->setmargin(30,30,80,30); //设置图表边界 $graph->title->set(year to date cost); //设置图表标题 // create the linear plot $lineplot=new lineplot($data); // 创建新的lineplot对象 $lineplot->setlegend(amount(m dollars)); //设置图例文字 $lineplot->setcolor(red); // 设置曲线的颜色 // add the plot to the graph $graph->add($lineplot); //在统计图上绘制曲线 // display the graph $graph->stroke(); //输出图像 ?>
运行后效果图如下:
希望本文所述对大家的php程序设计有所帮助。