Chen Jin Yan Chen Jin Yan - 10 months ago 81
PHP Question

The "jpgraph" not working, without errors in html

This is my PHP code:

require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_bar.php');


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

$theme_class=new UniversalTheme;

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


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

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




$graph->title->Set("Bar Plots");

// Display the graph

Reference: JpGraph Example - Chart

This is my HTML:


There is no error message on screen. Browser's console is empty as well.

What could be wrong? Do I need to set up something?

I have tried this link: jpgraph doesn't work but without success.


make sure you have at least minimal "installation" of jpgraph, this is what needs to be (at least) in your root:


also be sure to have GD library enabled, if you can't access filesystem, turn off USE_CACHE in jpg-config.

as I wrote in comment, your code works fine with default installation (means I just extracted files listed above, added your code to chart.php in root and I get the image of 3 bars in 4 groups ..

EDIT: additionally, check troubleshooting tips in their docs and this SO topic, which is related to your problem too