Hi everyone,

I am currently doing a bar chart but I having an error message of this "Your manually specified scale and ticks is not correct. The scale seems to be too small to hold any of the specified tick marks".

Here's the code:

<?php  

 $gpa11=$_REQUEST['gpa11']; 
 $gpa12=$_REQUEST['gpa12']; 

 $gpa21=$_REQUEST['gpa21']; 
 $gpa22=$_REQUEST['gpa22']; 

 $gpa31=$_REQUEST['gpa31']; 
 $gpa32=$_REQUEST['gpa32']; 

 $gpa41=$_REQUEST['gpa41']; 
 $gpa42=$_REQUEST['gpa42']; 

 $gpa51=$_REQUEST['gpa51']; 
 $gpa52=$_REQUEST['gpa52']; 

?> 

<?php // content="text/plain; charset=utf-8" 
require_once ('jpgraph/jpgraph.php'); 
require_once ('jpgraph/jpgraph_bar.php'); 

$data1y=array($gpa11,$gpa21,$gpa31,$gpa41, $gpa51); 
$data2y=array($gpa12,$gpa22,$gpa32,$gpa42, $gpa52); 



// Create the graph. These two calls are always required 
$graph = new Graph(350,200,'auto'); 
$graph->SetScale("textlin"); 

$theme_class=new UniversalTheme; 
$graph->SetTheme($theme_class); 

$graph->yaxis->SetTickPositions(array(0,30,60,90,120,150), array(15,45,75,105,135)); 
$graph->SetBox(false); 

$graph->ygrid->SetFill(false); 
$graph->xaxis->SetTickLabels(array('Year 1','Year 2','Year 3','Year 4','Year 5')); 
$graph->yaxis->HideLine(false); 
$graph->yaxis->HideTicks(false,false); 

// Create the bar plots 
$b1plot = new BarPlot($data1y); 
$b2plot = new BarPlot($data2y); 

// Create the grouped bar plot 
$gbplot = new GroupBarPlot(array($b1plot,$b2plot)); 
// ...and add it to the graPH 
$graph->Add($gbplot); 


$b1plot->SetColor("white"); 
$b1plot->SetFillColor("#cc1111"); 

$b2plot->SetColor("white"); 
$b2plot->SetFillColor("#11cccc"); 

$graph->title->Set("GPA Performance Graph"); 

// Display the graph 
$graph->Stroke(); 
?>

What should be done to correct the problems? Please advice 😕

    15 days later

    i am only answering this because i see it's gone unanswered. obviously you are using a code library which is great. I'm also assuming the code you show is copied from an example. Try this: could you first copy an example over that works, EXACTLY as provided, and verify that it works. Then modify incrementally untill you experience this or another error on the way there.

    then, reply or re-post with a description of this.

    this makes it easier for folks to debug (not to mentiion you learning something). Vs. posting a code block like this and just asking "why does this not work?" hope that sounds sensible and reasonable.

    sam

      Write a Reply...