如何在PHP中创建钟形曲线图

Tat*_*ata 2 php probability

http://support.microsoft.com/kb/213930显示"如何创建钟形曲线图".我需要使用尽可能接近php的东西来自动执行此操作.真的很感激,如果有人可以指向我的某些图书馆/ api等,这将使这个变得容易...

Lut*_*ski 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();

?>
Run Code Online (Sandbox Code Playgroud)