0

我有三个以$smty1; $thty2; $totaly3文件名“objective_matrix.php”命名的 php 数组。

我想将这三个数组传递给名为 graph2.php 的 Jpgraph 文件,如下所示

<?php
 require_once('/jpgraph-3.5.0b1/src/jpgraph.php');
 require_once('/jpgraph-3.5.0b1/src/jpgraph_bar.php'); 

//In here I will need the arrays $smty1, $thty2, $totaly3


$graph = new Graph(450,200,'auto');    
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->img->SetMargin(40,30,40,40);
$graph->xaxis->SetTickLabels($gDateLocale->GetShortMonth());

$graph->yaxis->title->Set('PPM');
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);

$graph->title->SetFont(FF_FONT1,FS_BOLD);

$bplot1 = new BarPlot($smty1);
$bplot2 = new BarPlot($thty2);
$bplot3 = new BarPlot($totaly3);

$bplot1->SetFillColor("orange");
$bplot2->SetFillColor("brown");
$bplot3->SetFillColor("darkgreen");

$bplot1->SetShadow();
$bplot2->SetShadow();
$bplot3->SetShadow();

$bplot1->SetShadow();
$bplot2->SetShadow();
$bplot3->SetShadow();

$gbarplot = new GroupBarPlot(array($bplot1,$bplot2,$bplot3));
$gbarplot->SetWidth(0.6);
$graph->Add($gbarplot);

$graph->Stroke();
?>

在“objective_matrix.php”中,我使用以下方法绘制图形:
<img style="position:absolute; top:635px" src="graph2.php" />

我尝试使用 URL 方法来传递这些数据,但我不知道如何在那里传递变量。有人能帮帮我吗?

4

1 回答 1

0

您的问题 Harshanii 有一个简短的解决方案。您可以将数组数据($smty1、$thty2、$totaly3)保存在临时数据库中,并在 graph2.php 中调用这些数据。

于 2013-07-25T07:18:30.997 回答