2011-10-23 26 views
2

http://support.microsoft.com/kb/213930显示“如何创建钟形曲线图”。我需要使用尽可能接近php的东西来自动执行此操作。真的很感激,如果有人能指出我的一些库/ API等也许会让这个容易...如何在PHP中创建钟形曲线图

+0

见:本[问题&答案](http://stackoverflow.com/questions/4304765/how-to-generate -a-cumulative-normal-distribution-in-php) – ObscureRobot

+0

那么一个普通的模型将是一个静态图像,其中假设它是完全正常的,而曲线的中心是平均值,每个部分(分别为68% 95%,当然是99.7%)只是远离平均值的另一个标准偏差。使用GD库添加您的标签:http://php.net/manual/en/book.image.php – Cyclone

回答

6

如果你不想与GD库,使图表直接,你可以考虑: jpgraphlibchart

我以前使用过libchart,但从未做过钟形曲线。

这里是jpgraph的一个例子,使一个类型的钟形曲线的:

<?php 
include ("jpgraph/jpgraph.php"); 
include ("jpgraph/jpgraph_bar.php"); 
$databary = array(); 
for ($i=0; $i<32*12; ++$i) 
{ 
    $databary[$i] = 0; 
} 
for ($i=0; $i<100000; ++$i) 
{ 
    $data = rand(0,31)+rand(0,31)+rand(0,31)+rand(0,31)+rand(0,31)+rand(0,31)+rand(0,31)+rand(0,31)+rand(0,31)+rand(0,31)+rand(0,31)+rand(0,31); 
    $databary[$data] += 1; 
} 
$graph = new Graph(1024,768,'auto'); 
$graph->SetShadow(); 
$graph->SetScale("textlin"); 
$graph->title->Set("Elementary barplot with a text scale"); 
$graph->title->SetFont(FF_FONT1,FS_BOLD); 
$b1 = new BarPlot($databary); 
$b1->SetLegend("Temperature"); 
$graph->Add($b1); 
$graph->Stroke(); 

?> 
+0

甜...我认为jpgraph将只为我吃饭。谢谢! – Tathagata