PHP Classes
elePHPant
Icontem

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

Contents

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

$graph = new graph(400,240);

$graph->parameter['path_to_fonts'] = 'fonts/';
$graph->parameter['title'] = 'Stacked Bar Chart. Right Hand Y Axis.';
//$graph->parameter['x_label'] = 'Day of the Week';
$graph->parameter['y_label_right'] = 'Units';
$graph->parameter['y_decimal_right'] = 2;
$graph->parameter['x_grid'] = 'none';
$graph->parameter['x_axis_angle'] = 60;
$graph->parameter['y_min_right'] = 0;
$graph->parameter['y_max_right'] = 10;
$graph->parameter['y_axis_gridlines'] = 11;
$graph->parameter['y_axis_text_right'] = 2; //print a tick every 2nd grid line
$graph->parameter['shadow'] = 'none';
$graph->parameter['legend'] = 'outside-right';
$graph->parameter['legend_offset'] = 5;
$graph->parameter['legend_border'] = 'black';
$graph->parameter['inner_padding'] = 6;

$graph->y_format['alpha'] = array('colour' => 'blue', 'bar' => 'fill', 'legend' => 'Product A', 'bar_size' => 0.4, 'y_axis' =>'right');
$graph->y_format['beta'] = array('colour' => 'red', 'bar' => 'fill', 'legend' => 'Product B', 'bar_size' => 0.2, 'y_axis' =>'right');

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

$graph->y_order = array('alpha', 'beta');

$graph->draw_stack();
?>