Klausos Klausos
Klausos Klausos

Reputation: 16050

JpGraph small demo is not working

I'm going to use JpGraph in my web-project. To do this, I downloaded the library into my project folder and created the following test code:

        <?php
        include ( "jpgraph-3.5.0b1/src/jpgraph.php");
        include ("jpgraph-3.5.0b1/src/jpgraph_gantt.php");

        // A new graph with automatic size
        $graph = new GanttGraph (0,0, "auto");

        //  A new activity on row '0'
        $activity = new GanttBar (0,"Project", "2001-12-21", "2002-02-20");
        $graph->Add( $activity);

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

The error message is:

The image “http://localhost:10088/test/check.php” cannot be displayed, 
because it contains errors.

What's wrong with my code? In fact, it was just copied from here. The only thing I changed was the path to the JpGraph library. So, do I need to import this library in some special way into my project (so far, I've just copied the JpGraph's folder into the project's folder)? I'm using Zend Studio.

Upvotes: 1

Views: 1938

Answers (1)

octern
octern

Reputation: 4868

This can be caused by extra whitespace on the page. Make sure you don't have any spaces or line breaks before your opening <?php tag.

Upvotes: 1

Related Questions