PHP Classes

File: samples/plain-php/demo.php

Recommend this page to a friend!
  Classes of Joseluis Laso   PHP Stats Graphs   samples/plain-php/demo.php   Download  
File: samples/plain-php/demo.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Stats Graphs
Generate SVG charts from sample data
Author: By
Last change:
Date: 6 years ago
Size: 802 bytes


Class file image Download

require_once __DIR__.'/../../vendor/autoload.php';

$stats = \JLaso\SimpleStats\Stats::getInstance();

$scatterGraph = new \JLaso\SimpleStats\Graph\Scatter();
$barGraph = new \JLaso\SimpleStats\Graph\Bar();

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
<h1>Example of Simple Stats</h1>
    <?php $scatterGraph->draw('Example scatter', 'clicks,ips', array(0,99999999999), 600, 480); ?>
    <a href="../click.php?data=click_link&redirect=plain-php/<?php echo(basename(__FILE__)); ?>">Click</a>
    <span>&nbsp;count [<?php echo $stats->getCountByData('ips', $stats->getUserIP());?>]</span>
    <?php $barGraph->draw('Example bars', 'logins', array(0,99999999999), 600, 480); ?>