Hi everybody, I am relatively new with jpgraph but quite desperate with the following problem:
I draw an altitude chart from data in a gpx file. I store the altitude-data in an array $elevations for the y-axis and distance-data in $abs_distances for the x-axis. The graph plots correctly, but I can not get rid of the gap between the last value in the array and the right margin of the graph. The gap is variable dependent on the data in $abs_distances.
The graph looks as follows:
This is my jpgraph code:
//-------------------- start jpgraph section -----------------
//Include der JPGraph library
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_line.php');
// create new JpGraph-Diagram
$width=800;
$height=450;
// Create the graph and set a scale.
$graph = new Graph($width,$height);
// Setup the graph
$graph->SetMargin(80,20,0,20);
$graph->title->Set($tourentitel);
$graph->title->SetFont( FF_VERDANA , FS_BOLD , 16);
$graph->subtitle->Set($tourendatum);
$graph->SetScale('linlin');
$graph->xaxis->title->Set('Distanz (km)');
$graph->xaxis->SetColor('blue');
$graph->xaxis->title->SetFont( FF_VERDANA , FS_BOLD , 10);
$graph->yaxis->title->Set('Höhe (m)');
$graph->yaxis->SetColor('blue');
$graph->yaxis->title->SetMargin(25);
$graph->yaxis->title->SetFont( FF_VERDANA , FS_BOLD , 10);
// Create the linear plot
$lineplot=new LinePlot($elevations,$abs_distances);
$lineplot->SetColor("blue");
$lineplot->SetWeight(0);
$lineplot->SetFillGradient('#739560:1.8','darkblue'); //color setting from turqoise to darkblue
// Add the plot to the graph
$graph->Add($lineplot);
// draw and save the jpgraph Diagram as jpg image
$graph->Stroke($altprofiledir.'/tbaltprofile_'.$tourendatum.'.jpg');
//-------------------- end jpgraph section -----------------
Any ideas to solve this? I have tried a lot of different approaches (setting manual ticks, define right margin etc.), but no success. Thanks for any hints. - Chris