1

I would like to start creating charts with php version 7.3. If I run the following code o similar ones every time I got a blank screen:

$graph=new PHPGraphLib(500,400);
 $data=array("Smith"=>60, "John"=>20, "Paul"=>20);
    $graph->addData($data);
    $graph->setTitle("Purchases");
    $graph->setTextColor("red");
    $graph->createGraph();

Into the forum I read a post where it's suggested to get information at (http://www.ebrueggeman.com/phpgraphlib/documentation/tutorial-mysql-and-phpgraphlib) but this link is not active. Thanks in advance for any help

Valgo54
  • 75
  • 3
  • 2
    Possible duplicate of [PHP's white screen of death](https://stackoverflow.com/questions/1475297/phps-white-screen-of-death) – 04FS Sep 20 '19 at 11:21

1 Answers1

0

reading some posts and after a some tests it's seems the chart , using phpgraplib, can be done only with a called php page.In practice there are two php pages , one is the index.php like the following:

`<?php
if (isset($_POST['button1'])){
    $data = array(12124, 5535, 43373, 22223, 90432, 23332, 15544, 24523, 32778,
   38878, 28787, 33243, 34832, 32302);
?>
<img src="done_chart.php?valore=$data">;
 <?php
}
 ?>
<form action="index.php" method="POST" >
    <input type="submit" name="button1" value="do chart">
</form>
'

and a php called page , named do_chart.php, that produces a chart like the follow:

 <?php
include('lib/phpgraphlib.php');
if (isset($_GET['valore'])){
$data = $_GET['valore'];
}
    $graph = new PHPGraphLib(500, 350);
    $graph->addData($data);
    $graph->setTitle('Widgets Produced');
    $graph->setGradient('red', 'maroon');
    $graph->createGraph();
?>

The above two codes dont work , it's seems the array is not properly passed to do_chart.php. Thanks for any help

Valgo54
  • 75
  • 3