我想用jpgraph創建一個線圖。JPGraph(php)line plot - scale scale的問題
我有一個顯示圖的問題 - 我收到的錯誤信息是:「JPGraph錯誤:25044 =不能使用自動縮放,因爲無法確定y軸的有效最小/最大值(僅空值)。」
我的代碼如下:
<?php // content="text/plain; charset=utf-8"
session_start();
require_once ('../includes/jpgraph/src/jpgraph.php');
require_once ('../includes/jpgraph/src/jpgraph_line.php');
// Some data
$datay1 = $_SESSION['userValues'];
$d = array();
for($i = 0; $i < 30; $i++)
$d[] = date("d", strtotime('-'. $i .' days'));
// Create the Line Graph.
$graph = new Graph(300,250);
$graph->SetScale("textlin");
$theme_class=new UniversalTheme;
$graph->SetTheme($theme_class);
$graph->img->SetAntiAliasing(false);
$graph->title->Set('Your Performance:');
$graph->SetBox(false);
$graph->img->SetAntiAliasing();
$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);
$graph->xgrid->Show();
$graph->xgrid->SetLineStyle("solid");
$graph->xaxis->SetTickLabels($d);
$graph->xgrid->SetColor('#E3E3E3');
// Create the first line
$p1 = new LinePlot($datay1);
$graph->Add($p1);
$p1->SetColor("#6495ED");
$p1->SetLegend('Line 1');
$graph->legend->SetFrameWeight(1);
// Output line
$graph->Stroke();
?>
我想我可能出了毛病分配爲x軸(我想顯示最近30天)的日期。數據通過使用會話進行傳遞並進行測試以確保其中包含實際數據。
感謝