Login   Register  
PHP Classes
elePHPant
Icontem

File: test03.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Herman Veluwenkamp  >  Graph Drawing Class 2  >  test03.php  >  Download  
File: test03.php
Role: Example script
Content type: text/plain
Description: Bar, Line, and Point Chart
Class: Graph Drawing Class 2
Class to draw line, point, area, and bar graphs.
Author: By
Last change:
Date: 2001-03-04 20:00
Size: 1,210 bytes
 

Contents

Class file image Download
<?php
include 'graph.php';

$line = new graph(400,240);
$line->parameter['path_to_fonts'] = 'fonts/';
$line->parameter['title']   = 'Bar, Line, and Point Chart';
$line->parameter['x_label'] = 'Day of the Week';
$line->parameter['y_label_left'] = 'Some Data';

$line->x_data          = array('Friday''Monday''Tuesday''Wednesday''Thursday''Friday');

$line->y_data['XYZ40'] = array(8.6107.9403.6703.6706.9408.650);
$line->y_data['ABC10'] = array(1.4563.0015.1452.0501.9981.678);
$line->y_data['DEF20'] = array(4.8964.5004.1903.0502.8883.678);


$line->y_format['XYZ40'] =
  array(
'colour' => 'blue''bar' => 'fill''shadow_offset' => 3);

$line->y_format['ABC10'] =
  array(
'colour' => 'red''point' => 'diamond''point_size' => 12'line' => 'brush''brush_size' => 3'shadow_offset' => 3);

$line->y_format['DEF20'] =
  array(
'colour' => 'green''bar' => 'fill''shadow_offset' => 3);

$line->y_order = array('XYZ40''DEF20''ABC10');

$line->parameter['y_min_left'] = 0;  // start at 0
$line->parameter['y_max_left'] = 10// and go to 10
$line->parameter['y_decimal_left'] = 2// 2 decimal places for y axis.
$line->draw();
?>