PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
  Classes of Gianluca Zanferrari  >  PHP Graph Real Time  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example
Class: PHP Graph Real Time
Display graphs of machine usage in real time
Author: By
Last change:
Date: 4 years ago
Size: 1,195 bytes
 

Contents

Class file image Download
<!DOCTYPE HTML>
<html>
<head>
    <script src="jquery.min.js"></script>
    <script src="highcharts.js"></script>
</head>
<body>
<?php
require_once('realtime_graph.class.php');

$mon = new realtime_graph(); // initiates the class

$mon->new_container('mem_usage'); // initiates the mem_usage graph

$mon->set_interval(5000); // I set the time interval of measurement to 5 secs

$mon->draw(); // shows the graph in browser

$mon->new_container('used_space'); // initiates the used_space graph

$mon->set_interval(10000); // I set the time interval of measurement to 10 secs

$data = $mon->draw(FALSE); // I store the data in a var for showing it as last graph (usefull for placing graphs in a templete)

$mon->new_container('num_threads'); // initiates the num_threads graph

$mon->set_interval(7000); // I set the time interval of measurement to 7 secs

$mon->draw(); // shows the graph in browser

$mon->new_container('num_users'); // initiates the num_users graph

$mon->set_interval(15000); // I set the time interval of measurement to 15 secs

$mon->draw(); // shows the graph in browser

echo($data); // I show here the 'used_space' graph
?>
</body>
</html>