Php JpGraph LINEPROOT输出在使用SetScale时超出图形区域
我用它来绘制一些数据。当我使用SetScale函数强制y轴范围时,输出视觉上溢出图形区域。我想将输出裁剪到图形区域Php JpGraph LINEPROOT输出在使用SetScale时超出图形区域,php,graphing,jpgraph,Php,Graphing,Jpgraph,我用它来绘制一些数据。当我使用SetScale函数强制y轴范围时,输出视觉上溢出图形区域。我想将输出裁剪到图形区域 <?php require_once ('include/jpgraph/jpgraph.php'); require_once ('include/jpgraph/jpgraph_line.php'); $datay1 = array(20,7,16,46,90,5,0,5,95); // Setup the graph $graph = new Graph(400,
<?php
require_once ('include/jpgraph/jpgraph.php');
require_once ('include/jpgraph/jpgraph_line.php');
$datay1 = array(20,7,16,46,90,5,0,5,95);
// Setup the graph
$graph = new Graph(400,300);
$graph->title->Set('Graph Title');
$graph->title->font_size = 20;
$graph->SetScale("textlin",20,50);
//this version works but does not set the y-axis scale
//$graph->SetScale("textlin");
$p1 = new LinePlot($datay1);
$graph->Add($p1);
// Output line
$graph->Stroke();
?>
这是当前输出:这是所需的输出(由Excel呈现):
$myMaxY=50//您需要根据需要设置Y Max
$length=计数($datay1);
对于($i=0;$i<$lenght;$i++)
{
如果($datay1[$i]>$myMaxY)
$datay1[$i]=$myMaxY;
}
$graph->SetScale(“textlin”,20,$myMaxY)//别忘了换这个
我与JpGraph背后的公司取得了联系,他们能够提供帮助。缺少的选项是:
$graph->setClipping(true);
我希望这能帮助其他可能有类似问题的人。我已经调查过了,但找不到答案,所以+1'ed。我现在也很好奇。
$graph->setClipping(true);