PHP Classes

Cannot display libchart-generated charts on screen

Recommend this page to a friend!

      Libchart  >  All threads  >  Cannot display libchart-generated...  >  (Un) Subscribe thread alerts  
Subject:Cannot display libchart-generated...
Summary:the chart is created in the folder, but not displayed on-screen
Messages:1
Author:Kreshna Aryaguna
Date:2008-06-30 10:39:46
 

  1. Cannot display libchart-generated...   Reply   Report abuse  
Picture of Kreshna Aryaguna Kreshna Aryaguna - 2008-06-30 10:39:47
Please help.

I've been trying libchart in a project named "laporan". I created a sub-folder named "laporan" in "htdocs" (htdocs/laporan). Then I copied the "libchart" folder into my project folder (htdocs/laporan/libchart). And of course, I created a folder named "generated" in my project folder (htdocs/laporan/generated). The "generared" folder is to contain JPG/PNG files generated by libchart.

Up to this point, I think I have been correct.

Thus, I created a file named "barchart.php" in htdocs/laporan. The php file is as follows:
[code]<?php

include "libchart/classes/libchart.php";
$chart = new VerticalBarChart(500, 250);

$dataSet = new XYDataSet();
$dataSet->addPoint(new Point("Jan 2005", 273));
$dataSet->addPoint(new Point("Feb 2005", 321));
$dataSet->addPoint(new Point("March 2005", 442));
$dataSet->addPoint(new Point("April 2005", 711));

$chart->setDataSet($dataSet);

$chart->setTitle("Monthly usage for www.example.com");
$chart->render("generated/demo1.png");

?>[/code]

The php script above has been successful in [b]generating[/b] the PNG file. Yes, there is a file named "demo1.png" in generated folder after I browsed the php page above.

However, the php script above does NOT display the resulted demo1.png --it merely generates the demo1.png inside the generated folder, but it does not display the png.

So if you're willing to pardon a newbie question: what should I do to display the resulted php?