我在使用JpGraph
构建图表方面有一点经验,我从未遇到过这个问题,因为我从未处理过与我目前处理的数字一样大的数字。
问题是超过 99,999 的任何内容都会被推离图表的左侧。我试图通过$graph->SetMargin();
设置保证金无济于事。我已经通过jpgraph.net
上的文档倾注了比我的答案更多的问题。以下是图表返回的示例图像。
http://cnedelcu.blogspot.com.co/2014/10/https-with-nginx-setting-up-ssl.html
简单地说,我很茫然......有人能提供有关如何在左侧获得此边距以正确显示我的图表的见解吗?值得一提的是,我尝试了多种宽度作为实验,一直到10,000 px宽,包括左侧超过300px的边距 - 仍然没有。我错过了什么?
<?php // content="text/plain; charset=utf-8"
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_line.php');
$datay1 = array(50,11000,110000,210000,320000,620000,860000,1200000,1500000,1200000,900000,700000,10000);
$datay3 = array(50,10000,100000,200000,300000,500000,600000,800000,1000000,950000,720000,510000,10000);
// Setup the graph
$graph = new Graph(600,300);
$graph->SetScale("intlin");
$graph->SetMargin(30,15,40,30);
$theme_class=new UniversalTheme;
$graph->SetTheme($theme_class);
$graph->img->SetAntiAliasing(false);
$graph->title->Set('');
$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(array('0','2','3','4','5','6','7','8','9','10','11','12','13'));
$graph->xgrid->SetColor('#E3E3E3');
// Create the first line
$p1 = new LinePlot($datay1);
$graph->Add($p1);
$p1->SetColor("#6495ED");
$p1->SetLegend('To Meet Your Goal');
// Create the second line
$p3 = new LinePlot($datay3);
$graph->Add($p3);
$p3->SetColor("#FF1493");
$p3->SetLegend('Where You Stand');
$graph->legend->SetFrameWeight(0);
// Output
$graph->Stroke();
?>