Login   Register  
PHP Classes
elePHPant
Icontem

File: test07.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  >  test07.php  >  Download  
File: test07.php
Role: Example script
Content type: text/plain
Description: Zero-Axis Bar Chart
Class: Graph Drawing Class 2
Class to draw line, point, area, and bar graphs.
Author: By
Last change:
Date: 13 years ago
Size: 1,714 bytes
 

Contents

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

$graph = new graph(400,240);
$graph->parameter['path_to_fonts'] = 'fonts/'// path to where fonts are stored
$graph->parameter['title']   = 'Zero-Axis Bar Chart';
//$graph->parameter['x_label'] = 'Day of the Week';
$graph->parameter['y_label'] = 'Offset';

$graph->x_data                 = array('Fri''Mon''Tue''Wed''Thu''Fri');
$graph->y_data['alpha']        = array(2, -1,  3,  5,  8,  9);
$graph->y_data['beta']         = array(32,   -4,  -3,  1,  5);

//$graph->y_data['beta'] = array(3, 2,   0,  0,  0,  5);

// format for each data set
$graph->y_format['alpha']             =  array('colour' => 'blue''bar' => 'fill');
$graph->y_format['beta']              =  array('colour' => 'red',  'bar' => 'fill');

$graph->parameter['shadow']           = 'grayCC'// set default shadow for all data sets.
$graph->parameter['bar_size']         = 0.9;
$graph->parameter['bar_spacing']      = 30;

$graph->parameter['y_min_left']       = -4;
$graph->parameter['y_max_left']       = 10;
$graph->parameter['y_decimal_left']   = 0;
$graph->parameter['y_axis_gridlines'] = 15;

$graph->parameter['x_axis_angle']      =  60;

$graph->parameter['x_ticks_colour']   = 'none'// no x ticks (colour = 'none')
$graph->parameter['y_ticks_colour']   = 'none'// no y ticks (colour = 'none')

$graph->parameter['zero_axis']        = 'black';
$graph->parameter['inner_border_type']= 'y-left'// only draw left y axis as zero axis already selected above.

$graph->parameter['y_label_rot']     = 60// rotate y_label text.

$graph->y_order = array('alpha''beta');
//$graph->y_order = array('beta');
$graph->draw();
//$graph->draw_stack();


?>