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

发布于 2024-12-11 07:28:16 字数 196 浏览 0 评论 0原文

http://support.microsoft.com/kb/213930 显示“如何创建钟形曲线图表”。我需要使用尽可能接近 php 的东西来自动化此操作。如果有人可以向我指出一些库/API 等,这将使这变得容易,我将非常感激......

http://support.microsoft.com/kb/213930 shows "How to Create a Bell Curve Chart". I need to automate this with something that is as close to php as possible. Would really appreciate if someone can point me to some library/api etc that'll make this easy ...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

空宴 2024-12-18 07:28:16

如果您不想直接使用 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();

?>

If you do not want to make the chart directly with the GD library you could consider:
jpgraph and libchart.

I have used libchart before, but never to make a bell curve.

Here is an example in jpgraph that makes a type of bell curve:

<?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();

?>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文