PHP Classes
elePHPant
Icontem

File: test_line.php

Recommend this page to a friend!
  Classes of Miran Zagar  >  eBusiness Charts  >  test_line.php  >  Download  
File: test_line.php
Role: Example script
Content type: text/plain
Description: Test script
Class: eBusiness Charts
Wrapper around eBusiness charts generation service
Author: By
Last change: ID Change
Date: 15 years ago
Size: 3,162 bytes
 

Contents

Class file image Download
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Test eB/Charts php class</TITLE>
<style type="text/css">
<!--
  .tbhead { color: #000000; font: 15pt Tahoma, Arial, Helvetica, sans-serif; font-weight: bold }
  .label { color: #000000; font: 8pt Tahoma, Arial, Helvetica, sans-serif; font-weight: bold }
  th { color: #000000; font: 15pt Tahoma, Arial, Helvetica, sans-serif; font-weight: bold }
  td { color: #000000; font: 8pt Tahoma, Arial, Helvetica, sans-serif; font-weight: bold }
-->
</style>

</HEAD>
<BODY>
<?
require_once ("class_ebcharts.php");

//////////////////////////////////////////////////////////////
//
// please change YOUR_ID to ID received after registration
//
// if you do not have your ID please get one from
// http://charts.eb-mon.net
//
////////////////////////////////////////////////////////////////

$labels_a='Jan,Feb,Mar,Apr,Maj,Jun,Jul,Avg,Sep';
$data_a='5,16,8,9,11,11,30,25,33';

$labels=array("first","second","third","fourth","fifth");
$da=array(10,20,30,25,28);
$db=array(11,18,26,21,22);

//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
$a=new chart("YOUR_ID","line",300,150);
$a->add_value_line($da,'aa',1);
$a->add_value_line("9,11,33,26,26",'dd',2);
$a->add_value_line("5,8,22,21,24",'bb');
$a->add_label($labels);
$a->set_bm(17);
$a->draw();
echo
"<HR>";
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
$a=new chart("YOUR_ID","line",700,300);
$a->add_value_line($da,'aa',5);
$a->add_value_line("9,11,33,26,26",'dd',12);
$a->add_value_line("5,8,22,21,24",'bb');
$a->add_label($labels);
//$a->show_symbols(4);
//$a->show_values();
$a->enable_spine();
$a->draw();
echo
"<HR>";


//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
echo "<table>";
echo
"<tr>";
echo
"<td>";
function
get_random($a){ srand( make_seed()); return rand(0, $a);}
function
make_seed() {list($usec, $sec) = explode(' ', microtime());return (float) $sec + ((float) $usec * 100000);}
$dblong=array();
$dblong1=array();
$dblongav=array();
$dblabs=array();
$n=100;
for (
$i=0;$i<$n;$i++) $dblong[]=10+get_random(50);
for (
$i=0;$i<$n;$i++) $dblong1[]=$i+get_random(50);
$avg = round(array_sum($dblong1) / count($dblong1),0);
for (
$i=0;$i<$n;$i++) $dblongav[]=$avg;
for (
$i=0;$i<$n;$i++) {if ($i%30==0) $dblabs[]=$i; else $dblabs[]=''; }

$a=new chart("YOUR_ID","line",700,200);
$a->add_value_line($dblong,'serija 1',0.5);
$a->add_value_line($dblong1,'serija 2',0.7);
$a->add_value_line($dblongav,'Povprečna vrednost serije 2',1.7);
$a->add_label($dblabs);
$a->set_color_table('#3366FF,#00CC00,#FF3366');
$a->set_bm(12);
$a->show_legend();
$a->set_label_class('label');
$a->set_th_class('tbhead');
$a->set_title("TEST chart");
$a->draw();
echo
"</td>";
echo
"</tr>";
echo
"</table>";
?>
</BODY>
</HTML>